summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-22 02:36:43 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-22 02:36:43 +0000
commitbea44e6c4331e7ff932eab4c7d96f61c1d2d3fe6 (patch)
treeb39f4ce257b27d5a2be007cbc71bbc2dfecf7143 /crawl-ref
parent9aea04f45a0902a19877de1f383264def728c862 (diff)
downloadcrawl-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')
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/itemprop.cc2
-rw-r--r--crawl-ref/source/player.cc33
-rw-r--r--crawl-ref/source/transfor.cc2
6 files changed, 24 insertions, 21 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index cfbe5395e2..bb45b4ad98 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -862,7 +862,7 @@ static int find_acquirement_subtype(object_class_type class_wanted,
// mutation specific problems (horns allow caps)
if (type_wanted == ARM_BOOTS && !player_has_feet()
- || you.mutation[MUT_CLAWS] >= 3 && type_wanted == ARM_GLOVES)
+ || you.has_claws(false) >= 3 && type_wanted == ARM_GLOVES)
{
type_wanted = OBJ_RANDOM;
}
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 7e460918ea..1cd0c7dc0c 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -766,8 +766,8 @@ public:
int total_weight() const;
int damage_type(int attk = -1);
int damage_brand(int attk = -1);
- int has_claws() const;
- bool has_usable_claws() const;
+ int has_claws(bool allow_tran = true) const;
+ bool has_usable_claws(bool allow_tran = true) const;
item_def *weapon(int which_attack = -1);
item_def *shield();
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 9f310d87a4..ee503f170e 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -777,7 +777,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary)
if (sub_type == ARM_GLOVES)
{
- if (you.has_claws() >= 3)
+ if (you.has_claws(false) >= 3)
{
if (verbose)
mpr( "You can't wear gloves with your huge claws!" );
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 8786bae35d..d17b970966 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1179,7 +1179,7 @@ bool check_armour_shape( const item_def &item, bool quiet )
break;
case EQ_GLOVES:
- if (you.mutation[MUT_CLAWS] >= 3)
+ if (you.has_claws(false) >= 3)
{
if (!quiet)
mpr( "You can't wear gloves with your huge claws!" );
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
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index 8bcf271a64..3dc1d8e6a9 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -623,7 +623,7 @@ bool can_equip( equipment_type use_which, bool ignore_temporary )
if (use_which == EQ_BOOTS && !player_has_feet())
return (false);
- if (use_which == EQ_GLOVES && you.mutation[MUT_CLAWS] >= 3)
+ if (use_which == EQ_GLOVES && you.has_claws(false) >= 3)
return (false);
if (!ignore_temporary)