cancelled zombification

Don't let cancelled zombies or cancelled liches create new zombies.
This commit is contained in:
PatR
2021-03-30 17:33:31 -07:00
parent 18b28b3355
commit 0479625c94
5 changed files with 34 additions and 33 deletions

View File

@@ -276,12 +276,16 @@ m_poisongas_ok(struct monst* mtmp)
return M_POISONGAS_BAD;
}
/* Return TRUE if this monster is capable of converting other monsters into
* zombies. */
/* return True if mon is capable of converting other monsters into zombies */
boolean
zombie_maker(struct permonst* pm)
zombie_maker(struct monst *mon)
{
switch(pm->mlet) {
struct permonst *pm = mon->data;
if (mon->mcan)
return FALSE;
switch (pm->mlet) {
case S_ZOMBIE:
/* Z-class monsters that aren't actually zombies go here */
if (pm == &mons[PM_GHOUL] || pm == &mons[PM_SKELETON])
@@ -294,15 +298,15 @@ zombie_maker(struct permonst* pm)
return FALSE;
}
/* return the monster index of the zombie monster which this monster could be
* turned into, or NON_PM if it doesn't have a direct counterpart. Sort of the
* zombie-specific inverse of undead_to_corpse.
* If a zombie gets passed to this function, it should return NON_PM, not the
* same monster again. */
/* Return monster index of zombie monster which this monster could
be turned into, or NON_PM if it doesn't have a direct counterpart.
Sort of the zombie-specific inverse of undead_to_corpse. */
int
zombie_form(struct permonst* pm)
zombie_form(struct permonst *pm)
{
switch(pm->mlet) {
switch (pm->mlet) {
case S_ZOMBIE: /* when already a zombie/ghoul/skeleton, will stay as is */
return NON_PM;
case S_KOBOLD:
return PM_KOBOLD_ZOMBIE;
case S_ORC:
@@ -1892,18 +1896,15 @@ mfndpos(
return cnt;
}
/* Part of mm_aggression that represents two-way aggression. To avoid having to
* code each case twice, this function contains those cases that ought to
* happen twice, and mm_aggression will call it twice. */
/* Part of mm_aggression that represents two-way aggression. To avoid
having to code each case twice, this function contains those cases that
ought to happen twice, and mm_aggression will call it twice. */
static long
mm_2way_aggression(struct monst* magr, struct monst* mdef)
mm_2way_aggression(struct monst *magr, struct monst *mdef)
{
struct permonst *ma = magr->data;
struct permonst *md = mdef->data;
/* zombies vs things that can be zombified */
if (zombie_maker(ma) && zombie_form(md) != NON_PM)
return ALLOW_M|ALLOW_TM;
if (zombie_maker(magr) && zombie_form(mdef->data) != NON_PM)
return (ALLOW_M | ALLOW_TM);
return 0;
}
@@ -2880,7 +2881,7 @@ xkilled(
/* corpse--none if hero was inside the monster */
if (!wasinside && corpse_chance(mtmp, (struct monst *) 0, FALSE)) {
g.zombify = (!g.thrownobj && !g.stoned && !uwep
&& zombie_maker(g.youmonst.data)
&& zombie_maker(&g.youmonst)
&& zombie_form(mtmp->data) != NON_PM);
cadaver = make_corpse(mtmp, burycorpse ? CORPSTAT_BURIED
: CORPSTAT_NONE);