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"
39 #include "objectkind.h"
43 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
46 void do_cmd_inven(void)
50 /* Note that we are in "p_ptr->inventory_list" mode */
53 /* Note that we are in "p_ptr->inventory_list" mode */
54 if (easy_floor) command_wrk = (USE_INVEN);
57 /* Display the p_ptr->inventory_list */
58 (void)show_inven(0, USE_FULL);
61 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
62 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
63 (long int)((p_ptr->total_weight * 100) / weight_limit()));
65 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
66 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
67 (p_ptr->total_weight * 100) / weight_limit());
71 command_new = inkey();
74 /* Process "Escape" */
75 if (command_new == ESCAPE)
79 Term_get_size(&wid, &hgt);
83 command_gap = wid - 30;
86 /* Process normal keys */
89 /* Hack -- Use "display" mode */
96 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
99 void do_cmd_equip(void)
103 /* Note that we are in "equipment" mode */
106 /* Note that we are in "equipment" mode */
107 if (easy_floor) command_wrk = (USE_EQUIP);
110 (void)show_equip(0, USE_FULL);
114 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
115 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
116 (long int)((p_ptr->total_weight * 100) / weight_limit()));
118 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
119 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
120 (long int)((p_ptr->total_weight * 100) / weight_limit()));
124 command_new = inkey();
127 /* Process "Escape" */
128 if (command_new == ESCAPE)
132 Term_get_size(&wid, &hgt);
136 command_gap = wid - 30;
139 /* Process normal keys */
142 /* Enter "display" mode */
150 bool select_ring_slot = FALSE;
153 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
156 void do_cmd_wield(void)
158 OBJECT_IDX item, slot;
166 GAME_TEXT o_name[MAX_NLEN];
169 OBJECT_IDX need_switch_wielding = 0;
171 if (p_ptr->special_defense & KATA_MUSOU)
173 set_action(ACTION_NONE);
176 /* Restrict the choices */
177 item_tester_hook = item_tester_hook_wear;
179 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
180 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
182 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
186 slot = wield_slot(o_ptr);
190 /* Shields and some misc. items */
195 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
197 /* Restrict the choices */
198 item_tester_hook = item_tester_hook_melee_weapon;
200 /* Choose a weapon from the equipment only */
201 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
202 s = _("おっと。", "Oops.");
203 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
204 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
207 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
209 /* Both arms are already used by non-weapon */
210 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
211 p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
213 /* Restrict the choices */
214 item_tester_hook = item_tester_hook_mochikae;
217 q = _("どちらの手に装備しますか?", "Equip which hand? ");
218 s = _("おっと。", "Oops.");
219 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
228 /* Asking for dual wielding */
229 if (slot == INVEN_LARM)
231 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
234 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
236 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
239 /* Both arms are already used */
240 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
242 /* Restrict the choices */
243 item_tester_hook = item_tester_hook_mochikae;
246 q = _("どちらの手に装備しますか?", "Equip which hand? ");
247 s = _("おっと。", "Oops.");
249 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
250 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
251 need_switch_wielding = INVEN_RARM;
257 /* Choose a ring slot */
258 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
260 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
264 q = _("どちらの手に装備しますか?", "Equip which hand? ");
266 s = _("おっと。", "Oops.");
268 /* Restrict the choices */
269 select_ring_slot = TRUE;
271 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
273 select_ring_slot = FALSE;
276 select_ring_slot = FALSE;
280 /* Prevent wielding into a cursed slot */
281 if (object_is_cursed(&p_ptr->inventory_list[slot]))
283 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
286 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
288 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
291 /* Cancel the command */
296 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
297 ((o_ptr->ident & IDENT_SENSE) &&
298 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
300 char dummy[MAX_NLEN+80];
302 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
303 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
305 if (!get_check(dummy)) return;
308 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
310 char dummy[MAX_NLEN+100];
312 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
314 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
315 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
317 if (!get_check(dummy)) return;
320 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
322 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
323 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
324 object_type object_tmp;
325 object_type *otmp_ptr = &object_tmp;
326 GAME_TEXT switch_name[MAX_NLEN];
328 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
330 object_copy(otmp_ptr, switch_o_ptr);
331 object_copy(switch_o_ptr, slot_o_ptr);
332 object_copy(slot_o_ptr, otmp_ptr);
334 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
335 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
336 (left_hander ? _("右手", "right") : _("左手", "left")));
337 slot = need_switch_wielding;
340 check_find_art_quest_completion(o_ptr);
342 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
344 identify_item(o_ptr);
346 /* Auto-inscription */
347 autopick_alter_item(item, FALSE);
350 take_turn(p_ptr, 100);
353 /* Obtain local object */
354 object_copy(q_ptr, o_ptr);
356 /* Modify quantity */
359 /* Decrease the item (from the pack) */
362 inven_item_increase(item, -1);
363 inven_item_optimize(item);
366 /* Decrease the item (from the floor) */
369 floor_item_increase(0 - item, -1);
370 floor_item_optimize(0 - item);
373 /* Access the wield slot */
374 o_ptr = &p_ptr->inventory_list[slot];
376 /* Take off existing item */
379 /* Take off existing item */
380 (void)inven_takeoff(slot, 255);
383 /* Wear the new stuff */
384 object_copy(o_ptr, q_ptr);
386 o_ptr->marked |= OM_TOUCHED;
388 p_ptr->total_weight += q_ptr->weight;
390 /* Increment the equip counter by hand */
393 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
394 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
395 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
397 /* Where is the item now */
401 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
402 act = STR_WIELD_ARMS;
404 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
408 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
409 act = STR_WIELD_ARMS;
411 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
415 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
419 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
423 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
427 object_desc(o_name, o_ptr, 0);
428 msg_format(act, o_name, index_to_label(slot));
431 if (object_is_cursed(o_ptr))
433 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
434 chg_virtue(V_HARMONY, -1);
437 o_ptr->ident |= (IDENT_SENSE);
440 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
441 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
443 /* Turn into a vampire */
444 change_race(RACE_VAMPIRE, "");
447 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
448 p_ptr->redraw |= (PR_EQUIPPY);
449 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
456 * @param item 持ち替えを行いたい装備部位ID
459 void kamaenaoshi(INVENTORY_IDX item)
461 object_type *o_ptr, *new_o_ptr;
462 GAME_TEXT o_name[MAX_NLEN];
464 if (item == INVEN_RARM)
466 if (has_melee_weapon(INVEN_LARM))
468 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
469 object_desc(o_name, o_ptr, 0);
471 if (!object_is_cursed(o_ptr))
473 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
474 object_copy(new_o_ptr, o_ptr);
475 p_ptr->total_weight += o_ptr->weight;
476 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
477 inven_item_optimize(INVEN_LARM);
478 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
479 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
481 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
482 (left_hander ? _("左手", "left") : _("右手", "right")));
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);
491 else if (item == INVEN_LARM)
493 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
494 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
496 if (has_melee_weapon(INVEN_RARM))
498 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
499 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
501 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
503 new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
504 object_copy(new_o_ptr, o_ptr);
505 p_ptr->total_weight += o_ptr->weight;
506 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
507 inven_item_optimize(INVEN_RARM);
508 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
515 * @brief 装備を外すコマンドのメインルーチン / Take off an item
518 void do_cmd_takeoff(void)
524 if (p_ptr->special_defense & KATA_MUSOU)
526 set_action(ACTION_NONE);
529 q = _("どれを装備からはずしますか? ", "Take off which item? ");
530 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
532 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
536 if (object_is_cursed(o_ptr))
538 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
540 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
545 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
547 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
549 o_ptr->ident |= (IDENT_SENSE);
550 o_ptr->curse_flags = 0L;
551 o_ptr->feeling = FEEL_NONE;
553 p_ptr->update |= (PU_BONUS);
554 p_ptr->window |= (PW_EQUIP);
556 msg_print(_("呪いを打ち破った。", "You break the curse."));
560 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
561 take_turn(p_ptr, 50);
566 take_turn(p_ptr, 50);
568 /* Take off the item */
569 (void)inven_takeoff(item, 255);
572 p_ptr->redraw |= (PR_EQUIPPY);
577 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
580 void do_cmd_drop(void)
589 if (p_ptr->special_defense & KATA_MUSOU)
591 set_action(ACTION_NONE);
594 q = _("どのアイテムを落としますか? ", "Drop which item? ");
595 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
597 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
600 /* Hack -- Cannot remove cursed items */
601 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
603 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
607 if (o_ptr->number > 1)
609 amt = get_quantity(NULL, o_ptr->number);
610 if (amt <= 0) return;
613 take_turn(p_ptr, 50);
615 /* Drop (some of) the item */
616 inven_drop(item, amt);
618 if (item >= INVEN_RARM)
624 p_ptr->redraw |= (PR_EQUIPPY);
629 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
632 void do_cmd_destroy(void)
642 object_type *q_ptr = &forge;
644 GAME_TEXT o_name[MAX_NLEN];
645 char out_val[MAX_NLEN+40];
649 if (p_ptr->special_defense & KATA_MUSOU)
651 set_action(ACTION_NONE);
654 /* Hack -- force destruction */
655 if (command_arg > 0) force = TRUE;
657 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
658 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
660 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
663 /* Verify unless quantity given beforehand */
664 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
666 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
668 /* Make a verification */
669 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
672 /* HACK : Add the line to message buffer */
673 message_add(out_val);
674 p_ptr->window |= (PW_MESSAGE);
677 /* Get an acceptable answer */
687 /* Erase the prompt */
691 if (i == 'y' || i == 'Y')
695 if (i == ESCAPE || i == 'n' || i == 'N')
702 /* Add an auto-destroy preference line */
703 if (autopick_autoregister(o_ptr))
705 /* Auto-destroy it */
706 autopick_alter_item(item, TRUE);
709 /* The object is already destroyed. */
715 if (o_ptr->number > 1)
717 amt = get_quantity(NULL, o_ptr->number);
718 if (amt <= 0) return;
722 old_number = o_ptr->number;
724 object_desc(o_name, o_ptr, 0);
725 o_ptr->number = old_number;
727 take_turn(p_ptr, 100);
729 /* Artifacts cannot be destroyed */
730 if (!can_player_destroy_object(o_ptr))
734 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
738 object_copy(q_ptr, o_ptr);
740 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
741 sound(SOUND_DESTITEM);
743 /* Reduce the charges of rods/wands */
744 reduce_charges(o_ptr, amt);
746 /* Eliminate the item (from the pack) */
749 inven_item_increase(item, -amt);
750 inven_item_describe(item);
751 inven_item_optimize(item);
754 /* Eliminate the item (from the floor) */
757 floor_item_increase(0 - item, -amt);
758 floor_item_describe(0 - item);
759 floor_item_optimize(0 - item);
762 if (item_tester_high_level_book(q_ptr))
764 bool gain_expr = FALSE;
766 if (p_ptr->prace == RACE_ANDROID)
769 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
773 else if (p_ptr->pclass == CLASS_PALADIN)
775 if (is_good_realm(p_ptr->realm1))
777 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
781 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
785 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
787 s32b tester_exp = p_ptr->max_exp / 20;
788 if (tester_exp > 10000) tester_exp = 10000;
789 if (q_ptr->sval < 3) tester_exp /= 4;
790 if (tester_exp<1) tester_exp = 1;
792 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
793 gain_exp(tester_exp * amt);
795 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
797 chg_virtue(V_UNLIFE, 1);
798 chg_virtue(V_VITALITY, -1);
800 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
802 chg_virtue(V_UNLIFE, -1);
803 chg_virtue(V_VITALITY, 1);
806 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
807 chg_virtue(V_ENCHANT, -1);
809 if (object_value_real(q_ptr) > 30000)
810 chg_virtue(V_SACRIFICE, 2);
812 else if (object_value_real(q_ptr) > 10000)
813 chg_virtue(V_SACRIFICE, 1);
816 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
817 chg_virtue(V_HARMONY, 1);
819 if (item >= INVEN_RARM) calc_android_exp();
824 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
827 void do_cmd_observe(void)
831 GAME_TEXT o_name[MAX_NLEN];
834 q = _("どのアイテムを調べますか? ", "Examine which item? ");
835 s = _("調べられるアイテムがない。", "You have nothing to examine.");
837 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
840 /* Require full knowledge */
841 if (!(o_ptr->ident & IDENT_MENTAL))
843 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
847 object_desc(o_name, o_ptr, 0);
848 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
849 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
855 * @brief アイテムの銘を消すコマンドのメインルーチン
856 * Remove the inscription from an object XXX Mention item (when done)?
859 void do_cmd_uninscribe(void)
865 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
866 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
868 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
871 /* Nothing to remove */
872 if (!o_ptr->inscription)
874 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
878 msg_print(_("銘を消した。", "Inscription removed."));
880 /* Remove the incription */
881 o_ptr->inscription = 0;
882 p_ptr->update |= (PU_COMBINE);
883 p_ptr->window |= (PW_INVEN | PW_EQUIP);
885 /* .や$の関係で, 再計算が必要なはず -- henkma */
886 p_ptr->update |= (PU_BONUS);
892 * @brief アイテムの銘を刻むコマンドのメインルーチン
893 * Inscribe an object with a comment
896 void do_cmd_inscribe(void)
900 GAME_TEXT o_name[MAX_NLEN];
904 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
905 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
907 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
910 /* Describe the activity */
911 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
913 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
916 /* Start with nothing */
919 /* Use old inscription */
920 if (o_ptr->inscription)
922 /* Start with the old inscription */
923 strcpy(out_val, quark_str(o_ptr->inscription));
926 /* Get a new inscription (possibly empty) */
927 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
929 /* Save the inscription */
930 o_ptr->inscription = quark_add(out_val);
931 p_ptr->update |= (PU_COMBINE);
932 p_ptr->window |= (PW_INVEN | PW_EQUIP);
934 /* .や$の関係で, 再計算が必要なはず -- henkma */
935 p_ptr->update |= (PU_BONUS);
941 * @brief ランタンに燃料を加えるコマンドのメインルーチン
942 * Refill the players lamp (from the pack or floor)
945 static void do_cmd_refill_lamp(void)
952 /* Restrict the choices */
953 item_tester_hook = item_tester_refill_lantern;
955 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
956 s = _("油つぼがない。", "You have no flasks of oil.");
958 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
961 take_turn(p_ptr, 50);
963 /* Access the lantern */
964 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
967 j_ptr->xtra4 += o_ptr->xtra4;
968 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
970 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
973 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
975 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
978 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
980 else if (j_ptr->xtra4 >= FUEL_LAMP)
982 j_ptr->xtra4 = FUEL_LAMP;
983 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
986 /* Decrease the item (from the pack) */
989 inven_item_increase(item, -1);
990 inven_item_describe(item);
991 inven_item_optimize(item);
994 /* Decrease the item (from the floor) */
997 floor_item_increase(0 - item, -1);
998 floor_item_describe(0 - item);
999 floor_item_optimize(0 - item);
1002 p_ptr->update |= (PU_TORCH);
1006 * @brief 松明を束ねるコマンドのメインルーチン
1007 * Refuel the players torch (from the pack or floor)
1010 static void do_cmd_refill_torch(void)
1019 /* Restrict the choices */
1020 item_tester_hook = object_can_refill_torch;
1022 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1023 s = _("他に松明がない。", "You have no extra torches.");
1025 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1028 take_turn(p_ptr, 50);
1030 /* Access the primary torch */
1031 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1034 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1036 msg_print(_("松明を結合した。", "You combine the torches."));
1038 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1041 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1043 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1046 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1048 /* Over-fuel message */
1049 else if (j_ptr->xtra4 >= FUEL_TORCH)
1051 j_ptr->xtra4 = FUEL_TORCH;
1052 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1055 /* Refuel message */
1058 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1061 /* Decrease the item (from the pack) */
1064 inven_item_increase(item, -1);
1065 inven_item_describe(item);
1066 inven_item_optimize(item);
1069 /* Decrease the item (from the floor) */
1072 floor_item_increase(0 - item, -1);
1073 floor_item_describe(0 - item);
1074 floor_item_optimize(0 - item);
1077 p_ptr->update |= (PU_TORCH);
1082 * @brief 燃料を補充するコマンドのメインルーチン
1083 * Refill the players lamp, or restock his torches
1086 void do_cmd_refill(void)
1091 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1093 if (p_ptr->special_defense & KATA_MUSOU)
1095 set_action(ACTION_NONE);
1099 if (o_ptr->tval != TV_LITE)
1101 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1105 else if (o_ptr->sval == SV_LITE_LANTERN)
1107 do_cmd_refill_lamp();
1111 else if (o_ptr->sval == SV_LITE_TORCH)
1113 do_cmd_refill_torch();
1116 /* No torch to refill */
1119 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1125 * @brief ターゲットを設定するコマンドのメインルーチン
1129 void do_cmd_target(void)
1131 if (p_ptr->wild_mode) return;
1134 if (target_set(TARGET_KILL))
1136 msg_print(_("ターゲット決定。", "Target Selected."));
1139 /* Target aborted */
1142 msg_print(_("ターゲット解除。", "Target Aborted."));
1149 * @brief 周囲を見渡すコマンドのメインルーチン
1153 void do_cmd_look(void)
1155 p_ptr->window |= PW_MONSTER_LIST;
1159 if (target_set(TARGET_LOOK))
1161 msg_print(_("ターゲット決定。", "Target Selected."));
1167 * @brief 位置を確認するコマンドのメインルーチン
1168 * Allow the player to examine other sectors on the map
1171 void do_cmd_locate(void)
1174 POSITION y1, x1, y2, x2;
1175 GAME_TEXT tmp_val[80];
1176 GAME_TEXT out_val[160];
1179 get_screen_size(&wid, &hgt);
1181 /* Start at current panel */
1182 y2 = y1 = panel_row_min;
1183 x2 = x1 = panel_col_min;
1185 /* Show panels until done */
1188 /* Describe the location */
1189 if ((y2 == y1) && (x2 == x1))
1191 strcpy(tmp_val, _("真上", "\0"));
1195 sprintf(tmp_val, "%s%s",
1196 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1197 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1200 /* Prepare to ask which way to look */
1201 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1202 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1203 y2 / (hgt / 2), y2 % (hgt / 2),
1204 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1206 /* Assume no direction */
1209 /* Get a direction */
1214 /* Get a command (or Cancel) */
1215 if (!get_com(out_val, &command, TRUE)) break;
1217 /* Extract the action (if any) */
1218 dir = get_keymap_dir(command);
1227 /* Apply the motion */
1228 if (change_panel(ddy[dir], ddx[dir]))
1236 /* Recenter the map around the player */
1239 p_ptr->update |= (PU_MONSTERS);
1240 p_ptr->redraw |= (PR_MAP);
1241 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1247 * @brief モンスターの思い出を見るコマンドのメインルーチン
1248 * Identify a character, allow recall of monsters
1252 * Several "special" responses recall "multiple" monsters:
1254 * ^U (all unique monsters)
1255 * ^N (all non-unique monsters)
1257 * The responses may be sorted in several ways, see below.
1259 * Note that the player ghosts are ignored.
1262 void do_cmd_query_symbol(void)
1276 bool recall = FALSE;
1281 /* Get a character, or abort */
1282 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1283 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1285 /* Find that character info, and describe it */
1286 for (i = 0; ident_info[i]; ++i)
1288 if (sym == ident_info[i][0]) break;
1290 if (sym == KTRL('A'))
1293 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1295 else if (sym == KTRL('U'))
1298 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1300 else if (sym == KTRL('N'))
1303 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1305 else if (sym == KTRL('R'))
1308 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1310 /* XTRA HACK WHATSEARCH */
1311 else if (sym == KTRL('M'))
1314 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1319 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1321 else if (ident_info[i])
1323 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1327 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1330 /* Display the result */
1333 /* Allocate the "who" array */
1334 C_MAKE(who, max_r_idx, MONRACE_IDX);
1336 /* Collect matching monsters */
1337 for (n = 0, i = 1; i < max_r_idx; i++)
1339 monster_race *r_ptr = &r_info[i];
1341 /* Nothing to recall */
1342 if (!cheat_know && !r_ptr->r_sights) continue;
1344 /* Require non-unique monsters if needed */
1345 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1347 /* Require unique monsters if needed */
1348 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1350 /* Require ridable monsters if needed */
1351 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1353 /* XTRA HACK WHATSEARCH */
1359 for (xx = 0; temp[xx] && xx < 80; xx++)
1362 if (iskanji(temp[xx])) { xx++; continue; }
1364 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1368 strcpy(temp2, r_name + r_ptr->E_name);
1370 strcpy(temp2, r_name + r_ptr->name);
1372 for (xx = 0; temp2[xx] && xx < 80; xx++)
1373 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1376 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1378 if (my_strstr(temp2, temp))
1383 /* Collect "appropriate" monsters */
1384 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1387 /* Nothing to recall */
1390 C_KILL(who, max_r_idx, MONRACE_IDX);
1395 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1403 /* Sort the array */
1404 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1406 /* Sort by kills (and level) */
1413 /* Catch "escape" */
1416 C_KILL(who, max_r_idx, MONRACE_IDX);
1420 /* Sort if needed */
1423 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1427 /* Start at the end */
1430 /* Scan the monster memory */
1433 /* Extract a race */
1436 /* Hack -- Auto-recall */
1437 monster_race_track(r_idx);
1448 /* Recall on screen */
1449 screen_roff(who[i], 0);
1452 /* Hack -- Begin the prompt */
1455 /* Hack -- Complete the prompt */
1456 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1467 /* Normal commands */
1468 if (query != 'r') break;
1475 if (query == ESCAPE) break;
1477 /* Move to "prev" monster */
1483 if (!expand_list) break;
1487 /* Move to "next" monster */
1493 if (!expand_list) break;
1498 /* Free the "who" array */
1499 C_KILL(who, max_r_idx, IDX);
1501 /* Re-display the identity */
1506 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1510 * XXX - Add actions for other item types
1512 void do_cmd_use(void)
1518 if (p_ptr->wild_mode)
1523 if (cmd_limit_arena(p_ptr)) return;
1525 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1527 set_action(ACTION_NONE);
1530 item_tester_hook = item_tester_hook_use;
1532 q = _("どれを使いますか?", "Use which item? ");
1533 s = _("使えるものがありません。", "You have nothing to use.");
1535 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1538 switch (o_ptr->tval)
1550 do_cmd_eat_food_aux(item);
1557 do_cmd_aim_wand_aux(item);
1564 do_cmd_use_staff_aux(item);
1571 do_cmd_zap_rod_aux(item);
1575 /* Quaff a potion */
1578 do_cmd_quaff_potion_aux(item);
1585 if (cmd_limit_blind(p_ptr)) return;
1586 if (cmd_limit_confused(p_ptr)) return;
1588 do_cmd_read_scroll_aux(item, TRUE);
1597 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1601 /* Activate an artifact */
1604 do_cmd_activate_aux(item);