Files
Bubberstation/code/modules/library/random_books.dm
Sealed101 d93dfbc35c Adds Summon Cheese (#77778)
oh apparently this is my 100th PR on tg, which is weird because github
reports 99 total, and i made at least one to the old voidcrew repo, and
filtering tg prs by my name still shows 99. weird. here's to 100 more i
guess?

<sub>could have been better if it was a get, jhonflupwliiard watch ur
back 🔫 </sub>

## About The Pull Request

Adds a new spell granter book to the Wizard's Den - Summon Cheese, which
grants the spell by the same name, which summons 9 heads of cheese.
That's about it, I think.

## Why It's Good For The Game

Wizards are a hungry bunch, so why can't they just summon food? They can
even share, if they'd like, since the notion of a friendly wizard still
exists

<details>
<summary>... </summary>

alright fine
i'm slightly malding over not getting the 77777 get so no more
roleplaying in the pr body

Wizard Grand Ritual now has a hidden goal of sacrificing 50 cheese
wheels. Sacrificing a cheese wheel is done with invoking the grand rune,
and each invocation/pulse of the rune will whisk away more cheese until
all cheese on the rune is taken by whichever entity lurks in the other
realm. The sacrifice will be hinted at in an _ancient parchment_ which
will be on the bookshelf (when i add it lmao) alongside the spell book.

Meeting this cheese goal will lock the wizard's grand finale rune and
grand finale effect to special ones. The cheese rune is mostly identical
to the normal grand rune, barring the custom sprites/animations.
The cheese finale consists of the wizard getting permanent Levitation
(nogravity + free space movement), a 0.5 modifier(reducing incoming
damage in half) to every damage type, a comically strong mood buff and
**The Wabbajack**(separate sprite pending) - a juiced up chaos staff
which can fire a lot more projectiles than a normal one can (it will get
more, I may even make a few just for it).
Everybody else (including any invader antags) gets hallucinations, 175
brain damage and a comically strong mood debuff, as well as a vendetta
against the wizard. If the victim was already suffering from
hallucinations from a trauma (including the quirk), they are instead
healed.

if you didn't catch the obvious reference, this entire shtick is a
tribute to Sheogorath. the rune makes use of daedric script, and most of
the catchphrases are a direct quotation of the Daedric Prince of
Madness, so if any of those things can get us in trouble somehow, let me
know. i will be sad but i will comply.

This shtick is intended as an easter egg, really, so I wasn't really
planning on expanding the wizard grand finale into heretic paths thing
or whatever.

Oh, and finale grand runes now allow the wizard to select the effect
even if it's time-gated. If it is, you just won't be able to invoke it
until the time comes. The rune will tell you how much time is left until
you can invoke it. And grand finale runes with a finale effect selected
also glow in the color of their effect. I also think I fixed some step
of the grand rune animation not triggering but I'm not sure.

<details><summary>Some rune animations (some are subject to
change)</summary>


![rune_cheese_activate](https://github.com/tgstation/tgstation/assets/75863639/62ae184d-b6fc-4883-a169-4d8ca7636b40)


![rune_cheese_flash_2](https://github.com/tgstation/tgstation/assets/75863639/619545c8-3c55-4264-bfa4-d40067ef7406)


</details> 

## Why It's Great For The Game

it's funny

</details> 

## Changelog


🆑 Sealed101, EBAT_BASUHA for spritework
add: Wizard's Den now has a book of Summon Cheese in the Studies Room
/🆑

---------

Co-authored-by: san7890 <the@san7890.com>
2023-08-31 10:31:33 -06:00

117 lines
3.9 KiB
Plaintext

/obj/item/book/manual/random
icon_state = "random_book"
/obj/item/book/manual/random/Initialize(mapload)
..()
var/static/banned_books = list(/obj/item/book/manual/random, /obj/item/book/manual/nuclear, /obj/item/book/manual/wiki)
var/newtype = pick(subtypesof(/obj/item/book/manual) - banned_books)
new newtype(loc)
return INITIALIZE_HINT_QDEL
/obj/item/book/random
icon_state = "random_book"
/// The category of books to pick from when creating this book.
var/random_category = null
/// If this book has already been 'generated' yet.
var/random_loaded = FALSE
/obj/item/book/random/Initialize(mapload)
. = ..()
gen_random_icon_state()
/obj/item/book/random/attack_self()
if(!random_loaded)
create_random_books(1, loc, TRUE, random_category, src)
random_loaded = TRUE
return ..()
/obj/structure/bookcase/random
load_random_books = TRUE
books_to_load = 2
icon_state = "random_bookcase"
/obj/structure/bookcase/random/Initialize(mapload)
. = ..()
if(books_to_load && isnum(books_to_load))
books_to_load += pick(-1,-1,0,1,1)
update_appearance()
/proc/create_random_books(amount, location, fail_loud = FALSE, category = null, obj/item/book/existing_book)
. = list()
if(!isnum(amount) || amount<1)
return
if (!SSdbcore.Connect())
if(existing_book && (fail_loud || prob(5)))
var/error_text = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"
existing_book.book_data = new("Strange Book", "???", error_text)
return
if(prob(25))
category = null
var/datum/db_query/query_get_random_books = SSdbcore.NewQuery({"
SELECT title, author, content
FROM [format_table_name("library")]
WHERE isnull(deleted) AND (:category IS NULL OR category = :category)
ORDER BY rand() LIMIT :limit
"}, list("category" = category, "limit" = amount))
if(query_get_random_books.Execute())
while(query_get_random_books.NextRow())
var/list/book_deets = query_get_random_books.item
var/obj/item/book/to_randomize = existing_book ? existing_book : new(location)
to_randomize.book_data = new()
var/datum/book_info/data = to_randomize.book_data
data.set_title(book_deets[1], trusted = TRUE)
data.set_author(book_deets[2], trusted = TRUE)
data.set_content(book_deets[3], trusted = TRUE)
to_randomize.name = "Book: [to_randomize.book_data.title]"
if(!existing_book)
to_randomize.gen_random_icon_state()
qdel(query_get_random_books)
/obj/structure/bookcase/random/fiction
name = "bookcase (Fiction)"
random_category = "Fiction"
///have we spawned the chuuni granter
var/static/chuuni_book_spawned = FALSE
/obj/structure/bookcase/random/fiction/after_random_load()
if(!chuuni_book_spawned && is_station_level(z))
chuuni_book_spawned = TRUE
new /obj/item/book/granter/chuunibyou(src)
/obj/structure/bookcase/random/nonfiction
name = "bookcase (Non-Fiction)"
random_category = "Non-fiction"
/obj/structure/bookcase/random/religion
name = "bookcase (Religion)"
random_category = "Religion"
/obj/structure/bookcase/random/adult
name = "bookcase (Adult)"
random_category = "Adult"
/obj/structure/bookcase/random/reference
name = "bookcase (Reference)"
random_category = "Reference"
///Chance to spawn a random manual book
var/ref_book_prob = 20
/obj/structure/bookcase/random/reference/Initialize(mapload)
. = ..()
while(books_to_load > 0 && prob(ref_book_prob))
books_to_load--
new /obj/item/book/manual/random(src)
/obj/structure/bookcase/random/reference/wizard
desc = "It reeks of cheese..."
///Whether this shelf has spawned a cheese granter
var/static/cheese_granter_spawned = FALSE
/obj/structure/bookcase/random/reference/wizard/after_random_load()
if(cheese_granter_spawned)
return
cheese_granter_spawned = TRUE
new /obj/item/book/granter/action/spell/summon_cheese(src)
new /obj/item/book/manual/ancient_parchment(src)