?recharging, ?enchant armour and ?identify.
If you read one of these scrolls and the type isn't known yet you are prompted with "Modify which item?" (better message needed!) and get to choose from the entire inventory. If the chosen item can be usefully "modified" by the scroll (unID'd item for identify, wand for recharging, enchantable armour for EA) the usual effect takes place and the scroll is identified. (Reading other scrolls of the same type will then only offer a more sensible selection of items.) Otherwise, nothing happens.
Further, recharging and enchant armour now allow direct choice of the item in question, and it doesn't even have to be wielded or worn.
I think this change actually makes the id game more interesting and also improves the interface. Gameplay might dictate that we reintroduce the "armour needs to be worn" rule, but that remains to be seen until after some more playtesting.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3514 c06c8d41-db1a-0410-9941-cceddc491573
MDAJYB6STTZPNHRQ2X66MMMSONMKXTESLHJSFPGN7H3D3TOVBAVAC
6JBULLXOSQVDJZP2R73BFMPV2OHWFT4V3KBPU5CTGN7REHBOB5NQC
XDHIIBQZLHLXAHIPJMXWH3FJ2X5PO7IB7HXQMVZDWM5JZFAG3HAQC
KX6HOBTF5OBZLH2VNEFHH6YAX66FSE6JGBY5I2WIAW5IEJUGNL6AC
CE6FLTWU5PYFBSGVTIJXQXRMHOIHQ3VJCKHQVIMUUAIFHQ73X7NAC
KZIHM6RUX43HHKXG6HGJHVEEYUPVVNBFIWMT4SKPD2GAH5ZMA3KAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
BWAQ3FHBBM6G3K3KYP75CRTR343RDQZJRYX5ZGYUEXYBAC3APDLAC
XS4OT3JJKMXJIOMIGSSHIE4IOV2EXKFFELHEU7J2C2B7PKAP4V4QC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
6ZZO2QBB46RZM6OXVS7OIKC5M3SEAULSSJFXW5PJG556JDKKUHWAC
CIPVRZGLOZHCERK6YPOBV3P2E4IAB4H6D5EHLRQE2O5E4P4VCBUAC
25CH7HH4LKXFIZ75YNMXS3TSXO6O27DYSOPLOD45K4OCNFWLS4LQC
OQ4KB7QCJSK7GSW3DYBARH4DCB75HFKLUSOSOZZZ4IUFKNGFRUDQC
77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC
SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC
P2YNOE2TUTZFAOBTHJOIVD6TCV7J7D2UKUX67LHZUL6QY44ZMENQC
TV3ZC6WOZKSQQJQN26JIVKCHK6UK7WMDBYZDUYRWEAZ4JB4YVNAAC
M7UBBA4B6VWC4UDEJWOYB3VW7QCLRKJHOKVRJE6JFZW3JSMQCYTAC
item_slot = prompt_invent_item( "Identify which item?", MT_INVLIST,
OSEL_UNIDENT, true, true, false );
if (item_slot == -1)
item_slot = prompt_invent_item( "Identify which item?", MT_INVLIST,
OSEL_UNIDENT, true, true, false );
// ... but electro-weapons can also be charged
return ( it.base_type == OBJ_WEAPONS
&& !is_random_artefact( it )
&& !is_fixed_artefact( it )
&& get_weapon_brand( it ) == SPWPN_ELECTROCUTION
&& (!known || item_type_known(it)) );
}
bool is_enchantable_armour(const item_def &arm, bool uncurse)
{
if (arm.base_type != OBJ_ARMOUR)
return (false);
// only equipped items should be affected
// if (!item_is_equipped(arm))
// return (false);
// artefacts cannot be enchanted
if (is_fixed_artefact( arm )
|| is_random_artefact( arm ))
{
return (uncurse && item_cursed( arm )); // ?EA may uncurse artefacts
}
// Nor can highly enchanted items
if ( arm.plus >= 2
&& (arm.sub_type >= ARM_CLOAK && arm.sub_type <= ARM_BOOTS
|| is_shield(arm)) )
{
return (uncurse && item_cursed( arm )); // ?EA may uncurse item
}
return (true);
}
// NOTE: It is assumed that armour which changes in this way does
// not change into a form of armour with a different evasion modifier.
int nthing = you.equip[EQ_BODY_ARMOUR];
if (item_slot == -1)
item_slot = prompt_invent_item( "Enchant which item?", MT_INVLIST,
OSEL_ENCH_ARM, true, true, false );
if (nthing != -1
&& (you.inv[nthing].sub_type == ARM_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_ICE_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_STEAM_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_MOTTLED_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_STORM_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_GOLD_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_SWAMP_DRAGON_HIDE
|| you.inv[nthing].sub_type == ARM_TROLL_HIDE))
if (item_slot == PROMPT_ABORT)
hide2armour(you.inv[nthing]);
return (true);
// cannot be enchanted nor uncursed
if (!is_enchantable_armour(arm, true))
{
canned_msg( MSG_NOTHING_HAPPENS );
return (false);
// pick random piece of armour
int count = 0;
int affected_slot = EQ_WEAPON;
for (int i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++)
bool is_cursed = item_cursed(arm);
// Turn hides into mails where applicable.
// NOTE: It is assumed that armour which changes in this way does
// not change into a form of armour with a different evasion modifier.
if (arm.sub_type == ARM_DRAGON_HIDE
|| arm.sub_type == ARM_ICE_DRAGON_HIDE
|| arm.sub_type == ARM_STEAM_DRAGON_HIDE
|| arm.sub_type == ARM_MOTTLED_DRAGON_HIDE
|| arm.sub_type == ARM_STORM_DRAGON_HIDE
|| arm.sub_type == ARM_GOLD_DRAGON_HIDE
|| arm.sub_type == ARM_SWAMP_DRAGON_HIDE
|| arm.sub_type == ARM_TROLL_HIDE)
if (is_random_artefact( item )
|| ((item.sub_type >= ARM_CLOAK && item.sub_type <= ARM_BOOTS)
&& item.plus >= 2)
|| ((item.sub_type == ARM_SHIELD
|| item.sub_type == ARM_BUCKLER
|| item.sub_type == ARM_LARGE_SHIELD)
&& item.plus >= 2)
|| (item.plus >= 3 && random2(8) < item.plus))
{
affected = false;
// no additional enchantment
return (true);
// returns true if the scroll had an obvious effect and should be identified
static bool scroll_modify_item(const scroll_type scroll)
{
int item_slot = prompt_invent_item( "Modify which item?", MT_INVLIST,
OSEL_ANY, true, true, false );
if (item_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
return (false);
}
item_def &item = you.inv[item_slot];
switch (scroll)
{
case SCR_IDENTIFY:
if ( !fully_identified(item) )
{
mpr("This is a scroll of identify!");
identify(-1, item_slot);
return (true);
}
break;
case SCR_RECHARGING:
if (item_is_rechargable(item))
{
mpr("This is a scroll of recharging!");
recharge_wand(item_slot);
return (true);
}
case SCR_ENCHANT_ARMOUR:
if (is_enchantable_armour(item, true))
{
// might still fail because of already high enchantment
if (enchant_armour(item_slot))
return (true);
return (false);
}
default:
break;
}
// Oops, wrong item...
canned_msg(MSG_NOTHING_HAPPENS);
return (false);
}
const int scroll_type = scroll.sub_type;
if (scroll_type != SCR_PAPER &&
(scroll_type != SCR_IMMOLATION || you.duration[DUR_CONF]))
const scroll_type which_scroll = static_cast<scroll_type>(scroll.sub_type);
if (which_scroll != SCR_PAPER &&
(which_scroll != SCR_IMMOLATION || you.duration[DUR_CONF]))
break;
case SCR_IDENTIFY:
if ( !item_type_known(scroll) )
{
mpr("This is a scroll of identify!");
more();
}
set_ident_flags( you.inv[item_slot], ISFLAG_IDENT_MASK );
// important {dlb}
set_ident_type( OBJ_SCROLLS, SCR_IDENTIFY, ID_KNOWN_TYPE );
identify(-1);
you.wield_change = true;
if (nthing != -1
&& !is_random_artefact( you.inv[nthing] )
&& !is_fixed_artefact( you.inv[nthing] )
&& get_weapon_brand( you.inv[nthing] ) == SPWPN_ELECTROCUTION)
{
id_the_scroll = enchant_weapon( ENCHANT_TO_DAM );
if (!item_ident(you.inv[nthing], ISFLAG_KNOW_TYPE))
{
if (item_type_known(scroll))
set_ident_flags(you.inv[nthing], ISFLAG_KNOW_TYPE);
else
id_the_scroll = false;
}
break;
}
if (!recharge_wand())
{
canned_msg(MSG_NOTHING_HAPPENS);
id_the_scroll = false;
}
case SCR_RECHARGING:
if ( !item_type_known(scroll) )
id_the_scroll = scroll_modify_item(which_scroll);
else
recharge_wand(-1);
item_def &wand = you.inv[ you.equip[EQ_WEAPON] ];
item_def &wand = you.inv[ item_slot ];
if (wand.base_type == OBJ_WEAPONS
&& !is_random_artefact( wand )
&& !is_fixed_artefact( wand )
&& get_weapon_brand( wand ) == SPWPN_ELECTROCUTION)
{
// might fail because of already high enchantment
if (enchant_weapon( ENCHANT_TO_DAM, false, item_slot ))
{
you.wield_change = true;
if (!item_ident(wand, ISFLAG_KNOW_TYPE))
set_ident_flags(wand, ISFLAG_KNOW_TYPE);
return (true);
}
return (false);
}