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"
41 #include "view-mainwindow.h"
43 #include "objectkind.h"
45 #include "targeting.h"
49 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
52 void do_cmd_inven(void)
56 /* Note that we are in "p_ptr->inventory_list" mode */
59 /* Note that we are in "p_ptr->inventory_list" mode */
60 if (easy_floor) command_wrk = (USE_INVEN);
63 /* Display the p_ptr->inventory_list */
64 (void)show_inven(0, USE_FULL);
67 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
68 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
69 (long int)((p_ptr->total_weight * 100) / weight_limit()));
71 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
72 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
73 (p_ptr->total_weight * 100) / weight_limit());
77 command_new = inkey();
80 /* Process "Escape" */
81 if (command_new == ESCAPE)
85 Term_get_size(&wid, &hgt);
89 command_gap = wid - 30;
92 /* Process normal keys */
95 /* Hack -- Use "display" mode */
102 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
105 void do_cmd_equip(void)
109 /* Note that we are in "equipment" mode */
112 /* Note that we are in "equipment" mode */
113 if (easy_floor) command_wrk = (USE_EQUIP);
116 (void)show_equip(0, USE_FULL);
120 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
121 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
122 (long int)((p_ptr->total_weight * 100) / weight_limit()));
124 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
125 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
126 (long int)((p_ptr->total_weight * 100) / weight_limit()));
130 command_new = inkey();
133 /* Process "Escape" */
134 if (command_new == ESCAPE)
138 Term_get_size(&wid, &hgt);
142 command_gap = wid - 30;
145 /* Process normal keys */
148 /* Enter "display" mode */
156 bool select_ring_slot = FALSE;
159 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
162 void do_cmd_wield(void)
164 OBJECT_IDX item, slot;
172 GAME_TEXT o_name[MAX_NLEN];
175 OBJECT_IDX need_switch_wielding = 0;
177 if (p_ptr->special_defense & KATA_MUSOU)
179 set_action(ACTION_NONE);
182 /* Restrict the choices */
183 item_tester_hook = item_tester_hook_wear;
185 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
186 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
188 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
192 slot = wield_slot(o_ptr);
196 /* Shields and some misc. items */
201 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
203 /* Restrict the choices */
204 item_tester_hook = item_tester_hook_melee_weapon;
206 /* Choose a weapon from the equipment only */
207 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
208 s = _("おっと。", "Oops.");
209 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
210 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
213 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
215 /* Both arms are already used by non-weapon */
216 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
217 p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
219 /* Restrict the choices */
220 item_tester_hook = item_tester_hook_mochikae;
223 q = _("どちらの手に装備しますか?", "Equip which hand? ");
224 s = _("おっと。", "Oops.");
225 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
234 /* Asking for dual wielding */
235 if (slot == INVEN_LARM)
237 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
240 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
242 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
245 /* Both arms are already used */
246 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
248 /* Restrict the choices */
249 item_tester_hook = item_tester_hook_mochikae;
252 q = _("どちらの手に装備しますか?", "Equip which hand? ");
253 s = _("おっと。", "Oops.");
255 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
256 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
257 need_switch_wielding = INVEN_RARM;
263 /* Choose a ring slot */
264 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
266 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
270 q = _("どちらの手に装備しますか?", "Equip which hand? ");
272 s = _("おっと。", "Oops.");
274 /* Restrict the choices */
275 select_ring_slot = TRUE;
277 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
279 select_ring_slot = FALSE;
282 select_ring_slot = FALSE;
286 /* Prevent wielding into a cursed slot */
287 if (object_is_cursed(&p_ptr->inventory_list[slot]))
289 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
292 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
294 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
297 /* Cancel the command */
302 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
303 ((o_ptr->ident & IDENT_SENSE) &&
304 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
306 char dummy[MAX_NLEN+80];
308 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
309 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
311 if (!get_check(dummy)) return;
314 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
316 char dummy[MAX_NLEN+100];
318 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
320 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
321 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
323 if (!get_check(dummy)) return;
326 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
328 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
329 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
330 object_type object_tmp;
331 object_type *otmp_ptr = &object_tmp;
332 GAME_TEXT switch_name[MAX_NLEN];
334 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
336 object_copy(otmp_ptr, switch_o_ptr);
337 object_copy(switch_o_ptr, slot_o_ptr);
338 object_copy(slot_o_ptr, otmp_ptr);
340 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
341 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
342 (left_hander ? _("右手", "right") : _("左手", "left")));
343 slot = need_switch_wielding;
346 check_find_art_quest_completion(o_ptr);
348 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
350 identify_item(o_ptr);
352 /* Auto-inscription */
353 autopick_alter_item(item, FALSE);
356 take_turn(p_ptr, 100);
359 /* Obtain local object */
360 object_copy(q_ptr, o_ptr);
362 /* Modify quantity */
365 /* Decrease the item (from the pack) */
368 inven_item_increase(item, -1);
369 inven_item_optimize(item);
372 /* Decrease the item (from the floor) */
375 floor_item_increase(0 - item, -1);
376 floor_item_optimize(0 - item);
379 /* Access the wield slot */
380 o_ptr = &p_ptr->inventory_list[slot];
382 /* Take off existing item */
385 /* Take off existing item */
386 (void)inven_takeoff(slot, 255);
389 /* Wear the new stuff */
390 object_copy(o_ptr, q_ptr);
392 o_ptr->marked |= OM_TOUCHED;
394 p_ptr->total_weight += q_ptr->weight;
396 /* Increment the equip counter by hand */
399 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
400 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
401 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
403 /* Where is the item now */
407 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
408 act = STR_WIELD_ARMS;
410 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
414 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
415 act = STR_WIELD_ARMS;
417 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
421 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
425 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
429 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
433 object_desc(o_name, o_ptr, 0);
434 msg_format(act, o_name, index_to_label(slot));
437 if (object_is_cursed(o_ptr))
439 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
440 chg_virtue(V_HARMONY, -1);
443 o_ptr->ident |= (IDENT_SENSE);
446 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
447 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
449 /* Turn into a vampire */
450 change_race(RACE_VAMPIRE, "");
453 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
454 p_ptr->redraw |= (PR_EQUIPPY);
455 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
462 * @param item 持ち替えを行いたい装備部位ID
465 void kamaenaoshi(INVENTORY_IDX item)
467 object_type *o_ptr, *new_o_ptr;
468 GAME_TEXT o_name[MAX_NLEN];
470 if (item == INVEN_RARM)
472 if (has_melee_weapon(INVEN_LARM))
474 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
475 object_desc(o_name, o_ptr, 0);
477 if (!object_is_cursed(o_ptr))
479 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
480 object_copy(new_o_ptr, o_ptr);
481 p_ptr->total_weight += o_ptr->weight;
482 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
483 inven_item_optimize(INVEN_LARM);
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);
487 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
488 (left_hander ? _("左手", "left") : _("右手", "right")));
492 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
493 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
497 else if (item == INVEN_LARM)
499 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
500 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
502 if (has_melee_weapon(INVEN_RARM))
504 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
505 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
507 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
509 new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
510 object_copy(new_o_ptr, o_ptr);
511 p_ptr->total_weight += o_ptr->weight;
512 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
513 inven_item_optimize(INVEN_RARM);
514 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
521 * @brief 装備を外すコマンドのメインルーチン / Take off an item
524 void do_cmd_takeoff(void)
530 if (p_ptr->special_defense & KATA_MUSOU)
532 set_action(ACTION_NONE);
535 q = _("どれを装備からはずしますか? ", "Take off which item? ");
536 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
538 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
542 if (object_is_cursed(o_ptr))
544 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
546 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
551 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
553 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
555 o_ptr->ident |= (IDENT_SENSE);
556 o_ptr->curse_flags = 0L;
557 o_ptr->feeling = FEEL_NONE;
559 p_ptr->update |= (PU_BONUS);
560 p_ptr->window |= (PW_EQUIP);
562 msg_print(_("呪いを打ち破った。", "You break the curse."));
566 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
567 take_turn(p_ptr, 50);
572 take_turn(p_ptr, 50);
574 /* Take off the item */
575 (void)inven_takeoff(item, 255);
578 p_ptr->redraw |= (PR_EQUIPPY);
583 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
586 void do_cmd_drop(void)
595 if (p_ptr->special_defense & KATA_MUSOU)
597 set_action(ACTION_NONE);
600 q = _("どのアイテムを落としますか? ", "Drop which item? ");
601 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
603 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
606 /* Hack -- Cannot remove cursed items */
607 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
609 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
613 if (o_ptr->number > 1)
615 amt = get_quantity(NULL, o_ptr->number);
616 if (amt <= 0) return;
619 take_turn(p_ptr, 50);
621 /* Drop (some of) the item */
622 inven_drop(item, amt);
624 if (item >= INVEN_RARM)
630 p_ptr->redraw |= (PR_EQUIPPY);
635 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
638 void do_cmd_destroy(void)
648 object_type *q_ptr = &forge;
650 GAME_TEXT o_name[MAX_NLEN];
651 char out_val[MAX_NLEN+40];
655 if (p_ptr->special_defense & KATA_MUSOU)
657 set_action(ACTION_NONE);
660 /* Hack -- force destruction */
661 if (command_arg > 0) force = TRUE;
663 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
664 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
666 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
669 /* Verify unless quantity given beforehand */
670 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
672 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
674 /* Make a verification */
675 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
678 /* HACK : Add the line to message buffer */
679 message_add(out_val);
680 p_ptr->window |= (PW_MESSAGE);
683 /* Get an acceptable answer */
693 /* Erase the prompt */
697 if (i == 'y' || i == 'Y')
701 if (i == ESCAPE || i == 'n' || i == 'N')
708 /* Add an auto-destroy preference line */
709 if (autopick_autoregister(o_ptr))
711 /* Auto-destroy it */
712 autopick_alter_item(item, TRUE);
715 /* The object is already destroyed. */
721 if (o_ptr->number > 1)
723 amt = get_quantity(NULL, o_ptr->number);
724 if (amt <= 0) return;
728 old_number = o_ptr->number;
730 object_desc(o_name, o_ptr, 0);
731 o_ptr->number = old_number;
733 take_turn(p_ptr, 100);
735 /* Artifacts cannot be destroyed */
736 if (!can_player_destroy_object(o_ptr))
740 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
744 object_copy(q_ptr, o_ptr);
746 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
747 sound(SOUND_DESTITEM);
749 /* Reduce the charges of rods/wands */
750 reduce_charges(o_ptr, amt);
752 /* Eliminate the item (from the pack) */
755 inven_item_increase(item, -amt);
756 inven_item_describe(item);
757 inven_item_optimize(item);
760 /* Eliminate the item (from the floor) */
763 floor_item_increase(0 - item, -amt);
764 floor_item_describe(0 - item);
765 floor_item_optimize(0 - item);
768 if (item_tester_high_level_book(q_ptr))
770 bool gain_expr = FALSE;
772 if (p_ptr->prace == RACE_ANDROID)
775 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
779 else if (p_ptr->pclass == CLASS_PALADIN)
781 if (is_good_realm(p_ptr->realm1))
783 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
787 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
791 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
793 s32b tester_exp = p_ptr->max_exp / 20;
794 if (tester_exp > 10000) tester_exp = 10000;
795 if (q_ptr->sval < 3) tester_exp /= 4;
796 if (tester_exp<1) tester_exp = 1;
798 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
799 gain_exp(tester_exp * amt);
801 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
803 chg_virtue(V_UNLIFE, 1);
804 chg_virtue(V_VITALITY, -1);
806 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
808 chg_virtue(V_UNLIFE, -1);
809 chg_virtue(V_VITALITY, 1);
812 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
813 chg_virtue(V_ENCHANT, -1);
815 if (object_value_real(q_ptr) > 30000)
816 chg_virtue(V_SACRIFICE, 2);
818 else if (object_value_real(q_ptr) > 10000)
819 chg_virtue(V_SACRIFICE, 1);
822 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
823 chg_virtue(V_HARMONY, 1);
825 if (item >= INVEN_RARM) calc_android_exp();
830 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
833 void do_cmd_observe(void)
837 GAME_TEXT o_name[MAX_NLEN];
840 q = _("どのアイテムを調べますか? ", "Examine which item? ");
841 s = _("調べられるアイテムがない。", "You have nothing to examine.");
843 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
846 /* Require full knowledge */
847 if (!(o_ptr->ident & IDENT_MENTAL))
849 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
853 object_desc(o_name, o_ptr, 0);
854 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
855 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
861 * @brief アイテムの銘を消すコマンドのメインルーチン
862 * Remove the inscription from an object XXX Mention item (when done)?
865 void do_cmd_uninscribe(void)
871 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
872 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
874 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
877 /* Nothing to remove */
878 if (!o_ptr->inscription)
880 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
884 msg_print(_("銘を消した。", "Inscription removed."));
886 /* Remove the incription */
887 o_ptr->inscription = 0;
888 p_ptr->update |= (PU_COMBINE);
889 p_ptr->window |= (PW_INVEN | PW_EQUIP);
891 /* .や$の関係で, 再計算が必要なはず -- henkma */
892 p_ptr->update |= (PU_BONUS);
898 * @brief アイテムの銘を刻むコマンドのメインルーチン
899 * Inscribe an object with a comment
902 void do_cmd_inscribe(void)
906 GAME_TEXT o_name[MAX_NLEN];
910 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
911 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
913 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
916 /* Describe the activity */
917 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
919 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
922 /* Start with nothing */
925 /* Use old inscription */
926 if (o_ptr->inscription)
928 /* Start with the old inscription */
929 strcpy(out_val, quark_str(o_ptr->inscription));
932 /* Get a new inscription (possibly empty) */
933 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
935 /* Save the inscription */
936 o_ptr->inscription = quark_add(out_val);
937 p_ptr->update |= (PU_COMBINE);
938 p_ptr->window |= (PW_INVEN | PW_EQUIP);
940 /* .や$の関係で, 再計算が必要なはず -- henkma */
941 p_ptr->update |= (PU_BONUS);
947 * @brief ランタンに燃料を加えるコマンドのメインルーチン
948 * Refill the players lamp (from the pack or floor)
951 static void do_cmd_refill_lamp(void)
958 /* Restrict the choices */
959 item_tester_hook = item_tester_refill_lantern;
961 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
962 s = _("油つぼがない。", "You have no flasks of oil.");
964 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
967 take_turn(p_ptr, 50);
969 /* Access the lantern */
970 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
973 j_ptr->xtra4 += o_ptr->xtra4;
974 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
976 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
979 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
981 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
984 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
986 else if (j_ptr->xtra4 >= FUEL_LAMP)
988 j_ptr->xtra4 = FUEL_LAMP;
989 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
992 /* Decrease the item (from the pack) */
995 inven_item_increase(item, -1);
996 inven_item_describe(item);
997 inven_item_optimize(item);
1000 /* Decrease the item (from the floor) */
1003 floor_item_increase(0 - item, -1);
1004 floor_item_describe(0 - item);
1005 floor_item_optimize(0 - item);
1008 p_ptr->update |= (PU_TORCH);
1012 * @brief 松明を束ねるコマンドのメインルーチン
1013 * Refuel the players torch (from the pack or floor)
1016 static void do_cmd_refill_torch(void)
1025 /* Restrict the choices */
1026 item_tester_hook = object_can_refill_torch;
1028 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1029 s = _("他に松明がない。", "You have no extra torches.");
1031 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1034 take_turn(p_ptr, 50);
1036 /* Access the primary torch */
1037 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1040 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1042 msg_print(_("松明を結合した。", "You combine the torches."));
1044 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1047 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1049 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1052 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1054 /* Over-fuel message */
1055 else if (j_ptr->xtra4 >= FUEL_TORCH)
1057 j_ptr->xtra4 = FUEL_TORCH;
1058 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1061 /* Refuel message */
1064 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1067 /* Decrease the item (from the pack) */
1070 inven_item_increase(item, -1);
1071 inven_item_describe(item);
1072 inven_item_optimize(item);
1075 /* Decrease the item (from the floor) */
1078 floor_item_increase(0 - item, -1);
1079 floor_item_describe(0 - item);
1080 floor_item_optimize(0 - item);
1083 p_ptr->update |= (PU_TORCH);
1088 * @brief 燃料を補充するコマンドのメインルーチン
1089 * Refill the players lamp, or restock his torches
1092 void do_cmd_refill(void)
1097 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1099 if (p_ptr->special_defense & KATA_MUSOU)
1101 set_action(ACTION_NONE);
1105 if (o_ptr->tval != TV_LITE)
1107 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1111 else if (o_ptr->sval == SV_LITE_LANTERN)
1113 do_cmd_refill_lamp();
1117 else if (o_ptr->sval == SV_LITE_TORCH)
1119 do_cmd_refill_torch();
1122 /* No torch to refill */
1125 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1131 * @brief ターゲットを設定するコマンドのメインルーチン
1135 void do_cmd_target(void)
1137 if (p_ptr->wild_mode) return;
1140 if (target_set(TARGET_KILL))
1142 msg_print(_("ターゲット決定。", "Target Selected."));
1145 /* Target aborted */
1148 msg_print(_("ターゲット解除。", "Target Aborted."));
1155 * @brief 周囲を見渡すコマンドのメインルーチン
1159 void do_cmd_look(void)
1161 p_ptr->window |= PW_MONSTER_LIST;
1165 if (target_set(TARGET_LOOK))
1167 msg_print(_("ターゲット決定。", "Target Selected."));
1173 * @brief 位置を確認するコマンドのメインルーチン
1174 * Allow the player to examine other sectors on the map
1177 void do_cmd_locate(void)
1180 POSITION y1, x1, y2, x2;
1181 GAME_TEXT tmp_val[80];
1182 GAME_TEXT out_val[160];
1185 get_screen_size(&wid, &hgt);
1187 /* Start at current panel */
1188 y2 = y1 = panel_row_min;
1189 x2 = x1 = panel_col_min;
1191 /* Show panels until done */
1194 /* Describe the location */
1195 if ((y2 == y1) && (x2 == x1))
1197 strcpy(tmp_val, _("真上", "\0"));
1201 sprintf(tmp_val, "%s%s",
1202 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1203 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1206 /* Prepare to ask which way to look */
1207 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1208 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1209 y2 / (hgt / 2), y2 % (hgt / 2),
1210 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1212 /* Assume no direction */
1215 /* Get a direction */
1220 /* Get a command (or Cancel) */
1221 if (!get_com(out_val, &command, TRUE)) break;
1223 /* Extract the action (if any) */
1224 dir = get_keymap_dir(command);
1233 /* Apply the motion */
1234 if (change_panel(ddy[dir], ddx[dir]))
1242 /* Recenter the map around the player */
1245 p_ptr->update |= (PU_MONSTERS);
1246 p_ptr->redraw |= (PR_MAP);
1247 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1253 * @brief モンスターの思い出を見るコマンドのメインルーチン
1254 * Identify a character, allow recall of monsters
1258 * Several "special" responses recall "multiple" monsters:
1260 * ^U (all unique monsters)
1261 * ^N (all non-unique monsters)
1263 * The responses may be sorted in several ways, see below.
1265 * Note that the player ghosts are ignored.
1268 void do_cmd_query_symbol(void)
1282 bool recall = FALSE;
1287 /* Get a character, or abort */
1288 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1289 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1291 /* Find that character info, and describe it */
1292 for (i = 0; ident_info[i]; ++i)
1294 if (sym == ident_info[i][0]) break;
1296 if (sym == KTRL('A'))
1299 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1301 else if (sym == KTRL('U'))
1304 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1306 else if (sym == KTRL('N'))
1309 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1311 else if (sym == KTRL('R'))
1314 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1316 /* XTRA HACK WHATSEARCH */
1317 else if (sym == KTRL('M'))
1320 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1325 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1327 else if (ident_info[i])
1329 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1333 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1336 /* Display the result */
1339 /* Allocate the "who" array */
1340 C_MAKE(who, max_r_idx, MONRACE_IDX);
1342 /* Collect matching monsters */
1343 for (n = 0, i = 1; i < max_r_idx; i++)
1345 monster_race *r_ptr = &r_info[i];
1347 /* Nothing to recall */
1348 if (!cheat_know && !r_ptr->r_sights) continue;
1350 /* Require non-unique monsters if needed */
1351 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1353 /* Require unique monsters if needed */
1354 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1356 /* Require ridable monsters if needed */
1357 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1359 /* XTRA HACK WHATSEARCH */
1365 for (xx = 0; temp[xx] && xx < 80; xx++)
1368 if (iskanji(temp[xx])) { xx++; continue; }
1370 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1374 strcpy(temp2, r_name + r_ptr->E_name);
1376 strcpy(temp2, r_name + r_ptr->name);
1378 for (xx = 0; temp2[xx] && xx < 80; xx++)
1379 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1382 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1384 if (my_strstr(temp2, temp))
1389 /* Collect "appropriate" monsters */
1390 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1393 /* Nothing to recall */
1396 C_KILL(who, max_r_idx, MONRACE_IDX);
1401 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1409 /* Sort the array */
1410 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1412 /* Sort by kills (and level) */
1419 /* Catch "escape" */
1422 C_KILL(who, max_r_idx, MONRACE_IDX);
1426 /* Sort if needed */
1429 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1433 /* Start at the end */
1436 /* Scan the monster memory */
1439 /* Extract a race */
1442 /* Hack -- Auto-recall */
1443 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(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));
1543 switch (o_ptr->tval)
1555 do_cmd_eat_food_aux(item);
1562 do_cmd_aim_wand_aux(item);
1569 do_cmd_use_staff_aux(item);
1576 do_cmd_zap_rod_aux(item);
1580 /* Quaff a potion */
1583 do_cmd_quaff_potion_aux(item);
1590 if (cmd_limit_blind(p_ptr)) return;
1591 if (cmd_limit_confused(p_ptr)) return;
1593 do_cmd_read_scroll_aux(item, TRUE);
1602 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1606 /* Activate an artifact */
1609 do_cmd_activate_aux(item);