3 * @brief プレイヤーのアイテムに関するコマンドの実装1 / Inventory commands
6 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
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.
18 #include "cmd-activate.h"
20 #include "cmd-quaff.h"
22 #include "cmd-usestaff.h"
23 #include "cmd-zaprod.h"
24 #include "cmd-zapwand.h"
26 #include "cmd-basic.h"
28 #include "object-flavor.h"
29 #include "object-hook.h"
34 #include "player-status.h"
35 #include "player-effects.h"
37 #include "view-mainwindow.h"
41 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory
44 void do_cmd_inven(void)
48 /* Note that we are in "inventory" mode */
51 /* Note that we are in "inventory" mode */
52 if (easy_floor) command_wrk = (USE_INVEN);
55 /* Display the inventory */
56 (void)show_inven(0, USE_FULL);
59 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
60 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
61 (long int)((p_ptr->total_weight * 100) / weight_limit()));
63 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
64 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
65 (p_ptr->total_weight * 100) / weight_limit());
69 command_new = inkey();
72 /* Process "Escape" */
73 if (command_new == ESCAPE)
77 Term_get_size(&wid, &hgt);
81 command_gap = wid - 30;
84 /* Process normal keys */
87 /* Hack -- Use "display" mode */
94 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
97 void do_cmd_equip(void)
101 /* Note that we are in "equipment" mode */
104 /* Note that we are in "equipment" mode */
105 if (easy_floor) command_wrk = (USE_EQUIP);
108 (void)show_equip(0, USE_FULL);
112 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
113 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
114 (long int)((p_ptr->total_weight * 100) / weight_limit()));
116 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
117 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
118 (long int)((p_ptr->total_weight * 100) / weight_limit()));
122 command_new = inkey();
125 /* Process "Escape" */
126 if (command_new == ESCAPE)
130 Term_get_size(&wid, &hgt);
134 command_gap = wid - 30;
137 /* Process normal keys */
140 /* Enter "display" mode */
148 bool select_ring_slot = FALSE;
151 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
154 void do_cmd_wield(void)
156 OBJECT_IDX item, slot;
164 GAME_TEXT o_name[MAX_NLEN];
167 OBJECT_IDX need_switch_wielding = 0;
169 if (p_ptr->special_defense & KATA_MUSOU)
171 set_action(ACTION_NONE);
174 /* Restrict the choices */
175 item_tester_hook = item_tester_hook_wear;
177 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
178 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
180 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
184 slot = wield_slot(o_ptr);
188 /* Shields and some misc. items */
193 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
195 /* Restrict the choices */
196 item_tester_hook = item_tester_hook_melee_weapon;
198 /* Choose a weapon from the equipment only */
199 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
200 s = _("おっと。", "Oops.");
201 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
202 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
205 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
207 /* Both arms are already used by non-weapon */
208 else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
209 inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
211 /* Restrict the choices */
212 item_tester_hook = item_tester_hook_mochikae;
215 q = _("どちらの手に装備しますか?", "Equip which hand? ");
216 s = _("おっと。", "Oops.");
217 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
226 /* Asking for dual wielding */
227 if (slot == INVEN_LARM)
229 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
232 else if (!inventory[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
234 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
237 /* Both arms are already used */
238 else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
240 /* Restrict the choices */
241 item_tester_hook = item_tester_hook_mochikae;
244 q = _("どちらの手に装備しますか?", "Equip which hand? ");
245 s = _("おっと。", "Oops.");
247 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
248 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
249 need_switch_wielding = INVEN_RARM;
255 /* Choose a ring slot */
256 if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
258 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
262 q = _("どちらの手に装備しますか?", "Equip which hand? ");
264 s = _("おっと。", "Oops.");
266 /* Restrict the choices */
267 select_ring_slot = TRUE;
269 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
271 select_ring_slot = FALSE;
274 select_ring_slot = FALSE;
278 /* Prevent wielding into a cursed slot */
279 if (object_is_cursed(&inventory[slot]))
281 object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
284 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
286 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
289 /* Cancel the command */
294 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
295 ((o_ptr->ident & IDENT_SENSE) &&
296 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
298 char dummy[MAX_NLEN+80];
300 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
301 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
303 if (!get_check(dummy)) return;
306 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
308 char dummy[MAX_NLEN+100];
310 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
312 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
313 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
315 if (!get_check(dummy)) return;
318 if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
320 object_type *slot_o_ptr = &inventory[slot];
321 object_type *switch_o_ptr = &inventory[need_switch_wielding];
322 object_type object_tmp;
323 object_type *otmp_ptr = &object_tmp;
324 GAME_TEXT switch_name[MAX_NLEN];
326 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
328 object_copy(otmp_ptr, switch_o_ptr);
329 object_copy(switch_o_ptr, slot_o_ptr);
330 object_copy(slot_o_ptr, otmp_ptr);
332 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
333 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
334 (left_hander ? _("右手", "right") : _("左手", "left")));
335 slot = need_switch_wielding;
338 check_find_art_quest_completion(o_ptr);
340 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
342 identify_item(o_ptr);
344 /* Auto-inscription */
345 autopick_alter_item(item, FALSE);
348 take_turn(p_ptr, 100);
351 /* Obtain local object */
352 object_copy(q_ptr, o_ptr);
354 /* Modify quantity */
357 /* Decrease the item (from the pack) */
360 inven_item_increase(item, -1);
361 inven_item_optimize(item);
364 /* Decrease the item (from the floor) */
367 floor_item_increase(0 - item, -1);
368 floor_item_optimize(0 - item);
371 /* Access the wield slot */
372 o_ptr = &inventory[slot];
374 /* Take off existing item */
377 /* Take off existing item */
378 (void)inven_takeoff(slot, 255);
381 /* Wear the new stuff */
382 object_copy(o_ptr, q_ptr);
384 o_ptr->marked |= OM_TOUCHED;
386 p_ptr->total_weight += q_ptr->weight;
388 /* Increment the equip counter by hand */
391 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
392 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
393 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
395 /* Where is the item now */
399 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
400 act = STR_WIELD_ARMS;
402 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
406 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
407 act = STR_WIELD_ARMS;
409 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
413 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
417 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
421 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
425 object_desc(o_name, o_ptr, 0);
426 msg_format(act, o_name, index_to_label(slot));
429 if (object_is_cursed(o_ptr))
431 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
432 chg_virtue(V_HARMONY, -1);
435 o_ptr->ident |= (IDENT_SENSE);
438 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
439 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
441 /* Turn into a vampire */
442 change_race(RACE_VAMPIRE, "");
445 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
446 p_ptr->redraw |= (PR_EQUIPPY);
447 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
454 * @param item 持ち替えを行いたい装備部位ID
457 void kamaenaoshi(INVENTORY_IDX item)
459 object_type *o_ptr, *new_o_ptr;
460 GAME_TEXT o_name[MAX_NLEN];
462 if (item == INVEN_RARM)
464 if (has_melee_weapon(INVEN_LARM))
466 o_ptr = &inventory[INVEN_LARM];
467 object_desc(o_name, o_ptr, 0);
469 if (!object_is_cursed(o_ptr))
471 new_o_ptr = &inventory[INVEN_RARM];
472 object_copy(new_o_ptr, o_ptr);
473 p_ptr->total_weight += o_ptr->weight;
474 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
475 inven_item_optimize(INVEN_LARM);
476 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
477 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
479 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
480 (left_hander ? _("左手", "left") : _("右手", "right")));
484 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
485 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
489 else if (item == INVEN_LARM)
491 o_ptr = &inventory[INVEN_RARM];
492 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
494 if (has_melee_weapon(INVEN_RARM))
496 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
497 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
499 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
501 new_o_ptr = &inventory[INVEN_LARM];
502 object_copy(new_o_ptr, o_ptr);
503 p_ptr->total_weight += o_ptr->weight;
504 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
505 inven_item_optimize(INVEN_RARM);
506 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
513 * @brief 装備を外すコマンドのメインルーチン / Take off an item
516 void do_cmd_takeoff(void)
522 if (p_ptr->special_defense & KATA_MUSOU)
524 set_action(ACTION_NONE);
527 q = _("どれを装備からはずしますか? ", "Take off which item? ");
528 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
530 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
534 if (object_is_cursed(o_ptr))
536 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
538 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
543 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
545 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
547 o_ptr->ident |= (IDENT_SENSE);
548 o_ptr->curse_flags = 0L;
549 o_ptr->feeling = FEEL_NONE;
551 p_ptr->update |= (PU_BONUS);
552 p_ptr->window |= (PW_EQUIP);
554 msg_print(_("呪いを打ち破った。", "You break the curse."));
558 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
559 take_turn(p_ptr, 50);
564 take_turn(p_ptr, 50);
566 /* Take off the item */
567 (void)inven_takeoff(item, 255);
570 p_ptr->redraw |= (PR_EQUIPPY);
575 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
578 void do_cmd_drop(void)
587 if (p_ptr->special_defense & KATA_MUSOU)
589 set_action(ACTION_NONE);
592 q = _("どのアイテムを落としますか? ", "Drop which item? ");
593 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
595 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
598 /* Hack -- Cannot remove cursed items */
599 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
601 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
605 if (o_ptr->number > 1)
607 amt = get_quantity(NULL, o_ptr->number);
608 if (amt <= 0) return;
611 take_turn(p_ptr, 50);
613 /* Drop (some of) the item */
614 inven_drop(item, amt);
616 if (item >= INVEN_RARM)
622 p_ptr->redraw |= (PR_EQUIPPY);
627 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
630 void do_cmd_destroy(void)
640 object_type *q_ptr = &forge;
642 GAME_TEXT o_name[MAX_NLEN];
643 char out_val[MAX_NLEN+40];
647 if (p_ptr->special_defense & KATA_MUSOU)
649 set_action(ACTION_NONE);
652 /* Hack -- force destruction */
653 if (command_arg > 0) force = TRUE;
655 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
656 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
658 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
661 /* Verify unless quantity given beforehand */
662 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
664 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
666 /* Make a verification */
667 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
670 /* HACK : Add the line to message buffer */
671 message_add(out_val);
672 p_ptr->window |= (PW_MESSAGE);
675 /* Get an acceptable answer */
685 /* Erase the prompt */
689 if (i == 'y' || i == 'Y')
693 if (i == ESCAPE || i == 'n' || i == 'N')
700 /* Add an auto-destroy preference line */
701 if (autopick_autoregister(o_ptr))
703 /* Auto-destroy it */
704 autopick_alter_item(item, TRUE);
707 /* The object is already destroyed. */
713 if (o_ptr->number > 1)
715 amt = get_quantity(NULL, o_ptr->number);
716 if (amt <= 0) return;
720 old_number = o_ptr->number;
722 object_desc(o_name, o_ptr, 0);
723 o_ptr->number = old_number;
725 take_turn(p_ptr, 100);
727 /* Artifacts cannot be destroyed */
728 if (!can_player_destroy_object(o_ptr))
732 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
736 object_copy(q_ptr, o_ptr);
738 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
739 sound(SOUND_DESTITEM);
741 /* Reduce the charges of rods/wands */
742 reduce_charges(o_ptr, amt);
744 /* Eliminate the item (from the pack) */
747 inven_item_increase(item, -amt);
748 inven_item_describe(item);
749 inven_item_optimize(item);
752 /* Eliminate the item (from the floor) */
755 floor_item_increase(0 - item, -amt);
756 floor_item_describe(0 - item);
757 floor_item_optimize(0 - item);
760 if (item_tester_high_level_book(q_ptr))
762 bool gain_expr = FALSE;
764 if (p_ptr->prace == RACE_ANDROID)
767 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
771 else if (p_ptr->pclass == CLASS_PALADIN)
773 if (is_good_realm(p_ptr->realm1))
775 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
779 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
783 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
785 s32b tester_exp = p_ptr->max_exp / 20;
786 if (tester_exp > 10000) tester_exp = 10000;
787 if (q_ptr->sval < 3) tester_exp /= 4;
788 if (tester_exp<1) tester_exp = 1;
790 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
791 gain_exp(tester_exp * amt);
793 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
795 chg_virtue(V_UNLIFE, 1);
796 chg_virtue(V_VITALITY, -1);
798 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
800 chg_virtue(V_UNLIFE, -1);
801 chg_virtue(V_VITALITY, 1);
804 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
805 chg_virtue(V_ENCHANT, -1);
807 if (object_value_real(q_ptr) > 30000)
808 chg_virtue(V_SACRIFICE, 2);
810 else if (object_value_real(q_ptr) > 10000)
811 chg_virtue(V_SACRIFICE, 1);
814 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
815 chg_virtue(V_HARMONY, 1);
817 if (item >= INVEN_RARM) calc_android_exp();
822 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
825 void do_cmd_observe(void)
829 GAME_TEXT o_name[MAX_NLEN];
832 q = _("どのアイテムを調べますか? ", "Examine which item? ");
833 s = _("調べられるアイテムがない。", "You have nothing to examine.");
835 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
838 /* Require full knowledge */
839 if (!(o_ptr->ident & IDENT_MENTAL))
841 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
845 object_desc(o_name, o_ptr, 0);
846 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
847 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
853 * @brief アイテムの銘を消すコマンドのメインルーチン
854 * Remove the inscription from an object XXX Mention item (when done)?
857 void do_cmd_uninscribe(void)
863 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
864 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
866 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
869 /* Nothing to remove */
870 if (!o_ptr->inscription)
872 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
876 msg_print(_("銘を消した。", "Inscription removed."));
878 /* Remove the incription */
879 o_ptr->inscription = 0;
880 p_ptr->update |= (PU_COMBINE);
881 p_ptr->window |= (PW_INVEN | PW_EQUIP);
883 /* .や$の関係で, 再計算が必要なはず -- henkma */
884 p_ptr->update |= (PU_BONUS);
890 * @brief アイテムの銘を刻むコマンドのメインルーチン
891 * Inscribe an object with a comment
894 void do_cmd_inscribe(void)
898 GAME_TEXT o_name[MAX_NLEN];
902 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
903 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
905 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
908 /* Describe the activity */
909 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
911 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
914 /* Start with nothing */
917 /* Use old inscription */
918 if (o_ptr->inscription)
920 /* Start with the old inscription */
921 strcpy(out_val, quark_str(o_ptr->inscription));
924 /* Get a new inscription (possibly empty) */
925 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
927 /* Save the inscription */
928 o_ptr->inscription = quark_add(out_val);
929 p_ptr->update |= (PU_COMBINE);
930 p_ptr->window |= (PW_INVEN | PW_EQUIP);
932 /* .や$の関係で, 再計算が必要なはず -- henkma */
933 p_ptr->update |= (PU_BONUS);
939 * @brief ランタンに燃料を加えるコマンドのメインルーチン
940 * Refill the players lamp (from the pack or floor)
943 static void do_cmd_refill_lamp(void)
950 /* Restrict the choices */
951 item_tester_hook = item_tester_refill_lantern;
953 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
954 s = _("油つぼがない。", "You have no flasks of oil.");
956 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
959 take_turn(p_ptr, 50);
961 /* Access the lantern */
962 j_ptr = &inventory[INVEN_LITE];
965 j_ptr->xtra4 += o_ptr->xtra4;
966 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
968 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
971 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
973 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
976 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
978 else if (j_ptr->xtra4 >= FUEL_LAMP)
980 j_ptr->xtra4 = FUEL_LAMP;
981 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
984 /* Decrease the item (from the pack) */
987 inven_item_increase(item, -1);
988 inven_item_describe(item);
989 inven_item_optimize(item);
992 /* Decrease the item (from the floor) */
995 floor_item_increase(0 - item, -1);
996 floor_item_describe(0 - item);
997 floor_item_optimize(0 - item);
1000 p_ptr->update |= (PU_TORCH);
1004 * @brief 松明を束ねるコマンドのメインルーチン
1005 * Refuel the players torch (from the pack or floor)
1008 static void do_cmd_refill_torch(void)
1017 /* Restrict the choices */
1018 item_tester_hook = object_can_refill_torch;
1020 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1021 s = _("他に松明がない。", "You have no extra torches.");
1023 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1026 take_turn(p_ptr, 50);
1028 /* Access the primary torch */
1029 j_ptr = &inventory[INVEN_LITE];
1032 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1034 msg_print(_("松明を結合した。", "You combine the torches."));
1036 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1039 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1041 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1044 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1046 /* Over-fuel message */
1047 else if (j_ptr->xtra4 >= FUEL_TORCH)
1049 j_ptr->xtra4 = FUEL_TORCH;
1050 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1053 /* Refuel message */
1056 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1059 /* Decrease the item (from the pack) */
1062 inven_item_increase(item, -1);
1063 inven_item_describe(item);
1064 inven_item_optimize(item);
1067 /* Decrease the item (from the floor) */
1070 floor_item_increase(0 - item, -1);
1071 floor_item_describe(0 - item);
1072 floor_item_optimize(0 - item);
1075 p_ptr->update |= (PU_TORCH);
1080 * @brief 燃料を補充するコマンドのメインルーチン
1081 * Refill the players lamp, or restock his torches
1084 void do_cmd_refill(void)
1089 o_ptr = &inventory[INVEN_LITE];
1091 if (p_ptr->special_defense & KATA_MUSOU)
1093 set_action(ACTION_NONE);
1097 if (o_ptr->tval != TV_LITE)
1099 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1103 else if (o_ptr->sval == SV_LITE_LANTERN)
1105 do_cmd_refill_lamp();
1109 else if (o_ptr->sval == SV_LITE_TORCH)
1111 do_cmd_refill_torch();
1114 /* No torch to refill */
1117 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1123 * @brief ターゲットを設定するコマンドのメインルーチン
1127 void do_cmd_target(void)
1129 if (p_ptr->wild_mode) return;
1132 if (target_set(TARGET_KILL))
1134 msg_print(_("ターゲット決定。", "Target Selected."));
1137 /* Target aborted */
1140 msg_print(_("ターゲット解除。", "Target Aborted."));
1147 * @brief 周囲を見渡すコマンドのメインルーチン
1151 void do_cmd_look(void)
1153 p_ptr->window |= PW_MONSTER_LIST;
1157 if (target_set(TARGET_LOOK))
1159 msg_print(_("ターゲット決定。", "Target Selected."));
1165 * @brief 位置を確認するコマンドのメインルーチン
1166 * Allow the player to examine other sectors on the map
1169 void do_cmd_locate(void)
1172 POSITION y1, x1, y2, x2;
1173 GAME_TEXT tmp_val[80];
1174 GAME_TEXT out_val[160];
1177 get_screen_size(&wid, &hgt);
1179 /* Start at current panel */
1180 y2 = y1 = panel_row_min;
1181 x2 = x1 = panel_col_min;
1183 /* Show panels until done */
1186 /* Describe the location */
1187 if ((y2 == y1) && (x2 == x1))
1189 strcpy(tmp_val, _("真上", "\0"));
1193 sprintf(tmp_val, "%s%s",
1194 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1195 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1198 /* Prepare to ask which way to look */
1199 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1200 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1201 y2 / (hgt / 2), y2 % (hgt / 2),
1202 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1204 /* Assume no direction */
1207 /* Get a direction */
1212 /* Get a command (or Cancel) */
1213 if (!get_com(out_val, &command, TRUE)) break;
1215 /* Extract the action (if any) */
1216 dir = get_keymap_dir(command);
1225 /* Apply the motion */
1226 if (change_panel(ddy[dir], ddx[dir]))
1234 /* Recenter the map around the player */
1237 p_ptr->update |= (PU_MONSTERS);
1238 p_ptr->redraw |= (PR_MAP);
1239 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1245 * @brief モンスターの思い出を見るコマンドのメインルーチン
1246 * Identify a character, allow recall of monsters
1250 * Several "special" responses recall "multiple" monsters:
1252 * ^U (all unique monsters)
1253 * ^N (all non-unique monsters)
1255 * The responses may be sorted in several ways, see below.
1257 * Note that the player ghosts are ignored.
1260 void do_cmd_query_symbol(void)
1274 bool recall = FALSE;
1279 /* Get a character, or abort */
1280 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1281 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1283 /* Find that character info, and describe it */
1284 for (i = 0; ident_info[i]; ++i)
1286 if (sym == ident_info[i][0]) break;
1288 if (sym == KTRL('A'))
1291 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1293 else if (sym == KTRL('U'))
1296 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1298 else if (sym == KTRL('N'))
1301 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1303 else if (sym == KTRL('R'))
1306 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1308 /* XTRA HACK WHATSEARCH */
1309 else if (sym == KTRL('M'))
1312 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1317 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1319 else if (ident_info[i])
1321 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1325 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1328 /* Display the result */
1331 /* Allocate the "who" array */
1332 C_MAKE(who, max_r_idx, MONRACE_IDX);
1334 /* Collect matching monsters */
1335 for (n = 0, i = 1; i < max_r_idx; i++)
1337 monster_race *r_ptr = &r_info[i];
1339 /* Nothing to recall */
1340 if (!cheat_know && !r_ptr->r_sights) continue;
1342 /* Require non-unique monsters if needed */
1343 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1345 /* Require unique monsters if needed */
1346 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1348 /* Require ridable monsters if needed */
1349 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1351 /* XTRA HACK WHATSEARCH */
1357 for (xx = 0; temp[xx] && xx < 80; xx++)
1360 if (iskanji(temp[xx])) { xx++; continue; }
1362 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1366 strcpy(temp2, r_name + r_ptr->E_name);
1368 strcpy(temp2, r_name + r_ptr->name);
1370 for (xx = 0; temp2[xx] && xx < 80; xx++)
1371 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1374 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1376 if (my_strstr(temp2, temp))
1381 /* Collect "appropriate" monsters */
1382 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1385 /* Nothing to recall */
1388 C_KILL(who, max_r_idx, MONRACE_IDX);
1393 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1401 /* Sort the array */
1402 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1404 /* Sort by kills (and level) */
1411 /* Catch "escape" */
1414 C_KILL(who, max_r_idx, MONRACE_IDX);
1418 /* Sort if needed */
1421 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1425 /* Start at the end */
1428 /* Scan the monster memory */
1431 /* Extract a race */
1434 /* Hack -- Auto-recall */
1435 monster_race_track(r_idx);
1446 /* Recall on screen */
1447 screen_roff(who[i], 0);
1450 /* Hack -- Begin the prompt */
1453 /* Hack -- Complete the prompt */
1454 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1465 /* Normal commands */
1466 if (query != 'r') break;
1473 if (query == ESCAPE) break;
1475 /* Move to "prev" monster */
1481 if (!expand_list) break;
1485 /* Move to "next" monster */
1491 if (!expand_list) break;
1496 /* Free the "who" array */
1497 C_KILL(who, max_r_idx, IDX);
1499 /* Re-display the identity */
1504 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1508 * XXX - Add actions for other item types
1510 void do_cmd_use(void)
1516 if (p_ptr->wild_mode)
1521 if (cmd_limit_arena(p_ptr)) return;
1523 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1525 set_action(ACTION_NONE);
1528 item_tester_hook = item_tester_hook_use;
1530 q = _("どれを使いますか?", "Use which item? ");
1531 s = _("使えるものがありません。", "You have nothing to use.");
1533 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1536 switch (o_ptr->tval)
1548 do_cmd_eat_food_aux(item);
1555 do_cmd_aim_wand_aux(item);
1562 do_cmd_use_staff_aux(item);
1569 do_cmd_zap_rod_aux(item);
1573 /* Quaff a potion */
1576 do_cmd_quaff_potion_aux(item);
1583 if (cmd_limit_blind(p_ptr)) return;
1584 if (cmd_limit_confused(p_ptr)) return;
1586 do_cmd_read_scroll_aux(item, TRUE);
1595 exe_fire(item, &inventory[INVEN_BOW], SP_NONE);
1599 /* Activate an artifact */
1602 do_cmd_activate_aux(item);