summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-04 16:42:54 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-08-04 16:42:54 +0000
commit5c7064085c546eeeaecb43267806c0058345f865 (patch)
treeefa312e3ed0dbc58c9c502b4791ee359d1a8dc50 /crawl-ref/source/player.cc
parentce3948ab25120e7caf3d69d14f5eff0c4f11ff11 (diff)
downloadcrawl-ref-5c7064085c546eeeaecb43267806c0058345f865.tar.gz
crawl-ref-5c7064085c546eeeaecb43267806c0058345f865.zip
Fix 2037105: amulet of controlled flight not autoIDing.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6773 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc46
1 files changed, 23 insertions, 23 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index f2d4c89162..b3187aa42a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4212,37 +4212,37 @@ int player_mental_clarity(bool calc_unid, bool items)
return ((ret > 3) ? 3 : ret);
}
-bool wearing_amulet(jewellery_type amulet, bool calc_unid)
+// Returns whether the player has the effect of the amulet
+// from a non-amulet source.
+bool extrinsic_amulet_effect(jewellery_type amulet)
{
- if (amulet == AMU_CONTROLLED_FLIGHT
- && (you.duration[DUR_CONTROLLED_FLIGHT]
- || player_genus(GENPC_DRACONIAN)
- || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
- || you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT))
+ switch ( amulet )
{
- return (true);
+ case AMU_CONTROLLED_FLIGHT:
+ return (you.duration[DUR_CONTROLLED_FLIGHT]
+ || player_genus(GENPC_DRACONIAN)
+ || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
+ || you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT);
+ case AMU_CLARITY:
+ return (player_mutation_level(MUT_CLARITY) > 0);
+ case AMU_RESIST_CORROSION:
+ case AMU_CONSERVATION:
+ return (player_equip_ego_type(EQ_CLOAK, SPARM_PRESERVATION) > 0);
+ default:
+ return false;
}
+}
- if (amulet == AMU_CLARITY && player_mutation_level(MUT_CLARITY))
+bool wearing_amulet(jewellery_type amulet, bool calc_unid)
+{
+ if ( extrinsic_amulet_effect(amulet) )
return (true);
-
- if (amulet == AMU_RESIST_CORROSION || amulet == AMU_CONSERVATION)
- {
- // XXX: this is hackish {dlb}
- if (player_equip_ego_type( EQ_CLOAK, SPARM_PRESERVATION ))
- return (true);
- }
-
+
if (you.equip[EQ_AMULET] == -1)
return (false);
- if (you.inv[you.equip[EQ_AMULET]].sub_type == amulet
- && ( calc_unid || item_type_known(you.inv[you.equip[EQ_AMULET]]) ))
- {
- return (true);
- }
-
- return (false);
+ const item_def& amu(you.inv[you.equip[EQ_AMULET]]);
+ return (amu.sub_type == amulet && (calc_unid || item_type_known(amu)));
}
bool player_is_airborne(void)