* One charge of one staff disappears.
* Hack -- staffs of identify can be "cancelled".
*/
-void exe_use_staff(INVENTORY_IDX item)
+void exe_use_staff(player_type *creature_ptr, INVENTORY_IDX item)
{
int ident, chance, lev;
object_type *o_ptr;
/* Hack -- let staffs of identify get aborted */
bool use_charge = TRUE;
- o_ptr = REF_ITEM(p_ptr, current_floor_ptr, item);
+ o_ptr = REF_ITEM(creature_ptr, current_floor_ptr, item);
/* Mega-Hack -- refuse to use a pile from the ground */
if ((item < 0) && (o_ptr->number > 1))
}
- take_turn(p_ptr, 100);
+ take_turn(creature_ptr, 100);
lev = k_info[o_ptr->k_idx].level;
if (lev > 50) lev = 50 + (lev - 50) / 2;
/* Base chance of success */
- chance = p_ptr->skill_dev;
+ chance = creature_ptr->skill_dev;
/* Confusion hurts skill */
- if (p_ptr->confused) chance = chance / 2;
+ if (creature_ptr->confused) chance = chance / 2;
/* Hight level objects are harder */
chance = chance - lev;
chance = USE_DEVICE;
}
- if (cmd_limit_time_walk(p_ptr)) return;
+ if (cmd_limit_time_walk(creature_ptr)) return;
/* Roll for usage */
- if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
+ if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (creature_ptr->pclass == CLASS_BERSERKER))
{
if (flush_failure) flush();
msg_print(_("杖をうまく使えなかった。", "You failed to use the staff properly."));
if (flush_failure) flush();
msg_print(_("この杖にはもう魔力が残っていない。", "The staff has no charges left."));
o_ptr->ident |= (IDENT_EMPTY);
- p_ptr->update |= (PU_COMBINE | PU_REORDER);
- p_ptr->window |= (PW_INVEN);
+ creature_ptr->update |= (PU_COMBINE | PU_REORDER);
+ creature_ptr->window |= (PW_INVEN);
return;
}
if (!(object_is_aware(o_ptr)))
{
- chg_virtue(p_ptr, V_PATIENCE, -1);
- chg_virtue(p_ptr, V_CHANCE, 1);
- chg_virtue(p_ptr, V_KNOWLEDGE, -1);
+ chg_virtue(creature_ptr, V_PATIENCE, -1);
+ chg_virtue(creature_ptr, V_CHANCE, 1);
+ chg_virtue(creature_ptr, V_KNOWLEDGE, -1);
}
- p_ptr->update |= (PU_COMBINE | PU_REORDER);
+ creature_ptr->update |= (PU_COMBINE | PU_REORDER);
/* Tried the item */
object_tried(o_ptr);
if (ident && !object_is_aware(o_ptr))
{
object_aware(o_ptr);
- gain_exp(p_ptr, (lev + (p_ptr->lev >> 1)) / p_ptr->lev);
+ gain_exp(creature_ptr, (lev + (creature_ptr->lev >> 1)) / creature_ptr->lev);
}
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
/* Hack -- some uses are "free" */
/* Unstack the used item */
o_ptr->number--;
- p_ptr->total_weight -= q_ptr->weight;
+ creature_ptr->total_weight -= q_ptr->weight;
item = inven_carry(q_ptr);
msg_print(_("杖をまとめなおした。", "You unstack your staff."));
s = _("使える杖がない。", "You have no staff to use.");
if (!choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), TV_STAFF)) return;
- exe_use_staff(item);
+ exe_use_staff(p_ptr, item);
}