conflicting delayed killers
Introduce a new set of functions to manage delayed killers in the trunk, used in addressing the various reports of delayed killer confusion. Since existing delayed killers are related to player properties, the delayed killers are keyed by uprop indexes. I did this to avoid adding yet another set of similar identifiers. - the new delayed_killer() is used for stoning, sliming, sickness, and delayed self-genocide while polymorphed. Some other timed events don't use it (and didn't use the old delayed_killer variable) because they use a fixed message when the timeout occurs. - A new data structure, struct kinfo, is used to track both delayed and immediate killers. This encapsulates all the info involved with identifying a killer. The structure contains a buffer, which subsumes the old killer_buf and several other buffers that didn't/couldn't use killer_buf. - the killer list is saved and restored as part of the game state. - the special case of usick_cause was removed and a delayed killer list entry is now used in its place - common code dealing with (un)sliming is moved to a new make_slimed function - attempted to update all make dependencies for new end.c -> lev.h dependency, sorry if I messed any up
This commit is contained in:
43
src/mhitu.c
43
src/mhitu.c
@@ -1058,8 +1058,8 @@ dopois:
|
||||
pline("Unfortunately your brain is still gone.");
|
||||
else
|
||||
Your("last thought fades away.");
|
||||
killer = "brainlessness";
|
||||
killer_format = KILLED_BY;
|
||||
Strcpy(killer.name, "brainlessness");
|
||||
killer.format = KILLED_BY;
|
||||
done(DIED);
|
||||
lifesaved++;
|
||||
}
|
||||
@@ -1150,18 +1150,16 @@ dopois:
|
||||
if (!Stoned && !Stone_resistance
|
||||
&& !(poly_when_stoned(youmonst.data) &&
|
||||
polymon(PM_STONE_GOLEM))) {
|
||||
Stoned = 5;
|
||||
delayed_killer = mtmp->data->mname;
|
||||
if (mtmp->data->geno & G_UNIQ) {
|
||||
if (!type_is_pname(mtmp->data)) {
|
||||
static char buf[BUFSZ];
|
||||
int kformat = KILLED_BY_AN;
|
||||
const char *kname = mtmp->data->mname;
|
||||
|
||||
/* "the" buffer may be reallocated */
|
||||
Strcpy(buf, the(delayed_killer));
|
||||
delayed_killer = buf;
|
||||
}
|
||||
killer_format = KILLED_BY;
|
||||
} else killer_format = KILLED_BY_AN;
|
||||
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);
|
||||
return(1);
|
||||
/* You("turn to stone..."); */
|
||||
/* done_in_by(mtmp); */
|
||||
@@ -1195,11 +1193,10 @@ dopois:
|
||||
!Is_waterlevel(&u.uz);
|
||||
|
||||
pline("%s drowns you...", Monnam(mtmp));
|
||||
killer_format = KILLED_BY_AN;
|
||||
Sprintf(buf, "%s by %s",
|
||||
killer.format = KILLED_BY_AN;
|
||||
Sprintf(killer.name, "%s by %s",
|
||||
moat ? "moat" : "pool of water",
|
||||
an(mtmp->data->mname));
|
||||
killer = buf;
|
||||
done(DROWNING);
|
||||
} else if(mattk->aatyp == AT_HUGS)
|
||||
You("are being crushed.");
|
||||
@@ -1450,8 +1447,8 @@ dopois:
|
||||
switch (rn2(20)) {
|
||||
case 19: case 18: case 17:
|
||||
if (!Antimagic) {
|
||||
killer_format = KILLED_BY_AN;
|
||||
killer = "touch of death";
|
||||
killer.format = KILLED_BY_AN;
|
||||
Strcpy(killer.name, "touch of death");
|
||||
done(DIED);
|
||||
dmg = 0;
|
||||
break;
|
||||
@@ -1491,10 +1488,8 @@ dopois:
|
||||
dmg = 0;
|
||||
} else if (!Slimed) {
|
||||
You("don't feel very well.");
|
||||
Slimed = 10L;
|
||||
context.botl = 1;
|
||||
killer_format = KILLED_BY_AN;
|
||||
delayed_killer = mtmp->data->mname;
|
||||
make_slimed(10L, (char*) 0);
|
||||
delayed_killer(SLIMED, KILLED_BY_AN, mtmp->data->mname);
|
||||
} else
|
||||
pline("Yuck!");
|
||||
break;
|
||||
@@ -1912,8 +1907,8 @@ gazemu(mtmp, mattk) /* monster gazes at you */
|
||||
if(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
|
||||
break;
|
||||
You("turn to stone...");
|
||||
killer_format = KILLED_BY;
|
||||
killer = mtmp->data->mname;
|
||||
killer.format = KILLED_BY;
|
||||
Strcpy(killer.name, mtmp->data->mname);
|
||||
done(STONING);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user