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.
21 #include "cmd-activate.h"
23 #include "cmd-quaff.h"
25 #include "cmd-usestaff.h"
26 #include "cmd-zaprod.h"
27 #include "cmd-zapwand.h"
29 #include "cmd-basic.h"
31 #include "object-flavor.h"
32 #include "object-hook.h"
33 #include "object-ego.h"
38 #include "player-status.h"
39 #include "player-effects.h"
40 #include "player-class.h"
41 #include "player-personality.h"
43 #include "view-mainwindow.h"
45 #include "objectkind.h"
47 #include "targeting.h"
49 #include "player-race.h"
50 #include "view-mainwindow.h"
51 #include "player-inventory.h"
54 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
57 void do_cmd_inven(void)
61 /* Note that we are in "p_ptr->inventory_list" mode */
64 /* Note that we are in "p_ptr->inventory_list" mode */
65 if (easy_floor) command_wrk = (USE_INVEN);
68 /* Display the p_ptr->inventory_list */
69 (void)show_inven(0, USE_FULL, 0);
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()));
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());
82 command_new = inkey();
85 /* Process "Escape" */
86 if (command_new == ESCAPE)
90 Term_get_size(&wid, &hgt);
94 command_gap = wid - 30;
97 /* Process normal keys */
100 /* Hack -- Use "display" mode */
107 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
110 void do_cmd_equip(void)
114 /* Note that we are in "equipment" mode */
117 /* Note that we are in "equipment" mode */
118 if (easy_floor) command_wrk = (USE_EQUIP);
121 (void)show_equip(0, USE_FULL, 0);
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()));
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()));
135 command_new = inkey();
138 /* Process "Escape" */
139 if (command_new == ESCAPE)
143 Term_get_size(&wid, &hgt);
147 command_gap = wid - 30;
150 /* Process normal keys */
153 /* Enter "display" mode */
161 bool select_ring_slot = FALSE;
164 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
167 void do_cmd_wield(void)
169 OBJECT_IDX item, slot;
177 GAME_TEXT o_name[MAX_NLEN];
180 OBJECT_IDX need_switch_wielding = 0;
182 if (p_ptr->special_defense & KATA_MUSOU)
184 set_action(p_ptr, ACTION_NONE);
187 /* Restrict the choices */
188 item_tester_hook = item_tester_hook_wear;
190 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
191 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
193 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
197 slot = wield_slot(o_ptr);
201 /* Shields and some misc. items */
206 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
208 /* Restrict the choices */
209 item_tester_hook = item_tester_hook_melee_weapon;
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;
218 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
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]))
224 /* Restrict the choices */
225 item_tester_hook = item_tester_hook_mochikae;
228 q = _("どちらの手に装備しますか?", "Equip which hand? ");
229 s = _("おっと。", "Oops.");
230 if (!choose_object(&slot, q, s, (USE_EQUIP), 0)) return;
239 /* Asking for dual wielding */
240 if (slot == INVEN_LARM)
242 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
245 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
247 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
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)
253 /* Restrict the choices */
254 item_tester_hook = item_tester_hook_mochikae;
257 q = _("どちらの手に装備しますか?", "Equip which hand? ");
258 s = _("おっと。", "Oops.");
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;
268 /* Choose a ring slot */
269 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
271 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
275 q = _("どちらの手に装備しますか?", "Equip which hand? ");
277 s = _("おっと。", "Oops.");
279 /* Restrict the choices */
280 select_ring_slot = TRUE;
282 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0))
284 select_ring_slot = FALSE;
287 select_ring_slot = FALSE;
291 /* Prevent wielding into a cursed slot */
292 if (object_is_cursed(&p_ptr->inventory_list[slot]))
294 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
296 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
298 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
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))))
308 char dummy[MAX_NLEN+80];
310 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
311 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
313 if (!get_check(dummy)) return;
316 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
318 char dummy[MAX_NLEN+100];
320 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
322 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
323 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
325 if (!get_check(dummy)) return;
328 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
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];
336 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
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);
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;
348 check_find_art_quest_completion(o_ptr);
350 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
352 identify_item(o_ptr);
354 /* Auto-inscription */
355 autopick_alter_item(item, FALSE);
358 take_turn(p_ptr, 100);
361 /* Obtain local object */
362 object_copy(q_ptr, o_ptr);
364 /* Modify quantity */
367 /* Decrease the item (from the pack) */
370 inven_item_increase(item, -1);
371 inven_item_optimize(item);
374 /* Decrease the item (from the floor) */
377 floor_item_increase(0 - item, -1);
378 floor_item_optimize(0 - item);
381 /* Access the wield slot */
382 o_ptr = &p_ptr->inventory_list[slot];
384 /* Take off existing item */
387 /* Take off existing item */
388 (void)inven_takeoff(slot, 255);
391 /* Wear the new stuff */
392 object_copy(o_ptr, q_ptr);
394 o_ptr->marked |= OM_TOUCHED;
396 p_ptr->total_weight += q_ptr->weight;
398 /* Increment the equip counter by hand */
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.")
405 /* Where is the item now */
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;
412 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
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;
419 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
423 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
427 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
431 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
435 object_desc(o_name, o_ptr, 0);
436 msg_format(act, o_name, index_to_label(slot));
439 if (object_is_cursed(o_ptr))
441 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
442 chg_virtue(p_ptr, V_HARMONY, -1);
445 o_ptr->ident |= (IDENT_SENSE);
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))
451 /* Turn into a vampire */
452 change_race(p_ptr, RACE_VAMPIRE, "");
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);
459 calc_android_exp(p_ptr);
464 * @param item 持ち替えを行いたい装備部位ID
467 void kamaenaoshi(INVENTORY_IDX item)
469 object_type *o_ptr, *new_o_ptr;
470 GAME_TEXT o_name[MAX_NLEN];
472 if (item == INVEN_RARM)
474 if (has_melee_weapon(INVEN_LARM))
476 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
477 object_desc(o_name, o_ptr, 0);
479 if (!object_is_cursed(o_ptr))
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);
489 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
490 (left_hander ? _("左手", "left") : _("右手", "right")));
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);
499 else if (item == INVEN_LARM)
501 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
502 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
504 if (has_melee_weapon(INVEN_RARM))
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);
509 else if (!(empty_hands(p_ptr, FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
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);
523 * @brief 装備を外すコマンドのメインルーチン / Take off an item
526 void do_cmd_takeoff(void)
532 if (p_ptr->special_defense & KATA_MUSOU)
534 set_action(p_ptr, ACTION_NONE);
537 q = _("どれを装備からはずしますか? ", "Take off which item? ");
538 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
540 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
544 if (object_is_cursed(o_ptr))
546 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
548 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
553 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
555 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
557 o_ptr->ident |= (IDENT_SENSE);
558 o_ptr->curse_flags = 0L;
559 o_ptr->feeling = FEEL_NONE;
561 p_ptr->update |= (PU_BONUS);
562 p_ptr->window |= (PW_EQUIP);
564 msg_print(_("呪いを打ち破った。", "You break the curse."));
568 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
569 take_turn(p_ptr, 50);
574 take_turn(p_ptr, 50);
576 /* Take off the item */
577 (void)inven_takeoff(item, 255);
579 calc_android_exp(p_ptr);
580 p_ptr->redraw |= (PR_EQUIPPY);
585 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
588 void do_cmd_drop(void)
597 if (p_ptr->special_defense & KATA_MUSOU)
599 set_action(p_ptr, ACTION_NONE);
602 q = _("どのアイテムを落としますか? ", "Drop which item? ");
603 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
605 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
608 /* Hack -- Cannot remove cursed items */
609 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
611 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
615 if (o_ptr->number > 1)
617 amt = get_quantity(NULL, o_ptr->number);
618 if (amt <= 0) return;
621 take_turn(p_ptr, 50);
623 /* Drop (some of) the item */
624 inven_drop(item, amt);
626 if (item >= INVEN_RARM)
629 calc_android_exp(p_ptr);
632 p_ptr->redraw |= (PR_EQUIPPY);
637 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
640 void do_cmd_destroy(void)
650 object_type *q_ptr = &forge;
652 GAME_TEXT o_name[MAX_NLEN];
653 char out_val[MAX_NLEN+40];
657 if (p_ptr->special_defense & KATA_MUSOU)
659 set_action(p_ptr, ACTION_NONE);
662 /* Hack -- force destruction */
663 if (command_arg > 0) force = TRUE;
665 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
666 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
668 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
671 /* Verify unless quantity given beforehand */
672 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
674 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
676 /* Make a verification */
677 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
680 /* HACK : Add the line to message buffer */
681 message_add(out_val);
682 p_ptr->window |= (PW_MESSAGE);
685 /* Get an acceptable answer */
695 /* Erase the prompt */
699 if (i == 'y' || i == 'Y')
703 if (i == ESCAPE || i == 'n' || i == 'N')
710 /* Add an auto-destroy preference line */
711 if (autopick_autoregister(o_ptr))
713 /* Auto-destroy it */
714 autopick_alter_item(item, TRUE);
717 /* The object is already destroyed. */
723 if (o_ptr->number > 1)
725 amt = get_quantity(NULL, o_ptr->number);
726 if (amt <= 0) return;
730 old_number = o_ptr->number;
732 object_desc(o_name, o_ptr, 0);
733 o_ptr->number = old_number;
735 take_turn(p_ptr, 100);
737 /* Artifacts cannot be destroyed */
738 if (!can_player_destroy_object(o_ptr))
742 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
746 object_copy(q_ptr, o_ptr);
748 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
749 sound(SOUND_DESTITEM);
751 /* Reduce the charges of rods/wands */
752 reduce_charges(o_ptr, amt);
754 /* Eliminate the item (from the pack) */
757 inven_item_increase(item, -amt);
758 inven_item_describe(item);
759 inven_item_optimize(item);
762 /* Eliminate the item (from the floor) */
765 floor_item_increase(0 - item, -amt);
766 floor_item_describe(0 - item);
767 floor_item_optimize(0 - item);
770 if (item_tester_high_level_book(q_ptr))
772 bool gain_expr = FALSE;
774 if (p_ptr->prace == RACE_ANDROID)
777 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
781 else if (p_ptr->pclass == CLASS_PALADIN)
783 if (is_good_realm(p_ptr->realm1))
785 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
789 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
793 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
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;
800 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
801 gain_exp(p_ptr, tester_exp * amt);
803 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
805 chg_virtue(p_ptr, V_UNLIFE, 1);
806 chg_virtue(p_ptr, V_VITALITY, -1);
808 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
810 chg_virtue(p_ptr, V_UNLIFE, -1);
811 chg_virtue(p_ptr, V_VITALITY, 1);
814 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
815 chg_virtue(p_ptr, V_ENCHANT, -1);
817 if (object_value_real(q_ptr) > 30000)
818 chg_virtue(p_ptr, V_SACRIFICE, 2);
820 else if (object_value_real(q_ptr) > 10000)
821 chg_virtue(p_ptr, V_SACRIFICE, 1);
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);
827 if (item >= INVEN_RARM) calc_android_exp(p_ptr);
832 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
835 void do_cmd_observe(void)
839 GAME_TEXT o_name[MAX_NLEN];
842 q = _("どのアイテムを調べますか? ", "Examine which item? ");
843 s = _("調べられるアイテムがない。", "You have nothing to examine.");
845 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
848 /* Require full knowledge */
849 if (!(o_ptr->ident & IDENT_MENTAL))
851 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
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."));
863 * @brief アイテムの銘を消すコマンドのメインルーチン
864 * Remove the inscription from an object XXX Mention item (when done)?
867 void do_cmd_uninscribe(void)
873 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
874 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
876 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
879 /* Nothing to remove */
880 if (!o_ptr->inscription)
882 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
886 msg_print(_("銘を消した。", "Inscription removed."));
888 /* Remove the incription */
889 o_ptr->inscription = 0;
890 p_ptr->update |= (PU_COMBINE);
891 p_ptr->window |= (PW_INVEN | PW_EQUIP);
893 /* .や$の関係で, 再計算が必要なはず -- henkma */
894 p_ptr->update |= (PU_BONUS);
900 * @brief アイテムの銘を刻むコマンドのメインルーチン
901 * Inscribe an object with a comment
904 void do_cmd_inscribe(void)
908 GAME_TEXT o_name[MAX_NLEN];
912 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
913 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
915 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
918 /* Describe the activity */
919 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
921 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
924 /* Start with nothing */
927 /* Use old inscription */
928 if (o_ptr->inscription)
930 /* Start with the old inscription */
931 strcpy(out_val, quark_str(o_ptr->inscription));
934 /* Get a new inscription (possibly empty) */
935 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
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);
942 /* .や$の関係で, 再計算が必要なはず -- henkma */
943 p_ptr->update |= (PU_BONUS);
949 * @brief ランタンに燃料を加えるコマンドのメインルーチン
950 * Refill the players lamp (from the pack or floor)
953 static void do_cmd_refill_lamp(void)
960 /* Restrict the choices */
961 item_tester_hook = item_tester_refill_lantern;
963 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
964 s = _("油つぼがない。", "You have no flasks of oil.");
966 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
969 take_turn(p_ptr, 50);
971 /* Access the lantern */
972 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
975 j_ptr->xtra4 += o_ptr->xtra4;
976 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
978 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
981 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
983 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
986 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
988 else if (j_ptr->xtra4 >= FUEL_LAMP)
990 j_ptr->xtra4 = FUEL_LAMP;
991 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
994 /* Decrease the item (from the pack) */
997 inven_item_increase(item, -1);
998 inven_item_describe(item);
999 inven_item_optimize(item);
1002 /* Decrease the item (from the floor) */
1005 floor_item_increase(0 - item, -1);
1006 floor_item_describe(0 - item);
1007 floor_item_optimize(0 - item);
1010 p_ptr->update |= (PU_TORCH);
1014 * @brief 松明を束ねるコマンドのメインルーチン
1015 * Refuel the players torch (from the pack or floor)
1018 static void do_cmd_refill_torch(void)
1027 /* Restrict the choices */
1028 item_tester_hook = object_can_refill_torch;
1030 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1031 s = _("他に松明がない。", "You have no extra torches.");
1033 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
1036 take_turn(p_ptr, 50);
1038 /* Access the primary torch */
1039 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1042 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1044 msg_print(_("松明を結合した。", "You combine the torches."));
1046 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1049 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1051 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1054 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1056 /* Over-fuel message */
1057 else if (j_ptr->xtra4 >= FUEL_TORCH)
1059 j_ptr->xtra4 = FUEL_TORCH;
1060 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1063 /* Refuel message */
1066 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1069 /* Decrease the item (from the pack) */
1072 inven_item_increase(item, -1);
1073 inven_item_describe(item);
1074 inven_item_optimize(item);
1077 /* Decrease the item (from the floor) */
1080 floor_item_increase(0 - item, -1);
1081 floor_item_describe(0 - item);
1082 floor_item_optimize(0 - item);
1085 p_ptr->update |= (PU_TORCH);
1090 * @brief 燃料を補充するコマンドのメインルーチン
1091 * Refill the players lamp, or restock his torches
1094 void do_cmd_refill(void)
1099 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1101 if (p_ptr->special_defense & KATA_MUSOU)
1103 set_action(p_ptr, ACTION_NONE);
1107 if (o_ptr->tval != TV_LITE)
1109 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1113 else if (o_ptr->sval == SV_LITE_LANTERN)
1115 do_cmd_refill_lamp();
1119 else if (o_ptr->sval == SV_LITE_TORCH)
1121 do_cmd_refill_torch();
1124 /* No torch to refill */
1127 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1133 * @brief ターゲットを設定するコマンドのメインルーチン
1137 void do_cmd_target(void)
1139 if (p_ptr->wild_mode) return;
1142 if (target_set(TARGET_KILL))
1144 msg_print(_("ターゲット決定。", "Target Selected."));
1147 /* Target aborted */
1150 msg_print(_("ターゲット解除。", "Target Aborted."));
1157 * @brief 周囲を見渡すコマンドのメインルーチン
1161 void do_cmd_look(void)
1163 p_ptr->window |= PW_MONSTER_LIST;
1167 if (target_set(TARGET_LOOK))
1169 msg_print(_("ターゲット決定。", "Target Selected."));
1175 * @brief 位置を確認するコマンドのメインルーチン
1176 * Allow the player to examine other sectors on the map
1179 void do_cmd_locate(void)
1182 POSITION y1, x1, y2, x2;
1183 GAME_TEXT tmp_val[80];
1184 GAME_TEXT out_val[160];
1187 get_screen_size(&wid, &hgt);
1189 /* Start at current panel */
1190 y2 = y1 = panel_row_min;
1191 x2 = x1 = panel_col_min;
1193 /* Show panels until done */
1196 /* Describe the location */
1197 if ((y2 == y1) && (x2 == x1))
1199 strcpy(tmp_val, _("真上", "\0"));
1203 sprintf(tmp_val, "%s%s",
1204 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1205 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
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);
1214 /* Assume no direction */
1217 /* Get a direction */
1222 /* Get a command (or Cancel) */
1223 if (!get_com(out_val, &command, TRUE)) break;
1225 /* Extract the action (if any) */
1226 dir = get_keymap_dir(command);
1235 /* Apply the motion */
1236 if (change_panel(ddy[dir], ddx[dir]))
1244 /* Recenter the map around the player */
1247 p_ptr->update |= (PU_MONSTERS);
1248 p_ptr->redraw |= (PR_MAP);
1249 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1255 * @brief モンスターの思い出を見るコマンドのメインルーチン
1256 * Identify a character, allow recall of monsters
1260 * Several "special" responses recall "multiple" monsters:
1262 * ^U (all unique monsters)
1263 * ^N (all non-unique monsters)
1265 * The responses may be sorted in several ways, see below.
1267 * Note that the player ghosts are ignored.
1270 void do_cmd_query_symbol(void)
1284 bool recall = FALSE;
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;
1293 /* Find that character info, and describe it */
1294 for (i = 0; ident_info[i]; ++i)
1296 if (sym == ident_info[i][0]) break;
1298 if (sym == KTRL('A'))
1301 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1303 else if (sym == KTRL('U'))
1306 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1308 else if (sym == KTRL('N'))
1311 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1313 else if (sym == KTRL('R'))
1316 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1318 /* XTRA HACK WHATSEARCH */
1319 else if (sym == KTRL('M'))
1322 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1327 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1329 else if (ident_info[i])
1331 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1335 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1338 /* Display the result */
1341 /* Allocate the "who" array */
1342 C_MAKE(who, max_r_idx, MONRACE_IDX);
1344 /* Collect matching monsters */
1345 for (n = 0, i = 1; i < max_r_idx; i++)
1347 monster_race *r_ptr = &r_info[i];
1349 /* Nothing to recall */
1350 if (!cheat_know && !r_ptr->r_sights) continue;
1352 /* Require non-unique monsters if needed */
1353 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1355 /* Require unique monsters if needed */
1356 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1358 /* Require ridable monsters if needed */
1359 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1361 /* XTRA HACK WHATSEARCH */
1367 for (xx = 0; temp[xx] && xx < 80; xx++)
1370 if (iskanji(temp[xx])) { xx++; continue; }
1372 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1376 strcpy(temp2, r_name + r_ptr->E_name);
1378 strcpy(temp2, r_name + r_ptr->name);
1380 for (xx = 0; temp2[xx] && xx < 80; xx++)
1381 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1384 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1386 if (my_strstr(temp2, temp))
1391 /* Collect "appropriate" monsters */
1392 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1395 /* Nothing to recall */
1398 C_KILL(who, max_r_idx, MONRACE_IDX);
1403 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1411 /* Sort the array */
1412 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1414 /* Sort by kills (and level) */
1421 /* Catch "escape" */
1424 C_KILL(who, max_r_idx, MONRACE_IDX);
1428 /* Sort if needed */
1431 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1435 /* Start at the end */
1438 /* Scan the monster memory */
1443 /* Hack -- Auto-recall */
1444 monster_race_track(r_idx);
1454 /* Recall on screen */
1455 screen_roff(who[i], 0);
1458 /* Hack -- Begin the prompt */
1461 /* Hack -- Complete the prompt */
1462 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1472 /* Normal commands */
1473 if (query != 'r') break;
1480 if (query == ESCAPE) break;
1482 /* Move to "prev" monster */
1488 if (!expand_list) break;
1492 /* Move to "next" monster */
1498 if (!expand_list) break;
1503 /* Free the "who" array */
1504 C_KILL(who, max_r_idx, IDX);
1506 /* Re-display the identity */
1511 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1515 * XXX - Add actions for other item types
1517 void do_cmd_use(void)
1523 if (p_ptr->wild_mode)
1528 if (cmd_limit_arena(p_ptr)) return;
1530 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1532 set_action(p_ptr, ACTION_NONE);
1535 item_tester_hook = item_tester_hook_use;
1537 q = _("どれを使いますか?", "Use which item? ");
1538 s = _("使えるものがありません。", "You have nothing to use.");
1540 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1543 switch (o_ptr->tval)
1558 exe_use_staff(item);
1566 exe_quaff_potion(item);
1570 if (cmd_limit_blind(p_ptr)) return;
1571 if (cmd_limit_confused(p_ptr)) return;
1572 exe_read(item, TRUE);
1578 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1582 exe_activate(p_ptr, item);