diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 8da5522a9181..3a254f5cd083 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -513,34 +513,23 @@ //LC13 AI entity Buffs //Buff Maroon Ordeal Soldiers, Feel free to cannibalize and rework to work for other creatures. -/datum/status_effect/all_armor_buff //due to multiplication the effect works more on entities that are weak to the damage value. - id = "all armor armor" - status_type = STATUS_EFFECT_UNIQUE - duration = 120 //6 seconds - alert_type = null +/datum/dc_change/maroon_buff + duration = 120 + potency = 0.8 var/visual -/datum/status_effect/all_armor_buff/on_apply() +/datum/dc_change/maroon_buff/New(mob/living/simple_animal/S, apply_visual = FALSE, damtype = RED_DAMAGE) + if(apply_visual) + visual = mutable_appearance('ModularTegustation/Teguicons/tegu_effects.dmi', "manager_shield") + owner.add_overlay(visual) + damage_type = damtype . = ..() - visual = mutable_appearance('ModularTegustation/Teguicons/tegu_effects.dmi', "manager_shield") - if(isanimal(owner)) - var/mob/living/simple_animal/M = owner - M.add_overlay(visual) - M.damage_coeff[RED_DAMAGE] *= 0.8 //20% damage decrease - M.damage_coeff[WHITE_DAMAGE] *= 0.8 - M.damage_coeff[BLACK_DAMAGE] *= 0.8 - M.damage_coeff[PALE_DAMAGE] *= 0.8 -/datum/status_effect/all_armor_buff/on_remove() - . = ..() - if(isanimal(owner)) - var/mob/living/simple_animal/M = owner - M.damage_coeff[RED_DAMAGE] /= 0.8 - M.damage_coeff[WHITE_DAMAGE] /= 0.8 - M.damage_coeff[BLACK_DAMAGE] /= 0.8 - M.damage_coeff[PALE_DAMAGE] /= 0.8 - owner.cut_overlay(visual) +/datum/status_effect/all_armor_buff/Remove() + if(visual) + owner.cut_overlay(visual) + . = ..() /datum/status_effect/minor_damage_buff id = "minor damage buff" diff --git a/code/modules/mob/living/simple_animal/damage_coeff_helper.dm b/code/modules/mob/living/simple_animal/damage_coeff_helper.dm new file mode 100644 index 000000000000..d8a0935f5a63 --- /dev/null +++ b/code/modules/mob/living/simple_animal/damage_coeff_helper.dm @@ -0,0 +1,48 @@ +// This is a modifier to Simple Animal's damage coeff. +// It's built to standarize the damage changes to abnos and other simple animals without causing them to desync during phase changes. + +/datum/dc_change + name = "Damage Coeff Change" + desc = "This is a modification to a simple_animal's damage_coeff." + /// TRUE if it adds the potency value to damage_coeff, FALSE if it multiplies. + var/additive = FALSE + /// The amount the damage type is added or multiplied by. + var/potency = 0 + /// Effected Damage Type + var/damage_type = RED_DAMAGE + /// Duration when the debuff is removed, in deciseconds by default. + var/duration = 0 SECONDS + var/mob/living/simple_animal/owner + +/datum/dc_change/New(mob/living/simple_animal/S) + if(!istype(S)) + qdel(S) + return + owner = S + owner.damage_mods += src + owner.Update_Coeff() + addtimer(CALLBACK(src, .proc/Remove), duration) + +/datum/dc_change/proc/Remove() + owner.damage_mods -= src + owner.Update_Coeff() + qdel(src) + +/// Updates the Simple Animal's damage coeff's. +/mob/living/simple_animal/proc/UpdateCoeff() + for(var/datum/dc_change/D in damage_mods) + if(D.additive) + continue + damage_coeff[D.damage_type] = unmodified_coeff[D.damage_type] * D.potency + for(var/datum/dc_change/D in damage_mods) + if(!D.additive) + continue + damage_coeff[D.damage_type] = unmodified_coeff[D.damage_type] + D.potency + +/// Give it a dc_change modifier path and it will check aganist that. If it exists in the list, it will be returned. +/mob/living/simple_animal/proc/HasDamageMod(mod) + . = FALSE + if(damage_mods) + for(var/datum/dc_change/modifier in damage_mods) + if(istype(modifer, mod)) + return mod diff --git a/code/modules/mob/living/simple_animal/dc_changes.dm b/code/modules/mob/living/simple_animal/dc_changes.dm new file mode 100644 index 000000000000..139597f9cb07 --- /dev/null +++ b/code/modules/mob/living/simple_animal/dc_changes.dm @@ -0,0 +1,2 @@ + + diff --git a/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm b/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm index bb0a30d42c00..bfa41e83dc1d 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm @@ -318,7 +318,7 @@ if(prob(20)) say(pick("Lads we got a hostile!", "Shit, wake up troops hell just found us!", "I warn you, we dont die easy.", "Keep your cool and we can all get out of this alive!")) for(var/mob/living/simple_animal/hostile/ordeal/G in oview(9, src)) - if(istype(G, /mob/living/simple_animal/hostile/ordeal/steel_dawn) && G.stat != DEAD && !has_status_effect(/datum/status_effect/all_armor_buff || /datum/status_effect/minor_damage_buff)) + if(istype(G, /mob/living/simple_animal/hostile/ordeal/steel_dawn) && G.stat != DEAD && (!HasDamageMod(/datum/dc_change/maroon_buff) || !has_status_effect(/datum/status_effect/minor_damage_buff))) G.GiveTarget(target) G.TemporarySpeedChange(-1, 1 SECONDS) last_command = 1 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 682255f269b9..358f09b34dd5 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -86,6 +86,10 @@ var/armortype = RED_DAMAGE /// 1 for full damage , 0 for none , -1 for 1:1 heal from that source. var/list/damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1, WHITE_DAMAGE = 1, BLACK_DAMAGE = 1, PALE_DAMAGE = 1) + /// A copy of the original damage_coeff, what the base resistances of a simple animal should be before modifiers. + var/list/unmodified_coeff = list() + /// The datum modifiers to + var/list/damage_mods = list() ///Attacking verb in present continuous tense. var/attack_verb_continuous = "attacks" ///Attacking verb in present simple tense. @@ -209,6 +213,8 @@ if(!unsuitable_heat_damage) unsuitable_heat_damage = unsuitable_atmos_damage + unmodified_coeff = damage_coeff + /mob/living/simple_animal/Life() . = ..() if(staminaloss > 0) diff --git a/lobotomy-corp13.dme b/lobotomy-corp13.dme index 958459286311..c541f2a2641d 100644 --- a/lobotomy-corp13.dme +++ b/lobotomy-corp13.dme @@ -2630,6 +2630,7 @@ #include "code\modules\mob\living\simple_animal\constructs.dm" #include "code\modules\mob\living\simple_animal\corpse.dm" #include "code\modules\mob\living\simple_animal\damage_procs.dm" +#include "code\modules\mob\living\simple_animal\dc_changes.dm" #include "code\modules\mob\living\simple_animal\eldritch_demons.dm" #include "code\modules\mob\living\simple_animal\parrot.dm" #include "code\modules\mob\living\simple_animal\shade.dm"