-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff26da5
commit a2b7850
Showing
6 changed files
with
70 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
code/modules/mob/living/simple_animal/damage_coeff_helper.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// This is a modifier to Simple Animal's damage coeff. | ||
// It's built to standarize the damage changes to abnos and other simple animals without causing them to desync during phase changes. | ||
|
||
/datum/dc_change | ||
name = "Damage Coeff Change" | ||
desc = "This is a modification to a simple_animal's damage_coeff." | ||
/// TRUE if it adds the potency value to damage_coeff, FALSE if it multiplies. | ||
var/additive = FALSE | ||
/// The amount the damage type is added or multiplied by. | ||
var/potency = 0 | ||
/// Effected Damage Type | ||
var/damage_type = RED_DAMAGE | ||
/// Duration when the debuff is removed, in deciseconds by default. | ||
var/duration = 0 SECONDS | ||
var/mob/living/simple_animal/owner | ||
|
||
/datum/dc_change/New(mob/living/simple_animal/S) | ||
if(!istype(S)) | ||
qdel(S) | ||
return | ||
owner = S | ||
owner.damage_mods += src | ||
owner.Update_Coeff() | ||
addtimer(CALLBACK(src, .proc/Remove), duration) | ||
|
||
/datum/dc_change/proc/Remove() | ||
owner.damage_mods -= src | ||
owner.Update_Coeff() | ||
qdel(src) | ||
|
||
/// Updates the Simple Animal's damage coeff's. | ||
/mob/living/simple_animal/proc/UpdateCoeff() | ||
for(var/datum/dc_change/D in damage_mods) | ||
if(D.additive) | ||
continue | ||
damage_coeff[D.damage_type] = unmodified_coeff[D.damage_type] * D.potency | ||
for(var/datum/dc_change/D in damage_mods) | ||
if(!D.additive) | ||
continue | ||
damage_coeff[D.damage_type] = unmodified_coeff[D.damage_type] + D.potency | ||
|
||
/// Give it a dc_change modifier path and it will check aganist that. If it exists in the list, it will be returned. | ||
/mob/living/simple_animal/proc/HasDamageMod(mod) | ||
. = FALSE | ||
if(damage_mods) | ||
for(var/datum/dc_change/modifier in damage_mods) | ||
if(istype(modifer, mod)) | ||
return mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters