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:
nethack.rankin
2006-08-19 05:29:16 +00:00
parent e6bf8af74e
commit d8076947dd
4 changed files with 46 additions and 2 deletions
+1
View File
@@ -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, if shopkeeper or priest gets teleported while inside his shop or temple,
give locations inside that room preference when choosing destination give locations inside that room preference when choosing destination
tame/peaceful grabber/engulfer will release hero after conflict ends 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 Platform- and/or Interface-Specific Fixes
+1
View File
@@ -567,6 +567,7 @@ E int NDECL(eatfood);
E int NDECL(opentin); E int NDECL(opentin);
E int NDECL(unfaint); E int NDECL(unfaint);
#endif #endif
E void NDECL(eatmupdate);
E boolean FDECL(is_edible, (struct obj *)); E boolean FDECL(is_edible, (struct obj *));
E void NDECL(init_uhunger); E void NDECL(init_uhunger);
E int NDECL(Hear_again); E int NDECL(Hear_again);
+39 -1
View File
@@ -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. */ /* 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. */
@@ -163,6 +163,44 @@ eatmdone(VOID_ARGS) /* called after mimicing is over */
return 0; 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) [)]'' */ /* ``[the(] singular(food, xname) [)]'' */
STATIC_OVL const char * STATIC_OVL const char *
food_xname(food, the_pfx) food_xname(food, the_pfx)
+5 -1
View File
@@ -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. */ /* 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. */
@@ -315,6 +315,10 @@ long mask; /* nonzero if resistance status should change by mask */
} }
if (changed) { 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) { if (u.uswallow) {
swallowed(0); /* redraw swallow display */ swallowed(0); /* redraw swallow display */
} else { } else {