wearing the randart. Breaks savefile compatibility for saved games containing any randarts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2403 c06c8d41-db1a-0410-9941-cceddc491573
SN3VSV7G6NF6NLX5E47QJQQFDIPC2LQUUYGZMH6AWBF3FOUHXCBQC ZRN5B7L6UZPGTK5L3FVEKDI6HKUEJPBK35F3372L6WGJYUCAFR6QC LP3U7LC6QK6TCMLAYTRGZ2CDZAHPM6VWDT6NPE5ET4WBBZVHBDXQC HFCPPPYI366EDKNBDGVNSAW76OGQA2NYTKLSP4LC3VYKHPLWFJ6QC X7PDT4KIPYJXXLGCQZKIPDQPYO636QL7LZ5KI2Q65RDNWTHYAT3QC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC R22TTMI6WXWULC7ODKFF3QCB7MOTETQQ6IR4BUCUPOCQKQNCTT5AC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC XKAJWK6MPHS3ZCZIPPLTIMOPF6AROGLRDDCS6EFE3IGE4AHT7MYQC QDTVLBRGHDTRUVT7I3O72K6TMOYAUSAJBZUHGOEFU2RKJNUPWZSQC PNFDSBFCGH5IZR7QNF4DQTEV4QXIIO4DWYTSFEOUWLZJVSWNDKAAC QVVC7AYGVA6U64PTNA7L27422NLMO327P22BQKXEVIMPZHIHO7MQC ASSERT( item.props.exists( KNOWN_PROPS_KEY ) );const CrawlStoreValue &_val = item.props[KNOWN_PROPS_KEY];ASSERT( _val.get_type() == SV_VEC );const CrawlVector &known_vec = _val.get_vector();ASSERT( known_vec.get_type() == SV_BOOL );ASSERT( known_vec.size() == RA_PROPERTIES);ASSERT( known_vec.get_max_size() == RA_PROPERTIES);if ( item_ident( item, ISFLAG_KNOW_PROPERTIES ) ){for (vec_size i = 0; i < RA_PROPERTIES; i++)known[i] = (bool) true;}else{for (vec_size i = 0; i < RA_PROPERTIES; i++)known[i] = known_vec[i];}
}void randart_wpn_properties( const item_def &item,randart_properties_t &proprt ){randart_known_props_t known;randart_wpn_properties(item, proprt, known);}int randart_wpn_property( const item_def &item, int prop, bool &_known ){randart_properties_t proprt;randart_known_props_t known;randart_wpn_properties( item, proprt, known );_known = known[prop];return ( proprt[prop] );
randart_properties_t proprt;
bool known;return randart_wpn_property( item, prop, known );}void randart_wpn_learn_prop( item_def &item, int prop ){ASSERT( is_random_artefact( item ) );ASSERT( item.props.exists( KNOWN_PROPS_KEY ) );CrawlStoreValue &_val = item.props[KNOWN_PROPS_KEY];ASSERT( _val.get_type() == SV_VEC );CrawlVector &known_vec = _val.get_vector();ASSERT( known_vec.get_type() == SV_BOOL );ASSERT( known_vec.size() == RA_PROPERTIES);ASSERT( known_vec.get_max_size() == RA_PROPERTIES);
item.flags |= ISFLAG_RANDART;
if (item.flags & ISFLAG_RANDART){return (true);}if (item.flags & ISFLAG_UNRANDART){#if DEBUGmprf(MSGCH_DIAGNOSTICS, "Trying to turn '%s' from an unrandart to""a randart.", item.name(DESC_PLAIN, false, true).c_str());#endifreturn (false);}item.flags |= ISFLAG_RANDART;
// the same ability. If not, give a message.// Do NOT give all these messages if the randart is identified.if (!ident)
// the same ability. If not, and if the ability granted hasn't// already been discovered, give a message.if (unknown_proprt(RAP_LEVITATE)&& !items_give_ability(item.link, RAP_LEVITATE))
if (proprt[RAP_INVISIBLE] && !you.duration[DUR_INVIS])mpr("You become transparent for a moment.");
if (unknown_proprt(RAP_INVISIBLE) && !you.duration[DUR_INVIS]){mpr("You become transparent for a moment.");randart_wpn_learn_prop(item, RAP_INVISIBLE);}
if (proprt[RAP_CAN_TELEPORT] && !items_give_ability(item.link, RAP_CAN_TELEPORT))mpr("You feel slightly jumpy.");
if (unknown_proprt(RAP_CAN_TELEPORT)&& !items_give_ability(item.link, RAP_CAN_TELEPORT)){mpr("You feel slightly jumpy.");randart_wpn_learn_prop(item, RAP_CAN_TELEPORT);}
if (proprt[RAP_BERSERK] && !items_give_ability(item.link, RAP_BERSERK))mpr("You feel a brief urge to hack something to bits.");
if (unknown_proprt(RAP_BERSERK)&& !items_give_ability(item.link, RAP_BERSERK)){mpr("You feel a brief urge to hack something to bits.");randart_wpn_learn_prop(item, RAP_BERSERK);
randart_properties_t proprt;randart_wpn_properties( item, proprt );
randart_properties_t proprt;randart_known_props_t known;randart_wpn_properties( item, proprt, known );
if (proprt[ RAP_FIRE ] < -2)description += "$It makes you extremely vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == -2)description += "$It makes you very vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == -1)description += "$It makes you vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == 1)description += "$It protects you from fire. ";else if (proprt[ RAP_FIRE ] == 2)description += "$It greatly protects you from fire. ";else if (proprt[ RAP_FIRE ] > 2)description += "$It renders you almost immune to fire. ";
if (known_proprt( RAP_FIRE )){if (proprt[ RAP_FIRE ] < -2)description += "$It makes you extremely vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == -2)description += "$It makes you very vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == -1)description += "$It makes you vulnerable to fire. ";else if (proprt[ RAP_FIRE ] == 1)description += "$It protects you from fire. ";else if (proprt[ RAP_FIRE ] == 2)description += "$It greatly protects you from fire. ";else if (proprt[ RAP_FIRE ] > 2)description += "$It renders you almost immune to fire. ";}
if (proprt[ RAP_COLD ] < -2)description += "$It makes you extremely vulnerable to cold. ";else if (proprt[ RAP_COLD ] == -2)description += "$It makes you very vulnerable to cold. ";else if (proprt[ RAP_COLD ] == -1)description += "$It makes you vulnerable to cold. ";else if (proprt[ RAP_COLD ] == 1)description += "$It protects you from cold. ";else if (proprt[ RAP_COLD ] == 2)description += "$It greatly protects you from cold. ";else if (proprt[ RAP_COLD ] > 2)description += "$It renders you almost immune to cold. ";
if (known_proprt( RAP_COLD )){if (proprt[ RAP_COLD ] < -2)description += "$It makes you extremely vulnerable to cold. ";else if (proprt[ RAP_COLD ] == -2)description += "$It makes you very vulnerable to cold. ";else if (proprt[ RAP_COLD ] == -1)description += "$It makes you vulnerable to cold. ";else if (proprt[ RAP_COLD ] == 1)description += "$It protects you from cold. ";else if (proprt[ RAP_COLD ] == 2)description += "$It greatly protects you from cold. ";else if (proprt[ RAP_COLD ] > 2)description += "$It renders you almost immune to cold. ";}
if (proprt[ RAP_NEGATIVE_ENERGY ] == 1)description += "$It partially protects you from negative energy. ";else if (proprt[ RAP_NEGATIVE_ENERGY ] == 2)description += "$It protects you from negative energy. ";else if (proprt[ RAP_NEGATIVE_ENERGY ] > 2)description += "$It renders you almost immune to negative energy. ";
if (known_proprt( RAP_NEGATIVE_ENERGY )){if (proprt[ RAP_NEGATIVE_ENERGY ] == 1)description += "$It partially protects you from negative energy. ";else if (proprt[ RAP_NEGATIVE_ENERGY ] == 2)description += "$It protects you from negative energy. ";else if (proprt[ RAP_NEGATIVE_ENERGY ] > 2)description += "$It renders you almost immune to ""negative energy. ";}
if (proprt[ RAP_STEALTH ] < -20)description += "$It makes you much less stealthy. ";elsedescription += "$It makes you less stealthy. ";}else if (proprt[ RAP_STEALTH ] > 0){if (proprt[ RAP_STEALTH ] > 20)description += "$It makes you much more stealthy. ";elsedescription += "$It makes you more stealthy. ";
if (proprt[ RAP_STEALTH ] < 0){if (proprt[ RAP_STEALTH ] < -20)description += "$It makes you much less stealthy. ";elsedescription += "$It makes you less stealthy. ";}else if (proprt[ RAP_STEALTH ] > 0){if (proprt[ RAP_STEALTH ] > 20)description += "$It makes you much more stealthy. ";elsedescription += "$It makes you more stealthy. ";}
if (proprt[ RAP_METABOLISM ] >= 3)description += "$It greatly speeds your metabolism. ";else if (proprt[ RAP_METABOLISM ])description += "$It speeds your metabolism. ";
if (known_proprt( RAP_METABOLISM )){if (proprt[ RAP_METABOLISM ] >= 3)description += "$It greatly speeds your metabolism. ";else if (proprt[ RAP_METABOLISM ])description += "$It speeds your metabolism. ";}
if (proprt[ RAP_MUTAGENIC ] > 3)description += "$It glows with mutagenic radiation.";else if (proprt[ RAP_MUTAGENIC ])description += "$It emits mutagenic radiation.";
if (known_proprt( RAP_MUTAGENIC )){if (proprt[ RAP_MUTAGENIC ] > 3)description += "$It glows with mutagenic radiation.";else if (proprt[ RAP_MUTAGENIC ])description += "$It emits mutagenic radiation.";}
if (item_ident( item, ISFLAG_KNOW_PROPERTIES )){unsigned int old_length = description.length();randart_descrip( description, item );
unsigned int old_length = description.length();randart_descrip( description, item );
if (description.length() == old_length)description += "$";}else if (item_type_known(item))
if (description.length() == old_length)description += "$";else if (!item_ident( item, ISFLAG_KNOW_PROPERTIES )&& item_type_known(item))
if (item_ident( item, ISFLAG_KNOW_PROPERTIES ))randart_descrip( description, item );else if (item_type_known(item))
randart_descrip( description, item );if (!item_ident( item, ISFLAG_KNOW_PROPERTIES )&& item_type_known(item)){
if (item_ident( item, ISFLAG_KNOW_PROPERTIES ))randart_descrip( description, item );else if (item_type_known(item))
randart_descrip( description, item );if (!item_ident( item, ISFLAG_KNOW_PROPERTIES )&& item_type_known(item))