OSDN Git Service

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