candelabrum in shop (trunk only)

The code to have Izchak recognize the Candelabrum of Invocation
instead of just being uninterested in an item not stocked in his shop was
being skipped when the character is hallucinating.  Make it work for any
lighting store (slash'em sometimes has another candle shop, run by a
randomly named shopkeeper), and make it recogize Izchak even when
hallucinating.  Also, have him give a message about the need for 7 candles
if the candelabrum doesn't already have them attached.
This commit is contained in:
nethack.rankin
2006-05-12 00:30:32 +00:00
parent 4e2b302368
commit 5333a7a30d
3 changed files with 37 additions and 11 deletions

View File

@@ -1986,6 +1986,7 @@ E boolean FDECL(saleable, (struct monst *,struct obj *));
E int FDECL(get_shop_item, (int));
E const char *FDECL(shkname, (struct monst *));
E boolean FDECL(shkname_is_pname, (struct monst *));
E boolean FDECL(is_izchak, (struct monst *,BOOLEAN_P));
/* ### sit.c ### */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)shk.c 3.5 2006/04/14 */
/* SCCS Id: @(#)shk.c 3.5 2006/05/10 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1979,16 +1979,24 @@ struct monst *shkp;
boolean quietly;
{
/* for unique situations */
if ((strcmp(shkname(shkp), "Izchak") == 0) &&
obj->otyp == CANDELABRUM_OF_INVOCATION) {
if (!quietly) {
if (!u.uevent.invoked)
if (ESHK(shkp)->shoptype == CANDLESHOP &&
obj->otyp == CANDELABRUM_OF_INVOCATION) {
if (!quietly) {
if (is_izchak(shkp, TRUE) && !u.uevent.invoked) {
verbalize("No thanks, I'd hang onto that if I were you.");
if (obj->spe < 7)
verbalize(
"No thanks, I'd hang onto that if I were you.");
else
verbalize("Take that out of here!");
"You'll need %d%s candle%s to go along with it.",
(7 - obj->spe),
(obj->spe > 0) ? " more" : "",
plur(7 - obj->spe));
/* [what if hero is already carrying enough candles?
should Izchak explain how to attach them instead] */
} else {
verbalize("I won't stock that. Take it out of here!");
}
return TRUE;
}
return TRUE;
}
return FALSE;
}
@@ -3802,7 +3810,7 @@ struct monst *shkp;
else if (shkmoney > 4000)
#endif
pline("%s says that business is good.", shkname(shkp));
else if (strcmp(shkname(shkp), "Izchak") == 0)
else if (is_izchak(shkp, FALSE))
pline(Izchak_speaks[rn2(SIZE(Izchak_speaks))],shkname(shkp));
else
pline("%s talks about the problem of shoplifters.",shkname(shkp));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)shknam.c 3.5 2006/01/03 */
/* SCCS Id: @(#)shknam.c 3.5 2006/05/10 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -704,4 +704,21 @@ struct monst *mtmp;
return (*shknm == '-' || *shknm == '+' || *shknm == '=');
}
boolean
is_izchak(shkp, override_hallucination)
struct monst *shkp;
boolean override_hallucination;
{
const char *shknm;
if (Hallucination && !override_hallucination) return FALSE;
if (!shkp->isshk) return FALSE;
/* outside of town, Izchak becomes just an ordinary shopkeeper */
if (!in_town(shkp->mx, shkp->my)) return FALSE;
shknm = ESHK(shkp)->shknam;
/* skip "+" prefix */
if (!letter(*shknm)) ++shknm;
return !strcmp(shknm, "Izchak");
}
/*shknam.c*/