Skip to content

Commit

Permalink
Merge pull request #1130 from crix870/decaps
Browse files Browse the repository at this point in the history
Lich respawn issue
  • Loading branch information
Lutowski authored Dec 31, 2024
2 parents 283854d + 48088c3 commit 8c16958
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 59 deletions.
202 changes: 144 additions & 58 deletions code/modules/antagonists/roguetown/villain/lich.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,32 @@
var/list/phylacteries = list()
var/out_of_lives = FALSE

var/traits_lich = list(
TRAIT_NOROGSTAM,
TRAIT_NOHUNGER,
TRAIT_NOBREATH,
TRAIT_NOPAIN,
TRAIT_TOXIMMUNE,
TRAIT_STEELHEARTED,
TRAIT_NOSLEEP,
TRAIT_VAMPMANSION,
TRAIT_NOMOOD,
TRAIT_NOLIMBDISABLE,
TRAIT_SHOCKIMMUNE,
TRAIT_LIMBATTACHMENT,
TRAIT_SEEPRICES,
TRAIT_CRITICAL_RESISTANCE,
TRAIT_HEAVYARMOR,
TRAIT_CABAL,
TRAIT_DEATHSIGHT
)

var/STASTR = 10
var/STASPD = 10
var/STAINT = 10
var/STAEND = 10
var/STAPER = 10

/datum/antagonist/lich/on_gain()
var/datum/game_mode/C = SSticker.mode
C.liches |= owner
Expand All @@ -20,13 +46,29 @@
skele_look()
equip_lich()
greet()
save_stats()

return ..()

/datum/antagonist/lich/greet()
to_chat(owner.current, span_userdanger("The secret of immortality is mine, but this is not enough. The Azurean lands need a new ruler. One that will reign eternal."))
owner.announce_objectives()
..()

/datum/antagonist/lich/proc/save_stats()
STASTR = owner.current.STASTR
STAPER = owner.current.STAPER
STAINT = owner.current.STAINT
STASPD = owner.current.STASPD
STAEND = owner.current.STAEND

/datum/antagonist/lich/proc/set_stats()
owner.current.STASTR = src.STASTR
owner.current.STAPER = src.STAPER
owner.current.STAINT = src.STAINT
owner.current.STASPD = src.STASPD
owner.current.STAEND = src.STAEND

/datum/antagonist/lich/proc/skele_look()
var/mob/living/carbon/human/L = owner.current
L.hairstyle = "Bald"
Expand All @@ -37,57 +79,31 @@

/datum/antagonist/lich/proc/equip_lich()
owner.unknow_all_people()
for(var/datum/mind/MF in get_minds())
for (var/datum/mind/MF in get_minds())
owner.become_unknown_to(MF)

var/mob/living/carbon/human/L = owner.current
ADD_TRAIT(L, TRAIT_NOROGSTAM, "[type]")
ADD_TRAIT(L, TRAIT_NOHUNGER, "[type]")
ADD_TRAIT(L, TRAIT_NOBREATH, "[type]")
ADD_TRAIT(L, TRAIT_NOPAIN, "[type]")
ADD_TRAIT(L, TRAIT_TOXIMMUNE, "[type]")
ADD_TRAIT(L, TRAIT_STEELHEARTED, "[type]")
ADD_TRAIT(L, TRAIT_NOSLEEP, "[type]")
ADD_TRAIT(L, TRAIT_VAMPMANSION, "[type]")
ADD_TRAIT(L, TRAIT_NOMOOD, "[type]")
ADD_TRAIT(L, TRAIT_NOLIMBDISABLE, "[type]")
ADD_TRAIT(L, TRAIT_SHOCKIMMUNE, "[type]")
ADD_TRAIT(L, TRAIT_LIMBATTACHMENT, "[type]")
ADD_TRAIT(L, TRAIT_SEEPRICES, "[type]")
ADD_TRAIT(L, TRAIT_CRITICAL_RESISTANCE, "[type]")
ADD_TRAIT(L, TRAIT_HEAVYARMOR, "[type]")
ADD_TRAIT(L, TRAIT_CABAL, "[type]")
ADD_TRAIT(L, TRAIT_DEATHSIGHT, "[type]")

L.cmode_music = 'sound/music/combat_cult.ogg'
L.faction = list("undead")
if(L.charflaw)

if (L.charflaw)
QDEL_NULL(L.charflaw)

L.mob_biotypes |= MOB_UNDEAD
var/obj/item/organ/eyes/eyes = L.getorganslot(ORGAN_SLOT_EYES)
if(eyes)
eyes.Remove(L,1)
QDEL_NULL(eyes)
eyes = new /obj/item/organ/eyes/night_vision/zombie
eyes.Insert(L)
for(var/obj/item/bodypart/B in L.bodyparts)
replace_eyes(L)

for (var/obj/item/bodypart/B in L.bodyparts)
B.skeletonize(FALSE)

equip_and_traits()
L.equipOutfit(/datum/outfit/job/roguetown/lich)

L.set_patron(/datum/patron/inhumen/zizo)

/datum/outfit/job/roguetown/lich/pre_equip(mob/living/carbon/human/H)

/datum/outfit/job/roguetown/lich/pre_equip(mob/living/carbon/human/H) //Equipment is located below
..()
pants = /obj/item/clothing/under/roguetown/chainlegs
shoes = /obj/item/clothing/shoes/roguetown/boots
neck = /obj/item/clothing/neck/roguetown/chaincoif
cloak = /obj/item/clothing/cloak/raincloak/mortus
armor = /obj/item/clothing/suit/roguetown/armor/blacksteel/cuirass
shirt = /obj/item/clothing/suit/roguetown/shirt/tunic/ucolored
wrists = /obj/item/clothing/wrists/roguetown/bracers
gloves = /obj/item/clothing/gloves/roguetown/chain
belt = /obj/item/storage/belt/rogue/leather/black
backl = /obj/item/storage/backpack/rogue/satchel
beltr = /obj/item/reagent_containers/glass/bottle/rogue/manapot
beltl = /obj/item/rogueweapon/huntingknife/idagger/steel
r_hand = /obj/item/rogueweapon/woodstaff/wise

H.mind.adjust_skillrank(/datum/skill/misc/reading, 6, TRUE)
H.mind.adjust_skillrank(/datum/skill/misc/alchemy, 5, TRUE)
Expand Down Expand Up @@ -122,6 +138,14 @@

addtimer(CALLBACK(H, TYPE_PROC_REF(/mob/living/carbon/human, choose_name_popup), "LICH"), 5 SECONDS)

/datum/antagonist/lich/proc/replace_eyes(mob/living/carbon/human/L)
var/obj/item/organ/eyes/eyes = L.getorganslot(ORGAN_SLOT_EYES)
if (eyes)
eyes.Remove(L, TRUE)
QDEL_NULL(eyes)
eyes = new /obj/item/organ/eyes/night_vision/zombie
eyes.Insert(L)

/datum/outfit/job/roguetown/lich/post_equip(mob/living/carbon/human/H)
..()
var/datum/antagonist/lich/lichman = H.mind.has_antag_datum(/datum/antagonist/lich)
Expand All @@ -132,28 +156,89 @@
H.equip_to_slot_or_del(new_phylactery,SLOT_IN_BACKPACK, TRUE)

/datum/antagonist/lich/proc/consume_phylactery(timer = 10 SECONDS)
for(var/obj/item/phylactery/phyl in phylacteries)
phyl.be_consumed(timer)
phylacteries -= phyl
return TRUE
if(phylacteries.len == 0)
return FALSE
else
for(var/obj/item/phylactery/phyl in phylacteries)
phyl.be_consumed(timer)
phylacteries -= phyl
return TRUE


///Called post death to equip new body with armour and stats. Order of equipment matters
/datum/antagonist/lich/proc/equip_and_traits()
var/mob/living/carbon/human/body = owner.current
var/list/equipment_slots = list(
SLOT_PANTS,
SLOT_SHOES,
SLOT_NECK,
SLOT_CLOAK,
SLOT_ARMOR,
SLOT_SHIRT,
SLOT_WRISTS,
SLOT_GLOVES,
SLOT_BELT,
SLOT_BELT_R,
SLOT_BELT_L,
SLOT_HANDS,
SLOT_BACK_L,
)

var/list/equipment_items = list(
/obj/item/clothing/under/roguetown/chainlegs,
/obj/item/clothing/shoes/roguetown/boots,
/obj/item/clothing/neck/roguetown/chaincoif,
/obj/item/clothing/cloak/raincloak/mortus,
/obj/item/clothing/suit/roguetown/armor/blacksteel/cuirass,
/obj/item/clothing/suit/roguetown/shirt/tunic/ucolored,
/obj/item/clothing/wrists/roguetown/bracers,
/obj/item/clothing/gloves/roguetown/chain,
/obj/item/storage/belt/rogue/leather/black,
/obj/item/reagent_containers/glass/bottle/rogue/manapot,
/obj/item/rogueweapon/huntingknife/idagger/steel,
/obj/item/rogueweapon/woodstaff/wise,
/obj/item/storage/backpack/rogue/satchel,
)
for (var/i = 1, i <= equipment_slots.len, i++)
var/slot = equipment_slots[i]
var/item_type = equipment_items[i]
body.equip_to_slot_or_del(new item_type, slot, TRUE)

for (var/trait in traits_lich)
ADD_TRAIT(body, trait, "[type]")

/datum/antagonist/lich/proc/rise_anew()
var/mob/living/carbon/human/bigbad = owner.current
bigbad.revive(TRUE, TRUE)
if (!owner.current.mind)
CRASH("Lich: rise_anew called with no mind")

var/mob/living/carbon/human/old_body = owner.current
var/turf/phylactery_turf = get_turf(old_body)
var/mob/living/carbon/human/new_body = new /mob/living/carbon/human/species/human/northern(phylactery_turf)

old_body.mind.transfer_to(new_body)

if (new_body.charflaw)
QDEL_NULL(new_body.charflaw)

new_body.real_name = old_body.name
new_body.dna.real_name = old_body.real_name
new_body.mob_biotypes |= MOB_UNDEAD
new_body.set_patron(/datum/patron/inhumen/zizo)
new_body.mind.grab_ghost(force = TRUE)

for (var/obj/item/bodypart/body_part in new_body.bodyparts)
body_part.skeletonize(FALSE)

replace_eyes(new_body)
set_stats()
skele_look()
equip_and_traits()

// Delete the old body if it still exists
if (!QDELETED(old_body))
qdel(old_body)

for(var/obj/item/bodypart/B in bigbad.bodyparts)
B.skeletonize(FALSE)

bigbad.faction = list("undead")
if(bigbad.charflaw)
QDEL_NULL(bigbad.charflaw)
bigbad.mob_biotypes |= MOB_UNDEAD
var/obj/item/organ/eyes/eyes = bigbad.getorganslot(ORGAN_SLOT_EYES)
if(eyes)
eyes.Remove(bigbad,1)
QDEL_NULL(eyes)
eyes = new /obj/item/organ/eyes/night_vision/zombie
eyes.Insert(bigbad)


/obj/item/phylactery
Expand Down Expand Up @@ -182,6 +267,7 @@
var/offset = prob(50) ? -2 : 2
animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = -1) //start shaking
visible_message(span_warning("[src] begins to glow and shake violently!"))

spawn(timer)
possessor.owner.current.forceMove(get_turf(src))
possessor.rise_anew()
Expand Down
3 changes: 2 additions & 1 deletion code/modules/spells/roguetown/necromancer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@
var/datum/antagonist/lich/lichman = user.mind.has_antag_datum(/datum/antagonist/lich)
if(lichman)
if(user.stat != DEAD)
lichman.consume_phylactery(0)
if(!lichman.consume_phylactery(0)) //Use phylactery at 0 timer. Returns false if none left.
user.death() // If no more phylacteries, die
else
user.death()

Expand Down

0 comments on commit 8c16958

Please sign in to comment.