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.
19 #include "cmd-activate.h"
21 #include "cmd-quaff.h"
23 #include "cmd-usestaff.h"
24 #include "cmd-zaprod.h"
25 #include "cmd-zapwand.h"
27 #include "cmd-basic.h"
29 #include "object-flavor.h"
30 #include "object-hook.h"
35 #include "player-status.h"
36 #include "player-effects.h"
38 #include "view-mainwindow.h"
40 #include "objectkind.h"
42 #include "targeting.h"
45 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
48 void do_cmd_inven(void)
52 /* Note that we are in "p_ptr->inventory_list" mode */
55 /* Note that we are in "p_ptr->inventory_list" mode */
56 if (easy_floor) command_wrk = (USE_INVEN);
59 /* Display the p_ptr->inventory_list */
60 (void)show_inven(0, USE_FULL);
63 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
64 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
65 (long int)((p_ptr->total_weight * 100) / weight_limit()));
67 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
68 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
69 (p_ptr->total_weight * 100) / weight_limit());
73 command_new = inkey();
76 /* Process "Escape" */
77 if (command_new == ESCAPE)
81 Term_get_size(&wid, &hgt);
85 command_gap = wid - 30;
88 /* Process normal keys */
91 /* Hack -- Use "display" mode */
98 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
101 void do_cmd_equip(void)
105 /* Note that we are in "equipment" mode */
108 /* Note that we are in "equipment" mode */
109 if (easy_floor) command_wrk = (USE_EQUIP);
112 (void)show_equip(0, USE_FULL);
116 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
117 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
118 (long int)((p_ptr->total_weight * 100) / weight_limit()));
120 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
121 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
122 (long int)((p_ptr->total_weight * 100) / weight_limit()));
126 command_new = inkey();
129 /* Process "Escape" */
130 if (command_new == ESCAPE)
134 Term_get_size(&wid, &hgt);
138 command_gap = wid - 30;
141 /* Process normal keys */
144 /* Enter "display" mode */
152 bool select_ring_slot = FALSE;
155 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
158 void do_cmd_wield(void)
160 OBJECT_IDX item, slot;
168 GAME_TEXT o_name[MAX_NLEN];
171 OBJECT_IDX need_switch_wielding = 0;
173 if (p_ptr->special_defense & KATA_MUSOU)
175 set_action(ACTION_NONE);
178 /* Restrict the choices */
179 item_tester_hook = item_tester_hook_wear;
181 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
182 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
184 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
188 slot = wield_slot(o_ptr);
192 /* Shields and some misc. items */
197 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
199 /* Restrict the choices */
200 item_tester_hook = item_tester_hook_melee_weapon;
202 /* Choose a weapon from the equipment only */
203 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
204 s = _("おっと。", "Oops.");
205 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
206 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
209 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
211 /* Both arms are already used by non-weapon */
212 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
213 p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
215 /* Restrict the choices */
216 item_tester_hook = item_tester_hook_mochikae;
219 q = _("どちらの手に装備しますか?", "Equip which hand? ");
220 s = _("おっと。", "Oops.");
221 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
230 /* Asking for dual wielding */
231 if (slot == INVEN_LARM)
233 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
236 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
238 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
241 /* Both arms are already used */
242 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
244 /* Restrict the choices */
245 item_tester_hook = item_tester_hook_mochikae;
248 q = _("どちらの手に装備しますか?", "Equip which hand? ");
249 s = _("おっと。", "Oops.");
251 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
252 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
253 need_switch_wielding = INVEN_RARM;
259 /* Choose a ring slot */
260 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
262 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
266 q = _("どちらの手に装備しますか?", "Equip which hand? ");
268 s = _("おっと。", "Oops.");
270 /* Restrict the choices */
271 select_ring_slot = TRUE;
273 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
275 select_ring_slot = FALSE;
278 select_ring_slot = FALSE;
282 /* Prevent wielding into a cursed slot */
283 if (object_is_cursed(&p_ptr->inventory_list[slot]))
285 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
288 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
290 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
293 /* Cancel the command */
298 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
299 ((o_ptr->ident & IDENT_SENSE) &&
300 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
302 char dummy[MAX_NLEN+80];
304 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
305 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
307 if (!get_check(dummy)) return;
310 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
312 char dummy[MAX_NLEN+100];
314 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
316 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
317 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
319 if (!get_check(dummy)) return;
322 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
324 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
325 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
326 object_type object_tmp;
327 object_type *otmp_ptr = &object_tmp;
328 GAME_TEXT switch_name[MAX_NLEN];
330 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
332 object_copy(otmp_ptr, switch_o_ptr);
333 object_copy(switch_o_ptr, slot_o_ptr);
334 object_copy(slot_o_ptr, otmp_ptr);
336 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
337 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
338 (left_hander ? _("右手", "right") : _("左手", "left")));
339 slot = need_switch_wielding;
342 check_find_art_quest_completion(o_ptr);
344 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
346 identify_item(o_ptr);
348 /* Auto-inscription */
349 autopick_alter_item(item, FALSE);
352 take_turn(p_ptr, 100);
355 /* Obtain local object */
356 object_copy(q_ptr, o_ptr);
358 /* Modify quantity */
361 /* Decrease the item (from the pack) */
364 inven_item_increase(item, -1);
365 inven_item_optimize(item);
368 /* Decrease the item (from the floor) */
371 floor_item_increase(0 - item, -1);
372 floor_item_optimize(0 - item);
375 /* Access the wield slot */
376 o_ptr = &p_ptr->inventory_list[slot];
378 /* Take off existing item */
381 /* Take off existing item */
382 (void)inven_takeoff(slot, 255);
385 /* Wear the new stuff */
386 object_copy(o_ptr, q_ptr);
388 o_ptr->marked |= OM_TOUCHED;
390 p_ptr->total_weight += q_ptr->weight;
392 /* Increment the equip counter by hand */
395 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
396 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
397 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
399 /* Where is the item now */
403 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
404 act = STR_WIELD_ARMS;
406 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
410 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
411 act = STR_WIELD_ARMS;
413 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
417 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
421 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
425 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
429 object_desc(o_name, o_ptr, 0);
430 msg_format(act, o_name, index_to_label(slot));
433 if (object_is_cursed(o_ptr))
435 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
436 chg_virtue(V_HARMONY, -1);
439 o_ptr->ident |= (IDENT_SENSE);
442 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
443 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
445 /* Turn into a vampire */
446 change_race(RACE_VAMPIRE, "");
449 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
450 p_ptr->redraw |= (PR_EQUIPPY);
451 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
458 * @param item 持ち替えを行いたい装備部位ID
461 void kamaenaoshi(INVENTORY_IDX item)
463 object_type *o_ptr, *new_o_ptr;
464 GAME_TEXT o_name[MAX_NLEN];
466 if (item == INVEN_RARM)
468 if (has_melee_weapon(INVEN_LARM))
470 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
471 object_desc(o_name, o_ptr, 0);
473 if (!object_is_cursed(o_ptr))
475 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
476 object_copy(new_o_ptr, o_ptr);
477 p_ptr->total_weight += o_ptr->weight;
478 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
479 inven_item_optimize(INVEN_LARM);
480 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
481 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
483 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
484 (left_hander ? _("左手", "left") : _("右手", "right")));
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);
493 else if (item == INVEN_LARM)
495 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
496 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
498 if (has_melee_weapon(INVEN_RARM))
500 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
501 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
503 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
505 new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
506 object_copy(new_o_ptr, o_ptr);
507 p_ptr->total_weight += o_ptr->weight;
508 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
509 inven_item_optimize(INVEN_RARM);
510 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
517 * @brief 装備を外すコマンドのメインルーチン / Take off an item
520 void do_cmd_takeoff(void)
526 if (p_ptr->special_defense & KATA_MUSOU)
528 set_action(ACTION_NONE);
531 q = _("どれを装備からはずしますか? ", "Take off which item? ");
532 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
534 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
538 if (object_is_cursed(o_ptr))
540 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
542 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
547 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
549 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
551 o_ptr->ident |= (IDENT_SENSE);
552 o_ptr->curse_flags = 0L;
553 o_ptr->feeling = FEEL_NONE;
555 p_ptr->update |= (PU_BONUS);
556 p_ptr->window |= (PW_EQUIP);
558 msg_print(_("呪いを打ち破った。", "You break the curse."));
562 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
563 take_turn(p_ptr, 50);
568 take_turn(p_ptr, 50);
570 /* Take off the item */
571 (void)inven_takeoff(item, 255);
574 p_ptr->redraw |= (PR_EQUIPPY);
579 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
582 void do_cmd_drop(void)
591 if (p_ptr->special_defense & KATA_MUSOU)
593 set_action(ACTION_NONE);
596 q = _("どのアイテムを落としますか? ", "Drop which item? ");
597 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
599 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
602 /* Hack -- Cannot remove cursed items */
603 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
605 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
609 if (o_ptr->number > 1)
611 amt = get_quantity(NULL, o_ptr->number);
612 if (amt <= 0) return;
615 take_turn(p_ptr, 50);
617 /* Drop (some of) the item */
618 inven_drop(item, amt);
620 if (item >= INVEN_RARM)
626 p_ptr->redraw |= (PR_EQUIPPY);
631 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
634 void do_cmd_destroy(void)
644 object_type *q_ptr = &forge;
646 GAME_TEXT o_name[MAX_NLEN];
647 char out_val[MAX_NLEN+40];
651 if (p_ptr->special_defense & KATA_MUSOU)
653 set_action(ACTION_NONE);
656 /* Hack -- force destruction */
657 if (command_arg > 0) force = TRUE;
659 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
660 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
662 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
665 /* Verify unless quantity given beforehand */
666 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
668 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
670 /* Make a verification */
671 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
674 /* HACK : Add the line to message buffer */
675 message_add(out_val);
676 p_ptr->window |= (PW_MESSAGE);
679 /* Get an acceptable answer */
689 /* Erase the prompt */
693 if (i == 'y' || i == 'Y')
697 if (i == ESCAPE || i == 'n' || i == 'N')
704 /* Add an auto-destroy preference line */
705 if (autopick_autoregister(o_ptr))
707 /* Auto-destroy it */
708 autopick_alter_item(item, TRUE);
711 /* The object is already destroyed. */
717 if (o_ptr->number > 1)
719 amt = get_quantity(NULL, o_ptr->number);
720 if (amt <= 0) return;
724 old_number = o_ptr->number;
726 object_desc(o_name, o_ptr, 0);
727 o_ptr->number = old_number;
729 take_turn(p_ptr, 100);
731 /* Artifacts cannot be destroyed */
732 if (!can_player_destroy_object(o_ptr))
736 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
740 object_copy(q_ptr, o_ptr);
742 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
743 sound(SOUND_DESTITEM);
745 /* Reduce the charges of rods/wands */
746 reduce_charges(o_ptr, amt);
748 /* Eliminate the item (from the pack) */
751 inven_item_increase(item, -amt);
752 inven_item_describe(item);
753 inven_item_optimize(item);
756 /* Eliminate the item (from the floor) */
759 floor_item_increase(0 - item, -amt);
760 floor_item_describe(0 - item);
761 floor_item_optimize(0 - item);
764 if (item_tester_high_level_book(q_ptr))
766 bool gain_expr = FALSE;
768 if (p_ptr->prace == RACE_ANDROID)
771 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
775 else if (p_ptr->pclass == CLASS_PALADIN)
777 if (is_good_realm(p_ptr->realm1))
779 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
783 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
787 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
789 s32b tester_exp = p_ptr->max_exp / 20;
790 if (tester_exp > 10000) tester_exp = 10000;
791 if (q_ptr->sval < 3) tester_exp /= 4;
792 if (tester_exp<1) tester_exp = 1;
794 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
795 gain_exp(tester_exp * amt);
797 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
799 chg_virtue(V_UNLIFE, 1);
800 chg_virtue(V_VITALITY, -1);
802 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
804 chg_virtue(V_UNLIFE, -1);
805 chg_virtue(V_VITALITY, 1);
808 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
809 chg_virtue(V_ENCHANT, -1);
811 if (object_value_real(q_ptr) > 30000)
812 chg_virtue(V_SACRIFICE, 2);
814 else if (object_value_real(q_ptr) > 10000)
815 chg_virtue(V_SACRIFICE, 1);
818 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
819 chg_virtue(V_HARMONY, 1);
821 if (item >= INVEN_RARM) calc_android_exp();
826 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
829 void do_cmd_observe(void)
833 GAME_TEXT o_name[MAX_NLEN];
836 q = _("どのアイテムを調べますか? ", "Examine which item? ");
837 s = _("調べられるアイテムがない。", "You have nothing to examine.");
839 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
842 /* Require full knowledge */
843 if (!(o_ptr->ident & IDENT_MENTAL))
845 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
849 object_desc(o_name, o_ptr, 0);
850 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
851 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
857 * @brief アイテムの銘を消すコマンドのメインルーチン
858 * Remove the inscription from an object XXX Mention item (when done)?
861 void do_cmd_uninscribe(void)
867 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
868 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
870 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
873 /* Nothing to remove */
874 if (!o_ptr->inscription)
876 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
880 msg_print(_("銘を消した。", "Inscription removed."));
882 /* Remove the incription */
883 o_ptr->inscription = 0;
884 p_ptr->update |= (PU_COMBINE);
885 p_ptr->window |= (PW_INVEN | PW_EQUIP);
887 /* .や$の関係で, 再計算が必要なはず -- henkma */
888 p_ptr->update |= (PU_BONUS);
894 * @brief アイテムの銘を刻むコマンドのメインルーチン
895 * Inscribe an object with a comment
898 void do_cmd_inscribe(void)
902 GAME_TEXT o_name[MAX_NLEN];
906 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
907 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
909 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
912 /* Describe the activity */
913 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
915 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
918 /* Start with nothing */
921 /* Use old inscription */
922 if (o_ptr->inscription)
924 /* Start with the old inscription */
925 strcpy(out_val, quark_str(o_ptr->inscription));
928 /* Get a new inscription (possibly empty) */
929 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
931 /* Save the inscription */
932 o_ptr->inscription = quark_add(out_val);
933 p_ptr->update |= (PU_COMBINE);
934 p_ptr->window |= (PW_INVEN | PW_EQUIP);
936 /* .や$の関係で, 再計算が必要なはず -- henkma */
937 p_ptr->update |= (PU_BONUS);
943 * @brief ランタンに燃料を加えるコマンドのメインルーチン
944 * Refill the players lamp (from the pack or floor)
947 static void do_cmd_refill_lamp(void)
954 /* Restrict the choices */
955 item_tester_hook = item_tester_refill_lantern;
957 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
958 s = _("油つぼがない。", "You have no flasks of oil.");
960 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
963 take_turn(p_ptr, 50);
965 /* Access the lantern */
966 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
969 j_ptr->xtra4 += o_ptr->xtra4;
970 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
972 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
975 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
977 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
980 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
982 else if (j_ptr->xtra4 >= FUEL_LAMP)
984 j_ptr->xtra4 = FUEL_LAMP;
985 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
988 /* Decrease the item (from the pack) */
991 inven_item_increase(item, -1);
992 inven_item_describe(item);
993 inven_item_optimize(item);
996 /* Decrease the item (from the floor) */
999 floor_item_increase(0 - item, -1);
1000 floor_item_describe(0 - item);
1001 floor_item_optimize(0 - item);
1004 p_ptr->update |= (PU_TORCH);
1008 * @brief 松明を束ねるコマンドのメインルーチン
1009 * Refuel the players torch (from the pack or floor)
1012 static void do_cmd_refill_torch(void)
1021 /* Restrict the choices */
1022 item_tester_hook = object_can_refill_torch;
1024 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1025 s = _("他に松明がない。", "You have no extra torches.");
1027 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1030 take_turn(p_ptr, 50);
1032 /* Access the primary torch */
1033 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1036 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1038 msg_print(_("松明を結合した。", "You combine the torches."));
1040 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1043 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1045 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1048 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1050 /* Over-fuel message */
1051 else if (j_ptr->xtra4 >= FUEL_TORCH)
1053 j_ptr->xtra4 = FUEL_TORCH;
1054 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1057 /* Refuel message */
1060 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1063 /* Decrease the item (from the pack) */
1066 inven_item_increase(item, -1);
1067 inven_item_describe(item);
1068 inven_item_optimize(item);
1071 /* Decrease the item (from the floor) */
1074 floor_item_increase(0 - item, -1);
1075 floor_item_describe(0 - item);
1076 floor_item_optimize(0 - item);
1079 p_ptr->update |= (PU_TORCH);
1084 * @brief 燃料を補充するコマンドのメインルーチン
1085 * Refill the players lamp, or restock his torches
1088 void do_cmd_refill(void)
1093 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1095 if (p_ptr->special_defense & KATA_MUSOU)
1097 set_action(ACTION_NONE);
1101 if (o_ptr->tval != TV_LITE)
1103 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1107 else if (o_ptr->sval == SV_LITE_LANTERN)
1109 do_cmd_refill_lamp();
1113 else if (o_ptr->sval == SV_LITE_TORCH)
1115 do_cmd_refill_torch();
1118 /* No torch to refill */
1121 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1127 * @brief ターゲットを設定するコマンドのメインルーチン
1131 void do_cmd_target(void)
1133 if (p_ptr->wild_mode) return;
1136 if (target_set(TARGET_KILL))
1138 msg_print(_("ターゲット決定。", "Target Selected."));
1141 /* Target aborted */
1144 msg_print(_("ターゲット解除。", "Target Aborted."));
1151 * @brief 周囲を見渡すコマンドのメインルーチン
1155 void do_cmd_look(void)
1157 p_ptr->window |= PW_MONSTER_LIST;
1161 if (target_set(TARGET_LOOK))
1163 msg_print(_("ターゲット決定。", "Target Selected."));
1169 * @brief 位置を確認するコマンドのメインルーチン
1170 * Allow the player to examine other sectors on the map
1173 void do_cmd_locate(void)
1176 POSITION y1, x1, y2, x2;
1177 GAME_TEXT tmp_val[80];
1178 GAME_TEXT out_val[160];
1181 get_screen_size(&wid, &hgt);
1183 /* Start at current panel */
1184 y2 = y1 = panel_row_min;
1185 x2 = x1 = panel_col_min;
1187 /* Show panels until done */
1190 /* Describe the location */
1191 if ((y2 == y1) && (x2 == x1))
1193 strcpy(tmp_val, _("真上", "\0"));
1197 sprintf(tmp_val, "%s%s",
1198 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1199 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1202 /* Prepare to ask which way to look */
1203 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1204 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1205 y2 / (hgt / 2), y2 % (hgt / 2),
1206 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1208 /* Assume no direction */
1211 /* Get a direction */
1216 /* Get a command (or Cancel) */
1217 if (!get_com(out_val, &command, TRUE)) break;
1219 /* Extract the action (if any) */
1220 dir = get_keymap_dir(command);
1229 /* Apply the motion */
1230 if (change_panel(ddy[dir], ddx[dir]))
1238 /* Recenter the map around the player */
1241 p_ptr->update |= (PU_MONSTERS);
1242 p_ptr->redraw |= (PR_MAP);
1243 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1249 * @brief モンスターの思い出を見るコマンドのメインルーチン
1250 * Identify a character, allow recall of monsters
1254 * Several "special" responses recall "multiple" monsters:
1256 * ^U (all unique monsters)
1257 * ^N (all non-unique monsters)
1259 * The responses may be sorted in several ways, see below.
1261 * Note that the player ghosts are ignored.
1264 void do_cmd_query_symbol(void)
1278 bool recall = FALSE;
1283 /* Get a character, or abort */
1284 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1285 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1287 /* Find that character info, and describe it */
1288 for (i = 0; ident_info[i]; ++i)
1290 if (sym == ident_info[i][0]) break;
1292 if (sym == KTRL('A'))
1295 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1297 else if (sym == KTRL('U'))
1300 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1302 else if (sym == KTRL('N'))
1305 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1307 else if (sym == KTRL('R'))
1310 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1312 /* XTRA HACK WHATSEARCH */
1313 else if (sym == KTRL('M'))
1316 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1321 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1323 else if (ident_info[i])
1325 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1329 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1332 /* Display the result */
1335 /* Allocate the "who" array */
1336 C_MAKE(who, max_r_idx, MONRACE_IDX);
1338 /* Collect matching monsters */
1339 for (n = 0, i = 1; i < max_r_idx; i++)
1341 monster_race *r_ptr = &r_info[i];
1343 /* Nothing to recall */
1344 if (!cheat_know && !r_ptr->r_sights) continue;
1346 /* Require non-unique monsters if needed */
1347 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1349 /* Require unique monsters if needed */
1350 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1352 /* Require ridable monsters if needed */
1353 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1355 /* XTRA HACK WHATSEARCH */
1361 for (xx = 0; temp[xx] && xx < 80; xx++)
1364 if (iskanji(temp[xx])) { xx++; continue; }
1366 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1370 strcpy(temp2, r_name + r_ptr->E_name);
1372 strcpy(temp2, r_name + r_ptr->name);
1374 for (xx = 0; temp2[xx] && xx < 80; xx++)
1375 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1378 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1380 if (my_strstr(temp2, temp))
1385 /* Collect "appropriate" monsters */
1386 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1389 /* Nothing to recall */
1392 C_KILL(who, max_r_idx, MONRACE_IDX);
1397 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1405 /* Sort the array */
1406 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1408 /* Sort by kills (and level) */
1415 /* Catch "escape" */
1418 C_KILL(who, max_r_idx, MONRACE_IDX);
1422 /* Sort if needed */
1425 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1429 /* Start at the end */
1432 /* Scan the monster memory */
1435 /* Extract a race */
1438 /* Hack -- Auto-recall */
1439 monster_race_track(r_idx);
1450 /* Recall on screen */
1451 screen_roff(who[i], 0);
1454 /* Hack -- Begin the prompt */
1457 /* Hack -- Complete the prompt */
1458 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1468 /* Normal commands */
1469 if (query != 'r') break;
1476 if (query == ESCAPE) break;
1478 /* Move to "prev" monster */
1484 if (!expand_list) break;
1488 /* Move to "next" monster */
1494 if (!expand_list) break;
1499 /* Free the "who" array */
1500 C_KILL(who, max_r_idx, IDX);
1502 /* Re-display the identity */
1507 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1511 * XXX - Add actions for other item types
1513 void do_cmd_use(void)
1519 if (p_ptr->wild_mode)
1524 if (cmd_limit_arena(p_ptr)) return;
1526 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1528 set_action(ACTION_NONE);
1531 item_tester_hook = item_tester_hook_use;
1533 q = _("どれを使いますか?", "Use which item? ");
1534 s = _("使えるものがありません。", "You have nothing to use.");
1536 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1539 switch (o_ptr->tval)
1551 do_cmd_eat_food_aux(item);
1558 do_cmd_aim_wand_aux(item);
1565 do_cmd_use_staff_aux(item);
1572 do_cmd_zap_rod_aux(item);
1576 /* Quaff a potion */
1579 do_cmd_quaff_potion_aux(item);
1586 if (cmd_limit_blind(p_ptr)) return;
1587 if (cmd_limit_confused(p_ptr)) return;
1589 do_cmd_read_scroll_aux(item, TRUE);
1598 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1602 /* Activate an artifact */
1605 do_cmd_activate_aux(item);