Refactors liches a bit (#25104)

* totally not breaking shit

* yes
This commit is contained in:
Contrabang
2024-04-19 14:05:44 -04:00
committed by GitHub
parent 24aadc9212
commit 7dcc7d41f2
3 changed files with 13 additions and 48 deletions
-33
View File
@@ -13,22 +13,12 @@
var/marked_item_uid
var/mob/living/current_body
var/resurrections = 0
var/existence_stops_round_end = FALSE
action_icon_state = "skeleton"
/datum/spell/lichdom/create_new_targeting()
return new /datum/spell_targeting/self
/datum/spell/lichdom/Destroy()
for(var/datum/mind/M in SSticker.mode.wizards) //Make sure no other bones are about
for(var/datum/spell/S in M.spell_list)
if(istype(S,/datum/spell/lichdom) && S != src)
return ..()
if(existence_stops_round_end)
GLOB.configuration.gamemode.disable_certain_round_early_end = FALSE
return ..()
/datum/spell/lichdom/cast(list/targets, mob/user = usr)
for(var/mob/M in targets)
if(stat_allowed)
@@ -89,7 +79,6 @@
lich.Weaken(stun_time)
user.mind.transfer_to(lich)
equip_lich(lich)
RegisterSignal(lich, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
current_body = lich
cooldown_handler.recharge_duration += 1 MINUTES
@@ -134,13 +123,8 @@
H.unEquip(H.head)
equip_lich(H)
RegisterSignal(target, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
RegisterSignal(current_body, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED), PROC_REF(check_revivability_handler))
to_chat(user, "<span class='userdanger'>With a hideous feeling of emptiness you watch in horrified fascination as skin sloughs off bone! Blood boils, nerves disintegrate, eyes boil in their sockets! As your organs crumble to dust in your fleshless chest you come to terms with your choice. You're a lich!</span>")
existence_stops_round_end = TRUE
GLOB.configuration.gamemode.disable_certain_round_early_end = TRUE
/datum/spell/lichdom/proc/is_revive_possible()
var/obj/item/marked_item = locateUID(marked_item_uid)
if(QDELETED(marked_item))
@@ -153,23 +137,6 @@
return FALSE
return TRUE
/datum/spell/lichdom/proc/check_revivability_handler()
SIGNAL_HANDLER
// There are other liches about, so round may still continue
for(var/datum/mind/M in SSticker.mode.wizards)
for(var/datum/spell/lichdom/S in M.spell_list)
if(S == src)
continue
// Other lich can still revive
if(S.is_revive_possible())
return
// Other lich is still alive
if(!QDELETED(S.current_body) && S.current_body.stat != DEAD)
return
GLOB.configuration.gamemode.disable_certain_round_early_end = is_revive_possible()
/datum/spell/lichdom/proc/equip_lich(mob/living/carbon/human/H)
H.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe/black(H), SLOT_HUD_OUTER_SUIT)
H.equip_to_slot_or_del(new /obj/item/clothing/head/wizard/black(H), SLOT_HUD_HEAD)
+5 -15
View File
@@ -45,21 +45,11 @@
if(but_wait_theres_more)
return ..()
// Wizards
for(var/datum/mind/wizard in wizards)
if(!iscarbon(wizard.current) || wizard.current.stat == DEAD) // wizard is in an MMI, don't count them as alive
continue
return ..()
// Apprentices
for(var/datum/mind/apprentice in apprentices)
if(!iscarbon(apprentice.current))
continue
if(apprentice.current.stat == DEAD)
continue
if(istype(apprentice.current, /obj/item/mmi)) // apprentice is in an MMI, don't count them as alive
continue
return ..()
// Wizards and Apprentices
for(var/datum/mind/wizard in (wizards + apprentices)) // yes, this works so it iterates through wizards, then apprentices
var/datum/antagonist/wizard/datum_wizard = wizard.has_antag_datum(/datum/antagonist/wizard)
if(datum_wizard?.wizard_is_alive())
return ..()
finished = TRUE
return TRUE
@@ -116,3 +116,11 @@
/datum/antagonist/wizard/proc/full_on_wizard()
return TRUE
/datum/antagonist/wizard/proc/wizard_is_alive() // fun fact did you know underscore make proc calls slower?
for(var/datum/spell/lichdom/S in owner.spell_list)
if(S.is_revive_possible()) // This must occur before the == DEAD check
return TRUE
if(!iscarbon(owner.current) || owner.current.stat == DEAD)
return FALSE
return TRUE