Make hero polyed into fog cloud emit clouds

Also prevent cloud creation giving a message, if it was a single
cloud on hero and deals no damage.
This commit is contained in:
Pasi Kallinen
2024-04-04 12:17:44 +03:00
parent 7f1bbdfb0e
commit f0fdd3c371
5 changed files with 28 additions and 6 deletions
+1
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 void mon_track_clear(struct monst *) NONNULLARG1;
extern boolean monhaskey(struct monst *, boolean) NONNULLARG1; extern boolean monhaskey(struct monst *, boolean) NONNULLARG1;
extern void mon_regen(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 void m_postmove_effect(struct monst *) NONNULLARG1;
extern int dochugw(struct monst *, boolean) NONNULLARG1; extern int dochugw(struct monst *, boolean) NONNULLARG1;
extern boolean onscary(coordxy, coordxy, struct monst *) NONNULLARG3; extern boolean onscary(coordxy, coordxy, struct monst *) NONNULLARG3;
+2
View File
@@ -439,6 +439,8 @@ moveloop_core(void)
curs_on_u(); curs_on_u();
} }
m_everyturn_effect(&gy.youmonst);
gc.context.move = 1; gc.context.move = 1;
if (gm.multi >= 0 && go.occupation) { if (gm.multi >= 0 && go.occupation) {
+1 -6
View File
@@ -1016,12 +1016,7 @@ movemon_singlemon(struct monst *mtmp)
if (mon_offmap(mtmp)) if (mon_offmap(mtmp))
return FALSE; return FALSE;
if (mtmp->data == &mons[PM_FOG_CLOUD]) { m_everyturn_effect(mtmp);
NhRegion *reg = visible_region_at(mtmp->mx, mtmp->my);
if (!reg)
create_gas_cloud(mtmp->mx, mtmp->my, 1, 0); /* harmless vapor */
}
/* Find a monster that we have not treated yet. */ /* Find a monster that we have not treated yet. */
if (mtmp->movement < NORMAL_SPEED) if (mtmp->movement < NORMAL_SPEED)
+17
View File
@@ -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. /* do whatever effects monster has after moving.
called for both monsters and polyed hero. called for both monsters and polyed hero.
for hero, called after location changes, for hero, called after location changes,
+7
View File
@@ -1143,6 +1143,13 @@ create_gas_cloud(coordxy x, coordxy y, int cloudsize, int damage)
int newidx = 1; /* initial spot is already taken */ int newidx = 1; /* initial spot is already taken */
boolean inside_cloud = is_hero_inside_gas_cloud(); 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) { if (cloudsize > MAX_CLOUD_SIZE) {
impossible("create_gas_cloud: cloud too large (%d)!", cloudsize); impossible("create_gas_cloud: cloud too large (%d)!", cloudsize);
cloudsize = MAX_CLOUD_SIZE; cloudsize = MAX_CLOUD_SIZE;