diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-11 03:23:34 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-11 03:23:34 +0000 |
commit | 37bace0de351260e14b6e1102e2f8f101d2bb162 (patch) | |
tree | 1b3b023d0920599c78d81bbae7a09fe909b2b2cb | |
parent | 767d1c86be4624c7c91da0b398134319d5aab612 (diff) | |
download | crawl-ref-37bace0de351260e14b6e1102e2f8f101d2bb162.tar.gz crawl-ref-37bace0de351260e14b6e1102e2f8f101d2bb162.zip |
For unidentified randart jewellery, remember and display obvious-from-wearing
effects caused by the base type item as if they were randart properties.
Related changes:
* Equpping or unequipping a ring of magical power or staff of power will
give a message about mana capacity increasing/decreasing.
* The randart property RAP_MAGICAL_POWER has been added.
randart_wpn_property() doesn't yet give this to any randarts, but
the rest of the code for it is in place.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2419 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/describe.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/it_use2.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 63 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/randart.cc | 96 | ||||
-rw-r--r-- | crawl-ref/source/randart.h | 7 |
6 files changed, 130 insertions, 63 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 1e09d0d758..c0bed567fd 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -168,7 +168,7 @@ static void randart_descrip( std::string &description, const item_def &item ) randart_properties_t proprt; randart_known_props_t known; - randart_wpn_properties( item, proprt, known ); + randart_desc_properties( item, proprt, known ); if (known_proprt( RAP_AC )) { @@ -289,6 +289,13 @@ static void randart_descrip( std::string &description, const item_def &item ) } } + if (known_proprt( RAP_MAGICAL_POWER )) + { + description += "$It affects your mana capacity ("; + append_value(description, proprt[ RAP_MAGICAL_POWER ], true); + description += ")."; + } + if (known_proprt( RAP_EYESIGHT )) description += "$It enhances your eyesight. "; diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 832e7bfe2a..34a5c335f1 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -493,7 +493,10 @@ void 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; } // end unwield_item() @@ -625,6 +628,16 @@ void unuse_randart(const item_def &item) } } + if (proprt[RAP_MAGICAL_POWER]) + { + you.redraw_magic_points = 1; + if (!known[RAP_MAGICAL_POWER]) + { + mprf("You feel you mana capacity %s.", proprt[RAP_EVASION] > 0? + "decrease" : "increase"); + } + } + // modify ability scores, always output messages modify_stat( STAT_STRENGTH, -proprt[RAP_STRENGTH], false, item, true); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ea900bd501..753cc8549c 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -426,6 +426,7 @@ void wield_effects(int item_wield_2, bool showMsgs) // inc_max_mp(13); calc_mp(); set_ident_flags( you.inv[item_wield_2], ISFLAG_EQ_WEAPON_MASK ); + mpr("You fell your mana capacity increase."); } else { @@ -2281,13 +2282,15 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, void jewellery_wear_effects(item_def &item) { - item_type_id_state_type ident = ID_TRIED_TYPE; + item_type_id_state_type ident = ID_TRIED_TYPE; + randart_prop_type fake_rap = RAP_NUM_PROPERTIES; + bool learn_pluses = false; // Randart jewellery shouldn't auto-ID just because the // base type is known. Somehow the player should still // be told, preferably by message. (jpeg) const bool artefact = is_random_artefact( item ); - const bool identified = fully_identified( item ); + const bool known_pluses = item_ident( item, ISFLAG_KNOW_PLUSES ); const bool known_cursed = item_known_cursed( item ); const bool known_bad = item_type_known( item ) && (item_value( item ) <= 2); @@ -2317,11 +2320,12 @@ void jewellery_wear_effects(item_def &item) { if (!artefact) ident = ID_KNOWN_TYPE; - else if (!identified) + else if (!known_pluses) { mprf("You feel %s.", item.plus > 0? "well-protected" : "more vulnerable"); } + learn_pluses = true; } break; @@ -2329,7 +2333,9 @@ void jewellery_wear_effects(item_def &item) if (!you.duration[DUR_INVIS]) { mpr("You become transparent for a moment."); - if (!artefact) + if (artefact) + fake_rap = RAP_INVISIBLE; + else ident = ID_KNOWN_TYPE; } break; @@ -2340,8 +2346,9 @@ void jewellery_wear_effects(item_def &item) { if (!artefact) ident = ID_KNOWN_TYPE; - else if (!identified) + else if (!known_pluses) mprf("You feel %s.", item.plus > 0? "nimbler" : "more awkward"); + learn_pluses = true; } break; @@ -2349,23 +2356,29 @@ void jewellery_wear_effects(item_def &item) modify_stat(STAT_STRENGTH, item.plus, !artefact, item); if (item.plus != 0 && !artefact) ident = ID_KNOWN_TYPE; + learn_pluses = true; break; case RING_DEXTERITY: modify_stat(STAT_DEXTERITY, item.plus, !artefact, item); if (item.plus != 0 && !artefact) ident = ID_KNOWN_TYPE; + learn_pluses = true; break; case RING_INTELLIGENCE: modify_stat(STAT_INTELLIGENCE, item.plus, !artefact, item); if (item.plus != 0 && !artefact) ident = ID_KNOWN_TYPE; + learn_pluses = true; break; case RING_MAGICAL_POWER: + mpr("You feel you mana capacity increase."); calc_mp(); - if (!artefact) + if (artefact) + fake_rap = RAP_MAGICAL_POWER; + else ident = ID_KNOWN_TYPE; break; @@ -2373,7 +2386,9 @@ void jewellery_wear_effects(item_def &item) if (!scan_randarts( RAP_LEVITATE )) { mpr("You feel buoyant."); - if (!artefact) + if (artefact) + fake_rap = RAP_LEVITATE; + else ident = ID_KNOWN_TYPE; } break; @@ -2382,7 +2397,9 @@ void jewellery_wear_effects(item_def &item) if (!scan_randarts( RAP_CAN_TELEPORT )) { mpr("You feel slightly jumpy."); - if (!artefact) + if (artefact) + fake_rap = RAP_CAUSE_TELEPORTATION; + else ident = ID_KNOWN_TYPE; } break; @@ -2391,7 +2408,9 @@ void jewellery_wear_effects(item_def &item) if (!scan_randarts( RAP_BERSERK )) { mpr("You feel a brief urge to hack something to bits."); - if (!artefact) + if (artefact) + fake_rap = RAP_BERSERK; + else ident = ID_KNOWN_TYPE; } break; @@ -2404,12 +2423,22 @@ void jewellery_wear_effects(item_def &item) // Artefacts have completely different appearance than base types // so we don't allow them to make the base types known if (artefact) + { use_randart(item); + + if (learn_pluses && (item.plus != 0 || item.plus2 != 0)) + set_ident_flags( item, ISFLAG_KNOW_PLUSES ); + + if (fake_rap != RAP_NUM_PROPERTIES) + randart_wpn_learn_prop( item, fake_rap ); + } else + { set_ident_type( item.base_type, item.sub_type, ident ); - if (ident == ID_KNOWN_TYPE) - set_ident_flags( item, ISFLAG_EQ_JEWELLERY_MASK ); + if (ident == ID_KNOWN_TYPE) + set_ident_flags( item, ISFLAG_EQ_JEWELLERY_MASK ); + } if (item_cursed( item )) { @@ -2685,6 +2714,7 @@ void jewellery_remove_effects(item_def &item) break; case RING_MAGICAL_POWER: + mpr("You feel you mana capacity decrease."); // dec_max_mp(9); break; @@ -3981,6 +4011,17 @@ void use_randart(item_def &item) } } + if (proprt[RAP_MAGICAL_POWER]) + { + you.redraw_magic_points = 1; + if (!known[RAP_MAGICAL_POWER]) + { + mprf("You feel you mana capacity %s.", proprt[RAP_EVASION] > 0? + "increase" : "decrease"); + randart_wpn_learn_prop(item, RAP_MAGICAL_POWER); + } + } + // modify ability scores // output result even when identified (because of potential fatality) modify_stat( STAT_STRENGTH, proprt[RAP_STRENGTH], false, item ); diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 83841f6f4b..674e2df54c 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2223,8 +2223,9 @@ int player_magical_power( void ) { int ret = 0; - ret += 13 * player_equip( EQ_STAFF, STAFF_POWER ); - ret += 9 * player_equip( EQ_RINGS, RING_MAGICAL_POWER ); + ret += 13 * player_equip( EQ_STAFF, STAFF_POWER ); + ret += 9 * player_equip( EQ_RINGS, RING_MAGICAL_POWER ); + ret += scan_randarts( RAP_MAGICAL_POWER ); return (ret); } diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 0767482401..1a81244651 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -880,6 +880,49 @@ static long calc_seed( const item_def &item ) return (item.special & RANDART_SEED_MASK); } +void randart_desc_properties( const item_def &item, + randart_properties_t &proprt, + randart_known_props_t &known ) +{ + randart_wpn_properties( item, proprt, known); + + if ( item_ident( item, ISFLAG_KNOW_PROPERTIES ) ) + return; + + if (item.base_type != OBJ_JEWELLERY) + return; + + randart_prop_type fake_rap = RAP_NUM_PROPERTIES; + int fake_plus = 1; + + switch (item.sub_type) + { + case RING_INVISIBILITY: + fake_rap = RAP_INVISIBLE; + break; + + case RING_TELEPORTATION: + fake_rap = RAP_CAUSE_TELEPORTATION; + break; + + case RING_MAGICAL_POWER: + fake_rap = RAP_MAGICAL_POWER; + fake_plus = 9; + break; + + case RING_LEVITATION: + fake_rap = RAP_LEVITATE; + break; + + case AMU_RAGE: + fake_rap = RAP_BERSERK; + break; + } + + if (fake_rap != RAP_NUM_PROPERTIES) + proprt[fake_rap] += fake_plus; +} + void randart_wpn_properties( const item_def &item, randart_properties_t &proprt, randart_known_props_t &known) @@ -1405,7 +1448,7 @@ int randart_wpn_num_props( const item_def &item ) int randart_wpn_num_props( const randart_properties_t &proprt ) { - int num; + int num = 0; for (int i = 0; i < RAP_NUM_PROPERTIES; i++) if (proprt[i] != 0) @@ -1816,14 +1859,6 @@ static bool randart_is_redundant( const item_def &item, switch (item.sub_type) { - case RING_SUSTAIN_ABILITIES: - case RING_SUSTENANCE: - case RING_REGENERATION: - case RING_TELEPORT_CONTROL: - case RING_WIZARDRY: - case RING_MAGICAL_POWER: - break; - case RING_PROTECTION: provides = RAP_AC; break; @@ -1880,6 +1915,10 @@ static bool randart_is_redundant( const item_def &item, provides = RAP_INTELLIGENCE; break; + case RING_MAGICAL_POWER: + provides = RAP_MAGICAL_POWER; + break; + case RING_LEVITATION: provides = RAP_LEVITATE; break; @@ -1899,16 +1938,6 @@ static bool randart_is_redundant( const item_def &item, case AMU_INACCURACY: provides = RAP_ACCURACY; break; - - case AMU_RESIST_SLOW: - case AMU_CLARITY: - case AMU_WARDING: - case AMU_RESIST_CORROSION: - case AMU_THE_GOURMAND: - case AMU_CONSERVATION: - case AMU_CONTROLLED_FLIGHT: - case AMU_RESIST_MUTATION: - break; } if (provides == RAP_NUM_PROPERTIES) @@ -1936,25 +1965,6 @@ static bool randart_is_conflicting( const item_def &item, switch (item.sub_type) { - case RING_REGENERATION: - case RING_PROTECTION: - case RING_PROTECTION_FROM_FIRE: - case RING_POISON_RESISTANCE: - case RING_PROTECTION_FROM_COLD: - case RING_STRENGTH: - case RING_SLAYING: - case RING_SEE_INVISIBLE: - case RING_INVISIBILITY: - case RING_HUNGER: - case RING_EVASION: - case RING_SUSTAIN_ABILITIES: - case RING_DEXTERITY: - case RING_INTELLIGENCE: - case RING_LEVITATION: - case RING_LIFE_PROTECTION: - case RING_PROTECTION_FROM_MAGIC: - break; - case RING_SUSTENANCE: conflicts = RAP_METABOLISM; break; @@ -1978,16 +1988,6 @@ static bool randart_is_conflicting( const item_def &item, case AMU_RAGE: conflicts = RAP_STEALTH; break; - - case AMU_RESIST_SLOW: - case AMU_CLARITY: - case AMU_WARDING: - case AMU_RESIST_CORROSION: - case AMU_THE_GOURMAND: - case AMU_CONSERVATION: - case AMU_CONTROLLED_FLIGHT: - case AMU_INACCURACY: - break; } if (conflicts == RAP_NUM_PROPERTIES) diff --git a/crawl-ref/source/randart.h b/crawl-ref/source/randart.h index 22af923d45..27ff3a3b19 100644 --- a/crawl-ref/source/randart.h +++ b/crawl-ref/source/randart.h @@ -47,12 +47,13 @@ enum randart_prop_type RAP_DAMAGE, RAP_CURSED, RAP_STEALTH, + RAP_MAGICAL_POWER, // 30 RAP_NUM_PROPERTIES }; // used in files.cc, newgame.cc, randart.cc {dlb} #define NO_UNRANDARTS 53 -#define RA_PROPERTIES 30 +#define RA_PROPERTIES RAP_NUM_PROPERTIES // Reserving the upper bits for later expansion/versioning. #define RANDART_SEED_MASK 0x00ffffff @@ -100,6 +101,10 @@ typedef FixedVector< bool, RA_PROPERTIES > randart_known_props_t; /* *********************************************************************** * called from: describe - fight - it_use2 - item_use - player * *********************************************************************** */ +void randart_desc_properties( const item_def &item, + randart_properties_t &proprt, + randart_known_props_t &known ); + void randart_wpn_properties( const item_def &item, randart_properties_t &proprt, randart_known_props_t &known ); |