Disenchant resist should block charge draining
Posted: Thu 14.11.2013, 15:46
...because seriously, dying to something because your teleport(or destruct, or banish, or what have you) staff got drained is not ok.
The message "Energy drains from your pack" is very easy to overlook in a realtime variant where new messages constantly flow in during combat, and often, you'll only notice it when you're trying to use the staff and failing.
So, let's get that into melee1.c.
Yes, my coding knowledge Is atrocious, and I copied the disenchant clause from the previous entry(unbonus) and tried to apply it to unpower too.
Just... make it so I no longer die for reasons I won't be aware of until it's too late, please.
The message "Energy drains from your pack" is very easy to overlook in a realtime variant where new messages constantly flow in during combat, and often, you'll only notice it when you're trying to use the staff and failing.
Code: Select all
/* Allow disenchant resist to block charge draining */
if (!p_ptr->resist_disen)
{
/* Find an item */
for (k = 0; k < 10; k++)
{
/* Pick an item */
i = rand_int(INVEN_PACK);
/* Obtain the item */
o_ptr = &p_ptr->inventory[i];
/* Drain charged wands/staffs */
if (((o_ptr->tval == TV_STAFF) ||
(o_ptr->tval == TV_WAND)) &&
(o_ptr->pval))
{
/* Message */
msg_print(Ind, "Energy drains from your pack!");
/* Obvious */
obvious = TRUE;
/* Heal */
j = rlev;
m_ptr->hp += j * o_ptr->pval * o_ptr->number;
if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
/* Redraw (later) if needed */
update_health(m_idx);
/* Uncharge */
o_ptr->pval = 0;
/* Combine / Reorder the pack */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
/* Done */
break;
}
}
Yes, my coding knowledge Is atrocious, and I copied the disenchant clause from the previous entry(unbonus) and tried to apply it to unpower too.
Just... make it so I no longer die for reasons I won't be aware of until it's too late, please.