output AC/EV and damage/accuracy/speed for armour and weapons, respectively.
Also, you can now wish for specific fixed and randarts in wizard mode via the 'o' command. (I was getting annoyed at always having to create all of them whenever I wanted to play around with the Singing Sword.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7048 c06c8d41-db1a-0410-9941-cceddc491573
HNPSSHGZFQ3E2I6X6VTKZ3WBBM2G25P2D7SIL2SZYKV2CCEA2ADAC
KREJDNTBEVLQEMRCVOIVYELCJJDKB44YPCYP4LSK6BPTQH2FZSHAC
YFIVTYI7PMVAXV23DUPXPAQNEY3YSFIXQGSN32I3WVHMMD5XS5DQC
4JHALUQLYAZQSH6MHLCS4EIIRHIT3Y4IYT2CE66NHSSWZFZY3SZQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
6UPCB64Z2W243QR3JQD7WPQMPVNVBPYRG7GTGZK6LTKKBBSKBHZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
XKAJWK6MPHS3ZCZIPPLTIMOPF6AROGLRDDCS6EFE3IGE4AHT7MYQC
UWI3ZNJDRQRL7CXFNFEG46TA6SAK24XUFY5YOKVOTJA3VG3OBNFAC
TGKAO3VB562WPSNRDP2MHE6FGMIB75A6254APKTIPCO6DHLCFCZAC
GL7TJGUGV4JPLZCDWH6QVST4RYW7UJV6IP7UAEWEKNBWJO2H2ZHAC
2OQFLBVWCTXCWUPSDM76KNXTNC3YPAKRI5KLDAEU4KQLN4DEOLYQC
MNYDF64QY6NHYKOAFOGBQJFYU7TZDILXRV23EXJPN4IZOCLSJ2AQC
WLX2RQMMOMP2PYPAGJRM4VFD2WTLJTOAZZPPY3MV76FU2EGEJ54QC
34C4U6EQWERY75GZJKUCM5KVGU2OUICETS5LGZF6RMKMZT4R5SQAC
J5AAA4LUTW6PLS2DBKGTXPSW2SGOBMICEOA3VDHRSKVLU36EGQMAC
7YUGK5Q64KG5O7GJGTUBRRLHAHBCJ5YOE23YUPT6UBKUSB67CYAQC
5KJCHLIUFKRPMIVWUAYT6EOF7SW4PTQF6Y5OPEFWXGLE7DUGYLZAC
T7CUIVICB74342RA32BR37T36FOX4RBSQIB5PNOHTGTGUYGDKSTQC
SQDS2YBPOYDDDCW3GGARBZ2HQIUHCQKL7SSHKFQWDENOL5YNNVNQC
CIPVRZGLOZHCERK6YPOBV3P2E4IAB4H6D5EHLRQE2O5E4P4VCBUAC
4GYZYBY7FFORRNPIEFTV4ZM2C7Z6D2KTQOM537ZCC2YBXT2TNSHAC
LOAF3UOCD7BGVGFWA5IPJT55URGZSKJJDMUIP6CN2VVWM5UHWTBQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
BDFIS53HAIHOCXQ5BE7WCO2MEOFCUQPFY4JGUWVLWY6JO3IFMEKQC
UWMN4HLG6YA2YFQEVIVMDISD6APKEPIZXMMPMNUYCBQDSAUYSXPQC
RNJX2RDBDA62DSAUIWVVPFS7YNIU3GEOXDWJUABDS5DS5QGS3LAQC
Q3XHNSHW6FI4JCXSEABATRFBJPMCF7PXNG2K6ZQTRRPVMIZFHUBQC
QCUMH3C7GXV7ZW444WT5SFAXQOJKJSE2YCQCEHMRYXCWF4QI7UMAC
RQR4PTMGQLTRWLYRU3KXIIDGND7FBORESJWMWFVD3WYU5SISZXAAC
M2HMYLYYXSP5XGX6MCI77IT6UW5K4YSEUJWHPQPYXVSW5L36BJ2AC
TGJZXTUIAKCFZQJ54ZQEBGFBVZSJCAX6AWDRSH3TP7UJRLGUM5SAC
LTFWXACXWTSFJNSVDFCMC4IJBHUERV6DNCKIECIMRXG2M2U3TYJAC
ZIFFVCQ72K35WGIUMZYN3KOXIUXF2CNXWKG6ZWEZ6LT3NSF3XOQAC
DF5LOTJFSXOT7UBDHLBDLGA22OY4L7ZF6CVFP6H3KL4N5CHB5C5QC
/* ***********************************************************************
* called from: command
* *********************************************************************** */
void append_weapon_stats(std::string &description, const item_def &item);
void append_armour_stats(std::string &description, const item_def &item);
{
description += "$Damage rating: ";
_append_value(description, property( item, PWPN_DAMAGE ), false);
description += " ";
description += "Accuracy rating: ";
_append_value(description, property( item, PWPN_HIT ), true);
description += " ";
description += "Base attack delay: ";
_append_value(description, property( item, PWPN_SPEED ) * 10, false);
description += "%";
}
append_weapon_stats(description, item);
description += "$Armour rating: ";
_append_value(description, property( item, PARM_AC ), false);
description += " ";
description += "Evasion modifier: ";
_append_value(description, property( item, PARM_EVASION ), true);
append_armour_stats(description, item);
static int max_subtype[] =
{
NUM_WEAPONS,
NUM_MISSILES,
NUM_ARMOURS,
NUM_WANDS,
NUM_FOODS,
0, // unknown I
NUM_SCROLLS,
NUM_JEWELLERY,
NUM_POTIONS,
0, // unknown II
NUM_BOOKS,
NUM_STAVES,
0, // Orbs -- only one, handled specially
NUM_MISCELLANY,
0, // corpses -- handled specially
0, // gold -- handled specially
0, // "gemstones" -- no items of type
};
}
// Deck colour (which control rarity) already set.
if (!is_deck(mitm[thing_created]))
item_colour( mitm[thing_created] );
move_item_to_grid( &thing_created, you.pos() );
if (thing_created != NON_ITEM)
{
// orig_monnum is used in corpses for things like the Animate
// Dead spell, so leave it alone.
if (class_wanted != OBJ_CORPSES)
origin_acquired( mitm[thing_created], AQ_WIZMODE );
canned_msg( MSG_SOMETHING_APPEARS );
}
}
#endif
bool get_item_by_name(item_def *item, char* specs,
object_class_type class_wanted, bool create_for_real)
{
static int max_subtype[] =
{
NUM_WEAPONS,
NUM_MISSILES,
NUM_ARMOURS,
NUM_WANDS,
NUM_FOODS,
0, // unknown I
NUM_SCROLLS,
NUM_JEWELLERY,
NUM_POTIONS,
0, // unknown II
NUM_BOOKS,
NUM_STAVES,
0, // Orbs -- only one, handled specially
NUM_MISCELLANY,
0, // corpses -- handled specially
0, // gold -- handled specially
0, // "gemstones" -- no items of type
};
// In order to get the sub-type, we'll fill out the base type...
// then we're going to iterate over all possible subtype values
// and see if we get a winner. -- bwr
mitm[thing_created].base_type = class_wanted;
mitm[thing_created].sub_type = 0;
mitm[thing_created].plus = 0;
mitm[thing_created].plus2 = 0;
mitm[thing_created].special = 0;
mitm[thing_created].flags = 0;
mitm[thing_created].quantity = 1;
set_ident_flags( mitm[thing_created], ISFLAG_IDENT_MASK );
char obj_name[ ITEMNAME_SIZE ];
char* ptr;
int i;
int best_index;
int type_wanted = -1;
int special_wanted = 0;
// In order to get the sub-type, we'll fill out the base type...
// then we're going to iterate over all possible subtype values
// and see if we get a winner. -- bwr
item->base_type = class_wanted;
item->sub_type = 0;
item->plus = 0;
item->plus2 = 0;
item->special = 0;
item->flags = 0;
item->quantity = 1;
set_ident_flags( *item, ISFLAG_IDENT_MASK );
if (class_wanted == OBJ_MISCELLANY)
{
// Leaves object unmodified if it wasn't a rune or deck.
_rune_or_deck_from_specs(specs, *item);
if (item->base_type == OBJ_UNASSIGNED)
{
// Rune or deck creation canceled, clean up item->
return (false);
}
}
// Rune or deck creation canceled, clean up item.
destroy_item(thing_created);
return;
// Earliest match is the winner.
if (ptr - obj_name < best_index)
{
mpr( obj_name );
type_wanted = i;
best_index = ptr - obj_name;
}
mitm[thing_created].sub_type = i;
strcpy(obj_name,mitm[thing_created].name(DESC_PLAIN).c_str());
// Try for fixed artefacts matching the name.
unique_item_status_type exists;
for (unsigned which = SPWPN_START_FIXEDARTS;
which <= SPWPN_END_FIXEDARTS; which++)
{
exists = get_unique_item_status(OBJ_WEAPONS, which);
make_item_fixed_artefact(*item, false, which);
strcpy(obj_name, item->name(DESC_PLAIN).c_str());
ptr = strstr( strlwr(obj_name), specs );
if (ptr != NULL)
{
// Earliest match is the winner.
if (ptr - obj_name < best_index)
ptr = strstr( strlwr(obj_name), specs );
if (ptr != NULL)
{
if (create_for_real)
mpr( obj_name );
return(true);
}
else
mpr( obj_name );
type_wanted = i;
best_index = ptr - obj_name;
set_unique_item_status(OBJ_WEAPONS, which, exists);
do_uncurse_item(*item);
item->props.clear();
if (_book_from_spell(specs, mitm[thing_created]))
type_wanted = mitm[thing_created].sub_type;
}
bool exists;
for (int unrand = 0; unrand < NO_UNRANDARTS; unrand++)
{
exists = does_unrandart_exist( unrand );
make_item_unrandart(*item, unrand);
strcpy(obj_name, item->name(DESC_PLAIN).c_str());
if (type_wanted == -1)
{
// ds -- If specs is a valid int, try using that.
// Since zero is atoi's copout, the wizard
// must enter (subtype + 1).
if (!(type_wanted = atoi(specs)))
{
mpr( "No such item." );
ptr = strstr( strlwr(obj_name), specs );
if (ptr != NULL && item->base_type == class_wanted)
{
if (create_for_real)
mpr( obj_name );
return(true);
}
// Clean up item
destroy_item(thing_created);
return;
set_unrandart_exist(unrand, exists);
do_uncurse_item(*item);
item->props.clear();
case OBJ_MISSILES:
mitm[thing_created].quantity = 30;
// intentional fall-through
case OBJ_WEAPONS:
case OBJ_ARMOUR:
mpr( "What ego type? ", MSGCH_PROMPT );
get_input_line( specs, sizeof( specs ) );
// ds -- If specs is a valid int, try using that.
// Since zero is atoi's copout, the wizard
// must enter (subtype + 1).
if (!(type_wanted = atoi(specs)))
return (false);
type_wanted--;
ptr = strstr( strlwr(obj_name), strlwr(specs) );
if (ptr != NULL)
{
// earliest match is the winner
if (ptr - obj_name < best_index)
{
mpr( obj_name );
special_wanted = i;
best_index = ptr - obj_name;
}
}
}
switch (item->base_type)
{
case OBJ_MISSILES:
item->quantity = 30;
// intentional fall-through
case OBJ_WEAPONS:
case OBJ_ARMOUR:
mpr( "What ego type? ", MSGCH_PROMPT );
get_input_line( specs, sizeof( specs ) );
mitm[thing_created].plus = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
mitm[thing_created].plus2 = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
item->plus = special_wanted;
item->plus2 = 3 + random2(15);
break;
else
mpr( "Sorry, no books on that skill today." );
}
break;
case OBJ_WANDS:
item->plus = 24;
break;
case OBJ_STAVES:
if (item_is_rod(*item))
{
item->plus = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
item->plus2 = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
}
break;
case OBJ_MISCELLANY:
if (!is_rune(*item) && !is_deck(*item))
item->plus = 50;
break;
case OBJ_MISCELLANY:
if (!is_rune(mitm[thing_created]) && !is_deck(mitm[thing_created]))
mitm[thing_created].plus = 50;
break;
case OBJ_POTIONS:
item->quantity = 12;
if (is_blood_potion(*item))
init_stack_blood_potions(*item);
break;
case OBJ_POTIONS:
mitm[thing_created].quantity = 12;
if (is_blood_potion(mitm[thing_created]))
init_stack_blood_potions(mitm[thing_created]);
break;
case OBJ_FOOD:
case OBJ_SCROLLS:
item->quantity = 12;
break;
case OBJ_FOOD:
case OBJ_SCROLLS:
mitm[thing_created].quantity = 12;
case OBJ_JEWELLERY:
if (jewellery_is_amulet(*item))
case OBJ_JEWELLERY:
if (jewellery_is_amulet(mitm[thing_created]))
break;
switch(mitm[thing_created].sub_type)
{
case RING_SLAYING:
mitm[thing_created].plus2 = 5;
// intentional fall-through
case RING_PROTECTION:
case RING_EVASION:
case RING_STRENGTH:
case RING_DEXTERITY:
case RING_INTELLIGENCE:
mitm[thing_created].plus = 5;
default:
break;
}
switch(item->sub_type)
{
case RING_SLAYING:
item->plus2 = 5;
// intentional fall-through
case RING_PROTECTION:
case RING_EVASION:
case RING_STRENGTH:
case RING_DEXTERITY:
case RING_INTELLIGENCE:
item->plus = 5;
// Deck colour (which control rarity) already set
if (!is_deck(mitm[thing_created]))
item_colour( mitm[thing_created] );
move_item_to_grid( &thing_created, you.pos() );
default:
break;
}
if (thing_created != NON_ITEM)
{
// orig_monnum is used in corpses for things like the Animate
// Dead spell, so leave it alone.
if (class_wanted != OBJ_CORPSES)
origin_acquired( mitm[thing_created], AQ_WIZMODE );
canned_msg( MSG_SOMETHING_APPEARS );
}
return (true);
else
{
int thing_created = get_item_slot();
if (thing_created != NON_ITEM)
{
char name[80];
snprintf(name, 80, key.c_str());
if (get_item_by_name(&mitm[thing_created], name, OBJ_WEAPONS))
{
append_weapon_stats(desc, mitm[thing_created]);
desc += "$";
}
else if (get_item_by_name(&mitm[thing_created], name, OBJ_ARMOUR))
{
append_armour_stats(desc, mitm[thing_created]);
desc += "$";
}
// Now we don't need the item anymore.
destroy_item(thing_created);
}
}