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 "object-hook.h"
29 #include "player-status.h"
33 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory
36 void do_cmd_inven(void)
40 /* Note that we are in "inventory" mode */
43 /* Note that we are in "inventory" mode */
44 if (easy_floor) command_wrk = (USE_INVEN);
47 /* Display the inventory */
48 (void)show_inven(0, USE_FULL);
51 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
52 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
53 (long int)((p_ptr->total_weight * 100) / weight_limit()));
55 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
56 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
57 (p_ptr->total_weight * 100) / weight_limit());
61 command_new = inkey();
64 /* Process "Escape" */
65 if (command_new == ESCAPE)
69 Term_get_size(&wid, &hgt);
73 command_gap = wid - 30;
76 /* Process normal keys */
79 /* Hack -- Use "display" mode */
86 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
89 void do_cmd_equip(void)
94 /* Note that we are in "equipment" mode */
97 /* Note that we are in "equipment" mode */
98 if (easy_floor) command_wrk = (USE_EQUIP);
101 (void)show_equip(0, USE_FULL);
105 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
106 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
107 (long int)((p_ptr->total_weight * 100) / weight_limit()));
109 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
110 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
111 (long int)((p_ptr->total_weight * 100) / weight_limit()));
115 command_new = inkey();
118 /* Process "Escape" */
119 if (command_new == ESCAPE)
123 Term_get_size(&wid, &hgt);
127 command_gap = wid - 30;
130 /* Process normal keys */
133 /* Enter "display" mode */
141 bool select_ring_slot = FALSE;
144 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
147 void do_cmd_wield(void)
149 OBJECT_IDX item, slot;
157 GAME_TEXT o_name[MAX_NLEN];
160 OBJECT_IDX need_switch_wielding = 0;
162 if (p_ptr->special_defense & KATA_MUSOU)
164 set_action(ACTION_NONE);
167 /* Restrict the choices */
168 item_tester_hook = item_tester_hook_wear;
170 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
171 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
173 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
177 slot = wield_slot(o_ptr);
181 /* Shields and some misc. items */
186 if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
188 /* Restrict the choices */
189 item_tester_hook = item_tester_hook_melee_weapon;
191 /* Choose a weapon from the equipment only */
192 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
193 s = _("おっと。", "Oops.");
194 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
195 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
198 else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM;
200 /* Both arms are already used by non-weapon */
201 else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
202 inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
204 /* Restrict the choices */
205 item_tester_hook = item_tester_hook_mochikae;
208 q = _("どちらの手に装備しますか?", "Equip which hand? ");
209 s = _("おっと。", "Oops.");
210 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
219 /* Asking for dual wielding */
220 if (slot == INVEN_LARM)
222 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
225 else if (!inventory[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM))
227 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
230 /* Both arms are already used */
231 else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
233 /* Restrict the choices */
234 item_tester_hook = item_tester_hook_mochikae;
237 q = _("どちらの手に装備しますか?", "Equip which hand? ");
238 s = _("おっと。", "Oops.");
240 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
241 if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM))
242 need_switch_wielding = INVEN_RARM;
248 /* Choose a ring slot */
249 if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
251 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
255 q = _("どちらの手に装備しますか?", "Equip which hand? ");
257 s = _("おっと。", "Oops.");
259 /* Restrict the choices */
260 select_ring_slot = TRUE;
262 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
264 select_ring_slot = FALSE;
267 select_ring_slot = FALSE;
271 /* Prevent wielding into a cursed slot */
272 if (object_is_cursed(&inventory[slot]))
274 object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
277 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
279 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
282 /* Cancel the command */
287 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
288 ((o_ptr->ident & IDENT_SENSE) &&
289 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
291 char dummy[MAX_NLEN+80];
293 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
294 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
296 if (!get_check(dummy)) return;
299 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
301 char dummy[MAX_NLEN+80];
303 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
306 sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name);
308 msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
309 sprintf(dummy, "Do you become a vampire?");
312 if (!get_check(dummy)) return;
315 if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
317 object_type *slot_o_ptr = &inventory[slot];
318 object_type *switch_o_ptr = &inventory[need_switch_wielding];
319 object_type object_tmp;
320 object_type *otmp_ptr = &object_tmp;
321 GAME_TEXT switch_name[MAX_NLEN];
323 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
325 object_copy(otmp_ptr, switch_o_ptr);
326 object_copy(switch_o_ptr, slot_o_ptr);
327 object_copy(slot_o_ptr, otmp_ptr);
329 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
330 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
331 (left_hander ? _("右手", "right") : _("左手", "left")));
332 slot = need_switch_wielding;
335 check_find_art_quest_completion(o_ptr);
337 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
339 identify_item(o_ptr);
341 /* Auto-inscription */
342 autopick_alter_item(item, FALSE);
345 p_ptr->energy_use = 100;
348 /* Obtain local object */
349 object_copy(q_ptr, o_ptr);
351 /* Modify quantity */
354 /* Decrease the item (from the pack) */
357 inven_item_increase(item, -1);
358 inven_item_optimize(item);
361 /* Decrease the item (from the floor) */
364 floor_item_increase(0 - item, -1);
365 floor_item_optimize(0 - item);
368 /* Access the wield slot */
369 o_ptr = &inventory[slot];
371 /* Take off existing item */
374 /* Take off existing item */
375 (void)inven_takeoff(slot, 255);
378 /* Wear the new stuff */
379 object_copy(o_ptr, q_ptr);
381 /* Player touches it */
382 o_ptr->marked |= OM_TOUCHED;
384 p_ptr->total_weight += q_ptr->weight;
386 /* Increment the equip counter by hand */
390 #define STR_WIELD_RARM "%s(%c)を右手に装備した。"
391 #define STR_WIELD_LARM "%s(%c)を左手に装備した。"
392 #define STR_WIELD_ARMS "%s(%c)を両手で構えた。"
394 #define STR_WIELD_RARM "You are wielding %s (%c) in your right hand."
395 #define STR_WIELD_LARM "You are wielding %s (%c) in your left hand."
396 #define STR_WIELD_ARMS "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 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 = &inventory[INVEN_LARM];
471 object_desc(o_name, o_ptr, 0);
473 if (!object_is_cursed(o_ptr))
475 new_o_ptr = &inventory[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 = &inventory[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 = &inventory[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 p_ptr->energy_use = 50;
568 /* Take a partial turn */
569 p_ptr->energy_use = 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."));
611 /* See how many items */
612 if (o_ptr->number > 1)
615 amt = get_quantity(NULL, o_ptr->number);
617 /* Allow user abort */
618 if (amt <= 0) return;
622 /* Take a partial turn */
623 p_ptr->energy_use = 50;
625 /* Drop (some of) the item */
626 inven_drop(item, amt);
628 if (item >= INVEN_RARM)
634 p_ptr->redraw |= (PR_EQUIPPY);
638 * @brief オブジェクトが高位の魔法書かどうかを判定する
639 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
640 * @return オブジェクトが高位の魔法書ならばTRUEを返す
642 static bool high_level_book(object_type *o_ptr)
644 if ((o_ptr->tval == TV_LIFE_BOOK) ||
645 (o_ptr->tval == TV_SORCERY_BOOK) ||
646 (o_ptr->tval == TV_NATURE_BOOK) ||
647 (o_ptr->tval == TV_CHAOS_BOOK) ||
648 (o_ptr->tval == TV_DEATH_BOOK) ||
649 (o_ptr->tval == TV_TRUMP_BOOK) ||
650 (o_ptr->tval == TV_CRAFT_BOOK) ||
651 (o_ptr->tval == TV_DAEMON_BOOK) ||
652 (o_ptr->tval == TV_CRUSADE_BOOK) ||
653 (o_ptr->tval == TV_MUSIC_BOOK) ||
654 (o_ptr->tval == TV_HEX_BOOK))
667 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
670 void do_cmd_destroy(void)
680 object_type *q_ptr = &forge;
682 GAME_TEXT o_name[MAX_NLEN];
683 char out_val[MAX_NLEN+40];
687 if (p_ptr->special_defense & KATA_MUSOU)
689 set_action(ACTION_NONE);
692 /* Hack -- force destruction */
693 if (command_arg > 0) force = TRUE;
695 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
696 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
698 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
701 /* Verify unless quantity given beforehand */
702 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
704 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
706 /* Make a verification */
707 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
710 /* HACK : Add the line to message buffer */
711 message_add(out_val);
712 p_ptr->window |= (PW_MESSAGE);
715 /* Get an acceptable answer */
725 /* Erase the prompt */
729 if (i == 'y' || i == 'Y')
733 if (i == ESCAPE || i == 'n' || i == 'N')
740 /* Add an auto-destroy preference line */
741 if (autopick_autoregister(o_ptr))
743 /* Auto-destroy it */
744 autopick_alter_item(item, TRUE);
747 /* The object is already destroyed. */
753 /* See how many items */
754 if (o_ptr->number > 1)
757 amt = get_quantity(NULL, o_ptr->number);
759 /* Allow user abort */
760 if (amt <= 0) return;
764 old_number = o_ptr->number;
766 object_desc(o_name, o_ptr, 0);
767 o_ptr->number = old_number;
769 p_ptr->energy_use = 100;
771 /* Artifacts cannot be destroyed */
772 if (!can_player_destroy_object(o_ptr))
774 p_ptr->energy_use = 0;
776 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
780 object_copy(q_ptr, o_ptr);
782 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
783 sound(SOUND_DESTITEM);
785 /* Reduce the charges of rods/wands */
786 reduce_charges(o_ptr, amt);
788 /* Eliminate the item (from the pack) */
791 inven_item_increase(item, -amt);
792 inven_item_describe(item);
793 inven_item_optimize(item);
796 /* Eliminate the item (from the floor) */
799 floor_item_increase(0 - item, -amt);
800 floor_item_describe(0 - item);
801 floor_item_optimize(0 - item);
804 if (high_level_book(q_ptr))
806 bool gain_expr = FALSE;
808 if (p_ptr->prace == RACE_ANDROID)
811 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
815 else if (p_ptr->pclass == CLASS_PALADIN)
817 if (is_good_realm(p_ptr->realm1))
819 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
823 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
827 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
829 s32b tester_exp = p_ptr->max_exp / 20;
830 if (tester_exp > 10000) tester_exp = 10000;
831 if (q_ptr->sval < 3) tester_exp /= 4;
832 if (tester_exp<1) tester_exp = 1;
834 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
835 gain_exp(tester_exp * amt);
837 if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
839 chg_virtue(V_UNLIFE, 1);
840 chg_virtue(V_VITALITY, -1);
842 else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
844 chg_virtue(V_UNLIFE, -1);
845 chg_virtue(V_VITALITY, 1);
848 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
849 chg_virtue(V_ENCHANT, -1);
851 if (object_value_real(q_ptr) > 30000)
852 chg_virtue(V_SACRIFICE, 2);
854 else if (object_value_real(q_ptr) > 10000)
855 chg_virtue(V_SACRIFICE, 1);
858 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
859 chg_virtue(V_HARMONY, 1);
861 if (item >= INVEN_RARM) calc_android_exp();
866 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
869 void do_cmd_observe(void)
873 GAME_TEXT o_name[MAX_NLEN];
876 q = _("どのアイテムを調べますか? ", "Examine which item? ");
877 s = _("調べられるアイテムがない。", "You have nothing to examine.");
879 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
882 /* Require full knowledge */
883 if (!(o_ptr->ident & IDENT_MENTAL))
885 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
889 object_desc(o_name, o_ptr, 0);
890 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
891 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
897 * @brief アイテムの銘を消すコマンドのメインルーチン
898 * Remove the inscription from an object XXX Mention item (when done)?
901 void do_cmd_uninscribe(void)
907 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
908 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
910 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
913 /* Nothing to remove */
914 if (!o_ptr->inscription)
916 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
920 msg_print(_("銘を消した。", "Inscription removed."));
922 /* Remove the incription */
923 o_ptr->inscription = 0;
925 /* Combine the pack */
926 p_ptr->update |= (PU_COMBINE);
928 p_ptr->window |= (PW_INVEN | PW_EQUIP);
930 /* .や$の関係で, 再計算が必要なはず -- henkma */
931 p_ptr->update |= (PU_BONUS);
937 * @brief アイテムの銘を刻むコマンドのメインルーチン
938 * Inscribe an object with a comment
941 void do_cmd_inscribe(void)
945 GAME_TEXT o_name[MAX_NLEN];
949 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
950 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
952 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
955 /* Describe the activity */
956 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
958 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
961 /* Start with nothing */
964 /* Use old inscription */
965 if (o_ptr->inscription)
967 /* Start with the old inscription */
968 strcpy(out_val, quark_str(o_ptr->inscription));
971 /* Get a new inscription (possibly empty) */
972 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
974 /* Save the inscription */
975 o_ptr->inscription = quark_add(out_val);
977 /* Combine the pack */
978 p_ptr->update |= (PU_COMBINE);
980 p_ptr->window |= (PW_INVEN | PW_EQUIP);
982 /* .や$の関係で, 再計算が必要なはず -- henkma */
983 p_ptr->update |= (PU_BONUS);
990 * @brief オブジェクトがランタンの燃料になるかどうかを判定する
991 * An "item_tester_hook" for refilling lanterns
992 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
993 * @return オブジェクトがランタンの燃料になるならばTRUEを返す
995 static bool item_tester_refill_lantern(object_type *o_ptr)
997 /* Flasks of oil are okay */
998 if (o_ptr->tval == TV_FLASK) return (TRUE);
1000 /* Laterns are okay */
1001 if ((o_ptr->tval == TV_LITE) &&
1002 (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE);
1004 /* Assume not okay */
1010 * @brief ランタンに燃料を加えるコマンドのメインルーチン
1011 * Refill the players lamp (from the pack or floor)
1014 static void do_cmd_refill_lamp(void)
1023 /* Restrict the choices */
1024 item_tester_hook = item_tester_refill_lantern;
1026 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
1027 s = _("油つぼがない。", "You have no flasks of oil.");
1029 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1032 /* Take a partial turn */
1033 p_ptr->energy_use = 50;
1035 /* Access the lantern */
1036 j_ptr = &inventory[INVEN_LITE];
1039 j_ptr->xtra4 += o_ptr->xtra4;
1040 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
1042 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1045 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
1047 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1050 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
1052 else if (j_ptr->xtra4 >= FUEL_LAMP)
1054 j_ptr->xtra4 = FUEL_LAMP;
1055 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
1058 /* Decrease the item (from the pack) */
1061 inven_item_increase(item, -1);
1062 inven_item_describe(item);
1063 inven_item_optimize(item);
1066 /* Decrease the item (from the floor) */
1069 floor_item_increase(0 - item, -1);
1070 floor_item_describe(0 - item);
1071 floor_item_optimize(0 - item);
1074 /* Recalculate torch */
1075 p_ptr->update |= (PU_TORCH);
1080 * @brief オブジェクトが松明に束ねられるかどうかを判定する
1081 * An "item_tester_hook" for refilling torches
1082 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1083 * @return オブジェクトが松明に束ねられるならばTRUEを返す
1085 static bool item_tester_refill_torch(object_type *o_ptr)
1087 /* Torches are okay */
1088 if ((o_ptr->tval == TV_LITE) &&
1089 (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
1091 /* Assume not okay */
1097 * @brief 松明を束ねるコマンドのメインルーチン
1098 * Refuel the players torch (from the pack or floor)
1101 static void do_cmd_refill_torch(void)
1110 /* Restrict the choices */
1111 item_tester_hook = item_tester_refill_torch;
1113 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1114 s = _("他に松明がない。", "You have no extra torches.");
1116 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1119 /* Take a partial turn */
1120 p_ptr->energy_use = 50;
1122 /* Access the primary torch */
1123 j_ptr = &inventory[INVEN_LITE];
1126 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1128 msg_print(_("松明を結合した。", "You combine the torches."));
1130 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1133 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1135 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1138 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1140 /* Over-fuel message */
1141 else if (j_ptr->xtra4 >= FUEL_TORCH)
1143 j_ptr->xtra4 = FUEL_TORCH;
1144 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1147 /* Refuel message */
1150 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1153 /* Decrease the item (from the pack) */
1156 inven_item_increase(item, -1);
1157 inven_item_describe(item);
1158 inven_item_optimize(item);
1161 /* Decrease the item (from the floor) */
1164 floor_item_increase(0 - item, -1);
1165 floor_item_describe(0 - item);
1166 floor_item_optimize(0 - item);
1169 /* Recalculate torch */
1170 p_ptr->update |= (PU_TORCH);
1175 * @brief 燃料を補充するコマンドのメインルーチン
1176 * Refill the players lamp, or restock his torches
1179 void do_cmd_refill(void)
1184 o_ptr = &inventory[INVEN_LITE];
1186 if (p_ptr->special_defense & KATA_MUSOU)
1188 set_action(ACTION_NONE);
1192 if (o_ptr->tval != TV_LITE)
1194 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1198 else if (o_ptr->sval == SV_LITE_LANTERN)
1200 do_cmd_refill_lamp();
1204 else if (o_ptr->sval == SV_LITE_TORCH)
1206 do_cmd_refill_torch();
1209 /* No torch to refill */
1212 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1218 * @brief ターゲットを設定するコマンドのメインルーチン
1222 void do_cmd_target(void)
1224 if (p_ptr->wild_mode) return;
1227 if (target_set(TARGET_KILL))
1229 msg_print(_("ターゲット決定。", "Target Selected."));
1232 /* Target aborted */
1235 msg_print(_("ターゲット解除。", "Target Aborted."));
1242 * @brief 周囲を見渡すコマンドのメインルーチン
1246 void do_cmd_look(void)
1248 p_ptr->window |= PW_MONSTER_LIST;
1252 if (target_set(TARGET_LOOK))
1254 msg_print(_("ターゲット決定。", "Target Selected."));
1260 * @brief 位置を確認するコマンドのメインルーチン
1261 * Allow the player to examine other sectors on the map
1264 void do_cmd_locate(void)
1267 POSITION y1, x1, y2, x2;
1268 GAME_TEXT tmp_val[80];
1269 GAME_TEXT out_val[160];
1272 get_screen_size(&wid, &hgt);
1274 /* Start at current panel */
1275 y2 = y1 = panel_row_min;
1276 x2 = x1 = panel_col_min;
1278 /* Show panels until done */
1281 /* Describe the location */
1282 if ((y2 == y1) && (x2 == x1))
1285 strcpy(tmp_val, "真上");
1294 sprintf(tmp_val, "%s%s",
1295 ((y2 < y1) ? "北" : (y2 > y1) ? "南" : ""),
1296 ((x2 < x1) ? "西" : (x2 > x1) ? "東" : ""));
1298 sprintf(tmp_val, "%s%s of",
1299 ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
1300 ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
1305 /* Prepare to ask which way to look */
1306 sprintf(out_val, _("マップ位置 [%ld(%02ld),%ld(%02ld)] (プレイヤーの%s) 方向?",
1307 "Map sector [%ld(%02ld),%ld(%02ld)], which is%s your sector. Direction?"),
1308 y2 / (hgt / 2), y2 % (hgt / 2),
1309 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1311 /* Assume no direction */
1314 /* Get a direction */
1319 /* Get a command (or Cancel) */
1320 if (!get_com(out_val, &command, TRUE)) break;
1322 /* Extract the action (if any) */
1323 dir = get_keymap_dir(command);
1332 /* Apply the motion */
1333 if (change_panel(ddy[dir], ddx[dir]))
1341 /* Recenter the map around the player */
1344 p_ptr->update |= (PU_MONSTERS);
1345 p_ptr->redraw |= (PR_MAP);
1346 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1353 * @brief モンスター種族情報を特定の基準によりソートするための比較処理
1354 * Sorting hook -- Comp function -- see below
1355 * @param u モンスター種族情報の入れるポインタ
1357 * @param a 比較するモンスター種族のID1
1358 * @param b 比較するモンスター種族のID2
1359 * @return 2の方が大きければTRUEを返す
1360 * We use "u" to point to array of monster indexes,
1361 * and "v" to select the type of sorting to perform on "u".
1363 bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
1365 u16b *who = (u16b*)(u);
1366 u16b *why = (u16b*)(v);
1373 /* Sort by player kills */
1376 /* Extract player kills */
1377 z1 = r_info[w1].r_pkills;
1378 z2 = r_info[w2].r_pkills;
1380 /* Compare player kills */
1381 if (z1 < z2) return (TRUE);
1382 if (z1 > z2) return (FALSE);
1386 /* Sort by total kills */
1389 /* Extract total kills */
1390 z1 = r_info[w1].r_tkills;
1391 z2 = r_info[w2].r_tkills;
1393 /* Compare total kills */
1394 if (z1 < z2) return (TRUE);
1395 if (z1 > z2) return (FALSE);
1399 /* Sort by monster level */
1402 /* Extract levels */
1403 z1 = r_info[w1].level;
1404 z2 = r_info[w2].level;
1406 /* Compare levels */
1407 if (z1 < z2) return (TRUE);
1408 if (z1 > z2) return (FALSE);
1412 /* Sort by monster experience */
1415 /* Extract experience */
1416 z1 = r_info[w1].mexp;
1417 z2 = r_info[w2].mexp;
1419 /* Compare experience */
1420 if (z1 < z2) return (TRUE);
1421 if (z1 > z2) return (FALSE);
1425 /* Compare indexes */
1431 * @brief モンスター種族情報を特定の基準によりソートするためのスワップ処理
1432 * Sorting hook -- Swap function -- see below
1433 * @param u モンスター種族情報の入れるポインタ
1435 * @param a スワップするモンスター種族のID1
1436 * @param b スワップするモンスター種族のID2
1439 * We use "u" to point to array of monster indexes,
1440 * and "v" to select the type of sorting to perform.
1442 void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
1444 u16b *who = (u16b*)(u);
1460 * @brief モンスターの思い出を見るコマンドのメインルーチン
1461 * Identify a character, allow recall of monsters
1465 * Several "special" responses recall "multiple" monsters:
1467 * ^U (all unique monsters)
1468 * ^N (all non-unique monsters)
1470 * The responses may be sorted in several ways, see below.
1472 * Note that the player ghosts are ignored.
1475 void do_cmd_query_symbol(void)
1489 bool recall = FALSE;
1494 /* Get a character, or abort */
1495 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1496 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1498 /* Find that character info, and describe it */
1499 for (i = 0; ident_info[i]; ++i)
1501 if (sym == ident_info[i][0]) break;
1503 if (sym == KTRL('A'))
1506 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1508 else if (sym == KTRL('U'))
1511 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1513 else if (sym == KTRL('N'))
1516 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1518 else if (sym == KTRL('R'))
1521 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1523 /* XTRA HACK WHATSEARCH */
1524 else if (sym == KTRL('M'))
1527 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1532 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1534 else if (ident_info[i])
1536 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1540 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1543 /* Display the result */
1546 /* Allocate the "who" array */
1547 C_MAKE(who, max_r_idx, MONRACE_IDX);
1549 /* Collect matching monsters */
1550 for (n = 0, i = 1; i < max_r_idx; i++)
1552 monster_race *r_ptr = &r_info[i];
1554 /* Nothing to recall */
1555 if (!cheat_know && !r_ptr->r_sights) continue;
1557 /* Require non-unique monsters if needed */
1558 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1560 /* Require unique monsters if needed */
1561 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1563 /* Require ridable monsters if needed */
1564 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1566 /* XTRA HACK WHATSEARCH */
1572 for (xx = 0; temp[xx] && xx < 80; xx++)
1575 if (iskanji(temp[xx])) { xx++; continue; }
1577 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1581 strcpy(temp2, r_name + r_ptr->E_name);
1583 strcpy(temp2, r_name + r_ptr->name);
1585 for (xx = 0; temp2[xx] && xx < 80; xx++)
1586 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1589 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1591 if (my_strstr(temp2, temp))
1596 /* Collect "appropriate" monsters */
1597 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1600 /* Nothing to recall */
1603 /* Free the "who" array */
1604 C_KILL(who, max_r_idx, IDX);
1610 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1620 /* Select the sort method */
1621 ang_sort_comp = ang_sort_comp_hook;
1622 ang_sort_swap = ang_sort_swap_hook;
1624 /* Sort the array */
1625 ang_sort(who, &why, n);
1627 /* Sort by kills (and level) */
1634 /* Catch "escape" */
1637 /* Free the "who" array */
1638 C_KILL(who, max_r_idx, IDX);
1643 /* Sort if needed */
1646 /* Select the sort method */
1647 ang_sort_comp = ang_sort_comp_hook;
1648 ang_sort_swap = ang_sort_swap_hook;
1650 /* Sort the array */
1651 ang_sort(who, &why, n);
1655 /* Start at the end */
1658 /* Scan the monster memory */
1661 /* Extract a race */
1664 /* Hack -- Auto-recall */
1665 monster_race_track(r_idx);
1676 /* Recall on screen */
1677 screen_roff(who[i], 0);
1680 /* Hack -- Begin the prompt */
1683 /* Hack -- Complete the prompt */
1684 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1696 /* Normal commands */
1697 if (query != 'r') break;
1704 if (query == ESCAPE) break;
1706 /* Move to "prev" monster */
1712 if (!expand_list) break;
1716 /* Move to "next" monster */
1722 if (!expand_list) break;
1727 /* Free the "who" array */
1728 C_KILL(who, max_r_idx, IDX);
1730 /* Re-display the identity */
1735 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1739 * XXX - Add actions for other item types
1741 void do_cmd_use(void)
1747 if (p_ptr->wild_mode)
1752 if (p_ptr->inside_arena)
1754 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
1759 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1761 set_action(ACTION_NONE);
1764 item_tester_hook = item_tester_hook_use;
1766 q = _("どれを使いますか?", "Use which item? ");
1767 s = _("使えるものがありません。", "You have nothing to use.");
1769 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1772 switch (o_ptr->tval)
1784 do_cmd_eat_food_aux(item);
1791 do_cmd_aim_wand_aux(item);
1798 do_cmd_use_staff_aux(item);
1805 do_cmd_zap_rod_aux(item);
1809 /* Quaff a potion */
1812 do_cmd_quaff_potion_aux(item);
1819 /* Check some conditions */
1822 msg_print(_("目が見えない。", "You can't see anything."));
1827 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
1830 if (p_ptr->confused)
1832 msg_print(_("混乱していて読めない!", "You are too confused!"));
1836 do_cmd_read_scroll_aux(item, TRUE);
1845 exe_fire(item, &inventory[INVEN_BOW]);
1849 /* Activate an artifact */
1852 do_cmd_activate_aux(item);