fix #H177 - mimicking gold while hallucinating (trunk only)
From a bug report, having hallucination time out while mimicking an orange (instead of gold, after eating a mimic corpse), you'd still get the hallucinatory end-of-mimicking message about not wanting to be peeled. If hallucination state is toggled, update the pending message and change the hero's appearance. In practice, only the orange-to-gold case can occur. Anything which might trigger gold-to-orange will have terminated the hero's mimickery befort that happens.
This commit is contained in:
@@ -156,6 +156,7 @@ pushing a boulder onto a level teleporter trap could issue repeat messages
|
||||
if shopkeeper or priest gets teleported while inside his shop or temple,
|
||||
give locations inside that room preference when choosing destination
|
||||
tame/peaceful grabber/engulfer will release hero after conflict ends
|
||||
make changes in hallucination be reflected by changes in mimickery feedback
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -567,6 +567,7 @@ E int NDECL(eatfood);
|
||||
E int NDECL(opentin);
|
||||
E int NDECL(unfaint);
|
||||
#endif
|
||||
E void NDECL(eatmupdate);
|
||||
E boolean FDECL(is_edible, (struct obj *));
|
||||
E void NDECL(init_uhunger);
|
||||
E int NDECL(Hear_again);
|
||||
|
||||
40
src/eat.c
40
src/eat.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)eat.c 3.5 2006/06/25 */
|
||||
/* SCCS Id: @(#)eat.c 3.5 2006/08/18 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -163,6 +163,44 @@ eatmdone(VOID_ARGS) /* called after mimicing is over */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* called when hallucination is toggled */
|
||||
void
|
||||
eatmupdate()
|
||||
{
|
||||
const char *altmsg = 0;
|
||||
int altapp = 0; /* lint suppression */
|
||||
|
||||
if (!eatmbuf || nomovemsg != eatmbuf) return;
|
||||
|
||||
if (youmonst.m_ap_type == M_AP_OBJECT &&
|
||||
youmonst.mappearance == ORANGE &&
|
||||
!Hallucination) {
|
||||
/* revert from hallucinatory to "normal" mimicking */
|
||||
altmsg = "You now prefer mimicking yourself.";
|
||||
altapp = GOLD_PIECE;
|
||||
} else if (youmonst.m_ap_type == M_AP_OBJECT &&
|
||||
youmonst.mappearance == GOLD_PIECE &&
|
||||
Hallucination) {
|
||||
/* won't happen; anything which might make immobilized
|
||||
hero begin hallucinating (black light attack, theft
|
||||
of Grayswandir) will terminate the mimickery first */
|
||||
altmsg = "Your rind escaped intact.";
|
||||
altapp = ORANGE;
|
||||
}
|
||||
|
||||
if (altmsg) {
|
||||
/* replace end-of-mimicking message */
|
||||
if (strlen(altmsg) > strlen(eatmbuf)) {
|
||||
free((genericptr_t) eatmbuf);
|
||||
eatmbuf = (char *) alloc(strlen(altmsg) + 1);
|
||||
}
|
||||
nomovemsg = strcpy(eatmbuf, altmsg);
|
||||
/* update current image */
|
||||
youmonst.mappearance = altapp;
|
||||
newsym(u.ux, u.uy);
|
||||
}
|
||||
}
|
||||
|
||||
/* ``[the(] singular(food, xname) [)]'' */
|
||||
STATIC_OVL const char *
|
||||
food_xname(food, the_pfx)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)potion.c 3.5 2006/06/21 */
|
||||
/* SCCS Id: @(#)potion.c 3.5 2006/08/18 */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -315,6 +315,10 @@ long mask; /* nonzero if resistance status should change by mask */
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
/* in case we're mimicking an orange (hallucinatory form
|
||||
of mimicking gold) update the mimicking's-over message */
|
||||
if (!Hallucination) eatmupdate();
|
||||
|
||||
if (u.uswallow) {
|
||||
swallowed(0); /* redraw swallow display */
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user