OSDN Git Service

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