diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm index fc5b7201621..c00ef2c4d1d 100644 --- a/code/__DEFINES/misc_defines.dm +++ b/code/__DEFINES/misc_defines.dm @@ -558,3 +558,13 @@ #define RQ_NONEW_MESSAGES 0 // RQ_NONEWMESSAGES = no new message #define RQ_NORMALPRIORITY 1 // RQ_NORMALPRIORITY = normal priority #define RQ_HIGHPRIORITY 2 // RQ_HIGHPRIORITY = high priority + +/** + * Reading books can help with brain damage! + * These are seperate times so that a user gains more benefits by reading more books, + * but also cant infinitely switch between 1000 books. + */ +/// The amount of time needed to pass to let a single book be read again for brain benefits +#define BRAIN_DAMAGE_BOOK_TIME 45 SECONDS +/// The amount of time a mob needs to wait between any book reading +#define BRAIN_DAMAGE_MOB_TIME 10 SECONDS diff --git a/code/__DEFINES/status_effects.dm b/code/__DEFINES/status_effects.dm index 9bafd69f603..add6fb00ba9 100644 --- a/code/__DEFINES/status_effects.dm +++ b/code/__DEFINES/status_effects.dm @@ -102,6 +102,8 @@ #define STATUS_EFFECT_CRYO_BEAM /datum/status_effect/cryo_beam //Chills target, freezes reagents in their blood, breaks if sight is lost. +#define STATUS_BOOKWYRM /datum/status_effect/bookwyrm + //#define STATUS_EFFECT_NECROPOLIS_CURSE /datum/status_effect/necropolis_curse //#define CURSE_BLINDING 1 //makes the edges of the target's screen obscured //#define CURSE_SPAWNING 2 //spawns creatures that attack the target only diff --git a/code/datums/status_effects/buffs.dm b/code/datums/status_effects/buffs.dm index 940f2561442..954e264ee99 100644 --- a/code/datums/status_effects/buffs.dm +++ b/code/datums/status_effects/buffs.dm @@ -736,3 +736,7 @@ /datum/status_effect/rev_protection/on_remove() UnregisterSignal(owner, COMSIG_HUMAN_ATTACKED) . = ..() + +/datum/status_effect/bookwyrm + duration = BRAIN_DAMAGE_MOB_TIME + alert_type = null diff --git a/code/modules/library/book.dm b/code/modules/library/book.dm index 0325cdd39c1..a796ad9773a 100644 --- a/code/modules/library/book.dm +++ b/code/modules/library/book.dm @@ -55,6 +55,8 @@ var/carved = FALSE ///Item that is stored inside the book var/obj/item/store + /// Cooldown for brain damage loss when reading + COOLDOWN_DECLARE(brain_damage_cooldown) /obj/item/book/Initialize(mapload, datum/cachedbook/CB, _copyright = FALSE, _protected = FALSE) . = ..() @@ -137,6 +139,16 @@ if(!can_read(user)) return + if(isliving(user)) + var/mob/living/L = user + // Books can be read every BRAIN_DAMAGE_BOOK_TIME, and has a minumum delay of BRAIN_DAMAGE_MOB_TIME between seperate book reads. + if(!L.has_status_effect(STATUS_BOOKWYRM) && COOLDOWN_FINISHED(src, brain_damage_cooldown)) + if(prob(10)) + to_chat(L, "You feel a bit smarter!") + L.adjustBrainLoss(-1) + COOLDOWN_START(src, brain_damage_cooldown, BRAIN_DAMAGE_BOOK_TIME) + L.apply_status_effect(STATUS_BOOKWYRM) + show_content(user) //where all the magic happens onclose(user, "book")