diff --git a/include/extern.h b/include/extern.h index 1b31ea989..d2d020ffe 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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_everyturn_effect(struct monst *) NONNULLARG1; extern void m_postmove_effect(struct monst *) NONNULLARG1; extern int dochugw(struct monst *, boolean) NONNULLARG1; extern boolean onscary(coordxy, coordxy, struct monst *) NONNULLARG3; diff --git a/src/allmain.c b/src/allmain.c index dc3170c02..c2ee0c115 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -439,6 +439,8 @@ moveloop_core(void) curs_on_u(); } + m_everyturn_effect(&gy.youmonst); + gc.context.move = 1; if (gm.multi >= 0 && go.occupation) { diff --git a/src/mon.c b/src/mon.c index d02b1bc4f..50175fe39 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1016,12 +1016,7 @@ movemon_singlemon(struct monst *mtmp) if (mon_offmap(mtmp)) return FALSE; - if (mtmp->data == &mons[PM_FOG_CLOUD]) { - NhRegion *reg = visible_region_at(mtmp->mx, mtmp->my); - - if (!reg) - create_gas_cloud(mtmp->mx, mtmp->my, 1, 0); /* harmless vapor */ - } + m_everyturn_effect(mtmp); /* Find a monster that we have not treated yet. */ if (mtmp->movement < NORMAL_SPEED) diff --git a/src/monmove.c b/src/monmove.c index dfd39f2f7..9eae66ffe 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -593,6 +593,23 @@ mind_blast(struct monst *mtmp) } } +/* called every turn for each living monster on the map, + and the hero */ +void +m_everyturn_effect(struct monst *mtmp) +{ + boolean is_u = (mtmp == &gy.youmonst) ? TRUE : FALSE; + coordxy x = is_u ? u.ux : mtmp->mx, + y = is_u ? u.uy : mtmp->my; + + if (mtmp->data == &mons[PM_FOG_CLOUD]) { + NhRegion *reg = visible_region_at(x, y); + + if (!reg) + create_gas_cloud(x, y, 1, 0); /* harmless vapor */ + } +} + /* do whatever effects monster has after moving. called for both monsters and polyed hero. for hero, called after location changes, diff --git a/src/region.c b/src/region.c index a76fd6698..b27efc113 100644 --- a/src/region.c +++ b/src/region.c @@ -1143,6 +1143,13 @@ create_gas_cloud(coordxy x, coordxy y, int cloudsize, int damage) int newidx = 1; /* initial spot is already taken */ boolean inside_cloud = is_hero_inside_gas_cloud(); + /* a single-point cloud on hero and it deals no damage. + probably a natural cause of being polyed. don't message about it */ + if (!gc.context.mon_moving && u_at(x, y) && cloudsize == 1 + && (!damage + || (damage && m_poisongas_ok(&gy.youmonst) == M_POISONGAS_OK))) + inside_cloud = TRUE; + if (cloudsize > MAX_CLOUD_SIZE) { impossible("create_gas_cloud: cloud too large (%d)!", cloudsize); cloudsize = MAX_CLOUD_SIZE;