mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 01:24:21 +01:00
e49e13b795
## About The Pull Request Phobias have been refactored to use the new fear system instead of handling their effects via simple triggers on themselves. The overall idea is still the same, triggering upon seeing/hearing/saying a scary word or thing, but instead of instantly sending you into a panic it adds some fear and has a chance of triggering a new startle fear effect, which mirrors some of the previous phobia effects that weren't already included in other handlers. To complete the phobic trio, I've added monophobia as a quirk - its quite interesting compared to nycto- and claustrophobia, as it forces you to stick to other people, thus indirectly incentivizing social interactions, and could make for actually interesting moments. Additionally, I've cleaned up some of the related code and added message CDs to all other handlers that were missing them as to avoid chat spam which could sometimes occur when the effect triggered far too frequently. ## Why It's Good For The Game Using the new system makes phobias much more immersive and interesting to play around, as they no longer absolutely cripple you to the point of making the game unplayable in case of some of them due to random stuns or knockouts. It also makes them natively interact with other phobias and quirks, which is a neat thing for character building. Currently getting a phobia basically forces you to go to medbay as to not risk randomly falling unconscious every once in a while if you roll a common one (like cyborgs, blood, doctors or authority), and picking one as a quirk is basically not an option. ## Changelog 🆑 add: Monophobia is now availible as a negative (-3) quirk. balance: Phobias now have accumulating, and less debilitating effects due to conversion to the new fear system. qol: Fear effects now have a cooldown between messages as to avoid chat spam. code: Cleaned up some of fear code. refactor: Refactored phobias to use the fear system /🆑
180 lines
6.0 KiB
Plaintext
180 lines
6.0 KiB
Plaintext
// Terror source handlers
|
|
/// Simple source which passively increases terror based on a single condition and can do something when its added/removed
|
|
/datum/terror_handler/simple_source
|
|
handler_type = TERROR_HANDLER_SOURCE
|
|
/// How much terror is added per second
|
|
var/buildup_per_second = 10
|
|
/// Have we already applied our effects?
|
|
var/active = FALSE
|
|
|
|
/datum/terror_handler/simple_source/tick(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (check_condition(seconds_per_tick, terror_buildup) && terror_buildup < TERROR_BUILDUP_PASSIVE_MAXIMUM)
|
|
if (!active)
|
|
on_activation(terror_buildup)
|
|
. += min(buildup_per_second * seconds_per_tick, TERROR_BUILDUP_PASSIVE_MAXIMUM - terror_buildup)
|
|
else if (active)
|
|
on_deactivation(terror_buildup)
|
|
|
|
/// Proc that children should override with their conditions
|
|
/datum/terror_handler/simple_source/proc/check_condition(seconds_per_tick, terror_buildup)
|
|
return !HAS_TRAIT(owner, TRAIT_FEARLESS) && !HAS_TRAIT(owner, TRAIT_MIND_TEMPORARILY_GONE) && owner.stat < UNCONSCIOUS
|
|
|
|
/// Proc that's called when the effect is first applied, for moodlets and alike
|
|
/datum/terror_handler/simple_source/proc/on_activation(terror_buildup)
|
|
active = TRUE
|
|
|
|
/// Proc that's called when the effect stops working, for moodlets and alike
|
|
/datum/terror_handler/simple_source/proc/on_deactivation(terror_buildup)
|
|
active = FALSE
|
|
|
|
/// Makes the owner terrified of darkness
|
|
/datum/terror_handler/simple_source/nyctophobia
|
|
buildup_per_second = 5 // Takes about two minutes to reach maximum
|
|
/// Are we counteracted by mesons?
|
|
var/meson_negated = TRUE
|
|
|
|
/datum/terror_handler/simple_source/nyctophobia/Destroy(force)
|
|
owner.clear_mood_event("nyctophobia")
|
|
return ..()
|
|
|
|
/datum/terror_handler/simple_source/nyctophobia/check_condition(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (!.)
|
|
return
|
|
|
|
if (ishuman(owner))
|
|
var/mob/living/carbon/human/as_human = owner
|
|
if(as_human.dna?.species.id in list(SPECIES_SHADOW, SPECIES_NIGHTMARE))
|
|
return FALSE
|
|
|
|
if (meson_negated && (owner.sight & SEE_TURFS))
|
|
return FALSE
|
|
|
|
var/lit_tiles = 0
|
|
var/unlit_tiles = 0
|
|
|
|
for (var/turf/open/turf_to_check in range(1, owner))
|
|
var/light_amount = turf_to_check.get_lumcount()
|
|
if (light_amount > LIGHTING_TILE_IS_DARK)
|
|
lit_tiles++
|
|
else
|
|
unlit_tiles++
|
|
|
|
return lit_tiles < unlit_tiles
|
|
|
|
/datum/terror_handler/simple_source/nyctophobia/on_activation(terror_buildup)
|
|
. = ..()
|
|
owner.add_mood_event("nyctophobia", /datum/mood_event/nyctophobia)
|
|
|
|
/datum/terror_handler/simple_source/nyctophobia/on_deactivation(terror_buildup)
|
|
. = ..()
|
|
owner.clear_mood_event("nyctophobia")
|
|
|
|
/// Nightmare spell version with quicker buildup that shadows the quirk one, also handles removing the status upon reaching 0 terror
|
|
/datum/terror_handler/simple_source/nyctophobia/terrified
|
|
// Takes about 30 seconds to reach maximum if you include 100 from casting the spell
|
|
buildup_per_second = 15
|
|
// Overrides the base type with slower buildup
|
|
overrides = list(/datum/terror_handler/simple_source/nyctophobia)
|
|
meson_negated = FALSE
|
|
|
|
/datum/terror_handler/simple_source/nyctophobia/terrified/tick(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (terror_buildup == 0 && !.)
|
|
owner.RemoveComponentSource("terrified", /datum/component/fearful)
|
|
|
|
/// Makes the owner afraid of being stuck in closets, crates, mechs, etc
|
|
/datum/terror_handler/simple_source/claustrophobia
|
|
buildup_per_second = 15
|
|
COOLDOWN_DECLARE(message_cd)
|
|
|
|
/datum/terror_handler/simple_source/claustrophobia/Destroy(force)
|
|
owner.clear_mood_event("claustrophobia")
|
|
return ..()
|
|
|
|
/datum/terror_handler/simple_source/claustrophobia/check_condition(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (!.)
|
|
return
|
|
|
|
if (isturf(owner.loc))
|
|
return FALSE
|
|
|
|
if (COOLDOWN_FINISHED(src, message_cd) && SPT_PROB(15, seconds_per_tick))
|
|
to_chat(owner, span_warning("You feel trapped! Must escape... can't breathe..."))
|
|
COOLDOWN_START(src, message_cd, TERROR_MESSAGE_CD)
|
|
|
|
return TRUE
|
|
|
|
/datum/terror_handler/simple_source/claustrophobia/on_activation(terror_buildup)
|
|
. = ..()
|
|
owner.add_mood_event("claustrophobia", /datum/mood_event/claustrophobia)
|
|
|
|
/datum/terror_handler/simple_source/claustrophobia/on_deactivation(terror_buildup)
|
|
. = ..()
|
|
owner.clear_mood_event("claustrophobia")
|
|
|
|
/// Makes the owner afraid of certain jolly figures
|
|
/datum/terror_handler/simple_source/clausophobia
|
|
buildup_per_second = 20
|
|
COOLDOWN_DECLARE(message_cd)
|
|
|
|
/datum/terror_handler/simple_source/clausophobia/check_condition(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (!.)
|
|
return
|
|
|
|
var/certified_jolly = FALSE
|
|
|
|
for (var/mob/living/carbon/human/possible_claus in view(5, owner))
|
|
if (possible_claus == owner)
|
|
continue // imagine being scared of your own existence
|
|
|
|
if (!istype(possible_claus.wear_suit, /obj/item/clothing/suit/space/santa))
|
|
continue
|
|
|
|
if (istype(possible_claus.back, /obj/item/storage/backpack/santabag))
|
|
certified_jolly = TRUE
|
|
break
|
|
|
|
if (istype(possible_claus.head, /obj/item/clothing/head/costume/santa) || istype(possible_claus.head, /obj/item/clothing/head/helmet/space/santahat))
|
|
certified_jolly = TRUE
|
|
break
|
|
|
|
if (!certified_jolly)
|
|
return FALSE
|
|
|
|
if (COOLDOWN_FINISHED(src, message_cd) && SPT_PROB(15, seconds_per_tick))
|
|
to_chat(owner, span_warning("Santa Claus is here! I gotta get out of here!"))
|
|
COOLDOWN_START(src, message_cd, TERROR_MESSAGE_CD)
|
|
|
|
return TRUE
|
|
|
|
/// Makes the owner afraid of being alone
|
|
/datum/terror_handler/simple_source/monophobia
|
|
buildup_per_second = 2.5 // Pretty low, ~4 minutes to reach passive cap
|
|
COOLDOWN_DECLARE(message_cd)
|
|
|
|
/datum/terror_handler/simple_source/monophobia/check_condition(seconds_per_tick, terror_buildup)
|
|
. = ..()
|
|
if (!.)
|
|
return
|
|
|
|
var/check_radius = 7
|
|
if (owner.is_blind())
|
|
check_radius = 1
|
|
|
|
for (var/mob/living/friend in view(check_radius, owner))
|
|
if (friend == owner)
|
|
continue
|
|
|
|
if (istype(friend, /mob/living/basic/pet) || friend.ckey)
|
|
return FALSE
|
|
|
|
if (COOLDOWN_FINISHED(src, message_cd) && SPT_PROB(10, seconds_per_tick))
|
|
to_chat(owner, span_warning("You feel terribly lonely..."))
|
|
COOLDOWN_START(src, message_cd, TERROR_MESSAGE_CD)
|
|
|
|
return TRUE
|