Skip to content

Commit

Permalink
Adds ModifyResistances proc and fixing spelling error
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceSmites328 committed Sep 12, 2023
1 parent 0a03f53 commit 1204a8e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
adjustBruteLoss(100)
pulse_damage -= 1
playsound(get_turf(src),'sound/abnormalities/doomsdaycalendar/Limbus_Dead_Generic.ogg', 50, 1)
AddModifier(/datum/dc_change/sacrified)
AddModifier(/datum/dc_change/sacrificed)

//***Simple Mobs***//
//clay dolls
Expand Down
27 changes: 27 additions & 0 deletions code/modules/mob/living/simple_animal/damage_coeff_helper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,30 @@
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

2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/dc_changes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
damage_type = PALE_DAMAGE

/// +0.1 Universal modifier, self-inflicted by Doomsday calender
/datum/dc_change/sacrified
/datum/dc_change/sacrificed
additive = TRUE
potency = 0.1
damage_type = list(RED_DAMAGE, WHITE_DAMAGE, BLACK_DAMAGE, PALE_DAMAGE)

0 comments on commit 1204a8e

Please sign in to comment.