OSDN Git Service

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