From ea6128f986505cfa5231929445f833b09c827fce Mon Sep 17 00:00:00 2001 From: Neerti Date: Tue, 18 Apr 2017 21:17:29 -0400 Subject: [PATCH] Adds Modifier System, Changes Some Ling Stuff Adds a fairly simple system that allows adjusting various numbers like max health, incoming damage, outgoing melee damage, etc. The nice part is that changing certain variables this way (like max health) is a lot safer than manually setting the max health var directly. Changes a lot of short lines of code to point towards a variable's getter or setter helper instead of reading the var directly so the modifiers can work. Endoarmor, delayed toxin sting, Enfeebling sting, and recursive adrenaline overdose now use the modifier system. Enfeebling sting now only lasts two minutes, from five minutes, however it now also reduces the victim's melee damage by 25%/50%, and increases the damage they suffer by 10%/35%, for normal and recursive respectively. Delayed Toxin Sting's effects are now felt all at once instead of over the course of a few minutes. --- code/ZAS/Phoron.dm | 2 +- code/__defines/mobs.dm | 6 + code/_onclick/item_attack.dm | 3 + .../changeling/powers/blind_sting.dm | 2 +- .../changeling/powers/delayed_toxin_sting.dm | 32 +-- .../gamemodes/changeling/powers/endoarmor.dm | 11 +- .../changeling/powers/enfeebling_string.dm | 40 ++-- .../changeling/powers/epinephrine_overdose.dm | 24 ++- .../changeling/powers/rapid_regen.dm | 2 +- .../gamemodes/changeling/powers/respec.dm | 4 +- .../gamemodes/changeling/powers/shriek.dm | 2 +- code/game/gamemodes/cult/runes.dm | 4 +- .../technomancer/spells/aura/unstable_aura.dm | 2 +- .../spells/insert/asphyxiation.dm | 4 +- .../technomancer/spells/resurrect.dm | 2 +- .../spells/summon/summon_creature.dm | 2 +- code/game/machinery/cryo.dm | 2 +- code/game/mecha/medical/odysseus.dm | 2 +- code/game/objects/items/devices/flash.dm | 4 +- code/game/objects/items/devices/scanners.dm | 2 +- code/game/objects/items/weapons/tools.dm | 2 +- code/game/verbs/suicide.dm | 4 +- code/modules/clothing/glasses/glasses.dm | 2 +- code/modules/genetics/side_effects.dm | 2 +- .../subtypes/input_output.dm | 8 +- code/modules/mining/ore.dm | 2 +- code/modules/mob/living/bot/bot.dm | 10 +- code/modules/mob/living/carbon/alien/life.dm | 4 +- code/modules/mob/living/carbon/brain/life.dm | 6 +- .../mob/living/carbon/human/human_damage.dm | 56 +++++- .../mob/living/carbon/human/human_movement.dm | 6 +- code/modules/mob/living/carbon/human/life.dm | 8 +- .../modules/mob/living/carbon/metroid/life.dm | 4 +- .../mob/living/carbon/metroid/metroid.dm | 4 +- .../mob/living/carbon/metroid/powers.dm | 2 +- code/modules/mob/living/life.dm | 6 +- code/modules/mob/living/living.dm | 184 ++++++++++++++++-- code/modules/mob/living/living_defines.dm | 2 +- code/modules/mob/living/silicon/robot/life.dm | 4 +- .../mob/living/silicon/robot/robot_damage.dm | 4 +- code/modules/mob/living/silicon/silicon.dm | 10 +- .../mob/living/simple_animal/aliens/drone.dm | 10 +- .../living/simple_animal/animals/spiderbot.dm | 6 +- .../simple_animal/constructs/constructs.dm | 6 +- .../simple_animal/constructs/soulstone.dm | 2 +- .../simple_animal/humanoids/mechamobs.dm | 2 +- .../mob/living/simple_animal/simple_animal.dm | 12 +- code/modules/mob/mob.dm | 24 +++ code/modules/mob/mob_grab.dm | 2 +- code/modules/mob/modifiers.dm | 106 ++++++++++ code/modules/organs/internal/brain.dm | 2 +- code/modules/organs/internal/eyes.dm | 2 +- code/modules/organs/internal/liver.dm | 2 +- code/modules/organs/organ_external.dm | 2 +- code/modules/organs/organ_internal.dm | 2 +- code/modules/projectiles/projectile/energy.dm | 8 +- .../modules/projectiles/projectile/special.dm | 2 +- .../Chemistry-Reagents-Dispenser.dm | 2 +- .../Chemistry-Reagents-Food-Drinks.dm | 6 +- .../Chemistry-Reagents-Medicine.dm | 8 +- .../Chemistry-Reagents-Other.dm | 4 +- .../Chemistry-Reagents-Toxins.dm | 4 +- code/modules/shieldgen/emergency_shield.dm | 2 +- code/modules/spells/spellbook.dm | 2 +- code/modules/spells/targeted/targeted.dm | 4 +- code/modules/virus2/effect.dm | 2 +- .../xenobio2/machinery/injector_computer.dm | 2 +- polaris.dme | 1 + 68 files changed, 537 insertions(+), 172 deletions(-) create mode 100644 code/modules/mob/modifiers.dm diff --git a/code/ZAS/Phoron.dm b/code/ZAS/Phoron.dm index 92dd6f5d517..4a4c29dcfbc 100644 --- a/code/ZAS/Phoron.dm +++ b/code/ZAS/Phoron.dm @@ -132,7 +132,7 @@ obj/var/phoronproof = 0 eye_blurry = min(eye_blurry+1.5,50) if (prob(max(0,E.damage - 15) + 1) &&!eye_blind) src << "You are blinded!" - eye_blind += 20 + Blind(20) /mob/living/carbon/human/proc/pl_head_protected() //Checks if the head is adequately sealed. diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 1dc64363558..7180fe4c376 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -148,6 +148,12 @@ #define INCAPACITATION_DISABLED (INCAPACITATION_KNOCKDOWN|INCAPACITATION_STUNNED) #define INCAPACITATION_ALL (~INCAPACITATION_NONE) +#define MODIFIER_STACK_FORBID 1 // Disallows stacking entirely. +#define MODIFIER_STACK_EXTEND 2 // Disallows a second instance, but will extend the first instance if possible. +#define MODIFIER_STACK_ALLOWED 3 // Multiple instances are allowed. + +#define MODIFIER_GENETIC 0 // Modifiers with this flag will be copied to mobs who get cloned. + // Bodyparts and organs. #define O_MOUTH "mouth" #define O_EYES "eyes" diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 88e69696bfe..b41dd9c57b6 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -84,6 +84,9 @@ avoid code duplication. This includes items that may sometimes act as a standard playsound(loc, hitsound, 50, 1, -1) var/power = force + for(var/datum/modifier/M in user.modifiers) + if(!isnull(M.outgoing_melee_damage_percent)) + power *= M.outgoing_melee_damage_percent if(HULK in user.mutations) power *= 2 return target.hit_with_weapon(src, user, power, hit_zone) diff --git a/code/game/gamemodes/changeling/powers/blind_sting.dm b/code/game/gamemodes/changeling/powers/blind_sting.dm index e098c98f034..41b14478b3d 100644 --- a/code/game/gamemodes/changeling/powers/blind_sting.dm +++ b/code/game/gamemodes/changeling/powers/blind_sting.dm @@ -26,7 +26,7 @@ src << "They will be deprived of sight for longer." spawn(duration) T.disabilities &= ~NEARSIGHTED - T.eye_blind = 10 + T.Blind(10) T.eye_blurry = 20 feedback_add_details("changeling_powers","BS") return 1 \ No newline at end of file diff --git a/code/game/gamemodes/changeling/powers/delayed_toxin_sting.dm b/code/game/gamemodes/changeling/powers/delayed_toxin_sting.dm index fd72524e5a2..a9b323465c3 100644 --- a/code/game/gamemodes/changeling/powers/delayed_toxin_sting.dm +++ b/code/game/gamemodes/changeling/powers/delayed_toxin_sting.dm @@ -2,12 +2,24 @@ name = "Delayed Toxic Sting" desc = "We silently sting a biological, causing a significant amount of toxins after a few minutes, allowing us to not \ implicate ourselves." - helptext = "The toxin takes effect in about two minutes. The sting has a three minute cooldown between uses." + helptext = "The toxin takes effect in about two minutes. Multiple applications within the two minutes will not cause increased toxicity." enhancedtext = "The toxic damage is doubled." ability_icon_state = "ling_sting_del_toxin" genomecost = 1 verbpath = /mob/proc/changeling_delayed_toxic_sting +/datum/modifier/delayed_toxin_sting + name = "delayed toxin injection" + hidden = TRUE + stacks = MODIFIER_STACK_FORBID + on_expired_text = "You feel a burning sensation flowing through your veins!" + +/datum/modifier/delayed_toxin_sting/on_expire() + holder.adjustToxLoss(rand(20, 30)) + +/datum/modifier/delayed_toxin_sting/strong/on_expire() + holder.adjustToxLoss(rand(40, 60)) + /mob/proc/changeling_delayed_toxic_sting() set category = "Changeling" set name = "Delayed Toxic Sting (20)" @@ -19,21 +31,13 @@ T.attack_log += text("\[[time_stamp()]\] Was delayed toxic stung by [key_name(src)]") src.attack_log += text("\[[time_stamp()]\] Used delayed toxic sting on [key_name(T)]") msg_admin_attack("[key_name(T)] was delayed toxic stung by [key_name(src)]") - var/i = rand(20,30) + + var/type_to_give = /datum/modifier/delayed_toxin_sting if(src.mind.changeling.recursive_enhancement) - i = i * 2 + type_to_give = /datum/modifier/delayed_toxin_sting/strong src << "Our toxin will be extra potent, when it strikes." - spawn(2 MINUTES) - if(T) //We might not exist in two minutes, for whatever reason. - T << "You feel a burning sensation flowing through your veins!" - while(i) - T.adjustToxLoss(1) - i-- - sleep(2 SECONDS) - src.verbs -= /mob/proc/changeling_delayed_toxic_sting - spawn(3 MINUTES) - src << "We are ready to use our delayed toxic string once more." - src.verbs |= /mob/proc/changeling_delayed_toxic_sting + + T.add_modifier(type_to_give, 2 MINUTES) feedback_add_details("changeling_powers","DTS") diff --git a/code/game/gamemodes/changeling/powers/endoarmor.dm b/code/game/gamemodes/changeling/powers/endoarmor.dm index 4052568a50e..536aef26ce3 100644 --- a/code/game/gamemodes/changeling/powers/endoarmor.dm +++ b/code/game/gamemodes/changeling/powers/endoarmor.dm @@ -6,9 +6,18 @@ isVerb = 0 verbpath = /mob/proc/changeling_endoarmor +/datum/modifier/endoarmor + name = "endoarmor" + desc = "We have hard plating underneath our skin, making us more durable." + + on_created_text = "We feel protective plating form underneath our skin." + on_expired_text = "Our protective armor underneath our skin fades as we absorb it." + max_health_flat = 50 + //Increases macimum chemical storage /mob/proc/changeling_endoarmor() if(ishuman(src)) var/mob/living/carbon/human/H = src - H.maxHealth += 50 + H.add_modifier(/datum/modifier/endoarmor) + // H.maxHealth += 50 return 1 \ No newline at end of file diff --git a/code/game/gamemodes/changeling/powers/enfeebling_string.dm b/code/game/gamemodes/changeling/powers/enfeebling_string.dm index 5370a682009..b7a6c569572 100644 --- a/code/game/gamemodes/changeling/powers/enfeebling_string.dm +++ b/code/game/gamemodes/changeling/powers/enfeebling_string.dm @@ -1,13 +1,29 @@ /datum/power/changeling/enfeebling_string name = "Enfeebling String" desc = "We sting a biological with a potent toxin that will greatly weaken them for a short period of time." - helptext = "Lowers the maximum health of the victim for a few minutes. This sting will also warn them of this. Has a \ - five minute coodown between uses." - enhancedtext = "Maximum health is lowered further." + helptext = "Lowers the maximum health of the victim for a few minutes, as well as making them more frail and weak. This sting will also warn them of this." + enhancedtext = "Maximum health and outgoing melee damage is lowered further. Incoming damage is increased." ability_icon_state = "ling_sting_enfeeble" genomecost = 1 verbpath = /mob/proc/changeling_enfeebling_string +/datum/modifier/enfeeble + name = "enfeebled" + desc = "You feel really weak and frail for some reason." + + stacks = MODIFIER_STACK_EXTEND + max_health_percent = 0.7 + outgoing_melee_damage_percent = 0.75 + incoming_damage_percent = 1.1 + on_created_text = "You feel a small prick and you feel extremly weak!" + on_expired_text = "You no longer feel extremly weak." + +// Now YOU'RE the Teshari! +/datum/modifier/enfeeble/strong + max_health_percent = 0.5 + outgoing_melee_damage_percent = 0.5 + incoming_damage_percent = 1.35 + /mob/proc/changeling_enfeebling_string() set category = "Changeling" set name = "Enfeebling Sting (30)" @@ -23,22 +39,10 @@ src.attack_log += text("\[[time_stamp()]\] Used enfeebling sting on [key_name(T)]") msg_admin_attack("[key_name(T)] was enfeebling stung by [key_name(src)]") - - var/effect = 30 //percent + var/type_to_give = /datum/modifier/enfeeble if(src.mind.changeling.recursive_enhancement) - effect = effect + 20 + type_to_give = /datum/modifier/enfeeble/strong src << "We make them extremely weak." - var/health_to_take_away = H.maxHealth * (effect / 100) - - H.maxHealth -= health_to_take_away - H << "You feel a small prick and you feel extremly weak!" - src.verbs -= /mob/proc/changeling_enfeebling_string - spawn(5 MINUTES) - src.verbs |= /mob/proc/changeling_enfeebling_string - src << "Our enfeebling string is ready to be used once more." - if(H) //Just incase we stop existing in five minutes for whatever reason. - H.maxHealth += health_to_take_away - if(!H.stat) //It'd be weird to no longer feel weak when you're dead. - H << "You no longer feel extremly weak." + H.add_modifier(type_to_give, 2 MINUTES) feedback_add_details("changeling_powers","ES") return 1 \ No newline at end of file diff --git a/code/game/gamemodes/changeling/powers/epinephrine_overdose.dm b/code/game/gamemodes/changeling/powers/epinephrine_overdose.dm index 3875a4b4fa5..38d200cad56 100644 --- a/code/game/gamemodes/changeling/powers/epinephrine_overdose.dm +++ b/code/game/gamemodes/changeling/powers/epinephrine_overdose.dm @@ -2,11 +2,20 @@ name = "Epinephrine Overdose" desc = "We evolve additional sacs of adrenaline throughout our body." helptext = "We can instantly recover from stuns and reduce the effect of future stuns, but we will suffer toxicity in the long term. Can be used while unconscious." - enhancedtext = "Constant recovery from stuns for thirty seconds." + enhancedtext = "Immunity from most disabling effects for 30 seconds." ability_icon_state = "ling_epinepherine_overdose" genomecost = 2 verbpath = /mob/proc/changeling_epinephrine_overdose +/datum/modifier/unstoppable + name = "unstoppable" + desc = "We feel limitless amounts of energy surge in our veins. Nothing can stop us!" + + stacks = MODIFIER_STACK_EXTEND + on_created_text = "We feel unstoppable!" + on_expired_text = "We feel our newfound energy fade..." + disable_duration_percent = 0 + //Recover from stuns. /mob/proc/changeling_epinephrine_overdose() set category = "Changeling" @@ -30,18 +39,7 @@ C.reagents.add_reagent("epinephrine", 20) if(src.mind.changeling.recursive_enhancement) - src << "We feel unstoppable." - spawn(1) - var/i = 30 - while(i) - C.SetParalysis(0) - C.SetStunned(0) - C.SetWeakened(0) - C.lying = 0 - C.update_canmove() - i-- - sleep(10) - src << "We feel our newfound energy fade." + C.add_modifier(/datum/modifier/unstoppable, 30 SECONDS) feedback_add_details("changeling_powers","UNS") return 1 diff --git a/code/game/gamemodes/changeling/powers/rapid_regen.dm b/code/game/gamemodes/changeling/powers/rapid_regen.dm index eddf83292ed..2eb628b8f6c 100644 --- a/code/game/gamemodes/changeling/powers/rapid_regen.dm +++ b/code/game/gamemodes/changeling/powers/rapid_regen.dm @@ -35,7 +35,7 @@ C.species.create_organs(C) C.restore_all_organs() C.blinded = 0 - C.eye_blind = 0 + C.SetBlinded(0) C.eye_blurry = 0 C.ear_deaf = 0 C.ear_damage = 0 diff --git a/code/game/gamemodes/changeling/powers/respec.dm b/code/game/gamemodes/changeling/powers/respec.dm index 7910ceaf7c5..efdf67ec6b0 100644 --- a/code/game/gamemodes/changeling/powers/respec.dm +++ b/code/game/gamemodes/changeling/powers/respec.dm @@ -17,8 +17,8 @@ ling_datum.chem_storage = 50 if(ishuman(src)) var/mob/living/carbon/human/H = src - H.does_not_breathe = 0 //If self respiration was bought, revert that too. - H.maxHealth = initial(H.maxHealth) //Revert endoarmor too. + // H.does_not_breathe = 0 //If self respiration was bought, revert that too. + H.remove_modifiers_of_type(/datum/modifier/endoarmor) //Revert endoarmor too. src.make_changeling() //And give back our freebies. src << "We have removed our evolutions from this form, and are now ready to readapt." diff --git a/code/game/gamemodes/changeling/powers/shriek.dm b/code/game/gamemodes/changeling/powers/shriek.dm index 2b8af49eb6f..ded66148fa4 100644 --- a/code/game/gamemodes/changeling/powers/shriek.dm +++ b/code/game/gamemodes/changeling/powers/shriek.dm @@ -55,7 +55,7 @@ M << "You hear an extremely loud screeching sound! It \ [pick("confuses","confounds","perturbs","befuddles","dazes","unsettles","disorients")] you." M.adjustEarDamage(0,30) - M.confused += 20 + M.Confuse(20) M << sound('sound/effects/screech.ogg') M.attack_log += text("\[[time_stamp()]\] Was affected by [key_name(src)]'s Resonant Shriek.") else diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 61f177eae55..027b61333ec 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -958,7 +958,7 @@ var/list/sacrificed = list() if(N) continue C.eye_blurry += 50 - C.eye_blind += 20 + C.Blind(20) if(prob(5)) C.disabilities |= NEARSIGHTED if(prob(10)) @@ -981,7 +981,7 @@ var/list/sacrificed = list() if(N) continue C.eye_blurry += 30 - C.eye_blind += 10 + C.Blind(10) //talismans is weaker. affected += C C.show_message("You feel a sharp pain in your eyes, and the world disappears into darkness..", 3) diff --git a/code/game/gamemodes/technomancer/spells/aura/unstable_aura.dm b/code/game/gamemodes/technomancer/spells/aura/unstable_aura.dm index 431e72a32f8..3c65a9503fc 100644 --- a/code/game/gamemodes/technomancer/spells/aura/unstable_aura.dm +++ b/code/game/gamemodes/technomancer/spells/aura/unstable_aura.dm @@ -25,7 +25,7 @@ if(is_ally(L)) continue - var/damage_to_inflict = max(L.health / L.maxHealth, 0) // Otherwise, those in crit would actually be healed. + var/damage_to_inflict = max(L.health / L.getMaxHealth(), 0) // Otherwise, those in crit would actually be healed. var/armor_factor = abs(L.getarmor(null, "energy") - 100) armor_factor = armor_factor / 100 diff --git a/code/game/gamemodes/technomancer/spells/insert/asphyxiation.dm b/code/game/gamemodes/technomancer/spells/insert/asphyxiation.dm index 555ff9f5592..84b0b22931a 100644 --- a/code/game/gamemodes/technomancer/spells/insert/asphyxiation.dm +++ b/code/game/gamemodes/technomancer/spells/insert/asphyxiation.dm @@ -32,7 +32,7 @@ warned_victim = predict_crit(pulses, H, 0) sleep(4 SECONDS) H.adjustOxyLoss(5) - var/health_lost = H.maxHealth - H.getOxyLoss() + H.getToxLoss() + H.getFireLoss() + H.getBruteLoss() + H.getCloneLoss() + var/health_lost = H.getMaxHealth() - H.getOxyLoss() + H.getToxLoss() + H.getFireLoss() + H.getBruteLoss() + H.getCloneLoss() H.adjustOxyLoss(round(abs(health_lost * 0.25))) //world << "Inflicted [round(abs(health_lost * 0.25))] damage!" pulses-- @@ -62,7 +62,7 @@ pulses_remaining-- return .(pulses_remaining, victim, previous_damage) // Now check if our damage predictions are going to cause the victim to go into crit if no healing occurs. - if(previous_damage + health_lost >= victim.maxHealth) // We're probably going to hardcrit + if(previous_damage + health_lost >= victim.getMaxHealth()) // We're probably going to hardcrit victim << "A feeling of immense dread starts to overcome you as everything starts \ to fade to black..." //world << "Predicted hardcrit." diff --git a/code/game/gamemodes/technomancer/spells/resurrect.dm b/code/game/gamemodes/technomancer/spells/resurrect.dm index c56df4f26e2..90a352c95f4 100644 --- a/code/game/gamemodes/technomancer/spells/resurrect.dm +++ b/code/game/gamemodes/technomancer/spells/resurrect.dm @@ -32,7 +32,7 @@ user << "You stab \the [L] with a hidden integrated hypo, attempting to bring them back..." if(istype(L, /mob/living/simple_animal)) var/mob/living/simple_animal/SM = L - SM.health = SM.maxHealth / 3 + SM.health = SM.getMaxHealth() / 3 SM.stat = CONSCIOUS dead_mob_list -= SM living_mob_list += SM diff --git a/code/game/gamemodes/technomancer/spells/summon/summon_creature.dm b/code/game/gamemodes/technomancer/spells/summon/summon_creature.dm index 7cf36ebabfb..0e7e96104c1 100644 --- a/code/game/gamemodes/technomancer/spells/summon/summon_creature.dm +++ b/code/game/gamemodes/technomancer/spells/summon/summon_creature.dm @@ -62,4 +62,4 @@ // Now we hurt their new pal, because being forcefully abducted by teleportation can't be healthy. - summoned.health = round(summoned.maxHealth * 0.7) \ No newline at end of file + summoned.health = round(summoned.getMaxHealth() * 0.7) \ No newline at end of file diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index d1ab11e7067..5d0f707ae88 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -96,7 +96,7 @@ occupantData["name"] = occupant.name occupantData["stat"] = occupant.stat occupantData["health"] = occupant.health - occupantData["maxHealth"] = occupant.maxHealth + occupantData["maxHealth"] = occupant.getMaxHealth() occupantData["minHealth"] = config.health_threshold_dead occupantData["bruteLoss"] = occupant.getBruteLoss() occupantData["oxyLoss"] = occupant.getOxyLoss() diff --git a/code/game/mecha/medical/odysseus.dm b/code/game/mecha/medical/odysseus.dm index 967c03252f3..6aec830c899 100644 --- a/code/game/mecha/medical/odysseus.dm +++ b/code/game/mecha/medical/odysseus.dm @@ -95,7 +95,7 @@ holder.icon_state = "hudhealth-100" C.images += holder else - holder.icon_state = RoundHealth((patient.health-config.health_threshold_crit)/(patient.maxHealth-config.health_threshold_crit)*100) + holder.icon_state = RoundHealth((patient.health-config.health_threshold_crit)/(patient.getMaxHealth()-config.health_threshold_crit)*100) C.images += holder holder = patient.hud_list[STATUS_HUD] diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index b553f4416ce..62d7e7b311c 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -92,8 +92,8 @@ flash_strength *= H.species.flash_mod if(flash_strength > 0) - H.confused = max(H.confused, flash_strength + 5) - H.eye_blind = max(H.eye_blind, flash_strength) + H.Confuse(flash_strength + 5) + H.Blind(flash_strength) H.eye_blurry = max(H.eye_blurry, flash_strength + 5) H.flash_eyes() H.adjustHalLoss(halloss_per_flash * (flash_strength / 5)) // Should take four flashes to stun. diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 243d301289b..5d883784aa0 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -69,7 +69,7 @@ REAGENT SCANNER user.show_message("Analyzing Results for [M]:") user.show_message("Overall Status: dead") else - user.show_message("Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round((M.health/M.maxHealth)*100) ]% healthy"]") + user.show_message("Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round((M.health/M.getMaxHealth())*100) ]% healthy"]") user.show_message(" Key: Suffocation/Toxin/Burns/Brute", 1) user.show_message(" Damage Specifics: [OX] - [TX] - [BU] - [BR]") user.show_message("Body Temperature: [M.bodytemperature-T0C]°C ([M.bodytemperature*1.8-459.67]°F)", 1) diff --git a/code/game/objects/items/weapons/tools.dm b/code/game/objects/items/weapons/tools.dm index 1080e1b8fbe..8c4067187fe 100644 --- a/code/game/objects/items/weapons/tools.dm +++ b/code/game/objects/items/weapons/tools.dm @@ -401,7 +401,7 @@ user.sdisabilities |= BLIND else if (E.damage >= E.min_bruised_damage) user << "You go blind!" - user.eye_blind = 5 + user.Blind(5) user.eye_blurry = 5 user.disabilities |= NEARSIGHTED spawn(100) diff --git a/code/game/verbs/suicide.dm b/code/game/verbs/suicide.dm index ec84ee42329..6e23d74bbb6 100644 --- a/code/game/verbs/suicide.dm +++ b/code/game/verbs/suicide.dm @@ -127,7 +127,7 @@ suiciding = 1 viewers(src) << "[src] is powering down. It looks like \he's trying to commit suicide." //put em at -175 - adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(getMaxHealth() * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() /mob/living/silicon/robot/verb/suicide() @@ -147,7 +147,7 @@ suiciding = 1 viewers(src) << "[src] is powering down. It looks like \he's trying to commit suicide." //put em at -175 - adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(getMaxHealth() * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) updatehealth() /mob/living/silicon/pai/verb/suicide() diff --git a/code/modules/clothing/glasses/glasses.dm b/code/modules/clothing/glasses/glasses.dm index 137cab1a01d..9e27f5c73dd 100644 --- a/code/modules/clothing/glasses/glasses.dm +++ b/code/modules/clothing/glasses/glasses.dm @@ -402,7 +402,7 @@ BLIND // can't see anything var/mob/living/carbon/human/M = src.loc M << "\red The Optical Thermal Scanner overloads and blinds you!" if(M.glasses == src) - M.eye_blind = 3 + M.Blind(3) M.eye_blurry = 5 // Don't cure being nearsighted if(!(M.disabilities & NEARSIGHTED)) diff --git a/code/modules/genetics/side_effects.dm b/code/modules/genetics/side_effects.dm index dcb5b4e4990..f3a9efb6d2b 100644 --- a/code/modules/genetics/side_effects.dm +++ b/code/modules/genetics/side_effects.dm @@ -72,7 +72,7 @@ finish(mob/living/carbon/human/H) if(!H.reagents.has_reagent("anti_toxin")) - H.confused += 100 + H.Confuse(100) proc/trigger_side_effect(mob/living/carbon/human/H) spawn diff --git a/code/modules/integrated_electronics/subtypes/input_output.dm b/code/modules/integrated_electronics/subtypes/input_output.dm index baa5738d4ea..6f7003ed948 100644 --- a/code/modules/integrated_electronics/subtypes/input_output.dm +++ b/code/modules/integrated_electronics/subtypes/input_output.dm @@ -99,8 +99,8 @@ if(!istype(H)) //Invalid input return if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. - var/total_health = round(H.health/H.maxHealth, 0.1)*100 - var/missing_health = H.maxHealth - H.health + var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100 + var/missing_health = H.getMaxHealth() - H.health var/datum/integrated_io/total = outputs[1] var/datum/integrated_io/missing = outputs[2] @@ -138,8 +138,8 @@ if(!istype(H)) //Invalid input return if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. - var/total_health = round(H.health/H.maxHealth, 0.1)*100 - var/missing_health = H.maxHealth - H.health + var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100 + var/missing_health = H.getMaxHealth() - H.health var/datum/integrated_io/total = outputs[1] var/datum/integrated_io/missing = outputs[2] diff --git a/code/modules/mining/ore.dm b/code/modules/mining/ore.dm index 128dc173328..e531e5208f3 100644 --- a/code/modules/mining/ore.dm +++ b/code/modules/mining/ore.dm @@ -37,7 +37,7 @@ var/mob/living/carbon/human/H = hit_atom if(istype(H) && H.has_eyes() && prob(85)) H << "Some of \the [src] gets in your eyes!" - H.eye_blind += 5 + H.Blind(5) H.eye_blurry += 10 spawn(1) if(istype(loc, /turf/)) qdel(src) diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm index 8c61b68a3ea..873934c0c70 100644 --- a/code/modules/mob/living/bot/bot.dm +++ b/code/modules/mob/living/bot/bot.dm @@ -70,10 +70,10 @@ /mob/living/bot/updatehealth() if(status_flags & GODMODE) - health = maxHealth + health = getMaxHealth() stat = CONSCIOUS else - health = maxHealth - getFireLoss() - getBruteLoss() + health = getMaxHealth() - getFireLoss() - getBruteLoss() oxyloss = 0 toxloss = 0 cloneloss = 0 @@ -104,9 +104,9 @@ user << "You need to unlock the controls first." return else if(istype(O, /obj/item/weapon/weldingtool)) - if(health < maxHealth) + if(health < getMaxHealth()) if(open) - health = min(maxHealth, health + 10) + health = min(getMaxHealth(), health + 10) user.visible_message("[user] repairs [src].","You repair [src].") else user << "Unable to repair with the maintenance panel closed." @@ -224,7 +224,7 @@ /mob/living/bot/proc/getPatrolTurf() var/minDist = INFINITY var/obj/machinery/navbeacon/targ = locate() in get_turf(src) - + if(!targ) for(var/obj/machinery/navbeacon/N in navbeacons) if(!N.codes["patrol"]) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index a7764d3d1dc..fd48b912a0d 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -73,11 +73,11 @@ // Eyes and blindness. if(!has_eyes()) - eye_blind = 1 + SetBlinded(1) blinded = 1 eye_blurry = 1 else if(eye_blind) - eye_blind = max(eye_blind-1,0) + AdjustBlinded(-1) blinded = 1 else if(eye_blurry) eye_blurry = max(eye_blurry-1, 0) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 3f41f21ce55..bac50b1e626 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -76,7 +76,7 @@ if(ingested) ingested.metabolize() if(bloodstr) bloodstr.metabolize() - confused = max(0, confused - 1) + AdjustConfused(-1) // decrement dizziness counter, clamped to 0 if(resting) dizziness = max(0, dizziness - 5) @@ -110,7 +110,7 @@ if(31 to INFINITY) emp_damage = 30//Let's not overdo it if(21 to 30)//High level of EMP damage, unable to see, hear, or speak - eye_blind = 1 + SetBlinded(1) blinded = 1 ear_deaf = 1 silent = 1 @@ -123,7 +123,7 @@ if(20) alert = 0 blinded = 0 - eye_blind = 0 + SetBlinded(0) ear_deaf = 0 silent = 0 emp_damage -= 1 diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index fa3d19ebabe..02d85bbcfaf 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -2,7 +2,7 @@ /mob/living/carbon/human/updatehealth() if(status_flags & GODMODE) - health = maxHealth + health = getMaxHealth() stat = CONSCIOUS return @@ -14,10 +14,10 @@ total_brute += O.brute_dam total_burn += O.burn_dam - health = maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute + health = getMaxHealth() - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute //TODO: fix husking - if( ((maxHealth - total_burn) < config.health_threshold_dead) && stat == DEAD) + if( ((getMaxHealth() - total_burn) < config.health_threshold_dead) && stat == DEAD) ChangeToHusk() return @@ -42,7 +42,7 @@ if(should_have_organ("brain")) var/obj/item/organ/internal/brain/sponge = internal_organs_by_name["brain"] if(sponge) - sponge.damage = min(max(amount, 0),(maxHealth*2)) + sponge.damage = min(max(amount, 0),(getMaxHealth()*2)) brainloss = sponge.damage else brainloss = 200 @@ -56,7 +56,7 @@ if(should_have_organ("brain")) var/obj/item/organ/internal/brain/sponge = internal_organs_by_name["brain"] if(sponge) - brainloss = min(sponge.damage,maxHealth*2) + brainloss = min(sponge.damage,getMaxHealth()*2) else brainloss = 200 else @@ -99,16 +99,32 @@ /mob/living/carbon/human/adjustBruteLoss(var/amount) amount = amount*species.brute_mod if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_brute_damage_percent)) + amount *= M.incoming_brute_damage_percent take_overall_damage(amount, 0) else + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent heal_overall_damage(-amount, 0) BITSET(hud_updateflag, HEALTH_HUD) /mob/living/carbon/human/adjustFireLoss(var/amount) amount = amount*species.burn_mod if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_fire_damage_percent)) + amount *= M.incoming_fire_damage_percent take_overall_damage(0, amount) else + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent heal_overall_damage(0, -amount) BITSET(hud_updateflag, HEALTH_HUD) @@ -118,8 +134,16 @@ var/obj/item/organ/external/O = get_organ(organ_name) if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_brute_damage_percent)) + amount *= M.incoming_brute_damage_percent O.take_damage(amount, 0, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(-amount, 0, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) @@ -131,8 +155,16 @@ var/obj/item/organ/external/O = get_organ(organ_name) if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_fire_damage_percent)) + amount *= M.incoming_fire_damage_percent O.take_damage(0, amount, sharp=is_sharp(damage_source), edge=has_edge(damage_source), used_weapon=damage_source) else + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. O.heal_damage(0, -amount, internal=0, robo_repair=(O.robotic >= ORGAN_ROBOT)) @@ -400,11 +432,25 @@ This function restores all organs. if(BRUTE) damageoverlaytemp = 20 damage = damage*species.brute_mod + + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + damage *= M.incoming_damage_percent + if(!isnull(M.incoming_brute_damage_percent)) + damage *= M.incoming_brute_damage_percent + if(organ.take_damage(damage, 0, sharp, edge, used_weapon)) UpdateDamageIcon() if(BURN) damageoverlaytemp = 20 damage = damage*species.burn_mod + + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + damage *= M.incoming_damage_percent + if(!isnull(M.incoming_brute_damage_percent)) + damage *= M.incoming_fire_damage_percent + if(organ.take_damage(0, damage, sharp, edge, used_weapon)) UpdateDamageIcon() diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 2ffec342883..75d61c62738 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -15,7 +15,11 @@ if(force_max_speed) return -3 // Returning -1 will actually result in a slowdown for Teshari. - var/health_deficiency = (maxHealth - health) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.slowdown)) + tally += M.slowdown + + var/health_deficiency = (getMaxHealth() - health) if(health_deficiency >= 40) tally += (health_deficiency / 25) if(can_feel_pain()) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index e6563a28a1b..7ce62e1ae9a 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -971,18 +971,18 @@ vision = internal_organs_by_name[species.vision_organ] if(!species.vision_organ) // Presumably if a species has no vision organs, they see via some other means. - eye_blind = 0 + SetBlinded(0) blinded = 0 eye_blurry = 0 else if(!vision || vision.is_broken()) // Vision organs cut out or broken? Permablind. - eye_blind = 1 + SetBlinded(1) blinded = 1 eye_blurry = 1 else //You have the requisite organs if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own blinded = 1 else if(eye_blind) // Blindness, heals slowly over time - eye_blind = max(eye_blind-1,0) + AdjustBlinded(-1) blinded = 1 else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster eye_blurry = max(eye_blurry-3, 0) @@ -1536,7 +1536,7 @@ if(stat == DEAD) holder.icon_state = "-100" // X_X else - holder.icon_state = RoundHealth((health-config.health_threshold_crit)/(maxHealth-config.health_threshold_crit)*100) + holder.icon_state = RoundHealth((health-config.health_threshold_crit)/(getMaxHealth()-config.health_threshold_crit)*100) hud_list[HEALTH_HUD] = holder if (BITTEST(hud_updateflag, LIFE_HUD)) diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index 7bbc4110dde..0f393a9417d 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -80,7 +80,7 @@ src.blinded = null - health = maxHealth - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) + health = getMaxHealth() - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss()) if(health < 0 && stat != DEAD) death() @@ -118,7 +118,7 @@ if (src.stuttering) src.stuttering = 0 if (src.eye_blind) - src.eye_blind = 0 + SetBlinded(0) src.blinded = 1 if (src.ear_deaf > 0) src.ear_deaf = 0 diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 3c0bfbdbadd..5fdea4a0e6f 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -81,7 +81,7 @@ var/tally = 0 - var/health_deficiency = (maxHealth - health) + var/health_deficiency = (getMaxHealth() - health) if(health_deficiency >= 30) tally += (health_deficiency / 25) if (bodytemperature < 183.222) @@ -146,7 +146,7 @@ ..() statpanel("Status") - stat(null, "Health: [round((health / maxHealth) * 100)]%") + stat(null, "Health: [round((health / getMaxHealth()) * 100)]%") stat(null, "Intent: [a_intent]") if (client.statpanel == "Status") diff --git a/code/modules/mob/living/carbon/metroid/powers.dm b/code/modules/mob/living/carbon/metroid/powers.dm index 933596ef5e2..9e20d49a442 100644 --- a/code/modules/mob/living/carbon/metroid/powers.dm +++ b/code/modules/mob/living/carbon/metroid/powers.dm @@ -21,7 +21,7 @@ return "I cannot feed on other slimes..." if (!Adjacent(M)) return "This subject is too far away..." - if (istype(M, /mob/living/carbon) && M.getCloneLoss() >= M.maxHealth * 1.5 || istype(M, /mob/living/simple_animal) && M.stat == DEAD) + if (istype(M, /mob/living/carbon) && M.getCloneLoss() >= M.getMaxHealth() * 1.5 || istype(M, /mob/living/simple_animal) && M.stat == DEAD) return "This subject does not have an edible life energy..." for(var/mob/living/carbon/slime/met in view()) if(met.Victim == M && met != src) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index 9271167d40d..2209c630084 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -10,6 +10,8 @@ return var/datum/gas_mixture/environment = loc.return_air() + handle_modifiers() // Do this early since it might affect other things later. + if(stat != DEAD) //Breathing, if applicable handle_breathing() @@ -148,9 +150,9 @@ /mob/living/proc/handle_disabilities() //Eyes if(sdisabilities & BLIND || stat) //blindness from disability or unconsciousness doesn't get better on its own - eye_blind = max(eye_blind, 1) + SetBlinded(1) else if(eye_blind) //blindness, heals slowly over time - eye_blind = max(eye_blind-1,0) + AdjustBlinded(-1) else if(eye_blurry) //blurry eyes heal slowly eye_blurry = max(eye_blurry-1, 0) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index ab55807be8d..2f8df3caae8 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -150,9 +150,9 @@ default behaviour is: /mob/living/verb/succumb() set hidden = 1 - if ((src.health < 0 && src.health > (5-src.maxHealth))) // Health below Zero but above 5-away-from-death, as before, but variable - src.adjustOxyLoss(src.health + src.maxHealth * 2) // Deal 2x health in OxyLoss damage, as before but variable. - src.health = src.maxHealth - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() + if ((src.health < 0 && src.health > (5-src.getMaxHealth()))) // Health below Zero but above 5-away-from-death, as before, but variable + src.adjustOxyLoss(src.health + src.getMaxHealth() * 2) // Deal 2x health in OxyLoss damage, as before but variable. + src.health = src.getMaxHealth() - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() src << "\blue You have given up life and succumbed to death." @@ -161,7 +161,7 @@ default behaviour is: health = 100 stat = CONSCIOUS else - health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - halloss + health = getMaxHealth() - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() - halloss //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually @@ -223,14 +223,38 @@ default behaviour is: /mob/living/proc/adjustBruteLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - bruteloss = min(max(bruteloss + amount, 0),(maxHealth*2)) + + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_brute_damage_percent)) + amount *= M.incoming_brute_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + + bruteloss = min(max(bruteloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/getOxyLoss() return oxyloss /mob/living/proc/adjustOxyLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - oxyloss = min(max(oxyloss + amount, 0),(maxHealth*2)) + + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_oxy_damage_percent)) + amount *= M.incoming_oxy_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + + oxyloss = min(max(oxyloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/setOxyLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode @@ -241,7 +265,19 @@ default behaviour is: /mob/living/proc/adjustToxLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - toxloss = min(max(toxloss + amount, 0),(maxHealth*2)) + + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_tox_damage_percent)) + amount *= M.incoming_tox_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + + toxloss = min(max(toxloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/setToxLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode @@ -255,14 +291,37 @@ default behaviour is: /mob/living/proc/adjustFireLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - fireloss = min(max(fireloss + amount, 0),(maxHealth*2)) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_fire_damage_percent)) + amount *= M.incoming_fire_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + + fireloss = min(max(fireloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/getCloneLoss() return cloneloss /mob/living/proc/adjustCloneLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - cloneloss = min(max(cloneloss + amount, 0),(maxHealth*2)) + + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_clone_damage_percent)) + amount *= M.incoming_clone_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + + cloneloss = min(max(cloneloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/setCloneLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode @@ -273,7 +332,7 @@ default behaviour is: /mob/living/proc/adjustBrainLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - brainloss = min(max(brainloss + amount, 0),(maxHealth*2)) + brainloss = min(max(brainloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/setBrainLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode @@ -284,18 +343,117 @@ default behaviour is: /mob/living/proc/adjustHalLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode - halloss = min(max(halloss + amount, 0),(maxHealth*2)) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_damage_percent)) + amount *= M.incoming_damage_percent + if(!isnull(M.incoming_hal_damage_percent)) + amount *= M.incoming_hal_damage_percent + if(!isnull(M.disable_duration_percent)) + amount *= M.incoming_hal_damage_percent + else if(amount < 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.incoming_healing_percent)) + amount *= M.incoming_healing_percent + halloss = min(max(halloss + amount, 0),(getMaxHealth()*2)) /mob/living/proc/setHalLoss(var/amount) if(status_flags & GODMODE) return 0 //godmode halloss = amount +// Use this to get a mob's max health whenever possible. Reading maxHealth directly will give inaccurate results if any modifiers exist. /mob/living/proc/getMaxHealth() - return maxHealth + var/result = maxHealth + for(var/datum/modifier/M in modifiers) + if(!isnull(M.max_health_flat)) + result += M.max_health_flat + // Second loop is so we can get all the flat adjustments first before multiplying, otherwise the result will be different. + for(var/datum/modifier/M in modifiers) + if(!isnull(M.max_health_percent)) + result *= M.max_health_percent + return result /mob/living/proc/setMaxHealth(var/newMaxHealth) maxHealth = newMaxHealth +/mob/living/Stun(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustStunned(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/Weaken(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustWeakened(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/Paralyse(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustParalysis(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/Sleeping(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustSleeping(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/Confuse(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustConfused(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/Blind(amount) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + +/mob/living/AdjustBlinded(amount) + if(amount > 0) + for(var/datum/modifier/M in modifiers) + if(!isnull(M.disable_duration_percent)) + amount = round(amount * M.disable_duration_percent) + ..(amount) + // ++++ROCKDTBEN++++ MOB PROCS //END /mob/proc/get_contents() @@ -433,7 +591,7 @@ default behaviour is: // fix blindness and deafness blinded = 0 - eye_blind = 0 + SetBlinded(0) eye_blurry = 0 ear_deaf = 0 ear_damage = 0 diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index e6b7f2979df..d8913e7b5b8 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -2,7 +2,7 @@ see_invisible = SEE_INVISIBLE_LIVING //Health and life related vars - var/maxHealth = 100 //Maximum health that should be possible. + var/maxHealth = 100 //Maximum health that should be possible. Avoid adjusting this if you can, and instead use modifiers datums. var/health = 100 //A mob's health var/hud_updateflag = 0 diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 9dacf9924c4..a9464c595e8 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -98,7 +98,7 @@ else //Not stunned. src.stat = 0 - confused = max(0, confused - 1) + AdjustConfused(-1) else //Dead. src.blinded = 1 @@ -107,7 +107,7 @@ if (src.stuttering) src.stuttering-- if (src.eye_blind) - src.eye_blind-- + src.AdjustBlinded(-1) src.blinded = 1 if (src.ear_deaf > 0) src.ear_deaf-- diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index 1b051e029f4..58a81ca7a7d 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -1,9 +1,9 @@ /mob/living/silicon/robot/updatehealth() if(status_flags & GODMODE) - health = maxHealth + health = getMaxHealth() stat = CONSCIOUS return - health = maxHealth - (getBruteLoss() + getFireLoss()) + health = getMaxHealth() - (getBruteLoss() + getFireLoss()) return /mob/living/silicon/robot/getBruteLoss() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 738e9969676..40b18525282 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -63,16 +63,16 @@ switch(severity) if(1) src.take_organ_damage(0,20,emp=1) - confused = (min(confused + 5, 30)) + Confuse(5) if(2) src.take_organ_damage(0,15,emp=1) - confused = (min(confused + 4, 30)) + Confuse(4) if(3) src.take_organ_damage(0,10,emp=1) - confused = (min(confused + 3, 30)) + Confuse(3) if(4) src.take_organ_damage(0,5,emp=1) - confused = (min(confused + 2, 30)) + Confuse(2) flash_eyes(affect_silicon = 1) src << "*BZZZT*" src << "Warning: Electromagnetic pulse detected." @@ -148,7 +148,7 @@ // this function shows the health of the AI in the Status panel /mob/living/silicon/proc/show_system_integrity() if(!src.stat) - stat(null, text("System integrity: [round((health/maxHealth)*100)]%")) + stat(null, text("System integrity: [round((health/getMaxHealth())*100)]%")) else stat(null, text("Systems nonfunctional")) diff --git a/code/modules/mob/living/simple_animal/aliens/drone.dm b/code/modules/mob/living/simple_animal/aliens/drone.dm index 3d1ae1bd02d..06de6b4d141 100644 --- a/code/modules/mob/living/simple_animal/aliens/drone.dm +++ b/code/modules/mob/living/simple_animal/aliens/drone.dm @@ -17,7 +17,7 @@ response_help = "pokes" response_disarm = "gently pushes aside" response_harm = "hits" - + a_intent = I_HURT ranged = 1 rapid = 1 @@ -99,16 +99,16 @@ src.visible_message("\red \icon[src] [src] suddenly lights up, and additional targetting vanes slide into place.") hostile = 1 - if(health / maxHealth > 0.9) + if(health / getMaxHealth() > 0.9) icon_state = "drone3" explode_chance = 0 - else if(health / maxHealth > 0.7) + else if(health / getMaxHealth() > 0.7) icon_state = "drone2" explode_chance = 0 - else if(health / maxHealth > 0.5) + else if(health / getMaxHealth() > 0.5) icon_state = "drone1" explode_chance = 0.5 - else if(health / maxHealth > 0.3) + else if(health / getMaxHealth() > 0.3) icon_state = "drone0" explode_chance = 5 else if(health > 0) diff --git a/code/modules/mob/living/simple_animal/animals/spiderbot.dm b/code/modules/mob/living/simple_animal/animals/spiderbot.dm index 1bb202d1a03..95b7e81a177 100644 --- a/code/modules/mob/living/simple_animal/animals/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/animals/spiderbot.dm @@ -95,10 +95,10 @@ if (istype(O, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = O if (WT.remove_fuel(0)) - if(health < maxHealth) + if(health < getMaxHealth()) health += pick(1,1,1,2,2,3) - if(health > maxHealth) - health = maxHealth + if(health > getMaxHealth()) + health = getMaxHealth() add_fingerprint(user) src.visible_message("\The [user] has spot-welded some of the damage to \the [src]!") else diff --git a/code/modules/mob/living/simple_animal/constructs/constructs.dm b/code/modules/mob/living/simple_animal/constructs/constructs.dm index c24100476cc..1cc1a85108b 100644 --- a/code/modules/mob/living/simple_animal/constructs/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs/constructs.dm @@ -57,7 +57,7 @@ /mob/living/simple_animal/construct/attack_generic(var/mob/user) if(istype(user, /mob/living/simple_animal/construct/builder)) - if(health < maxHealth) + if(health < getMaxHealth()) adjustBruteLoss(-5) user.visible_message("\The [user] mends some of \the [src]'s wounds.") else @@ -68,9 +68,9 @@ /mob/living/simple_animal/construct/examine(mob/user) ..(user) var/msg = "*---------*\nThis is \icon[src] \a [src]!\n" - if (src.health < src.maxHealth) + if (src.health < src.getMaxHealth()) msg += "" - if (src.health >= src.maxHealth/2) + if (src.health >= src.getMaxHealth()/2) msg += "It looks slightly dented.\n" else msg += "It looks severely dented!\n" diff --git a/code/modules/mob/living/simple_animal/constructs/soulstone.dm b/code/modules/mob/living/simple_animal/constructs/soulstone.dm index 05087c40368..7b5e77f5c39 100644 --- a/code/modules/mob/living/simple_animal/constructs/soulstone.dm +++ b/code/modules/mob/living/simple_animal/constructs/soulstone.dm @@ -170,7 +170,7 @@ T.forceMove(src) //put shade in stone T.status_flags |= GODMODE T.canmove = 0 - T.health = T.maxHealth + T.health = T.getMaxHealth() src.icon_state = "soulstone2" T << "Your soul has been recaptured by the soul stone, its arcane energies are reknitting your ethereal form" diff --git a/code/modules/mob/living/simple_animal/humanoids/mechamobs.dm b/code/modules/mob/living/simple_animal/humanoids/mechamobs.dm index 79f389821e7..ae700d60b76 100644 --- a/code/modules/mob/living/simple_animal/humanoids/mechamobs.dm +++ b/code/modules/mob/living/simple_animal/humanoids/mechamobs.dm @@ -75,7 +75,7 @@ /mob/living/simple_animal/hostile/mecha/Life() . = ..() if(!.) return - if((health < maxHealth*0.3) && prob(10)) + if((health < getMaxHealth()*0.3) && prob(10)) sparks.start() /mob/living/simple_animal/hostile/mecha/bullet_act() diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index af20f042019..3ad6260813a 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -234,8 +234,8 @@ density = 1 //Overhealth - else if(health > maxHealth) - health = maxHealth + else if(health > getMaxHealth()) + health = getMaxHealth() /mob/living/simple_animal/update_icon() ..() @@ -534,7 +534,7 @@ if(istype(O, /obj/item/stack/medical)) if(stat != DEAD) var/obj/item/stack/medical/MED = O - if(health < maxHealth) + if(health < getMaxHealth()) if(MED.amount >= 1) adjustBruteLoss(-MED.heal_brute) MED.amount -= 1 @@ -602,7 +602,7 @@ ..() if(statpanel("Status") && show_stat_health) - stat(null, "Health: [round((health / maxHealth) * 100)]%") + stat(null, "Health: [round((health / getMaxHealth()) * 100)]%") /mob/living/simple_animal/lay_down() ..() @@ -645,10 +645,10 @@ adjustBruteLoss(30) /mob/living/simple_animal/adjustBruteLoss(damage) - health = Clamp(health - damage, 0, maxHealth) + health = Clamp(health - damage, 0, getMaxHealth()) /mob/living/simple_animal/adjustFireLoss(damage) - health = Clamp(health - damage, 0, maxHealth) + health = Clamp(health - damage, 0, getMaxHealth()) // Check target_mob if worthy of attack (i.e. check if they are dead or empty mecha) /mob/living/simple_animal/proc/SA_attackable(target_mob) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 714bde7096a..f16af92a740 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -804,6 +804,30 @@ sleeping = max(sleeping + amount,0) return +/mob/proc/Confuse(amount) + confused = max(max(confused,amount),0) + return + +/mob/proc/SetConfused(amount) + confused = max(amount,0) + return + +/mob/proc/AdjustConfused(amount) + confused = max(confused + amount,0) + return + +/mob/proc/Blind(amount) + eye_blind = max(max(eye_blind,amount),0) + return + +/mob/proc/SetBlinded(amount) + eye_blind = max(amount,0) + return + +/mob/proc/AdjustBlinded(amount) + eye_blind = max(eye_blind + amount,0) + return + /mob/proc/Resting(amount) facing_dir = null resting = max(max(resting,amount),0) diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index f3cd084ffac..80f68b979d5 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -170,7 +170,7 @@ if(announce) assailant.visible_message("[assailant] covers [affecting]'s eyes!") if(affecting.eye_blind < 3) - affecting.eye_blind = 3 + affecting.Blind(3) /obj/item/weapon/grab/attack_self() return s_click(hud) diff --git a/code/modules/mob/modifiers.dm b/code/modules/mob/modifiers.dm new file mode 100644 index 00000000000..6ba148916e3 --- /dev/null +++ b/code/modules/mob/modifiers.dm @@ -0,0 +1,106 @@ +// This is a datum that tells the mob that something is affecting them. +// The advantage of using this datum verses just setting a variable on the mob directly, is that there is no risk of two different procs overwriting +// each other, or other weirdness. An excellent example is adjusting max health. + +/datum/modifier + var/name = null // Mostly used to organize, might show up on the UI in the Future(tm) + var/desc = null // Ditto. + var/icon_state = null // See above. + var/mob/living/holder = null // The mob that this datum is affecting. + var/expire_at = null // world.time when holder's Life() will remove the datum. If null, it lasts forever or until it gets deleted by something else. + var/on_created_text = null // Text to show to holder upon being created. + var/on_expired_text = null // Text to show to holder when it expires. + var/hidden = FALSE // If true, it will not show up on the HUD in the Future(tm) + var/stacks = MODIFIER_STACK_FORBID // If true, attempts to add a second instance of this type will refresh expire_at instead. + var/flags = 0 // Flags for the modifier, see mobs.dm defines for more details. + + // Now for all the different effects. + // Percentage modifiers are expressed as a multipler. (e.g. +25% damage should be written as 1.25) + var/max_health_flat // Adjusts max health by a flat (e.g. +20) amount. Note this is added to base health. + var/max_health_percent // Adjusts max health by a percentage (e.g. -30%). + var/disable_duration_percent // Adjusts duration of 'disables' (stun, weaken, paralyze, confusion, sleep, halloss, etc) Setting to 0 will grant immunity. + var/incoming_damage_percent // Adjusts all incoming damage. + var/incoming_brute_damage_percent // Only affects bruteloss. + var/incoming_fire_damage_percent // Only affects fireloss. + var/incoming_tox_damage_percent // Only affects toxloss. + var/incoming_oxy_damage_percent // Only affects oxyloss. + var/incoming_clone_damage_percent // Only affects cloneloss. + var/incoming_hal_damage_percent // Only affects halloss. + var/incoming_healing_percent // Adjusts amount of healing received. + var/outgoing_melee_damage_percent // Adjusts melee damage inflicted by holder by a percentage. Affects attacks by melee weapons and hand-to-hand. + var/slowdown // Negative numbers speed up, positive numbers slow down movement. + +/datum/modifier/New(var/new_holder) + holder = new_holder + ..() + +// Checks to see if this datum should continue existing. +/datum/modifier/proc/check_if_valid() + if(expire_at && expire_at < world.time) // Is our time up? + src.expire() + +/datum/modifier/proc/expire(var/silent = FALSE) + if(on_expired_text && !silent) + to_chat(holder, on_expired_text) + on_expire() + holder.modifiers.Remove(src) + qdel(src) + +// Override this for special effects when it gets removed. +/datum/modifier/proc/on_expire() + return + +/mob/living + var/list/modifiers = list() // A list of modifier datums, which can adjust certain mob numbers. + +/mob/living/Destroy() + remove_all_modifiers(TRUE) + ..() + +// Called by Life(). +/mob/living/proc/handle_modifiers() + if(!modifiers.len) // No work to do. + return + // Get rid of anything we shouldn't have. + for(var/datum/modifier/M in modifiers) + M.check_if_valid() + +// Call this to add a modifier to a mob. First argument is the modifier type you want, second is how long it should last, in ticks. +// The SECONDS/MINUTES macro is very helpful for this. E.g. M.add_modifier(/datum/modifier/example, 5 MINUTES) +/mob/living/proc/add_modifier(var/modifier_type, var/expire_at = null) + // First, check if the mob already has this modifier. + for(var/datum/modifier/M in modifiers) + if(ispath(modifier_type, M.type)) + switch(M.stacks) + if(MODIFIER_STACK_FORBID) + return // Stop here. + if(MODIFIER_STACK_ALLOWED) + break // No point checking anymore. + if(MODIFIER_STACK_EXTEND) + // Not allow to add a second instance, but we can try to prolong the first instance. + if(expire_at && world.time + expire_at > M.expire_at) + M.expire_at = world.time + expire_at + return + + // If we're at this point, the mob doesn't already have it, or it does but stacking is allowed. + var/datum/modifier/mod = new modifier_type(src) + if(expire_at) + mod.expire_at = world.time + expire_at + if(mod.on_created_text) + to_chat(src, mod.on_created_text) + modifiers.Add(mod) + +// Removes a specific instance of modifier +/mob/living/proc/remove_specific_modifier(var/datum/modifier/M, var/silent = FALSE) + M.expire(silent) + +// Removes all modifiers of a type +/mob/living/proc/remove_modifiers_of_type(var/modifier_type, var/silent = FALSE) + for(var/datum/modifier/M in modifiers) + if(ispath(modifier_type, M.type)) + M.expire(silent) + +// Removes all modifiers, useful if the mob's being deleted +/mob/living/proc/remove_all_modifiers(var/silent = FALSE) + for(var/datum/modifier/M in modifiers) + M.expire(silent) \ No newline at end of file diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index 6514092dfc0..1390c89b291 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -35,7 +35,7 @@ if (. >= 2) if(prob(1)) owner.custom_pain("Your feel very dizzy for a moment!",0) - owner.confused = max(owner.confused, 2) + owner.Confuse(2) /obj/item/organ/internal/brain/proc/replace_self_with(replace_path) var/mob/living/carbon/human/tmp_owner = owner diff --git a/code/modules/organs/internal/eyes.dm b/code/modules/organs/internal/eyes.dm index 2a2b8305d3c..4febf8f4790 100644 --- a/code/modules/organs/internal/eyes.dm +++ b/code/modules/organs/internal/eyes.dm @@ -72,7 +72,7 @@ if(is_bruised()) owner.eye_blurry = 20 if(is_broken()) - owner.eye_blind = 20 + owner.Blind(20) /obj/item/organ/internal/eyes/handle_germ_effects() . = ..() //Up should return an infection level as an integer diff --git a/code/modules/organs/internal/liver.dm b/code/modules/organs/internal/liver.dm index daa0a88f76c..6b7459500b6 100644 --- a/code/modules/organs/internal/liver.dm +++ b/code/modules/organs/internal/liver.dm @@ -53,6 +53,6 @@ if(prob(1)) owner.custom_pain("There's a sharp pain in your upper-right abdomen!",1) if (. >= 2) - if(prob(1) && owner.getToxLoss() < owner.maxHealth*0.3) + if(prob(1) && owner.getToxLoss() < owner.getMaxHealth()*0.3) //owner << "" //Toxins provide their own messages for pain owner.adjustToxLoss(5) //Not realistic to PA but there are basically no 'real' liver infections diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 63c6da64098..67c1d3c2a79 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -492,7 +492,7 @@ This function completely restores a damaged organ to perfect condition. //Burn damage can cause fluid loss due to blistering and cook-off if((damage > 5 || damage + burn_dam >= 15) && type == BURN && (robotic < ORGAN_ROBOT)) - var/fluid_loss = 0.75 * (damage/(owner.maxHealth - config.health_threshold_dead)) * owner.species.blood_volume*(1 - BLOOD_VOLUME_SURVIVE/100) + var/fluid_loss = 0.75 * (damage/(owner.getMaxHealth() - config.health_threshold_dead)) * owner.species.blood_volume*(1 - BLOOD_VOLUME_SURVIVE/100) owner.remove_blood(fluid_loss) // first check whether we can widen an existing wound diff --git a/code/modules/organs/organ_internal.dm b/code/modules/organs/organ_internal.dm index 244c0b79719..cfc0910901c 100644 --- a/code/modules/organs/organ_internal.dm +++ b/code/modules/organs/organ_internal.dm @@ -165,7 +165,7 @@ if(is_bruised()) owner.eye_blurry = 20 if(is_broken()) - owner.eye_blind = 20 + owner.Blind(20) /obj/item/organ/internal/liver name = "liver" diff --git a/code/modules/projectiles/projectile/energy.dm b/code/modules/projectiles/projectile/energy.dm index 54a2d301c7f..033b4065102 100644 --- a/code/modules/projectiles/projectile/energy.dm +++ b/code/modules/projectiles/projectile/energy.dm @@ -29,8 +29,8 @@ flash_strength *= H.species.flash_mod if(flash_strength > 0) - H.confused = max(H.confused, flash_strength + 5) - H.eye_blind = max(H.eye_blind, flash_strength) + H.Confuse(flash_strength + 5) + H.Blind(flash_strength) H.eye_blurry = max(H.eye_blurry, flash_strength + 5) H.adjustHalLoss(22 * (flash_strength / 5)) // Five flashes to stun. Bit weaker than melee flashes due to being ranged. @@ -146,9 +146,9 @@ var/ear_safety = 0 ear_safety = M.get_ear_protection() if(ear_safety == 1) - M.confused += 150 + M.Confuse(150) else if (ear_safety > 1) - M.confused += 30 + M.Confuse(30) else if (!ear_safety) M.Stun(10) M.Weaken(2) diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index b507afc3167..dd81d713fe3 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -150,7 +150,7 @@ on_hit(var/atom/target, var/blocked = 0) if(ishuman(target)) var/mob/living/carbon/human/M = target - M.confused += rand(5,8) + M.Confuse(rand(5,8)) /obj/item/projectile/chameleon name = "bullet" diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Dispenser.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Dispenser.dm index 091842663d2..1d8e7177738 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Dispenser.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Dispenser.dm @@ -106,7 +106,7 @@ if(dose * strength_mod >= strength * 2) // Slurring M.slurring = max(M.slurring, 30) if(dose * strength_mod >= strength * 3) // Confusion - walking in random directions - M.confused = max(M.confused, 20) + M.Confuse(20) if(dose * strength_mod >= strength * 4) // Blurry vision M.eye_blurry = max(M.eye_blurry, 10) if(dose * strength_mod >= strength * 5) // Drowsyness - periodically falling asleep diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm index 95f661d7a54..2f34ebd93d3 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm @@ -376,7 +376,7 @@ else if(eyes_covered) M << "Your [safe_thing] protect you from most of the pepperspray!" M.eye_blurry = max(M.eye_blurry, effective_strength * 3) - M.eye_blind = max(M.eye_blind, effective_strength) + M.Blind(effective_strength) M.Stun(5) M.Weaken(5) return @@ -387,7 +387,7 @@ else // Oh dear :D M << "You're sprayed directly in the eyes with pepperspray!" M.eye_blurry = max(M.eye_blurry, effective_strength * 5) - M.eye_blind = max(M.eye_blind, effective_strength * 2) + M.Blind(effective_strength * 2) M.Stun(5) M.Weaken(5) return @@ -1166,7 +1166,7 @@ if(M.dizziness) M.dizziness = max(0, M.dizziness - 15) if(M.confused) - M.confused = max(0, M.confused - 5) + M.Confuse(-5) /datum/reagent/drink/dry_ramen name = "Dry Ramen" diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm index e0307e07cc3..ef6d8bb4287 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Medicine.dm @@ -258,7 +258,7 @@ /datum/reagent/oxycodone/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) M.add_chemical_effect(CE_PAINKILLER, 200) M.eye_blurry += 10 - M.confused += 5 + M.Confuse(5) /datum/reagent/oxycodone/overdose(var/mob/living/carbon/M, var/alien) ..() @@ -319,7 +319,7 @@ /datum/reagent/imidazoline/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) M.eye_blurry = max(M.eye_blurry - 5, 0) - M.eye_blind = max(M.eye_blind - 5, 0) + M.AdjustBlinded(-5) if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/internal/eyes/E = H.internal_organs_by_name[O_EYES] @@ -349,7 +349,7 @@ continue if(I.damage > 0) //Peridaxon heals only non-robotic organs I.damage = max(I.damage - removed, 0) - H.confused += 5 + H.Confuse(5) if(I.damage <= 5 && I.organ_tag == O_EYES) H.eye_blurry += 10 //Eyes need to reset, or something H.sdisabilities &= ~BLIND @@ -441,7 +441,7 @@ M.dizziness = 0 M.drowsyness = 0 M.stuttering = 0 - M.confused = 0 + M.SetConfused(0) if(M.ingested) for(var/datum/reagent/R in M.ingested.reagent_list) if(istype(R, /datum/reagent/ethanol)) diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Other.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Other.dm index 4f8e17cb1e6..0a7c78f9527 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Other.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Other.dm @@ -133,7 +133,7 @@ M.disabilities = 0 M.sdisabilities = 0 M.eye_blurry = 0 - M.eye_blind = 0 + M.SetBlinded(0) M.SetWeakened(0) M.SetStunned(0) M.SetParalysis(0) @@ -141,7 +141,7 @@ M.dizziness = 0 M.drowsyness = 0 M.stuttering = 0 - M.confused = 0 + M.SetConfused(0) M.sleeping = 0 M.jitteriness = 0 diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm index 6e34257e4a4..19785e6a181 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Toxins.dm @@ -403,7 +403,7 @@ effective_dose *= 2 if(effective_dose == metabolism) - M.confused += 2 + M.Confuse(2) M.drowsyness += 2 else if(effective_dose < 2 * threshold) M.Weaken(30) @@ -490,7 +490,7 @@ if(alien == IS_SKRELL) drug_strength = drug_strength * 0.8 M.make_dizzy(drug_strength) - M.confused = max(M.confused, drug_strength * 5) + M.Confuse(drug_strength * 5) /datum/reagent/impedrezene name = "Impedrezene" diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index f7bc1d1c803..48721314294 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -290,7 +290,7 @@ else if(istype(W, /obj/item/stack/cable_coil) && malfunction && is_open) var/obj/item/stack/cable_coil/coil = W user << "You begin to replace the wires." - //if(do_after(user, min(60, round( ((maxhealth/health)*10)+(malfunction*10) ))) //Take longer to repair heavier damage + //if(do_after(user, min(60, round( ((getMaxHealth()/health)*10)+(malfunction*10) ))) //Take longer to repair heavier damage if(do_after(user, 30)) if (coil.use(1)) health = max_health diff --git a/code/modules/spells/spellbook.dm b/code/modules/spells/spellbook.dm index a28f03e8feb..515453f6a35 100644 --- a/code/modules/spells/spellbook.dm +++ b/code/modules/spells/spellbook.dm @@ -322,7 +322,7 @@ /obj/item/weapon/spellbook/oneuse/blind/recoil(mob/user as mob) ..() user <<"You go blind!" - user.eye_blind = 10 + user.Blind(10) /obj/item/weapon/spellbook/oneuse/mindswap spell = /spell/targeted/mind_transfer diff --git a/code/modules/spells/targeted/targeted.dm b/code/modules/spells/targeted/targeted.dm index 498d363408e..d9d581e0504 100644 --- a/code/modules/spells/targeted/targeted.dm +++ b/code/modules/spells/targeted/targeted.dm @@ -138,8 +138,8 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp if(amt_weakened || amt_paralysis || amt_stunned) if(target.buckled) target.buckled = null - target.eye_blind += amt_eye_blind + target.Blind(amt_eye_blind) target.eye_blurry += amt_eye_blurry target.dizziness += amt_dizziness - target.confused += amt_confused + target.Confuse(amt_confused) target.stuttering += amt_stuttering \ No newline at end of file diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index 5243bae35f6..310f2231593 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -264,7 +264,7 @@ stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob << "You have trouble telling right and left apart all of a sudden." - mob.confused += 10 + mob.Confuse(10) /datum/disease2/effect/mutation name = "DNA Degradation" diff --git a/code/modules/xenobio2/machinery/injector_computer.dm b/code/modules/xenobio2/machinery/injector_computer.dm index 2f0144d37b3..6189a385e22 100644 --- a/code/modules/xenobio2/machinery/injector_computer.dm +++ b/code/modules/xenobio2/machinery/injector_computer.dm @@ -76,7 +76,7 @@ if(injector.occupant) data["occupantHealth"] = injector.occupant.health - data["occupantHealthMax"] = injector.occupant.maxHealth + data["occupantHealthMax"] = injector.occupant.getMaxHealth() else data["occupantHealth"] = null data["occupantHealthMax"] = null diff --git a/polaris.dme b/polaris.dme index b7953b0d07c..b167a599e4b 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1506,6 +1506,7 @@ #include "code\modules\mob\mob_helpers.dm" #include "code\modules\mob\mob_movement.dm" #include "code\modules\mob\mob_transformation_simple.dm" +#include "code\modules\mob\modifiers.dm" #include "code\modules\mob\say.dm" #include "code\modules\mob\transform_procs.dm" #include "code\modules\mob\typing_indicator.dm"