Stoning management (trunk only)

Make petrification initiation or termination go through a new routine,
make_stoned(), instead of manipulating its countdown timer and delayed
killer directly.  No change in behavior.

     There's no reason in terms of bug risk or game play or saved data why
this shouldn't be done in the branch too, but so much of the surrounding
context has already diverged between trunk and branch that it's trunk only.
This commit is contained in:
nethack.rankin
2005-06-19 04:38:30 +00:00
parent 254b521add
commit bd1af39997
8 changed files with 47 additions and 35 deletions
+2 -1
View File
@@ -1615,7 +1615,8 @@ E void FDECL(make_confused, (long,BOOLEAN_P));
E void FDECL(make_stunned, (long,BOOLEAN_P)); E void FDECL(make_stunned, (long,BOOLEAN_P));
E void FDECL(make_blinded, (long,BOOLEAN_P)); E void FDECL(make_blinded, (long,BOOLEAN_P));
E void FDECL(make_sick, (long, const char *, BOOLEAN_P,int)); E void FDECL(make_sick, (long, const char *, BOOLEAN_P,int));
E void FDECL(make_slimed, (long,const char*)); E void FDECL(make_slimed, (long,const char *));
E void FDECL(make_stoned, (long,const char *,int,const char *));
E void FDECL(make_vomiting, (long,BOOLEAN_P)); E void FDECL(make_vomiting, (long,BOOLEAN_P));
E boolean FDECL(make_hallucinated, (long,BOOLEAN_P,long)); E boolean FDECL(make_hallucinated, (long,BOOLEAN_P,long));
E int NDECL(dodrink); E int NDECL(dodrink);
+11 -10
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)eat.c 3.5 2005/06/02 */ /* SCCS Id: @(#)eat.c 3.5 2005/06/21 */
/* 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. */
@@ -514,13 +514,14 @@ register int pm;
void void
fix_petrification() fix_petrification()
{ {
Stoned = 0; char buf[BUFSZ];
dealloc_killer(find_delayed_killer(STONED));
if (Hallucination) if (Hallucination)
pline("What a pity - you just ruined a future piece of %sart!", Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
ACURR(A_CHA) > 15 ? "fine " : ""); ACURR(A_CHA) > 15 ? "fine " : "");
else else
You_feel("limber!"); Strcpy(buf, "You feel limber!");
make_stoned(0L, buf, 0, (char *)0);
} }
/* /*
@@ -1836,10 +1837,10 @@ register struct obj *otmp;
!(poly_when_stoned(youmonst.data) && !(poly_when_stoned(youmonst.data) &&
polymon(PM_STONE_GOLEM))) { polymon(PM_STONE_GOLEM))) {
if (!Stoned) { if (!Stoned) {
Stoned = 5;
Sprintf(killer.name, Sprintf(killer.name,
"%s egg", mons[otmp->corpsenm].mname); "%s egg", mons[otmp->corpsenm].mname);
delayed_killer(STONED, KILLED_BY_AN, killer.name); make_stoned(5L, (char *)0,
KILLED_BY_AN, killer.name);
} }
} }
/* note: no "tastes like chicken" message for eggs */ /* note: no "tastes like chicken" message for eggs */
+2 -3
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mhitu.c 3.5 2005/04/15 */ /* SCCS Id: @(#)mhitu.c 3.5 2005/06/21 */
/* 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. */
@@ -1182,13 +1182,12 @@ dopois:
int kformat = KILLED_BY_AN; int kformat = KILLED_BY_AN;
const char *kname = mtmp->data->mname; const char *kname = mtmp->data->mname;
Stoned = 5;
if (mtmp->data->geno & G_UNIQ) { if (mtmp->data->geno & G_UNIQ) {
if (!type_is_pname(mtmp->data)) if (!type_is_pname(mtmp->data))
kname = the(kname); kname = the(kname);
kformat = KILLED_BY; kformat = KILLED_BY;
} }
delayed_killer(STONED, kformat, kname); make_stoned(5L, (char *)0, kformat, kname);
return(1); return(1);
/* You("turn to stone..."); */ /* You("turn to stone..."); */
/* done_in_by(mtmp); */ /* done_in_by(mtmp); */
+2 -3
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mthrowu.c 3.5 2004/08/16 */ /* SCCS Id: @(#)mthrowu.c 3.5 2005/06/21 */
/* 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. */
@@ -404,8 +404,7 @@ struct obj *obj; /* missile (or stack providing it) */
if (!Stoned && !Stone_resistance if (!Stoned && !Stone_resistance
&& !(poly_when_stoned(youmonst.data) && && !(poly_when_stoned(youmonst.data) &&
polymon(PM_STONE_GOLEM))) { polymon(PM_STONE_GOLEM))) {
Stoned = 5; make_stoned(5L, (char *)0, KILLED_BY, nul);
delayed_killer(STONED, KILLED_BY, nul);
} }
} }
stop_occupation(); stop_occupation();
+5 -9
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)polyself.c 3.5 2005/04/13 */ /* SCCS Id: @(#)polyself.c 3.5 2005/06/21 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -193,8 +193,7 @@ newman()
redist_attr(); redist_attr();
u.uhunger = rn1(500,500); u.uhunger = rn1(500,500);
if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL); if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
Stoned = 0; if (Stoned) make_stoned(0L, (char *)0, 0, (char *)0);
dealloc_killer(find_delayed_killer(STONED));
if (u.uhp <= 0 || u.uhpmax <= 0) { if (u.uhp <= 0 || u.uhpmax <= 0) {
if (Polymorph_control) { if (Polymorph_control) {
if (u.uhp <= 0) u.uhp = 1; if (u.uhp <= 0) u.uhp = 1;
@@ -407,10 +406,8 @@ int mntmp;
} }
if (Stoned && poly_when_stoned(&mons[mntmp])) { if (Stoned && poly_when_stoned(&mons[mntmp])) {
/* poly_when_stoned already checked stone golem genocide */ /* poly_when_stoned already checked stone golem genocide */
You("turn to stone!");
mntmp = PM_STONE_GOLEM; mntmp = PM_STONE_GOLEM;
Stoned = 0; make_stoned(0L, "You turn to stone!", 0, (char *)0);
dealloc_killer(find_delayed_killer(STONED));
} }
u.mtimedone = rn1(500, 500); u.mtimedone = rn1(500, 500);
@@ -423,9 +420,8 @@ int mntmp;
if(strongmonst(&mons[mntmp])) ABASE(A_STR) = AMAX(A_STR) = STR18(100); if(strongmonst(&mons[mntmp])) ABASE(A_STR) = AMAX(A_STR) = STR18(100);
if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */ if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */
Stoned = 0; make_stoned(0L, "You no longer seem to be petrifying.",
dealloc_killer(find_delayed_killer(STONED)); 0, (char *)0);
You("no longer seem to be petrifying.");
} }
if (Sick_resistance && Sick) { if (Sick_resistance && Sick) {
make_sick(0L, (char *) 0, FALSE, SICK_ALL); make_sick(0L, (char *) 0, FALSE, SICK_ALL);
+20 -1
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)potion.c 3.5 2005/06/02 */ /* SCCS Id: @(#)potion.c 3.5 2005/06/21 */
/* 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. */
@@ -153,6 +153,25 @@ const char *msg;
if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED)); if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED));
} }
/* start or stop petrification */
void
make_stoned(xtime, msg, killedby, killername)
long xtime;
const char *msg;
int killedby;
const char *killername;
{
long old = Stoned;
if ((!xtime && old) || (xtime && !old)) {
if (msg) pline("%s", msg);
/* context.botl = 1; --- Stoned is not a status line item */
}
set_itimeout(&Stoned, xtime);
if (!Stoned) dealloc_killer(find_delayed_killer(STONED));
else if (!old) delayed_killer(STONED, killedby, killername);
}
void void
make_vomiting(xtime, talk) make_vomiting(xtime, talk)
long xtime; long xtime;
+2 -5
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pray.c 3.5 2004/06/12 */ /* SCCS Id: @(#)pray.c 3.5 2005/06/21 */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -276,10 +276,7 @@ register int trouble;
switch (trouble) { switch (trouble) {
case TROUBLE_STONED: case TROUBLE_STONED:
You_feel("more limber."); make_stoned(0L, "You feel more limber.", 0, (char *)0);
Stoned = 0;
context.botl = 1;
dealloc_killer(find_delayed_killer(STONED));
break; break;
case TROUBLE_SLIMED: case TROUBLE_SLIMED:
make_slimed(0L, "The slime disappears."); make_slimed(0L, "The slime disappears.");
+3 -3
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)uhitm.c 3.5 2004/12/21 */ /* SCCS Id: @(#)uhitm.c 3.5 2005/06/21 */
/* 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. */
@@ -1571,8 +1571,8 @@ register struct attack *mattk;
You("eat %s brain!", s_suffix(mon_nam(mdef))); You("eat %s brain!", s_suffix(mon_nam(mdef)));
u.uconduct.food++; u.uconduct.food++;
if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) { if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) {
Stoned = 5; make_stoned(5L, (char *)0,
delayed_killer(STONED, KILLED_BY_AN, mdef->data->mname); KILLED_BY_AN, mdef->data->mname);
} }
if (!vegan(mdef->data)) if (!vegan(mdef->data))
u.uconduct.unvegan++; u.uconduct.unvegan++;