armour/recharging on armour that cannot be enchanted or items that cannot be recharged, respectively.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8337 c06c8d41-db1a-0410-9941-cceddc491573
Q2LPHU5H37HYN24G42JF4T3MXLEULG2NXKMD2WGDNYE5UBR56SHQC
JVFPF4MBNVY2UEXPWJDKTWL6RY7WCXPB6GBOK3WPJOGM6CX3D7HQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
CB7U6IEEN2Z74672EYQQHWTB4GXVNNMAYDRQYAGY6K3QSDYYEHYAC
OO5PVQJ7B3HMIV46B5BIEKJNBZHQSXL3DJOGINRLLSTGSM67KYZAC
MDAJYB6STTZPNHRQ2X66MMMSONMKXTESLHJSFPGN7H3D3TOVBAVAC
QLEBDRVUQ3BMCT7LV4EBPG7T5X4KMQJAVLMLHHB7DRCNNGDQBRNQC
FLAGBNUNSIQNFDN53CDWABJRTTFWDL4PG34AI474ZKPXDEPYHOAQC
CL7GSN76SHFJA7SAHJMLN4K5ALWGSF6UFI2QTM4Y5W7WKBAZQP2AC
AZ2RCXNVULJUSCBDBK3VARTUCTPEJXHTA7ALP73S4EXLJB6YYB5QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SG76BPJKTQGDFNP5QFMAVR6H72FMMAYCECVGSWWSCLMAVQX7E3FQC
JZTWTPXIUEVACX5B6FYQRVRJD3KQN653C4G4GXT2VSMX4EP7WS3AC
4QRLZDW4KBFG34B3MCG4375NHFR3WKWSLWQKRMQ3OE5R26WCZBBQC
WFIA2XFIWZF3XVLH52GC57XK7A6ECI3K6P7GRZSHPIUBX66OF3OQC
GSYPPGYTKWGWXFP7ZMNGDUA4M4HHQA5LT7WKJF2BUMLOWTODHD4QC
6CWMT6I76TMTHT7BVOVZJ7ATDMZ3VBKKICIRRZBOSGLHJMDS2DWQC
4PM7YVPELDFA6GYVBXNBNR5WY7IVYOFPQSXJ4CLIT4RT3QHM3BCAC
FEKRY3DYIDLWVBLAZN7W2WFNEKZPCAHABXOSM6K5RLTH5WY2NODQC
ZGUJWUFJ4NFFJ6PGXLFGQWCWBCZHPWGWI44NJHJEVPRG5L36PADQC
KNCEMOC5TMWHTKCWF7CMYNHLGCXOLGMTXLEIHMEFBGM5FR26GRXAC
4ZAYR6K7SNJ45QYS5KLZOJ2T7OKYL4M2RY5UIIMOWRQGZLTME6UQC
VEPHAIXR3GSPHBLOW5DWFFU4ULEMVWRQG4G5PKSKRA2I6RHYROUAC
T4IGWVUK5K3UTQOGRGHPS6DQE2ZDF5A6V42Z3EJ6TWKYDAYDMA7AC
XNSBXTNKIHKTFUAAVT2H6Y2DCJVVS57CN4E7645OSSC5SKAI2QHAC
2TZT4GURBCNHSVOXO5ZMN7XEIO3K4GWJCDPVSYUCMVZ6UFDL4DIQC
AS44S4DVL3XJD5P6PQXTBWF5XZSXQJTRBWLAVIKGFMBX4ZRL2UTAC
CIPVRZGLOZHCERK6YPOBV3P2E4IAB4H6D5EHLRQE2O5E4P4VCBUAC
RBAGQ2PB7V5YAM5KSHSZR2E3MLKDSRVM5XYGI2TIXP5QMVBOQHDQC
// If known is true, only returns true for *known* weapons of electrocution,
// and returns false for wands/rods known to be fully charged.
bool item_is_rechargeable(const item_def &it, bool known)
// Returns whether a wand or rod can be charged, or a weapon of electrocution
// enchanted.
// If unknown is true, wands with unknown charges and weapons with unknown
// brand will also return true.
// If hide_charged is true, wands known to be full will return false.
// (This distinction is necessary because even full wands/rods give a message.)
bool item_is_rechargeable(const item_def &it, bool unknown, bool hide_charged)
if (known && (it.plus2 == ZAPCOUNT_MAX_CHARGED
|| item_ident(it, ISFLAG_KNOW_PLUSES)
&& it.plus >= 3 * wand_charge_value(it.sub_type)))
if (it.plus2 == ZAPCOUNT_MAX_CHARGED
|| item_ident(it, ISFLAG_KNOW_PLUSES)
&& it.plus >= 3 * wand_charge_value(it.sub_type))
item_slot = prompt_invent_item("Enchant which item?", MT_INVLIST,
OSEL_ENCH_ARM, true, true, false);
}
if (item_slot == -1)
{
item_slot = prompt_invent_item("Enchant which item?", MT_INVLIST,
OSEL_ENCH_ARM, true, true, false);
}
if (prompt_failed(item_slot))
return (false);
item_slot = prompt_invent_item( "Charge which item?", MT_INVLIST,
OSEL_RECHARGE, true, true, false );
}
if (item_slot == -1)
{
item_slot = prompt_invent_item( "Charge which item?", MT_INVLIST,
OSEL_RECHARGE, true, true, false );
}
if (prompt_failed(item_slot))
return (false);
// Weapons of electrocution can be "charged", i.e. gain +1 damage.
if (wand.base_type == OBJ_WEAPONS
&& get_weapon_brand(wand) == SPWPN_ELECTROCUTION)
{
// Might fail because of already high enchantment.
if (enchant_weapon( ENCHANT_TO_DAM, false, wand ))
// Weapons of electrocution can be "charged", i.e. gain +1 damage.
if (wand.base_type == OBJ_WEAPONS
&& get_weapon_brand(wand) == SPWPN_ELECTROCUTION)
int charge_gain = 0;
if (wand.base_type == OBJ_WANDS)
{
charge_gain = wand_charge_value(wand.sub_type);
int charge_gain = 0;
if (wand.base_type == OBJ_WANDS)
{
charge_gain = wand_charge_value(wand.sub_type);
const int new_charges =
std::max<int>(
wand.plus,
std::min(charge_gain * 3,
wand.plus +
1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 )));
const int new_charges =
std::max<int>(
wand.plus,
std::min(charge_gain * 3,
wand.plus +
1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 )));
std::string desc;
if (charged && item_ident(wand, ISFLAG_KNOW_PLUSES))
{
snprintf(info, INFO_SIZE, " and now has %d charges", new_charges);
desc = info;
std::string desc;
if (charged && item_ident(wand, ISFLAG_KNOW_PLUSES))
{
snprintf(info, INFO_SIZE, " and now has %d charges", new_charges);
desc = info;
}
mprf("%s %s for a moment%s.",
wand.name(DESC_CAP_YOUR).c_str(),
charged? "glows" : "flickers",
desc.c_str());
wand.plus = new_charges;
if (!charged)
wand.plus2 = ZAPCOUNT_MAX_CHARGED;
if (!charged)
wand.plus2 = ZAPCOUNT_MAX_CHARGED;
}
else // It's a rod.
{
bool work = false;
if (wand.plus2 > MAX_ROD_CHARGE * ROD_CHARGE_MULT)
wand.plus2 = MAX_ROD_CHARGE * ROD_CHARGE_MULT;