diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-09-28 21:46:04 -0500 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-09-28 21:46:04 -0500 |
commit | 6a8cc750190313fc4bdca7c1f257708f3298d20f (patch) | |
tree | bf807c87b73a34a01cb664aa4298b9a7197e55ac /crawl-ref/source/monstuff.cc | |
parent | b64541c7ef4b9756015c499e6760afe3664de111 (diff) | |
download | crawl-ref-6a8cc750190313fc4bdca7c1f257708f3298d20f.tar.gz crawl-ref-6a8cc750190313fc4bdca7c1f257708f3298d20f.zip |
Simplify checks for whether players/monsters can hit monsters, and make
sure that the latter can properly hit monsters submerged in shallow
water if they have tentacles.
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index f528547519..af62b59e37 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2794,16 +2794,14 @@ bool swap_check(monsters *monster, coord_def &loc, bool quiet) // monster has tentacles). bool monster_can_hit_monster(monsters *monster, const monsters *targ) { - if (!mons_is_submerged(targ)) + if (!mons_is_submerged(targ) || monster->has_damage_type(DVORP_TENTACLE)) return (true); - if (grd(targ->pos()) == DNGN_SHALLOW_WATER) - { - item_def *weapon = monster->weapon(); - return (weapon && weapon_skill(*weapon) == SK_POLEARMS); - } + if (grd(targ->pos()) != DNGN_SHALLOW_WATER) + return (false); - return (monster->has_damage_type(DVORP_TENTACLE)); + const item_def *weapon = monster->weapon(); + return (weapon && weapon_skill(*weapon) == SK_POLEARMS); } void mons_get_damage_level(const monsters* monster, std::string& desc, |