summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-09-28 17:09:09 -0500
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-09-28 17:09:09 -0500
commitf05884f49be60aab15111bd5bd9c27e679b8318b (patch)
tree9944039fa29c24a6d7db2dcba8a3ff2642bffbbf /crawl-ref/source/player.cc
parentbba212516dfeac3f4a3f4429ad0221bd10298d6d (diff)
downloadcrawl-ref-f05884f49be60aab15111bd5bd9c27e679b8318b.tar.gz
crawl-ref-f05884f49be60aab15111bd5bd9c27e679b8318b.zip
Attempt to make monster attacks on submerged monsters consistent with
player attacks on the same (aside from tentacle attacks, which only monsters can currently have and which work on all submerged monsters).
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index b44093e7a4..a362419d2a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -771,13 +771,13 @@ bool you_tran_can_wear(int eq, bool check_mutation)
// eq must be in [EQ_WEAPON, EQ_AMULET], or bad things will happen.
item_def *player_slot_item(equipment_type eq)
{
- return you.slot_item(eq);
+ return (you.slot_item(eq));
}
// Returns the item in the player's weapon slot.
item_def *player_weapon()
{
- return you.weapon();
+ return (you.weapon());
}
bool player_weapon_wielded()
@@ -1093,11 +1093,13 @@ bool player_can_hit_monster(const monsters *mon)
if (!mons_is_submerged(mon))
return (true);
- if (grd(mon->pos()) != DNGN_SHALLOW_WATER)
- return (false);
+ if (grd(mon->pos()) == DNGN_SHALLOW_WATER)
+ {
+ const item_def *weapon = you.weapon();
+ return (weapon && weapon_skill(*weapon) == SK_POLEARMS);
+ }
- const item_def *weapon = you.weapon();
- return (weapon && weapon_skill(*weapon) == SK_POLEARMS);
+ return (false);
}
int player_teleport(bool calc_unid)
@@ -6441,13 +6443,13 @@ item_def *player::slot_item(equipment_type eq)
ASSERT(eq >= EQ_WEAPON && eq <= EQ_AMULET);
const int item = equip[eq];
- return (item == -1? NULL : &inv[item]);
+ return (item == -1 ? NULL : &inv[item]);
}
// Returns the item in the player's weapon slot.
item_def *player::weapon(int /* which_attack */)
{
- return slot_item(EQ_WEAPON);
+ return (slot_item(EQ_WEAPON));
}
bool actor::can_wield(const item_def* item, bool ignore_curse,
@@ -6510,7 +6512,7 @@ item_def *player::shield()
if (!you_tran_can_wear(EQ_SHIELD))
return (NULL);
- return slot_item(EQ_SHIELD);
+ return (slot_item(EQ_SHIELD));
}
std::string player::name(description_level_type type, bool) const