Code cleanup with unrandarts and fixedarts. Bugfix for isomorphic-up-to-colour unrandarts being confused when lost in the Abyss. Trowel will not clobber critical features (stairs, portals, etc.) Nemelex is unhappy about Trowel failing. Breaks savefiles.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3003 c06c8d41-db1a-0410-9941-cceddc491573
IXLNOTBJGHKESBCTME6QAR6XVWFNCHYGMS62V62ZJEA7VLQHXO2QC
WJS4U5UXQH6ENQLZRWLID56EITQT2B3G72NVSS6RFCYZVWOK6J2QC
HDJSYPW6GTSBM43QYCJQBEBDAUWWHFHUR6DC4ILGF6LJVL26CZPAC
Q3DNEB5OOJ34P5ML4CMK3L6SCP7RLW7DDOZEG24KZBX3C7BJRQDAC
KPU2SA6G7UECM5N6PNXOT5CCQAYFBN47K5JYBQMFBD25HL2A5GIAC
SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
TYRQMDB4PCK6K4WOC6XSMAGRR2FIEUIQSM7RQO7ZZ44MY37HEA3QC
H7BW6SEIQ57X6V4BM2RX54W42W6BH5XJBAS6FYCYKLQQG43ZMU4QC
QVVC7AYGVA6U64PTNA7L27422NLMO327P22BQKXEVIMPZHIHO7MQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
7K5P2GRF6QUXTMERG2R3BB6DZFQYJQ6V2KNPMBPFDLOP36NQILPAC
LZBHBSCXDX2JKU2BSO5QP3WDHFIGHPXK4CKUZV6FWYDRFWLQK26QC
XUCCWGMXKPIR34BBCCOI67YHI3RST4STDWSDUZTN4B2CJWXQLQ7AC
3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC
35KOQQV4ZBNNIAXGKPOYHOWTN7RBQY7HRZTVMR3WAS4GOYFBM6PQC
JP7SVXCIKEPVDD4Q5CDYDATPK7X5XOYW3T6QK2Y6EWHFH52LBK3QC
SS6MUIJYTGIVBYU356Z563QJWLJ47QNHSJWS7GJTS7EATZH2ESJQC
JIMH7VEMQ7QF6VV2D65UISCRG5W55UX5YSQLLUW6SZNSTZMFWQ5AC
WVFKGV3AMOYUZ53MWH2RWRITRRCPKKNPTO7QASA5WVKWAUGDJ2OQC
if (art >= SPWPN_SINGING_SWORD && art <= SPWPN_SWORD_OF_ZONGULDROK)
return (you.unique_items[ art - SPWPN_SINGING_SWORD ]);
else if (art >= SPWPN_SWORD_OF_POWER && art <= SPWPN_STAFF_OF_WUCAD_MU)
return (you.unique_items[ art - SPWPN_SWORD_OF_POWER + 24 ]);
return (you.unique_items[art - SPWPN_START_FIXEDARTS]);
if (art >= SPWPN_SINGING_SWORD && art <= SPWPN_SWORD_OF_ZONGULDROK)
you.unique_items[ art - SPWPN_SINGING_SWORD ] = status;
else if (art >= SPWPN_SWORD_OF_POWER && art <= SPWPN_STAFF_OF_WUCAD_MU)
you.unique_items[ art - SPWPN_SWORD_OF_POWER + 24 ] = status;
}
else if (base_type == OBJ_ORBS)
{
if (art >= 4 && art <= 19)
you.unique_items[ art + 3 ] = status;
you.unique_items[art - SPWPN_START_FIXEDARTS] = status;
struct unrandart_entry *unrand = seekunrandart( item );
return (item_type_known(item) ? unrand->name
: unrand->unid_name);
const unrandart_entry *unrand = seekunrandart( item );
return (item_type_known(item) ? unrand->name : unrand->unid_name);
if (unranddata[x].ura_cl == item.base_type
&& unranddata[x].ura_ty == item.sub_type
&& unranddata[x].ura_pl == item.plus
&& unranddata[x].ura_pl2 == item.plus2
&& unranddata[x].ura_col == item.colour)
const unrandart_entry& candidate = unranddata[i];
if (candidate.ura_cl == artefact.base_type
&& candidate.ura_ty == artefact.sub_type
&& candidate.ura_pl == artefact.plus
&& candidate.ura_pl2 == artefact.plus2
&& candidate.ura_col == artefact.colour)
int x;
for(x=0; x < NO_UNRANDARTS; x++)
{
if (unranddata[x].ura_cl == mitm[item_number].base_type
&& unranddata[x].ura_ty == mitm[item_number].sub_type
&& unranddata[x].ura_pl == mitm[item_number].plus
&& unranddata[x].ura_pl2 == mitm[item_number].plus2)
{
return (x);
}
}
return (-1);
const int idx = find_unrandart_index(item);
if ( idx == -1 )
return &unranddata[0]; // dummy unrandart
else
return &unranddata[idx];
if (unranddata[x].ura_cl == aclass
&& !does_unrandart_exist(x)
&& (atype == OBJ_RANDOM || unranddata[x].ura_ty == atype))
if (unranddata[i].ura_cl == aclass
&& !does_unrandart_exist(i)
&& (atype == OBJ_RANDOM || unranddata[i].ura_ty == atype))
// using old behaviour... try only once. -- bwr
force = false;
do {
which = SPWPN_SINGING_SWORD +
random2(SPWPN_STAFF_OF_WUCAD_MU - SPWPN_SINGING_SWORD + 1);
} while ( which == SPWPN_SWORD_OF_CEREBOV ||
which == SPWPN_STAFF_OF_DISPATER ||
which == SPWPN_SCEPTRE_OF_ASMODEUS );
which = SPWPN_START_FIXEDARTS +
random2(SPWPN_START_NOGEN_FIXEDARTS - SPWPN_START_FIXEDARTS);
if (is_fixed_artefact(mitm[dest]))
set_unique_item_status( mitm[dest].base_type, mitm[dest].special,
UNIQ_NOT_EXISTS );
else if (is_unrandom_artefact(mitm[dest]))
if (is_fixed_artefact(item))
{
set_unique_item_status(item.base_type, item.special,
UNIQ_NOT_EXISTS);
}
else if (is_unrandom_artefact(item))
}
}
const char* jewellery_base_ability_string(int subtype)
{
switch(subtype)
{
case RING_REGENERATION: return "Regen";
case RING_SUSTAIN_ABILITIES: return "SustAbil";
case RING_SUSTENANCE: return "-Hun";
case RING_WIZARDRY: return "Wiz";
case RING_FIRE: return "F-Mag";
case RING_ICE: return "I-Mag";
case RING_TELEPORT_CONTROL: return "TC";
case AMU_RESIST_SLOW: return "RSlow";
case AMU_CLARITY: return "Clar";
case AMU_WARDING: return "Ward";
case AMU_RESIST_CORROSION: return "RA";
case AMU_THE_GOURMAND: return "Gourm";
case AMU_CONSERVATION: return "Csrv";
case AMU_CONTROLLED_FLIGHT: return "CFly";
case AMU_RESIST_MUTATION: return "RMut";
{ "AC", RAP_AC, 0 },
{ "EV", RAP_EVASION, 0 },
{ "Str", RAP_STRENGTH, 0 },
{ "Dex", RAP_DEXTERITY, 0 },
{ "Int", RAP_INTELLIGENCE, 0 },
{ "Acc", RAP_ACCURACY, 0 },
{ "Dam", RAP_DAMAGE, 0 },
{ "RF", RAP_FIRE, 1 },
{ "RC", RAP_COLD, 1 },
{ "RE", RAP_ELECTRICITY, 1 },
{ "RP", RAP_POISON, 1 },
{ "RN", RAP_NEGATIVE_ENERGY, 1 },
{ "MP", RAP_MAGICAL_POWER, 0 },
{ "MR", RAP_MAGIC, 2 },
{ "SInv", RAP_EYESIGHT, 2 },
{ "Stl", RAP_STEALTH, 2 },
{ "Ang", RAP_BERSERK, 2 },
{ "Noi", RAP_NOISES, 2 },
{ "-Spl", RAP_PREVENT_SPELLCASTING, 2 },
{ "-Tp", RAP_PREVENT_TELEPORTATION, 2 },
{ "+Tp", RAP_CAUSE_TELEPORTATION, 2 },
{ "Hun", RAP_METABOLISM, 1 },
{ "Mut", RAP_MUTAGENIC, 2 },
{ "Inv", RAP_INVISIBLE, 2 },
{ "Lev", RAP_LEVITATE, 2 },
{ "Blk", RAP_BLINK, 2 },
{ "?Tp", RAP_CAN_TELEPORT, 2 },
{ "Map", RAP_MAPPING, 2 },
};
// 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;
// Positive, quantative attributes
{ "AC", RAP_AC, 0 },
{ "EV", RAP_EVASION, 0 },
{ "Str", RAP_STRENGTH, 0 },
{ "Dex", RAP_DEXTERITY, 0 },
{ "Int", RAP_INTELLIGENCE, 0 },
{ "Acc", RAP_ACCURACY, 0 },
{ "Dam", RAP_DAMAGE, 0 },
case AMU_THE_GOURMAND:
type = "Gourm";
break;
// (Generally) negative attributes
{ "Ang", RAP_BERSERK, 2 },
{ "Noi", RAP_NOISES, 2 },
{ "-Spl", RAP_PREVENT_SPELLCASTING, 2 },
{ "-Tp", RAP_PREVENT_TELEPORTATION, 2 },
{ "+Tp", RAP_CAUSE_TELEPORTATION, 2 },
{ "Hun", RAP_METABOLISM, 1 },
{ "Mut", RAP_MUTAGENIC, 2 },
case AMU_RESIST_MUTATION:
type = "RMut";
break;
}
if (type != "")
// For randart jewellery, note the base jewellery type if it's not
// covered by randart_desc_properties()
if (item.base_type == OBJ_JEWELLERY
&& item_ident(item, ISFLAG_KNOW_PROPERTIES))
{
const std::string type = jewellery_base_ability_string(item.sub_type);
if ( !type.empty() )
// OK, technically inefficient to call randart_auto_inscription
// when we don't need to.
std::string ainscrip;
if (is_random_artefact(item))
ainscrip = randart_auto_inscription(item);
// Only allow autoinscription if we don't have all the text
// already.
is_random_artefact(item) &&
(randart_auto_inscription(item) != "") &&
(item.inscription.find(randart_auto_inscription(item))
== std::string::npos);
is_random_artefact(item)
&& !ainscrip.empty()
&& item.inscription.find(ainscrip) == std::string::npos;