health food tins
Groundwork for having health food shops carry tins as part of their
stock. (That part isn't finished yet.) The choice of which types of tin
preparation might be sold as health food is rather arbitrary. Tweak if
needed--but keep in mind that just because something is marketed as health
food doesn't necessary mean that it's actually healthy; vice versa as well.
Tin handling could be simplified if tin->spe for spinach was changed
from 1 to -1. Then checks for spinach could compare against SPINACH_TIN
instead of a magic number, and with non-spinach tin->spe would be a direct
index rather than needing negating and offsetting.
This commit is contained in:
+6
-6
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)hack.h 3.5 2001/04/12 */
|
/* SCCS Id: @(#)hack.h 3.5 2005/03/07 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -267,12 +267,12 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
|
|||||||
#define NOSE 17
|
#define NOSE 17
|
||||||
#define STOMACH 18
|
#define STOMACH 18
|
||||||
|
|
||||||
/* indexes for some special tin types */
|
/* indices for some special tin types */
|
||||||
#define ROTTEN_TIN 4
|
#define ROTTEN_TIN 0
|
||||||
#define HOMEMADE_TIN 5
|
#define HOMEMADE_TIN 1
|
||||||
#define FRENCH_FRIED_TIN 11
|
|
||||||
#define SPINACH_TIN (-1)
|
#define SPINACH_TIN (-1)
|
||||||
#define RANDOM_TIN (-2)
|
#define RANDOM_TIN (-2)
|
||||||
|
#define HEALTHY_TIN (-3)
|
||||||
|
|
||||||
/* Flags to control menus */
|
/* Flags to control menus */
|
||||||
#define MENUTYPELEN sizeof("traditional ")
|
#define MENUTYPELEN sizeof("traditional ")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)eat.c 3.5 2005/01/29 */
|
/* SCCS Id: @(#)eat.c 3.5 2005/03/09 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -116,23 +116,29 @@ init_uhunger()
|
|||||||
u.uhs = NOT_HUNGRY;
|
u.uhs = NOT_HUNGRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct { const char *txt; int nut; } tintxts[] = {
|
/* tin types */
|
||||||
{"deep fried", 60},
|
static const struct {
|
||||||
{"pickled", 40},
|
const char *txt; /* description */
|
||||||
{"soup made from", 20},
|
int nut; /* nutrition */
|
||||||
{"pureed", 500},
|
Bitfield(fodder,1); /* stocked by health food shops */
|
||||||
{"rotten", -50}, /* ROTTEN_TIN = 4 */
|
Bitfield(greasy,1); /* causes slippery fingers */
|
||||||
{"homemade", 50}, /* HOMEMADE_TIN = 5 */
|
} tintxts[] = {
|
||||||
{"stir fried", 80},
|
{"rotten", -50, 0, 0}, /* ROTTEN_TIN = 0 */
|
||||||
{"candied", 100},
|
{"homemade", 50, 1, 0}, /* HOMEMADE_TIN = 1 */
|
||||||
{"boiled", 50},
|
{"soup made from", 20, 1, 0},
|
||||||
{"dried", 55},
|
{"french fried", 40, 0, 1},
|
||||||
{"szechuan", 70},
|
{"pickled", 40, 1, 0},
|
||||||
{"french fried", 40}, /* FRENCH_FRIED_TIN = 11 */
|
{"boiled", 50, 1, 0},
|
||||||
{"sauteed", 95},
|
{"smoked", 50, 1, 0},
|
||||||
{"broiled", 80},
|
{"dried", 55, 1, 0},
|
||||||
{"smoked", 50},
|
{"deep fried", 60, 0, 1},
|
||||||
{"", 0}
|
{"szechuan", 70, 1, 0},
|
||||||
|
{"broiled", 80, 0, 0},
|
||||||
|
{"stir fried", 80, 0, 1},
|
||||||
|
{"sauteed", 95, 0, 0},
|
||||||
|
{"candied", 100, 1, 0},
|
||||||
|
{"pureed", 500, 1, 0},
|
||||||
|
{"", 0, 0, 0}
|
||||||
};
|
};
|
||||||
#define TTSZ SIZE(tintxts)
|
#define TTSZ SIZE(tintxts)
|
||||||
|
|
||||||
@@ -1010,6 +1016,7 @@ char *s;
|
|||||||
int *tinvariety;
|
int *tinvariety;
|
||||||
{
|
{
|
||||||
int k, l;
|
int k, l;
|
||||||
|
|
||||||
if (s && tinvariety) {
|
if (s && tinvariety) {
|
||||||
*tinvariety = -1;
|
*tinvariety = -1;
|
||||||
for (k = 0; k < TTSZ-1; ++k) {
|
for (k = 0; k < TTSZ-1; ++k) {
|
||||||
@@ -1030,9 +1037,19 @@ struct obj *obj;
|
|||||||
int forcetype;
|
int forcetype;
|
||||||
{
|
{
|
||||||
register int r;
|
register int r;
|
||||||
if (forcetype == SPINACH_TIN) {
|
|
||||||
obj->spe = 1;
|
if (forcetype == SPINACH_TIN ||
|
||||||
|
(forcetype == HEALTHY_TIN &&
|
||||||
|
(obj->corpsenm == NON_PM || /* empty or already spinach */
|
||||||
|
!vegetarian(&mons[obj->corpsenm])))) { /* replace meat */
|
||||||
|
obj->corpsenm = NON_PM; /* not based on any monster */
|
||||||
|
obj->spe = 1; /* spinach */
|
||||||
return;
|
return;
|
||||||
|
} else if (forcetype == HEALTHY_TIN) {
|
||||||
|
r = tin_variety(obj);
|
||||||
|
if (r < 0 || r >= TTSZ) r = ROTTEN_TIN; /* shouldn't happen */
|
||||||
|
while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder)
|
||||||
|
r = rn2(TTSZ-1);
|
||||||
} else if (forcetype >= 0 && forcetype < TTSZ-1) {
|
} else if (forcetype >= 0 && forcetype < TTSZ-1) {
|
||||||
r = forcetype;
|
r = forcetype;
|
||||||
} else { /* RANDOM_TIN */
|
} else { /* RANDOM_TIN */
|
||||||
@@ -1050,7 +1067,9 @@ struct obj *obj;
|
|||||||
{
|
{
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
if (obj->spe != 1 && obj->cursed) {
|
if (obj->spe == 1) {
|
||||||
|
r = SPINACH_TIN;
|
||||||
|
} else if (obj->cursed) {
|
||||||
r = ROTTEN_TIN; /* always rotten if cursed */
|
r = ROTTEN_TIN; /* always rotten if cursed */
|
||||||
} else if (obj->spe < 0) {
|
} else if (obj->spe < 0) {
|
||||||
r = -(obj->spe);
|
r = -(obj->spe);
|
||||||
@@ -1150,11 +1169,11 @@ opentin() /* called during each move whilst opening a tin */
|
|||||||
if(tintxts[r].nut < 0) make_vomiting((long)rn1(15,10), FALSE);
|
if(tintxts[r].nut < 0) make_vomiting((long)rn1(15,10), FALSE);
|
||||||
else lesshungry(tintxts[r].nut);
|
else lesshungry(tintxts[r].nut);
|
||||||
|
|
||||||
if(r == 0 || r == FRENCH_FRIED_TIN) {
|
if (tintxts[r].greasy) {
|
||||||
/* Assume !Glib, because you can't open tins when Glib. */
|
/* Assume !Glib, because you can't open tins when Glib. */
|
||||||
incr_itimeout(&Glib, rnd(15));
|
incr_itimeout(&Glib, rnd(15));
|
||||||
pline("Eating deep fried food made your %s very slippery.",
|
pline("Eating %s food made your %s very slippery.",
|
||||||
makeplural(body_part(FINGER)));
|
tintxts[r].txt, makeplural(body_part(FINGER)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (context.tin.tin->cursed)
|
if (context.tin.tin->cursed)
|
||||||
|
|||||||
Reference in New Issue
Block a user