Confusion will no longer continue to confuse after being cured (#52286)

* Confusion will no longer continue to confuse after being cured

* Grammar comment fix

* Move to status effect

* Remove test per request

* Make confusion a status effect, confusion curing now completely neuters the confusion

* set_confusion changes, get_confusion

* Fix confusion going down twice per tick

* Change strength = to proc

* Move procs to status_procs
This commit is contained in:
Jared-Fogle
2020-08-05 12:36:00 -07:00
committed by GitHub
parent 4176da0cb7
commit 7df16c595e
47 changed files with 137 additions and 82 deletions

View File

@@ -21,7 +21,7 @@
H.Stun(50)
if(2)
to_chat(H, "<span class='warning'>You hear an annoying buzz in your head.</span>")
H.confused += 15
H.add_confusion(15)
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 10, 160)
if(3)
H.hallucination += 60

View File

@@ -25,7 +25,7 @@
H.Stun(20)
H.blur_eyes(20)
eyes?.applyOrganDamage(5)
H.confused += 3
H.add_confusion(3)
for(var/mob/living/silicon/S in range(2,user))
to_chat(S, "<span class='userdanger'>Your sensors are disabled by a shower of blood!</span>")
S.Paralyze(60)

View File

@@ -17,7 +17,7 @@
var/obj/item/organ/ears/ears = C.getorganslot(ORGAN_SLOT_EARS)
if(ears)
ears.adjustEarDamage(0, 30)
C.confused += 25
C.add_confusion(25)
C.Jitter(50)
else
SEND_SOUND(C, sound('sound/effects/screech.ogg'))

View File

@@ -31,7 +31,7 @@
return
if(prob(stage*3))
to_chat(affected_mob, "<span class='revennotice'>You suddenly feel [pick("sick and tired", "disoriented", "tired and confused", "nauseated", "faint", "dizzy")]...</span>")
affected_mob.confused += 8
affected_mob.add_confusion(8)
affected_mob.adjustStaminaLoss(20)
new /obj/effect/temp_visual/revenant(affected_mob.loc)
if(stagedamage < stage)

View File

@@ -164,7 +164,7 @@
M.reagents.add_reagent(/datum/reagent/medicine/omnizine, 20)
M.flash_act()
M.confused += 10
M.add_confusion(10)
M.blur_eyes(5)
to_chat(M, "<span class='warning'>You feel strange...</span>")
sleep(60)
@@ -173,7 +173,7 @@
sleep(65)
to_chat(M, "<span class='warning'>Your head pounds... It feels like it's going to burst out your skull!</span>")
M.flash_act()
M.confused += 20
M.add_confusion(20)
M.blur_eyes(3)
sleep(30)
to_chat(M, "<span class='warning'>Your head pounds...</span>")
@@ -185,7 +185,7 @@
so it's only a matter of time before we ship you back...\"</i></span>")
M.blur_eyes(10)
M.Dizzy(15)
M.confused += 20
M.add_confusion(20)
// We're returning the victim
/datum/syndicate_contract/proc/returnVictim(var/mob/living/M)
@@ -224,7 +224,7 @@
M.flash_act()
M.blur_eyes(30)
M.Dizzy(35)
M.confused += 20
M.add_confusion(20)
new /obj/effect/pod_landingzone(possible_drop_loc[pod_rand_loc], return_pod)
else

View File

@@ -116,9 +116,9 @@
to_chat(M, "<span class='danger'>[src] emits a blinding light!</span>")
if(targeted)
if(M.flash_act(1, 1))
if(M.confused < power)
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
M.confused += min(power, diff)
if(M.get_confusion() < power)
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
M.add_confusion(min(power, diff))
if(user)
terrible_conversion_proc(M, user)
visible_message("<span class='danger'>[user] blinds [M] with the flash!</span>")
@@ -135,8 +135,8 @@
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
else
if(M.flash_act())
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
M.confused += min(power, diff)
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
M.add_confusion(min(power, diff))
/obj/item/assembly/flash/attack(mob/living/M, mob/user)
if(!try_use_flash(user))
@@ -149,8 +149,8 @@
log_combat(user, R, "flashed", src)
update_icon(1)
R.Paralyze(rand(80,120))
var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
R.confused += min(5, diff)
var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.get_confusion()
R.add_confusion(min(5, diff))
R.flash_act(affect_silicon = 1)
user.visible_message("<span class='warning'>[user] overloads [R]'s sensors with the flash!</span>", "<span class='danger'>You overload [R]'s sensors with the flash!</span>")
return TRUE
@@ -279,7 +279,7 @@
if(!hypnosis)
to_chat(M, "<span class='hypnophrase'>The light makes you feel oddly relaxed...</span>")
M.confused += min(M.confused + 10, 20)
M.add_confusion(min(M.get_confusion() + 10, 20))
M.dizziness += min(M.dizziness + 10, 20)
M.drowsyness += min(M.drowsyness + 10, 20)
M.apply_status_effect(STATUS_EFFECT_PACIFY, 100)
@@ -293,7 +293,7 @@
else if(M.flash_act())
to_chat(M, "<span class='notice'>Such a pretty light...</span>")
M.confused += min(M.confused + 4, 20)
M.add_confusion(min(M.get_confusion() + 4, 20))
M.dizziness += min(M.dizziness + 4, 20)
M.drowsyness += min(M.drowsyness + 4, 20)
M.apply_status_effect(STATUS_EFFECT_PACIFY, 40)

View File

@@ -104,7 +104,7 @@
return
var/mob/living/carbon/human/H = AM
if(has_gravity(loc) && HAS_TRAIT(H, TRAIT_CLUMSY) && !H.resting)
H.confused = max(H.confused, 10)
H.set_confusion(max(H.get_confusion(), 10))
H.Stun(20)
playsound(src, 'sound/weapons/punch4.ogg', 50, TRUE)
H.visible_message("<span class='warning'>[H] steps on [src] causing the handle to hit [H.p_them()] right in the face!</span>", \

View File

@@ -120,7 +120,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
return
C.adjust_blurriness(6)
C.adjustStaminaLoss(15)//the pain from your eyes burning does stamina damage
C.confused += 5
C.add_confusion(5)
to_chat(C, "<span class='userdanger'>\The [src] gets into your eyes! The pain, it burns!</span>")
qdel(src)

View File

@@ -132,7 +132,7 @@
owner.Paralyze(100)
owner.jitteriness += 30
owner.confused += 30
owner.add_confusion(30)
owner.stuttering += 30
recent_queen_death = 1

View File

@@ -1592,7 +1592,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
if(H.stat == CONSCIOUS)
H.visible_message("<span class='danger'>[H] is knocked senseless!</span>", \
"<span class='userdanger'>You're knocked senseless!</span>")
H.confused = max(H.confused, 20)
H.set_confusion(max(H.get_confusion(), 20))
H.adjust_blurriness(10)
if(prob(10))
H.gain_trauma(/datum/brain_trauma/mild/concussion)

View File

@@ -817,7 +817,7 @@
M.show_message("<span class='narsiesmall'>GONG!</span>", MSG_AUDIBLE)
M.playsound_local(H, 'sound/effects/gong.ogg', 100, TRUE)
M.soundbang_act(1, 0, 30, 3)
M.confused += 10
M.add_confusion(10)
M.jitteriness += 4
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, "gonged", /datum/mood_event/loud_gong)
if(2 to 3)

View File

@@ -539,12 +539,12 @@ All effects don't start immediately, but rather get worse over time; the rate is
if(drunkenness >= 41)
if(prob(25))
confused += 2
add_confusion(2)
Dizzy(10)
if(drunkenness >= 51)
if(prob(3))
confused += 15
add_confusion(15)
vomit() // vomiting clears toxloss, consider this a blessing
Dizzy(25)

View File

@@ -118,8 +118,6 @@
//this updates all special effects: knockdown, druggy, stuttering, etc..
/mob/living/proc/handle_status_effects()
if(confused)
confused = max(0, confused - 1)
/mob/living/proc/handle_traits()
//Eyes

View File

@@ -618,7 +618,7 @@
heal_overall_damage(INFINITY, INFINITY, INFINITY, null, TRUE) //heal brute and burn dmg on both organic and robotic limbs, and update health right away.
ExtinguishMob()
fire_stacks = 0
confused = 0
set_confusion(0)
dizziness = 0
drowsyness = 0
stuttering = 0

View File

@@ -33,8 +33,6 @@
VAR_PROTECTED/lying_angle = 0 ///number of degrees. DO NOT USE THIS IN CHECKS. CHECK FOR MOBILITY FLAGS INSTEAD!!
var/lying_prev = 0 ///last value of lying on update_mobility
var/confused = 0 ///Makes the mob move in random directions.
var/hallucination = 0 ///Directly affects how long a mob will hallucinate for
var/last_special = 0 ///Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.

View File

@@ -494,3 +494,23 @@
LAZYREMOVEASSOC(movespeed_mod_immunities, slowdown_type, source)
if(update)
update_movespeed()
/// Gets the amount of confusion on the mob.
/mob/living/proc/get_confusion()
var/datum/status_effect/confusion/confusion = has_status_effect(STATUS_EFFECT_CONFUSION)
return confusion ? confusion.strength : 0
/// Set the confusion of the mob. Confusion will make the mob walk randomly.
/mob/living/proc/set_confusion(new_confusion)
new_confusion = max(new_confusion, 0)
if (new_confusion)
var/datum/status_effect/confusion/confusion_status = has_status_effect(STATUS_EFFECT_CONFUSION) || apply_status_effect(STATUS_EFFECT_CONFUSION)
confusion_status.set_strength(new_confusion)
else
remove_status_effect(STATUS_EFFECT_CONFUSION)
/// Add confusion to the mob. Confusion will make the mob walk randomly.
/// Shorthand for set_confusion(confusion + x).
/mob/living/proc/add_confusion(confusion_to_add)
set_confusion(get_confusion() + confusion_to_add)

View File

@@ -123,13 +123,14 @@
else
move_delay = world.time
if(L.confused)
var/confusion = L.get_confusion()
if(confusion)
var/newdir = 0
if(L.confused > 40)
if(confusion > 40)
newdir = pick(GLOB.alldirs)
else if(prob(L.confused * 1.5))
else if(prob(confusion * 1.5))
newdir = angle2dir(dir2angle(direct) + pick(90, -90))
else if(prob(L.confused * 3))
else if(prob(confusion * 3))
newdir = angle2dir(dir2angle(direct) + pick(45, -45))
if(newdir)
direct = newdir

View File

@@ -1318,7 +1318,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
/datum/reagent/consumable/ethanol/atomicbomb/on_mob_life(mob/living/carbon/M)
M.set_drugginess(50)
if(!HAS_TRAIT(M, TRAIT_ALCOHOL_TOLERANCE))
M.confused = max(M.confused+2,0)
M.set_confusion(max(M.get_confusion()+2,0))
M.Dizzy(10)
if (!M.slurring)
M.slurring = 1
@@ -1353,7 +1353,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
M.slurring += 3
if(45 to 55)
if(prob(50))
M.confused = max(M.confused+3,0)
M.set_confusion(max(M.get_confusion()+3,0))
if(55 to 200)
M.set_drugginess(55)
if(200 to INFINITY)

View File

@@ -393,7 +393,7 @@
/datum/reagent/drug/happiness/on_mob_life(mob/living/carbon/M)
M.jitteriness = 0
M.confused = 0
M.set_confusion(0)
M.disgust = 0
M.adjustOrganLoss(ORGAN_SLOT_BRAIN, 0.2)
..()

View File

@@ -314,7 +314,7 @@
victim.emote("scream")
victim.blur_eyes(5) // 10 seconds
victim.blind_eyes(3) // 6 seconds
victim.confused = max(M.confused, 5) // 10 seconds
victim.set_confusion(max(M.get_confusion(), 5)) // 10 seconds
victim.Knockdown(3 SECONDS)
victim.add_movespeed_modifier(/datum/movespeed_modifier/reagent/pepperspray)
addtimer(CALLBACK(victim, /mob.proc/remove_movespeed_modifier, /datum/movespeed_modifier/reagent/pepperspray), 10 SECONDS)

View File

@@ -76,7 +76,7 @@
M.drowsyness = 0
M.stuttering = 0
M.slurring = 0
M.confused = 0
M.set_confusion(0)
M.SetSleeping(0, 0)
M.jitteriness = 0
if(M.blood_volume < BLOOD_VOLUME_NORMAL)
@@ -848,7 +848,7 @@
M.dizziness = 0
M.drowsyness = 0
M.slurring = 0
M.confused = 0
M.set_confusion(0)
M.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 3*REM, 0, 1)
M.adjustToxLoss(-0.2*REM, 0)
if(ishuman(M))
@@ -1215,7 +1215,7 @@
/datum/reagent/medicine/psicodine/on_mob_life(mob/living/carbon/M)
M.jitteriness = max(0, M.jitteriness-6)
M.dizziness = max(0, M.dizziness-6)
M.confused = max(0, M.confused-6)
M.set_confusion(max(0, M.get_confusion()-6))
M.disgust = max(0, M.disgust-6)
var/datum/component/mood/mood = M.GetComponent(/datum/component/mood)
if(mood != null && mood.sanity <= SANITY_NEUTRAL) // only take effect if in negative sanity and then...

View File

@@ -1111,9 +1111,7 @@
/datum/reagent/cryptobiolin/on_mob_life(mob/living/carbon/M)
M.Dizzy(1)
if(!M.confused)
M.confused = 1
M.confused = max(M.confused, 20)
M.set_confusion(clamp(M.get_confusion(), 1, 20))
..()
/datum/reagent/impedrezene
@@ -1277,7 +1275,7 @@
H.blood_volume = max(H.blood_volume - 10, 0)
if(prob(20))
M.losebreath += 2
M.confused = min(M.confused + 2, 5)
M.set_confusion(min(M.get_confusion() + 2, 5))
..()
/datum/reagent/stimulum
@@ -2068,8 +2066,8 @@
can_synth = TRUE
/datum/reagent/peaceborg/confuse/on_mob_life(mob/living/carbon/M)
if(M.confused < 6)
M.confused = clamp(M.confused + 3, 0, 5)
if(M.get_confusion() < 6)
M.set_confusion(clamp(M.get_confusion() + 3, 0, 5))
if(M.dizziness < 6)
M.dizziness = clamp(M.dizziness + 3, 0, 5)
if(prob(20))

View File

@@ -221,7 +221,7 @@
return TRUE
switch(current_cycle)
if(1 to 5)
M.confused += 1
M.add_confusion(1)
M.drowsyness += 1
M.slurring += 3
if(5 to 8)
@@ -378,7 +378,7 @@
/datum/reagent/toxin/chloralhydrate/on_mob_life(mob/living/carbon/M)
switch(current_cycle)
if(1 to 10)
M.confused += 2
M.add_confusion(2)
M.drowsyness += 2
if(10 to 50)
M.Sleeping(40, 0)
@@ -979,7 +979,7 @@
/datum/reagent/toxin/bungotoxin/on_mob_life(mob/living/carbon/M)
M.adjustOrganLoss(ORGAN_SLOT_HEART, 3)
M.confused = M.dizziness //add a tertiary effect here if this is isn't an effective poison.
M.set_confusion(M.dizziness) //add a tertiary effect here if this is isn't an effective poison.
if(current_cycle >= 12 && prob(8))
var/tox_message = pick("You feel your heart spasm in your chest.", "You feel faint.","You feel you need to catch your breath.","You feel a prickle of pain in your chest.")
to_chat(M, "<span class='notice'>[tox_message]</span>")
@@ -1000,5 +1000,5 @@
M.adjustOrganLoss(ORGAN_SLOT_BRAIN,1)
if(prob(1))
to_chat(M, "<span class='notice'>Ah, what was that? You thought you heard something...</span>")
M.confused += 5
M.add_confusion(5)
return ..()

View File

@@ -75,7 +75,7 @@
if(1)
host_mob.hallucination += 15
if(2)
host_mob.confused += 10
host_mob.add_confusion(10)
if(3)
host_mob.drowsyness += 10
if(4)
@@ -110,7 +110,7 @@
/datum/nanite_program/nerve_decay/active_effect()
if(prob(5))
to_chat(host_mob, "<span class='warning'>You feel unbalanced!</span>")
host_mob.confused += 10
host_mob.add_confusion(10)
else if(prob(4))
to_chat(host_mob, "<span class='warning'>You can't feel your hands!</span>")
host_mob.drop_all_held_items()

View File

@@ -51,13 +51,13 @@
if(H.disgust >= DISGUST_LEVEL_GROSS)
if(prob(10))
H.stuttering += 1
H.confused += 2
H.add_confusion(2)
if(prob(10) && !H.stat)
to_chat(H, "<span class='warning'>You feel kind of iffy...</span>")
H.jitteriness = max(H.jitteriness - 3, 0)
if(H.disgust >= DISGUST_LEVEL_VERYGROSS)
if(prob(pukeprob)) //iT hAndLeS mOrE ThaN PukInG
H.confused += 2.5
H.add_confusion(2.5)
H.stuttering += 1
H.vomit(10, 0, 1, 0, 1, 0)
H.Dizzy(5)

View File

@@ -15,6 +15,7 @@
#include "card_mismatch.dm"
#include "chain_pull_through_space.dm"
#include "component_tests.dm"
#include "confusion.dm"
#include "keybinding_init.dm"
#include "medical_wounds.dm"
#include "metabolizing.dm"

View File

@@ -0,0 +1,16 @@
// Checks that the confusion symptom correctly gives, and removes, confusion
/datum/unit_test/confusion_symptom/Run()
var/mob/living/carbon/human/H = allocate(/mob/living/carbon/human)
var/datum/disease/advance/confusion/disease = allocate(/datum/disease/advance/confusion)
var/datum/symptom/confusion/confusion = disease.symptoms[1]
disease.processing = TRUE
disease.update_stage(5)
disease.infect(H, make_copy = FALSE)
confusion.Activate(disease)
TEST_ASSERT(H.get_confusion() > 0, "Human is not confused after getting symptom.")
disease.cure()
TEST_ASSERT_EQUAL(H.get_confusion(), 0, "Human is still confused after curing confusion.")
/datum/disease/advance/confusion/New()
symptoms += new /datum/symptom/confusion
Refresh()