Give a message when stinking cloud is created on top of hero

This commit is contained in:
Pasi Kallinen
2022-04-03 20:43:04 +03:00
parent 92c21b588b
commit 16d813b44a
2 changed files with 18 additions and 0 deletions

View File

@@ -863,6 +863,7 @@ be more flexible when wishing checks for artifact name matches; now allows
"firebrand" or "fire-brand" to yield "Fire Brand"
exclude unique monsters from pacification when untrapped from web
ask to kick a door open, if it's locked and you don't have unlocking tool
give a message when stinking cloud is created on top of hero
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -38,6 +38,7 @@ NhRegion *create_force_field(xchar,xchar,int,long);
#endif
static void reset_region_mids(NhRegion *);
static boolean is_hero_inside_gas_cloud(void);
static const callback_proc callbacks[] = {
#define INSIDE_GAS_CLOUD 0
@@ -1062,6 +1063,17 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2)
return FALSE; /* Monster is still alive */
}
static boolean
is_hero_inside_gas_cloud(void)
{
int i;
for (i = 0; i < g.n_regions; i++)
if (hero_inside(g.regions[i]) && g.regions[i]->inside_f == INSIDE_GAS_CLOUD)
return TRUE;
return FALSE;
}
/* Create a gas cloud which starts at (x,y) and grows outward from it via
* breadth-first search.
* cloudsize is the number of squares the cloud will attempt to fill.
@@ -1081,6 +1093,7 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
ycoords[0] = y;
int curridx;
int newidx = 1; /* initial spot is already taken */
boolean inside_cloud = is_hero_inside_gas_cloud();
if (cloudsize > MAX_CLOUD_SIZE) {
impossible("create_gas_cloud: cloud too large (%d)!", cloudsize);
@@ -1160,6 +1173,10 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
cloud->visible = TRUE;
cloud->glyph = cmap_to_glyph(damage ? S_poisoncloud : S_cloud);
add_region(cloud);
if (!g.in_mklev && !inside_cloud && is_hero_inside_gas_cloud())
You("are enveloped in a cloud of noxious gas!");
return cloud;
}