Refactor Fleshmend into a Status Effect (#20031)

* Fleshmend Refactor

* Reworked buff to match existing code in effect

* Clean up formatting

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>

* Syntax and formatting updates as per comment suggestions

* Update code/datums/status_effects/buffs.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Clean up array code

Cleaned up some array code, changed a segment where an array was manipulated while iterating through it to instead collect expired instances and remove them after.

---------

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Springf
2023-02-07 13:50:37 -06:00
committed by GitHub
co-authored by Henri215 Ryan
parent fba3664c5a
commit 9504e00ba2
3 changed files with 44 additions and 36 deletions
@@ -7,48 +7,14 @@
dna_cost = 2
req_stat = UNCONSCIOUS
power_type = CHANGELING_PURCHASABLE_POWER
var/recent_uses = 1 //The factor of which the healing should be divided by
var/healing_ticks = 10
// The ideal total healing amount,
// divided by healing_ticks to get heal/tick
var/total_healing = 100
/datum/action/changeling/fleshmend/New()
..()
START_PROCESSING(SSobj, src)
/datum/action/changeling/fleshmend/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/datum/action/changeling/fleshmend/process()
if(recent_uses > 1)
recent_uses = max(1, recent_uses - (1 / healing_ticks))
//Starts healing you every second for 10 seconds. Can be used whilst unconscious.
/datum/action/changeling/fleshmend/sting_action(mob/living/user)
to_chat(user, "<span class='notice'>We begin to heal rapidly.</span>")
if(recent_uses > 1)
if(user.has_status_effect(STATUS_EFFECT_FLESHMEND))
to_chat(user, "<span class='warning'>Our healing's effectiveness is reduced \
by quick repeated use!</span>")
recent_uses++
INVOKE_ASYNC(src, PROC_REF(fleshmend), user)
user.apply_status_effect(STATUS_EFFECT_FLESHMEND)
SSblackbox.record_feedback("nested tally", "changeling_powers", 1, list("[name]"))
return TRUE
/datum/action/changeling/fleshmend/proc/fleshmend(mob/living/user)
// The healing itself - doesn't heal toxin damage
// (that's anatomic panacea) and the effectiveness decreases with
// each use in a short timespan
for(var/i in 1 to healing_ticks)
if(user)
var/healpertick = -(total_healing / healing_ticks)
user.heal_overall_damage((-healpertick/recent_uses), (-healpertick/recent_uses), updating_health = FALSE)
user.adjustOxyLoss(healpertick/recent_uses, FALSE)
user.blood_volume = min(user.blood_volume + 30, BLOOD_VOLUME_NORMAL)
user.updatehealth()
else
break
sleep(10)