Allow reading many more items

You can now also read alchemy smocks, credit cards, cans of grease,
magic markers, gold, the Orb of Fate, and candy bars.
This commit is contained in:
Pasi Kallinen
2015-03-27 21:04:01 +02:00
parent 2e2d020a59
commit 870b124f14
3 changed files with 134 additions and 12 deletions

View File

@@ -303,6 +303,17 @@ struct obj {
|| (otmp)->otyp == WAX_CANDLE\
|| (otmp)->otyp == POT_OIL)
/* things that can be read */
#define is_readable(otmp) ((otmp)->otyp == FORTUNE_COOKIE\
|| (otmp)->otyp == T_SHIRT\
|| (otmp)->otyp == ALCHEMY_SMOCK\
|| (otmp)->otyp == CREDIT_CARD\
|| (otmp)->otyp == CAN_OF_GREASE\
|| (otmp)->otyp == MAGIC_MARKER\
|| (otmp)->oclass == COIN_CLASS\
|| (otmp)->oartifact == ART_ORB_OF_FATE\
|| (otmp)->otyp == CANDY_BAR)
/* special stones */
#define is_graystone(obj) ((obj)->otyp == LUCKSTONE || \
(obj)->otyp == LOADSTONE || \

View File

@@ -915,8 +915,8 @@ register const char *let,*word;
/* "ugly check" for reading fortune cookies, part 2 */
if ((!strcmp(word, "read")
&& (otmp->otyp == FORTUNE_COOKIE || otmp->otyp == T_SHIRT)))
allowall = TRUE;
&& is_readable(otmp)))
allowall = usegold = TRUE;
}
}
bp[foo] = 0;

View File

@@ -53,6 +53,19 @@ struct obj *sobj;
(void) learnscrolltyp(sobj->otyp);
}
char *
erode_obj_text(otmp, buf)
struct obj *otmp;
char *buf;
{
int erosion = greatest_erosion(otmp);
if (erosion)
wipeout_text(buf,
(int)(strlen(buf) * erosion / (2*MAX_ERODE)),
otmp->o_id ^ (unsigned)ubirthday);
return buf;
}
char *
tshirt_text(tshirt, buf)
struct obj *tshirt;
@@ -76,14 +89,28 @@ char *buf;
"Furinkan High School Athletic Dept.", /* Ranma 1/2 */
"Hel-LOOO, Nurse!", /* Animaniacs */
};
int erosion;
Strcpy(buf, shirt_msgs[tshirt->o_id % SIZE(shirt_msgs)]);
erosion = greatest_erosion(tshirt);
if (erosion)
wipeout_text(buf,
(int)(strlen(buf) * erosion / (2*MAX_ERODE)),
tshirt->o_id ^ (unsigned)ubirthday);
return buf;
return erode_obj_text(tshirt, buf);
}
char *
apron_text(apron, buf)
struct obj *apron;
char *buf;
{
static const char *apron_msgs[] = {
"Kiss the cook",
"I'm making SCIENCE!",
"Don't mess with the chef",
"Don't make me poison you",
"Gehennom's Kitchen",
"Rat: The other white meat",
"If you can't stand the heat, get out of Gehennom!",
"If we weren't meant to eat animals, why are they made out of meat?",
"If you don't like the food, I'll stab you",
};
Strcpy(buf, apron_msgs[apron->o_id % SIZE(apron_msgs)]);
return erode_obj_text(apron, buf);
}
int
@@ -105,14 +132,15 @@ doread()
if (!Blind) u.uconduct.literate++;
useup(scroll);
return(1);
} else if (scroll->otyp == T_SHIRT) {
} else if (scroll->otyp == T_SHIRT ||
scroll->otyp == ALCHEMY_SMOCK) {
char buf[BUFSZ];
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
/* can't read shirt worn under suit (under cloak is ok though) */
if (uarm && scroll == uarmu) {
if (scroll->otyp == T_SHIRT && uarm && scroll == uarmu) {
pline("%s shirt is obscured by %s%s.",
scroll->unpaid ? "That" : "Your",
shk_your(buf, uarm), suit_simple_name(uarm));
@@ -121,7 +149,90 @@ doread()
u.uconduct.literate++;
if(flags.verbose)
pline("It reads:");
pline("\"%s\"", tshirt_text(scroll, buf));
pline("\"%s\"", (scroll->otyp == T_SHIRT)
? tshirt_text(scroll, buf)
: apron_text(scroll, buf));
return 1;
} else if (scroll->otyp == CREDIT_CARD) {
static const char *card_msgs[] = {
"Leprechaun Gold Tru$t - Shamrock Card",
"Magic Memory Vault Charge Card",
"Larn National Bank", /* Larn */
"First Bank of Omega", /* Omega */
"Bank of Zork - Frobozz Magic Card", /* Zork */
"Ankh-Morpork Merchant's Guild Barter Card",
"Ankh-Morpork Thieves' Guild Unlimited Transaction Card",
"Ransmannsby Moneylenders Association",
"Bank of Gehennom - 99% Interest Card",
"Yendorian Express - Copper Card",
"Yendorian Express - Silver Card",
"Yendorian Express - Gold Card",
"Yendorian Express - Mithril Card",
"Yendorian Express - Platinum Card", /* must be last */
};
if (Blind) {
You("feel the embossed numbers:");
} else {
if(flags.verbose)
pline("It reads:");
pline("\"%s\"", scroll->oartifact ? card_msgs[SIZE(card_msgs)-1]
: card_msgs[scroll->o_id % (SIZE(card_msgs)-1)]);
}
/* Make a credit card number */
pline("\"%d0%d %d%d1 0%d%d0\"", ((scroll->o_id % 89)+10), (scroll->o_id % 4),
(((scroll->o_id * 499) % 899999) + 100000), (scroll->o_id % 10),
(!(scroll->o_id % 3)), ((scroll->o_id * 7) % 10));
u.uconduct.literate++;
return 1;
} else if (scroll->otyp == CAN_OF_GREASE) {
pline("This %s has no label.", singular(scroll, xname));
return 0;
} else if (scroll->otyp == MAGIC_MARKER) {
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
if (flags.verbose)
pline("It reads:");
pline("\"Magic Marker(TM) Red Ink Marker Pen. Water Soluble.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->oclass == COIN_CLASS) {
if (Blind)
You("feel the embossed words:");
else if (flags.verbose)
You("read:");
pline("\"1 Zorkmid. 857 GUE. In Frobs We Trust.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->oartifact == ART_ORB_OF_FATE) {
if (Blind)
You("feel the engraved signature:");
else pline("It is signed:");
pline("\"Odin.\"");
u.uconduct.literate++;
return 1;
} else if (scroll->otyp == CANDY_BAR) {
static const char *wrapper_msgs[] = {
"Apollo", /* Lost */
"Moon Crunchy", /* South Park */
"Snacky Cake",
"Chocolate Nuggie",
"The Small Bar",
"Crispy Yum Yum",
"Nilla Crunchie",
"Berry Bar",
"Choco Nummer",
"Om-nom", /* Cat Macro */
"Fruity Oaty", /* Serenity */
"Wonka" /* Charlie and the Chocolate Factory */
};
if (Blind) {
You_cant("feel any Braille writing.");
return 0;
}
pline("The wrapper reads: \"%s\"", wrapper_msgs[scroll->o_id % SIZE(wrapper_msgs)]);
u.uconduct.literate++;
return 1;
} else if (scroll->oclass != SCROLL_CLASS
&& scroll->oclass != SPBOOK_CLASS) {