Skip to content

Commit

Permalink
Damage Coeff Change Standardization (vlggms#1326)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LanceSmites328 authored and vampirebat74 committed May 10, 2024
1 parent 6d04f24 commit ae5a291
Show file tree
Hide file tree
Showing 52 changed files with 544 additions and 235 deletions.
21 changes: 13 additions & 8 deletions ModularTegustation/tegu_items/gadgets/unpowered.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
/obj/item/deepscanner/examine(mob/living/M)
. = ..()
if(deep_scan_log)
to_chat(M, "<span class='notice'>Previous Scan:[deep_scan_log].</span>")
to_chat(M, "<span class='notice'>Previous Scan:[deep_scan_log]</span>")

/obj/item/deepscanner/attack(mob/living/M, mob/user)
user.visible_message("<span class='notice'>[user] takes a tool out of [src] and begins scanning [M].</span>", "<span class='notice'>You set down the deep scanner and begin scanning [M].</span>")
Expand All @@ -165,17 +165,22 @@
check1d = 1 - (H.getarmor(null, PALE_DAMAGE) / 100)
if(H.job)
check1e = H.job
to_chat(user, "<span class='notice'>[check1e] [H] [H.maxHealth] [check1a] [check1b] [check1c] [check1d].</span>")
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, "<span class='notice'>[mon] [mon.maxHealth] [check1a] [check1b] [check1c] [check1d].</span>")
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, "<span class='notice'>[output]</span>")
deep_scan_log = output
playsound(get_turf(M), 'sound/misc/box_deploy.ogg', 5, 0, 3)


Expand Down
4 changes: 2 additions & 2 deletions ModularTegustation/tegu_items/workshop/mods/curing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ModularTegustation/tegu_items/workshop/mods/healthup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ModularTegustation/tegu_items/workshop/mods/sapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ModularTegustation/tegu_mobs/chaos_marine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/lobotomy_events.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 11 additions & 13 deletions code/datums/status_effects/buffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 29 additions & 16 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/manager_camera.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
to_chat(user, "<span class='notice'>[clicked_atom]'s resistances are : </span>")
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, "<span class='notice'>[i]: [resistance].</span>")
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/ego_weapons/aleph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/ego_weapons/non_abnormality/pierre.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 5 additions & 19 deletions code/game/objects/items/ego_weapons/non_abnormality/purple_tear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 3 additions & 19 deletions code/game/objects/items/ego_weapons/non_abnormality/wcorp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/ego_weapons/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/ego_weapons/waw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading

0 comments on commit ae5a291

Please sign in to comment.