From a2a3329e4097778b8dcd658c69752e942830f7bf Mon Sep 17 00:00:00 2001 From: Lance Date: Wed, 19 Jul 2023 16:05:45 -0400 Subject: [PATCH] Temporary Starting Commit Changes "damage_coeff =" to "ChangeResistances(" --- ModularTegustation/tegu_mobs/chaos_marine.dm | 4 +- code/controllers/subsystem/lobotomy_events.dm | 2 +- code/datums/status_effects/buffs.dm | 24 ++- code/datums/status_effects/debuffs.dm | 45 ++++-- .../ego_weapons/non_abnormality/wcorp.dm | 22 +-- .../abnormality/aleph/censored.dm | 4 +- .../abnormality/aleph/nothing_there.dm | 4 +- .../abnormality/aleph/silent_orchestra.dm | 10 +- .../abnormality/aleph/titania.dm | 4 +- .../abnormality/he/doomsday_calendar.dm | 5 +- .../abnormality/he/golden_false_apple.dm | 2 +- .../abnormality/he/pisc_mermaid.dm | 4 +- .../abnormality/he/scaredy_cat.dm | 4 +- .../abnormality/he/schadenfreude.dm | 6 +- .../abnormality/teth/punishing_bird.dm | 4 +- .../abnormality/waw/naked_nest.dm | 17 ++- .../simple_animal/abnormality/waw/yang.dm | 4 +- .../simple_animal/abnormality/waw/yin.dm | 4 +- .../simple_animal/damage_coeff_helper.dm | 143 ++++++++++++++++++ .../mob/living/simple_animal/dc_changes.dm | 43 ++++++ .../simple_animal/guardian/types/protector.dm | 4 +- .../simple_animal/guardian/types/support.dm | 4 +- .../simple_animal/hostile/ordeal/indigo.dm | 4 +- .../simple_animal/hostile/ordeal/steel.dm | 2 +- .../simple_animal/hostile/ordeal/white.dm | 4 +- .../mob/living/simple_animal/simple_animal.dm | 6 + .../projectiles/projectile/ego_bullets/waw.dm | 4 +- code/modules/spells/ability_types/realized.dm | 32 +--- code/modules/suppressions/extraction.dm | 18 +-- lobotomy-corp13.dme | 2 + 30 files changed, 301 insertions(+), 134 deletions(-) create mode 100644 code/modules/mob/living/simple_animal/damage_coeff_helper.dm create mode 100644 code/modules/mob/living/simple_animal/dc_changes.dm diff --git a/ModularTegustation/tegu_mobs/chaos_marine.dm b/ModularTegustation/tegu_mobs/chaos_marine.dm index ef6c7bdd6f37..2c8483218b0b 100644 --- a/ModularTegustation/tegu_mobs/chaos_marine.dm +++ b/ModularTegustation/tegu_mobs/chaos_marine.dm @@ -394,12 +394,12 @@ playsound(src, 'sound/magic/clockwork/narsie_attack.ogg', 200, TRUE) /mob/living/simple_animal/hostile/megafauna/chaos_marine/proc/cmempower() - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.25, WHITE_DAMAGE = 2, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.1) + ChangeResistances(list(RED_DAMAGE = 0.25, WHITE_DAMAGE = 2, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.1)) add_atom_colour(newcolor, TEMPORARY_COLOUR_PRIORITY) new /obj/effect/temp_visual/cult/sparks(get_turf(src)) /mob/living/simple_animal/hostile/megafauna/chaos_marine/proc/cmdepower() - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 0, BLACK_DAMAGE = 1, PALE_DAMAGE = 0.2) + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 0, BLACK_DAMAGE = 1, PALE_DAMAGE = 0.2)) remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, newcolor) new /obj/effect/temp_visual/cult/sparks(get_turf(src)) diff --git a/code/controllers/subsystem/lobotomy_events.dm b/code/controllers/subsystem/lobotomy_events.dm index 3a45cec54275..46ef5ce73129 100644 --- a/code/controllers/subsystem/lobotomy_events.dm +++ b/code/controllers/subsystem/lobotomy_events.dm @@ -133,7 +133,7 @@ SUBSYSTEM_DEF(lobotomy_events) A.density = FALSE // They ignore you and walk past you. A.AIStatus = AI_OFF A.can_patrol = FALSE - A.damage_coeff = list(BRUTE = 0, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) // You can kill the portal but not them. + A.ChangeResistances(list(BRUTE = 0, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0)) // You can kill the portal but not them. AB_types = list() // So the event can't run again. return if(YINYANG) diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 8da5522a9181..f0942635fd87 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -513,33 +513,31 @@ //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 + duration = 120 //12 seconds alert_type = null var/visual /datum/status_effect/all_armor_buff/on_apply() . = ..() + if(!isanimal(owner)) + qdel(src) + return 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 + var/mob/living/simple_animal/M = owner + M.add_overlay(visual) + M.AddModifier(/datum/dc_change/maroon_buff) /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) + M.RemoveModifier(/datum/dc_change/maroon_buff) + if(visual) + owner.cut_overlay(visual) /datum/status_effect/minor_damage_buff diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index 64a30f588d90..fb65f95efe9e 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -1012,28 +1012,33 @@ owner.cut_overlay(statuseffectvisual) return ..() -/datum/status_effect/sunder_red - id = "sunder red armor" +//update_stamina() is move_to_delay = (initial(move_to_delay) + (staminaloss * 0.06)) +// 100 stamina damage equals 6 additional move_to_delay. So 167*0.06 = 10.02 + +/datum/status_effect/rend_red + id = "rend red armor" status_type = STATUS_EFFECT_UNIQUE - duration = 60 //3 seconds + duration = 60 //6 seconds alert_type = null -/datum/status_effect/sunder_red/on_apply() +/datum/status_effect/rend_red/on_apply() . = ..() - if(isanimal(owner)) - var/mob/living/simple_animal/M = owner - M.damage_coeff[RED_DAMAGE] *= 1.2 + if(!isanimal(owner)) + qdel(src) + return + var/mob/living/simple_animal/M = owner + M.AddModifier(/datum/dc_change/rend/red) //20% damage increase. Hitting any abnormality that has a negative value will cause this //to be a buff to their healing. -/datum/status_effect/sunder_red/on_remove() +/datum/status_effect/rend_red/on_remove() . = ..() if(isanimal(owner)) var/mob/living/simple_animal/M = owner - M.damage_coeff[RED_DAMAGE] /= 1.2 + M.RemoveModifier(/datum/dc_change/rend/red) - //White Damage Debuff +//White Damage Debuff /datum/status_effect/rend_white id = "rend white armor" status_type = STATUS_EFFECT_UNIQUE @@ -1042,13 +1047,17 @@ /datum/status_effect/rend_white/on_apply() . = ..() + if(!isanimal(owner)) + qdel(src) + return var/mob/living/simple_animal/M = owner - M.damage_coeff[WHITE_DAMAGE] *= 1.2 + M.AddModifier(/datum/dc_change/rend/white) /datum/status_effect/rend_white/on_remove() . = ..() - var/mob/living/simple_animal/M = owner - M.damage_coeff[WHITE_DAMAGE] /= 1.2 + if(isanimal(owner)) + var/mob/living/simple_animal/M = owner + M.RemoveModifier(/datum/dc_change/rend/white) //Black Damage Debuff @@ -1060,12 +1069,16 @@ /datum/status_effect/rend_black/on_apply() . = ..() + if(!isanimal(owner)) + qdel(src) + return var/mob/living/simple_animal/M = owner - M.damage_coeff[BLACK_DAMAGE] *= 1.2 + M.AddModifier(/datum/dc_change/rend/black) /datum/status_effect/rend_black/on_remove() . = ..() - var/mob/living/simple_animal/M = owner - M.damage_coeff[BLACK_DAMAGE] /= 1.2 + if(isanimal(owner)) + var/mob/living/simple_animal/M = owner + M.RemoveModifier(/datum/dc_change/rend/black) #undef CARBON_HALFSPEED diff --git a/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm b/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm index bd19243cb33d..b445329e382f 100644 --- a/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm +++ b/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm @@ -223,26 +223,10 @@ to_chat(user, "[release_message].") sleep(5) target.apply_damage(force*2, damtype, null, target.run_armor_check(null, damtype), spread_damage = TRUE) - target.apply_status_effect(/datum/status_effect/rendBlackArmor) + target.apply_status_effect(/datum/status_effect/rend_black/w_corp) playsound(src, 'sound/abnormalities/thunderbird/tbird_bolt.ogg', 50, TRUE) var/turf/T = get_turf(target) new /obj/effect/temp_visual/justitia_effect(T) -/datum/status_effect/rendBlackArmor - id = "rend Black armor" - status_type = STATUS_EFFECT_UNIQUE - duration = 50 //5 seconds since it's melee-ish - alert_type = null - -/datum/status_effect/rendBlackArmor/on_apply() - . = ..() - if(isanimal(owner)) - var/mob/living/simple_animal/M = owner - M.damage_coeff[BLACK_DAMAGE] *= 1.2 - -/datum/status_effect/rendBlackArmor/on_remove() - . = ..() - if(isanimal(owner)) - var/mob/living/simple_animal/M = owner - M.damage_coeff[BLACK_DAMAGE] /= 1.2 - +/datum/status_effect/rend_black/w_corp // Duplicate of "rend_black", giving it a unique id so it can stack. + id = "w-corp rend black armor" diff --git a/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm b/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm index fc3984364f99..bb36d1742513 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm @@ -93,7 +93,7 @@ return can_act = FALSE forceMove(get_turf(H)) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0)) playsound(src, 'sound/abnormalities/censored/convert.ogg', 45, FALSE, 5) SLEEP_CHECK_DEATH(3) new /obj/effect/temp_visual/censored(get_turf(src)) @@ -104,7 +104,7 @@ if(!QDELETED(H)) C.desc = "What the hell is this? It shouldn't exist... On the second thought, it reminds you of [H.real_name]..." H.gib() - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.4, PALE_DAMAGE = 1) + ChangeResistances(list(RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.4, PALE_DAMAGE = 1)) adjustBruteLoss(-(maxHealth*0.1)) can_act = TRUE diff --git a/code/modules/mob/living/simple_animal/abnormality/aleph/nothing_there.dm b/code/modules/mob/living/simple_animal/abnormality/aleph/nothing_there.dm index b876b8238652..dcbd3191f85a 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/nothing_there.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/nothing_there.dm @@ -273,7 +273,7 @@ switch(current_stage) if(1) icon_state = "nothing_egg" - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0.6, BLACK_DAMAGE = 0.6, PALE_DAMAGE = 1) + ChangeResistances(list(RED_DAMAGE = 0, WHITE_DAMAGE = 0.6, BLACK_DAMAGE = 0.6, PALE_DAMAGE = 1)) can_act = FALSE next_transform = world.time + rand(10 SECONDS, 25 SECONDS) heartbeat.start() @@ -287,7 +287,7 @@ icon_state = icon_living pixel_x = -16 base_pixel_x = -16 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0.4, BLACK_DAMAGE = 0.4, PALE_DAMAGE = 0.8) + ChangeResistances(list(WHITE_DAMAGE = 0.4, BLACK_DAMAGE = 0.4, PALE_DAMAGE = 0.8)) can_act = TRUE melee_damage_lower = 65 melee_damage_upper = 75 diff --git a/code/modules/mob/living/simple_animal/abnormality/aleph/silent_orchestra.dm b/code/modules/mob/living/simple_animal/abnormality/aleph/silent_orchestra.dm index 6e794cb139a2..5535d9879a4c 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/silent_orchestra.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/silent_orchestra.dm @@ -81,26 +81,26 @@ next_movement_time = world.time + 4 SECONDS if(1) next_movement_time = world.time + 22 SECONDS - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 1) + ChangeResistances(list(PALE_DAMAGE = 1)) spawn_performer(1, WEST) if(2) next_movement_time = world.time + 14.5 SECONDS - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 1, PALE_DAMAGE = 0) + ChangeResistances(list(BLACK_DAMAGE = 1, PALE_DAMAGE = 0)) spawn_performer(2, WEST) if(3) next_movement_time = world.time + 11.5 SECONDS - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 1, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(WHITE_DAMAGE = 1, BLACK_DAMAGE = 0)) symphony_damage = 18 movement_volume = 3 // No more tinnitus spawn_performer(1, EAST) if(4) next_movement_time = world.time + 23 SECONDS - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(RED_DAMAGE = 1, WHITE_DAMAGE = 0)) symphony_damage = 12 spawn_performer(2, EAST) if(5) next_movement_time = world.time + 999 SECONDS // Never - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(RED_DAMAGE = 0)) movement_volume = 65 // TA-DA!!! if(current_movement_num < 6) sound_to_playing_players_on_level("sound/abnormalities/silentorchestra/movement[current_movement_num].ogg", movement_volume, zlevel = z) diff --git a/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm b/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm index ad39fa8b6c57..8c452045bc6d 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm @@ -172,10 +172,10 @@ if(currentlaw == "fairies") for(var/mob/living/simple_animal/L in spawned_mobs) - L.damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.2, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 0.2, PALE_DAMAGE = 1) + L.ChangeResistances(list(RED_DAMAGE = 0.2, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 0.2, PALE_DAMAGE = 1)) else for(var/mob/living/simple_animal/L in spawned_mobs) - L.damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1, WHITE_DAMAGE = 1, BLACK_DAMAGE = 1, PALE_DAMAGE = 1) + L.ChangeResistances(list(RED_DAMAGE = 1, WHITE_DAMAGE = 1, BLACK_DAMAGE = 1, PALE_DAMAGE = 1)) /mob/living/simple_animal/hostile/abnormality/titania/proc/Punishment(mob/living/sinner) diff --git a/code/modules/mob/living/simple_animal/abnormality/he/doomsday_calendar.dm b/code/modules/mob/living/simple_animal/abnormality/he/doomsday_calendar.dm index 30ed41cdf24a..9e36faab9bfd 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/doomsday_calendar.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/doomsday_calendar.dm @@ -305,10 +305,7 @@ adjustBruteLoss(100) pulse_damage -= 1 playsound(get_turf(src),'sound/abnormalities/doomsdaycalendar/Limbus_Dead_Generic.ogg', 50, 1) - for(var/damtype in src.damage_coeff) - if(damtype == BRUTE) - continue - damage_coeff[damtype] += 0.1 + AddModifier(/datum/dc_change/sacrified) //***Simple Mobs***// //clay dolls diff --git a/code/modules/mob/living/simple_animal/abnormality/he/golden_false_apple.dm b/code/modules/mob/living/simple_animal/abnormality/he/golden_false_apple.dm index 743b56928911..554002595fb1 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/golden_false_apple.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/golden_false_apple.dm @@ -302,7 +302,7 @@ attack_verb_continuous = "pummels" attack_verb_simple = "pummel" move_to_delay = 3 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1, PALE_DAMAGE = 0.5) + ChangeResistances(list(RED_DAMAGE = 1.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1, PALE_DAMAGE = 0.5)) melee_damage_type = BLACK_DAMAGE fear_level = WAW_LEVEL revive(full_heal = TRUE, admin_revive = FALSE) diff --git a/code/modules/mob/living/simple_animal/abnormality/he/pisc_mermaid.dm b/code/modules/mob/living/simple_animal/abnormality/he/pisc_mermaid.dm index 4fc60503cd25..b6d3b93b9fcf 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/pisc_mermaid.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/pisc_mermaid.dm @@ -92,7 +92,7 @@ pixel_y = -16 base_pixel_y = -16 if(!isnull(crown?.loved)) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.3, WHITE_DAMAGE = 0.3, BLACK_DAMAGE = 0.3, PALE_DAMAGE = 0.3) //others can still help but it's going to take a lot of damage + ChangeResistances(list(RED_DAMAGE = 0.3, WHITE_DAMAGE = 0.3, BLACK_DAMAGE = 0.3, PALE_DAMAGE = 0.3)) //others can still help but it's going to take a lot of damage love_target = crown.loved qdel(crown) love_target.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/unrequited_slowdown) @@ -137,7 +137,7 @@ if(love_target.stat == DEAD) say("[love_target.name]? Are you okay? I'm sorry, is it my fault? Will you come back if I love you enough? Will you love me back in death at least?") - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 2) //back to being a pushover + ChangeResistances(list(RED_DAMAGE = 1.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 2)) //back to being a pushover love_target = null return //Not having a cooldown on the oxyloss sounds bad, but people's breathing is dictated by Life(), so it's actually the perfect pace of oxyloss diff --git a/code/modules/mob/living/simple_animal/abnormality/he/scaredy_cat.dm b/code/modules/mob/living/simple_animal/abnormality/he/scaredy_cat.dm index 0c5edf947f5c..f459bc3b10df 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/scaredy_cat.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/scaredy_cat.dm @@ -170,7 +170,7 @@ if(courage) melee_damage_lower = 15 melee_damage_upper = 20 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 2, BLACK_DAMAGE = 1.5, PALE_DAMAGE = 0.5) + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 2, BLACK_DAMAGE = 1.5, PALE_DAMAGE = 0.5)) icon = 'ModularTegustation/Teguicons/48x48.dmi' icon_living = "cat_courage" icon_dead = "dead_courage" @@ -181,7 +181,7 @@ faction = list("neutral") melee_damage_lower = initial(melee_damage_lower) melee_damage_upper = initial(melee_damage_upper) //it shouldn't attack in that form in the first place but... - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 4, WHITE_DAMAGE = 4, BLACK_DAMAGE = 4, PALE_DAMAGE = 4) + ChangeResistances(list(RED_DAMAGE = 4, WHITE_DAMAGE = 4, BLACK_DAMAGE = 4, PALE_DAMAGE = 4)) playsound(src, 'sound/abnormalities/scaredycat/catchange.ogg', 75, FALSE, 4) icon = 'ModularTegustation/Teguicons/32x32.dmi' icon_living = "scaredy_cat" diff --git a/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm b/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm index c3b39c0ba382..e229718bc3d0 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm @@ -54,7 +54,7 @@ solo_punish = TRUE if(living_players == 1) seen = TRUE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1.2, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 1.0, PALE_DAMAGE = 1.5) + ChangeResistances(list(RED_DAMAGE = 1.2, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 1.0, PALE_DAMAGE = 1.5)) return solo_punish = FALSE //Reset to normal if the amount of living players on your z-level is something other than 1, to allow normal behavior. @@ -70,10 +70,10 @@ datum_reference.qliphoth_change(-1) if(people_watching == 1) seen = FALSE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.7) + ChangeResistances(list(RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.7)) else //any amount of people that's not 1. seen = TRUE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1.2, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 1.0, PALE_DAMAGE = 1.5) + ChangeResistances(list(RED_DAMAGE = 1.2, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 1.0, PALE_DAMAGE = 1.5)) //Stuff that needs sight check /mob/living/simple_animal/hostile/abnormality/schadenfreude/Move() diff --git a/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm b/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm index af73ceeb658d..f5baa58e5800 100644 --- a/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm +++ b/code/modules/mob/living/simple_animal/abnormality/teth/punishing_bird.dm @@ -93,7 +93,7 @@ obj_damage = 2500 environment_smash = ENVIRONMENT_SMASH_STRUCTURES stat_attack = DEAD - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.5) + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 0.5, BLACK_DAMAGE = 0.5, PALE_DAMAGE = 0.5)) bird_angry = TRUE update_icon() @@ -114,7 +114,7 @@ environment_smash = initial(environment_smash) stat_attack = initial(stat_attack) adjustHealth(-maxHealth) // Full restoration - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 2, WHITE_DAMAGE = 2, BLACK_DAMAGE = 2, PALE_DAMAGE = 2) + ChangeResistances(list(RED_DAMAGE = 2, WHITE_DAMAGE = 2, BLACK_DAMAGE = 2, PALE_DAMAGE = 2)) bird_angry = FALSE update_icon() diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/naked_nest.dm b/code/modules/mob/living/simple_animal/abnormality/waw/naked_nest.dm index c5eee8d69727..ef59f29e8925 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/naked_nest.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/naked_nest.dm @@ -296,30 +296,31 @@ var/mob/living/simple_animal/hostile/abnormality/naked_nest/N = new(get_turf(src)) for(var/atom/movable/AM in src) //morph code AM.forceMove(N) - N.damage_coeff = damage_coeff + N.ChangeResistances(damage_coeff) playsound(get_turf(src), 'sound/misc/moist_impact.ogg', 30, 1) qdel(src) /mob/living/simple_animal/hostile/naked_nested/proc/UpdateArmor() - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 1.2, PALE_DAMAGE = 1.5) + var/list/damage_list = list(RED_DAMAGE = 0.6, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 1.2, PALE_DAMAGE = 1.5) var/obj/item/clothing/suit/armor/host_armor = locate(/obj/item/clothing/suit/armor) in contents if(host_armor) if(host_armor.armor[RED_DAMAGE]) fortitude = 1 - (host_armor.armor[RED_DAMAGE] / 100) // 100 armor / 100 = 1 - if(fortitude <= damage_coeff[RED_DAMAGE] && fortitude > 0) //if armor is less than current red armor and is more than 0 since anything 0 or below is healing or immune to damage - damage_coeff[RED_DAMAGE] = fortitude + if(fortitude <= damage_list[RED_DAMAGE] && fortitude > 0) //if armor is less than current red armor and is more than 0 since anything 0 or below is healing or immune to damage + damage_list[RED_DAMAGE] = fortitude if(host_armor.armor[WHITE_DAMAGE]) prudence = 1 - (host_armor.armor[WHITE_DAMAGE] / 100) - if(prudence <= damage_coeff[WHITE_DAMAGE] && prudence > 0) - damage_coeff[WHITE_DAMAGE] = prudence + if(prudence <= damage_list[WHITE_DAMAGE] && prudence > 0) + damage_list[WHITE_DAMAGE] = prudence if(host_armor.armor[BLACK_DAMAGE]) temperance = 1 - (host_armor.armor[BLACK_DAMAGE] / 100) if(temperance > 0) - damage_coeff[BLACK_DAMAGE] = temperance + damage_list[BLACK_DAMAGE] = temperance if(host_armor.armor[PALE_DAMAGE]) justice = 1 - (host_armor.armor[PALE_DAMAGE] / 100) if(justice > 0) - damage_coeff[PALE_DAMAGE] = justice + damage_list[PALE_DAMAGE] = justice + ChangeResistances(damage_list) return TRUE /mob/living/simple_animal/hostile/naked_nested/hour_nesting //for dungeon gamemodes diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/yang.dm b/code/modules/mob/living/simple_animal/abnormality/waw/yang.dm index fa51584e0053..6da139ba4d99 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/yang.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/yang.dm @@ -144,14 +144,14 @@ icon_state = icon_dead playsound(src, 'sound/effects/magic.ogg', 60) SSlobotomy_events.yang_downed = TRUE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0)) for(var/i = 1 to 12) SLEEP_CHECK_DEATH(5 SECONDS) if(SSlobotomy_events.yin_downed) death() return adjustBruteLoss(-maxHealth) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 1, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 1.7, PALE_DAMAGE = 2) + ChangeResistances(list(RED_DAMAGE = 1, WHITE_DAMAGE = 0.2, BLACK_DAMAGE = 1.7, PALE_DAMAGE = 2)) SSlobotomy_events.yang_downed = FALSE icon_state = icon_breach diff --git a/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm b/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm index 5642333e9e40..ed62e096b369 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm @@ -135,14 +135,14 @@ icon_state = icon_dead playsound(src, 'sound/effects/magic.ogg', 60) SSlobotomy_events.yin_downed = TRUE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) + ChangeResistances(list(RED_DAMAGE = 0, WHITE_DAMAGE = 0, PALE_DAMAGE = 0)) for(var/i = 1 to 12) SLEEP_CHECK_DEATH(5 SECONDS) if(SSlobotomy_events.yang_downed) death() return adjustBruteLoss(-maxHealth) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 0, PALE_DAMAGE = 1) + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 1.5, PALE_DAMAGE = 1)) SSlobotomy_events.yin_downed = FALSE icon_state = icon_breach 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..725c2892ca72 --- /dev/null +++ b/code/modules/mob/living/simple_animal/damage_coeff_helper.dm @@ -0,0 +1,143 @@ +// 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 + /// 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 + /// Affected Damage Type + var/damage_type = RED_DAMAGE + +/** + * Adds a resistance modifier from an simple animal. + * + * vars: + * * DC - the path of the dc_change to be added OR a list of paths to add. + * + * returns: + * * FALSE if no value added, otherwise TRUE. + */ +/mob/living/simple_animal/proc/AddModifier(DC) + . = FALSE + if(islist(DC)) // If List + for(var/p in DC) // Check each item in the list + if(!ispath(p,/datum/dc_change)) // If it's not a path, skip it + continue + damage_mods.Add(new p) // Add a new one to the list + else if(!ispath(DC,/datum/dc_change)) // Otherwise, if it's not a path, return. + return + else + damage_mods.Add(new DC) // Otherwise, add a new one to the list. + UpdateResistances() + return TRUE + +/** + * Removes a resistance modifier from an simple animal. + * + * vars: + * * DC - the path of the dc_change to be removed. + * + * returns: + * * FALSE if no value removed, otherwise TRUE. + */ +/mob/living/simple_animal/proc/RemoveModifier(DC) + . = FALSE + if(islist(DC)) // If list + for(var/p in DC) // Check each item in the list + if(!ispath(p,/datum/dc_change)) + continue + var/modifier = HasDamageMod(p) // Grab it if it exists + if(!modifier) + continue + damage_mods.Remove(modifier) // Then remove it + QDEL_NULL(modifier) + else if(!ispath(DC,/datum/dc_change)) // Otherwise, if it's not a path, return. + return + else // If it IS a path + var/modifier = HasDamageMod(DC) // Grab it + if(!modifier) + return + damage_mods.Remove(modifier) // And Remove it + QDEL_NULL(modifier) + UpdateResistances() + return TRUE + +/** + * Used to change a multiple resistances of an simple animal. + * + * vars: + * * resistances - An associative list of damage types to be changed. See: list(RED_DAMAGE = 100, WHITE_DAMAGE = 50) + */ +/mob/living/simple_animal/proc/ChangeResistances(list/resistances = list()) + for(var/DT in resistances) + ChangeResistance(DT, resistances[DT], FALSE) + UpdateResistances() + return + +/** + * Used to change a single resistance of an simple animal. + * + * vars: + * * resistance - the damage type being altered. + * * value - the number it's being set to. + * * update (optional) - TRUE by default, if TRUE it will call UpdateResistances() after alteration. + * + * returns: + * * TRUE if value was successfully changed. + */ +/mob/living/simple_animal/proc/ChangeResistance(resistance, value, update = TRUE) + . = FALSE + if(!(resistance in list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE))) + return + unmodified_coeff[resistance] = value + if(update) + UpdateResistances() + return TRUE + +/** + * Updates all of a mob's resistances to be based on their base value with modifiers added. + */ +/mob/living/simple_animal/proc/UpdateResistances() + damage_coeff = unmodified_coeff.Copy() // Reset resistances + for(var/datum/dc_change/D in damage_mods) // Check our multiplicative mods + if(D.additive) + continue + if(islist(D.damage_type)) + for(var/dam_type in D.damage_type) + if(damage_coeff[dam_type] <= 0) // Immunity / Healing is not modified + continue + damage_coeff[dam_type] *= D.potency + else + if(damage_coeff[D.damage_type] <= 0) // Immunity / Healing is not modified + continue + damage_coeff[D.damage_type] *= D.potency + for(var/datum/dc_change/D in damage_mods) // Then include additive modifiers + if(!D.additive) + continue + if(islist(D.damage_type)) + for(var/dam_type in D.damage_type) + if(damage_coeff[dam_type] <= 0) // Immunity / Healing is not modified + continue + damage_coeff[dam_type] += D.potency + else + if(damage_coeff[D.damage_type] <= 0) // Immunity / Healing is not modified + continue + damage_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. + * + * vars: + * * mod - A dc_change path + * + * returns: + * * The matching modifier, otherwise FALSE. + */ +/mob/living/simple_animal/proc/HasDamageMod(mod) + . = FALSE + if(LAZYLEN(damage_mods)) + for(var/datum/dc_change/DC in damage_mods) + if(istype(DC, mod)) + return DC + 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..92ff43969c4a --- /dev/null +++ b/code/modules/mob/living/simple_animal/dc_changes.dm @@ -0,0 +1,43 @@ + +/// 0.8x, Maroon Soldier (used for steel???) damage_coeff changes +/datum/dc_change/maroon_buff + potency = 0.8 + damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) + +/// 1.2x Rends, used for various EGO +/datum/dc_change/rend + potency = 1.2 + +/datum/dc_change/rend/red + damage_type = RED_DAMAGE + +/datum/dc_change/rend/white + damage_type = WHITE_DAMAGE + +/datum/dc_change/rend/black + damage_type = BLACK_DAMAGE + +/datum/dc_change/rend/pale // Unused atm + damage_type = PALE_DAMAGE + +/// 1.1x modifiers, used by Salvation +/datum/dc_change/salvation + potency = 1.1 + damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) + +/// 1.5x Black modifier, used by Laughter +/datum/dc_change/mosb_black + potency = 1.5 + damage_type = BLACK_DAMAGE + +/// +0.5 Pale modifier, used by Head of God +/datum/dc_change/godhead + additive = TRUE + potency = 0.5 + damage_type = PALE_DAMAGE + +/// +0.1 Universal modifier, self-inflicted by Doomsday calender +/datum/dc_change/sacrified + additive = TRUE + potency = 0.1 + damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) diff --git a/code/modules/mob/living/simple_animal/guardian/types/protector.dm b/code/modules/mob/living/simple_animal/guardian/types/protector.dm index 22252c5ed523..c3b814913c7b 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/protector.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/protector.dm @@ -39,7 +39,7 @@ melee_damage_lower = initial(melee_damage_lower) melee_damage_upper = initial(melee_damage_upper) speed = initial(speed) - damage_coeff = list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA = 0, OXY = 0.4) + ChangeResistances(list(BRUTE = 0.4, BURN = 0.4, TOX = 0.4, CLONE = 0.4, STAMINA = 0, OXY = 0.4)) to_chat(src, "You switch to combat mode.") toggle = FALSE else @@ -50,7 +50,7 @@ melee_damage_lower = 2 melee_damage_upper = 2 speed = 1 - damage_coeff = list(BRUTE = 0.05, BURN = 0.05, TOX = 0.05, CLONE = 0.05, STAMINA = 0, OXY = 0.05) //damage? what's damage? + ChangeResistances(list(BRUTE = 0.05, BURN = 0.05, TOX = 0.05, CLONE = 0.05, STAMINA = 0, OXY = 0.05)) //damage? what's damage? to_chat(src, "You switch to protection mode.") toggle = TRUE diff --git a/code/modules/mob/living/simple_animal/guardian/types/support.dm b/code/modules/mob/living/simple_animal/guardian/types/support.dm index c5256950040a..79873261de9c 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/support.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/support.dm @@ -48,7 +48,7 @@ if(toggle) a_intent = INTENT_HARM speed = 0 - damage_coeff = list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7) + ChangeResistances(list(BRUTE = 0.7, BURN = 0.7, TOX = 0.7, CLONE = 0.7, STAMINA = 0, OXY = 0.7)) melee_damage_lower = 15 melee_damage_upper = 15 to_chat(src, "You switch to combat mode.") @@ -56,7 +56,7 @@ else a_intent = INTENT_HELP speed = 1 - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1) + ChangeResistances(list(BURN = 1, TOX = 1, CLONE = 1, STAMINA = 0, OXY = 1)) melee_damage_lower = 0 melee_damage_upper = 0 to_chat(src, "You switch to healing mode.") diff --git a/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm b/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm index 70306dfc6083..020befcf69da 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm @@ -476,7 +476,7 @@ SLEEP_CHECK_DEATH(5) maxHealth = 4000 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.4, WHITE_DAMAGE = 0.6, BLACK_DAMAGE = 0.25, PALE_DAMAGE = 0.8) + ChangeResistances(list(RED_DAMAGE = 0.4, WHITE_DAMAGE = 0.6, BLACK_DAMAGE = 0.25, PALE_DAMAGE = 0.8)) move_to_delay = phase2speed speed = phase2speed rapid_melee +=1 @@ -495,7 +495,7 @@ SLEEP_CHECK_DEATH(5) maxHealth = 3000 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.3, PALE_DAMAGE = 1) + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.3, PALE_DAMAGE = 1)) move_to_delay = phase3speed speed = phase3speed rapid_melee += 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 0aa2accb59cf..437ac3ea764d 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm @@ -315,7 +315,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/hostile/ordeal/white.dm b/code/modules/mob/living/simple_animal/hostile/ordeal/white.dm index bdb5c86139f6..858dff187f92 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/white.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/white.dm @@ -284,10 +284,10 @@ playsound(src, 'sound/effects/ordeals/white/white_reflect.ogg', 50, TRUE, 7) visible_message("