OSDN Git Service

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