Combat Overhaul Staging: Limb Specific Stamina and status effect clickdelay modifiers! (#36274)

This commit is contained in:
kevinz000
2018-03-23 04:36:35 -07:00
committed by yogstation13-bot
parent f943a8c465
commit 1646cc73ce
19 changed files with 160 additions and 108 deletions

View File

@@ -20,6 +20,14 @@
/mob/proc/changeNext_move(num)
next_move = world.time + ((num+next_move_adjust)*next_move_modifier)
/mob/living/changeNext_move(num)
var/mod = next_move_modifier
var/adj = next_move_adjust
for(var/i in status_effects)
var/datum/status_effect/S = i
mod *= S.nextmove_modifier()
adj += S.nextmove_adjust()
next_move = world.time + ((num + adj)*mod)
/*
Before anything else, defer these calls to a per-mobtype handler. This allows us to

View File

@@ -30,7 +30,7 @@
id = "knockdown"
/datum/status_effect/incapacitating/knockdown/tick()
if(owner.staminaloss)
if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.3) //reduce stamina loss by 0.3 per tick, 6 per 2 seconds
@@ -40,7 +40,7 @@
needs_update_stat = TRUE
/datum/status_effect/incapacitating/unconscious/tick()
if(owner.staminaloss)
if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.3) //reduce stamina loss by 0.3 per tick, 6 per 2 seconds
//SLEEPING
@@ -65,7 +65,7 @@
return ..()
/datum/status_effect/incapacitating/sleeping/tick()
if(owner.staminaloss)
if(owner.getStaminaLoss())
owner.adjustStaminaLoss(-0.5) //reduce stamina loss by 0.5 per tick, 10 per 2 seconds
if(human_owner && human_owner.drunkenness)
human_owner.drunkenness *= 0.997 //reduce drunkenness by 0.3% per tick, 6% per 2 seconds

View File

@@ -63,6 +63,13 @@
owner = null
qdel(src)
//clickdelay/nextmove modifiers!
/datum/status_effect/proc/nextmove_modifier()
return 1
/datum/status_effect/proc/nextmove_adjust()
return 0
////////////////
// ALERT HOOK //
////////////////

View File

@@ -105,7 +105,7 @@
/obj/item/organ/heart/gland/heals/activate()
to_chat(owner, "<span class='notice'>You feel curiously revitalized.</span>")
owner.adjustToxLoss(-20, FALSE, TRUE)
owner.heal_bodypart_damage(20, 20, TRUE)
owner.heal_bodypart_damage(20, 20, 0, TRUE)
owner.adjustOxyLoss(-20)
/obj/item/organ/heart/gland/slime

View File

@@ -504,11 +504,14 @@
return
var/total_burn = 0
var/total_brute = 0
var/total_stamina = 0
for(var/X in bodyparts) //hardcoded to streamline things a bit
var/obj/item/bodypart/BP = X
total_brute += BP.brute_dam
total_burn += BP.burn_dam
total_stamina += BP.stamina_dam
health = maxHealth - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute
staminaloss = total_stamina
update_stat()
if(((maxHealth - total_burn) < HEALTH_THRESHOLD_DEAD) && stat == DEAD )
become_husk("burn")

View File

@@ -35,10 +35,14 @@
if(CLONE)
adjustCloneLoss(damage * hit_percent)
if(STAMINA)
if(BP)
if(BP.receive_damage(0, 0, damage * hit_percent))
update_damage_overlays()
else
adjustStaminaLoss(damage * hit_percent)
if(BRAIN)
adjustBrainLoss(damage * hit_percent)
return 1
return TRUE
//These procs fetch a cumulative total damage from all bodyparts
@@ -61,21 +65,20 @@
if(!forced && (status_flags & GODMODE))
return FALSE
if(amount > 0)
take_overall_damage(amount, 0, updating_health)
take_overall_damage(amount, 0, 0, updating_health)
else
heal_overall_damage(-amount, 0, 0, 1, updating_health)
heal_overall_damage(abs(amount), 0, 0, FALSE, TRUE, updating_health)
return amount
/mob/living/carbon/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE)
if(!forced && (status_flags & GODMODE))
return FALSE
if(amount > 0)
take_overall_damage(0, amount, updating_health)
take_overall_damage(0, amount, 0, updating_health)
else
heal_overall_damage(0, -amount, 0, 1, updating_health)
heal_overall_damage(0, abs(amount), 0, FALSE, TRUE, updating_health)
return amount
/mob/living/carbon/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
if(!forced && has_trait(TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
amount = -amount
@@ -85,14 +88,36 @@
blood_volume -= amount
return ..()
/mob/living/carbon/getStaminaLoss()
. = 0
for(var/X in bodyparts)
var/obj/item/bodypart/BP = X
. += BP.stamina_dam
/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE)
if(!forced && (status_flags & GODMODE))
return FALSE
if(amount > 0)
take_overall_damage(0, 0, amount, updating_health)
else
heal_overall_damage(0, 0, abs(amount), FALSE, FALSE, updating_health)
return amount
/mob/living/carbon/setStaminaLoss(amount, updating = TRUE, forced = FALSE)
var/current = getStaminaLoss()
var/diff = amount - current
if(!diff)
return
adjustStaminaLoss(diff, updating, forced)
////////////////////////////////////////////
//Returns a list of damaged bodyparts
/mob/living/carbon/proc/get_damaged_bodyparts(brute, burn)
/mob/living/carbon/proc/get_damaged_bodyparts(brute = FALSE, burn = FALSE, stamina = FALSE)
var/list/obj/item/bodypart/parts = list()
for(var/X in bodyparts)
var/obj/item/bodypart/BP = X
if((brute && BP.brute_dam) || (burn && BP.burn_dam))
if((brute && BP.brute_dam) || (burn && BP.burn_dam) || (stamina && BP.stamina_dam))
parts += BP
return parts
@@ -108,90 +133,79 @@
//Heals ONE bodypart randomly selected from damaged ones.
//It automatically updates damage overlays if necessary
//It automatically updates health status
/mob/living/carbon/heal_bodypart_damage(brute, burn, only_robotic = 0, only_organic = 1)
/mob/living/carbon/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE, only_robotic = FALSE, only_organic = TRUE)
var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute,burn)
if(!parts.len)
return
var/obj/item/bodypart/picked = pick(parts)
if(picked.heal_damage(brute, burn, only_robotic, only_organic))
if(picked.heal_damage(brute, burn, stamina, only_robotic, only_organic))
update_damage_overlays()
//Damages ONE bodypart randomly selected from damagable ones.
//It automatically updates damage overlays if necessary
//It automatically updates health status
/mob/living/carbon/take_bodypart_damage(brute, burn)
/mob/living/carbon/take_bodypart_damage(brute = 0, burn = 0, stamina = 0)
var/list/obj/item/bodypart/parts = get_damageable_bodyparts()
if(!parts.len)
return
var/obj/item/bodypart/picked = pick(parts)
if(picked.receive_damage(brute,burn))
if(picked.receive_damage(brute, burn, stamina))
update_damage_overlays()
//Heal MANY bodyparts, in random order
/mob/living/carbon/heal_overall_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute,burn)
/mob/living/carbon/heal_overall_damage(brute = 0, burn = 0, stamina = 0, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
var/list/obj/item/bodypart/parts = get_damaged_bodyparts(brute, burn, stamina)
var/update = 0
while(parts.len && (brute>0 || burn>0) )
var/update = NONE
while(parts.len && (brute > 0 || burn > 0 || stamina > 0))
var/obj/item/bodypart/picked = pick(parts)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
var/stamina_was = picked.stamina_dam
update |= picked.heal_damage(brute,burn, only_robotic, only_organic, 0)
update |= picked.heal_damage(brute, burn, stamina, only_robotic, only_organic, FALSE)
brute -= (brute_was - picked.brute_dam)
burn -= (burn_was - picked.burn_dam)
stamina -= (stamina_was - picked.stamina_dam)
parts -= picked
if(updating_health)
updatehealth()
update_stamina()
if(update)
update_damage_overlays()
// damage MANY bodyparts, in random order
/mob/living/carbon/take_overall_damage(brute, burn, updating_health = 1)
/mob/living/carbon/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
if(status_flags & GODMODE)
return //godmode
var/list/obj/item/bodypart/parts = get_damageable_bodyparts()
var/update = 0
while(parts.len && (brute>0 || burn>0) )
while(parts.len && (brute > 0 || burn > 0 || stamina > 0))
var/obj/item/bodypart/picked = pick(parts)
var/brute_per_part = round(brute/parts.len, 0.01)
var/burn_per_part = round(burn/parts.len, 0.01)
var/stamina_per_part = round(stamina/parts.len, 0.01)
var/brute_was = picked.brute_dam
var/burn_was = picked.burn_dam
var/stamina_was = picked.stamina_dam
update |= picked.receive_damage(brute_per_part,burn_per_part, 0)
update |= picked.receive_damage(brute_per_part, burn_per_part, stamina_per_part, FALSE)
brute -= (picked.brute_dam - brute_was)
burn -= (picked.burn_dam - burn_was)
stamina -= (picked.stamina_dam - stamina_was)
parts -= picked
if(updating_health)
updatehealth()
if(update)
update_damage_overlays()
/mob/living/carbon/adjustStaminaLoss(amount, updating_stamina = 1)
if(status_flags & GODMODE)
return 0
staminaloss = CLAMP(staminaloss + amount, 0, maxHealth*2)
if(updating_stamina)
update_stamina()
/mob/living/carbon/setStaminaLoss(amount, updating_stamina = 1)
if(status_flags & GODMODE)
return 0
staminaloss = amount
if(updating_stamina)
update_stamina()
/mob/living/carbon/getBrainLoss()

View File

@@ -769,7 +769,7 @@
return
else
if(hud_used.healths)
var/health_amount = health - staminaloss
var/health_amount = health - getStaminaLoss()
if(..(health_amount)) //not dead
switch(hal_screwyhud)
if(SCREWYHUD_CRIT)

View File

@@ -692,8 +692,8 @@
if(bleed_rate)
to_chat(src, "<span class='danger'>You are bleeding!</span>")
if(staminaloss)
if(staminaloss > 30)
if(getStaminaLoss())
if(getStaminaLoss() > 30)
to_chat(src, "<span class='info'>You're completely exhausted.</span>")
else
to_chat(src, "<span class='info'>You feel fatigued.</span>")

View File

@@ -1452,6 +1452,10 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(CLONE)
H.adjustCloneLoss(damage * hit_percent * H.physiology.clone_mod)
if(STAMINA)
if(BP)
if(BP.receive_damage(0, 0, damage * hit_percent * H.physiology.stamina_mod))
H.update_stamina()
else
H.adjustStaminaLoss(damage * hit_percent * H.physiology.stamina_mod)
if(BRAIN)
H.adjustBrainLoss(damage * hit_percent * H.physiology.brain_mod)

View File

@@ -322,7 +322,7 @@
//this updates all special effects: stun, sleeping, knockdown, druggy, stuttering, etc..
/mob/living/carbon/handle_status_effects()
..()
if(staminaloss)
if(getStaminaLoss())
adjustStaminaLoss(-3)
var/restingpwr = 1 + 4 * resting

View File

@@ -236,34 +236,41 @@
/mob/living/proc/setStaminaLoss(amount, updating_stamina = TRUE, forced = FALSE)
return
// heal ONE external organ, organ gets randomly selected from damaged ones.
/mob/living/proc/heal_bodypart_damage(brute, burn, updating_health = 1)
adjustBruteLoss(-brute, 0) //zero as argument for no instant health update
adjustFireLoss(-burn, 0)
/mob/living/proc/heal_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update
adjustFireLoss(-burn, FALSE)
adjustStaminaLoss(-stamina, FALSE)
if(updating_health)
updatehealth()
update_stamina()
// damage ONE external organ, organ gets randomly selected from damaged ones.
/mob/living/proc/take_bodypart_damage(brute, burn, updating_health = 1)
adjustBruteLoss(brute, 0) //zero as argument for no instant health update
adjustFireLoss(burn, 0)
/mob/living/proc/take_bodypart_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update
adjustFireLoss(burn, FALSE)
adjustStaminaLoss(stamina, FALSE)
if(updating_health)
updatehealth()
update_stamina()
// heal MANY bodyparts, in random order
/mob/living/proc/heal_overall_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
adjustBruteLoss(-brute, 0) //zero as argument for no instant health update
adjustFireLoss(-burn, 0)
/mob/living/proc/heal_overall_damage(brute = 0, burn = 0, stamina = 0, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
adjustBruteLoss(-brute, FALSE) //zero as argument for no instant health update
adjustFireLoss(-burn, FALSE)
adjustStaminaLoss(-stamina, FALSE)
if(updating_health)
updatehealth()
update_stamina()
// damage MANY bodyparts, in random order
/mob/living/proc/take_overall_damage(brute, burn, updating_health = 1)
adjustBruteLoss(brute, 0) //zero as argument for no instant health update
adjustFireLoss(burn, 0)
/mob/living/proc/take_overall_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
adjustBruteLoss(brute, FALSE) //zero as argument for no instant health update
adjustFireLoss(burn, FALSE)
adjustStaminaLoss(stamina, FALSE)
if(updating_health)
updatehealth()
update_stamina()
//heal up to amount damage, in a given order
/mob/living/proc/heal_ordered_damage(amount, list/damage_types)

View File

@@ -433,6 +433,7 @@
if(status_flags & GODMODE)
return
health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss()
staminaloss = getStaminaLoss()
update_stat()
med_hud_set_health()
med_hud_set_status()
@@ -481,7 +482,7 @@
cure_blind()
cure_husk()
hallucination = 0
heal_overall_damage(100000, 100000, 0, 0, 1) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
heal_overall_damage(INFINITY, INFINITY, INFINITY, FALSE, FALSE, TRUE) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
ExtinguishMob()
fire_stacks = 0
update_canmove()
@@ -862,13 +863,17 @@
return FALSE
return TRUE
/mob/living/carbon/proc/update_stamina()
if(staminaloss)
var/total_health = (health - staminaloss)
/mob/living/proc/update_stamina()
return
/mob/living/carbon/update_stamina()
var/stam = getStaminaLoss()
if(stam)
var/total_health = (health - stam)
if(total_health <= HEALTH_THRESHOLD_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
Knockdown(100)
setStaminaLoss(health - 2)
setStaminaLoss(health - 2, FALSE, FALSE)
update_health_hud()
/mob/living/carbon/alien/update_stamina()

View File

@@ -408,7 +408,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
else
dam = 0
if((brute_heal > 0 && affecting.brute_dam > 0) || (burn_heal > 0 && affecting.burn_dam > 0))
if(affecting.heal_damage(brute_heal, burn_heal, 1, 0))
if(affecting.heal_damage(brute_heal, burn_heal, 0, TRUE, FALSE))
H.update_damage_overlays()
user.visible_message("[user] has fixed some of the [dam ? "dents on" : "burnt wires in"] [H]'s [affecting.name].", \
"<span class='notice'>You fix some of the [dam ? "dents on" : "burnt wires in"] [H]'s [affecting.name].</span>")

View File

@@ -231,7 +231,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/bilk/on_mob_life(mob/living/M)
if(M.getBruteLoss() && prob(10))
M.heal_bodypart_damage(1,0, 0)
M.heal_bodypart_damage(1)
. = 1
return ..() || .
@@ -1085,7 +1085,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/bananahonk/on_mob_life(mob/living/M)
if((ishuman(M) && M.job in list("Clown") ) || ismonkey(M))
M.heal_bodypart_damage(1,1, 0)
M.heal_bodypart_damage(1,1)
. = 1
return ..() || .
@@ -1403,7 +1403,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/quadruple_sec/on_mob_life(mob/living/M)
if(M.mind && M.mind.assigned_role in list("Security Officer", "Detective", "Head of Security", "Warden", "Lawyer")) //Securidrink in line with the screwderiver for engineers or nothing for mimes.
M.heal_bodypart_damage (1,1,1)
M.heal_bodypart_damage(1, 1)
M.adjustBruteLoss(-2,0)
. = 1
return ..()

View File

@@ -40,7 +40,7 @@
M.setCloneLoss(0, 0)
M.setOxyLoss(0, 0)
M.radiation = 0
M.heal_bodypart_damage(5,5, 0)
M.heal_bodypart_damage(5,5)
M.adjustToxLoss(-5, 0, TRUE)
M.hallucination = 0
M.setBrainLoss(0)
@@ -197,7 +197,7 @@
/datum/reagent/medicine/rezadone/on_mob_life(mob/living/M)
M.setCloneLoss(0) //Rezadone is almost never used in favor of cryoxadone. Hopefully this will change that.
M.heal_bodypart_damage(1,1, 0)
M.heal_bodypart_damage(1,1)
M.remove_trait(TRAIT_DISFIGURED, TRAIT_GENERIC)
..()
. = 1
@@ -1129,7 +1129,7 @@
can_synth = FALSE
/datum/reagent/medicine/miningnanites/on_mob_life(mob/living/M)
M.heal_bodypart_damage(5,5, 0)
M.heal_bodypart_damage(5,5)
..()
. = 1

View File

@@ -784,7 +784,7 @@
taste_description = "chlorine"
/datum/reagent/chlorine/on_mob_life(mob/living/M)
M.take_bodypart_damage(1*REM, 0, 0)
M.take_bodypart_damage(1*REM, 0, 0, 0)
. = 1
..()

View File

@@ -128,7 +128,7 @@
M.adjustToxLoss(rand(20,60)*REM, 0)
. = 1
else if(prob(40))
M.heal_bodypart_damage(5*REM,0, 0)
M.heal_bodypart_damage(5*REM)
. = 1
..()
@@ -874,7 +874,7 @@
/datum/reagent/toxin/peaceborg/tire/on_mob_life(mob/living/M)
var/healthcomp = (100 - M.health) //DOES NOT ACCOUNT FOR ADMINBUS THINGS THAT MAKE YOU HAVE MORE THAN 200/210 HEALTH, OR SOMETHING OTHER THAN A HUMAN PROCESSING THIS.
if(M.staminaloss < (45 - healthcomp)) //At 50 health you would have 200 - 150 health meaning 50 compensation. 60 - 50 = 10, so would only do 10-19 stamina.)
if(M.getStaminaLoss() < (45 - healthcomp)) //At 50 health you would have 200 - 150 health meaning 50 compensation. 60 - 50 = 10, so would only do 10-19 stamina.)
M.adjustStaminaLoss(10)
if(prob(30))
to_chat(M, "You should sit down and take a rest...")

View File

@@ -19,6 +19,7 @@
var/burnstate = 0
var/brute_dam = 0
var/burn_dam = 0
var/stamina_dam = 0
var/max_damage = 0
var/list/embedded_objects = list()
var/held_index = 0 //are we a hand? if so, which one!
@@ -107,52 +108,54 @@
//Applies brute and burn damage to the organ. Returns 1 if the damage-icon states changed at all.
//Damage will not exceed max_damage using this proc
//Cannot apply negative damage
/obj/item/bodypart/proc/receive_damage(brute, burn, updating_health = 1)
/obj/item/bodypart/proc/receive_damage(brute = 0, burn = 0, stamina = 0, updating_health = TRUE)
if(owner && (owner.status_flags & GODMODE))
return 0 //godmode
return FALSE //godmode
var/dmg_mlt = CONFIG_GET(number/damage_multiplier)
brute = max(brute * dmg_mlt, 0)
burn = max(burn * dmg_mlt, 0)
stamina = max(stamina * dmg_mlt, 0)
if(status == BODYPART_ROBOTIC) //This makes robolimbs not damageable by chems and makes it stronger
brute = max(0, brute - 5)
burn = max(0, burn - 4)
//No stamina scaling.. for now..
if(!brute && !burn && !stamina)
return FALSE
switch(animal_origin)
if(ALIEN_BODYPART,LARVA_BODYPART) //aliens take double burn
burn *= 2
var/can_inflict = max_damage - (brute_dam + burn_dam)
if(!can_inflict)
return 0
if(can_inflict <= 0)
return FALSE
var/total_damage = brute + burn
if(total_damage > can_inflict)
var/excess = total_damage - can_inflict
brute = brute * (excess / total_damage)
burn = burn * (excess / total_damage)
if((brute + burn) < can_inflict)
brute_dam += brute
burn_dam += burn
else
if(brute > 0)
if(burn > 0)
brute = round( (brute/(brute+burn)) * can_inflict, 1 )
burn = can_inflict - brute //gets whatever damage is left over
brute_dam += brute
burn_dam += burn
else
brute_dam += can_inflict
else
if(burn > 0)
burn_dam += can_inflict
else
return 0
//We've dealt the physical damages, if there's room lets apply the stamina damage.
var/current_damage = brute_dam + burn_dam + stamina_dam //This time around, count stamina loss too.
var/available_damage = max_damage - current_damage
stamina_dam += CLAMP(stamina, 0, available_damage)
if(owner && updating_health)
owner.updatehealth()
if(stamina)
owner.update_stamina()
return update_bodypart_damage_state()
//Heals brute and burn damage for the organ. Returns 1 if the damage-icon states changed at all.
//Damage cannot go below zero.
//Cannot remove negative damage (i.e. apply damage)
/obj/item/bodypart/proc/heal_damage(brute, burn, only_robotic = 0, only_organic = 1, updating_health = 1)
/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
if(only_robotic && status != BODYPART_ROBOTIC) //This makes organic limbs not heal when the proc is in Robotic mode.
return
@@ -162,6 +165,7 @@
brute_dam = max(brute_dam - brute, 0)
burn_dam = max(burn_dam - burn, 0)
stamina_dam = max(stamina_dam - stamina, 0)
if(owner && updating_health)
owner.updatehealth()
return update_bodypart_damage_state()
@@ -180,8 +184,8 @@
if((tbrute != brutestate) || (tburn != burnstate))
brutestate = tbrute
burnstate = tburn
return 1
return 0
return TRUE
return FALSE

View File

@@ -305,7 +305,7 @@
cooldown = COOLDOWN_DAMAGE
for(var/V in listeners)
var/mob/living/L = V
L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, 0, 0)
L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, 0, FALSE, FALSE)
//BRUTE DAMAGE
else if((findtext(message, hurt_words)))