summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-26 22:21:16 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-26 22:21:16 +0000
commit6ceab003bb46f769b5f4d1c0d7429f5032f3c017 (patch)
tree26175ebc265af365f2ea144f5740899e7332013d /crawl-ref/source/player.cc
parent3cfe89ce027c008e6fe651b79171afa5da78cd85 (diff)
downloadcrawl-ref-6ceab003bb46f769b5f4d1c0d7429f5032f3c017.tar.gz
crawl-ref-6ceab003bb46f769b5f4d1c0d7429f5032f3c017.zip
Fix 2448686: some jewellery properties not working properly while transformed.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7983 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 966874fea0..c4b12e45f1 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -681,8 +681,11 @@ bool you_tran_can_wear(int eq, bool check_mutation)
return (false);
// Everyone else can wear jewellery, at least.
- if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET)
+ if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_RINGS
+ || eq == EQ_AMULET)
+ {
return (true);
+ }
// These cannot use anything but jewellery.
if (transform == TRAN_SPIDER || transform == TRAN_DRAGON
@@ -998,9 +1001,11 @@ int player_regen(void)
rr += 100;
// troll leather (except for trolls)
- if (player_equip( EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR ) &&
- you.species != SP_TROLL)
+ if (player_equip( EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR )
+ && you.species != SP_TROLL)
+ {
rr += 30;
+ }
// fast heal mutation
rr += player_mutation_level(MUT_REGENERATION) * 20;
@@ -2028,17 +2033,16 @@ static int _player_armour_racial_bonus(const item_def& item)
int player_AC(void)
{
int AC = 0;
- int i; // loop variable
- for (i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++)
+ for (int eq = EQ_CLOAK; eq <= EQ_BODY_ARMOUR; ++eq)
{
- if (i == EQ_SHIELD)
+ if (eq == EQ_SHIELD)
continue;
- if (!player_wearing_slot(i))
+ if (!player_wearing_slot(eq))
continue;
- const item_def& item = you.inv[you.equip[i]];
+ const item_def& item = you.inv[you.equip[eq]];
const int ac_value = property(item, PARM_AC ) * 100;
int racial_bonus = _player_armour_racial_bonus(item);
@@ -2048,7 +2052,7 @@ int player_AC(void)
// The deformed don't fit into body armour very well.
// (This includes nagas and centaurs.)
- if (i == EQ_BODY_ARMOUR && player_mutation_level(MUT_DEFORMED))
+ if (eq == EQ_BODY_ARMOUR && player_mutation_level(MUT_DEFORMED))
AC -= ac_value / 2;
}
@@ -4444,11 +4448,11 @@ bool items_give_ability(const int slot, randart_prop_type abil)
{
for (int i = EQ_WEAPON; i < NUM_EQUIP; i++)
{
- const int eq = you.equip[i];
-
- if (eq == -1)
+ if (!player_wearing_slot(i))
continue;
+ const int eq = you.equip[i];
+
// skip item to compare with
if (eq == slot)
continue;
@@ -4488,10 +4492,9 @@ bool items_give_ability(const int slot, randart_prop_type abil)
a given property. Slow if any randarts are worn, so avoid where possible. */
int scan_randarts(randart_prop_type which_property, bool calc_unid)
{
- int i = 0;
int retval = 0;
- for (i = EQ_WEAPON; i < NUM_EQUIP; i++)
+ for (int i = EQ_WEAPON; i < NUM_EQUIP; ++i)
{
if (!player_wearing_slot(i))
continue;
@@ -6685,7 +6688,7 @@ bool player::permanent_levitation() const
// in order to actually cancel levitation (by setting
// DUR_LEVITATION to 1.) Note that antimagic() won't do this.
return (airborne() && player_equip_ego_type(EQ_BOOTS, SPARM_LEVITATION)
- && you.duration[DUR_LEVITATION] > 1);
+ && you.duration[DUR_LEVITATION] > 1);
}
bool player::permanent_flight() const