#define SORTLOOT_INVLET 0x02
#define SORTLOOT_LOOT 0x04
+/* flags for xkilled() [note: meaning of first bit used to be reversed,
+ 1 to give message and 0 to suppress] */
+#define XKILL_GIVEMSG 0
+#define XKILL_NOMSG 1
+#define XKILL_NOCORPSE 2
+#define XKILL_NOCONDUCT 4
+
/* Macros for messages referring to hands, eyes, feet, etc... */
#define ARM 0
#define EYE 1
that's the result of his actions; gain experience,
lose pacifism, take alignment and luck hit, make
corpse less likely to remain tame after revival */
- xkilled(mtmp, 0); /* no "you kill it" message */
+ xkilled(mtmp, XKILL_NOMSG);
/* life-saving doesn't ordinarily reset this */
if (mtmp->mhp > 0)
u.uconduct.killer = save_pacifism;
}
STATIC_OVL void
-e_died(etmp, dest, how)
+e_died(etmp, xkill_flags, how)
struct entity *etmp;
-int dest, how;
+int xkill_flags, how;
{
if (is_u(etmp)) {
if (how == DROWNING) {
killer.name[0] = 0;
/* fake "digested to death" damage-type suppresses corpse */
-#define mk_message(dest) ((dest & 1) ? "" : (char *) 0)
-#define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS)
+#define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "")
+#define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS)
/* if monsters are moving, one of them caused the destruction */
if (context.mon_moving)
- monkilled(etmp->emon, mk_message(dest), mk_corpse(dest));
+ monkilled(etmp->emon,
+ mk_message(xkill_flags), mk_corpse(xkill_flags));
else /* you caused it */
- xkilled(etmp->emon, dest);
+ xkilled(etmp->emon, xkill_flags);
etmp->edata = (struct permonst *) 0;
/* dead long worm handling */
if (crm->typ == DRAWBRIDGE_DOWN) {
pline("%s crushed underneath the drawbridge.",
E_phrase(etmp, "are")); /* no jump */
- e_died(etmp, e_inview ? 3 : 2, CRUSHING); /* no corpse */
+ e_died(etmp,
+ XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
+ CRUSHING); /* no corpse */
return; /* Note: Beyond this point, we know we're */
} /* not at an opened drawbridge, since all */
must_jump = TRUE; /* *missable* creatures survive on the */
E_phrase(etmp, "are"));
else if (!Deaf)
You_hear("a crushing sound.");
- e_died(etmp, e_inview ? 3 : 2, CRUSHING);
+ e_died(etmp,
+ XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG
+ : XKILL_NOMSG),
+ CRUSHING);
/* no corpse */
return;
}
if (!e_survives_at(etmp, etmp->ex, etmp->ey)) {
killer.format = KILLED_BY_AN;
Strcpy(killer.name, "closing drawbridge");
- e_died(etmp, 0, CRUSHING); /* no message */
+ e_died(etmp, XKILL_NOMSG, CRUSHING);
return;
}
debugpline1("%s in here", E_phrase(etmp, "survive"));
}
killer.format = NO_KILLER_PREFIX;
Strcpy(killer.name, "fell from a drawbridge");
- e_died(etmp, e_inview ? 3 : 2, /* CRUSHING is arbitrary */
- (is_pool(etmp->ex, etmp->ey))
- ? DROWNING
- : (is_lava(etmp->ex, etmp->ey)) ? BURNING
- : CRUSHING); /*no corpse*/
+ e_died(etmp, /* CRUSHING is arbitrary */
+ XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
+ is_pool(etmp->ex, etmp->ey) ? DROWNING
+ : is_lava(etmp->ex, etmp->ey) ? BURNING
+ : CRUSHING); /*no corpse*/
return;
}
}
E_phrase(etmp2, "are"));
killer.format = KILLED_BY_AN;
Strcpy(killer.name, "exploding drawbridge");
- e_died(etmp2, e_inview ? 3 : 2, CRUSHING); /*no corpse*/
+ e_died(etmp2,
+ XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
+ CRUSHING); /*no corpse*/
} /* nothing which is vulnerable can survive this */
}
set_entity(x, y, etmp1);
}
killer.format = KILLED_BY_AN;
Strcpy(killer.name, "collapsing drawbridge");
- e_died(etmp1, e_inview ? 3 : 2, CRUSHING); /*no corpse*/
+ e_died(etmp1,
+ XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
+ CRUSHING); /*no corpse*/
if (levl[etmp1->ex][etmp1->ey].typ == MOAT)
do_entity(etmp1);
}
}
pline("%s turns to stone!", Monnam(mtmp));
stoned = 1;
- xkilled(mtmp, 0);
+ xkilled(mtmp, XKILL_NOMSG);
if (mtmp->mhp > 0)
return 1;
return 2;
assess_dmg:
if ((mtmp->mhp -= tmp) <= 0) {
pline("%s dies!", Monnam(mtmp));
- xkilled(mtmp, 0);
+ xkilled(mtmp, XKILL_NOMSG);
if (mtmp->mhp > 0)
return 1;
return 2;
killed(mtmp)
struct monst *mtmp;
{
- xkilled(mtmp, 1);
+ xkilled(mtmp, XKILL_GIVEMSG);
}
/* the player has killed the monster mtmp */
void
-xkilled(mtmp, dflags)
+xkilled(mtmp, xkill_flags)
struct monst *mtmp;
-int dflags; /* disposition flags: 1 => give message, 2 => suppress corpse */
+int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
{
int tmp, mndx, x = mtmp->mx, y = mtmp->my;
struct permonst *mdat;
struct obj *otmp;
struct trap *t;
- boolean wasinside = u.uswallow && (u.ustuck == mtmp), burycorpse = FALSE,
- givemsg = (dflags & 1) != 0, nocorpse = (dflags & 2) != 0;
+ boolean wasinside = u.uswallow && (u.ustuck == mtmp),
+ burycorpse = FALSE,
+ nomsg = (xkill_flags & XKILL_NOMSG) != 0,
+ nocorpse = (xkill_flags & XKILL_NOCORPSE) != 0,
+ noconduct = (xkill_flags & XKILL_NOCONDUCT) != 0;
- /* KMH, conduct */
- u.uconduct.killer++;
+ if (!noconduct) /* KMH, conduct */
+ u.uconduct.killer++;
- if (givemsg)
+ if (!nomsg)
You("%s %s!",
nonliving(mtmp->data) ? "destroy" : "kill",
!(wasinside || canspotmon(mtmp)) ? "it"
/* oc_big is also oc_bimanual and oc_bulky */
&& (otmp->owt > 30 || objects[otyp].oc_big)) {
delobj(otmp);
- } else if (!flooreffects(otmp, x, y, givemsg ? "fall" : "")) {
+ } else if (!flooreffects(otmp, x, y, nomsg ? "" : "fall")) {
place_object(otmp, x, y);
stackobj(otmp);
}
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
: CORPSTAT_NONE);
if (burycorpse && cadaver && cansee(x, y) && !mtmp->minvis
- && cadaver->where == OBJ_BURIED && givemsg) {
+ && cadaver->where == OBJ_BURIED && !nomsg) {
pline("%s corpse ends up buried.", s_suffix(Monnam(mtmp)));
}
}
/* don't blame hero for unknown rolling boulder trap */
if (!context.mon_moving
&& (otmp->otyp != BOULDER || range >= 0 || otmp->otrapped))
- xkilled(mtmp, 0);
+ xkilled(mtmp, XKILL_NOMSG);
else
mondied(mtmp);
}
if (mon->mhp <= 0) {
pline("%s dies!", Monnam(mon));
if (by_you)
- xkilled(mon, 0);
+ xkilled(mon, XKILL_NOMSG);
else
mondead(mon);
return;
else {
You("destroy %s!",
mtmp->mtame
- ? x_monnam(
- mtmp, ARTICLE_THE,
- "poor",
- (has_mname(mtmp))
- ? SUPPRESS_SADDLE
- : 0,
- FALSE)
- : mon_nam(mtmp));
+ ? x_monnam(mtmp, ARTICLE_THE,
+ "poor",
+ has_mname(mtmp)
+ ? SUPPRESS_SADDLE
+ : 0,
+ FALSE)
+ : mon_nam(mtmp));
}
- xkilled(mtmp, 0);
+ xkilled(mtmp, XKILL_NOMSG);
}
}
} else if (x == u.ux && y == u.uy) {
god_zaps_you(resp_god)
aligntyp resp_god;
{
- long oldkillcount = u.uconduct.killer;
-
if (u.uswallow) {
pline(
"Suddenly a bolt of lightning comes down at you from the heavens!");
* Other credit/blame applies (luck or alignment adjustments),
* but not direct kill count (pacifist conduct).
*/
- xkilled(u.ustuck, 0);
- u.uconduct.killer = oldkillcount;
+ xkilled(u.ustuck, XKILL_NOMSG | XKILL_NOCONDUCT);
} else
pline("%s seems unaffected.", Monnam(u.ustuck));
} else {
mon_nam(u.ustuck));
if (!resists_disint(u.ustuck)) {
pline("%s disintegrates into a pile of dust!", Monnam(u.ustuck));
- xkilled(u.ustuck, 2); /* no corpse */
- u.uconduct.killer = oldkillcount;
+ xkilled(u.ustuck, XKILL_NOMSG | XKILL_NOCORPSE | XKILL_NOCONDUCT);
} else
pline("%s seems unaffected.", Monnam(u.ustuck));
} else {
}
mtmp->mhp -= mdmg;
if (mtmp->mhp <= 0) {
- if (byu)
- xkilled(mtmp, 1);
- else {
+ if (byu) {
+ killed(mtmp);
+ } else {
pline("%s is killed.", Monnam(mtmp));
mondied(mtmp);
}
pline("%s turns to stone.", Monnam(mon));
if (byplayer) {
stoned = TRUE;
- xkilled(mon, 0);
+ xkilled(mon, XKILL_NOMSG);
} else
monstone(mon);
}
if (poiskilled) {
pline_The("poison was deadly...");
if (!already_killed)
- xkilled(mon, 0);
+ xkilled(mon, XKILL_NOMSG);
destroyed = TRUE; /* return FALSE; */
} else if (destroyed) {
if (!already_killed)
if (pd == &mons[PM_STRAW_GOLEM] || pd == &mons[PM_PAPER_GOLEM]) {
if (!Blind)
pline("%s burns completely!", Monnam(mdef));
- xkilled(mdef, 2);
+ xkilled(mdef, XKILL_NOMSG | XKILL_NOCORPSE);
tmp = 0;
break;
/* Don't return yet; keep hp<1 and tmp=0 for pet msg */
if (!Blind)
pline("Some writing vanishes from %s head!",
s_suffix(mon_nam(mdef)));
- xkilled(mdef, 0);
+ xkilled(mdef, XKILL_NOMSG);
/* Don't return yet; keep hp<1 and tmp=0 for pet msg */
} else {
mdef->mcan = 1;
case AD_DRLI:
if (!negated && !rn2(3) && !resists_drli(mdef)) {
int xtmp = d(2, 6);
+
pline("%s suddenly seems weaker!", Monnam(mdef));
mdef->mhpmax -= xtmp;
if ((mdef->mhp -= xtmp) <= 0 || !mdef->m_lev) {
pline("%s dies!", Monnam(mdef));
- xkilled(mdef, 0);
+ xkilled(mdef, XKILL_NOMSG);
} else
mdef->m_lev--;
tmp = 0;
case AD_RUST:
if (pd == &mons[PM_IRON_GOLEM]) {
pline("%s falls to pieces!", Monnam(mdef));
- xkilled(mdef, 0);
+ xkilled(mdef, XKILL_NOMSG);
}
erode_armor(mdef, ERODE_RUST);
tmp = 0;
case AD_DCAY:
if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) {
pline("%s falls to pieces!", Monnam(mdef));
- xkilled(mdef, 0);
+ xkilled(mdef, XKILL_NOMSG);
}
erode_armor(mdef, ERODE_ROT);
tmp = 0;
if (mdef->mtame && !cansee(mdef->mx, mdef->my)) {
You_feel("embarrassed for a moment.");
if (tmp)
- xkilled(mdef, 0); /* !tmp but hp<1: already killed */
+ xkilled(mdef, XKILL_NOMSG); /* !tmp but hp<1: already killed */
} else if (!flags.verbose) {
You("destroy it!");
if (tmp)
- xkilled(mdef, 0);
+ xkilled(mdef, XKILL_NOMSG);
} else if (tmp)
killed(mdef);
return 2;
m_useup(mdef, otmp);
newuhs(FALSE);
- xkilled(mdef, 2);
+ xkilled(mdef, XKILL_NOMSG | XKILL_NOCORPSE);
if (mdef->mhp > 0) { /* monster lifesaved */
You("hurriedly regurgitate the sizzling in your %s.",
body_part(STOMACH));
}
/* context.bypasses = TRUE; ## for make_corpse() */
/* no corpse after system shock */
- xkilled(mtmp, 3);
+ xkilled(mtmp, XKILL_GIVEMSG | XKILL_NOCORPSE);
} else if (newcham(mtmp, (struct permonst *) 0,
polyspot, give_msg) != 0
/* if shapechange failed because there aren't
dmg *= 2;
if (otyp == SPE_DRAIN_LIFE)
dmg = spell_damage_bonus(dmg);
- if (resists_drli(mtmp))
+ if (resists_drli(mtmp)) {
shieldeff(mtmp->mx, mtmp->my);
- else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) && mtmp->mhp > 0) {
+ } else if (!resist(mtmp, otmp->oclass, dmg, NOTELL) && mtmp->mhp > 0) {
mtmp->mhp -= dmg;
mtmp->mhpmax -= dmg;
- if (mtmp->mhp <= 0 || mtmp->mhpmax <= 0 || mtmp->m_lev < 1)
- xkilled(mtmp, 1);
- else {
+ /* die if already level 0, regardless of hit points */
+ if (mtmp->mhp <= 0 || mtmp->mhpmax <= 0 || mtmp->m_lev < 1) {
+ killed(mtmp);
+ } else {
mtmp->m_lev--;
if (canseemon(mtmp))
pline("%s suddenly seems weaker!", Monnam(mtmp));
if (type < 0)
monkilled(mon, (char *) 0, -AD_RBRE);
else
- xkilled(mon, 2);
+ xkilled(mon, XKILL_NOMSG | XKILL_NOCORPSE);
}
/*