diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-22 02:36:43 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-22 02:36:43 +0000 |
commit | bea44e6c4331e7ff932eab4c7d96f61c1d2d3fe6 (patch) | |
tree | b39f4ce257b27d5a2be007cbc71bbc2dfecf7143 /crawl-ref/source/player.cc | |
parent | 9aea04f45a0902a19877de1f383264def728c862 (diff) | |
download | crawl-ref-bea44e6c4331e7ff932eab4c7d96f61c1d2d3fe6.tar.gz crawl-ref-bea44e6c4331e7ff932eab4c7d96f61c1d2d3fe6.zip |
make player::has_claws() and player::has_usable_claws() take a bool
indicating whether claws from transformations should be taken into
account; this removes the need for more special cases dealing with
trolls' and ghouls' built-in claws
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2891 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 92778360cd..68408d4dcc 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -566,7 +566,7 @@ bool you_tran_can_wear(int eq, bool check_mutation) // not a transformation, but also temporary -> check first if (check_mutation) { - if (you.mutation[MUT_CLAWS] >= 3 && eq == EQ_GLOVES) + if (eq == EQ_GLOVES && you.has_claws(false) >= 3) return false; if (eq == EQ_BOOTS @@ -6115,21 +6115,24 @@ void player::slow_down(int str) ::slow_player( str ); } -int player::has_claws() const +int player::has_claws(bool allow_tran) const { - // these transformations bring claws with them - if (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON - || attribute[ATTR_TRANSFORMATION] == TRAN_SERPENT_OF_HELL) + if (allow_tran) { - return 3; - } + // these transformations bring claws with them + if (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON + || attribute[ATTR_TRANSFORMATION] == TRAN_SERPENT_OF_HELL) + { + return 3; + } - // transformations other than these will override claws - if (attribute[ATTR_TRANSFORMATION] != TRAN_NONE - && attribute[ATTR_TRANSFORMATION] != TRAN_STATUE - && attribute[ATTR_TRANSFORMATION] != TRAN_LICH) - { - return 0; + // transformations other than these will override claws + if (attribute[ATTR_TRANSFORMATION] != TRAN_NONE + && attribute[ATTR_TRANSFORMATION] != TRAN_STATUE + && attribute[ATTR_TRANSFORMATION] != TRAN_LICH) + { + return 0; + } } // these are the only other sources for claws @@ -6139,9 +6142,9 @@ int player::has_claws() const return mutation[MUT_CLAWS]; } -bool player::has_usable_claws() const +bool player::has_usable_claws(bool allow_tran) const { - return (equip[EQ_GLOVES] == -1 && has_claws()); + return (equip[EQ_GLOVES] == -1 && has_claws(allow_tran)); } god_type player::deity() const |