OSDN Git Service

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