From 40bbbb4b3e78a9d6d87fb6b9ce3426ec1b5e8e5f Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 13 Aug 2007 19:34:42 +0000 Subject: Added message to mutation and overview screen about not being able to wear some kinds of equipment. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1998 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/enum.h | 3 ++- crawl-ref/source/mutation.cc | 19 +++++++++++++++++ crawl-ref/source/output.cc | 13 ++++++++++++ crawl-ref/source/player.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++ crawl-ref/source/player.h | 1 + 5 files changed, 85 insertions(+), 1 deletion(-) diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 062abef63b..238de7b1c3 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1387,7 +1387,8 @@ enum genus_type { GENPC_DRACONIAN, // 0 GENPC_ELVEN, // 1 - GENPC_DWARVEN // 2 + GENPC_DWARVEN, // 2 + GENPC_OGRE }; enum gender_type diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 747d97007e..885b788811 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -923,6 +923,7 @@ formatted_string describe_mutations() break; case SP_NAGA: + result += "You cannot wear boots." EOL; // breathe poison replaces spit poison: if (!you.mutation[MUT_BREATHE_POISON]) result += "You can spit poison." EOL; @@ -939,6 +940,17 @@ formatted_string describe_mutations() have_any = true; break; + case SP_CENTAUR: + result += "You cannot wear boots." EOL; + result += "You are unusually fast." EOL; + have_any = true; + break; + + case SP_SPRIGGAN: + result += "You are unusually fast." EOL; + have_any = true; + break; + case SP_TROLL: if ( you.mutation[MUT_CLAWS] ) result += ""; @@ -952,6 +964,13 @@ formatted_string describe_mutations() case SP_GHOUL: result += "Your body is rotting away." EOL; + if ( you.mutation[MUT_CLAWS] ) + result += ""; + result += troll_claw_descrip[you.mutation[MUT_CLAWS]]; + if ( you.mutation[MUT_CLAWS] ) + result += ""; + result += EOL; + result += "You preferably eat rotten meat." EOL; have_any = true; break; diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 7d474dedd5..60da17500a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1264,6 +1264,19 @@ void print_overview_screen() else snprintf(buf, sizeof buf, "%-7s:", slot); } + else if (!you_can_wear(e_order[i])) + { + if (e_order[i] == EQ_BODY_ARMOUR || e_order[i] == EQ_HELMET) + { + snprintf(buf, sizeof buf, + "%-7s: (ill-fitting)", slot); + } + else + { + snprintf(buf, sizeof buf, + "%-7s: (unavailable)", slot); + } + } else { snprintf(buf, sizeof buf, "%-7s:", slot); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index ebaa18142c..da0ed6aa3f 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -417,6 +417,10 @@ bool player_genus(unsigned char which_genus, unsigned char species) case SP_MOUNTAIN_DWARF: return (which_genus == GENPC_DWARVEN); + + case SP_OGRE: + case SP_OGRE_MAGE: + return (which_genus == GENPC_OGRE); default: break; @@ -425,6 +429,52 @@ bool player_genus(unsigned char which_genus, unsigned char species) return (false); } // end player_genus() +// 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) +// Centaurs and Naga are ignored for now, seeing how +// Boots are changed to Barding in the % screen. +// ------------------------------------------------- +bool you_can_wear(int eq) +{ + // bats cannot use anything + if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT) + 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_SHIELD || eq == EQ_CLOAK) + { + return true; + } + + // these can wear everything + if (player_genus(GENPC_ELVEN)) + return true; + + if (you.is_undead) + return true; + +// if (eq == EQ_BOOTS && (you.species == SP_NAGA || you.species == SP_CENTAUR)) +// 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; + } + + if (you.species == SP_KENKU && (eq == EQ_HELMET || eq == EQ_BOOTS)) + { + return false; + } + + // else no problems + return true; +} + // Returns the item in the given equipment slot, NULL if the slot is empty. // eq must be in [EQ_WEAPON, EQ_AMULET], or bad things will happen. item_def *player_slot_item(equipment_type eq) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 90921e3362..d99e8ba040 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -303,6 +303,7 @@ void redraw_skill(const char your_name[kNameLen], const char class_name[80]); bool player_genus( unsigned char which_genus, unsigned char species = SP_UNKNOWN ); +bool you_can_wear( int eq ); /* *********************************************************************** * called from: ability - effects - fight - it_use3 - ouch - spell - -- cgit v1.2.3-54-g00ecf