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.
This commit is contained in:
Neerti
2017-04-18 21:17:29 -04:00
parent 55d895aa14
commit ea6128f986
68 changed files with 537 additions and 172 deletions

View File

@@ -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 << "<span class='danger'>You are blinded!</span>"
eye_blind += 20
Blind(20)
/mob/living/carbon/human/proc/pl_head_protected()
//Checks if the head is adequately sealed.

View File

@@ -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"

View File

@@ -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)

View File

@@ -26,7 +26,7 @@
src << "<span class='notice'>They will be deprived of sight for longer.</span>"
spawn(duration)
T.disabilities &= ~NEARSIGHTED
T.eye_blind = 10
T.Blind(10)
T.eye_blurry = 20
feedback_add_details("changeling_powers","BS")
return 1

View File

@@ -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 = "<span class='danger'>You feel a burning sensation flowing through your veins!</span>"
/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()]\] <font color='red'>Was delayed toxic stung by [key_name(src)]</font>")
src.attack_log += text("\[[time_stamp()]\] <font color='orange'> Used delayed toxic sting on [key_name(T)]</font>")
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 << "<span class='notice'>Our toxin will be extra potent, when it strikes.</span>"
spawn(2 MINUTES)
if(T) //We might not exist in two minutes, for whatever reason.
T << "<span class='danger'>You feel a burning sensation flowing through your veins!</span>"
while(i)
T.adjustToxLoss(1)
i--
sleep(2 SECONDS)
src.verbs -= /mob/proc/changeling_delayed_toxic_sting
spawn(3 MINUTES)
src << "<span class='notice'>We are ready to use our delayed toxic string once more.</span>"
src.verbs |= /mob/proc/changeling_delayed_toxic_sting
T.add_modifier(type_to_give, 2 MINUTES)
feedback_add_details("changeling_powers","DTS")

View File

@@ -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 = "<span class='notice'>We feel protective plating form underneath our skin.</span>"
on_expired_text = "<span class='notice'>Our protective armor underneath our skin fades as we absorb it.</span>"
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

View File

@@ -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 = "<span class='danger'>You feel a small prick and you feel extremly weak!</span>"
on_expired_text = "<span class='notice'>You no longer feel extremly weak.</span>"
// 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()]\] <font color='orange'> Used enfeebling sting on [key_name(T)]</font>")
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 << "<span class='notice'>We make them extremely weak.</span>"
var/health_to_take_away = H.maxHealth * (effect / 100)
H.maxHealth -= health_to_take_away
H << "<span class='danger'>You feel a small prick and you feel extremly weak!</span>"
src.verbs -= /mob/proc/changeling_enfeebling_string
spawn(5 MINUTES)
src.verbs |= /mob/proc/changeling_enfeebling_string
src << "<span class='notice'>Our enfeebling string is ready to be used once more.</span>"
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 << "<span class='notice'>You no longer feel extremly weak.</span>"
H.add_modifier(type_to_give, 2 MINUTES)
feedback_add_details("changeling_powers","ES")
return 1

View File

@@ -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 = "<span class='notice'>We feel unstoppable!</span>"
on_expired_text = "<span class='warning'>We feel our newfound energy fade...</span>"
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 << "<span class='notice'>We feel unstoppable.</span>"
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 << "<span class='notice'>We feel our newfound energy fade.</span>"
C.add_modifier(/datum/modifier/unstoppable, 30 SECONDS)
feedback_add_details("changeling_powers","UNS")
return 1

View File

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

View File

@@ -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 << "<span class='notice'>We have removed our evolutions from this form, and are now ready to readapt.</span>"

View File

@@ -55,7 +55,7 @@
M << "<span class='danger'>You hear an extremely loud screeching sound! It \
[pick("confuses","confounds","perturbs","befuddles","dazes","unsettles","disorients")] you.</span>"
M.adjustEarDamage(0,30)
M.confused += 20
M.Confuse(20)
M << sound('sound/effects/screech.ogg')
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Was affected by [key_name(src)]'s Resonant Shriek.</font>")
else

View File

@@ -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("<span class='warning'>You feel a sharp pain in your eyes, and the world disappears into darkness..</span>", 3)

View File

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

View File

@@ -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 << "<span class='danger'><font size='3'>A feeling of immense dread starts to overcome you as everything starts \
to fade to black...</font></span>"
//world << "Predicted hardcrit."

View File

@@ -32,7 +32,7 @@
user << "<span class='notice'>You stab \the [L] with a hidden integrated hypo, attempting to bring them back...</span>"
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

View File

@@ -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)
summoned.health = round(summoned.getMaxHealth() * 0.7)

View File

@@ -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()

View File

@@ -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]

View File

@@ -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.

View File

@@ -69,7 +69,7 @@ REAGENT SCANNER
user.show_message("<span class='notice'>Analyzing Results for [M]:</span>")
user.show_message("<span class='notice'>Overall Status: dead</span>")
else
user.show_message("<span class='notice'>Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round((M.health/M.maxHealth)*100) ]% healthy"]</span>")
user.show_message("<span class='notice'>Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round((M.health/M.getMaxHealth())*100) ]% healthy"]</span>")
user.show_message("<span class='notice'> Key: <font color='cyan'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font></span>", 1)
user.show_message("<span class='notice'> Damage Specifics: <font color='cyan'>[OX]</font> - <font color='green'>[TX]</font> - <font color='#FFA500'>[BU]</font> - <font color='red'>[BR]</font></span>")
user.show_message("<span class='notice'>Body Temperature: [M.bodytemperature-T0C]&deg;C ([M.bodytemperature*1.8-459.67]&deg;F)</span>", 1)

View File

@@ -401,7 +401,7 @@
user.sdisabilities |= BLIND
else if (E.damage >= E.min_bruised_damage)
user << "<span class='danger'>You go blind!</span>"
user.eye_blind = 5
user.Blind(5)
user.eye_blurry = 5
user.disabilities |= NEARSIGHTED
spawn(100)

View File

@@ -127,7 +127,7 @@
suiciding = 1
viewers(src) << "<span class='danger'>[src] is powering down. It looks like \he's trying to commit suicide.</span>"
//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) << "<span class='danger'>[src] is powering down. It looks like \he's trying to commit suicide.</span>"
//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()

View File

@@ -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))

View File

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

View File

@@ -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]

View File

@@ -37,7 +37,7 @@
var/mob/living/carbon/human/H = hit_atom
if(istype(H) && H.has_eyes() && prob(85))
H << "<span class='danger'>Some of \the [src] gets in your eyes!</span>"
H.eye_blind += 5
H.Blind(5)
H.eye_blurry += 10
spawn(1)
if(istype(loc, /turf/)) qdel(src)

View File

@@ -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 << "<span class='notice'>You need to unlock the controls first.</span>"
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("<span class='notice'>[user] repairs [src].</span>","<span class='notice'>You repair [src].</span>")
else
user << "<span class='notice'>Unable to repair with the maintenance panel closed.</span>"

View File

@@ -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)

View File

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

View File

@@ -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()

View File

@@ -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())

View File

@@ -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))

View File

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

View File

@@ -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")

View File

@@ -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)

View File

@@ -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)

View File

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

View File

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

View File

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

View File

@@ -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()

View File

@@ -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 << "<span class='danger'><B>*BZZZT*</B></span>"
src << "<span class='danger'>Warning: Electromagnetic pulse detected.</span>"
@@ -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"))

View File

@@ -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)

View File

@@ -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("<span class='notice'>\The [user] has spot-welded some of the damage to \the [src]!</span>")
else

View File

@@ -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("<span class='notice'>\The [user] mends some of \the [src]'s wounds.</span>")
else
@@ -68,9 +68,9 @@
/mob/living/simple_animal/construct/examine(mob/user)
..(user)
var/msg = "<span cass='info'>*---------*\nThis is \icon[src] \a <EM>[src]</EM>!\n"
if (src.health < src.maxHealth)
if (src.health < src.getMaxHealth())
msg += "<span class='warning'>"
if (src.health >= src.maxHealth/2)
if (src.health >= src.getMaxHealth()/2)
msg += "It looks slightly dented.\n"
else
msg += "<B>It looks severely dented!</B>\n"

View File

@@ -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"

View File

@@ -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()

View File

@@ -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)

View File

@@ -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)

View File

@@ -170,7 +170,7 @@
if(announce)
assailant.visible_message("<span class='warning'>[assailant] covers [affecting]'s eyes!</span>")
if(affecting.eye_blind < 3)
affecting.eye_blind = 3
affecting.Blind(3)
/obj/item/weapon/grab/attack_self()
return s_click(hud)

View File

@@ -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)

View File

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

View File

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

View File

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

View File

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

View File

@@ -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"

View File

@@ -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)

View File

@@ -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"

View File

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

View File

@@ -376,7 +376,7 @@
else if(eyes_covered)
M << "<span class='warning'>Your [safe_thing] protect you from most of the pepperspray!</span>"
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 << "<span class='warning'>You're sprayed directly in the eyes with pepperspray!</span>"
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"

View File

@@ -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))

View File

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

View File

@@ -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"

View File

@@ -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 << "<span class='notice'>You begin to replace the wires.</span>"
//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

View File

@@ -322,7 +322,7 @@
/obj/item/weapon/spellbook/oneuse/blind/recoil(mob/user as mob)
..()
user <<"<span class='warning'>You go blind!</span>"
user.eye_blind = 10
user.Blind(10)
/obj/item/weapon/spellbook/oneuse/mindswap
spell = /spell/targeted/mind_transfer

View File

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

View File

@@ -264,7 +264,7 @@
stage = 3
activate(var/mob/living/carbon/mob,var/multiplier)
mob << "<span class='notice'>You have trouble telling right and left apart all of a sudden.</span>"
mob.confused += 10
mob.Confuse(10)
/datum/disease2/effect/mutation
name = "DNA Degradation"

View File

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

View File

@@ -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"