diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index b0312d44134..aa73b686b9d 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -110,3 +110,9 @@ var/gaussian_next if(new_val < bound_lower) new_val = min(orig_val, bound_lower) return new_val + +// sqrt, but if you give it a negative number, you get 0 instead of a runtime +/proc/sqrtor0(num) + if(num < 0) + return 0 + return sqrt(num) diff --git a/code/datums/diseases/advance/symptoms/choking.dm b/code/datums/diseases/advance/symptoms/choking.dm index 172c4b63757..62e31105b92 100644 --- a/code/datums/diseases/advance/symptoms/choking.dm +++ b/code/datums/diseases/advance/symptoms/choking.dm @@ -43,11 +43,11 @@ Bonus return /datum/symptom/choking/proc/Choke_stage_3_4(mob/living/M, datum/disease/advance/A) - var/get_damage = sqrt(21+A.totalStageSpeed()*0.5)+sqrt(16+A.totalStealth()) + var/get_damage = sqrtor0(21+A.totalStageSpeed()*0.5)+sqrtor0(16+A.totalStealth()) M.adjustOxyLoss(get_damage) return 1 /datum/symptom/choking/proc/Choke(mob/living/M, datum/disease/advance/A) - var/get_damage = sqrt(21+A.totalStageSpeed()*0.5)+sqrt(16+A.totalStealth()*5) + var/get_damage = sqrtor0(21+A.totalStageSpeed()*0.5)+sqrtor0(16+A.totalStealth()*5) M.adjustOxyLoss(get_damage) return 1 \ No newline at end of file diff --git a/code/datums/diseases/advance/symptoms/fever.dm b/code/datums/diseases/advance/symptoms/fever.dm index 917ec9f3bf1..b19d821b75f 100644 --- a/code/datums/diseases/advance/symptoms/fever.dm +++ b/code/datums/diseases/advance/symptoms/fever.dm @@ -36,6 +36,6 @@ Bonus return /datum/symptom/fever/proc/Heat(mob/living/M, datum/disease/advance/A) - var/get_heat = (sqrt(21+A.totalTransmittable()*2))+(sqrt(20+A.totalStageSpeed()*3)) + var/get_heat = (sqrtor0(21+A.totalTransmittable()*2))+(sqrtor0(20+A.totalStageSpeed()*3)) M.bodytemperature = min(M.bodytemperature + (get_heat * A.stage), BODYTEMP_HEAT_DAMAGE_LIMIT - 1) return 1 \ No newline at end of file diff --git a/code/datums/diseases/advance/symptoms/fire.dm b/code/datums/diseases/advance/symptoms/fire.dm index ad828efdd4c..1466bc86459 100644 --- a/code/datums/diseases/advance/symptoms/fire.dm +++ b/code/datums/diseases/advance/symptoms/fire.dm @@ -45,13 +45,13 @@ Bonus return /datum/symptom/fire/proc/Firestacks_stage_4(mob/living/M, datum/disease/advance/A) - var/get_stacks = (sqrt(20+A.totalStageSpeed()*2))-(sqrt(16+A.totalStealth())) + var/get_stacks = (sqrtor0(20+A.totalStageSpeed()*2))-(sqrtor0(16+A.totalStealth())) M.adjust_fire_stacks(get_stacks) M.adjustFireLoss(get_stacks/2) return 1 /datum/symptom/fire/proc/Firestacks_stage_5(mob/living/M, datum/disease/advance/A) - var/get_stacks = (sqrt(20+A.totalStageSpeed()*3))-(sqrt(16+A.totalStealth())) + var/get_stacks = (sqrtor0(20+A.totalStageSpeed()*3))-(sqrtor0(16+A.totalStealth())) M.adjust_fire_stacks(get_stacks) M.adjustFireLoss(get_stacks) return 1 \ No newline at end of file diff --git a/code/datums/diseases/advance/symptoms/flesh_eating.dm b/code/datums/diseases/advance/symptoms/flesh_eating.dm index e99f6f2835b..9cfdf8a9d34 100644 --- a/code/datums/diseases/advance/symptoms/flesh_eating.dm +++ b/code/datums/diseases/advance/symptoms/flesh_eating.dm @@ -38,6 +38,6 @@ Bonus return /datum/symptom/flesh_eating/proc/Flesheat(mob/living/M, datum/disease/advance/A) - var/get_damage = ((sqrt(16-A.totalStealth()))*5) + var/get_damage = ((sqrtor0(16-A.totalStealth()))*5) M.adjustBruteLoss(get_damage) return 1 \ No newline at end of file diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 11235d9a35b..007bbc92f0b 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -34,7 +34,7 @@ Bonus return /datum/symptom/heal/proc/Heal(mob/living/M, datum/disease/advance/A) - var/get_damage = (sqrt(20+A.totalStageSpeed())*(1+rand())) + var/get_damage = (sqrtor0(20+A.totalStageSpeed())*(1+rand())) M.adjustToxLoss(-get_damage) return 1 @@ -148,7 +148,7 @@ Bonus level = 5 /datum/symptom/heal/dna/Heal(mob/living/carbon/M, datum/disease/advance/A) - var/amt_healed = (sqrt(20+A.totalStageSpeed()*(3+rand())))-(sqrt(16+A.totalStealth()*rand())) + var/amt_healed = (sqrtor0(20+A.totalStageSpeed()*(3+rand())))-(sqrtor0(16+A.totalStealth()*rand())) M.adjustBrainLoss(-amt_healed) //Non-power mutations, excluding race, so the virus does not force monkey -> human transformations. var/list/unclean_mutations = (not_good_mutations|bad_mutations) - mutations_list[RACEMUT] diff --git a/code/datums/diseases/advance/symptoms/shivering.dm b/code/datums/diseases/advance/symptoms/shivering.dm index a26a19de048..d52a0a02256 100644 --- a/code/datums/diseases/advance/symptoms/shivering.dm +++ b/code/datums/diseases/advance/symptoms/shivering.dm @@ -35,6 +35,6 @@ Bonus return /datum/symptom/shivering/proc/Chill(mob/living/M, datum/disease/advance/A) - var/get_cold = (sqrt(16+A.totalStealth()*2))+(sqrt(21+A.totalResistance()*2)) + var/get_cold = (sqrtor0(16+A.totalStealth()*2))+(sqrtor0(21+A.totalResistance()*2)) M.bodytemperature = min(M.bodytemperature - (get_cold * A.stage), BODYTEMP_COLD_DAMAGE_LIMIT + 1) return 1 \ No newline at end of file