OSDN Git Service

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