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-06-09 16:17:48 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-09 16:17:48 +0000
commit7b7a36d0531a016ba81520bec2a4a4177e2ca8ed (patch)
tree2054ca1b5243de711a38a2751edc06f39d92b001 /crawl-ref/source/player.cc
parent5443a68f96b0ba24b0de77573ad36a5633b39cd7 (diff)
downloadcrawl-ref-7b7a36d0531a016ba81520bec2a4a4177e2ca8ed.tar.gz
crawl-ref-7b7a36d0531a016ba81520bec2a4a4177e2ca8ed.zip
Yikes, so many files! And all I did was add more item evaluation
functions for menu colouring and pickup... Added: emergency_item, good_item, dangerous_item, bad_item, and useless_item, all taking into account player species and mutations, so e.g. =see invisible is useless for Naga, and !poison is always bad but only useless if you don't know Evaporate. Never autopickup useless, dangerous (e.g. ?immolation) or inedible items, and simplify the item colour/pickup options accordingly. I'll have to see if pickup.lua is still even needed after this. Removed the menu_colour_prefix_id option as I can't see any reason to turn it off. Oh, and fixed a bug where Kenku were unable to stop levitating if they gained level 15 while levitating. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5658 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc102
1 files changed, 50 insertions, 52 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 96ebb92304..07cdb20059 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -580,51 +580,51 @@ bool is_player_same_species(const int mon, bool transform)
}
}
-// checks whether the player's current species can
-// use (usually wear) a given piece of equipment
+// Checks whether the player's current species can
+// use (usually wear) a given piece of equipment.
// Note that EQ_BODY_ARMOUR and EQ_HELMET only check
-// the ill-fitting variant (i.e. not caps and robes)
+// the ill-fitting variant (i.e. not caps and robes).
// If special_armour is set to true, special cases
// such as bardings, light armour and caps are
// considered. Otherwise these simply return false.
// -------------------------------------------------
bool you_can_wear(int eq, bool special_armour)
{
- // these can be used by all
- if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET
- || eq == EQ_WEAPON || eq == EQ_CLOAK)
- {
- return true;
- }
-
- // anyone can wear caps/hats and robes and at least one of buckler/shield
- if (special_armour
- && (eq == EQ_HELMET || eq == EQ_BODY_ARMOUR || eq == EQ_SHIELD))
- {
- return true;
- }
-
- if (eq == EQ_BOOTS && (you.species == SP_NAGA || you.species == SP_CENTAUR))
- return (special_armour);
-
- // of the remaining items, these races can't wear anything
- if (you.species == SP_TROLL || you.species == SP_SPRIGGAN
- || player_genus(GENPC_OGRE) || player_genus(GENPC_DRACONIAN))
- {
- return false;
- }
+ // These can be used by all.
+ if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET
+ || eq == EQ_WEAPON || eq == EQ_CLOAK)
+ {
+ return (true);
+ }
- if (you.species == SP_KENKU && (eq == EQ_HELMET || eq == EQ_BOOTS))
- return false;
+ // Anyone can wear caps/hats and robes and at least one of buckler/shield.
+ if (special_armour
+ && (eq == EQ_HELMET || eq == EQ_BODY_ARMOUR || eq == EQ_SHIELD))
+ {
+ return (true);
+ }
- if (player_mutation_level(MUT_HORNS) && eq == EQ_HELMET)
- return (special_armour);
+ if (eq == EQ_BOOTS && (you.species == SP_NAGA || you.species == SP_CENTAUR))
+ return (special_armour);
- if (you.species == SP_GHOUL && eq == EQ_GLOVES)
- return false;
+ // Of the remaining items, these races can't wear anything.
+ if (you.species == SP_TROLL || you.species == SP_SPRIGGAN
+ || player_genus(GENPC_OGRE) || player_genus(GENPC_DRACONIAN))
+ {
+ return (false);
+ }
- // else no problems
- return true;
+ if (you.species == SP_KENKU && (eq == EQ_HELMET || eq == EQ_BOOTS))
+ return (false);
+
+ if (player_mutation_level(MUT_HORNS) && eq == EQ_HELMET)
+ return (special_armour);
+
+ if (you.species == SP_GHOUL && eq == EQ_GLOVES)
+ return (false);
+
+ // Else, no problems.
+ return (true);
}
bool player_has_feet()
@@ -826,7 +826,7 @@ int player_equip( equipment_type slot, int sub_type, bool calc_unid )
break;
case EQ_ALL_ARMOUR:
- // doesn't make much sense here... be specific. -- bwr
+ // Doesn't make much sense here... be specific. -- bwr
break;
default:
@@ -1003,7 +1003,7 @@ int player_hunger_rate(void)
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
return 1;
- // jmf: hunger isn't fair while you can't eat
+ // jmf: Hunger isn't fair while you can't eat.
// Actually, it is since you can detransform any time you like -- bwr
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_AIR)
return 0;
@@ -1167,22 +1167,22 @@ int player_res_magic(void)
break;
}
- /* randarts */
+ // randarts
rm += scan_randarts(RAP_MAGIC);
- /* armour */
+ // armour
rm += 30 * player_equip_ego_type( EQ_ALL_ARMOUR, SPARM_MAGIC_RESISTANCE );
- /* rings of magic resistance */
+ // rings of magic resistance
rm += 40 * player_equip( EQ_RINGS, RING_PROTECTION_FROM_MAGIC );
- /* Enchantment skill */
+ // Enchantment skill
rm += 2 * you.skills[SK_ENCHANTMENTS];
- /* Mutations */
+ // Mutations
rm += 30 * player_mutation_level(MUT_MAGIC_RESISTANCE);
- /* transformations */
+ // transformations
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_LICH)
rm += 50;
@@ -1289,14 +1289,14 @@ int player_res_cold(bool calc_unid)
rc++;
}
- /* rings of fire resistance/fire */
+ // rings of fire resistance/fire
rc += player_equip( EQ_RINGS, RING_PROTECTION_FROM_COLD, calc_unid );
rc += player_equip( EQ_RINGS, RING_ICE, calc_unid );
- /* rings of ice */
+ // rings of ice
rc -= player_equip( EQ_RINGS, RING_FIRE, calc_unid );
- /* Staves */
+ // Staves
rc += player_equip( EQ_STAFF, STAFF_COLD, calc_unid );
// body armour:
@@ -2760,8 +2760,8 @@ int burden_change(void)
if (is_flying_light != was_flying_light)
{
- mpr(is_flying_light? "You feel quicker in the air."
- : "You feel heavier in the air.");
+ mpr(is_flying_light ? "You feel quicker in the air."
+ : "You feel heavier in the air.");
}
return you.burden;
@@ -6257,15 +6257,13 @@ bool player::permanent_levitation() const
// all times. This is so that you can evoke stop-levitation
// in order to actually cancel levitation (by setting
// DUR_LEVITATION to 1.) Note that antimagic() won't do this.
- return (airborne()
- && (permanent_flight()
- || player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION )
- && you.duration[DUR_LEVITATION] > 1));
+ return (airborne() && player_equip_ego_type(EQ_BOOTS, SPARM_LEVITATION)
+ && you.duration[DUR_LEVITATION] > 1);
}
bool player::permanent_flight() const
{
- return (airborne()
+ return (airborne() && wearing_amulet( AMU_CONTROLLED_FLIGHT )
&& you.species == SP_KENKU && you.experience_level >= 15);
}