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"
53 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
56 void do_cmd_inven(void)
60 /* Note that we are in "p_ptr->inventory_list" mode */
63 /* Note that we are in "p_ptr->inventory_list" mode */
64 if (easy_floor) command_wrk = (USE_INVEN);
67 /* Display the p_ptr->inventory_list */
68 (void)show_inven(0, USE_FULL, item_tester_tval);
71 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
72 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
73 (long int)((p_ptr->total_weight * 100) / weight_limit()));
75 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
76 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
77 (p_ptr->total_weight * 100) / weight_limit());
81 command_new = inkey();
84 /* Process "Escape" */
85 if (command_new == ESCAPE)
89 Term_get_size(&wid, &hgt);
93 command_gap = wid - 30;
96 /* Process normal keys */
99 /* Hack -- Use "display" mode */
106 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
109 void do_cmd_equip(void)
113 /* Note that we are in "equipment" mode */
116 /* Note that we are in "equipment" mode */
117 if (easy_floor) command_wrk = (USE_EQUIP);
120 (void)show_equip(0, USE_FULL, item_tester_tval);
124 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
125 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
126 (long int)((p_ptr->total_weight * 100) / weight_limit()));
128 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
129 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
130 (long int)((p_ptr->total_weight * 100) / weight_limit()));
134 command_new = inkey();
137 /* Process "Escape" */
138 if (command_new == ESCAPE)
142 Term_get_size(&wid, &hgt);
146 command_gap = wid - 30;
149 /* Process normal keys */
152 /* Enter "display" mode */
160 bool select_ring_slot = FALSE;
163 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
166 void do_cmd_wield(void)
168 OBJECT_IDX item, slot;
176 GAME_TEXT o_name[MAX_NLEN];
179 OBJECT_IDX need_switch_wielding = 0;
181 if (p_ptr->special_defense & KATA_MUSOU)
183 set_action(ACTION_NONE);
186 /* Restrict the choices */
187 item_tester_hook = item_tester_hook_wear;
189 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
190 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
192 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
196 slot = wield_slot(o_ptr);
200 /* Shields and some misc. items */
205 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
207 /* Restrict the choices */
208 item_tester_hook = item_tester_hook_melee_weapon;
210 /* Choose a weapon from the equipment only */
211 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
212 s = _("おっと。", "Oops.");
213 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
214 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
217 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
219 /* Both arms are already used by non-weapon */
220 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
221 p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
223 /* Restrict the choices */
224 item_tester_hook = item_tester_hook_mochikae;
227 q = _("どちらの手に装備しますか?", "Equip which hand? ");
228 s = _("おっと。", "Oops.");
229 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
238 /* Asking for dual wielding */
239 if (slot == INVEN_LARM)
241 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
244 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
246 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
249 /* Both arms are already used */
250 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
252 /* Restrict the choices */
253 item_tester_hook = item_tester_hook_mochikae;
256 q = _("どちらの手に装備しますか?", "Equip which hand? ");
257 s = _("おっと。", "Oops.");
259 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
260 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
261 need_switch_wielding = INVEN_RARM;
267 /* Choose a ring slot */
268 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
270 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
274 q = _("どちらの手に装備しますか?", "Equip which hand? ");
276 s = _("おっと。", "Oops.");
278 /* Restrict the choices */
279 select_ring_slot = TRUE;
281 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
283 select_ring_slot = FALSE;
286 select_ring_slot = FALSE;
290 /* Prevent wielding into a cursed slot */
291 if (object_is_cursed(&p_ptr->inventory_list[slot]))
293 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));
301 /* Cancel the command */
306 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
307 ((o_ptr->ident & IDENT_SENSE) &&
308 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
310 char dummy[MAX_NLEN+80];
312 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
313 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
315 if (!get_check(dummy)) return;
318 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
320 char dummy[MAX_NLEN+100];
322 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
324 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
325 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
327 if (!get_check(dummy)) return;
330 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
332 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
333 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
334 object_type object_tmp;
335 object_type *otmp_ptr = &object_tmp;
336 GAME_TEXT switch_name[MAX_NLEN];
338 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
340 object_copy(otmp_ptr, switch_o_ptr);
341 object_copy(switch_o_ptr, slot_o_ptr);
342 object_copy(slot_o_ptr, otmp_ptr);
344 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
345 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
346 (left_hander ? _("右手", "right") : _("左手", "left")));
347 slot = need_switch_wielding;
350 check_find_art_quest_completion(o_ptr);
352 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
354 identify_item(o_ptr);
356 /* Auto-inscription */
357 autopick_alter_item(item, FALSE);
360 take_turn(p_ptr, 100);
363 /* Obtain local object */
364 object_copy(q_ptr, o_ptr);
366 /* Modify quantity */
369 /* Decrease the item (from the pack) */
372 inven_item_increase(item, -1);
373 inven_item_optimize(item);
376 /* Decrease the item (from the floor) */
379 floor_item_increase(0 - item, -1);
380 floor_item_optimize(0 - item);
383 /* Access the wield slot */
384 o_ptr = &p_ptr->inventory_list[slot];
386 /* Take off existing item */
389 /* Take off existing item */
390 (void)inven_takeoff(slot, 255);
393 /* Wear the new stuff */
394 object_copy(o_ptr, q_ptr);
396 o_ptr->marked |= OM_TOUCHED;
398 p_ptr->total_weight += q_ptr->weight;
400 /* Increment the equip counter by hand */
403 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
404 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
405 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
407 /* Where is the item now */
411 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
412 act = STR_WIELD_ARMS;
414 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
418 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
419 act = STR_WIELD_ARMS;
421 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
425 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
429 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
433 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
437 object_desc(o_name, o_ptr, 0);
438 msg_format(act, o_name, index_to_label(slot));
441 if (object_is_cursed(o_ptr))
443 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
444 chg_virtue(V_HARMONY, -1);
447 o_ptr->ident |= (IDENT_SENSE);
450 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
451 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
453 /* Turn into a vampire */
454 change_race(RACE_VAMPIRE, "");
457 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
458 p_ptr->redraw |= (PR_EQUIPPY);
459 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
466 * @param item 持ち替えを行いたい装備部位ID
469 void kamaenaoshi(INVENTORY_IDX item)
471 object_type *o_ptr, *new_o_ptr;
472 GAME_TEXT o_name[MAX_NLEN];
474 if (item == INVEN_RARM)
476 if (has_melee_weapon(INVEN_LARM))
478 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
479 object_desc(o_name, o_ptr, 0);
481 if (!object_is_cursed(o_ptr))
483 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
484 object_copy(new_o_ptr, o_ptr);
485 p_ptr->total_weight += o_ptr->weight;
486 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
487 inven_item_optimize(INVEN_LARM);
488 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
489 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
491 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
492 (left_hander ? _("左手", "left") : _("右手", "right")));
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);
501 else if (item == INVEN_LARM)
503 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
504 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
506 if (has_melee_weapon(INVEN_RARM))
508 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
509 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
511 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
513 new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
514 object_copy(new_o_ptr, o_ptr);
515 p_ptr->total_weight += o_ptr->weight;
516 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
517 inven_item_optimize(INVEN_RARM);
518 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
525 * @brief 装備を外すコマンドのメインルーチン / Take off an item
528 void do_cmd_takeoff(void)
534 if (p_ptr->special_defense & KATA_MUSOU)
536 set_action(ACTION_NONE);
539 q = _("どれを装備からはずしますか? ", "Take off which item? ");
540 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
542 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
546 if (object_is_cursed(o_ptr))
548 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
550 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
555 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
557 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
559 o_ptr->ident |= (IDENT_SENSE);
560 o_ptr->curse_flags = 0L;
561 o_ptr->feeling = FEEL_NONE;
563 p_ptr->update |= (PU_BONUS);
564 p_ptr->window |= (PW_EQUIP);
566 msg_print(_("呪いを打ち破った。", "You break the curse."));
570 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
571 take_turn(p_ptr, 50);
576 take_turn(p_ptr, 50);
578 /* Take off the item */
579 (void)inven_takeoff(item, 255);
582 p_ptr->redraw |= (PR_EQUIPPY);
587 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
590 void do_cmd_drop(void)
599 if (p_ptr->special_defense & KATA_MUSOU)
601 set_action(ACTION_NONE);
604 q = _("どのアイテムを落としますか? ", "Drop which item? ");
605 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
607 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
610 /* Hack -- Cannot remove cursed items */
611 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
613 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
617 if (o_ptr->number > 1)
619 amt = get_quantity(NULL, o_ptr->number);
620 if (amt <= 0) return;
623 take_turn(p_ptr, 50);
625 /* Drop (some of) the item */
626 inven_drop(item, amt);
628 if (item >= INVEN_RARM)
634 p_ptr->redraw |= (PR_EQUIPPY);
639 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
642 void do_cmd_destroy(void)
652 object_type *q_ptr = &forge;
654 GAME_TEXT o_name[MAX_NLEN];
655 char out_val[MAX_NLEN+40];
659 if (p_ptr->special_defense & KATA_MUSOU)
661 set_action(ACTION_NONE);
664 /* Hack -- force destruction */
665 if (command_arg > 0) force = TRUE;
667 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
668 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
670 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
673 /* Verify unless quantity given beforehand */
674 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
676 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
678 /* Make a verification */
679 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
682 /* HACK : Add the line to message buffer */
683 message_add(out_val);
684 p_ptr->window |= (PW_MESSAGE);
687 /* Get an acceptable answer */
697 /* Erase the prompt */
701 if (i == 'y' || i == 'Y')
705 if (i == ESCAPE || i == 'n' || i == 'N')
712 /* Add an auto-destroy preference line */
713 if (autopick_autoregister(o_ptr))
715 /* Auto-destroy it */
716 autopick_alter_item(item, TRUE);
719 /* The object is already destroyed. */
725 if (o_ptr->number > 1)
727 amt = get_quantity(NULL, o_ptr->number);
728 if (amt <= 0) return;
732 old_number = o_ptr->number;
734 object_desc(o_name, o_ptr, 0);
735 o_ptr->number = old_number;
737 take_turn(p_ptr, 100);
739 /* Artifacts cannot be destroyed */
740 if (!can_player_destroy_object(o_ptr))
744 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
748 object_copy(q_ptr, o_ptr);
750 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
751 sound(SOUND_DESTITEM);
753 /* Reduce the charges of rods/wands */
754 reduce_charges(o_ptr, amt);
756 /* Eliminate the item (from the pack) */
759 inven_item_increase(item, -amt);
760 inven_item_describe(item);
761 inven_item_optimize(item);
764 /* Eliminate the item (from the floor) */
767 floor_item_increase(0 - item, -amt);
768 floor_item_describe(0 - item);
769 floor_item_optimize(0 - item);
772 if (item_tester_high_level_book(q_ptr))
774 bool gain_expr = FALSE;
776 if (p_ptr->prace == RACE_ANDROID)
779 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
783 else if (p_ptr->pclass == CLASS_PALADIN)
785 if (is_good_realm(p_ptr->realm1))
787 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
791 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
795 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
797 s32b tester_exp = p_ptr->max_exp / 20;
798 if (tester_exp > 10000) tester_exp = 10000;
799 if (q_ptr->sval < 3) tester_exp /= 4;
800 if (tester_exp<1) tester_exp = 1;
802 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
803 gain_exp(tester_exp * amt);
805 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
807 chg_virtue(V_UNLIFE, 1);
808 chg_virtue(V_VITALITY, -1);
810 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
812 chg_virtue(V_UNLIFE, -1);
813 chg_virtue(V_VITALITY, 1);
816 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
817 chg_virtue(V_ENCHANT, -1);
819 if (object_value_real(q_ptr) > 30000)
820 chg_virtue(V_SACRIFICE, 2);
822 else if (object_value_real(q_ptr) > 10000)
823 chg_virtue(V_SACRIFICE, 1);
826 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
827 chg_virtue(V_HARMONY, 1);
829 if (item >= INVEN_RARM) calc_android_exp();
834 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
837 void do_cmd_observe(void)
841 GAME_TEXT o_name[MAX_NLEN];
844 q = _("どのアイテムを調べますか? ", "Examine which item? ");
845 s = _("調べられるアイテムがない。", "You have nothing to examine.");
847 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
850 /* Require full knowledge */
851 if (!(o_ptr->ident & IDENT_MENTAL))
853 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
857 object_desc(o_name, o_ptr, 0);
858 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
859 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
865 * @brief アイテムの銘を消すコマンドのメインルーチン
866 * Remove the inscription from an object XXX Mention item (when done)?
869 void do_cmd_uninscribe(void)
875 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
876 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
878 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
881 /* Nothing to remove */
882 if (!o_ptr->inscription)
884 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
888 msg_print(_("銘を消した。", "Inscription removed."));
890 /* Remove the incription */
891 o_ptr->inscription = 0;
892 p_ptr->update |= (PU_COMBINE);
893 p_ptr->window |= (PW_INVEN | PW_EQUIP);
895 /* .や$の関係で, 再計算が必要なはず -- henkma */
896 p_ptr->update |= (PU_BONUS);
902 * @brief アイテムの銘を刻むコマンドのメインルーチン
903 * Inscribe an object with a comment
906 void do_cmd_inscribe(void)
910 GAME_TEXT o_name[MAX_NLEN];
914 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
915 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
917 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
920 /* Describe the activity */
921 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
923 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
926 /* Start with nothing */
929 /* Use old inscription */
930 if (o_ptr->inscription)
932 /* Start with the old inscription */
933 strcpy(out_val, quark_str(o_ptr->inscription));
936 /* Get a new inscription (possibly empty) */
937 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
939 /* Save the inscription */
940 o_ptr->inscription = quark_add(out_val);
941 p_ptr->update |= (PU_COMBINE);
942 p_ptr->window |= (PW_INVEN | PW_EQUIP);
944 /* .や$の関係で, 再計算が必要なはず -- henkma */
945 p_ptr->update |= (PU_BONUS);
951 * @brief ランタンに燃料を加えるコマンドのメインルーチン
952 * Refill the players lamp (from the pack or floor)
955 static void do_cmd_refill_lamp(void)
962 /* Restrict the choices */
963 item_tester_hook = item_tester_refill_lantern;
965 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
966 s = _("油つぼがない。", "You have no flasks of oil.");
968 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
971 take_turn(p_ptr, 50);
973 /* Access the lantern */
974 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
977 j_ptr->xtra4 += o_ptr->xtra4;
978 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
980 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
983 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
985 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
988 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
990 else if (j_ptr->xtra4 >= FUEL_LAMP)
992 j_ptr->xtra4 = FUEL_LAMP;
993 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
996 /* Decrease the item (from the pack) */
999 inven_item_increase(item, -1);
1000 inven_item_describe(item);
1001 inven_item_optimize(item);
1004 /* Decrease the item (from the floor) */
1007 floor_item_increase(0 - item, -1);
1008 floor_item_describe(0 - item);
1009 floor_item_optimize(0 - item);
1012 p_ptr->update |= (PU_TORCH);
1016 * @brief 松明を束ねるコマンドのメインルーチン
1017 * Refuel the players torch (from the pack or floor)
1020 static void do_cmd_refill_torch(void)
1029 /* Restrict the choices */
1030 item_tester_hook = object_can_refill_torch;
1032 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1033 s = _("他に松明がない。", "You have no extra torches.");
1035 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1038 take_turn(p_ptr, 50);
1040 /* Access the primary torch */
1041 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1044 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1046 msg_print(_("松明を結合した。", "You combine the torches."));
1048 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1051 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1053 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1056 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1058 /* Over-fuel message */
1059 else if (j_ptr->xtra4 >= FUEL_TORCH)
1061 j_ptr->xtra4 = FUEL_TORCH;
1062 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1065 /* Refuel message */
1068 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1071 /* Decrease the item (from the pack) */
1074 inven_item_increase(item, -1);
1075 inven_item_describe(item);
1076 inven_item_optimize(item);
1079 /* Decrease the item (from the floor) */
1082 floor_item_increase(0 - item, -1);
1083 floor_item_describe(0 - item);
1084 floor_item_optimize(0 - item);
1087 p_ptr->update |= (PU_TORCH);
1092 * @brief 燃料を補充するコマンドのメインルーチン
1093 * Refill the players lamp, or restock his torches
1096 void do_cmd_refill(void)
1101 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1103 if (p_ptr->special_defense & KATA_MUSOU)
1105 set_action(ACTION_NONE);
1109 if (o_ptr->tval != TV_LITE)
1111 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1115 else if (o_ptr->sval == SV_LITE_LANTERN)
1117 do_cmd_refill_lamp();
1121 else if (o_ptr->sval == SV_LITE_TORCH)
1123 do_cmd_refill_torch();
1126 /* No torch to refill */
1129 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1135 * @brief ターゲットを設定するコマンドのメインルーチン
1139 void do_cmd_target(void)
1141 if (p_ptr->wild_mode) return;
1144 if (target_set(TARGET_KILL))
1146 msg_print(_("ターゲット決定。", "Target Selected."));
1149 /* Target aborted */
1152 msg_print(_("ターゲット解除。", "Target Aborted."));
1159 * @brief 周囲を見渡すコマンドのメインルーチン
1163 void do_cmd_look(void)
1165 p_ptr->window |= PW_MONSTER_LIST;
1169 if (target_set(TARGET_LOOK))
1171 msg_print(_("ターゲット決定。", "Target Selected."));
1177 * @brief 位置を確認するコマンドのメインルーチン
1178 * Allow the player to examine other sectors on the map
1181 void do_cmd_locate(void)
1184 POSITION y1, x1, y2, x2;
1185 GAME_TEXT tmp_val[80];
1186 GAME_TEXT out_val[160];
1189 get_screen_size(&wid, &hgt);
1191 /* Start at current panel */
1192 y2 = y1 = panel_row_min;
1193 x2 = x1 = panel_col_min;
1195 /* Show panels until done */
1198 /* Describe the location */
1199 if ((y2 == y1) && (x2 == x1))
1201 strcpy(tmp_val, _("真上", "\0"));
1205 sprintf(tmp_val, "%s%s",
1206 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1207 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1210 /* Prepare to ask which way to look */
1211 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1212 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1213 y2 / (hgt / 2), y2 % (hgt / 2),
1214 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1216 /* Assume no direction */
1219 /* Get a direction */
1224 /* Get a command (or Cancel) */
1225 if (!get_com(out_val, &command, TRUE)) break;
1227 /* Extract the action (if any) */
1228 dir = get_keymap_dir(command);
1237 /* Apply the motion */
1238 if (change_panel(ddy[dir], ddx[dir]))
1246 /* Recenter the map around the player */
1249 p_ptr->update |= (PU_MONSTERS);
1250 p_ptr->redraw |= (PR_MAP);
1251 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1257 * @brief モンスターの思い出を見るコマンドのメインルーチン
1258 * Identify a character, allow recall of monsters
1262 * Several "special" responses recall "multiple" monsters:
1264 * ^U (all unique monsters)
1265 * ^N (all non-unique monsters)
1267 * The responses may be sorted in several ways, see below.
1269 * Note that the player ghosts are ignored.
1272 void do_cmd_query_symbol(void)
1286 bool recall = FALSE;
1291 /* Get a character, or abort */
1292 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1293 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1295 /* Find that character info, and describe it */
1296 for (i = 0; ident_info[i]; ++i)
1298 if (sym == ident_info[i][0]) break;
1300 if (sym == KTRL('A'))
1303 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1305 else if (sym == KTRL('U'))
1308 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1310 else if (sym == KTRL('N'))
1313 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1315 else if (sym == KTRL('R'))
1318 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1320 /* XTRA HACK WHATSEARCH */
1321 else if (sym == KTRL('M'))
1324 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1329 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1331 else if (ident_info[i])
1333 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1337 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1340 /* Display the result */
1343 /* Allocate the "who" array */
1344 C_MAKE(who, max_r_idx, MONRACE_IDX);
1346 /* Collect matching monsters */
1347 for (n = 0, i = 1; i < max_r_idx; i++)
1349 monster_race *r_ptr = &r_info[i];
1351 /* Nothing to recall */
1352 if (!cheat_know && !r_ptr->r_sights) continue;
1354 /* Require non-unique monsters if needed */
1355 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1357 /* Require unique monsters if needed */
1358 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1360 /* Require ridable monsters if needed */
1361 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1363 /* XTRA HACK WHATSEARCH */
1369 for (xx = 0; temp[xx] && xx < 80; xx++)
1372 if (iskanji(temp[xx])) { xx++; continue; }
1374 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1378 strcpy(temp2, r_name + r_ptr->E_name);
1380 strcpy(temp2, r_name + r_ptr->name);
1382 for (xx = 0; temp2[xx] && xx < 80; xx++)
1383 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1386 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1388 if (my_strstr(temp2, temp))
1393 /* Collect "appropriate" monsters */
1394 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1397 /* Nothing to recall */
1400 C_KILL(who, max_r_idx, MONRACE_IDX);
1405 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1413 /* Sort the array */
1414 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1416 /* Sort by kills (and level) */
1423 /* Catch "escape" */
1426 C_KILL(who, max_r_idx, MONRACE_IDX);
1430 /* Sort if needed */
1433 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1437 /* Start at the end */
1440 /* Scan the monster memory */
1443 /* Extract a race */
1446 /* Hack -- Auto-recall */
1447 monster_race_track(r_idx);
1458 /* Recall on screen */
1459 screen_roff(who[i], 0);
1462 /* Hack -- Begin the prompt */
1465 /* Hack -- Complete the prompt */
1466 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1476 /* Normal commands */
1477 if (query != 'r') break;
1484 if (query == ESCAPE) break;
1486 /* Move to "prev" monster */
1492 if (!expand_list) break;
1496 /* Move to "next" monster */
1502 if (!expand_list) break;
1507 /* Free the "who" array */
1508 C_KILL(who, max_r_idx, IDX);
1510 /* Re-display the identity */
1515 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1519 * XXX - Add actions for other item types
1521 void do_cmd_use(void)
1527 if (p_ptr->wild_mode)
1532 if (cmd_limit_arena(p_ptr)) return;
1534 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1536 set_action(ACTION_NONE);
1539 item_tester_hook = item_tester_hook_use;
1541 q = _("どれを使いますか?", "Use which item? ");
1542 s = _("使えるものがありません。", "You have nothing to use.");
1544 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1547 switch (o_ptr->tval)
1559 do_cmd_eat_food_aux(item);
1566 do_cmd_aim_wand_aux(item);
1573 do_cmd_use_staff_aux(item);
1580 do_cmd_zap_rod_aux(item);
1584 /* Quaff a potion */
1587 do_cmd_quaff_potion_aux(item);
1594 if (cmd_limit_blind(p_ptr)) return;
1595 if (cmd_limit_confused(p_ptr)) return;
1597 do_cmd_read_scroll_aux(item, TRUE);
1606 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1610 /* Activate an artifact */
1613 do_cmd_activate_aux(item);