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 | |
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')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 10 |
2 files changed, 9 insertions, 13 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, diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a362419d2a..13161c94c7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -1093,13 +1093,11 @@ bool player_can_hit_monster(const monsters *mon) if (!mons_is_submerged(mon)) return (true); - if (grd(mon->pos()) == DNGN_SHALLOW_WATER) - { - const item_def *weapon = you.weapon(); - return (weapon && weapon_skill(*weapon) == SK_POLEARMS); - } + if (grd(mon->pos()) != DNGN_SHALLOW_WATER) + return (false); - return (false); + const item_def *weapon = you.weapon(); + return (weapon && weapon_skill(*weapon) == SK_POLEARMS); } int player_teleport(bool calc_unid) |