OSDN Git Service

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