From cd555474f03d4a288c2dbd87fe4ab848590873ee Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 14 Aug 2007 09:19:12 +0000 Subject: More equipment information on the % screen, this time for transformations, plus additional curse checks. Also added "mutation" messages for hungry vampires. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1999 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mutation.cc | 25 +++++++++++++++------ crawl-ref/source/output.cc | 14 +++++++++++- crawl-ref/source/player.cc | 53 ++++++++++++++++++++++++++++++++++++++++---- crawl-ref/source/player.h | 1 + crawl-ref/source/transfor.cc | 37 ++++++++++++++++++++++--------- 5 files changed, 108 insertions(+), 22 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 885b788811..ae5ec3496a 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -971,6 +971,7 @@ formatted_string describe_mutations() result += ""; result += EOL; result += "You preferably eat rotten meat." EOL; + result += "You resist negative energy." EOL; have_any = true; break; @@ -1010,6 +1011,7 @@ formatted_string describe_mutations() result += " strongly"; result += " in touch with the powers of death." EOL; + result += "You resist negative energy." EOL; if (you.experience_level > 12) result += "You can restore your body by infusing magical energy." EOL; @@ -1101,13 +1103,22 @@ formatted_string describe_mutations() break; case SP_VAMPIRE: - result += "You are"; - result += (you.experience_level > 25 && you.hunger_state == HS_FULL) ? - " very strongly" : - (you.experience_level > 12 && you.hunger_state != HS_HUNGRY) ? - " strongly" : ""; - result += " in touch with the powers of death." EOL; - have_any = true; + if (you.hunger_state < HS_SATIATED) + { + result += ""; + result += "You are"; + result += (you.experience_level > 25) ? + " strongly" : ""; + result += " in touch with the powers of death." EOL; + result += "You mostly resist negative energy." EOL; + result += "You can see invisible." EOL; + if (you.hunger_state < HS_HUNGRY) + result += "You do not regenerate." EOL; + else + result += "You regenerate slowly." EOL; + result += ""; + have_any = true; + } break; default: diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 60da17500a..db0d566a9d 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1261,6 +1261,12 @@ void print_overview_screen() snprintf(buf, sizeof buf, "%-7s: Blade Hands", slot); else if (you.skills[SK_UNARMED_COMBAT]) snprintf(buf, sizeof buf, "%-7s: Unarmed", slot); + else if (!you_tran_can_wear(EQ_WEAPON)) + { + snprintf(buf, sizeof buf, "%-7s: " + "(currently unavailable)", + slot); + } else snprintf(buf, sizeof buf, "%-7s:", slot); } @@ -1274,9 +1280,15 @@ void print_overview_screen() else { snprintf(buf, sizeof buf, - "%-7s: (unavailable)", slot); + "%-7s: (unavailable)", slot); } } + else if (!you_tran_can_wear(e_order[i])) + { + snprintf(buf, sizeof buf, "%-7s: " + "(currently unavailable)", + slot); + } else { snprintf(buf, sizeof buf, "%-7s:", slot); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index da0ed6aa3f..5ac9124d99 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -438,10 +438,6 @@ bool player_genus(unsigned char which_genus, unsigned char species) // ------------------------------------------------- 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) @@ -475,6 +471,55 @@ bool you_can_wear(int eq) return true; } +bool you_tran_can_wear(int eq) +{ + int transform = you.attribute[ATTR_TRANSFORMATION]; + + // no further restrictions + if (transform == TRAN_NONE || transform == TRAN_LICH) + return true; + + // bats cannot use anything, clouds obviously so + if (transform == TRAN_BAT || transform == TRAN_AIR) + return false; + + // everyone else can wear jewellery, at least + if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET) + return true; + + // these cannot use anything but jewellery + if (transform == TRAN_SPIDER || transform == TRAN_DRAGON + || transform == TRAN_SERPENT_OF_HELL) + { + return false; + } + + if (transform == TRAN_BLADE_HANDS) + { + if (eq == EQ_WEAPON || eq == EQ_GLOVES || eq == EQ_SHIELD) + return false; + return true; + } + + if (transform == TRAN_ICE_BEAST) + { + if (eq != EQ_CLOAK) + { + return false; + } + return true; + } + + if (transform == TRAN_STATUE) + { + if (eq == EQ_BODY_ARMOUR || eq == EQ_GLOVES || eq == EQ_SHIELD) + return false; + return true; + } + + 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 d99e8ba040..898ae998cf 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -304,6 +304,7 @@ bool player_genus( unsigned char which_genus, unsigned char species = SP_UNKNOWN ); bool you_can_wear( int eq ); +bool you_tran_can_wear( int eq ); /* *********************************************************************** * called from: ability - effects - fight - it_use3 - ouch - spell - diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 58a14e4532..a3716de77a 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -219,7 +219,6 @@ bool transform(int pow, transformation_type which_trans) you.species == SP_VAMPIRE ? "vampire " : ""); remove_equipment( rem_stuff ); - // drop_everything(); you.attribute[ATTR_TRANSFORMATION] = TRAN_BAT; you.duration[DUR_TRANSFORMATION] = 20 + random2(pow) + random2(pow); @@ -235,10 +234,13 @@ bool transform(int pow, transformation_type which_trans) return (true); case TRAN_ICE_BEAST: // also AC +3, cold +3, fire -1, pois +1 - mpr( "You turn into a creature of crystalline ice." ); - rem_stuff.erase(EQ_CLOAK); + if (check_for_cursed_equipment( rem_stuff )) + return false; + + mpr( "You turn into a creature of crystalline ice." ); + remove_equipment( rem_stuff ); you.attribute[ATTR_TRANSFORMATION] = TRAN_ICE_BEAST; @@ -276,6 +278,14 @@ bool transform(int pow, transformation_type which_trans) return (true); case TRAN_STATUE: // also AC +20, ev -5, elec +1, pois +1, neg +1, slow + rem_stuff.erase(EQ_WEAPON); // can still hold a weapon + rem_stuff.erase(EQ_CLOAK); + rem_stuff.erase(EQ_HELMET); + rem_stuff.erase(EQ_BOOTS); + + if (check_for_cursed_equipment( rem_stuff )) + return false; + if (you.species == SP_GNOME && coinflip()) mpr( "Look, a garden gnome. How cute!" ); else if (player_genus(GENPC_DWARVEN) && one_chance_in(10)) @@ -283,13 +293,7 @@ bool transform(int pow, transformation_type which_trans) else mpr( "You turn into a living statue of rough stone." ); - rem_stuff.erase(EQ_WEAPON); // can still hold a weapon - rem_stuff.erase(EQ_CLOAK); - rem_stuff.erase(EQ_HELMET); - rem_stuff.erase(EQ_BOOTS); - // too stiff to make use of shields, gloves, or armour -- bwr - remove_equipment( rem_stuff ); you.attribute[ATTR_TRANSFORMATION] = TRAN_STATUE; @@ -310,6 +314,9 @@ bool transform(int pow, transformation_type which_trans) return (true); case TRAN_DRAGON: // also AC +10, ev -3, cold -1, fire +2, pois +1, flight + if (check_for_cursed_equipment( rem_stuff )) + return false; + if (you.species == SP_MERFOLK && player_is_swimming()) mpr("You fly out of the water as you turn into " "a fearsome dragon!"); @@ -370,7 +377,14 @@ bool transform(int pow, transformation_type which_trans) return (true); case TRAN_AIR: - // also AC 20, ev +20, regen/2, no hunger, fire -2, cold -2, air +2, + rem_stuff.insert(EQ_LEFT_RING); + rem_stuff.insert(EQ_RIGHT_RING); + rem_stuff.insert(EQ_AMULET); + + if (check_for_cursed_equipment( rem_stuff )) + return false; + + // also AC 20, ev +20, regen/2, no hunger, fire -2, cold -2, air +2, // pois +1, spec_earth -1 mpr( "You feel diffuse..." ); @@ -390,6 +404,9 @@ bool transform(int pow, transformation_type which_trans) return (true); case TRAN_SERPENT_OF_HELL: + if (check_for_cursed_equipment( rem_stuff )) + return false; + // also AC +10, ev -5, fire +2, pois +1, life +2, slow mpr( "You transform into a huge demonic serpent!" ); -- cgit v1.2.3-54-g00ecf