<commit_before>/obj/effect/proc_holder/spell/targeted/charge
	name = "Charge"
	desc = "This spell can be used to recharge a variety of things in your hands, from magical artifacts to electrical components. A creative wizard can even use it to grant magical power to a fellow magic user."

	school = "transmutation"
	charge_max = 600
	clothes_req = 0
	invocation = "DIRI CEL"
	invocation_type = "whisper"
	range = -1
	cooldown_min = 400 //50 deciseconds reduction per rank
	include_user = 1


/obj/effect/proc_holder/spell/targeted/charge/cast(list/targets,mob/user = usr)
	for(var/mob/living/L in targets)
		var/list/hand_items = list(L.get_active_hand(),L.get_inactive_hand())
		var/charged_item = null
		var/burnt_out = 0
		for(var/obj/item in hand_items)
			if(istype(item, /obj/item/weapon/grab))
				var/obj/item/weapon/grab/G = item
				if(G.affecting)
					var/mob/M = G.affecting
					if(M.mob_spell_list.len != 0 || (M.mind && M.mind.spell_list.len != 0))
						for(var/obj/effect/proc_holder/spell/S in M.mob_spell_list)
							S.charge_counter = S.charge_max
						if(M.mind)
							for(var/obj/effect/proc_holder/spell/S in M.mind.spell_list)
								S.charge_counter = S.charge_max
						M <<"<span class='notice'>you feel raw magic flowing through you, it feels good!</span>"
					else
						M <<"<span class='notice'>you feel very strange for a moment, but then it passes.</span>"
						burnt_out = 1
					charged_item = M
					break
			else if(istype(item, /obj/item/weapon/spellbook))
				if(istype(item, /obj/item/weapon/spellbook/oneuse))
					var/obj/item/weapon/spellbook/oneuse/I = item
					if(prob(80))
						L.visible_message("<span class='warning'>[I] catches fire!</span>")
						qdel(I)
					else
						I.used = 0
						charged_item = I
						break
				else
					L << "<span class='caution'>Glowing red letters appear on the front cover...</span>"
					L << "<span class='warning'>[pick("NICE TRY BUT NO!","CLEVER BUT NOT CLEVER ENOUGH!", "SUCH FLAGRANT CHEESING IS WHY WE ACCEPTED YOUR APPLICATION!", "CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?")]</span>"
					burnt_out = 1
			else if(istype(item, /obj/item/weapon/gun/magic))<commit_msg>Removes grab from Charge spell<commit_after>/obj/effect/proc_holder/spell/targeted/charge
	name = "Charge"
	desc = "This spell can be used to recharge a variety of things in your hands, from magical artifacts to electrical components. A creative wizard can even use it to grant magical power to a fellow magic user."

	school = "transmutation"
	charge_max = 600
	clothes_req = 0
	invocation = "DIRI CEL"
	invocation_type = "whisper"
	range = -1
	cooldown_min = 400 //50 deciseconds reduction per rank
	include_user = 1


/obj/effect/proc_holder/spell/targeted/charge/cast(list/targets,mob/user = usr)
	for(var/mob/living/L in targets)
		var/list/hand_items = list(L.get_active_hand(),L.get_inactive_hand())
		var/charged_item = null
		var/burnt_out = 0

		if(L.pulling && (istype(L.pulling, /mob/living)))
			var/mob/living/M =	L.pulling
			if(M.mob_spell_list.len != 0 || (M.mind && M.mind.spell_list.len != 0))
				for(var/obj/effect/proc_holder/spell/S in M.mob_spell_list)
					S.charge_counter = S.charge_max
				if(M.mind)
					for(var/obj/effect/proc_holder/spell/S in M.mind.spell_list)
						S.charge_counter = S.charge_max
				M <<"<span class='notice'>you feel raw magic flowing through you, it feels good!</span>"
			else
				M <<"<span class='notice'>you feel very strange for a moment, but then it passes.</span>"
				burnt_out = 1
			charged_item = M
			break
		for(var/obj/item in hand_items)
			if(istype(item, /obj/item/weapon/spellbook))
				if(istype(item, /obj/item/weapon/spellbook/oneuse))
					var/obj/item/weapon/spellbook/oneuse/I = item
					if(prob(80))
						L.visible_message("<span class='warning'>[I] catches fire!</span>")
						qdel(I)
					else
						I.used = 0
						charged_item = I
						break
				else
					L << "<span class='caution'>Glowing red letters appear on the front cover...</span>"
					L << "<span class='warning'>[pick("NICE TRY BUT NO!","CLEVER BUT NOT CLEVER ENOUGH!", "SUCH FLAGRANT CHEESING IS WHY WE ACCEPTED YOUR APPLICATION!", "CUTE!", "YOU DIDN'T THINK IT'D BE THAT EASY, DID YOU?")]</span>"
					burnt_out = 1
			else if(istype(item, /obj/item/weapon/gun/magic))
{'fraction_non_alphanumeric': 0.13113229481515926, 'fraction_numerical': 0.008835154615205766, 'mean_word_length': 3.4123076923076923, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6019704', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1542, 'n_words': 388}