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.
16 #include "cmd-activate.h"
18 #include "cmd-quaff.h"
20 #include "cmd-usestaff.h"
21 #include "cmd-zaprod.h"
22 #include "cmd-zapwand.h"
24 #include "player-item.h"
25 #include "object-hook.h"
29 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory
32 void do_cmd_inven(void)
36 /* Note that we are in "inventory" mode */
39 /* Note that we are in "inventory" mode */
40 if (easy_floor) command_wrk = (USE_INVEN);
43 /* Display the inventory */
44 (void)show_inven(0, USE_FULL);
47 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
48 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
49 (long int)((p_ptr->total_weight * 100) / weight_limit()));
51 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
52 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
53 (p_ptr->total_weight * 100) / weight_limit());
57 command_new = inkey();
60 /* Process "Escape" */
61 if (command_new == ESCAPE)
65 Term_get_size(&wid, &hgt);
69 command_gap = wid - 30;
72 /* Process normal keys */
75 /* Hack -- Use "display" mode */
82 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
85 void do_cmd_equip(void)
90 /* Note that we are in "equipment" mode */
93 /* Note that we are in "equipment" mode */
94 if (easy_floor) command_wrk = (USE_EQUIP);
97 (void)show_equip(0, USE_FULL);
101 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
102 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
103 (long int)((p_ptr->total_weight * 100) / weight_limit()));
105 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
106 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
107 (long int)((p_ptr->total_weight * 100) / weight_limit()));
111 command_new = inkey();
114 /* Process "Escape" */
115 if (command_new == ESCAPE)
119 Term_get_size(&wid, &hgt);
123 command_gap = wid - 30;
126 /* Process normal keys */
129 /* Enter "display" mode */
137 bool select_ring_slot = FALSE;
140 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
143 void do_cmd_wield(void)
145 OBJECT_IDX item, slot;
153 GAME_TEXT o_name[MAX_NLEN];
156 OBJECT_IDX need_switch_wielding = 0;
158 if (p_ptr->special_defense & KATA_MUSOU)
160 set_action(ACTION_NONE);
163 /* Restrict the choices */
164 item_tester_hook = item_tester_hook_wear;
166 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
167 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
169 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
173 slot = wield_slot(o_ptr);
177 /* Shields and some misc. items */
182 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
184 /* Restrict the choices */
185 item_tester_hook = item_tester_hook_melee_weapon;
187 /* Choose a weapon from the equipment only */
188 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
189 s = _("おっと。", "Oops.");
190 if (!get_item(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
191 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
194 else if (buki_motteruka(INVEN_LARM)) slot = INVEN_RARM;
196 /* Both arms are already used by non-weapon */
197 else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
198 inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
200 /* Restrict the choices */
201 item_tester_hook = item_tester_hook_mochikae;
204 q = _("どちらの手に装備しますか?", "Equip which hand? ");
205 s = _("おっと。", "Oops.");
206 if (!get_item(&slot, q, s, (USE_EQUIP))) return;
215 /* Asking for dual wielding */
216 if (slot == INVEN_LARM)
218 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
221 else if (!inventory[INVEN_RARM].k_idx && buki_motteruka(INVEN_LARM))
223 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
226 /* Both arms are already used */
227 else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
229 /* Restrict the choices */
230 item_tester_hook = item_tester_hook_mochikae;
233 q = _("どちらの手に装備しますか?", "Equip which hand? ");
234 s = _("おっと。", "Oops.");
236 if (!get_item(&slot, q, s, (USE_EQUIP))) return;
237 if ((slot == INVEN_LARM) && !buki_motteruka(INVEN_RARM))
238 need_switch_wielding = INVEN_RARM;
244 /* Choose a ring slot */
245 if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
247 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
251 q = _("どちらの手に装備しますか?", "Equip which hand? ");
253 s = _("おっと。", "Oops.");
255 /* Restrict the choices */
256 select_ring_slot = TRUE;
258 if (!get_item(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
260 select_ring_slot = FALSE;
263 select_ring_slot = FALSE;
267 /* Prevent wielding into a cursed slot */
268 if (object_is_cursed(&inventory[slot]))
270 object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
273 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
275 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
278 /* Cancel the command */
283 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
284 ((o_ptr->ident & IDENT_SENSE) &&
285 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
287 char dummy[MAX_NLEN+80];
289 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
290 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
292 if (!get_check(dummy)) return;
295 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
297 char dummy[MAX_NLEN+80];
299 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
302 sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name);
304 msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
305 sprintf(dummy, "Do you become a vampire?");
308 if (!get_check(dummy)) return;
311 if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
313 object_type *slot_o_ptr = &inventory[slot];
314 object_type *switch_o_ptr = &inventory[need_switch_wielding];
315 object_type object_tmp;
316 object_type *otmp_ptr = &object_tmp;
317 GAME_TEXT switch_name[MAX_NLEN];
319 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
321 object_copy(otmp_ptr, switch_o_ptr);
322 object_copy(switch_o_ptr, slot_o_ptr);
323 object_copy(slot_o_ptr, otmp_ptr);
325 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
326 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
327 (left_hander ? _("右手", "right") : _("左手", "left")));
328 slot = need_switch_wielding;
331 check_find_art_quest_completion(o_ptr);
333 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
335 identify_item(o_ptr);
337 /* Auto-inscription */
338 autopick_alter_item(item, FALSE);
341 p_ptr->energy_use = 100;
344 /* Obtain local object */
345 object_copy(q_ptr, o_ptr);
347 /* Modify quantity */
350 /* Decrease the item (from the pack) */
353 inven_item_increase(item, -1);
354 inven_item_optimize(item);
357 /* Decrease the item (from the floor) */
360 floor_item_increase(0 - item, -1);
361 floor_item_optimize(0 - item);
364 /* Access the wield slot */
365 o_ptr = &inventory[slot];
367 /* Take off existing item */
370 /* Take off existing item */
371 (void)inven_takeoff(slot, 255);
374 /* Wear the new stuff */
375 object_copy(o_ptr, q_ptr);
377 /* Player touches it */
378 o_ptr->marked |= OM_TOUCHED;
380 /* Increase the weight */
381 p_ptr->total_weight += q_ptr->weight;
383 /* Increment the equip counter by hand */
387 #define STR_WIELD_RARM "%s(%c)を右手に装備した。"
388 #define STR_WIELD_LARM "%s(%c)を左手に装備した。"
389 #define STR_WIELD_ARMS "%s(%c)を両手で構えた。"
391 #define STR_WIELD_RARM "You are wielding %s (%c) in your right hand."
392 #define STR_WIELD_LARM "You are wielding %s (%c) in your left hand."
393 #define STR_WIELD_ARMS "You are wielding %s (%c) with both hands."
396 /* Where is the item now */
400 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
401 act = STR_WIELD_ARMS;
403 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
407 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
408 act = STR_WIELD_ARMS;
410 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
414 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
418 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
422 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
426 object_desc(o_name, o_ptr, 0);
427 msg_format(act, o_name, index_to_label(slot));
430 if (object_is_cursed(o_ptr))
432 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
433 chg_virtue(V_HARMONY, -1);
436 o_ptr->ident |= (IDENT_SENSE);
439 /* The Stone Mask make the player turn into a vampire! */
440 if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
442 /* Turn into a vampire */
443 change_race(RACE_VAMPIRE, "");
446 p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
447 p_ptr->redraw |= (PR_EQUIPPY);
448 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
455 * @param item 持ち替えを行いたい装備部位ID
458 void kamaenaoshi(INVENTORY_IDX item)
460 object_type *o_ptr, *new_o_ptr;
461 GAME_TEXT o_name[MAX_NLEN];
463 if (item == INVEN_RARM)
465 if (buki_motteruka(INVEN_LARM))
467 o_ptr = &inventory[INVEN_LARM];
468 object_desc(o_name, o_ptr, 0);
470 if (!object_is_cursed(o_ptr))
472 new_o_ptr = &inventory[INVEN_RARM];
473 object_copy(new_o_ptr, o_ptr);
474 p_ptr->total_weight += o_ptr->weight;
475 inven_item_increase(INVEN_LARM, -((int)o_ptr->number));
476 inven_item_optimize(INVEN_LARM);
477 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
478 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
480 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
481 (left_hander ? _("左手", "left") : _("右手", "right")));
485 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
486 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
490 else if (item == INVEN_LARM)
492 o_ptr = &inventory[INVEN_RARM];
493 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
495 if (buki_motteruka(INVEN_RARM))
497 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
498 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
500 else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr))
502 new_o_ptr = &inventory[INVEN_LARM];
503 object_copy(new_o_ptr, o_ptr);
504 p_ptr->total_weight += o_ptr->weight;
505 inven_item_increase(INVEN_RARM, -((int)o_ptr->number));
506 inven_item_optimize(INVEN_RARM);
507 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
514 * @brief 装備を外すコマンドのメインルーチン / Take off an item
517 void do_cmd_takeoff(void)
523 if (p_ptr->special_defense & KATA_MUSOU)
525 set_action(ACTION_NONE);
528 q = _("どれを装備からはずしますか? ", "Take off which item? ");
529 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
531 if (!get_item(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
533 /* Get the item (in the pack) */
536 o_ptr = &inventory[item];
539 /* Get the item (on the floor) */
542 o_ptr = &o_list[0 - item];
547 if (object_is_cursed(o_ptr))
549 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
551 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
556 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
558 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
560 o_ptr->ident |= (IDENT_SENSE);
561 o_ptr->curse_flags = 0L;
562 o_ptr->feeling = FEEL_NONE;
564 p_ptr->update |= (PU_BONUS);
565 p_ptr->window |= (PW_EQUIP);
567 msg_print(_("呪いを打ち破った。", "You break the curse."));
571 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
572 p_ptr->energy_use = 50;
577 /* Take a partial turn */
578 p_ptr->energy_use = 50;
580 /* Take off the item */
581 (void)inven_takeoff(item, 255);
584 p_ptr->redraw |= (PR_EQUIPPY);
589 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
592 void do_cmd_drop(void)
601 if (p_ptr->special_defense & KATA_MUSOU)
603 set_action(ACTION_NONE);
606 q = _("どのアイテムを落としますか? ", "Drop which item? ");
607 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
609 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT))) return;
611 /* Get the item (in the pack) */
614 o_ptr = &inventory[item];
617 /* Get the item (on the floor) */
620 o_ptr = &o_list[0 - item];
624 /* Hack -- Cannot remove cursed items */
625 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
627 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
632 /* See how many items */
633 if (o_ptr->number > 1)
636 amt = get_quantity(NULL, o_ptr->number);
638 /* Allow user abort */
639 if (amt <= 0) return;
643 /* Take a partial turn */
644 p_ptr->energy_use = 50;
646 /* Drop (some of) the item */
647 inven_drop(item, amt);
649 if (item >= INVEN_RARM)
655 p_ptr->redraw |= (PR_EQUIPPY);
659 * @brief オブジェクトが高位の魔法書かどうかを判定する
660 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
661 * @return オブジェクトが高位の魔法書ならばTRUEを返す
663 static bool high_level_book(object_type *o_ptr)
665 if ((o_ptr->tval == TV_LIFE_BOOK) ||
666 (o_ptr->tval == TV_SORCERY_BOOK) ||
667 (o_ptr->tval == TV_NATURE_BOOK) ||
668 (o_ptr->tval == TV_CHAOS_BOOK) ||
669 (o_ptr->tval == TV_DEATH_BOOK) ||
670 (o_ptr->tval == TV_TRUMP_BOOK) ||
671 (o_ptr->tval == TV_CRAFT_BOOK) ||
672 (o_ptr->tval == TV_DAEMON_BOOK) ||
673 (o_ptr->tval == TV_CRUSADE_BOOK) ||
674 (o_ptr->tval == TV_MUSIC_BOOK) ||
675 (o_ptr->tval == TV_HEX_BOOK))
688 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
691 void do_cmd_destroy(void)
701 object_type *q_ptr = &forge;
703 GAME_TEXT o_name[MAX_NLEN];
704 char out_val[MAX_NLEN+40];
708 if (p_ptr->special_defense & KATA_MUSOU)
710 set_action(ACTION_NONE);
713 /* Hack -- force destruction */
714 if (command_arg > 0) force = TRUE;
716 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
717 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
719 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
721 /* Get the item (in the pack) */
724 o_ptr = &inventory[item];
727 /* Get the item (on the floor) */
730 o_ptr = &o_list[0 - item];
733 /* Verify unless quantity given beforehand */
734 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
736 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
738 /* Make a verification */
739 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
742 /* HACK : Add the line to message buffer */
743 message_add(out_val);
744 p_ptr->window |= (PW_MESSAGE);
747 /* Get an acceptable answer */
757 /* Erase the prompt */
761 if (i == 'y' || i == 'Y')
765 if (i == ESCAPE || i == 'n' || i == 'N')
772 /* Add an auto-destroy preference line */
773 if (autopick_autoregister(o_ptr))
775 /* Auto-destroy it */
776 autopick_alter_item(item, TRUE);
779 /* The object is already destroyed. */
785 /* See how many items */
786 if (o_ptr->number > 1)
789 amt = get_quantity(NULL, o_ptr->number);
791 /* Allow user abort */
792 if (amt <= 0) return;
796 old_number = o_ptr->number;
798 object_desc(o_name, o_ptr, 0);
799 o_ptr->number = old_number;
801 p_ptr->energy_use = 100;
803 /* Artifacts cannot be destroyed */
804 if (!can_player_destroy_object(o_ptr))
806 p_ptr->energy_use = 0;
808 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
812 object_copy(q_ptr, o_ptr);
814 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
815 sound(SOUND_DESTITEM);
817 /* Reduce the charges of rods/wands */
818 reduce_charges(o_ptr, amt);
820 /* Eliminate the item (from the pack) */
823 inven_item_increase(item, -amt);
824 inven_item_describe(item);
825 inven_item_optimize(item);
828 /* Eliminate the item (from the floor) */
831 floor_item_increase(0 - item, -amt);
832 floor_item_describe(0 - item);
833 floor_item_optimize(0 - item);
836 if (high_level_book(q_ptr))
838 bool gain_expr = FALSE;
840 if (p_ptr->prace == RACE_ANDROID)
843 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
847 else if (p_ptr->pclass == CLASS_PALADIN)
849 if (is_good_realm(p_ptr->realm1))
851 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
855 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
859 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
861 s32b tester_exp = p_ptr->max_exp / 20;
862 if (tester_exp > 10000) tester_exp = 10000;
863 if (q_ptr->sval < 3) tester_exp /= 4;
864 if (tester_exp<1) tester_exp = 1;
866 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
867 gain_exp(tester_exp * amt);
869 if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
871 chg_virtue(V_UNLIFE, 1);
872 chg_virtue(V_VITALITY, -1);
874 else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
876 chg_virtue(V_UNLIFE, -1);
877 chg_virtue(V_VITALITY, 1);
880 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
881 chg_virtue(V_ENCHANT, -1);
883 if (object_value_real(q_ptr) > 30000)
884 chg_virtue(V_SACRIFICE, 2);
886 else if (object_value_real(q_ptr) > 10000)
887 chg_virtue(V_SACRIFICE, 1);
890 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
891 chg_virtue(V_HARMONY, 1);
893 if (item >= INVEN_RARM) calc_android_exp();
898 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
901 void do_cmd_observe(void)
905 GAME_TEXT o_name[MAX_NLEN];
909 q = _("どのアイテムを調べますか? ", "Examine which item? ");
910 s = _("調べられるアイテムがない。", "You have nothing to examine.");
912 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
914 /* Get the item (in the pack) */
917 o_ptr = &inventory[item];
920 /* Get the item (on the floor) */
923 o_ptr = &o_list[0 - item];
927 /* Require full knowledge */
928 if (!(o_ptr->ident & IDENT_MENTAL))
930 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
936 object_desc(o_name, o_ptr, 0);
937 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
938 /* Describe it fully */
939 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
945 * @brief アイテムの銘を消すコマンドのメインルーチン
946 * Remove the inscription from an object XXX Mention item (when done)?
949 void do_cmd_uninscribe(void)
955 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
956 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
958 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
960 /* Get the item (in the pack) */
963 o_ptr = &inventory[item];
966 /* Get the item (on the floor) */
969 o_ptr = &o_list[0 - item];
972 /* Nothing to remove */
973 if (!o_ptr->inscription)
975 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
979 msg_print(_("銘を消した。", "Inscription removed."));
981 /* Remove the incription */
982 o_ptr->inscription = 0;
984 /* Combine the pack */
985 p_ptr->notice |= (PN_COMBINE);
987 p_ptr->window |= (PW_INVEN | PW_EQUIP);
989 /* .や$の関係で, 再計算が必要なはず -- henkma */
990 p_ptr->update |= (PU_BONUS);
996 * @brief アイテムの銘を刻むコマンドのメインルーチン
997 * Inscribe an object with a comment
1000 void do_cmd_inscribe(void)
1004 GAME_TEXT o_name[MAX_NLEN];
1008 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
1009 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
1011 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
1013 /* Get the item (in the pack) */
1016 o_ptr = &inventory[item];
1019 /* Get the item (on the floor) */
1022 o_ptr = &o_list[0 - item];
1025 /* Describe the activity */
1026 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
1028 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
1031 /* Start with nothing */
1032 strcpy(out_val, "");
1034 /* Use old inscription */
1035 if (o_ptr->inscription)
1037 /* Start with the old inscription */
1038 strcpy(out_val, quark_str(o_ptr->inscription));
1041 /* Get a new inscription (possibly empty) */
1042 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
1044 /* Save the inscription */
1045 o_ptr->inscription = quark_add(out_val);
1047 /* Combine the pack */
1048 p_ptr->notice |= (PN_COMBINE);
1050 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1052 /* .や$の関係で, 再計算が必要なはず -- henkma */
1053 p_ptr->update |= (PU_BONUS);
1060 * @brief オブジェクトがランタンの燃料になるかどうかを判定する
1061 * An "item_tester_hook" for refilling lanterns
1062 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1063 * @return オブジェクトがランタンの燃料になるならばTRUEを返す
1065 static bool item_tester_refill_lantern(object_type *o_ptr)
1067 /* Flasks of oil are okay */
1068 if (o_ptr->tval == TV_FLASK) return (TRUE);
1070 /* Laterns are okay */
1071 if ((o_ptr->tval == TV_LITE) &&
1072 (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE);
1074 /* Assume not okay */
1080 * @brief ランタンに燃料を加えるコマンドのメインルーチン
1081 * Refill the players lamp (from the pack or floor)
1084 static void do_cmd_refill_lamp(void)
1094 /* Restrict the choices */
1095 item_tester_hook = item_tester_refill_lantern;
1098 q = "どの油つぼから注ぎますか? ";
1101 q = "Refill with which flask? ";
1102 s = "You have no flasks of oil.";
1105 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1107 /* Get the item (in the pack) */
1110 o_ptr = &inventory[item];
1113 /* Get the item (on the floor) */
1116 o_ptr = &o_list[0 - item];
1119 /* Take a partial turn */
1120 p_ptr->energy_use = 50;
1122 /* Access the lantern */
1123 j_ptr = &inventory[INVEN_LITE];
1126 j_ptr->xtra4 += o_ptr->xtra4;
1127 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
1129 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1132 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
1134 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1137 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
1139 else if (j_ptr->xtra4 >= FUEL_LAMP)
1141 j_ptr->xtra4 = FUEL_LAMP;
1142 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
1145 /* Decrease the item (from the pack) */
1148 inven_item_increase(item, -1);
1149 inven_item_describe(item);
1150 inven_item_optimize(item);
1153 /* Decrease the item (from the floor) */
1156 floor_item_increase(0 - item, -1);
1157 floor_item_describe(0 - item);
1158 floor_item_optimize(0 - item);
1161 /* Recalculate torch */
1162 p_ptr->update |= (PU_TORCH);
1167 * @brief オブジェクトが松明に束ねられるかどうかを判定する
1168 * An "item_tester_hook" for refilling torches
1169 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1170 * @return オブジェクトが松明に束ねられるならばTRUEを返す
1172 static bool item_tester_refill_torch(object_type *o_ptr)
1174 /* Torches are okay */
1175 if ((o_ptr->tval == TV_LITE) &&
1176 (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
1178 /* Assume not okay */
1184 * @brief 松明を束ねるコマンドのメインルーチン
1185 * Refuel the players torch (from the pack or floor)
1188 static void do_cmd_refill_torch(void)
1197 /* Restrict the choices */
1198 item_tester_hook = item_tester_refill_torch;
1200 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1201 s = _("他に松明がない。", "You have no extra torches.");
1203 if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
1205 /* Get the item (in the pack) */
1208 o_ptr = &inventory[item];
1211 /* Get the item (on the floor) */
1214 o_ptr = &o_list[0 - item];
1218 /* Take a partial turn */
1219 p_ptr->energy_use = 50;
1221 /* Access the primary torch */
1222 j_ptr = &inventory[INVEN_LITE];
1225 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1227 msg_print(_("松明を結合した。", "You combine the torches."));
1229 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1232 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1234 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1237 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1239 /* Over-fuel message */
1240 else if (j_ptr->xtra4 >= FUEL_TORCH)
1242 j_ptr->xtra4 = FUEL_TORCH;
1243 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1246 /* Refuel message */
1249 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1252 /* Decrease the item (from the pack) */
1255 inven_item_increase(item, -1);
1256 inven_item_describe(item);
1257 inven_item_optimize(item);
1260 /* Decrease the item (from the floor) */
1263 floor_item_increase(0 - item, -1);
1264 floor_item_describe(0 - item);
1265 floor_item_optimize(0 - item);
1268 /* Recalculate torch */
1269 p_ptr->update |= (PU_TORCH);
1274 * @brief 燃料を補充するコマンドのメインルーチン
1275 * Refill the players lamp, or restock his torches
1278 void do_cmd_refill(void)
1283 o_ptr = &inventory[INVEN_LITE];
1285 if (p_ptr->special_defense & KATA_MUSOU)
1287 set_action(ACTION_NONE);
1291 if (o_ptr->tval != TV_LITE)
1293 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1297 else if (o_ptr->sval == SV_LITE_LANTERN)
1299 do_cmd_refill_lamp();
1303 else if (o_ptr->sval == SV_LITE_TORCH)
1305 do_cmd_refill_torch();
1308 /* No torch to refill */
1311 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1317 * @brief ターゲットを設定するコマンドのメインルーチン
1321 void do_cmd_target(void)
1324 if (target_set(TARGET_KILL))
1326 msg_print(_("ターゲット決定。", "Target Selected."));
1329 /* Target aborted */
1332 msg_print(_("ターゲット解除。", "Target Aborted."));
1339 * @brief 周囲を見渡すコマンドのメインルーチン
1343 void do_cmd_look(void)
1345 p_ptr->window |= PW_MONSTER_LIST;
1349 if (target_set(TARGET_LOOK))
1351 msg_print(_("ターゲット決定。", "Target Selected."));
1357 * @brief 位置を確認するコマンドのメインルーチン
1358 * Allow the player to examine other sectors on the map
1361 void do_cmd_locate(void)
1363 int dir, y1, x1, y2, x2;
1371 get_screen_size(&wid, &hgt);
1374 /* Start at current panel */
1375 y2 = y1 = panel_row_min;
1376 x2 = x1 = panel_col_min;
1378 /* Show panels until done */
1381 /* Describe the location */
1382 if ((y2 == y1) && (x2 == x1))
1385 strcpy(tmp_val, "真上");
1394 sprintf(tmp_val, "%s%s",
1395 ((y2 < y1) ? "北" : (y2 > y1) ? "南" : ""),
1396 ((x2 < x1) ? "西" : (x2 > x1) ? "東" : ""));
1398 sprintf(tmp_val, "%s%s of",
1399 ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
1400 ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
1405 /* Prepare to ask which way to look */
1406 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1407 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1408 y2 / (hgt / 2), y2 % (hgt / 2),
1409 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1411 /* Assume no direction */
1414 /* Get a direction */
1419 /* Get a command (or Cancel) */
1420 if (!get_com(out_val, &command, TRUE)) break;
1422 /* Extract the action (if any) */
1423 dir = get_keymap_dir(command);
1432 /* Apply the motion */
1433 if (change_panel(ddy[dir], ddx[dir]))
1441 /* Recenter the map around the player */
1444 p_ptr->update |= (PU_MONSTERS);
1446 p_ptr->redraw |= (PR_MAP);
1448 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1455 * @brief モンスター種族情報を特定の基準によりソートするための比較処理
1456 * Sorting hook -- Comp function -- see below
1457 * @param u モンスター種族情報の入れるポインタ
1459 * @param a 比較するモンスター種族のID1
1460 * @param b 比較するモンスター種族のID2
1461 * @return 2の方が大きければTRUEを返す
1462 * We use "u" to point to array of monster indexes,
1463 * and "v" to select the type of sorting to perform on "u".
1465 bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
1467 u16b *who = (u16b*)(u);
1469 u16b *why = (u16b*)(v);
1476 /* Sort by player kills */
1479 /* Extract player kills */
1480 z1 = r_info[w1].r_pkills;
1481 z2 = r_info[w2].r_pkills;
1483 /* Compare player kills */
1484 if (z1 < z2) return (TRUE);
1485 if (z1 > z2) return (FALSE);
1489 /* Sort by total kills */
1492 /* Extract total kills */
1493 z1 = r_info[w1].r_tkills;
1494 z2 = r_info[w2].r_tkills;
1496 /* Compare total kills */
1497 if (z1 < z2) return (TRUE);
1498 if (z1 > z2) return (FALSE);
1502 /* Sort by monster level */
1505 /* Extract levels */
1506 z1 = r_info[w1].level;
1507 z2 = r_info[w2].level;
1509 /* Compare levels */
1510 if (z1 < z2) return (TRUE);
1511 if (z1 > z2) return (FALSE);
1515 /* Sort by monster experience */
1518 /* Extract experience */
1519 z1 = r_info[w1].mexp;
1520 z2 = r_info[w2].mexp;
1522 /* Compare experience */
1523 if (z1 < z2) return (TRUE);
1524 if (z1 > z2) return (FALSE);
1528 /* Compare indexes */
1534 * @brief モンスター種族情報を特定の基準によりソートするためのスワップ処理
1535 * Sorting hook -- Swap function -- see below
1536 * @param u モンスター種族情報の入れるポインタ
1538 * @param a スワップするモンスター種族のID1
1539 * @param b スワップするモンスター種族のID2
1542 * We use "u" to point to array of monster indexes,
1543 * and "v" to select the type of sorting to perform.
1545 void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
1547 u16b *who = (u16b*)(u);
1563 * @brief モンスターの思い出を見るコマンドのメインルーチン
1564 * Identify a character, allow recall of monsters
1568 * Several "special" responses recall "multiple" monsters:
1570 * ^U (all unique monsters)
1571 * ^N (all non-unique monsters)
1573 * The responses may be sorted in several ways, see below.
1575 * Note that the player ghosts are ignored.
1578 void do_cmd_query_symbol(void)
1592 bool recall = FALSE;
1597 /* Get a character, or abort */
1598 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1599 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1601 /* Find that character info, and describe it */
1602 for (i = 0; ident_info[i]; ++i)
1604 if (sym == ident_info[i][0]) break;
1606 if (sym == KTRL('A'))
1609 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1611 else if (sym == KTRL('U'))
1614 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1616 else if (sym == KTRL('N'))
1619 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1621 else if (sym == KTRL('R'))
1624 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1626 /* XTRA HACK WHATSEARCH */
1627 else if (sym == KTRL('M'))
1630 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1635 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1637 else if (ident_info[i])
1639 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1643 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1646 /* Display the result */
1649 /* Allocate the "who" array */
1650 C_MAKE(who, max_r_idx, IDX);
1652 /* Collect matching monsters */
1653 for (n = 0, i = 1; i < max_r_idx; i++)
1655 monster_race *r_ptr = &r_info[i];
1657 /* Nothing to recall */
1658 if (!cheat_know && !r_ptr->r_sights) continue;
1660 /* Require non-unique monsters if needed */
1661 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1663 /* Require unique monsters if needed */
1664 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1666 /* Require ridable monsters if needed */
1667 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1669 /* XTRA HACK WHATSEARCH */
1675 for (xx = 0; temp[xx] && xx < 80; xx++)
1678 if (iskanji(temp[xx])) { xx++; continue; }
1680 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1684 strcpy(temp2, r_name + r_ptr->E_name);
1686 strcpy(temp2, r_name + r_ptr->name);
1688 for (xx = 0; temp2[xx] && xx < 80; xx++)
1689 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1692 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1694 if (my_strstr(temp2, temp))
1699 /* Collect "appropriate" monsters */
1700 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1703 /* Nothing to recall */
1706 /* Free the "who" array */
1707 C_KILL(who, max_r_idx, IDX);
1713 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1723 /* Select the sort method */
1724 ang_sort_comp = ang_sort_comp_hook;
1725 ang_sort_swap = ang_sort_swap_hook;
1727 /* Sort the array */
1728 ang_sort(who, &why, n);
1730 /* Sort by kills (and level) */
1737 /* Catch "escape" */
1740 /* Free the "who" array */
1741 C_KILL(who, max_r_idx, IDX);
1746 /* Sort if needed */
1749 /* Select the sort method */
1750 ang_sort_comp = ang_sort_comp_hook;
1751 ang_sort_swap = ang_sort_swap_hook;
1753 /* Sort the array */
1754 ang_sort(who, &why, n);
1758 /* Start at the end */
1761 /* Scan the monster memory */
1764 /* Extract a race */
1767 /* Hack -- Auto-recall */
1768 monster_race_track(r_idx);
1779 /* Recall on screen */
1780 screen_roff(who[i], 0);
1783 /* Hack -- Begin the prompt */
1786 /* Hack -- Complete the prompt */
1787 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1799 /* Normal commands */
1800 if (query != 'r') break;
1807 if (query == ESCAPE) break;
1809 /* Move to "prev" monster */
1815 if (!expand_list) break;
1819 /* Move to "next" monster */
1825 if (!expand_list) break;
1830 /* Free the "who" array */
1831 C_KILL(who, max_r_idx, IDX);
1833 /* Re-display the identity */
1838 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1842 * XXX - Add actions for other item types
1844 void do_cmd_use(void)
1850 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1852 set_action(ACTION_NONE);
1855 item_tester_hook = item_tester_hook_use;
1857 q = _("どれを使いますか?", "Use which item? ");
1858 s = _("使えるものがありません。", "You have nothing to use.");
1860 if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return;
1862 /* Get the item (in the pack) */
1865 o_ptr = &inventory[item];
1867 /* Get the item (on the floor) */
1870 o_ptr = &o_list[0 - item];
1873 switch (o_ptr->tval)
1885 do_cmd_eat_food_aux(item);
1892 do_cmd_aim_wand_aux(item);
1899 do_cmd_use_staff_aux(item);
1906 do_cmd_zap_rod_aux(item);
1910 /* Quaff a potion */
1913 do_cmd_quaff_potion_aux(item);
1920 /* Check some conditions */
1923 msg_print(_("目が見えない。", "You can't see anything."));
1928 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
1931 if (p_ptr->confused)
1933 msg_print(_("混乱していて読めない!", "You are too confused!"));
1937 do_cmd_read_scroll_aux(item, TRUE);
1946 do_cmd_fire_aux(item, &inventory[INVEN_BOW]);
1950 /* Activate an artifact */
1953 do_cmd_activate_aux(item);