and "deep water creature can walk on land".
Most of the supporting features neccessary for the "earth worm" FR [1766532] have been implemented, except for "fleeing towards walls". However, no work has yet been done to update the monster AI to work well when a monster is fighting an earth worm.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2858 c06c8d41-db1a-0410-9941-cceddc491573
AS2IQQJNNCEQNXXKTGYHLB7RO3ZKCF4F7GK6FJH66BOOKDDRGNIQC
3V52MSSK7QX7FWLLUW63DTWCBAJEK674EFZLKP45FLZ5KZKVARHAC
SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
LJK4ZQATLSB4MKZG3ARZX5V6RFGTN3NLCN6GTCUGJQKU26SOXMUAC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
GVCGKTH5IJ4VSQEIN4CRC7ZFVZW26JPIYNCPTO7GY66CSZZEW3ZQC
OHJE4HQ2B3HVV4BOPBRFKO6HBRTLZEI74P5PLJF5GLSRD2MFWXHQC
4UXFU3FZOCBSLDQ4S7MJKAE2H7VUHCNRDQMIY6NJ3PHYXWNGISDQC
// XXX: Monsters of I_NORMAL or above should select a new target
// if their current target is another monser 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.
// 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.
}
// 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))
{
std::string feat_name = raw_feature_description(grd(def->pos()));
if (attacker->atype() == ACT_PLAYER)
{
player_apply_attack_delay();
if (you.can_see(def))
{
mprf("The %s protects %s from harm.",
feat_name.c_str(),
def->name(DESC_NOCAP_THE).c_str());
}
else
{
mprf("You hit the %s.",
feat_name.c_str());
}
}
else if (you.can_see(atk))
{
// Make sure the monster uses up some energy, even though
// it didn't actually land a blow.
monsterentry *entry = get_monster_data(atk->type);
atk->speed_increment -= entry->energy_usage.attack;
if (!mons_near(def))
simple_monster_message(atk, " hits something");
else if (!you.can_see(atk))
mprf("%s hits the %s.", def->name(DESC_CAP_THE).c_str(),
feat_name.c_str());
else
mprf("%s tries to hit the %s, but is blocked by the %s.",
atk->name(DESC_CAP_THE).c_str(),
def->name(DESC_NOCAP_THE).c_str(),
feat_name.c_str());
}
return (true);
// 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 electricty.
static bool affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty)
{
UNUSED(item);
int mid = mgrd[tx][ty];
if (mid == NON_MONSTER)
return false;
if (pbolt.is_enchant
|| (!pbolt.is_explosion && !pbolt.is_big_cloud
&& (grd[tx][ty] != DNGN_METAL_WALL
|| !pbolt.flavour != BEAM_ELECTRICITY)))
{
monsters *mons = &menv[mid];
if (!mons_class_flag(mons->type, M_WALL_SHIELDED))
return true;
}
// if it's still a wall, quit - we can't do anything else to
// a wall. Otherwise effects (like clouds, etc) are still possible.
// if it's still a wall, quit - we can't do anything else to a
// wall (but we still might be able to do something to any
// monster inside the wall). Otherwise effects (like clouds,
// etc) are still possible.
{
int mid = mgrd[x][y];
if (mid != NON_MONSTER)
{
monsters *mon = &menv[mid];
if (affect_mon_in_wall(beam, NULL, x, y))
rangeUsed += affect_monster( beam, mon );
else if (you.can_see(mon))
{
mprf("The %s protects %s from harm.",
raw_feature_description(grd(mon->pos())).c_str(),
mon->name(DESC_NOCAP_THE).c_str());
}
}