Make hero polyed into hezrou also stink

This commit is contained in:
Pasi Kallinen
2024-04-04 11:20:45 +03:00
parent 1487d05c92
commit e2d3368b0e
3 changed files with 26 additions and 6 deletions

View File

@@ -1827,6 +1827,7 @@ extern void mon_track_add(struct monst *, coordxy, coordxy) NONNULLARG1;
extern void mon_track_clear(struct monst *) NONNULLARG1;
extern boolean monhaskey(struct monst *, boolean) NONNULLARG1;
extern void mon_regen(struct monst *, boolean) NONNULLARG1;
extern void m_postmove_effect(struct monst *) NONNULLARG1;
extern int dochugw(struct monst *, boolean) NONNULLARG1;
extern boolean onscary(coordxy, coordxy, struct monst *) NONNULLARG3;
extern struct monst *find_pmmonst(int);

View File

@@ -2692,6 +2692,9 @@ domove_core(void)
/* tentatively move the hero plus steed; leave CLIPPING til later */
u.ux += u.dx;
u.uy += u.dy;
m_postmove_effect(&gy.youmonst);
if (u.usteed) {
u.usteed->mx = u.ux;
u.usteed->my = u.uy;

View File

@@ -593,6 +593,26 @@ mind_blast(struct monst *mtmp)
}
}
/* do whatever effects monster has after moving.
called for both monsters and polyed hero.
for hero, called after location changes,
to prevent spam messages for hero getting enveloped in a cloud.
for monsters, called before location changes,
because monsters don't have "previous location" field */
void
m_postmove_effect(struct monst *mtmp)
{
boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE;
coordxy x = is_u ? u.ux0 : mtmp->mx,
y = is_u ? u.uy0 : mtmp->my;
/* Hezrous create clouds of stench. This does not cost a move. */
if (mtmp->data == &mons[PM_HEZROU]) /* stench */
create_gas_cloud(x, y, 1, 8);
else if (mtmp->data == &mons[PM_STEAM_VORTEX] && !mtmp->mcan)
create_gas_cloud(x, y, 1, 0); /* harmless vapor */
}
/* returns 1 if monster died moving, 0 otherwise */
/* The whole dochugw/m_move/distfleeck/mfndpos section is serious spaghetti
* code. --KAA
@@ -780,12 +800,6 @@ dochug(struct monst *mtmp)
* PHASE THREE: Now the actual movement phase
*/
/* Hezrous create clouds of stench. This does not cost a move. */
if (mtmp->data == &mons[PM_HEZROU]) /* stench */
create_gas_cloud(mtmp->mx, mtmp->my, 1, 8);
else if (mtmp->data == &mons[PM_STEAM_VORTEX] && !mtmp->mcan)
create_gas_cloud(mtmp->mx, mtmp->my, 1, 0); /* harmless vapor */
/* A killer bee may eat honey in order to turn into a queen bee,
costing it a move. */
if (mdat == &mons[PM_KILLER_BEE]
@@ -1887,6 +1901,8 @@ m_move(struct monst *mtmp, int after)
return MMOVE_DONE;
}
m_postmove_effect(mtmp);
/* move a normal monster; for a long worm, remove_monster() and
place_monster() only manipulate the head; they leave tail as-is */
remove_monster(omx, omy);