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

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_blinded, (long,BOOLEAN_P));
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 boolean FDECL(make_hallucinated, (long,BOOLEAN_P,long));
E int NDECL(dodrink);

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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -514,13 +514,14 @@ register int pm;
void
fix_petrification()
{
Stoned = 0;
dealloc_killer(find_delayed_killer(STONED));
if (Hallucination)
pline("What a pity - you just ruined a future piece of %sart!",
ACURR(A_CHA) > 15 ? "fine " : "");
else
You_feel("limber!");
char buf[BUFSZ];
if (Hallucination)
Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
ACURR(A_CHA) > 15 ? "fine " : "");
else
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) &&
polymon(PM_STONE_GOLEM))) {
if (!Stoned) {
Stoned = 5;
Sprintf(killer.name,
"%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 */

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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1182,13 +1182,12 @@ dopois:
int kformat = KILLED_BY_AN;
const char *kname = mtmp->data->mname;
Stoned = 5;
if (mtmp->data->geno & G_UNIQ) {
if (!type_is_pname(mtmp->data))
kname = the(kname);
kformat = KILLED_BY;
}
delayed_killer(STONED, kformat, kname);
make_stoned(5L, (char *)0, kformat, kname);
return(1);
/* You("turn to stone..."); */
/* done_in_by(mtmp); */

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. */
/* 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
&& !(poly_when_stoned(youmonst.data) &&
polymon(PM_STONE_GOLEM))) {
Stoned = 5;
delayed_killer(STONED, KILLED_BY, nul);
make_stoned(5L, (char *)0, KILLED_BY, nul);
}
}
stop_occupation();

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 */
/* NetHack may be freely redistributed. See license for details. */
@@ -193,8 +193,7 @@ newman()
redist_attr();
u.uhunger = rn1(500,500);
if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
Stoned = 0;
dealloc_killer(find_delayed_killer(STONED));
if (Stoned) make_stoned(0L, (char *)0, 0, (char *)0);
if (u.uhp <= 0 || u.uhpmax <= 0) {
if (Polymorph_control) {
if (u.uhp <= 0) u.uhp = 1;
@@ -407,10 +406,8 @@ int mntmp;
}
if (Stoned && poly_when_stoned(&mons[mntmp])) {
/* poly_when_stoned already checked stone golem genocide */
You("turn to stone!");
mntmp = PM_STONE_GOLEM;
Stoned = 0;
dealloc_killer(find_delayed_killer(STONED));
make_stoned(0L, "You turn to stone!", 0, (char *)0);
}
u.mtimedone = rn1(500, 500);
@@ -423,9 +420,8 @@ int mntmp;
if(strongmonst(&mons[mntmp])) ABASE(A_STR) = AMAX(A_STR) = STR18(100);
if (Stone_resistance && Stoned) { /* parnes@eniac.seas.upenn.edu */
Stoned = 0;
dealloc_killer(find_delayed_killer(STONED));
You("no longer seem to be petrifying.");
make_stoned(0L, "You no longer seem to be petrifying.",
0, (char *)0);
}
if (Sick_resistance && Sick) {
make_sick(0L, (char *) 0, FALSE, SICK_ALL);

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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -153,6 +153,25 @@ const char *msg;
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
make_vomiting(xtime, talk)
long xtime;

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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -276,10 +276,7 @@ register int trouble;
switch (trouble) {
case TROUBLE_STONED:
You_feel("more limber.");
Stoned = 0;
context.botl = 1;
dealloc_killer(find_delayed_killer(STONED));
make_stoned(0L, "You feel more limber.", 0, (char *)0);
break;
case TROUBLE_SLIMED:
make_slimed(0L, "The slime disappears.");

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. */
/* 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)));
u.uconduct.food++;
if (touch_petrifies(mdef->data) && !Stone_resistance && !Stoned) {
Stoned = 5;
delayed_killer(STONED, KILLED_BY_AN, mdef->data->mname);
make_stoned(5L, (char *)0,
KILLED_BY_AN, mdef->data->mname);
}
if (!vegan(mdef->data))
u.uconduct.unvegan++;