Merge pull request #3730 from Tastyfish/better-stuns

Fixes stun code to not allow one get stuck stunned/paralyzed etc
This commit is contained in:
Fox McCloud
2016-02-28 16:22:44 -05:00
15 changed files with 74 additions and 111 deletions
@@ -183,13 +183,11 @@
show_stat_emergency_shuttle_eta()
/mob/living/carbon/alien/Stun(amount)
if(status_flags & CANSTUN)
stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
else
/mob/living/carbon/alien/SetStunned(amount)
..(amount)
if(!(status_flags & CANSTUN) && amount)
// add some movement delay
move_delay_add = min(move_delay_add + round(amount / 2), 10) // a maximum delay of 10
return
/mob/living/carbon/alien/getDNA()
return null
@@ -127,12 +127,6 @@
O.heal_damage(0, -amount, internal=0, robo_repair=(O.status & ORGAN_ROBOT))
/mob/living/carbon/human/Stun(amount)
..()
/mob/living/carbon/human/Weaken(amount)
..()
/mob/living/carbon/human/Paralyse(amount)
// Notify our AI if they can now control the suit.
if(wearing_rig && !stat && paralysis < amount) //We are passing out right this second.
+3 -3
View File
@@ -122,7 +122,7 @@
/mob/living/proc/handle_weakened()
if(weakened)
weakened = max(weakened-1,0) //before you get mad Rockdtben: I done this so update_canmove isn't called multiple times
AdjustWeakened(-1)
if(!weakened)
update_icons()
return weakened
@@ -147,14 +147,14 @@
slurring = max(slurring-1, 0)
return slurring
/mob/living/proc/handle_paralysed() // Currently only used by simple_animal.dm, treated as a special case in other mobs
/mob/living/proc/handle_paralysed()
if(paralysis)
AdjustParalysis(-1)
return paralysis
/mob/living/proc/handle_sleeping()
if(sleeping)
sleeping = max(sleeping - 1, 0)
AdjustSleeping(-1)
return sleeping
+3 -3
View File
@@ -110,11 +110,11 @@
if(!effect || (blocked >= 2)) return 0
switch(effecttype)
if(STUN)
stunned = max(stunned,(effect/(blocked+1)))
Stun(effect / (blocked + 1))
if(WEAKEN)
weakened = max(weakened,(effect/(blocked+1)))
Weaken(effect / (blocked + 1))
if(PARALYZE)
paralysis = max(paralysis,(effect/(blocked+1)))
Paralyse(effect / (blocked + 1))
if(IRRADIATE)
radiation += min((effect - (effect*getarmor(null, "rad"))), 0)//Rads auto check armor
if(STUTTER)
+26 -48
View File
@@ -1121,94 +1121,72 @@ var/list/slot_equipment_priority = list( \
/mob/proc/Jitter(amount)
jitteriness = max(jitteriness,amount,0)
jitteriness = max(jitteriness, amount, 0)
/mob/proc/Dizzy(amount)
dizziness = max(dizziness,amount,0)
dizziness = max(dizziness, amount, 0)
/mob/proc/Stun(amount)
if(status_flags & CANSTUN)
stunned = max(max(stunned,amount),0) //can't go below 0, getting a low amount of stun doesn't lower your current stun
update_canmove()
return
SetStunned(max(stunned, amount))
/mob/proc/SetStunned(amount) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned"
if(status_flags & CANSTUN)
stunned = max(amount,0)
stunned = max(amount, 0)
update_canmove()
else if(stunned)
stunned = 0
update_canmove()
return
/mob/proc/AdjustStunned(amount)
if(status_flags & CANSTUN)
stunned = max(stunned + amount,0)
update_canmove()
return
SetStunned(stunned + amount)
/mob/proc/Weaken(amount)
if(status_flags & CANWEAKEN)
weakened = max(max(weakened,amount),0)
update_canmove() //updates lying, canmove and icons
return
SetWeakened(max(weakened, amount))
/mob/proc/SetWeakened(amount)
if(status_flags & CANWEAKEN)
weakened = max(amount,0)
weakened = max(amount, 0)
update_canmove() //updates lying, canmove and icons
return
else if(weakened)
weakened = 0
update_canmove()
/mob/proc/AdjustWeakened(amount)
if(status_flags & CANWEAKEN)
weakened = max(weakened + amount,0)
update_canmove() //updates lying, canmove and icons
return
SetWeakened(weakened + amount)
/mob/proc/Paralyse(amount)
if(status_flags & CANPARALYSE)
paralysis = max(max(paralysis,amount),0)
update_canmove()
return
SetParalysis(max(paralysis, amount))
/mob/proc/SetParalysis(amount)
if(status_flags & CANPARALYSE)
paralysis = max(amount,0)
paralysis = max(amount, 0)
update_canmove()
else if(paralysis)
paralysis = 0
update_canmove()
return
/mob/proc/AdjustParalysis(amount)
if(status_flags & CANPARALYSE)
paralysis = max(paralysis + amount,0)
update_canmove()
return
SetParalysis(paralysis + amount)
/mob/proc/Sleeping(amount)
sleeping = max(max(sleeping,amount),0)
update_canmove()
return
SetSleeping(max(sleeping, amount))
/mob/proc/SetSleeping(amount)
sleeping = max(amount,0)
sleeping = max(amount, 0)
update_canmove()
return
/mob/proc/AdjustSleeping(amount)
sleeping = max(sleeping + amount,0)
update_canmove()
return
SetSleeping(sleeping + amount)
/mob/proc/Resting(amount)
resting = max(max(resting,amount),0)
update_canmove()
return
SetResting(max(resting, amount))
/mob/proc/SetResting(amount)
resting = max(amount,0)
resting = max(amount, 0)
update_canmove()
return
/mob/proc/AdjustResting(amount)
resting = max(resting + amount,0)
update_canmove()
return
SetResting(resting + amount)
/mob/proc/get_species()
return ""
@@ -101,14 +101,14 @@
if(..(target, blocked))
var/mob/living/M = target
M.dizziness += 20
M:slurring += 20
M.slurring += 20
M.confused += 20
M.eye_blurry += 20
M.drowsyness += 20
for(var/datum/reagent/ethanol/A in M.reagents.reagent_list)
M.paralysis += 2
M.AdjustParalysis(2)
M.dizziness += 10
M:slurring += 10
M.slurring += 10
M.confused += 10
M.eye_blurry += 10
M.drowsyness += 10
@@ -22,7 +22,7 @@
// Sobering multiplier.
// Sober block makes it more difficult to get drunk
var/sober_str=!(SOBER in M.mutations)?1:2
M:nutrition += nutriment_factor
M.nutrition += nutriment_factor
if(!src.data) data = 1
src.data++
@@ -42,8 +42,8 @@
M.dizziness += dizzy_adj.
if(d >= slur_start && d < pass_out)
if (!M:slurring) M:slurring = 1
M:slurring += slurr_adj/sober_str
if (!M.slurring) M.slurring = 1
M.slurring += slurr_adj/sober_str
if(d >= brawl_start && ishuman(M))
var/mob/living/carbon/human/H = M
F.teach(H,1)
@@ -51,17 +51,17 @@
if(H.martial_art == F)
F.remove(H)
if(d >= confused_start && prob(33))
if (!M:confused) M:confused = 1
M.confused = max(M:confused+(confused_adj/sober_str),0)
if (!M.confused) M.confused = 1
M.confused = max(M.confused+(confused_adj/sober_str),0)
if(d >= blur_start)
M.eye_blurry = max(M.eye_blurry, 10/sober_str)
M:drowsyness = max(M:drowsyness, 0)
M.drowsyness = max(M.drowsyness, 0)
if(d >= vomit_start)
if(prob(8))
M.fakevomit()
if(d >= pass_out)
M:paralysis = max(M:paralysis, 20/sober_str)
M:drowsyness = max(M:drowsyness, 30/sober_str)
M.Paralyse(20 / sober_str)
M.drowsyness = max(M.drowsyness, 30/sober_str)
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/obj/item/organ/liver/L = H.internal_organs_by_name["liver"]
@@ -17,7 +17,7 @@
C.apply_effect(25 * weakness,IRRADIATE,0)
C.nutrition -= min(50 * weakness, C.nutrition)
C.Dizzy(6 * weakness)
C.weakened += 6 * weakness
C.AdjustWeakened(6 * weakness)
/datum/artifact_effect/hurt/DoEffectAura()
if(holder)
@@ -28,14 +28,14 @@
var/turf/T = get_turf(suspension_field)
if(field_type == "carbon")
for(var/mob/living/carbon/M in T)
M.weakened = max(M.weakened, 3)
M.Weaken(3)
cell.charge -= power_use
if(prob(5))
M << "\blue [pick("You feel tingly.","You feel like floating.","It is hard to speak.","You can barely move.")]"
if(field_type == "iron")
for(var/mob/living/silicon/M in T)
M.weakened = max(M.weakened, 3)
M.Weaken(3)
cell.charge -= power_use
if(prob(5))
M << "\blue [pick("You feel tingly.","You feel like floating.","It is hard to speak.","You can barely move.")]"
@@ -47,7 +47,7 @@
I.loc = suspension_field
for(var/mob/living/simple_animal/M in T)
M.weakened = max(M.weakened, 3)
M.Weaken(3)
cell.charge -= power_use
if(prob(5))
M << "\blue [pick("You feel tingly.","You feel like floating.","It is hard to speak.","You can barely move.")]"
@@ -247,7 +247,7 @@
if("carbon")
success = 1
for(var/mob/living/carbon/C in T)
C.weakened += 5
C.AdjustWeakened(5)
C.visible_message("\blue \icon[C] [C] begins to float in the air!","You feel tingly and light, but it is difficult to move.")
if("nitrogen")
success = 1
@@ -270,7 +270,7 @@
if("iron")
success = 1
for(var/mob/living/silicon/R in T)
R.weakened += 5
R.AdjustWeakened(5)
R.visible_message("\blue \icon[R] [R] begins to float in the air!","You feel tingly and light, but it is difficult to move.")
//
//in case we have a bad field type
@@ -279,7 +279,7 @@
for(var/mob/living/simple_animal/C in T)
C.visible_message("\blue \icon[C] [C] begins to float in the air!","You feel tingly and light, but it is difficult to move.")
C.weakened += 5
C.AdjustWeakened(5)
suspension_field = new(T)
suspension_field.field_type = field_type
@@ -306,7 +306,7 @@
for(var/mob/M in T)
M << "<span class='info'>You no longer feel like floating.</span>"
M.weakened = min(M.weakened, 3)
M.SetWeakened(min(M.weakened, 3))
src.visible_message("\blue \icon[src] [src] deactivates with a gentle shudder.")
qdel(suspension_field)
@@ -385,7 +385,8 @@
var/mob/living/M = A
if(M in immune)
continue
M.stunned = 10
M.stunned += 10
M.canmove = 0
M.anchored = 1
if(istype(M, /mob/living/simple_animal/hostile))
var/mob/living/simple_animal/hostile/H = M
@@ -413,7 +414,7 @@
return
/obj/effect/timestop/proc/unfreeze_mob(mob/living/M)
M.stunned = 0
M.AdjustStunned(-10)
M.anchored = 0
if(istype(M, /mob/living/simple_animal/hostile))
var/mob/living/simple_animal/hostile/H = M