summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc10
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/mon-data.h31
-rw-r--r--crawl-ref/source/mon-util.cc36
-rw-r--r--crawl-ref/source/mon-util.h3
-rw-r--r--crawl-ref/source/monstuff.cc16
6 files changed, 39 insertions, 59 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 8ad73623d2..a876a3fd02 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1248,10 +1248,10 @@ static void zappy( zap_type z_type, int power, bolt &pbolt )
*/
-// Affect monster in wall unless it can shield itself using the wall
-// (M_WALL_SHIELDED). The wall will always shield the monster if the
-// beam bounces off the wall, and a monster can't use a metal wall to
-// shield itself from electricity.
+// Affect monster in wall unless it can shield itself using the wall.
+// The wall will always shield the monster if the beam bounces off the
+// wall, and a monster can't use a metal wall to shield itself from
+// electricity.
static bool affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty)
{
UNUSED(item);
@@ -1267,7 +1267,7 @@ static bool affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty)
|| !pbolt.flavour != BEAM_ELECTRICITY)))
{
monsters *mon = &menv[mid];
- if (!mons_class_flag(mon->type, M_WALL_SHIELDED))
+ if (!mons_is_wall_shielded(mon->type))
return true;
}
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 1019d862a0..0cfde5f4db 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -504,7 +504,7 @@ bool melee_attack::attack()
// Defending monster protects itself from attacks using the
// wall it's in.
if (defender->atype() == ACT_MONSTER && grid_is_solid(def->pos())
- && mons_class_flag(def->type, M_WALL_SHIELDED))
+ && mons_is_wall_shielded(def->type))
{
std::string feat_name = raw_feature_description(grd(def->pos()));
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index fabea05a67..d3a7611d12 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -389,7 +389,7 @@
{
MONS_FIRE_VORTEX, 'v', RED, "fire vortex",
- M_LEVITATE | M_CONFUSED,
+ M_LEVITATE | M_CONFUSED | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_FIRE | MR_VUL_COLD | MR_RES_ELEC,
0, 5, MONS_FIRE_VORTEX, MONS_FIRE_VORTEX, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_FIRE, 30}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -514,7 +514,7 @@
{
MONS_GIANT_SPORE, 'G', GREEN, "giant spore",
- M_LEVITATE,
+ M_LEVITATE | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_ASPHYX,
0, 10, MONS_PLANT, MONS_GIANT_SPORE, MH_NATURAL, -3,
{ {AT_HIT, AF_PLAIN, 1}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -862,7 +862,7 @@
{
MONS_SHADOW, ' ', BLACK, "shadow",
- M_SEE_INVIS | M_EVIL,
+ M_SEE_INVIS | M_EVIL | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_COLD,
0, 10, MONS_WRAITH, MONS_SHADOW, MH_UNDEAD, -5,
{ {AT_HIT, AF_DRAIN_STR, 5}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -873,7 +873,7 @@
{
MONS_HUNGRY_GHOST, 'p', GREEN, "hungry ghost",
- M_SENSE_INVIS | M_FLIES | M_EVIL,
+ M_SENSE_INVIS | M_FLIES | M_EVIL | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_COLD,
0, 10, MONS_PHANTOM, MONS_HUNGRY_GHOST, MH_UNDEAD, -4,
{ {AT_HIT, AF_HUNGER, 5}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -1455,7 +1455,7 @@
{
MONS_FIRE_ELEMENTAL, '#', YELLOW, "fire elemental",
M_FLIES,
- MR_RES_POISON | MR_RES_HELLFIRE | MR_VUL_COLD | MR_RES_ELEC,
+ MR_RES_POISON | MR_RES_HELLFIRE | MR_VUL_COLD | MR_RES_ELEC | M_INSUBSTANTIAL,
0, 10, MONS_EARTH_ELEMENTAL, MONS_FIRE_ELEMENTAL, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_FIRE, 5}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
{ 6, 3, 5, 0 },
@@ -1465,7 +1465,7 @@
{
MONS_AIR_ELEMENTAL, 'v', LIGHTGREY, "air elemental",
- M_LEVITATE | M_SEE_INVIS | M_FLIES,
+ M_LEVITATE | M_SEE_INVIS | M_FLIES | M_INSUBSTANTIAL,
MR_RES_ELEC | MR_RES_POISON,
0, 5, MONS_EARTH_ELEMENTAL, MONS_AIR_ELEMENTAL, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_PLAIN, 15}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -1632,7 +1632,7 @@
{
MONS_INSUBSTANTIAL_WISP, 'p', LIGHTGREY, "insubstantial wisp",
- M_LEVITATE | M_SPECIAL_ABILITY,
+ M_LEVITATE | M_SPECIAL_ABILITY | M_INSUBSTANTIAL,
MR_RES_ELEC | MR_RES_POISON | MR_RES_FIRE | MR_RES_COLD,
0, 17, MONS_INSUBSTANTIAL_WISP, MONS_INSUBSTANTIAL_WISP, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_BLINK, 12}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -1643,7 +1643,7 @@
{
MONS_VAPOUR, '#', LIGHTGREY, "vapour",
- M_SPELLCASTER | M_LEVITATE | M_SEE_INVIS | M_INVIS | M_CONFUSED,
+ M_SPELLCASTER | M_LEVITATE | M_SEE_INVIS | M_INVIS | M_CONFUSED | M_INSUBSTANTIAL,
MR_RES_ELEC | MR_RES_POISON,
0, 21, MONS_VAPOUR, MONS_VAPOUR, MH_NONLIVING, MAG_IMMUNE,
{ AT_NO_ATK, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -2211,7 +2211,7 @@
{
MONS_SMOKE_DEMON, '4', LIGHTGREY, "smoke demon",
- M_SPELLCASTER | M_FLIES | M_EVIL,
+ M_SPELLCASTER | M_FLIES | M_EVIL | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_FIRE,
0, 12, MONS_SMOKE_DEMON, MONS_SMOKE_DEMON, MH_DEMONIC, -6,
{ {AT_HIT, AF_PLAIN, 8}, {AT_HIT, AF_PLAIN, 5}, {AT_HIT, AF_PLAIN, 5}, AT_NO_ATK },
@@ -2343,7 +2343,7 @@
{
MONS_SHADOW_WRAITH, 'W', BLUE, "shadow wraith",
- M_LEVITATE | M_SEE_INVIS | M_INVIS | M_EVIL,
+ M_LEVITATE | M_SEE_INVIS | M_INVIS | M_EVIL | M_INSUBSTANTIAL,
MR_RES_POISON,
0, 15, MONS_WRAITH, MONS_SHADOW_WRAITH, MH_UNDEAD, -8,
{ {AT_HIT, AF_DRAIN_XP, 20}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -2387,7 +2387,7 @@
{
MONS_SPATIAL_VORTEX, 'v', BLACK, "spatial vortex",
- M_LEVITATE | M_CONFUSED,
+ M_LEVITATE | M_CONFUSED | M_INSUBSTANTIAL,
MR_RES_POISON | MR_RES_FIRE | MR_RES_COLD | MR_RES_ELEC,
0, 5, MONS_FIRE_VORTEX, MONS_SPATIAL_VORTEX, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_DISTORT, 30}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -3590,7 +3590,7 @@
{
MONS_BALL_LIGHTNING, '*', LIGHTCYAN, "ball lightning",
- M_FLIES | M_CONFUSED | M_SPELLCASTER | M_SPECIAL_ABILITY,
+ M_FLIES | M_CONFUSED | M_SPELLCASTER | M_SPECIAL_ABILITY | M_INSUBSTANTIAL,
MR_RES_ELEC | MR_RES_POISON | MR_RES_COLD,
0, 20, MONS_BALL_LIGHTNING, MONS_BALL_LIGHTNING, MH_NONLIVING, MAG_IMMUNE,
{ {AT_HIT, AF_PLAIN, 5}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -3601,7 +3601,7 @@
{
MONS_ORB_OF_FIRE, '*', RED, "orb of fire",
- M_SPELLCASTER | M_FLIES | M_SEE_INVIS,
+ M_SPELLCASTER | M_FLIES | M_SEE_INVIS | M_INSUBSTANTIAL,
MR_RES_ELEC | MR_RES_FIRE | MR_RES_HELLFIRE | MR_RES_COLD | MR_RES_POISON,
0, 10, MONS_ORB_OF_FIRE, MONS_ORB_OF_FIRE, MH_NONLIVING, MAG_IMMUNE,
{ AT_NO_ATK, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -3791,7 +3791,7 @@
/* player ghost - only one per level. stats are stored in ghost struct */
{
MONS_PLAYER_GHOST, 'p', DARKGREY, "player ghost",
- M_FIGHTER | M_SPEAKS | M_SPELLCASTER | M_ACTUAL_SPELLS | M_FLIES | M_UNIQUE,
+ M_FIGHTER | M_SPEAKS | M_SPELLCASTER | M_ACTUAL_SPELLS | M_FLIES | M_UNIQUE | M_INSUBSTANTIAL,
MR_RES_POISON,
0, 15, MONS_PHANTOM, MONS_PLAYER_GHOST, MH_UNDEAD, -5,
{ {AT_HIT, AF_PLAIN, 5}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
@@ -3931,8 +3931,7 @@
// begin "move through rock" monsters {mpc}
{
MONS_ROCK_WORM, 'w', BROWN, "rock worm",
- //M_NO_FLAGS,
- M_WALL_SHIELDED,
+ M_NO_FLAGS,
MR_RES_POISON | MR_RES_FIRE | MR_RES_COLD | MR_RES_ELEC,
0, 10, MONS_WORM, MONS_ROCK_WORM, MH_NATURAL, -3,
{ {AT_BITE, AF_PLAIN, 20}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 9af1d5eeec..a4e6940df6 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -357,7 +357,7 @@ mon_holy_type mons_holiness(const monsters *mon)
{
if (mons_your_abomination(mon))
return (MH_UNDEAD);
-
+
return (mons_class_holiness(mon->type));
}
@@ -392,36 +392,16 @@ bool mons_class_is_slowable(int mc)
return (smc->resist_magic < MAG_IMMUNE);
}
+bool mons_is_wall_shielded(int mc)
+{
+ return (mons_habitat(mc) == HT_ROCK);
+}
+
// returns whether a monster is non-solid
// and thus can't be affected by some traps
bool mons_is_insubstantial(int mc)
{
- switch (mc)
- {
- // vortices
- case MONS_FIRE_VORTEX:
- case MONS_SPATIAL_VORTEX:
- // elementals
- case MONS_FIRE_ELEMENTAL:
- case MONS_AIR_ELEMENTAL:
- case MONS_WATER_ELEMENTAL:
- // vapours
- case MONS_INSUBSTANTIAL_WISP:
- case MONS_VAPOUR:
- // ghosts and some undead
- case MONS_PLAYER_GHOST:
- case MONS_HUNGRY_GHOST:
- case MONS_SHADOW:
- case MONS_SMOKE_DEMON:
- case MONS_SHADOW_WRAITH:
- // others
- case MONS_BALL_LIGHTNING:
- case MONS_GIANT_SPORE:
- case MONS_ORB_OF_FIRE:
- return true;
- default:
- return false;
- }
+ return mons_class_flag(mc, M_INSUBSTANTIAL);
}
bool mons_behaviour_perceptible(const monsters *mon)
@@ -2436,7 +2416,7 @@ bool monsters::floundering() const
bool mons_class_can_pass(const int mclass, const dungeon_feature_type grid)
{
- if (mons_habitat(mclass) == HT_ROCK)
+ if (mons_is_wall_shielded(mclass))
{
// Permanent walls can't be passed through.
return (!grid_is_solid(grid) ||
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 076eb18c2c..4877271260 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -116,7 +116,7 @@ enum mons_class_flags
M_ARCHER = (1<<23), // gets various archery boosts
- M_WALL_SHIELDED = (1<<24), // Shielded from attacks if in wall
+ M_INSUBSTANTIAL = (1<<24), // is insubstantial
M_TWOWEAPON = (1<<25), // wields two weapons at once
@@ -622,6 +622,7 @@ bool mons_class_is_stationary(int mc);
bool mons_class_is_confusable(int mc);
bool mons_class_is_slowable(int mc);
bool mons_is_stationary(const monsters *mon);
+bool mons_is_wall_shielded(int mc);
bool mons_is_insubstantial(int mc);
bool mons_is_submerged( const monsters *mon );
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 37a4ad84ca..b4b1f789b6 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1774,9 +1774,9 @@ void behaviour_event( monsters *mon, int event, int src,
//
// XXX: Monsters of I_NORMAL or above should select a new target
// if their current target is another monster which is sitting in
-// a wall and is immune to most attacks while in a wall
-// (M_WALL_SHIELDED), unless the monster has a spell or special/nearby
-// ability which isn't affected by M_WALL_SHIELDED.
+// a wall and is immune to most attacks while in a wall, unless
+// the monster has a spell or special/nearby ability which isn't
+// affected by the wall.
//---------------------------------------------------------------
static void handle_behaviour(monsters *mon)
{
@@ -2113,12 +2113,12 @@ static void handle_behaviour(monsters *mon)
// we can jump back to WANDER if the foe
// isn't present.
- // XXX: If a monster can move through solid grids then it
+ // XXX: If a monster can move through solid grids, then it
// should preferentially flee towards the nearest solid grid
- // it can move through. If it has M_WALL_SHIELDED is will
- // be (mostly) safe as soon as it enters the wall, and even
- // if it doesn't once it moves again it will be on the other
- // side of the wall and likely beyond the reach of the player.
+ // it can move through. It will be (mostly) safe as soon as
+ // it enters the wall, and even if it isn't, once it moves
+ // again it will be on the other side of the wall and likely
+ // beyond the reach of the player.
if (isFriendly)
{