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.
20 #include "cmd-activate.h"
22 #include "cmd-quaff.h"
24 #include "cmd-usestaff.h"
25 #include "cmd-zaprod.h"
26 #include "cmd-zapwand.h"
28 #include "cmd-basic.h"
30 #include "object-flavor.h"
31 #include "object-hook.h"
36 #include "player-status.h"
37 #include "player-effects.h"
39 #include "view-mainwindow.h"
41 #include "objectkind.h"
43 #include "targeting.h"
46 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display p_ptr->inventory_list
49 void do_cmd_inven(void)
53 /* Note that we are in "p_ptr->inventory_list" mode */
56 /* Note that we are in "p_ptr->inventory_list" mode */
57 if (easy_floor) command_wrk = (USE_INVEN);
60 /* Display the p_ptr->inventory_list */
61 (void)show_inven(0, USE_FULL);
64 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
65 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
66 (long int)((p_ptr->total_weight * 100) / weight_limit()));
68 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
69 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
70 (p_ptr->total_weight * 100) / weight_limit());
74 command_new = inkey();
77 /* Process "Escape" */
78 if (command_new == ESCAPE)
82 Term_get_size(&wid, &hgt);
86 command_gap = wid - 30;
89 /* Process normal keys */
92 /* Hack -- Use "display" mode */
99 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
102 void do_cmd_equip(void)
106 /* Note that we are in "equipment" mode */
109 /* Note that we are in "equipment" mode */
110 if (easy_floor) command_wrk = (USE_EQUIP);
113 (void)show_equip(0, USE_FULL);
117 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
118 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
119 (long int)((p_ptr->total_weight * 100) / weight_limit()));
121 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
122 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
123 (long int)((p_ptr->total_weight * 100) / weight_limit()));
127 command_new = inkey();
130 /* Process "Escape" */
131 if (command_new == ESCAPE)
135 Term_get_size(&wid, &hgt);
139 command_gap = wid - 30;
142 /* Process normal keys */
145 /* Enter "display" mode */
153 bool select_ring_slot = FALSE;
156 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
159 void do_cmd_wield(void)
161 OBJECT_IDX item, slot;
169 GAME_TEXT o_name[MAX_NLEN];
172 OBJECT_IDX need_switch_wielding = 0;
174 if (p_ptr->special_defense & KATA_MUSOU)
176 set_action(ACTION_NONE);
179 /* Restrict the choices */
180 item_tester_hook = item_tester_hook_wear;
182 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
183 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
185 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
189 slot = wield_slot(o_ptr);
193 /* Shields and some misc. items */
198 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
200 /* Restrict the choices */
201 item_tester_hook = item_tester_hook_melee_weapon;
203 /* Choose a weapon from the equipment only */
204 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
205 s = _("おっと。", "Oops.");
206 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
207 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
210 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
212 /* Both arms are already used by non-weapon */
213 else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
214 p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
216 /* Restrict the choices */
217 item_tester_hook = item_tester_hook_mochikae;
220 q = _("どちらの手に装備しますか?", "Equip which hand? ");
221 s = _("おっと。", "Oops.");
222 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
231 /* Asking for dual wielding */
232 if (slot == INVEN_LARM)
234 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
237 else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
239 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
242 /* Both arms are already used */
243 else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
245 /* Restrict the choices */
246 item_tester_hook = item_tester_hook_mochikae;
249 q = _("どちらの手に装備しますか?", "Equip which hand? ");
250 s = _("おっと。", "Oops.");
252 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
253 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
254 need_switch_wielding = INVEN_RARM;
260 /* Choose a ring slot */
261 if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
263 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
267 q = _("どちらの手に装備しますか?", "Equip which hand? ");
269 s = _("おっと。", "Oops.");
271 /* Restrict the choices */
272 select_ring_slot = TRUE;
274 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
276 select_ring_slot = FALSE;
279 select_ring_slot = FALSE;
283 /* Prevent wielding into a cursed slot */
284 if (object_is_cursed(&p_ptr->inventory_list[slot]))
286 object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
289 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
291 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
294 /* Cancel the command */
299 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
300 ((o_ptr->ident & IDENT_SENSE) &&
301 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
303 char dummy[MAX_NLEN+80];
305 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
306 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
308 if (!get_check(dummy)) return;
311 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
313 char dummy[MAX_NLEN+100];
315 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
317 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
318 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
320 if (!get_check(dummy)) return;
323 if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
325 object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
326 object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
327 object_type object_tmp;
328 object_type *otmp_ptr = &object_tmp;
329 GAME_TEXT switch_name[MAX_NLEN];
331 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
333 object_copy(otmp_ptr, switch_o_ptr);
334 object_copy(switch_o_ptr, slot_o_ptr);
335 object_copy(slot_o_ptr, otmp_ptr);
337 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
338 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
339 (left_hander ? _("右手", "right") : _("左手", "left")));
340 slot = need_switch_wielding;
343 check_find_art_quest_completion(o_ptr);
345 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
347 identify_item(o_ptr);
349 /* Auto-inscription */
350 autopick_alter_item(item, FALSE);
353 take_turn(p_ptr, 100);
356 /* Obtain local object */
357 object_copy(q_ptr, o_ptr);
359 /* Modify quantity */
362 /* Decrease the item (from the pack) */
365 inven_item_increase(item, -1);
366 inven_item_optimize(item);
369 /* Decrease the item (from the floor) */
372 floor_item_increase(0 - item, -1);
373 floor_item_optimize(0 - item);
376 /* Access the wield slot */
377 o_ptr = &p_ptr->inventory_list[slot];
379 /* Take off existing item */
382 /* Take off existing item */
383 (void)inven_takeoff(slot, 255);
386 /* Wear the new stuff */
387 object_copy(o_ptr, q_ptr);
389 o_ptr->marked |= OM_TOUCHED;
391 p_ptr->total_weight += q_ptr->weight;
393 /* Increment the equip counter by hand */
396 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
397 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
398 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
400 /* Where is the item now */
404 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
405 act = STR_WIELD_ARMS;
407 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
411 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
412 act = STR_WIELD_ARMS;
414 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
418 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
422 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
426 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
430 object_desc(o_name, o_ptr, 0);
431 msg_format(act, o_name, index_to_label(slot));
434 if (object_is_cursed(o_ptr))
436 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
437 chg_virtue(V_HARMONY, -1);
440 o_ptr->ident |= (IDENT_SENSE);
443 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
444 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
446 /* Turn into a vampire */
447 change_race(RACE_VAMPIRE, "");
450 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
451 p_ptr->redraw |= (PR_EQUIPPY);
452 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
459 * @param item 持ち替えを行いたい装備部位ID
462 void kamaenaoshi(INVENTORY_IDX item)
464 object_type *o_ptr, *new_o_ptr;
465 GAME_TEXT o_name[MAX_NLEN];
467 if (item == INVEN_RARM)
469 if (has_melee_weapon(INVEN_LARM))
471 o_ptr = &p_ptr->inventory_list[INVEN_LARM];
472 object_desc(o_name, o_ptr, 0);
474 if (!object_is_cursed(o_ptr))
476 new_o_ptr = &p_ptr->inventory_list[INVEN_RARM];
477 object_copy(new_o_ptr, o_ptr);
478 p_ptr->total_weight += o_ptr->weight;
479 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
480 inven_item_optimize(INVEN_LARM);
481 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
482 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
484 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
485 (left_hander ? _("左手", "left") : _("右手", "right")));
489 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
490 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
494 else if (item == INVEN_LARM)
496 o_ptr = &p_ptr->inventory_list[INVEN_RARM];
497 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
499 if (has_melee_weapon(INVEN_RARM))
501 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
502 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
504 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
506 new_o_ptr = &p_ptr->inventory_list[INVEN_LARM];
507 object_copy(new_o_ptr, o_ptr);
508 p_ptr->total_weight += o_ptr->weight;
509 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
510 inven_item_optimize(INVEN_RARM);
511 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
518 * @brief 装備を外すコマンドのメインルーチン / Take off an item
521 void do_cmd_takeoff(void)
527 if (p_ptr->special_defense & KATA_MUSOU)
529 set_action(ACTION_NONE);
532 q = _("どれを装備からはずしますか? ", "Take off which item? ");
533 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
535 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
539 if (object_is_cursed(o_ptr))
541 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
543 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
548 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
550 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
552 o_ptr->ident |= (IDENT_SENSE);
553 o_ptr->curse_flags = 0L;
554 o_ptr->feeling = FEEL_NONE;
556 p_ptr->update |= (PU_BONUS);
557 p_ptr->window |= (PW_EQUIP);
559 msg_print(_("呪いを打ち破った。", "You break the curse."));
563 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
564 take_turn(p_ptr, 50);
569 take_turn(p_ptr, 50);
571 /* Take off the item */
572 (void)inven_takeoff(item, 255);
575 p_ptr->redraw |= (PR_EQUIPPY);
580 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
583 void do_cmd_drop(void)
592 if (p_ptr->special_defense & KATA_MUSOU)
594 set_action(ACTION_NONE);
597 q = _("どのアイテムを落としますか? ", "Drop which item? ");
598 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
600 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
603 /* Hack -- Cannot remove cursed items */
604 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
606 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
610 if (o_ptr->number > 1)
612 amt = get_quantity(NULL, o_ptr->number);
613 if (amt <= 0) return;
616 take_turn(p_ptr, 50);
618 /* Drop (some of) the item */
619 inven_drop(item, amt);
621 if (item >= INVEN_RARM)
627 p_ptr->redraw |= (PR_EQUIPPY);
632 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
635 void do_cmd_destroy(void)
645 object_type *q_ptr = &forge;
647 GAME_TEXT o_name[MAX_NLEN];
648 char out_val[MAX_NLEN+40];
652 if (p_ptr->special_defense & KATA_MUSOU)
654 set_action(ACTION_NONE);
657 /* Hack -- force destruction */
658 if (command_arg > 0) force = TRUE;
660 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
661 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
663 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
666 /* Verify unless quantity given beforehand */
667 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
669 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
671 /* Make a verification */
672 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
675 /* HACK : Add the line to message buffer */
676 message_add(out_val);
677 p_ptr->window |= (PW_MESSAGE);
680 /* Get an acceptable answer */
690 /* Erase the prompt */
694 if (i == 'y' || i == 'Y')
698 if (i == ESCAPE || i == 'n' || i == 'N')
705 /* Add an auto-destroy preference line */
706 if (autopick_autoregister(o_ptr))
708 /* Auto-destroy it */
709 autopick_alter_item(item, TRUE);
712 /* The object is already destroyed. */
718 if (o_ptr->number > 1)
720 amt = get_quantity(NULL, o_ptr->number);
721 if (amt <= 0) return;
725 old_number = o_ptr->number;
727 object_desc(o_name, o_ptr, 0);
728 o_ptr->number = old_number;
730 take_turn(p_ptr, 100);
732 /* Artifacts cannot be destroyed */
733 if (!can_player_destroy_object(o_ptr))
737 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
741 object_copy(q_ptr, o_ptr);
743 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
744 sound(SOUND_DESTITEM);
746 /* Reduce the charges of rods/wands */
747 reduce_charges(o_ptr, amt);
749 /* Eliminate the item (from the pack) */
752 inven_item_increase(item, -amt);
753 inven_item_describe(item);
754 inven_item_optimize(item);
757 /* Eliminate the item (from the floor) */
760 floor_item_increase(0 - item, -amt);
761 floor_item_describe(0 - item);
762 floor_item_optimize(0 - item);
765 if (item_tester_high_level_book(q_ptr))
767 bool gain_expr = FALSE;
769 if (p_ptr->prace == RACE_ANDROID)
772 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
776 else if (p_ptr->pclass == CLASS_PALADIN)
778 if (is_good_realm(p_ptr->realm1))
780 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
784 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
788 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
790 s32b tester_exp = p_ptr->max_exp / 20;
791 if (tester_exp > 10000) tester_exp = 10000;
792 if (q_ptr->sval < 3) tester_exp /= 4;
793 if (tester_exp<1) tester_exp = 1;
795 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
796 gain_exp(tester_exp * amt);
798 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
800 chg_virtue(V_UNLIFE, 1);
801 chg_virtue(V_VITALITY, -1);
803 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
805 chg_virtue(V_UNLIFE, -1);
806 chg_virtue(V_VITALITY, 1);
809 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
810 chg_virtue(V_ENCHANT, -1);
812 if (object_value_real(q_ptr) > 30000)
813 chg_virtue(V_SACRIFICE, 2);
815 else if (object_value_real(q_ptr) > 10000)
816 chg_virtue(V_SACRIFICE, 1);
819 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
820 chg_virtue(V_HARMONY, 1);
822 if (item >= INVEN_RARM) calc_android_exp();
827 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
830 void do_cmd_observe(void)
834 GAME_TEXT o_name[MAX_NLEN];
837 q = _("どのアイテムを調べますか? ", "Examine which item? ");
838 s = _("調べられるアイテムがない。", "You have nothing to examine.");
840 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
843 /* Require full knowledge */
844 if (!(o_ptr->ident & IDENT_MENTAL))
846 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
850 object_desc(o_name, o_ptr, 0);
851 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
852 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
858 * @brief アイテムの銘を消すコマンドのメインルーチン
859 * Remove the inscription from an object XXX Mention item (when done)?
862 void do_cmd_uninscribe(void)
868 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
869 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
871 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
874 /* Nothing to remove */
875 if (!o_ptr->inscription)
877 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
881 msg_print(_("銘を消した。", "Inscription removed."));
883 /* Remove the incription */
884 o_ptr->inscription = 0;
885 p_ptr->update |= (PU_COMBINE);
886 p_ptr->window |= (PW_INVEN | PW_EQUIP);
888 /* .や$の関係で, 再計算が必要なはず -- henkma */
889 p_ptr->update |= (PU_BONUS);
895 * @brief アイテムの銘を刻むコマンドのメインルーチン
896 * Inscribe an object with a comment
899 void do_cmd_inscribe(void)
903 GAME_TEXT o_name[MAX_NLEN];
907 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
908 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
910 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
913 /* Describe the activity */
914 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
916 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
919 /* Start with nothing */
922 /* Use old inscription */
923 if (o_ptr->inscription)
925 /* Start with the old inscription */
926 strcpy(out_val, quark_str(o_ptr->inscription));
929 /* Get a new inscription (possibly empty) */
930 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
932 /* Save the inscription */
933 o_ptr->inscription = quark_add(out_val);
934 p_ptr->update |= (PU_COMBINE);
935 p_ptr->window |= (PW_INVEN | PW_EQUIP);
937 /* .や$の関係で, 再計算が必要なはず -- henkma */
938 p_ptr->update |= (PU_BONUS);
944 * @brief ランタンに燃料を加えるコマンドのメインルーチン
945 * Refill the players lamp (from the pack or floor)
948 static void do_cmd_refill_lamp(void)
955 /* Restrict the choices */
956 item_tester_hook = item_tester_refill_lantern;
958 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
959 s = _("油つぼがない。", "You have no flasks of oil.");
961 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
964 take_turn(p_ptr, 50);
966 /* Access the lantern */
967 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
970 j_ptr->xtra4 += o_ptr->xtra4;
971 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
973 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
976 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
978 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
981 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
983 else if (j_ptr->xtra4 >= FUEL_LAMP)
985 j_ptr->xtra4 = FUEL_LAMP;
986 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
989 /* Decrease the item (from the pack) */
992 inven_item_increase(item, -1);
993 inven_item_describe(item);
994 inven_item_optimize(item);
997 /* Decrease the item (from the floor) */
1000 floor_item_increase(0 - item, -1);
1001 floor_item_describe(0 - item);
1002 floor_item_optimize(0 - item);
1005 p_ptr->update |= (PU_TORCH);
1009 * @brief 松明を束ねるコマンドのメインルーチン
1010 * Refuel the players torch (from the pack or floor)
1013 static void do_cmd_refill_torch(void)
1022 /* Restrict the choices */
1023 item_tester_hook = object_can_refill_torch;
1025 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1026 s = _("他に松明がない。", "You have no extra torches.");
1028 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1031 take_turn(p_ptr, 50);
1033 /* Access the primary torch */
1034 j_ptr = &p_ptr->inventory_list[INVEN_LITE];
1037 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1039 msg_print(_("松明を結合した。", "You combine the torches."));
1041 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1044 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1046 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1049 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1051 /* Over-fuel message */
1052 else if (j_ptr->xtra4 >= FUEL_TORCH)
1054 j_ptr->xtra4 = FUEL_TORCH;
1055 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1058 /* Refuel message */
1061 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1064 /* Decrease the item (from the pack) */
1067 inven_item_increase(item, -1);
1068 inven_item_describe(item);
1069 inven_item_optimize(item);
1072 /* Decrease the item (from the floor) */
1075 floor_item_increase(0 - item, -1);
1076 floor_item_describe(0 - item);
1077 floor_item_optimize(0 - item);
1080 p_ptr->update |= (PU_TORCH);
1085 * @brief 燃料を補充するコマンドのメインルーチン
1086 * Refill the players lamp, or restock his torches
1089 void do_cmd_refill(void)
1094 o_ptr = &p_ptr->inventory_list[INVEN_LITE];
1096 if (p_ptr->special_defense & KATA_MUSOU)
1098 set_action(ACTION_NONE);
1102 if (o_ptr->tval != TV_LITE)
1104 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1108 else if (o_ptr->sval == SV_LITE_LANTERN)
1110 do_cmd_refill_lamp();
1114 else if (o_ptr->sval == SV_LITE_TORCH)
1116 do_cmd_refill_torch();
1119 /* No torch to refill */
1122 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1128 * @brief ターゲットを設定するコマンドのメインルーチン
1132 void do_cmd_target(void)
1134 if (p_ptr->wild_mode) return;
1137 if (target_set(TARGET_KILL))
1139 msg_print(_("ターゲット決定。", "Target Selected."));
1142 /* Target aborted */
1145 msg_print(_("ターゲット解除。", "Target Aborted."));
1152 * @brief 周囲を見渡すコマンドのメインルーチン
1156 void do_cmd_look(void)
1158 p_ptr->window |= PW_MONSTER_LIST;
1162 if (target_set(TARGET_LOOK))
1164 msg_print(_("ターゲット決定。", "Target Selected."));
1170 * @brief 位置を確認するコマンドのメインルーチン
1171 * Allow the player to examine other sectors on the map
1174 void do_cmd_locate(void)
1177 POSITION y1, x1, y2, x2;
1178 GAME_TEXT tmp_val[80];
1179 GAME_TEXT out_val[160];
1182 get_screen_size(&wid, &hgt);
1184 /* Start at current panel */
1185 y2 = y1 = panel_row_min;
1186 x2 = x1 = panel_col_min;
1188 /* Show panels until done */
1191 /* Describe the location */
1192 if ((y2 == y1) && (x2 == x1))
1194 strcpy(tmp_val, _("真上", "\0"));
1198 sprintf(tmp_val, "%s%s",
1199 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1200 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1203 /* Prepare to ask which way to look */
1204 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1205 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1206 y2 / (hgt / 2), y2 % (hgt / 2),
1207 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1209 /* Assume no direction */
1212 /* Get a direction */
1217 /* Get a command (or Cancel) */
1218 if (!get_com(out_val, &command, TRUE)) break;
1220 /* Extract the action (if any) */
1221 dir = get_keymap_dir(command);
1230 /* Apply the motion */
1231 if (change_panel(ddy[dir], ddx[dir]))
1239 /* Recenter the map around the player */
1242 p_ptr->update |= (PU_MONSTERS);
1243 p_ptr->redraw |= (PR_MAP);
1244 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1250 * @brief モンスターの思い出を見るコマンドのメインルーチン
1251 * Identify a character, allow recall of monsters
1255 * Several "special" responses recall "multiple" monsters:
1257 * ^U (all unique monsters)
1258 * ^N (all non-unique monsters)
1260 * The responses may be sorted in several ways, see below.
1262 * Note that the player ghosts are ignored.
1265 void do_cmd_query_symbol(void)
1279 bool recall = FALSE;
1284 /* Get a character, or abort */
1285 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1286 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1288 /* Find that character info, and describe it */
1289 for (i = 0; ident_info[i]; ++i)
1291 if (sym == ident_info[i][0]) break;
1293 if (sym == KTRL('A'))
1296 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1298 else if (sym == KTRL('U'))
1301 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1303 else if (sym == KTRL('N'))
1306 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1308 else if (sym == KTRL('R'))
1311 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1313 /* XTRA HACK WHATSEARCH */
1314 else if (sym == KTRL('M'))
1317 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1322 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1324 else if (ident_info[i])
1326 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1330 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1333 /* Display the result */
1336 /* Allocate the "who" array */
1337 C_MAKE(who, max_r_idx, MONRACE_IDX);
1339 /* Collect matching monsters */
1340 for (n = 0, i = 1; i < max_r_idx; i++)
1342 monster_race *r_ptr = &r_info[i];
1344 /* Nothing to recall */
1345 if (!cheat_know && !r_ptr->r_sights) continue;
1347 /* Require non-unique monsters if needed */
1348 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1350 /* Require unique monsters if needed */
1351 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1353 /* Require ridable monsters if needed */
1354 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1356 /* XTRA HACK WHATSEARCH */
1362 for (xx = 0; temp[xx] && xx < 80; xx++)
1365 if (iskanji(temp[xx])) { xx++; continue; }
1367 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1371 strcpy(temp2, r_name + r_ptr->E_name);
1373 strcpy(temp2, r_name + r_ptr->name);
1375 for (xx = 0; temp2[xx] && xx < 80; xx++)
1376 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1379 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1381 if (my_strstr(temp2, temp))
1386 /* Collect "appropriate" monsters */
1387 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1390 /* Nothing to recall */
1393 C_KILL(who, max_r_idx, MONRACE_IDX);
1398 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1406 /* Sort the array */
1407 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1409 /* Sort by kills (and level) */
1416 /* Catch "escape" */
1419 C_KILL(who, max_r_idx, MONRACE_IDX);
1423 /* Sort if needed */
1426 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1430 /* Start at the end */
1433 /* Scan the monster memory */
1436 /* Extract a race */
1439 /* Hack -- Auto-recall */
1440 monster_race_track(r_idx);
1451 /* Recall on screen */
1452 screen_roff(who[i], 0);
1455 /* Hack -- Begin the prompt */
1458 /* Hack -- Complete the prompt */
1459 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1469 /* Normal commands */
1470 if (query != 'r') break;
1477 if (query == ESCAPE) break;
1479 /* Move to "prev" monster */
1485 if (!expand_list) break;
1489 /* Move to "next" monster */
1495 if (!expand_list) break;
1500 /* Free the "who" array */
1501 C_KILL(who, max_r_idx, IDX);
1503 /* Re-display the identity */
1508 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1512 * XXX - Add actions for other item types
1514 void do_cmd_use(void)
1520 if (p_ptr->wild_mode)
1525 if (cmd_limit_arena(p_ptr)) return;
1527 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1529 set_action(ACTION_NONE);
1532 item_tester_hook = item_tester_hook_use;
1534 q = _("どれを使いますか?", "Use which item? ");
1535 s = _("使えるものがありません。", "You have nothing to use.");
1537 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1540 switch (o_ptr->tval)
1552 do_cmd_eat_food_aux(item);
1559 do_cmd_aim_wand_aux(item);
1566 do_cmd_use_staff_aux(item);
1573 do_cmd_zap_rod_aux(item);
1577 /* Quaff a potion */
1580 do_cmd_quaff_potion_aux(item);
1587 if (cmd_limit_blind(p_ptr)) return;
1588 if (cmd_limit_confused(p_ptr)) return;
1590 do_cmd_read_scroll_aux(item, TRUE);
1599 exe_fire(item, &p_ptr->inventory_list[INVEN_BOW], SP_NONE);
1603 /* Activate an artifact */
1606 do_cmd_activate_aux(item);