Files
Bubberstation/code/modules/hallucination/battle.dm
MrMelbert eb0e842320 Hallucination revamps and additions (#89865)
## About The Pull Request

1. Hallucination effects are now tiered

Hallucinations now all have tiers, ranging from common to special. 
If you are just hallucinating a teeny bit, you will not experience the
more extreme hallucinations, like bubblegum or your mom.
But if you're hallucinating off your butt, you will be a bit more likely
to experience them.

2. Hallucination rate has been tweaked

Default hallucination cooldown is now 20-80 seconds, up from 10-60
seconds.
However the cooldown will *also* vary depending on just how much you're
hallucinating, going down to 10-40 seconds.

3. RDS is now capped a bit lower (meaning you don't see the higher tiers
like bubblegum).

But I added a preference to uncap it. For the people who actually like
bubblegum visits.

4. If a hallucination fails to trigger, the cooldown will partially
reset. (by 75%)

5. "Fake chat" hallucination will pick more viable subjects.

Fake chat will try to find someone who can actually speak your language,
rather than make a monkey speak mothic or something.
(I may revisit this so if you're super-hallucinating it reverts to old
behavior though.)

6. Adds a hallucination: Fake blood

You hallucinate that you start bleeding, very simple.

7. Adds a hallucination: Fake telepathy

You hallucinate a random telepathic message, similar to fake chat.

8. Adds a hallucination: Eyes in the Dark

A nearby dark turf will have a set of glowing red eyes shine through the
dark. A classic.

9. Adds some new sub-hallucination: PDA ringtone (fake sound), summon
guns/magic (fake item)

Funny prank.

10. Makes mindbreaker a bit more effective at combating RDS.

Pretty much does nothing right now unless you gulp like 50u.

## Why It's Good For The Game

Hallucinations are pretty one note if you experience them for longer
than 10 minutes.

This is due to two fold:
- Many hallucinations are goofy, and not subtle
- Hallucinations trigger very rapidly

You will never fall for a hallucination because in between "You see John
Greytide put the blueprints away", you get your mom yelling at you,
everyone looking like syndies (again), and bubblegum

This pr addresses it by
- Limiting the wacky hallucinations for when you're really off your
gourd
- Reducing the period between triggers
- Adding a few hallucinations

If the wackier hallucinations are reserved for when you're really off
your rocker, this lets the more subtle ones sink in over time, leaves
more room for second guessing

## Changelog

🆑 Melbert
add: Adds 4-5 new hallucinations. Collect them all.
balance: If you are only hallucinating a little bit, the game will
prefer to pick more subtle hallucinations. If you are hallucinating a
ton, it will prefer the more wacky hallucinations.
balance: If you are only hallucinating a little bit, the cooldown
between hallucinations is longer. If you are hallucinating a ton, it
will be shorter.
balance: If a hallucination fails to trigger (such as a deaf person
getting a sound hallucination) the next one will be a lot sooner.
balance: RDS hallucination amount is capped at mid tier hallucinations.
This means bubblegum and co. will be a lot rarer, or will even never
show. HOWEVER, there is now a preference allowing you to uncap your RDS
hallucinations.
balance: Mindbreaker toxin is more effective at suppressing RDS.
balance: Some hallucinations effects have been tweaked up or down
according to the new thresholds. Madness mask as an example.
fix: "Fake Fire" Hallucination works again, and now has a unique message
for if you stop-drop-roll that other people see.
/🆑
2025-03-20 21:36:56 +00:00

171 lines
6.5 KiB
Plaintext

/// Battle hallucination, makes it sound like a melee or gun battle is going on in the background.
/datum/hallucination/battle
abstract_hallucination_parent = /datum/hallucination/battle
random_hallucination_weight = 3
hallucination_tier = HALLUCINATION_TIER_COMMON
/// Subtype of battle hallucination for gun based battles, where it sounds like someone is being shot.
/datum/hallucination/battle/gun
abstract_hallucination_parent = /datum/hallucination/battle/gun
/// The lower end to how many shots we'll fire.
var/shots_to_fire_lower_range = 3
/// The upper end to how many shots we'll fire.
var/shots_to_fire_upper_range = 6
/// The sound effect we play when we "fire" a shot.
var/fire_sound = 'sound/items/weapons/gun/shotgun/shot.ogg'
/// The sound we make when our shot actually "hits" "someone".
var/hit_person_sound = 'sound/items/weapons/pierce.ogg'
/// The sound we make when our shot misses someone and "hits" a "wall".
var/hit_wall_sound = SFX_RICOCHET
/// The number of successful hits required to "down" the "someone" we're firing at.
var/number_of_hits_to_end = 2
/// The probability chance we have to make our "hit" person fall down after we pass the number_of_hits_to_end.
var/chance_to_fall = 80
/datum/hallucination/battle/gun/start()
fire_loop(random_far_turf(), rand(shots_to_fire_lower_range, shots_to_fire_upper_range))
return TRUE
/// The main loop for gun based hallucinations.
/datum/hallucination/battle/gun/proc/fire_loop(turf/source, shots_left = 3, hits = 0)
if(QDELETED(src) || QDELETED(hallucinator) || !source)
return
// We shoot our shot.
hallucinator.playsound_local(source, fire_sound, 25, TRUE)
// Shortly after shooting our shot, it plays a hit (or miss) sound.
var/next_hit_sound = rand(0.5 SECONDS, 1 SECONDS)
if(prob(50))
addtimer(CALLBACK(hallucinator, TYPE_PROC_REF(/mob/, playsound_local), source, hit_person_sound, 25, TRUE), next_hit_sound)
hits++
else
addtimer(CALLBACK(hallucinator, TYPE_PROC_REF(/mob/, playsound_local), source, hit_wall_sound, 25, TRUE), next_hit_sound)
// If we scored enough hits, we have a chance to knock them down and stop the hallucination early.
if(hits >= number_of_hits_to_end && prob(chance_to_fall))
addtimer(CALLBACK(hallucinator, TYPE_PROC_REF(/mob/, playsound_local), source, SFX_BODYFALL, 25, TRUE), next_hit_sound)
qdel(src)
// Or, if we do have shots left, keep it going.
else if(shots_left >= 0)
shots_left--
addtimer(CALLBACK(src, PROC_REF(fire_loop), source, shots_left, hits), rand(CLICK_CD_RANGE, CLICK_CD_RANGE + 6))
// Otherwise, if we have no shots left, stop the hallucination.
else
qdel(src)
/// Gun battle hallucination that sounds like disabler fire.
/datum/hallucination/battle/gun/disabler
shots_to_fire_lower_range = 5
shots_to_fire_upper_range = 10
fire_sound = 'sound/items/weapons/taser2.ogg'
hit_person_sound = 'sound/items/weapons/tap.ogg'
hit_wall_sound = 'sound/items/weapons/effects/searwall.ogg'
number_of_hits_to_end = 3
chance_to_fall = 70
/// Gun battle hallucination that sounds like laser fire.
/datum/hallucination/battle/gun/laser
shots_to_fire_lower_range = 5
shots_to_fire_upper_range = 10
fire_sound = 'sound/items/weapons/laser.ogg'
hit_person_sound = 'sound/items/weapons/sear.ogg'
hit_wall_sound = 'sound/items/weapons/effects/searwall.ogg'
number_of_hits_to_end = 4
chance_to_fall = 70
/// A hallucination of someone being hit with a stun prod, followed by cable cuffing.
/datum/hallucination/battle/stun_prod
/datum/hallucination/battle/stun_prod/start()
var/turf/source = random_far_turf()
hallucinator.playsound_local(source, 'sound/items/weapons/egloves.ogg', 40, TRUE)
hallucinator.playsound_local(source, SFX_BODYFALL, 25, TRUE)
addtimer(CALLBACK(src, PROC_REF(fake_cuff), source), 2 SECONDS)
return TRUE
/// Plays a fake cable-cuff sound and deletes the hallucination.
/datum/hallucination/battle/stun_prod/proc/fake_cuff(turf/source)
if(QDELETED(src) || QDELETED(hallucinator) || !source)
return
hallucinator.playsound_local(source, 'sound/items/weapons/cablecuff.ogg', 15, TRUE)
qdel(src)
/// A hallucination of someone being stun batonned, and subsequently harmbatonned.
/datum/hallucination/battle/harm_baton
/datum/hallucination/battle/harm_baton/start()
var/turf/source = random_far_turf()
hallucinator.playsound_local(source, 'sound/items/weapons/egloves.ogg', 40, TRUE)
hallucinator.playsound_local(source, SFX_BODYFALL, 25, TRUE)
addtimer(CALLBACK(src, PROC_REF(harmbaton_loop), source, rand(5, 12)), 2 SECONDS)
return TRUE
/// The main sound loop for harmbatonning.
/datum/hallucination/battle/harm_baton/proc/harmbaton_loop(turf/source, hits_remaing = 5)
if(QDELETED(src) || QDELETED(hallucinator) || !source)
return
hallucinator.playsound_local(source, SFX_SWING_HIT, 50, TRUE)
hits_remaing--
if(hits_remaing <= 0)
qdel(src)
else
addtimer(CALLBACK(src, PROC_REF(harmbaton_loop), source, hits_remaing), rand(CLICK_CD_MELEE, CLICK_CD_MELEE + 4))
/// A hallucination of someone unsheathing an energy sword, going to town, and sheathing it again.
/datum/hallucination/battle/e_sword
/datum/hallucination/battle/e_sword/start()
var/turf/source = random_far_turf()
hallucinator.playsound_local(source, 'sound/items/weapons/saberon.ogg', 15, 1)
addtimer(CALLBACK(src, PROC_REF(stab_loop), source, rand(4, 8)), CLICK_CD_MELEE)
return TRUE
/// The main sound loop of someone being esworded.
/datum/hallucination/battle/e_sword/proc/stab_loop(turf/source, stabs_remaining = 4)
if(QDELETED(src) || QDELETED(hallucinator) || !source)
return
if(stabs_remaining >= 1)
hallucinator.playsound_local(source, 'sound/items/weapons/blade1.ogg', 50, TRUE)
else
hallucinator.playsound_local(source, 'sound/items/weapons/saberoff.ogg', 15, TRUE)
qdel(src)
return
if(stabs_remaining == 4)
hallucinator.playsound_local(source, SFX_BODYFALL, 25, TRUE)
addtimer(CALLBACK(src, PROC_REF(stab_loop), source, stabs_remaining - 1), rand(CLICK_CD_MELEE, CLICK_CD_MELEE + 6))
/// A hallucination of a syndicate bomb ticking down.
/datum/hallucination/battle/bomb
/datum/hallucination/battle/bomb/start()
addtimer(CALLBACK(src, PROC_REF(fake_tick), random_far_turf(), rand(3, 11)), 1.5 SECONDS)
return TRUE
/// The loop of the (fake) bomb ticking down.
/datum/hallucination/battle/bomb/proc/fake_tick(turf/source, ticks_remaining = 3)
if(QDELETED(src) || QDELETED(hallucinator) || !source)
return
hallucinator.playsound_local(source, 'sound/items/timer.ogg', 25, FALSE)
ticks_remaining--
if(ticks_remaining <= 0)
qdel(src)
else
addtimer(CALLBACK(src, PROC_REF(fake_tick), source, ticks_remaining), 1.5 SECONDS)