Skip to content

Commit

Permalink
Update absorb.dm (#36699)
Browse files Browse the repository at this point in the history
  • Loading branch information
boy2mantwicethefam authored Jun 25, 2024
1 parent 61a9ca5 commit 331cf84
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions code/modules/spells/targeted/absorb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,49 @@
else if(isapprentice(target)) //So wizards with absorb don't abuse their own apprentices for double spells
to_chat(holder, "<span class='warning'>Only a fool would steal magic from an apprentice.</span>")
else
var/has_spell_to_steal = FALSE //If false, will not go through the do_after()
for(var/spell/targetspell in C.spell_list)
if(targetspell.is_wizard_spell())
has_spell_to_steal = TRUE
break
if(!has_spell_to_steal)
to_chat(holder, "<span class='warning'>The target has no spells that you can steal!</span>")
return
var/obj/effect/absorb_effect/E = new (holder.loc, holder)
if(do_after(holder, target, 5 SECONDS, use_user_turf = TRUE))
qdel(E)
var/hasAbsorbed = FALSE
var/canAbsorb = TRUE
for(var/spell/targetspell in C.spell_list)
if(!targetspell.is_wizard_spell()) //Not a wizard spell, disregard
continue
canAbsorb = TRUE
var/consumed_spell = FALSE //If consumed, will not give the absorber a new spell.
for(var/spell/holderspell in L.spell_list)
if(!holderspell.is_wizard_spell())
continue
if(targetspell.type == holderspell.type)
canAbsorb = FALSE
/* if(holderspell.can_improve(Sp_POWER))
to_chat(holder, "<span class='notice'>You asborb the magical energies from your foe and have empowered [targetspell.name]!</span>")
if(holderspell.can_improve(Sp_POWER)) //Prioritize empowerments over cooldown upgrades
to_chat(holder, "<span class='notice'>You absorb the magical energies from your foe and have empowered [targetspell.name]!</span>")
holderspell.apply_upgrade(Sp_POWER)
hasAbsorbed = TRUE
if(holderspell.can_improve(Sp_SPEED))
to_chat(holder, "<span class='notice'>You asborb the magical energies from your foe and have quickened [targetspell.name]!</span>")
consumed_spell = TRUE
else if(holderspell.can_improve(Sp_SPEED))
to_chat(holder, "<span class='notice'>You absorb the magical energies from your foe and have quickened [targetspell.name]!</span>")
holderspell.apply_upgrade(Sp_SPEED)
hasAbsorbed = TRUE */
hasAbsorbed = TRUE
consumed_spell = TRUE
if(canAbsorb)
to_chat(target, "<span class='warning'>You feel the magical energy being drained from you!</span>")
to_chat(target, "<span class='warning'>You forget how to cast [targetspell.name]!</span>")
to_chat(holder, "<span class='notice'>You absorb the magical energies from your foe and have learned [targetspell.name]!</span>")
if(!consumed_spell)
to_chat(holder, "<span class='notice'>You absorb the magical energies from your foe and have learned [targetspell.name]!</span>")
L.attack_log += text("\[[time_stamp()] <font color='orange'>[L.real_name] ([L.ckey]) absorbed the spell [targetspell.name] from [C.real_name] ([C.ckey]).</font>")
var/wizard_user = iswizard(L) //Wizards will steal and store it in their wizard spells
C.remove_spell(targetspell)
L.add_spell(targetspell, iswizard = wizard_user)
if(!consumed_spell)
L.add_spell(targetspell, iswizard = wizard_user)
if(!hasAbsorbed)
hasAbsorbed = TRUE
update_wizard_role_spells(targetspell, L, C)
Expand Down

0 comments on commit 331cf84

Please sign in to comment.