diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-16 08:18:15 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-16 08:18:15 +0000 |
commit | 20161f7b196c4e760f8ef9468a4a621018eafd05 (patch) | |
tree | 4b5550b7d38c2dc2683149cb9f8bc4b9146af1d2 /crawl-ref/source/fight.cc | |
parent | f286cbea0ccc47a5d9c6a113f1d40460f7197a78 (diff) | |
download | crawl-ref-20161f7b196c4e760f8ef9468a4a621018eafd05.tar.gz crawl-ref-20161f7b196c4e760f8ef9468a4a621018eafd05.zip |
M_AMPHIBIOUS now means both "land creature can swim through deep water"
*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
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r-- | crawl-ref/source/fight.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 50b5869f77..a77844f618 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -505,6 +505,50 @@ bool melee_attack::attack() xom_is_stimulated(128); } + // 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); + } + // Allow god to get offended, etc. attacker->attacking(defender); |