mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
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:
@@ -359,6 +359,45 @@
|
||||
/datum/status_effect/regenerative_core/on_remove()
|
||||
REMOVE_TRAIT(owner, TRAIT_IGNOREDAMAGESLOWDOWN, id)
|
||||
|
||||
/datum/status_effect/fleshmend
|
||||
duration = -1
|
||||
status_type = STATUS_EFFECT_REFRESH
|
||||
tick_interval = 1 SECONDS
|
||||
alert_type = null
|
||||
/// This diminishes the healing of fleshmend the higher it is.
|
||||
var/tolerance = 1
|
||||
var/instance_duration = 10 // in ticks
|
||||
/// a list of integers, one for each remaining instance of fleshmend.
|
||||
var/list/active_instances = list()
|
||||
var/ticks = 0
|
||||
|
||||
/datum/status_effect/fleshmend/on_apply()
|
||||
tolerance += 1
|
||||
active_instances += instance_duration
|
||||
return TRUE
|
||||
|
||||
/datum/status_effect/fleshmend/refresh()
|
||||
tolerance += 1
|
||||
active_instances += instance_duration
|
||||
..()
|
||||
|
||||
/datum/status_effect/fleshmend/tick()
|
||||
if(length(active_instances) >= 1)
|
||||
var/heal_amount = 10 * length(active_instances) / tolerance
|
||||
var/blood_restore = 30 * length(active_instances)
|
||||
owner.heal_overall_damage(heal_amount, heal_amount, updating_health = FALSE)
|
||||
owner.adjustOxyLoss(-heal_amount, FALSE)
|
||||
owner.blood_volume = min(owner.blood_volume + blood_restore, BLOOD_VOLUME_NORMAL)
|
||||
owner.updatehealth()
|
||||
var/list/expired_instances = list()
|
||||
for(var/i in 1 to length(active_instances))
|
||||
active_instances[i]--
|
||||
if(active_instances[i] <= 0)
|
||||
expired_instances += active_instances[i]
|
||||
active_instances -= expired_instances
|
||||
tolerance = max(tolerance - 0.05, 1)
|
||||
if(tolerance <= 1 && length(active_instances) == 0)
|
||||
qdel(src)
|
||||
|
||||
/datum/status_effect/speedlegs
|
||||
duration = -1
|
||||
|
||||
Reference in New Issue
Block a user