From ae5a291acaaca2f13689b6183096658a9bac1792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B=CC=B8R=CC=B5e=CC=B5d=CC=B4a=CC=B4c=CC=B6t=CC=B8e=CC=B8?= =?UTF-8?q?d=CC=B4=5D=CC=B5?= <61567407+LanceSmites328@users.noreply.github.com> Date: Sat, 28 Oct 2023 09:30:37 -0400 Subject: [PATCH] Damage Coeff Change Standardization (#1326) * Temporary Starting Commit Changes "damage_coeff =" to "ChangeResistances(" Changes "Unmodified_Coeff" to "Unmodified_Damage_Coeff" Returns the status check as opposed to the mod check Adds ModifyResistances proc and fixing spelling error Update damage_coeff_helper.dm Entire Rework of how I've done this Call this shit "Armor 2" * Old Code Update * code improvement * God of Seasons update * Updates damage_coeff checks with new Proc * Deep Scanner Update * linter fixes * Converts current damage_coeff system to mimic armor * Update _abnormality.dm --- .../tegu_items/gadgets/unpowered.dm | 21 +- .../tegu_items/workshop/mods/curing.dm | 4 +- .../tegu_items/workshop/mods/healthup.dm | 4 +- .../tegu_items/workshop/mods/sapping.dm | 4 +- 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 ++-- .../game/machinery/computer/manager_camera.dm | 2 +- code/game/objects/items/ego_weapons/aleph.dm | 4 +- .../ego_weapons/non_abnormality/limbus_ego.dm | 4 +- .../ego_weapons/non_abnormality/pierre.dm | 4 +- .../non_abnormality/purple_tear.dm | 24 +-- .../ego_weapons/non_abnormality/wcorp.dm | 22 +- .../game/objects/items/ego_weapons/special.dm | 2 +- code/game/objects/items/ego_weapons/waw.dm | 8 +- .../mob/living/simple_animal/_damage_coeff.dm | 89 ++++++++ .../simple_animal/abnormality/_abnormality.dm | 2 +- .../abnormality/aleph/censored.dm | 4 +- .../abnormality/aleph/nothing_there.dm | 4 +- .../abnormality/aleph/seasons.dm | 3 +- .../abnormality/aleph/silent_orchestra.dm | 10 +- .../abnormality/aleph/titania.dm | 4 +- .../abnormality/he/doomsday_calendar.dm | 5 +- .../abnormality/he/golden_false_apple.dm | 2 +- .../simple_animal/abnormality/he/norinori.dm | 10 +- .../abnormality/he/pisc_mermaid.dm | 4 +- .../simple_animal/abnormality/he/red_shoes.dm | 10 +- .../abnormality/he/scaredy_cat.dm | 4 +- .../abnormality/he/schadenfreude.dm | 6 +- .../abnormality/teth/punishing_bird.dm | 4 +- .../abnormality/waw/naked_nest.dm | 17 +- .../abnormality/waw/wrath_servant.dm | 2 +- .../simple_animal/abnormality/waw/yang.dm | 4 +- .../simple_animal/abnormality/waw/yin.dm | 4 +- .../living/simple_animal/animal_defense.dm | 4 +- .../simple_animal/damage_coeff_helper.dm | 203 ++++++++++++++++++ .../mob/living/simple_animal/damage_procs.dm | 38 ++-- .../mob/living/simple_animal/dc_changes.dm | 52 +++++ .../simple_animal/distortion/_distortion.dm | 2 +- .../distortion/plague/bunnyman.dm | 5 +- .../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 | 6 +- .../mob/living/simple_animal/simple_animal.dm | 19 +- .../mob/living/simple_animal/slime/powers.dm | 2 +- .../projectiles/projectile/ego_bullets/waw.dm | 4 +- code/modules/spells/ability_types/realized.dm | 43 +--- code/modules/suppressions/extraction.dm | 18 +- lobotomy-corp13.dme | 3 + 52 files changed, 544 insertions(+), 235 deletions(-) create mode 100644 code/modules/mob/living/simple_animal/_damage_coeff.dm 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_items/gadgets/unpowered.dm b/ModularTegustation/tegu_items/gadgets/unpowered.dm index e1beedea043a..1f0698d5401d 100644 --- a/ModularTegustation/tegu_items/gadgets/unpowered.dm +++ b/ModularTegustation/tegu_items/gadgets/unpowered.dm @@ -143,7 +143,7 @@ /obj/item/deepscanner/examine(mob/living/M) . = ..() if(deep_scan_log) - to_chat(M, "Previous Scan:[deep_scan_log].") + to_chat(M, "Previous Scan:[deep_scan_log]") /obj/item/deepscanner/attack(mob/living/M, mob/user) user.visible_message("[user] takes a tool out of [src] and begins scanning [M].", "You set down the deep scanner and begin scanning [M].") @@ -165,17 +165,22 @@ check1d = 1 - (H.getarmor(null, PALE_DAMAGE) / 100) if(H.job) check1e = H.job - to_chat(user, "[check1e] [H] [H.maxHealth] [check1a] [check1b] [check1c] [check1d].") else var/mob/living/simple_animal/hostile/mon = M if((mon.status_flags & GODMODE)) return - check1a = mon.damage_coeff[RED_DAMAGE] - check1b = mon.damage_coeff[WHITE_DAMAGE] - check1c = mon.damage_coeff[BLACK_DAMAGE] - check1d = mon.damage_coeff[PALE_DAMAGE] - to_chat(user, "[mon] [mon.maxHealth] [check1a] [check1b] [check1c] [check1d].") - deep_scan_log = "[mon] [mon.maxHealth] [check1a] [check1b] [check1c] [check1d]" + check1a = mon.damage_coeff.getCoeff(RED_DAMAGE) + check1b = mon.damage_coeff.getCoeff(WHITE_DAMAGE) + check1c = mon.damage_coeff.getCoeff(BLACK_DAMAGE) + check1d = mon.damage_coeff.getCoeff(PALE_DAMAGE) + if(isabnormalitymob(mon)) + var/mob/living/simple_animal/hostile/abnormality/abno = mon + check1e = THREAT_TO_NAME[abno.threat_level] + else + check1e = FALSE + var/output = "----------\n[check1e ? check1e+" " : ""][M]\nHP [M.health]/[M.maxHealth]\nR [check1a] W [check1b] B [check1c] P [check1d]\n----------" + to_chat(user, "[output]") + deep_scan_log = output playsound(get_turf(M), 'sound/misc/box_deploy.ogg', 5, 0, 3) diff --git a/ModularTegustation/tegu_items/workshop/mods/curing.dm b/ModularTegustation/tegu_items/workshop/mods/curing.dm index 1fbc4adeeeef..8fd1f6632348 100644 --- a/ModularTegustation/tegu_items/workshop/mods/curing.dm +++ b/ModularTegustation/tegu_items/workshop/mods/curing.dm @@ -9,8 +9,8 @@ var/heal_amt = T.force*0.04 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustSanityLoss(-heal_amt) diff --git a/ModularTegustation/tegu_items/workshop/mods/healthup.dm b/ModularTegustation/tegu_items/workshop/mods/healthup.dm index 229e29bf587b..9af81776495c 100644 --- a/ModularTegustation/tegu_items/workshop/mods/healthup.dm +++ b/ModularTegustation/tegu_items/workshop/mods/healthup.dm @@ -9,8 +9,8 @@ var/heal_amt = T.force*0.10 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustBruteLoss(-heal_amt) diff --git a/ModularTegustation/tegu_items/workshop/mods/sapping.dm b/ModularTegustation/tegu_items/workshop/mods/sapping.dm index 0c3682c21374..66442ad0101e 100644 --- a/ModularTegustation/tegu_items/workshop/mods/sapping.dm +++ b/ModularTegustation/tegu_items/workshop/mods/sapping.dm @@ -9,8 +9,8 @@ var/heal_amt = T.force*0.10 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustSanityLoss(-heal_amt) 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 9c5093b035fd..c50865c23446 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,13 +1069,17 @@ /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/machinery/computer/manager_camera.dm b/code/game/machinery/computer/manager_camera.dm index de955806e188..8fb4cfeea1b9 100644 --- a/code/game/machinery/computer/manager_camera.dm +++ b/code/game/machinery/computer/manager_camera.dm @@ -195,7 +195,7 @@ to_chat(user, "[clicked_atom]'s resistances are : ") var/list/damage_types = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) for(var/i in damage_types) - var/resistance = SimpleResistanceToText(monster.damage_coeff[i]) + var/resistance = SimpleResistanceToText(monster.damage_coeff.getCoeff(i)) if(isnull(resistance)) continue to_chat(user, "[i]: [resistance].") diff --git a/code/game/objects/items/ego_weapons/aleph.dm b/code/game/objects/items/ego_weapons/aleph.dm index f3e8e8c36764..14572d061f7e 100644 --- a/code/game/objects/items/ego_weapons/aleph.dm +++ b/code/game/objects/items/ego_weapons/aleph.dm @@ -183,8 +183,8 @@ var/heal_amt = force*0.15 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustBruteLoss(-heal_amt) diff --git a/code/game/objects/items/ego_weapons/non_abnormality/limbus_ego.dm b/code/game/objects/items/ego_weapons/non_abnormality/limbus_ego.dm index 1211bd81cf57..8247e25dcdd2 100644 --- a/code/game/objects/items/ego_weapons/non_abnormality/limbus_ego.dm +++ b/code/game/objects/items/ego_weapons/non_abnormality/limbus_ego.dm @@ -37,8 +37,8 @@ var/heal_amt = force*0.10 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustBruteLoss(-heal_amt) diff --git a/code/game/objects/items/ego_weapons/non_abnormality/pierre.dm b/code/game/objects/items/ego_weapons/non_abnormality/pierre.dm index b5cc22f2f8dd..9aa21ee79bf8 100644 --- a/code/game/objects/items/ego_weapons/non_abnormality/pierre.dm +++ b/code/game/objects/items/ego_weapons/non_abnormality/pierre.dm @@ -20,8 +20,8 @@ var/heal_amt = force*0.2 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustBruteLoss(-heal_amt) diff --git a/code/game/objects/items/ego_weapons/non_abnormality/purple_tear.dm b/code/game/objects/items/ego_weapons/non_abnormality/purple_tear.dm index b973578797d8..65f7d6bb9462 100644 --- a/code/game/objects/items/ego_weapons/non_abnormality/purple_tear.dm +++ b/code/game/objects/items/ego_weapons/non_abnormality/purple_tear.dm @@ -228,16 +228,9 @@ L.physiology.pale_mod *= 2 return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[RED_DAMAGE] > 0) - M.damage_coeff[RED_DAMAGE] *= 2 - if(M.damage_coeff[WHITE_DAMAGE] > 0) - M.damage_coeff[WHITE_DAMAGE] *= 2 - if(M.damage_coeff[BLACK_DAMAGE] > 0) - M.damage_coeff[BLACK_DAMAGE] *= 2 - if(M.damage_coeff[PALE_DAMAGE] > 0) - M.damage_coeff[PALE_DAMAGE] *= 2 - -/datum/status_effect/pt_lacerate/on_apply() + M.AddModifier(/datum/dc_change/lacerated) + +/datum/status_effect/pt_lacerate/on_remove() . = ..() if(ishuman(owner)) var/mob/living/carbon/human/L = owner @@ -248,14 +241,7 @@ L.physiology.pale_mod /= 2 return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[RED_DAMAGE] > 0) - M.damage_coeff[RED_DAMAGE] /= 2 - if(M.damage_coeff[WHITE_DAMAGE] > 0) - M.damage_coeff[WHITE_DAMAGE] /= 2 - if(M.damage_coeff[BLACK_DAMAGE] > 0) - M.damage_coeff[BLACK_DAMAGE] /= 2 - if(M.damage_coeff[PALE_DAMAGE] > 0) - M.damage_coeff[PALE_DAMAGE] /= 2 + M.RemoveModifier(/datum/dc_change/lacerated) // Slow black damage with a buff attack /obj/item/ego_weapon/city/pt/blunt @@ -314,7 +300,7 @@ L.physiology.pale_mod /= 2 return -/datum/status_effect/pt_lacerate/on_apply() +/datum/status_effect/pt_defense/on_remove() . = ..() if(ishuman(owner)) var/mob/living/carbon/human/L = owner 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 4233da0ce267..489eeb99e50b 100644 --- a/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm +++ b/code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm @@ -223,29 +223,13 @@ ..() 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" //Type C weapons diff --git a/code/game/objects/items/ego_weapons/special.dm b/code/game/objects/items/ego_weapons/special.dm index 13a8ce4ae581..24fffd711978 100644 --- a/code/game/objects/items/ego_weapons/special.dm +++ b/code/game/objects/items/ego_weapons/special.dm @@ -35,7 +35,7 @@ icon_state = "eyeball2" // Cool sprite if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] <= 0) + if(S.damage_coeff.getCoeff(damtype) <= 0) resistance = 100 if(resistance >= 100) // If the eyeball wielder is going no-balls and using one fucking weapon, let's throw them a bone. force *= 0.1 diff --git a/code/game/objects/items/ego_weapons/waw.dm b/code/game/objects/items/ego_weapons/waw.dm index 36160f572f02..c00921699853 100644 --- a/code/game/objects/items/ego_weapons/waw.dm +++ b/code/game/objects/items/ego_weapons/waw.dm @@ -971,8 +971,8 @@ var/heal_amt = force*0.10 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 user.adjustBruteLoss(-heal_amt) @@ -1593,8 +1593,8 @@ var/heal_amt = force*0.05 if(isanimal(target)) var/mob/living/simple_animal/S = target - if(S.damage_coeff[damtype] > 0) - heal_amt *= S.damage_coeff[damtype] + if(S.damage_coeff.getCoeff(damtype) > 0) + heal_amt *= S.damage_coeff.getCoeff(damtype) else heal_amt = 0 amount_filled = clamp(amount_filled + heal_amt, 0, amount_max) diff --git a/code/modules/mob/living/simple_animal/_damage_coeff.dm b/code/modules/mob/living/simple_animal/_damage_coeff.dm new file mode 100644 index 000000000000..b4d1325188f6 --- /dev/null +++ b/code/modules/mob/living/simple_animal/_damage_coeff.dm @@ -0,0 +1,89 @@ +#define DAMCOEFFID "damage_coeff-[red]-[white]-[black]-[pale]-[brute]-[burn]-[tox]-[clone]-[stamina]-[oxy]" + +/proc/getDamCoeff(red = 1, white = 1, black = 1, pale = 1, brute = 1, burn = 1, tox = 1, clone = 1, stamina = 1, oxy = 1) + . = locate(DAMCOEFFID) + if(!.) + . = new /datum/dam_coeff(red, white, black, pale, brute, burn, tox, clone, stamina, oxy) + +/proc/makeDamCoeff(list/dc = list()) + var/list/coeffs = list(RED_DAMAGE = 1, WHITE_DAMAGE = 1, BLACK_DAMAGE = 1, PALE_DAMAGE = 1, BRUTE = 1, BURN = 1, TOX = 1, CLONE = 1, STAMINA = 1, OXY = 1) + for(var/I in dc) + coeffs[I] = dc[I] + return getDamCoeff(coeffs[RED_DAMAGE], coeffs[WHITE_DAMAGE], coeffs[BLACK_DAMAGE], coeffs[PALE_DAMAGE], coeffs[BRUTE], coeffs[BURN], coeffs[TOX], coeffs[CLONE], coeffs[STAMINA], coeffs[OXY]) + +/datum/dam_coeff + datum_flags = DF_USE_TAG + var/brute + var/burn + var/tox + var/clone + var/stamina + var/oxy + var/red + var/white + var/black + var/pale + +/datum/dam_coeff/New(red = 1, white = 1, black = 1, pale = 1, brute = 1, burn = 1, tox = 1, clone = 1, stamina = 1, oxy = 1) + src.red = red + src.white = white + src.black = black + src.pale = pale + src.brute = brute + src.burn = burn + src.tox = tox + src.clone = clone + src.stamina = stamina + src.oxy = oxy + tag = DAMCOEFFID + +/datum/dam_coeff/proc/modifyCoeff(red = 0, white = 0, black = 0, pale = 0, brute = 0, burn = 0, tox = 0, clone = 0, stamina = 0, oxy = 0) + return getDamCoeff(src.red+red, src.white+white, src.black+black, src.pale+pale, src.brute+brute, src.burn+burn, src.tox+tox, src.clone+clone, src.stamina+stamina, src.oxy+oxy) + +/datum/dam_coeff/proc/setCoeff(red, white, black, pale, brute, burn, tox, clone, stamina, oxy) + return getDamCoeff((isnull(red) ? src.red : red),\ + (isnull(white) ? src.white : white),\ + (isnull(black) ? src.black : black),\ + (isnull(pale) ? src.pale : pale),\ + (isnull(brute) ? src.brute : brute),\ + (isnull(burn) ? src.burn : burn),\ + (isnull(tox) ? src.tox : clone),\ + (isnull(clone) ? src.clone : clone),\ + (isnull(stamina) ? src.stamina : stamina),\ + (isnull(oxy) ? src.oxy : oxy)) + +/datum/dam_coeff/proc/getCoeff(coeff) + . = 0 + switch(coeff) + if(BRUTE) + . = brute + if(BURN) + . = burn + if(TOX) + . = tox + if(CLONE) + . = clone + if(STAMINA) + . = stamina + if(OXY) + . = oxy + if(RED_DAMAGE) + . = red + if(WHITE_DAMAGE) + . = white + if(BLACK_DAMAGE) + . = black + if(PALE_DAMAGE) + . = pale + return + +/datum/dam_coeff/proc/getList() + return list(RED_DAMAGE = red, WHITE_DAMAGE = white, BLACK_DAMAGE = black, PALE_DAMAGE = pale, BRUTE = brute, BURN = burn, TOX = tox, CLONE = clone, STAMINA = stamina, OXY = oxy) + +/datum/dam_coeff/vv_edit_var(var_name, var_value) + if (var_name == NAMEOF(src, tag)) + return FALSE + . = ..() + tag = DAMCOEFFID // update tag in case damage_coeff values were edited + +#undef DAMCOEFFID diff --git a/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm b/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm index d81d525ec704..4bbaebfc4f18 100644 --- a/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm +++ b/code/modules/mob/living/simple_animal/abnormality/_abnormality.dm @@ -86,7 +86,7 @@ if(!(type in GLOB.cached_abno_work_rates)) GLOB.cached_abno_work_rates[type] = work_chances.Copy() if(!(type in GLOB.cached_abno_resistances)) - GLOB.cached_abno_resistances[type] = damage_coeff.Copy() + GLOB.cached_abno_resistances[type] = damage_coeff.getList() for(var/action_type in attack_action_types) var/datum/action/innate/abnormality_attack/attack_action = new action_type() attack_action.Grant(src) 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 5243fa0ed2cc..930d5804e13e 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/censored.dm @@ -92,7 +92,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)) @@ -103,7 +103,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 46f299c1902b..2e733dd15455 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 @@ -272,7 +272,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() @@ -286,7 +286,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/seasons.dm b/code/modules/mob/living/simple_animal/abnormality/aleph/seasons.dm index 03e6cf72eea6..7772b50a0fde 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/seasons.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/seasons.dm @@ -203,10 +203,9 @@ /mob/living/simple_animal/hostile/abnormality/seasons/proc/Transform() current_season = SSlobotomy_events.current_season var/list/new_work_chances = modular_work_chance[current_season] - var/list/new_damage_coeff = modular_damage_coeff[current_season] work_chances = new_work_chances.Copy() datum_reference.available_work = work_chances - damage_coeff = new_damage_coeff.Copy() + ChangeResistances(modular_damage_coeff[current_season]) work_damage_type = season_stats[current_season][2] melee_damage_type = season_stats[current_season][2] icon_state = current_season 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 e2e4093528b3..0c9117111d2e 100644 --- a/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm +++ b/code/modules/mob/living/simple_animal/abnormality/aleph/titania.dm @@ -170,10 +170,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..1675ac10046a 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/sacrificed) //***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 909a5476a969..978e1b98e4d1 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 @@ -305,7 +305,7 @@ melee_damage_upper = 45 attack_verb_continuous = "pummels" attack_verb_simple = "pummel" - 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 is_maggot = TRUE diff --git a/code/modules/mob/living/simple_animal/abnormality/he/norinori.dm b/code/modules/mob/living/simple_animal/abnormality/he/norinori.dm index 70794a518cf8..21b38d585881 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/norinori.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/norinori.dm @@ -165,10 +165,7 @@ playsound(src, 'sound/effects/blobattack.ogg', 150, FALSE, 4) playsound(src, 'sound/weapons/chainsawhit.ogg', 250, FALSE, 4) attack_sound = 'sound/abnormalities/helper/attack.ogg' - for(var/damtype in src.damage_coeff) - if(damtype == BRUTE) - continue - damage_coeff[damtype] -= 0.4 + ChangeResistances(list(RED_DAMAGE = 0.1, WHITE_DAMAGE = 1.1, BLACK_DAMAGE = 0.6, PALE_DAMAGE = 1.6)) can_act = TRUE rapid_melee = 3 melee_reach = 3 @@ -182,10 +179,7 @@ icon_state = icon_aggro attack_sound = 'sound/weapons/slashmiss.ogg' SLEEP_CHECK_DEATH(10) - for(var/damtype in src.damage_coeff) - if(damtype == BRUTE) - continue - damage_coeff[damtype] += 0.4 + ChangeResistances(list(RED_DAMAGE = 0.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1, PALE_DAMAGE = 2)) can_act = TRUE rapid_melee = 1 melee_reach = 1 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 61f9ae2fd15c..1ac4ffc39ebd 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 @@ -91,7 +91,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) @@ -136,7 +136,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/red_shoes.dm b/code/modules/mob/living/simple_animal/abnormality/he/red_shoes.dm index ce796f871f3c..8be75be83711 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/red_shoes.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/red_shoes.dm @@ -156,10 +156,10 @@ if(ishuman(H) && (H.sanity_lost)) var/obj/item/clothing/suit/armor/ego_gear/EQ = H.get_item_by_slot(ITEM_SLOT_OCLOTHING)//copies all resistances from worn E.G.O if(EQ) - for(var/damtype in damage_coeff) - if(damtype == BRUTE) - continue - damage_coeff[damtype] -= (EQ.armor[damtype] / 100) + var/list/temp = EQ.armor.getList() + for(var/damtype in temp) + temp[damtype] = 1 - (temp[damtype] / 100) + ChangeResistances(temp) user.forceMove(src) playsound(src, 'sound/abnormalities/redshoes/RedShoes_Activate.ogg', 50, 1) name = user.name @@ -192,7 +192,7 @@ desc = "The Red Shoes’s bloody enameled leather glistens in the light." icon_state = "redshoes_breach" icon_living = "redshoes_breach" - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1, PALE_DAMAGE = 1.5) + ChangeResistances(list(BRUTE = 1, RED_DAMAGE = 0.5, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1, PALE_DAMAGE = 1.5)) sleep(10) new /mob/living/simple_animal/hostile/red_shoe(get_turf(src)) datum_reference.qliphoth_change(-2) 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 1516d5048c8a..3bd7a03166ba 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 @@ -169,7 +169,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" @@ -180,7 +180,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 19b699854624..3278a0648895 100644 --- a/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm +++ b/code/modules/mob/living/simple_animal/abnormality/he/schadenfreude.dm @@ -53,7 +53,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. @@ -69,10 +69,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 af378b728025..bd539c0be689 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 @@ -295,30 +295,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/wrath_servant.dm b/code/modules/mob/living/simple_animal/abnormality/waw/wrath_servant.dm index 088d839e6fee..4f708bcb1ea5 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/wrath_servant.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/wrath_servant.dm @@ -333,7 +333,7 @@ continue if(faction_check(H.faction, list("neutral"), FALSE)) continue - if(H.damage_coeff[RED_DAMAGE] <= 0) // Can't be hurt (Feasibly) + if(H.unmodified_damage_coeff_datum.getCoeff(RED_DAMAGE) <= 0) // Can't be hurt (Feasibly) continue if(H.health < highest_params[1]) continue 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 bfb4c8fb1319..3084e601f2c2 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 dcb7ff38ef37..d341797ee7fa 100644 --- a/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm +++ b/code/modules/mob/living/simple_animal/abnormality/waw/yin.dm @@ -134,14 +134,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/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 46f0e30eaa5a..b1256d420b2c 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -127,10 +127,10 @@ /mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE, actuallydamage = TRUE) var/temp_damage = damage - if(!damage_coeff[damagetype]) + if(!damage_coeff.getList()[damagetype]) temp_damage = 0 else - temp_damage *= damage_coeff[damagetype] + temp_damage *= damage_coeff.getList()[damagetype] if(temp_damage >= 0 && temp_damage <= force_threshold) visible_message("[src] looks unharmed!") 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..3607458b1a7b --- /dev/null +++ b/code/modules/mob/living/simple_animal/damage_coeff_helper.dm @@ -0,0 +1,203 @@ +// 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) + switch(resistance) + if(BRUTE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(brute = value) + if(BURN) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(burn = value) + if(TOX) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(tox = value) + if(CLONE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(clone = value) + if(STAMINA) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(stamina = value) + if(OXY) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(oxy = value) + if(RED_DAMAGE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(red = value) + if(WHITE_DAMAGE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(white = value) + if(BLACK_DAMAGE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(black = value) + if(PALE_DAMAGE) + unmodified_damage_coeff_datum = unmodified_damage_coeff_datum.setCoeff(pale = value) + else + return FALSE + 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() + var/list/cached_resistances = unmodified_damage_coeff_datum.getList() // 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(cached_resistances[dam_type] <= 0) // Immunity / Healing is not modified + continue + cached_resistances[dam_type] *= D.potency + else + if(cached_resistances[D.damage_type] <= 0) // Immunity / Healing is not modified + continue + cached_resistances[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 + cached_resistances[dam_type] += D.potency + else + if(damage_coeff[D.damage_type] <= 0) // Immunity / Healing is not modified + continue + cached_resistances[D.damage_type] += D.potency + + for(var/I in cached_resistances) + cached_resistances[I] = round(cached_resistances[I], 0.1) // Minimizes damage_coeff datums created due to rampant decimals. + + damage_coeff = damage_coeff.setCoeff( + cached_resistances[RED_DAMAGE],\ + cached_resistances[WHITE_DAMAGE],\ + cached_resistances[BLACK_DAMAGE],\ + cached_resistances[PALE_DAMAGE],\ + cached_resistances[BRUTE],\ + cached_resistances[BURN],\ + cached_resistances[TOX],\ + cached_resistances[CLONE],\ + cached_resistances[STAMINA],\ + cached_resistances[OXY]) + +/** + * 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 + + +/** + * Modify a group of resistances by a custom amount. + * Note: This is permanent unless the returned DCs are kept and removed semi-manually later. + * Using the other procs and making a custom dc_change datum is preferable to this, along with tying it to a status effect. + * + * vars: + * * target - a simple animal + * * changes - an associated list of damage types and values (RED_DAMAGE = 1.2, WHITE_DAMAGE = 0.8, ...) + * * additive - TRUE if the values should be added/subtracted to the damage_coeff or FALSE if used multiplicatively. + * + * returns: A list of DC_Changes if successful, otherwise FALSE. + */ +/proc/ModifyResistances(mob/living/simple_animal/target, list/changes = list(), additive = FALSE) + if(!target || !LAZYLEN(changes)) + return FALSE + . = list() + for(var/DT in changes) + var/datum/dc_change/DC = new + DC.additive = additive + DC.potency = changes[DT] + DC.damage_type = DT + . += DC + target.damage_mods += . + target.UpdateResistances() + return + diff --git a/code/modules/mob/living/simple_animal/damage_procs.dm b/code/modules/mob/living/simple_animal/damage_procs.dm index baf4dca53243..2e7003d36f74 100644 --- a/code/modules/mob/living/simple_animal/damage_procs.dm +++ b/code/modules/mob/living/simple_animal/damage_procs.dm @@ -22,60 +22,60 @@ /mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[BRUTE]) - . = adjustHealth(amount * damage_coeff[BRUTE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.brute * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[BURN]) - . = adjustHealth(amount * damage_coeff[BURN] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.burn * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[OXY]) - . = adjustHealth(amount * damage_coeff[OXY] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.oxy * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[TOX]) - . = adjustHealth(amount * damage_coeff[TOX] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.tox * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[CLONE]) - . = adjustHealth(amount * damage_coeff[CLONE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.clone * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustStaminaLoss(amount, updating_health = FALSE, forced = FALSE) if(forced) staminaloss = max(0, min(max_staminaloss, staminaloss + amount)) else - staminaloss = max(0, min(max_staminaloss, staminaloss + (amount * damage_coeff[STAMINA]))) + staminaloss = max(0, min(max_staminaloss, staminaloss + (amount * damage_coeff.stamina))) update_stamina() /mob/living/simple_animal/adjustRedLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[RED_DAMAGE]) - . = adjustHealth(amount * damage_coeff[RED_DAMAGE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.red * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustWhiteLoss(amount, updating_health = TRUE, forced = FALSE, white_healable = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[WHITE_DAMAGE]) - . = adjustHealth(amount * damage_coeff[WHITE_DAMAGE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.white * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustBlackLoss(amount, updating_health = TRUE, forced = FALSE, white_healable = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[BLACK_DAMAGE]) - . = adjustHealth(amount * damage_coeff[BLACK_DAMAGE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.black * CONFIG_GET(number/damage_multiplier), updating_health, forced) /mob/living/simple_animal/adjustPaleLoss(amount, updating_health = TRUE, forced = FALSE) if(forced) . = adjustHealth(amount * CONFIG_GET(number/damage_multiplier), updating_health, forced) - else if(damage_coeff[PALE_DAMAGE]) - . = adjustHealth(amount * damage_coeff[PALE_DAMAGE] * CONFIG_GET(number/damage_multiplier), updating_health, forced) + else + . = adjustHealth(amount * damage_coeff.pale * CONFIG_GET(number/damage_multiplier), updating_health, forced) 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..932b28985174 --- /dev/null +++ b/code/modules/mob/living/simple_animal/dc_changes.dm @@ -0,0 +1,52 @@ + +/// 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/sacrificed + additive = TRUE + potency = 0.1 + damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) + +/// Universal x2 modifer, inflicted by PT +/datum/dc_change/lacerated + potency = 2 + damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE) + +/// x1.05 - x2 Red Modifier, inflicted by Naked Nest Realization +/datum/dc_change/infested + potency = 1.05 diff --git a/code/modules/mob/living/simple_animal/distortion/_distortion.dm b/code/modules/mob/living/simple_animal/distortion/_distortion.dm index 4d6e280dbf58..6ca9ff6903f9 100644 --- a/code/modules/mob/living/simple_animal/distortion/_distortion.dm +++ b/code/modules/mob/living/simple_animal/distortion/_distortion.dm @@ -146,7 +146,7 @@ patrol_reset() density = FALSE AIStatus = AI_OFF - damage_coeff = list(BRUTE = 0, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0) // Prevent death jank + ChangeResistances(list(BRUTE = 0, RED_DAMAGE = 0, WHITE_DAMAGE = 0, BLACK_DAMAGE = 0, PALE_DAMAGE = 0)) // Prevent death jank forceMove(egoist) //Hide the distortion inside of the spawned human in case of shinanigains if(unmanifest_effect) new unmanifest_effect(get_turf(src)) diff --git a/code/modules/mob/living/simple_animal/distortion/plague/bunnyman.dm b/code/modules/mob/living/simple_animal/distortion/plague/bunnyman.dm index ffee4f76c1b8..dd88675fe2c0 100644 --- a/code/modules/mob/living/simple_animal/distortion/plague/bunnyman.dm +++ b/code/modules/mob/living/simple_animal/distortion/plague/bunnyman.dm @@ -94,10 +94,7 @@ playsound(src, 'sound/effects/blobattack.ogg', 150, FALSE, 4) playsound(src, 'sound/weapons/chainsawhit.ogg', 250, FALSE, 4) attack_sound = 'sound/abnormalities/helper/attack.ogg' - for(var/damtype in src.damage_coeff) - if(damtype == BRUTE) - continue - damage_coeff[damtype] += 0.5 + ChangeResistances(list(RED_DAMAGE = 0.7, WHITE_DAMAGE = 1.5, BLACK_DAMAGE = 1.5, PALE_DAMAGE = 2)) melee_damage_lower = 30 melee_damage_upper = 45 rapid_melee = 3 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 31bd33dd785f..2280fbd4ee5a 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/indigo.dm @@ -517,7 +517,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)) SpeedChange(phasespeedchange) rapid_melee +=1 melee_damage_lower -= 10 @@ -535,7 +535,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)) SpeedChange(phasespeedchange) rapid_melee += 2 melee_damage_lower -= 15 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 5612e0c26121..be5fce1a068e 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/steel.dm @@ -314,7 +314,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 && (!has_status_effect(/datum/status_effect/all_armor_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 30dbd0181140..10f3c5d5bf8b 100644 --- a/code/modules/mob/living/simple_animal/hostile/ordeal/white.dm +++ b/code/modules/mob/living/simple_animal/hostile/ordeal/white.dm @@ -282,10 +282,10 @@ playsound(src, 'sound/effects/ordeals/white/white_reflect.ogg', 50, TRUE, 7) visible_message("[pick("This subject is incompatible", \ diff --git a/code/modules/projectiles/projectile/ego_bullets/waw.dm b/code/modules/projectiles/projectile/ego_bullets/waw.dm index 7c024486bb23..84092bf26491 100644 --- a/code/modules/projectiles/projectile/ego_bullets/waw.dm +++ b/code/modules/projectiles/projectile/ego_bullets/waw.dm @@ -237,9 +237,9 @@ . = ..() if(isliving(target)) var/mob/living/simple_animal/M = target - if(!ishuman(M) && !M.has_status_effect(/datum/status_effect/sunder_red)) + if(!ishuman(M) && !M.has_status_effect(/datum/status_effect/rend_red)) new /obj/effect/temp_visual/cult/sparks(get_turf(M)) - M.apply_status_effect(/datum/status_effect/sunder_red) + M.apply_status_effect(/datum/status_effect/rend_red) //feather of valor /obj/projectile/ego_bullet/ego_warring diff --git a/code/modules/spells/ability_types/realized.dm b/code/modules/spells/ability_types/realized.dm index 2b2adef4286a..dc434cdda8ac 100644 --- a/code/modules/spells/ability_types/realized.dm +++ b/code/modules/spells/ability_types/realized.dm @@ -92,28 +92,14 @@ if(!isanimal(owner)) return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[RED_DAMAGE] > 0) - M.damage_coeff[RED_DAMAGE] *= 1.1 - if(M.damage_coeff[WHITE_DAMAGE] > 0) - M.damage_coeff[WHITE_DAMAGE] *= 1.1 - if(M.damage_coeff[BLACK_DAMAGE] > 0) - M.damage_coeff[BLACK_DAMAGE] *= 1.1 - if(M.damage_coeff[PALE_DAMAGE] > 0) - M.damage_coeff[PALE_DAMAGE] *= 1.1 + M.AddModifier(/datum/dc_change/salvation) /datum/status_effect/salvation/on_remove() . = ..() if(!isanimal(owner)) return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[RED_DAMAGE] > 0) - M.damage_coeff[RED_DAMAGE] /= 1.1 - if(M.damage_coeff[WHITE_DAMAGE] > 0) - M.damage_coeff[WHITE_DAMAGE] /= 1.1 - if(M.damage_coeff[BLACK_DAMAGE] > 0) - M.damage_coeff[BLACK_DAMAGE] /= 1.1 - if(M.damage_coeff[PALE_DAMAGE] > 0) - M.damage_coeff[PALE_DAMAGE] /= 1.1 + M.RemoveModifier(/datum/dc_change/salvation) /atom/movable/screen/alert/status_effect/salvation name = "Salvation" @@ -194,10 +180,7 @@ H.physiology.black_mod *= 1.5 return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[BLACK_DAMAGE] <= 0) - qdel(src) - return - M.damage_coeff[BLACK_DAMAGE] *= 1.5 + M.AddModifier(/datum/dc_change/mosb_black) /datum/status_effect/mosb_black_debuff/on_remove() . = ..() @@ -206,7 +189,7 @@ H.physiology.black_mod /= 1.5 return var/mob/living/simple_animal/M = owner - M.damage_coeff[BLACK_DAMAGE] /= 1.5 + M.RemoveModifier(/datum/dc_change/mosb_black) /atom/movable/screen/alert/status_effect/mosb_black_debuff name = "Dread" @@ -257,10 +240,7 @@ H.physiology.pale_mod /= 1.5 return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[PALE_DAMAGE] <= 0) - qdel(src) - return - M.damage_coeff[PALE_DAMAGE] += 0.5 + M.AddModifier(/datum/dc_change/godhead) /datum/status_effect/judgement_pale_debuff/on_remove() . = ..() @@ -269,7 +249,7 @@ H.physiology.pale_mod *= 1.5 return var/mob/living/simple_animal/M = owner - M.damage_coeff[PALE_DAMAGE] -= 0.5 + M.RemoveModifier(/datum/dc_change/godhead) /atom/movable/screen/alert/status_effect/judgement_pale_debuff name = "Soul Drain" @@ -1196,22 +1176,21 @@ /datum/status_effect/stacking/infestation/on_apply() . = ..() var/mob/living/simple_animal/M = owner - red = M.damage_coeff[RED_DAMAGE] + M.AddModifier(/datum/dc_change/infested) /datum/status_effect/stacking/infestation/on_remove() . = ..() var/mob/living/simple_animal/M = owner - M.damage_coeff[RED_DAMAGE] = red + M.RemoveModifier(/datum/dc_change/infested) /datum/status_effect/stacking/infestation/add_stacks(stacks_added) . = ..() if(!isanimal(owner)) return var/mob/living/simple_animal/M = owner - if(M.damage_coeff[RED_DAMAGE] <= 0) - qdel(src) - return - M.damage_coeff[RED_DAMAGE] = red * (1+(stacks/20)) + var/datum/dc_change/infested/mod = M.HasDamageMod(/datum/dc_change/infested) + mod.potency = 1+(stacks/20) + M.UpdateResistances() linked_alert.desc = initial(linked_alert.desc)+"[stacks*5]%!" /mob/living/simple_animal/hostile/naked_nest_serpent_friend diff --git a/code/modules/suppressions/extraction.dm b/code/modules/suppressions/extraction.dm index 8bc55c488297..10501a00c7d5 100644 --- a/code/modules/suppressions/extraction.dm +++ b/code/modules/suppressions/extraction.dm @@ -31,7 +31,7 @@ desc = "The elite agent of the head; Despite being a mere imitation, it is nonetheless an intimidating foe." health = 10000 maxHealth = 10000 - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1) + damage_coeff = list(RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1) icon_state = "arbiter" icon_living = "arbiter" icon_dead = "arbiter" @@ -159,7 +159,7 @@ return FALSE // Death life_stage += 1 adjustHealth(-maxHealth) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1) + ChangeResistances(list(RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1)) fairy_cooldown_time = max(4 SECONDS, fairy_cooldown_time - 2 SECONDS) key_cooldown_time = max(10 SECONDS, fairy_cooldown_time - 4 SECONDS) playsound(get_turf(src), 'sound/magic/arbiter/repulse.ogg', 50, TRUE, 24) @@ -169,7 +169,7 @@ if(2) possible_meltdown_types |= MELTDOWN_PURPLE if(3) - 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)) return TRUE /* Combat */ @@ -291,7 +291,7 @@ return charging = TRUE icon_state = "arbiter_ability" - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1) + ChangeResistances(list(RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1)) SLEEP_CHECK_DEATH(1 SECONDS) playsound(get_turf(src), 'sound/magic/arbiter/repulse.ogg', 50, TRUE, 7) @@ -372,7 +372,7 @@ switch(current_meltdown_type) if(MELTDOWN_GRAY) INVOKE_ASYNC(GLOBAL_PROC, .proc/show_global_blurb, 5 SECONDS, "I am fading.", 1 SECONDS, "black", "yellow", "left", "CENTER,BOTTOM+2") - 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)) SLEEP_CHECK_DEATH(10 SECONDS) if(MELTDOWN_GOLD) INVOKE_ASYNC(GLOBAL_PROC, .proc/show_global_blurb, 5 SECONDS, "The sandman calls me.", 1 SECONDS, "black", "yellow", "left", "CENTER,BOTTOM+2") @@ -383,7 +383,7 @@ SLEEP_CHECK_DEATH(1 SECONDS) check_count += 1 charging = TRUE - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.8, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.8, PALE_DAMAGE = 0.8) + ChangeResistances(list(RED_DAMAGE = 0.8, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.8, PALE_DAMAGE = 0.8)) SLEEP_CHECK_DEATH(10 SECONDS) charging = FALSE if(MELTDOWN_PURPLE) @@ -393,13 +393,13 @@ INVOKE_ASYNC(src, .proc/StopPillarStorm) if(last_stage == life_stage) - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.8, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.8, PALE_DAMAGE = 0.8) + ChangeResistances(list(RED_DAMAGE = 0.8, WHITE_DAMAGE = 0.8, BLACK_DAMAGE = 0.8, PALE_DAMAGE = 0.8)) // Pillar Storm /mob/living/simple_animal/hostile/megafauna/arbiter/proc/StartPillarStorm() charging = TRUE icon_state = "arbiter_ability" - 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)) SLEEP_CHECK_DEATH(2 SECONDS) @@ -459,7 +459,7 @@ pillar_storm_cooldown = world.time + pillar_storm_cooldown_time charging = FALSE icon_state = icon_living - damage_coeff = list(BRUTE = 1, RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1) + ChangeResistances(list(RED_DAMAGE = 0.1, WHITE_DAMAGE = 0.1, BLACK_DAMAGE = 0.1, PALE_DAMAGE = 0.1)) // Arbiter either died(somehow) or meltdown of pillars was cleared /mob/living/simple_animal/hostile/megafauna/arbiter/proc/StopPillarStorm() diff --git a/lobotomy-corp13.dme b/lobotomy-corp13.dme index fd880f40cad6..8209749c5720 100644 --- a/lobotomy-corp13.dme +++ b/lobotomy-corp13.dme @@ -2670,10 +2670,13 @@ #include "code\modules\mob\living\silicon\robot\robot_modules.dm" #include "code\modules\mob\living\silicon\robot\robot_movement.dm" #include "code\modules\mob\living\silicon\robot\robot_say.dm" +#include "code\modules\mob\living\simple_animal\_damage_coeff.dm" #include "code\modules\mob\living\simple_animal\animal_defense.dm" #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_coeff_helper.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"