OSDN Git Service

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