diff options
Diffstat (limited to 'crawl-ref/source/it_use2.cc')
-rw-r--r-- | crawl-ref/source/it_use2.cc | 108 |
1 files changed, 48 insertions, 60 deletions
diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index e78f3375e6..0d4b6ca36a 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -27,7 +27,6 @@ #include "beam.h" #include "effects.h" #include "food.h" -#include "item_use.h" #include "itemname.h" #include "itemprop.h" #include "misc.h" @@ -41,13 +40,12 @@ #include "spl-util.h" #include "stuff.h" #include "view.h" -#include "xom.h" // From an actual potion, pow == 40 -- bwr bool potion_effect( potion_type pot_eff, int pow ) { bool effect = true; // current behaviour is all potions id on quaffing - bool was_known = item_type_known(OBJ_POTIONS, (int) pot_eff); + int new_value = 0; if (pow > 150) @@ -111,7 +109,7 @@ bool potion_effect( potion_type pot_eff, int pow ) if ( were_mighty ) contaminate_player(1); else - modify_stat(STAT_STRENGTH, 5, true, ""); + modify_stat(STAT_STRENGTH, 5, true); // conceivable max gain of +184 {dlb} you.duration[DUR_MIGHT] += 35 + random2(pow); @@ -120,7 +118,7 @@ bool potion_effect( potion_type pot_eff, int pow ) if (you.duration[DUR_MIGHT] > 80) you.duration[DUR_MIGHT] = 80; - did_god_conduct( DID_STIMULANTS, 4 + random2(4), was_known ); + did_god_conduct( DID_STIMULANTS, 4 + random2(4) ); break; } @@ -218,8 +216,7 @@ bool potion_effect( potion_type pot_eff, int pow ) case POT_DEGENERATION: if ( pow == 40 ) mpr("There was something very wrong with that liquid!"); - if (lose_stat(STAT_RANDOM, 1 + random2avg(4, 2), false, - "drinking a potion of degeneration")) + if (lose_stat(STAT_RANDOM, 1 + random2avg(4, 2))) xom_is_stimulated(64); break; @@ -308,20 +305,31 @@ bool potion_effect( potion_type pot_eff, int pow ) case POT_BLOOD: if (you.species == SP_VAMPIRE) { - const char* names[] = { "human", "rat", "goblin", - "elf", "goat", "sheep", - "sheep", "gnoll", "yak" }; - - mprf("Yummy - fresh %s blood!", RANDOM_ELEMENT(names)); - lessen_hunger(1000, true); - mpr("You feel better."); - inc_hp(1 + random2(10), false); + int temp_rand = random2(9); + strcpy(info, (temp_rand == 0) ? "human" : + (temp_rand == 1) ? "rat" : + (temp_rand == 2) ? "goblin" : + (temp_rand == 3) ? "elf" : + (temp_rand == 4) ? "goat" : + (temp_rand == 5) ? "sheep" : + (temp_rand == 6) ? "gnoll" : + (temp_rand == 7) ? "sheep" + : "yak"); + + mprf("Yummy - fresh %s blood!", info); + + lessen_hunger(1000, true); + mpr("You feel better."); + inc_hp(1 + random2(10), false); } else { - if (you.omnivorous() || you.mutation[MUT_CARNIVOROUS]) + bool likes_blood = (you.species == SP_OGRE + || you.species == SP_TROLL + || you.mutation[MUT_CARNIVOROUS]); + + if (likes_blood) { - // Likes it mpr("This tastes like blood."); lessen_hunger(200, true); } @@ -335,7 +343,7 @@ bool potion_effect( potion_type pot_eff, int pow ) xom_is_stimulated(32); } } - did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3), was_known); + did_god_conduct(DID_DRINK_BLOOD, 1 + random2(3)); break; case POT_RESISTANCE: @@ -356,15 +364,12 @@ bool potion_effect( potion_type pot_eff, int pow ) return (effect); } // end potion_effect() -bool unwield_item(bool showMsgs) +void unwield_item(bool showMsgs) { const int unw = you.equip[EQ_WEAPON]; if ( unw == -1 ) - return (false); + return; - if (!safe_to_remove_or_wear(you.inv[unw], true)) - return (false); - you.equip[EQ_WEAPON] = -1; you.special_wield = SPWLD_NONE; you.wield_change = true; @@ -407,7 +412,7 @@ bool unwield_item(bool showMsgs) break; } - return (true); + return; } const int brand = get_weapon_brand( item ); @@ -469,7 +474,7 @@ bool unwield_item(bool showMsgs) // int effect = 9 - random2avg( you.skills[SK_TRANSLOCATIONS] * 2, 2 ); miscast_effect( SPTYP_TRANSLOCATION, 9, 90, 100, - "distortion unwield" ); + "a distortion effect" ); break; // when more are added here, *must* duplicate unwielding @@ -487,23 +492,18 @@ bool unwield_item(bool showMsgs) } if (item.base_type == OBJ_STAVES && item.sub_type == STAFF_POWER) - { calc_mp(); - mpr("You fell your mana capacity decrease."); - } - return (true); + return; } // end unwield_item() // This does *not* call ev_mod! void unwear_armour(char unw) { - you.redraw_armour_class = true; - you.redraw_evasion = true; + you.redraw_armour_class = 1; + you.redraw_evasion = 1; - item_def &item(you.inv[unw]); - - switch (get_armour_ego_type( item )) + switch (get_armour_ego_type( you.inv[unw] )) { case SPARM_RUNNING: mpr("You feel rather sluggish."); @@ -533,15 +533,15 @@ void unwear_armour(char unw) break; case SPARM_STRENGTH: - modify_stat(STAT_STRENGTH, -3, false, item, true); + modify_stat(STAT_STRENGTH, -3, false); break; case SPARM_DEXTERITY: - modify_stat(STAT_DEXTERITY, -3, false, item, true); + modify_stat(STAT_DEXTERITY, -3, false); break; case SPARM_INTELLIGENCE: - modify_stat(STAT_INTELLIGENCE, -3, false, item, true); + modify_stat(STAT_INTELLIGENCE, -3, false); break; case SPARM_PONDEROUSNESS: @@ -598,47 +598,35 @@ void unuse_randart(const item_def &item) { ASSERT( is_random_artefact( item ) ); + const bool ident = fully_identified(item); + randart_properties_t proprt; - randart_known_props_t known; - randart_wpn_properties( item, proprt, known ); + randart_wpn_properties( item, proprt ); if (proprt[RAP_AC]) { - you.redraw_armour_class = true; - if (!known[RAP_AC]) + you.redraw_armour_class = 1; + if (!ident) { mprf("You feel less %s.", - proprt[RAP_AC] > 0? "well-protected" : "vulnerable"); + proprt[RAP_AC] > 0? "well-protected" : "vulnerable"); } } if (proprt[RAP_EVASION]) { - you.redraw_evasion = true; - if (!known[RAP_EVASION]) + you.redraw_evasion = 1; + if (!ident) { mprf("You feel less %s.", proprt[RAP_EVASION] > 0? "nimble" : "awkward"); } } - if (proprt[RAP_MAGICAL_POWER]) - { - you.redraw_magic_points = true; - if (!known[RAP_MAGICAL_POWER]) - { - mprf("You feel your mana capacity %s.", - proprt[RAP_MAGICAL_POWER] > 0 ? "decrease" : "increase"); - } - } - // modify ability scores, always output messages - modify_stat( STAT_STRENGTH, -proprt[RAP_STRENGTH], false, item, - true); - modify_stat( STAT_INTELLIGENCE, -proprt[RAP_INTELLIGENCE], false, item, - true); - modify_stat( STAT_DEXTERITY, -proprt[RAP_DEXTERITY], false, item, - true); + modify_stat( STAT_STRENGTH, -proprt[RAP_STRENGTH], false ); + modify_stat( STAT_INTELLIGENCE, -proprt[RAP_INTELLIGENCE], false ); + modify_stat( STAT_DEXTERITY, -proprt[RAP_DEXTERITY], false ); if (proprt[RAP_NOISES] != 0) you.special_wield = SPWLD_NONE; |