From 59b053efd22ccd197d042ed5731b117e4846599b Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 4 Nov 2008 13:14:08 +0000 Subject: Apply the first part of the labyrinth tweaks: * labyrinths are bordered by (undiggable) metal walls * teleporting inside a labyrinth will always send you away from the centre (as the crow flies: you'll end somewhere in the stone or rock area) Also make sure melded equipment cannot corrode. (I'm still undecided about whether curses should affect melded items.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7383 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 54028f48dd..a75fc6aeb9 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -588,6 +588,14 @@ bool player_has_feet() return (true); } +bool player_wearing_slot(int eq) +{ + if (you.equip[eq] == -1) + return (false); + + return (you_tran_can_wear(you.inv[you.equip[eq]])); +} + bool you_tran_can_wear(const item_def &item) { switch (item.base_type) @@ -1992,7 +2000,7 @@ int player_AC(void) if (i == EQ_SHIELD) continue; - if (you.equip[i] == -1 || !you_tran_can_wear(you.equip[i])) + if (!player_wearing_slot(i)) continue; const item_def& item = you.inv[you.equip[i]]; @@ -4443,11 +4451,11 @@ int scan_randarts(randart_prop_type which_property, bool calc_unid) for (i = EQ_WEAPON; i < NUM_EQUIP; i++) { - const int eq = you.equip[i]; - - if (eq == -1 || !you_tran_can_wear(eq)) + if (!player_wearing_slot(i)) continue; + const int eq = you.equip[i]; + // Only weapons give their effects when in our hands. if (i == EQ_WEAPON && you.inv[ eq ].base_type != OBJ_WEAPONS) continue; -- cgit v1.2.3-54-g00ecf