Mild Zombie Apocalypse

When a zombie (or lich) kills a monster in melee without a weapon,
the monster can rise few turns later as a zombie.

The only creatures that can be zombified are ones that actually have
a zombie counterpart monster. A zombie cannot turn a jackal into
a zombie, for instance. But it could turn a shopkeeper into a human
zombie, or a dwarf king into a dwarf zombie.

Zombies will fight with monsters that can be turned into zombies.

Originally this was a SliceHack feature, but this is based on xNetHack
version of it, with some modifications.
This commit is contained in:
Pasi Kallinen
2020-10-21 21:04:03 +03:00
parent 1cc26106bf
commit aeb0ea65e3
13 changed files with 182 additions and 27 deletions

View File

@@ -1293,29 +1293,8 @@ register int after;
* Pets get taken care of above and shouldn't reach this code.
* Conflict gets handled even farther away (movemon()).
*/
if ((info[chi] & ALLOW_M) || (nix == mtmp->mux && niy == mtmp->muy)) {
struct monst *mtmp2;
int mstatus;
mtmp2 = m_at(nix, niy);
g.notonhead = mtmp2 && (nix != mtmp2->mx || niy != mtmp2->my);
/* note: mstatus returns 0 if mtmp2 is nonexistent */
mstatus = mattackm(mtmp, mtmp2);
if (mstatus & MM_AGR_DIED) /* aggressor died */
return 2;
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
&& mtmp2->movement >= NORMAL_SPEED) {
mtmp2->movement -= NORMAL_SPEED;
g.notonhead = 0;
mstatus = mattackm(mtmp2, mtmp); /* return attack */
if (mstatus & MM_DEF_DIED)
return 2;
}
return 3;
}
if ((info[chi] & ALLOW_M) || (nix == mtmp->mux && niy == mtmp->muy))
return m_move_aggress(mtmp, nix, niy);
if ((info[chi] & ALLOW_MDISP)) {
struct monst *mtmp2;
@@ -1607,6 +1586,44 @@ register int after;
return mmoved;
}
/* The part of m_move that deals with a monster attacking another monster (and
* that monster possibly retaliating).
* Extracted into its own function so that it can be called with monsters that
* have special move patterns (shopkeepers, priests, etc) that want to attack
* other monsters but aren't just roaming freely around the level (so allowing
* m_move to run fully for them could select an invalid move).
* x and y are the coordinates mtmp wants to attack.
* Return values are the same as for m_move, but this function only return 2
* (mtmp died) or 3 (mtmp made its move).
*/
int
m_move_aggress(mtmp, x, y)
struct monst * mtmp;
xchar x, y;
{
struct monst *mtmp2;
int mstatus;
mtmp2 = m_at(x, y);
g.notonhead = mtmp2 && (x != mtmp2->mx || y != mtmp2->my);
/* note: mstatus returns 0 if mtmp2 is nonexistent */
mstatus = mattackm(mtmp, mtmp2);
if (mstatus & MM_AGR_DIED) /* aggressor died */
return 2;
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
&& mtmp2->movement >= NORMAL_SPEED) {
mtmp2->movement -= NORMAL_SPEED;
g.notonhead = 0;
mstatus = mattackm(mtmp2, mtmp); /* return attack */
if (mstatus & MM_DEF_DIED)
return 2;
}
return 3;
}
void
dissolve_bars(x, y)
register int x, y;