MCPcopy Create free account
hub / github.com/NetHack/NetHack / flip_through_book

Function flip_through_book

src/apply.c:4472–4524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4470}
4471
4472staticfn int
4473flip_through_book(struct obj *obj)
4474{
4475 if (Underwater) {
4476 You("don't want to get the pages even more soggy, do you?");
4477 return ECMD_OK;
4478 }
4479
4480 You("flip through the pages of %s.", thesimpleoname(obj));
4481
4482 if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
4483 if (!Deaf) {
4484 if (!Hallucination) {
4485 Soundeffect(se_rustling_paper, 50);
4486 }
4487 You_hear("the pages make an unpleasant %s sound.",
4488 Hallucination ? "chuckling"
4489 : "rustling");
4490 } else if (!Blind) {
4491 You_see("the pages glow faintly %s.", hcolor(NH_RED));
4492 } else {
4493 You_feel("the pages tremble.");
4494 }
4495 } else if (Blind) {
4496 pline("The pages feel %s.",
4497 Hallucination ? "freshly picked"
4498 : "rough and dry");
4499 } else if (obj->otyp == SPE_BLANK_PAPER) {
4500 pline("This spellbook %s.",
4501 Hallucination ? "doesn't have much of a plot"
4502 : "has nothing written in it");
4503 makeknown(obj->otyp);
4504 } else if (Hallucination) {
4505 You("enjoy the animated initials.");
4506 } else if (obj->otyp == SPE_NOVEL) {
4507 pline("This looks like it might be interesting to read.");
4508 } else {
4509 static const char *const fadeness[] = {
4510 "fresh",
4511 "slightly faded",
4512 "very faded",
4513 "extremely faded",
4514 "barely visible"
4515 };
4516 int findx = min(obj->spestudied, MAX_SPELL_STUDY);
4517
4518 pline("The%s ink in this spellbook is %s.",
4519 objects[obj->otyp].oc_magic ? " magical" : "",
4520 fadeness[findx]);
4521 }
4522
4523 return ECMD_TIME;
4524}
4525
4526staticfn int
4527flip_coin(struct obj *obj)

Callers 1

doapplyFunction · 0.85

Calls 7

YouFunction · 0.85
thesimpleonameFunction · 0.85
You_hearFunction · 0.85
You_seeFunction · 0.85
hcolorFunction · 0.85
You_feelFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected