From f4ed0bf4fbec3036cdaa396986b51fa292f30aaa Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Thu, 30 May 2024 17:12:20 +0200 Subject: [PATCH] Cleans up revenant code (#25634) --- .../gamemodes/miniantags/revenant/revenant.dm | 81 ++++++++++--------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index bd35548dfe2..aba2c771443 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -11,10 +11,7 @@ desc = "A malevolent spirit." icon = 'icons/mob/mob.dmi' icon_state = "revenant_idle" - var/icon_idle = "revenant_idle" - var/icon_reveal = "revenant_revealed" - var/icon_stun = "revenant_stun" - var/icon_drain = "revenant_draining" + mob_biotypes = MOB_SPIRIT incorporeal_move = INCORPOREAL_MOVE_HOLY_BLOCK see_invisible = INVISIBILITY_REVENANT @@ -23,7 +20,6 @@ maxHealth = INFINITY see_in_dark = 8 lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE - universal_understand = TRUE response_help = "passes through" response_disarm = "swings at" response_harm = "punches" @@ -39,9 +35,17 @@ move_resist = INFINITY mob_size = MOB_SIZE_TINY pass_flags = PASSTABLE | PASSGRILLE | PASSMOB - speed = 1 atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) + /// The revenant's idle icon + var/icon_idle = "revenant_idle" + /// The revenant's revealed icon + var/icon_reveal = "revenant_revealed" + /// The revenant's stunned icon + var/icon_stun = "revenant_stun" + /// The revant's icon while draining mobs + var/icon_drain = "revenant_draining" + ///The resource of revenants. Max health is equal to three times this amount var/essence = 75 ///The regeneration cap of essence (go figure); regenerates every Life() tick up to this amount. @@ -69,7 +73,6 @@ ///How many perfect, regen-cap increasing souls the revenant has. var/perfectsouls = 0 - /mob/living/simple_animal/revenant/Life(seconds, times_fired) ..() if(revealed && essence <= 0) @@ -78,7 +81,7 @@ essence = min(essence_regen_cap, essence+essence_regen_amount) if(unreveal_time && world.time >= unreveal_time) unreveal_time = 0 - revealed = 0 + revealed = FALSE incorporeal_move = INCORPOREAL_MOVE_HOLY_BLOCK invisibility = INVISIBILITY_REVENANT to_chat(src, "You are once more concealed.") @@ -89,7 +92,7 @@ update_spooky_icon() /mob/living/simple_animal/revenant/ex_act(severity) - return 1 //Immune to the effects of explosions. + return TRUE //Immune to the effects of explosions. /mob/living/simple_animal/revenant/blob_act(obj/structure/blob/B) return //blah blah blobs aren't in tune with the spirit world, or something. @@ -100,7 +103,6 @@ /mob/living/simple_animal/revenant/narsie_act() return //most humans will now be either bones or harvesters, but we're still un-alive. - /mob/living/simple_animal/revenant/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE) return FALSE //You are a ghost, atmos and grill makes sparks, and you make your own shocks with lights. @@ -108,7 +110,7 @@ if(!revealed) return essence = max(0, essence-amount) - if(essence == 0) + if(!essence) to_chat(src, "You feel your essence fraying!") /mob/living/simple_animal/revenant/say(message) @@ -201,12 +203,11 @@ mind.AddSpell(new /datum/spell/aoe/revenant/hallucinations(null)) return TRUE - /mob/living/simple_animal/revenant/dust() - . = death() + return death() /mob/living/simple_animal/revenant/gib() - . = death() + return death() /mob/living/simple_animal/revenant/death() if(!revealed) @@ -218,9 +219,9 @@ to_chat(src, "NO! No... it's too late, you can feel your essence breaking apart...") notransform = TRUE - revealed = 1 + revealed = TRUE invisibility = 0 - playsound(src, 'sound/effects/screech.ogg', 100, 1) + playsound(src, 'sound/effects/screech.ogg', 100, TRUE) visible_message("[src] lets out a waning screech as violet mist swirls around its dissolving body!") icon_state = "revenant_draining" animate(src, alpha = 0, time = 3 SECONDS) @@ -234,9 +235,9 @@ visible_message("[src] violently flinches!", \ "As \the [W] passes through you, you feel your essence draining away!") adjustBruteLoss(25) //hella effective - inhibited = 1 + inhibited = TRUE spawn(30) - inhibited = 0 + inhibited = FALSE ..() @@ -246,32 +247,32 @@ var/turf/T = get_turf(src) if(iswallturf(T)) to_chat(src, "You cannot use abilities from inside of a wall.") - return 0 + return FALSE if(inhibited) to_chat(src, "Your powers have been suppressed by nulling energy!") - return 0 + return FALSE if(!change_essence_amount(essence_cost, 1)) to_chat(src, "You lack the essence to use that ability.") - return 0 - return 1 + return FALSE + return TRUE -/mob/living/simple_animal/revenant/proc/change_essence_amount(essence_amt, silent = 0, source = null) +/mob/living/simple_animal/revenant/proc/change_essence_amount(essence_amt, silent = FALSE, source) if(essence + essence_amt <= 0) return - essence = max(0, essence+essence_amt) + essence = max(0, essence + essence_amt) if(essence_amt > 0) - essence_accumulated = max(0, essence_accumulated+essence_amt) + essence_accumulated = max(0, essence_accumulated + essence_amt) if(!silent) if(essence_amt > 0) to_chat(src, "Gained [essence_amt]E from [source].") else to_chat(src, "Lost [essence_amt]E from [source].") - return 1 + return TRUE /mob/living/simple_animal/revenant/proc/reveal(time) if(time <= 0) return - revealed = 1 + revealed = TRUE invisibility = 0 incorporeal_move = NO_INCORPOREAL_MOVE if(!unreveal_time) @@ -295,23 +296,26 @@ update_spooky_icon() /mob/living/simple_animal/revenant/proc/update_spooky_icon() - if(revealed) - if(notransform) - if(draining) - icon_state = icon_drain - else - icon_state = icon_stun - else - icon_state = icon_reveal - else + if(!revealed) icon_state = icon_idle + return + + if(!notransform) + icon_state = icon_reveal + return + + if(draining) + icon_state = icon_drain + return + // No other state is happening, therefore we are stunned + icon_state = icon_stun /datum/objective/revenant needs_target = FALSE var/targetAmount = 100 /datum/objective/revenant/New() - targetAmount = rand(350,600) + targetAmount = rand(350, 600) explanation_text = "Absorb [targetAmount] points of essence from humans." ..() @@ -348,8 +352,7 @@ ..() /datum/objective/revenantFluff/check_completion() - return 1 - + return TRUE /obj/item/ectoplasm/revenant name = "glimmering residue"