For jewellery randarts, the properties of the randart's basetype are included in the auto-inscription.
Auto-inscribe unidentified randarts if the the player has learned some of its properties via equiping it.
If an unidentified randart is autoinscribed, is subsequently identified, and the identification reveals more of its properties, then remove the old atuo-inscription string before adding the new one.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3000 c06c8d41-db1a-0410-9941-cceddc491573
KPU2SA6G7UECM5N6PNXOT5CCQAYFBN47K5JYBQMFBD25HL2A5GIAC
// The base jewelery type is one whose property is revealed by
// wearing it, but whose property isn't revealed by having
// ISFLAG_KNOW_PLUSES set. For a randart with a base type of, for
// example, a ring of strength, wearing it sets
// ISFLAG_KNOW_PLUSES, which reveals the ring's strength plus.
if (item_ident( item, ISFLAG_KNOW_PROPERTIES )
|| item_ident( item, ISFLAG_KNOW_TYPE ))
{
known[fake_rap] = true;
}
return;
}
if (!force_fake_props)
return;
// For auto-inscribing randart jewellry, force_fake_props folds as
// much info about the base type as possible into the randarts
// property struct.
randart_prop_type fake_rap2 = RAP_NUM_PROPERTIES;
int fake_plus2 = 1;
switch (item.sub_type)
{
case RING_PROTECTION:
fake_rap = RAP_AC;
fake_plus = item.plus;
break;
case RING_PROTECTION_FROM_FIRE:
fake_rap = RAP_FIRE;
break;
case RING_POISON_RESISTANCE:
fake_rap = RAP_POISON;
break;
case RING_PROTECTION_FROM_COLD:
fake_rap = RAP_COLD;
break;
case RING_STRENGTH:
fake_rap = RAP_STRENGTH;
break;
case RING_SLAYING:
fake_rap = RAP_ACCURACY;
fake_plus = item.plus;
fake_rap2 = RAP_DAMAGE;
fake_plus2 = item.plus2;
break;
case RING_SEE_INVISIBLE:
fake_rap = RAP_EYESIGHT;
break;
case RING_HUNGER:
fake_rap = RAP_METABOLISM;
break;
case RING_EVASION:
fake_rap = RAP_EVASION;
fake_plus = item.plus;
break;
case RING_DEXTERITY:
fake_rap = RAP_DEXTERITY;
fake_plus = item.plus;
break;
case RING_INTELLIGENCE:
fake_rap = RAP_INTELLIGENCE;
fake_plus = item.plus;
break;
case RING_LIFE_PROTECTION:
fake_rap = RAP_NEGATIVE_ENERGY;
break;
case RING_PROTECTION_FROM_MAGIC:
fake_rap = RAP_MAGIC;
break;
case RING_FIRE:
fake_rap = RAP_FIRE;
fake_rap2 = RAP_COLD;
fake_plus2 = -1;
break;
case RING_ICE:
fake_rap = RAP_COLD;
fake_rap2 = RAP_FIRE;
fake_plus2 = -1;
break;
case AMU_INACCURACY:
fake_rap = RAP_ACCURACY;
fake_plus = -5;
break;
}
if (fake_rap != RAP_NUM_PROPERTIES)
proprt[fake_rap] += fake_plus;
if (fake_rap2 != RAP_NUM_PROPERTIES)
proprt[fake_rap2] += fake_plus2;
if (item_ident( item, ISFLAG_KNOW_PROPERTIES )
|| item_ident( item, ISFLAG_KNOW_TYPE ))
{
if (fake_rap != RAP_NUM_PROPERTIES && proprt[fake_rap] != 0)
known[fake_rap] = true;
if (fake_rap2 != RAP_NUM_PROPERTIES && proprt[fake_rap2] != 0)
known[fake_rap2] = true;
}
// For randart jewellry, note the base jewelery type if it's not
// covered by randart_desc_properties()
if (item.base_type == OBJ_JEWELLERY
&& item_ident( item, ISFLAG_KNOW_PROPERTIES ))
{
std::string type = "";
switch(item.sub_type)
{
case RING_REGENERATION:
type = "Regen";
break;
case RING_SUSTAIN_ABILITIES:
type = "SustAbil";
break;
case RING_SUSTENANCE:
type = "Susten";
break;
case RING_WIZARDRY:
type = "Wiz";
break;
case RING_FIRE:
type = "F-Mag";
break;
case RING_ICE:
type = "I-Mag";
break;
case RING_TELEPORT_CONTROL:
type = "T-Cont";
break;
case AMU_RESIST_SLOW:
type = "RSlow";
break;
case AMU_CLARITY:
type = "Clar";
break;
case AMU_WARDING:
type = "Ward";
break;
case AMU_RESIST_CORROSION:
type = "RAcid";
break;
case AMU_THE_GOURMAND:
type = "Gourm";
break;
case AMU_CONSERVATION:
type = "Conserv";
break;
case AMU_CONTROLLED_FLIGHT:
type = "C-Fly";
break;
}
// Remove randart auto-inscription. Do it once for each property
// string, rather than the return value of randart_auto_inscription(),
// in case more information about the randart has been learned since
// the last auto-inscription.
static void trim_randart_inscrip( item_def& item )
{
std::vector<std::string> propnames = randart_propnames(item);
for (unsigned int i = 0, size = propnames.size(); i < size; i++)
{
std::string prop = propnames[i] + ",";
item.inscription = replace_all(item.inscription, prop, "");
prop = propnames[i];
item.inscription = replace_all(item.inscription, prop, "");
}
trim_string(item.inscription);