OSDN Git Service

82bf1392ed3a6bc1c08975645b426292c58dc4e1
[hengband/hengband.git] / src / cmd-item.c
1 /*!
2  *  @file cmd3.c
3  *  @brief プレイヤーのアイテムに関するコマンドの実装1 / Inventory commands
4  *  @date 2014/01/02
5  *  @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research,
9  * and not for profit purposes provided that this copyright and statement
10  * are included in all such copies.  Other copyrights may also apply.
11  */
12
13
14 #include "angband.h"
15 #include "core.h"
16 #include "util.h"
17 #include "autopick.h"
18 #include "term.h"
19
20 #include "selfinfo.h"
21 #include "cmd-activate.h"
22 #include "cmd-eat.h"
23 #include "cmd-quaff.h"
24 #include "cmd-read.h"
25 #include "cmd-usestaff.h"
26 #include "cmd-zaprod.h"
27 #include "cmd-zapwand.h"
28 #include "cmd-pet.h"
29 #include "cmd-basic.h"
30
31 #include "object-flavor.h"
32 #include "object-hook.h"
33 #include "object-ego.h"
34 #include "sort.h"
35 #include "quest.h"
36 #include "artifact.h"
37 #include "avatar.h"
38 #include "player-status.h"
39 #include "player-effects.h"
40 #include "monster.h"
41 #include "view-mainwindow.h"
42 #include "spells.h"
43 #include "objectkind.h"
44 #include "autopick.h"
45 #include "targeting.h"
46
47 /*!
48  * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
49  * @return なし 
50  */
51 void do_cmd_inven(void)
52 {
53         char out_val[160];
54
55         /* Note that we are in "p_ptr->inventory_list" mode */
56         command_wrk = FALSE;
57
58         /* Note that we are in "p_ptr->inventory_list" mode */
59         if (easy_floor) command_wrk = (USE_INVEN);
60         screen_save();
61
62         /* Display the p_ptr->inventory_list */
63         (void)show_inven(0, USE_FULL);
64
65 #ifdef JP
66         sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
67                 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
68                 (long int)((p_ptr->total_weight * 100) / weight_limit()));
69 #else
70         sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
71                 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
72                 (p_ptr->total_weight * 100) / weight_limit());
73 #endif
74
75         prt(out_val, 0, 0);
76         command_new = inkey();
77         screen_load();
78
79         /* Process "Escape" */
80         if (command_new == ESCAPE)
81         {
82                 TERM_LEN wid, hgt;
83
84                 Term_get_size(&wid, &hgt);
85
86                 /* Reset stuff */
87                 command_new = 0;
88                 command_gap = wid - 30;
89         }
90
91         /* Process normal keys */
92         else
93         {
94                 /* Hack -- Use "display" mode */
95                 command_see = TRUE;
96         }
97 }
98
99
100 /*!
101  * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
102  * @return なし 
103  */
104 void do_cmd_equip(void)
105 {
106         char out_val[160];
107
108         /* Note that we are in "equipment" mode */
109         command_wrk = TRUE;
110
111         /* Note that we are in "equipment" mode */
112         if (easy_floor) command_wrk = (USE_EQUIP);
113         screen_save();
114
115         (void)show_equip(0, USE_FULL);
116
117         /* Build a prompt */
118 #ifdef JP
119         sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
120             (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
121             (long int)((p_ptr->total_weight * 100) / weight_limit()));
122 #else
123         sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
124             (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
125             (long int)((p_ptr->total_weight * 100) / weight_limit()));
126 #endif
127
128         prt(out_val, 0, 0);
129         command_new = inkey();
130         screen_load();
131
132         /* Process "Escape" */
133         if (command_new == ESCAPE)
134         {
135                 TERM_LEN wid, hgt;
136
137                 Term_get_size(&wid, &hgt);
138
139                 /* Reset stuff */
140                 command_new = 0;
141                 command_gap = wid - 30;
142         }
143
144         /* Process normal keys */
145         else
146         {
147                 /* Enter "display" mode */
148                 command_see = TRUE;
149         }
150 }
151
152
153
154
155 bool select_ring_slot = FALSE;
156
157 /*!
158  * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
159  * @return なし 
160  */
161 void do_cmd_wield(void)
162 {
163         OBJECT_IDX item, slot;
164         object_type forge;
165         object_type *q_ptr;
166         object_type *o_ptr;
167
168         concptr act;
169         concptr q, s;
170
171         GAME_TEXT o_name[MAX_NLEN];
172
173
174         OBJECT_IDX need_switch_wielding = 0;
175
176         if (p_ptr->special_defense & KATA_MUSOU)
177         {
178                 set_action(ACTION_NONE);
179         }
180
181         /* Restrict the choices */
182         item_tester_hook = item_tester_hook_wear;
183
184         q = _("どれを装備しますか? ", "Wear/Wield which item? ");
185         s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
186
187         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
188         if (!o_ptr) return;
189
190         /* Check the slot */
191         slot = wield_slot(o_ptr);
192
193         switch (o_ptr->tval)
194         {
195         /* Shields and some misc. items */
196         case TV_CAPTURE:
197         case TV_SHIELD:
198         case TV_CARD:
199                 /* Dual wielding */
200                 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
201                 {
202                         /* Restrict the choices */
203                         item_tester_hook = item_tester_hook_melee_weapon;
204
205                         /* Choose a weapon from the equipment only */
206                         q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
207                         s = _("おっと。", "Oops.");
208                         if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
209                         if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
210                 }
211
212                 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
213
214                 /* Both arms are already used by non-weapon */
215                 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
216                          p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
217                 {
218                         /* Restrict the choices */
219                         item_tester_hook = item_tester_hook_mochikae;
220
221                         /* Choose a hand */
222                         q = _("どちらの手に装備しますか?", "Equip which hand? ");
223                         s = _("おっと。", "Oops.");
224                         if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
225                 }
226                 break;
227
228         /* Melee weapons */
229         case TV_DIGGING:
230         case TV_HAFTED:
231         case TV_POLEARM:
232         case TV_SWORD:
233                 /* Asking for dual wielding */
234                 if (slot == INVEN_LARM)
235                 {
236                         if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
237                 }
238
239                 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
240                 {
241                         if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
242                 }
243
244                 /* Both arms are already used */
245                 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
246                 {
247                         /* Restrict the choices */
248                         item_tester_hook = item_tester_hook_mochikae;
249
250                         /* Choose a hand */
251                         q = _("どちらの手に装備しますか?", "Equip which hand? ");
252                         s = _("おっと。", "Oops.");
253                         
254                         if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
255                         if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
256                                 need_switch_wielding = INVEN_RARM;
257                 }
258                 break;
259
260         /* Rings */
261         case TV_RING:
262                 /* Choose a ring slot */
263                 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
264                 {
265                         q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
266                 }
267                 else
268                 {
269                         q = _("どちらの手に装備しますか?", "Equip which hand? ");
270                 }
271                 s = _("おっと。", "Oops.");
272
273                 /* Restrict the choices */
274                 select_ring_slot = TRUE;
275
276                 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
277                 {
278                         select_ring_slot = FALSE;
279                         return;
280                 }
281                 select_ring_slot = FALSE;
282                 break;
283         }
284
285         /* Prevent wielding into a cursed slot */
286         if (object_is_cursed(&p_ptr->inventory_list[slot]))
287         {
288                 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
289
290 #ifdef JP
291                 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
292 #else
293                 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
294 #endif
295
296                 /* Cancel the command */
297                 return;
298         }
299
300         if (confirm_wear &&
301                 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
302                 ((o_ptr->ident & IDENT_SENSE) &&
303                         (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
304         {
305                 char dummy[MAX_NLEN+80];
306
307                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
308                 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
309
310                 if (!get_check(dummy)) return;
311         }
312
313         if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
314         {
315                 char dummy[MAX_NLEN+100];
316
317                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
318
319                 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
320                         "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
321
322                 if (!get_check(dummy)) return;
323         }
324
325         if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
326         {
327                 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
328                 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
329                 object_type object_tmp;
330                 object_type *otmp_ptr = &object_tmp;
331                 GAME_TEXT switch_name[MAX_NLEN];
332
333                 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
334
335                 object_copy(otmp_ptr, switch_o_ptr);
336                 object_copy(switch_o_ptr, slot_o_ptr);
337                 object_copy(slot_o_ptr, otmp_ptr);
338                 
339                 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name, 
340                                         (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) : 
341                                                                                    (left_hander ? _("右手", "right") : _("左手", "left")));
342                 slot = need_switch_wielding;
343         }
344
345         check_find_art_quest_completion(o_ptr);
346
347         if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
348         {
349                 identify_item(o_ptr);
350
351                 /* Auto-inscription */
352                 autopick_alter_item(item, FALSE);
353         }
354
355         take_turn(p_ptr, 100);
356         q_ptr = &forge;
357
358         /* Obtain local object */
359         object_copy(q_ptr, o_ptr);
360
361         /* Modify quantity */
362         q_ptr->number = 1;
363
364         /* Decrease the item (from the pack) */
365         if (item >= 0)
366         {
367                 inven_item_increase(item, -1);
368                 inven_item_optimize(item);
369         }
370
371         /* Decrease the item (from the floor) */
372         else
373         {
374                 floor_item_increase(0 - item, -1);
375                 floor_item_optimize(0 - item);
376         }
377
378         /* Access the wield slot */
379         o_ptr = &p_ptr->inventory_list[slot];
380
381         /* Take off existing item */
382         if (o_ptr->k_idx)
383         {
384                 /* Take off existing item */
385                 (void)inven_takeoff(slot, 255);
386         }
387
388         /* Wear the new stuff */
389         object_copy(o_ptr, q_ptr);
390
391         o_ptr->marked |= OM_TOUCHED;
392
393         p_ptr->total_weight += q_ptr->weight;
394
395         /* Increment the equip counter by hand */
396         p_ptr->equip_cnt++;
397
398 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
399 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
400 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
401
402         /* Where is the item now */
403         switch (slot)
404         {
405         case INVEN_RARM:
406                 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
407                         act = STR_WIELD_ARMS;
408                 else
409                         act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
410                 break;
411
412         case INVEN_LARM:
413                 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
414                         act = STR_WIELD_ARMS;
415                 else
416                         act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
417                 break;
418
419         case INVEN_BOW:
420                 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
421                 break;
422
423         case INVEN_LITE:
424                 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
425                 break;
426
427         default:
428                 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
429                 break;
430         }
431
432         object_desc(o_name, o_ptr, 0);
433         msg_format(act, o_name, index_to_label(slot));
434
435         /* Cursed! */
436         if (object_is_cursed(o_ptr))
437         {
438                 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
439                 chg_virtue(V_HARMONY, -1);
440
441                 /* Note the curse */
442                 o_ptr->ident |= (IDENT_SENSE);
443         }
444
445         /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
446         if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
447         {
448                 /* Turn into a vampire */
449                 change_race(RACE_VAMPIRE, "");
450         }
451
452         p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
453         p_ptr->redraw |= (PR_EQUIPPY);
454         p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
455
456         calc_android_exp();
457 }
458
459 /*!
460  * @brief 持ち替え処理
461  * @param item 持ち替えを行いたい装備部位ID
462  * @return なし
463  */
464 void kamaenaoshi(INVENTORY_IDX item)
465 {
466         object_type *o_ptr, *new_o_ptr;
467         GAME_TEXT o_name[MAX_NLEN];
468
469         if (item == INVEN_RARM)
470         {
471                 if (has_melee_weapon(INVEN_LARM))
472                 {
473                         o_ptr = &p_ptr->inventory_list[INVEN_LARM];
474                         object_desc(o_name, o_ptr, 0);
475
476                         if (!object_is_cursed(o_ptr))
477                         {
478                                 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
479                                 object_copy(new_o_ptr, o_ptr);
480                                 p_ptr->total_weight += o_ptr->weight;
481                                 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
482                                 inven_item_optimize(INVEN_LARM);
483                                 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
484                                         msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
485                                 else
486                                         msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name, 
487                                                 (left_hander ? _("左手", "left") : _("右手", "right")));
488                         }
489                         else
490                         {
491                                 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
492                                         msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
493                         }
494                 }
495         }
496         else if (item == INVEN_LARM)
497         {
498                 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
499                 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
500
501                 if (has_melee_weapon(INVEN_RARM))
502                 {
503                         if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
504                                 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
505                 }
506                 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
507                 {
508                         new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
509                         object_copy(new_o_ptr, o_ptr);
510                         p_ptr->total_weight += o_ptr->weight;
511                         inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
512                         inven_item_optimize(INVEN_RARM);
513                         msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
514                 }
515         }
516 }
517
518
519 /*!
520  * @brief 装備を外すコマンドのメインルーチン / Take off an item
521  * @return なし
522  */
523 void do_cmd_takeoff(void)
524 {
525         OBJECT_IDX item;
526         object_type *o_ptr;
527         concptr q, s;
528
529         if (p_ptr->special_defense & KATA_MUSOU)
530         {
531                 set_action(ACTION_NONE);
532         }
533
534         q = _("どれを装備からはずしますか? ", "Take off which item? ");
535         s = _("はずせる装備がない。", "You are not wearing anything to take off.");
536
537         o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
538         if (!o_ptr) return;
539
540         /* Item is cursed */
541         if (object_is_cursed(o_ptr))
542         {
543                 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
544                 {
545                         msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
546
547                         return;
548                 }
549
550                 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
551                 {
552                         msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
553
554                         o_ptr->ident |= (IDENT_SENSE);
555                         o_ptr->curse_flags = 0L;
556                         o_ptr->feeling = FEEL_NONE;
557
558                         p_ptr->update |= (PU_BONUS);
559                         p_ptr->window |= (PW_EQUIP);
560
561                         msg_print(_("呪いを打ち破った。", "You break the curse."));
562                 }
563                 else
564                 {
565                         msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
566                         take_turn(p_ptr, 50);
567                         return;
568                 }
569         }
570
571         take_turn(p_ptr, 50);
572
573         /* Take off the item */
574         (void)inven_takeoff(item, 255);
575         kamaenaoshi(item);
576         calc_android_exp();
577         p_ptr->redraw |= (PR_EQUIPPY);
578 }
579
580
581 /*!
582  * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
583  * @return なし
584  */
585 void do_cmd_drop(void)
586 {
587         OBJECT_IDX item;
588         int amt = 1;
589
590         object_type *o_ptr;
591
592         concptr q, s;
593
594         if (p_ptr->special_defense & KATA_MUSOU)
595         {
596                 set_action(ACTION_NONE);
597         }
598
599         q = _("どのアイテムを落としますか? ", "Drop which item? ");
600         s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
601
602         o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
603         if (!o_ptr) return;
604
605         /* Hack -- Cannot remove cursed items */
606         if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
607         {
608                 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
609                 return;
610         }
611
612         if (o_ptr->number > 1)
613         {
614                 amt = get_quantity(NULL, o_ptr->number);
615                 if (amt <= 0) return;
616         }
617
618         take_turn(p_ptr, 50);
619
620         /* Drop (some of) the item */
621         inven_drop(item, amt);
622
623         if (item >= INVEN_RARM)
624         {
625                 kamaenaoshi(item);
626                 calc_android_exp();
627         }
628
629         p_ptr->redraw |= (PR_EQUIPPY);
630 }
631
632
633 /*!
634  * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
635  * @return なし
636  */
637 void do_cmd_destroy(void)
638 {
639         OBJECT_IDX item;
640         QUANTITY amt = 1;
641         QUANTITY old_number;
642
643         bool force = FALSE;
644
645         object_type *o_ptr;
646         object_type forge;
647         object_type *q_ptr = &forge;
648
649         GAME_TEXT o_name[MAX_NLEN];
650         char out_val[MAX_NLEN+40];
651
652         concptr q, s;
653
654         if (p_ptr->special_defense & KATA_MUSOU)
655         {
656                 set_action(ACTION_NONE);
657         }
658
659         /* Hack -- force destruction */
660         if (command_arg > 0) force = TRUE;
661
662         q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
663         s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
664
665         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
666         if (!o_ptr) return;
667
668         /* Verify unless quantity given beforehand */
669         if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
670         {
671                 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
672
673                 /* Make a verification */
674                 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
675                 msg_print(NULL);
676
677                 /* HACK : Add the line to message buffer */
678                 message_add(out_val);
679                 p_ptr->window |= (PW_MESSAGE);
680                 handle_stuff();
681
682                 /* Get an acceptable answer */
683                 while (TRUE)
684                 {
685                         char i;
686
687                         /* Prompt */
688                         prt(out_val, 0, 0);
689
690                         i = inkey();
691
692                         /* Erase the prompt */
693                         prt("", 0, 0);
694
695
696                         if (i == 'y' || i == 'Y')
697                         {
698                                 break;
699                         }
700                         if (i == ESCAPE || i == 'n' || i == 'N')
701                         {
702                                 /* Cancel */
703                                 return;
704                         }
705                         if (i == 'A')
706                         {
707                                 /* Add an auto-destroy preference line */
708                                 if (autopick_autoregister(o_ptr))
709                                 {
710                                         /* Auto-destroy it */
711                                         autopick_alter_item(item, TRUE);
712                                 }
713
714                                 /* The object is already destroyed. */
715                                 return;
716                         }
717                 } /* while (TRUE) */
718         }
719
720         if (o_ptr->number > 1)
721         {
722                 amt = get_quantity(NULL, o_ptr->number);
723                 if (amt <= 0) return;
724         }
725
726
727         old_number = o_ptr->number;
728         o_ptr->number = amt;
729         object_desc(o_name, o_ptr, 0);
730         o_ptr->number = old_number;
731
732         take_turn(p_ptr, 100);
733
734         /* Artifacts cannot be destroyed */
735         if (!can_player_destroy_object(o_ptr))
736         {
737                 free_turn(p_ptr);
738
739                 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
740                 return;
741         }
742
743         object_copy(q_ptr, o_ptr);
744
745         msg_format(_("%sを壊した。", "You destroy %s."), o_name);
746         sound(SOUND_DESTITEM);
747
748         /* Reduce the charges of rods/wands */
749         reduce_charges(o_ptr, amt);
750
751         /* Eliminate the item (from the pack) */
752         if (item >= 0)
753         {
754                 inven_item_increase(item, -amt);
755                 inven_item_describe(item);
756                 inven_item_optimize(item);
757         }
758
759         /* Eliminate the item (from the floor) */
760         else
761         {
762                 floor_item_increase(0 - item, -amt);
763                 floor_item_describe(0 - item);
764                 floor_item_optimize(0 - item);
765         }
766
767         if (item_tester_high_level_book(q_ptr))
768         {
769                 bool gain_expr = FALSE;
770
771                 if (p_ptr->prace == RACE_ANDROID)
772                 {
773                 }
774                 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
775                 {
776                         gain_expr = TRUE;
777                 }
778                 else if (p_ptr->pclass == CLASS_PALADIN)
779                 {
780                         if (is_good_realm(p_ptr->realm1))
781                         {
782                                 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
783                         }
784                         else
785                         {
786                                 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
787                         }
788                 }
789
790                 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
791                 {
792                         s32b tester_exp = p_ptr->max_exp / 20;
793                         if (tester_exp > 10000) tester_exp = 10000;
794                         if (q_ptr->sval < 3) tester_exp /= 4;
795                         if (tester_exp<1) tester_exp = 1;
796
797                         msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
798                         gain_exp(tester_exp * amt);
799                 }
800                 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
801                 {
802                         chg_virtue(V_UNLIFE, 1);
803                         chg_virtue(V_VITALITY, -1);
804                 }
805                 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
806                 {
807                         chg_virtue(V_UNLIFE, -1);
808                         chg_virtue(V_VITALITY, 1);
809                 }
810         
811                 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
812                         chg_virtue(V_ENCHANT, -1);
813         
814                 if (object_value_real(q_ptr) > 30000)
815                         chg_virtue(V_SACRIFICE, 2);
816         
817                 else if (object_value_real(q_ptr) > 10000)
818                         chg_virtue(V_SACRIFICE, 1);
819         }
820
821         if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
822                 chg_virtue(V_HARMONY, 1);
823
824         if (item >= INVEN_RARM) calc_android_exp();
825 }
826
827
828 /*!
829  * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
830  * @return なし
831  */
832 void do_cmd_observe(void)
833 {
834         OBJECT_IDX item;
835         object_type *o_ptr;
836         GAME_TEXT o_name[MAX_NLEN];
837         concptr q, s;
838
839         q = _("どのアイテムを調べますか? ", "Examine which item? ");
840         s = _("調べられるアイテムがない。", "You have nothing to examine.");
841
842         o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
843         if (!o_ptr) return;
844
845         /* Require full knowledge */
846         if (!(o_ptr->ident & IDENT_MENTAL))
847         {
848                 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
849                 return;
850         }
851
852         object_desc(o_name, o_ptr, 0);
853         msg_format(_("%sを調べている...", "Examining %s..."), o_name);
854         if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
855 }
856
857
858
859 /*!
860  * @brief アイテムの銘を消すコマンドのメインルーチン
861  * Remove the inscription from an object XXX Mention item (when done)?
862  * @return なし
863  */
864 void do_cmd_uninscribe(void)
865 {
866         OBJECT_IDX item;
867         object_type *o_ptr;
868         concptr q, s;
869
870         q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
871         s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
872
873         o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
874         if (!o_ptr) return;
875
876         /* Nothing to remove */
877         if (!o_ptr->inscription)
878         {
879                 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
880                 return;
881         }
882
883         msg_print(_("銘を消した。", "Inscription removed."));
884
885         /* Remove the incription */
886         o_ptr->inscription = 0;
887         p_ptr->update |= (PU_COMBINE);
888         p_ptr->window |= (PW_INVEN | PW_EQUIP);
889
890         /* .や$の関係で, 再計算が必要なはず -- henkma */
891         p_ptr->update |= (PU_BONUS);
892
893 }
894
895
896 /*!
897  * @brief アイテムの銘を刻むコマンドのメインルーチン
898  * Inscribe an object with a comment
899  * @return なし
900  */
901 void do_cmd_inscribe(void)
902 {
903         OBJECT_IDX item;
904         object_type *o_ptr;
905         GAME_TEXT o_name[MAX_NLEN];
906         char out_val[80];
907         concptr q, s;
908
909         q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
910         s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
911
912         o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
913         if (!o_ptr) return;
914
915         /* Describe the activity */
916         object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
917
918         msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
919         msg_print(NULL);
920
921         /* Start with nothing */
922         strcpy(out_val, "");
923
924         /* Use old inscription */
925         if (o_ptr->inscription)
926         {
927                 /* Start with the old inscription */
928                 strcpy(out_val, quark_str(o_ptr->inscription));
929         }
930
931         /* Get a new inscription (possibly empty) */
932         if (get_string(_("銘: ", "Inscription: "), out_val, 80))
933         {
934                 /* Save the inscription */
935                 o_ptr->inscription = quark_add(out_val);
936                 p_ptr->update |= (PU_COMBINE);
937                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
938
939                 /* .や$の関係で, 再計算が必要なはず -- henkma */
940                 p_ptr->update |= (PU_BONUS);
941         }
942 }
943
944
945 /*!
946  * @brief ランタンに燃料を加えるコマンドのメインルーチン
947  * Refill the players lamp (from the pack or floor)
948  * @return なし
949  */
950 static void do_cmd_refill_lamp(void)
951 {
952         OBJECT_IDX item;
953         object_type *o_ptr;
954         object_type *j_ptr;
955         concptr q, s;
956
957         /* Restrict the choices */
958         item_tester_hook = item_tester_refill_lantern;
959
960         q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
961         s = _("油つぼがない。", "You have no flasks of oil.");
962
963         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
964         if (!o_ptr) return;
965
966         take_turn(p_ptr, 50);
967
968         /* Access the lantern */
969         j_ptr = &p_ptr->inventory_list[INVEN_LITE];
970
971         /* Refuel */
972         j_ptr->xtra4 += o_ptr->xtra4;
973         msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
974
975         if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
976         {
977                 j_ptr->xtra4 = 0;
978                 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
979         }
980         else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
981         {
982                 j_ptr->xtra4 = 0;
983                 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
984         }
985         else if (j_ptr->xtra4 >= FUEL_LAMP)
986         {
987                 j_ptr->xtra4 = FUEL_LAMP;
988                 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
989         }
990
991         /* Decrease the item (from the pack) */
992         if (item >= 0)
993         {
994                 inven_item_increase(item, -1);
995                 inven_item_describe(item);
996                 inven_item_optimize(item);
997         }
998
999         /* Decrease the item (from the floor) */
1000         else
1001         {
1002                 floor_item_increase(0 - item, -1);
1003                 floor_item_describe(0 - item);
1004                 floor_item_optimize(0 - item);
1005         }
1006
1007         p_ptr->update |= (PU_TORCH);
1008 }
1009
1010 /*!
1011  * @brief 松明を束ねるコマンドのメインルーチン
1012  * Refuel the players torch (from the pack or floor)
1013  * @return なし
1014  */
1015 static void do_cmd_refill_torch(void)
1016 {
1017         OBJECT_IDX item;
1018
1019         object_type *o_ptr;
1020         object_type *j_ptr;
1021
1022         concptr q, s;
1023
1024         /* Restrict the choices */
1025         item_tester_hook = object_can_refill_torch;
1026
1027         q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1028         s = _("他に松明がない。", "You have no extra torches.");
1029
1030         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1031         if (!o_ptr) return;
1032
1033         take_turn(p_ptr, 50);
1034
1035         /* Access the primary torch */
1036         j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1037
1038         /* Refuel */
1039         j_ptr->xtra4 += o_ptr->xtra4 + 5;
1040
1041         msg_print(_("松明を結合した。", "You combine the torches."));
1042
1043         if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1044         {
1045                 j_ptr->xtra4 = 0;
1046                 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1047         }
1048         else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1049         {
1050                 j_ptr->xtra4 = 0;
1051                 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1052         }
1053         /* Over-fuel message */
1054         else if (j_ptr->xtra4 >= FUEL_TORCH)
1055         {
1056                 j_ptr->xtra4 = FUEL_TORCH;
1057                 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1058         }
1059
1060         /* Refuel message */
1061         else
1062         {
1063                 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1064         }
1065
1066         /* Decrease the item (from the pack) */
1067         if (item >= 0)
1068         {
1069                 inven_item_increase(item, -1);
1070                 inven_item_describe(item);
1071                 inven_item_optimize(item);
1072         }
1073
1074         /* Decrease the item (from the floor) */
1075         else
1076         {
1077                 floor_item_increase(0 - item, -1);
1078                 floor_item_describe(0 - item);
1079                 floor_item_optimize(0 - item);
1080         }
1081
1082         p_ptr->update |= (PU_TORCH);
1083 }
1084
1085
1086 /*!
1087  * @brief 燃料を補充するコマンドのメインルーチン
1088  * Refill the players lamp, or restock his torches
1089  * @return なし
1090  */
1091 void do_cmd_refill(void)
1092 {
1093         object_type *o_ptr;
1094
1095         /* Get the light */
1096         o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1097
1098         if (p_ptr->special_defense & KATA_MUSOU)
1099         {
1100                 set_action(ACTION_NONE);
1101         }
1102
1103         /* It is nothing */
1104         if (o_ptr->tval != TV_LITE)
1105         {
1106                 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1107         }
1108
1109         /* It's a lamp */
1110         else if (o_ptr->sval == SV_LITE_LANTERN)
1111         {
1112                 do_cmd_refill_lamp();
1113         }
1114
1115         /* It's a torch */
1116         else if (o_ptr->sval == SV_LITE_TORCH)
1117         {
1118                 do_cmd_refill_torch();
1119         }
1120
1121         /* No torch to refill */
1122         else
1123         {
1124                 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1125         }
1126 }
1127
1128
1129 /*!
1130  * @brief ターゲットを設定するコマンドのメインルーチン
1131  * Target command
1132  * @return なし
1133  */
1134 void do_cmd_target(void)
1135 {
1136         if (p_ptr->wild_mode) return;
1137
1138         /* Target set */
1139         if (target_set(TARGET_KILL))
1140         {
1141                 msg_print(_("ターゲット決定。", "Target Selected."));
1142         }
1143
1144         /* Target aborted */
1145         else
1146         {
1147                 msg_print(_("ターゲット解除。", "Target Aborted."));
1148         }
1149 }
1150
1151
1152
1153 /*!
1154  * @brief 周囲を見渡すコマンドのメインルーチン
1155  * Look command
1156  * @return なし
1157  */
1158 void do_cmd_look(void)
1159 {
1160         p_ptr->window |= PW_MONSTER_LIST;
1161         handle_stuff();
1162
1163         /* Look around */
1164         if (target_set(TARGET_LOOK))
1165         {
1166                 msg_print(_("ターゲット決定。", "Target Selected."));
1167         }
1168 }
1169
1170
1171 /*!
1172  * @brief 位置を確認するコマンドのメインルーチン
1173  * Allow the player to examine other sectors on the map
1174  * @return なし
1175  */
1176 void do_cmd_locate(void)
1177 {
1178         DIRECTION dir;
1179         POSITION y1, x1, y2, x2;
1180         GAME_TEXT tmp_val[80];
1181         GAME_TEXT out_val[160];
1182         TERM_LEN wid, hgt;
1183
1184         get_screen_size(&wid, &hgt);
1185
1186         /* Start at current panel */
1187         y2 = y1 = panel_row_min;
1188         x2 = x1 = panel_col_min;
1189
1190         /* Show panels until done */
1191         while (1)
1192         {
1193                 /* Describe the location */
1194                 if ((y2 == y1) && (x2 == x1))
1195                 {
1196                         strcpy(tmp_val, _("真上", "\0"));
1197                 }
1198                 else
1199                 {
1200                         sprintf(tmp_val, "%s%s",
1201                                 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1202                                 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1203                 }
1204
1205                 /* Prepare to ask which way to look */
1206                 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s)  方向?", 
1207                                                "Map sector [%d(%02d),%d(%02d)], which is%s your sector.  Direction?"),
1208                         y2 / (hgt / 2), y2 % (hgt / 2),
1209                         x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1210
1211                 /* Assume no direction */
1212                 dir = 0;
1213
1214                 /* Get a direction */
1215                 while (!dir)
1216                 {
1217                         char command;
1218
1219                         /* Get a command (or Cancel) */
1220                         if (!get_com(out_val, &command, TRUE)) break;
1221
1222                         /* Extract the action (if any) */
1223                         dir = get_keymap_dir(command);
1224
1225                         /* Error */
1226                         if (!dir) bell();
1227                 }
1228
1229                 /* No direction */
1230                 if (!dir) break;
1231
1232                 /* Apply the motion */
1233                 if (change_panel(ddy[dir], ddx[dir]))
1234                 {
1235                         y2 = panel_row_min;
1236                         x2 = panel_col_min;
1237                 }
1238         }
1239
1240
1241         /* Recenter the map around the player */
1242         verify_panel();
1243
1244         p_ptr->update |= (PU_MONSTERS);
1245         p_ptr->redraw |= (PR_MAP);
1246         p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1247         handle_stuff();
1248 }
1249
1250
1251 /*!
1252  * @brief モンスターの思い出を見るコマンドのメインルーチン
1253  * Identify a character, allow recall of monsters
1254  * @return なし
1255  * @details
1256  * <pre>
1257  * Several "special" responses recall "multiple" monsters:
1258  *   ^A (all monsters)
1259  *   ^U (all unique monsters)
1260  *   ^N (all non-unique monsters)
1261  *
1262  * The responses may be sorted in several ways, see below.
1263  *
1264  * Note that the player ghosts are ignored. 
1265  * </pre>
1266  */
1267 void do_cmd_query_symbol(void)
1268 {
1269         IDX i;
1270         int n;
1271         MONRACE_IDX r_idx;
1272         char sym, query;
1273         char buf[128];
1274
1275         bool all = FALSE;
1276         bool uniq = FALSE;
1277         bool norm = FALSE;
1278         bool ride = FALSE;
1279         char temp[80] = "";
1280
1281         bool recall = FALSE;
1282
1283         u16b why = 0;
1284         MONRACE_IDX *who;
1285
1286         /* Get a character, or abort */
1287         if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ", 
1288                                    "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1289
1290         /* Find that character info, and describe it */
1291         for (i = 0; ident_info[i]; ++i)
1292         {
1293                 if (sym == ident_info[i][0]) break;
1294         }
1295         if (sym == KTRL('A'))
1296         {
1297                 all = TRUE;
1298                 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1299         }
1300         else if (sym == KTRL('U'))
1301         {
1302                 all = uniq = TRUE;
1303                 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1304         }
1305         else if (sym == KTRL('N'))
1306         {
1307                 all = norm = TRUE;
1308                 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1309         }
1310         else if (sym == KTRL('R'))
1311         {
1312                 all = ride = TRUE;
1313                 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1314         }
1315         /* XTRA HACK WHATSEARCH */
1316         else if (sym == KTRL('M'))
1317         {
1318                 all = TRUE;
1319                 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1320                 {
1321                         temp[0]=0;
1322                         return;
1323                 }
1324                 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1325         }
1326         else if (ident_info[i])
1327         {
1328                 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1329         }
1330         else
1331         {
1332                 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1333         }
1334
1335         /* Display the result */
1336         prt(buf, 0, 0);
1337
1338         /* Allocate the "who" array */
1339         C_MAKE(who, max_r_idx, MONRACE_IDX);
1340
1341         /* Collect matching monsters */
1342         for (n = 0, i = 1; i < max_r_idx; i++)
1343         {
1344                 monster_race *r_ptr = &r_info[i];
1345
1346                 /* Nothing to recall */
1347                 if (!cheat_know && !r_ptr->r_sights) continue;
1348
1349                 /* Require non-unique monsters if needed */
1350                 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1351
1352                 /* Require unique monsters if needed */
1353                 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1354
1355                 /* Require ridable monsters if needed */
1356                 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1357
1358                 /* XTRA HACK WHATSEARCH */
1359                 if (temp[0])
1360                 {
1361                         TERM_LEN xx;
1362                         char temp2[80];
1363
1364                         for (xx = 0; temp[xx] && xx < 80; xx++)
1365                         {
1366 #ifdef JP
1367                                 if (iskanji(temp[xx])) { xx++; continue; }
1368 #endif
1369                                 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1370                         }
1371
1372 #ifdef JP
1373                         strcpy(temp2, r_name + r_ptr->E_name);
1374 #else
1375                         strcpy(temp2, r_name + r_ptr->name);
1376 #endif
1377                         for (xx = 0; temp2[xx] && xx < 80; xx++)
1378                                 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1379
1380 #ifdef JP
1381                         if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1382 #else
1383                         if (my_strstr(temp2, temp))
1384 #endif
1385                                 who[n++] = i;
1386                 }
1387
1388                 /* Collect "appropriate" monsters */
1389                 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1390         }
1391
1392         /* Nothing to recall */
1393         if (!n)
1394         {
1395                 C_KILL(who, max_r_idx, MONRACE_IDX);
1396                 return;
1397         }
1398
1399         /* Prompt */
1400         put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1401
1402         /* Query */
1403         query = inkey();
1404         prt(buf, 0, 0);
1405
1406         why = 2;
1407
1408         /* Sort the array */
1409         ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1410
1411         /* Sort by kills (and level) */
1412         if (query == 'k')
1413         {
1414                 why = 4;
1415                 query = 'y';
1416         }
1417
1418         /* Catch "escape" */
1419         if (query != 'y')
1420         {
1421                 C_KILL(who, max_r_idx, MONRACE_IDX);
1422                 return;
1423         }
1424
1425         /* Sort if needed */
1426         if (why == 4)
1427         {
1428                 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1429         }
1430
1431
1432         /* Start at the end */
1433         i = n - 1;
1434
1435         /* Scan the monster memory */
1436         while (1)
1437         {
1438                 /* Extract a race */
1439                 r_idx = who[i];
1440
1441                 /* Hack -- Auto-recall */
1442                 monster_race_track(r_idx);
1443                 handle_stuff();
1444
1445                 /* Interact */
1446                 while (1)
1447                 {
1448                         /* Recall */
1449                         if (recall)
1450                         {
1451                                 screen_save();
1452
1453                                 /* Recall on screen */
1454                                 screen_roff(who[i], 0);
1455                         }
1456
1457                         /* Hack -- Begin the prompt */
1458                         roff_top(r_idx);
1459
1460                         /* Hack -- Complete the prompt */
1461                         Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1462
1463                         query = inkey();
1464
1465                         /* Unrecall */
1466                         if (recall)
1467                         {
1468                                 screen_load();
1469                         }
1470
1471                         /* Normal commands */
1472                         if (query != 'r') break;
1473
1474                         /* Toggle recall */
1475                         recall = !recall;
1476                 }
1477
1478                 /* Stop scanning */
1479                 if (query == ESCAPE) break;
1480
1481                 /* Move to "prev" monster */
1482                 if (query == '-')
1483                 {
1484                         if (++i == n)
1485                         {
1486                                 i = 0;
1487                                 if (!expand_list) break;
1488                         }
1489                 }
1490
1491                 /* Move to "next" monster */
1492                 else
1493                 {
1494                         if (i-- == 0)
1495                         {
1496                                 i = n - 1;
1497                                 if (!expand_list) break;
1498                         }
1499                 }
1500         }
1501
1502         /* Free the "who" array */
1503         C_KILL(who, max_r_idx, IDX);
1504
1505         /* Re-display the identity */
1506         prt(buf, 0, 0);
1507 }
1508
1509 /*!
1510  * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1511  * Use an item
1512  * @return なし
1513  * @details
1514  * XXX - Add actions for other item types
1515  */
1516 void do_cmd_use(void)
1517 {
1518         OBJECT_IDX item;
1519         object_type *o_ptr;
1520         concptr q, s;
1521
1522         if (p_ptr->wild_mode)
1523         {
1524                 return;
1525         }
1526
1527         if (cmd_limit_arena(p_ptr)) return;
1528
1529         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1530         {
1531                 set_action(ACTION_NONE);
1532         }
1533
1534         item_tester_hook = item_tester_hook_use;
1535
1536         q = _("どれを使いますか?", "Use which item? ");
1537         s = _("使えるものがありません。", "You have nothing to use.");
1538
1539         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1540         if (!o_ptr) return;
1541
1542         switch (o_ptr->tval)
1543         {
1544                 /* Spike a door */
1545                 case TV_SPIKE:
1546                 {
1547                         do_cmd_spike();
1548                         break;
1549                 }
1550
1551                 /* Eat some food */
1552                 case TV_FOOD:
1553                 {
1554                         do_cmd_eat_food_aux(item);
1555                         break;
1556                 }
1557
1558                 /* Aim a wand */
1559                 case TV_WAND:
1560                 {
1561                         do_cmd_aim_wand_aux(item);
1562                         break;
1563                 }
1564
1565                 /* Use a staff */
1566                 case TV_STAFF:
1567                 {
1568                         do_cmd_use_staff_aux(item);
1569                         break;
1570                 }
1571
1572                 /* Zap a rod */
1573                 case TV_ROD:
1574                 {
1575                         do_cmd_zap_rod_aux(item);
1576                         break;
1577                 }
1578
1579                 /* Quaff a potion */
1580                 case TV_POTION:
1581                 {
1582                         do_cmd_quaff_potion_aux(item);
1583                         break;
1584                 }
1585
1586                 /* Read a scroll */
1587                 case TV_SCROLL:
1588                 {
1589                         if (cmd_limit_blind(p_ptr)) return;
1590                         if (cmd_limit_confused(p_ptr)) return;
1591
1592                         do_cmd_read_scroll_aux(item, TRUE);
1593                         break;
1594                 }
1595
1596                 /* Fire ammo */
1597                 case TV_SHOT:
1598                 case TV_ARROW:
1599                 case TV_BOLT:
1600                 {
1601                         exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1602                         break;
1603                 }
1604
1605                 /* Activate an artifact */
1606                 default:
1607                 {
1608                         do_cmd_activate_aux(item);
1609                         break;
1610                 }
1611         }
1612 }
1613