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"
30 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory
33 void do_cmd_inven(void)
37 /* Note that we are in "inventory" mode */
40 /* Note that we are in "inventory" mode */
41 if (easy_floor) command_wrk = (USE_INVEN);
44 /* Display the inventory */
45 (void)show_inven(0, USE_FULL);
48 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
49 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
50 (long int)((p_ptr->total_weight * 100) / weight_limit()));
52 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
53 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
54 (p_ptr->total_weight * 100) / weight_limit());
58 command_new = inkey();
61 /* Process "Escape" */
62 if (command_new == ESCAPE)
66 Term_get_size(&wid, &hgt);
70 command_gap = wid - 30;
73 /* Process normal keys */
76 /* Hack -- Use "display" mode */
83 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
86 void do_cmd_equip(void)
91 /* Note that we are in "equipment" mode */
94 /* Note that we are in "equipment" mode */
95 if (easy_floor) command_wrk = (USE_EQUIP);
98 (void)show_equip(0, USE_FULL);
102 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
103 (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) ,
104 (long int)((p_ptr->total_weight * 100) / weight_limit()));
106 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
107 (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10),
108 (long int)((p_ptr->total_weight * 100) / weight_limit()));
112 command_new = inkey();
115 /* Process "Escape" */
116 if (command_new == ESCAPE)
120 Term_get_size(&wid, &hgt);
124 command_gap = wid - 30;
127 /* Process normal keys */
130 /* Enter "display" mode */
138 bool select_ring_slot = FALSE;
141 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
144 void do_cmd_wield(void)
146 OBJECT_IDX item, slot;
154 GAME_TEXT o_name[MAX_NLEN];
157 OBJECT_IDX need_switch_wielding = 0;
159 if (p_ptr->special_defense & KATA_MUSOU)
161 set_action(ACTION_NONE);
164 /* Restrict the choices */
165 item_tester_hook = item_tester_hook_wear;
167 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
168 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
170 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
174 slot = wield_slot(o_ptr);
178 /* Shields and some misc. items */
183 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
185 /* Restrict the choices */
186 item_tester_hook = item_tester_hook_melee_weapon;
188 /* Choose a weapon from the equipment only */
189 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
190 s = _("おっと。", "Oops.");
191 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
192 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
195 else if (buki_motteruka(INVEN_LARM)) slot = INVEN_RARM;
197 /* Both arms are already used by non-weapon */
198 else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) &&
199 inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM]))
201 /* Restrict the choices */
202 item_tester_hook = item_tester_hook_mochikae;
205 q = _("どちらの手に装備しますか?", "Equip which hand? ");
206 s = _("おっと。", "Oops.");
207 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
216 /* Asking for dual wielding */
217 if (slot == INVEN_LARM)
219 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
222 else if (!inventory[INVEN_RARM].k_idx && buki_motteruka(INVEN_LARM))
224 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
227 /* Both arms are already used */
228 else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx)
230 /* Restrict the choices */
231 item_tester_hook = item_tester_hook_mochikae;
234 q = _("どちらの手に装備しますか?", "Equip which hand? ");
235 s = _("おっと。", "Oops.");
237 if (!choose_object(&slot, q, s, (USE_EQUIP))) return;
238 if ((slot == INVEN_LARM) && !buki_motteruka(INVEN_RARM))
239 need_switch_wielding = INVEN_RARM;
245 /* Choose a ring slot */
246 if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx)
248 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
252 q = _("どちらの手に装備しますか?", "Equip which hand? ");
254 s = _("おっと。", "Oops.");
256 /* Restrict the choices */
257 select_ring_slot = TRUE;
259 if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)))
261 select_ring_slot = FALSE;
264 select_ring_slot = FALSE;
268 /* Prevent wielding into a cursed slot */
269 if (object_is_cursed(&inventory[slot]))
271 object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
274 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
276 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
279 /* Cancel the command */
284 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
285 ((o_ptr->ident & IDENT_SENSE) &&
286 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
288 char dummy[MAX_NLEN+80];
290 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
291 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
293 if (!get_check(dummy)) return;
296 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
298 char dummy[MAX_NLEN+80];
300 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
303 sprintf(dummy, "%sを装備すると吸血鬼になります。よろしいですか?", o_name);
305 msg_format("%s will transforms you into a vampire permanently when equiped.", o_name);
306 sprintf(dummy, "Do you become a vampire?");
309 if (!get_check(dummy)) return;
312 if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding]))
314 object_type *slot_o_ptr = &inventory[slot];
315 object_type *switch_o_ptr = &inventory[need_switch_wielding];
316 object_type object_tmp;
317 object_type *otmp_ptr = &object_tmp;
318 GAME_TEXT switch_name[MAX_NLEN];
320 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
322 object_copy(otmp_ptr, switch_o_ptr);
323 object_copy(switch_o_ptr, slot_o_ptr);
324 object_copy(slot_o_ptr, otmp_ptr);
326 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
327 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
328 (left_hander ? _("右手", "right") : _("左手", "left")));
329 slot = need_switch_wielding;
332 check_find_art_quest_completion(o_ptr);
334 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
336 identify_item(o_ptr);
338 /* Auto-inscription */
339 autopick_alter_item(item, FALSE);
342 p_ptr->energy_use = 100;
345 /* Obtain local object */
346 object_copy(q_ptr, o_ptr);
348 /* Modify quantity */
351 /* Decrease the item (from the pack) */
354 inven_item_increase(item, -1);
355 inven_item_optimize(item);
358 /* Decrease the item (from the floor) */
361 floor_item_increase(0 - item, -1);
362 floor_item_optimize(0 - item);
365 /* Access the wield slot */
366 o_ptr = &inventory[slot];
368 /* Take off existing item */
371 /* Take off existing item */
372 (void)inven_takeoff(slot, 255);
375 /* Wear the new stuff */
376 object_copy(o_ptr, q_ptr);
378 /* Player touches it */
379 o_ptr->marked |= OM_TOUCHED;
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 o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT));
535 if (object_is_cursed(o_ptr))
537 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER))
539 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
544 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
546 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
548 o_ptr->ident |= (IDENT_SENSE);
549 o_ptr->curse_flags = 0L;
550 o_ptr->feeling = FEEL_NONE;
552 p_ptr->update |= (PU_BONUS);
553 p_ptr->window |= (PW_EQUIP);
555 msg_print(_("呪いを打ち破った。", "You break the curse."));
559 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
560 p_ptr->energy_use = 50;
565 /* Take a partial turn */
566 p_ptr->energy_use = 50;
568 /* Take off the item */
569 (void)inven_takeoff(item, 255);
572 p_ptr->redraw |= (PR_EQUIPPY);
577 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
580 void do_cmd_drop(void)
589 if (p_ptr->special_defense & KATA_MUSOU)
591 set_action(ACTION_NONE);
594 q = _("どのアイテムを落としますか? ", "Drop which item? ");
595 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
597 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT));
600 /* Hack -- Cannot remove cursed items */
601 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
603 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
608 /* See how many items */
609 if (o_ptr->number > 1)
612 amt = get_quantity(NULL, o_ptr->number);
614 /* Allow user abort */
615 if (amt <= 0) return;
619 /* Take a partial turn */
620 p_ptr->energy_use = 50;
622 /* Drop (some of) the item */
623 inven_drop(item, amt);
625 if (item >= INVEN_RARM)
631 p_ptr->redraw |= (PR_EQUIPPY);
635 * @brief オブジェクトが高位の魔法書かどうかを判定する
636 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
637 * @return オブジェクトが高位の魔法書ならばTRUEを返す
639 static bool high_level_book(object_type *o_ptr)
641 if ((o_ptr->tval == TV_LIFE_BOOK) ||
642 (o_ptr->tval == TV_SORCERY_BOOK) ||
643 (o_ptr->tval == TV_NATURE_BOOK) ||
644 (o_ptr->tval == TV_CHAOS_BOOK) ||
645 (o_ptr->tval == TV_DEATH_BOOK) ||
646 (o_ptr->tval == TV_TRUMP_BOOK) ||
647 (o_ptr->tval == TV_CRAFT_BOOK) ||
648 (o_ptr->tval == TV_DAEMON_BOOK) ||
649 (o_ptr->tval == TV_CRUSADE_BOOK) ||
650 (o_ptr->tval == TV_MUSIC_BOOK) ||
651 (o_ptr->tval == TV_HEX_BOOK))
664 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
667 void do_cmd_destroy(void)
677 object_type *q_ptr = &forge;
679 GAME_TEXT o_name[MAX_NLEN];
680 char out_val[MAX_NLEN+40];
684 if (p_ptr->special_defense & KATA_MUSOU)
686 set_action(ACTION_NONE);
689 /* Hack -- force destruction */
690 if (command_arg > 0) force = TRUE;
692 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
693 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
695 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
698 /* Verify unless quantity given beforehand */
699 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
701 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
703 /* Make a verification */
704 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
707 /* HACK : Add the line to message buffer */
708 message_add(out_val);
709 p_ptr->window |= (PW_MESSAGE);
712 /* Get an acceptable answer */
722 /* Erase the prompt */
726 if (i == 'y' || i == 'Y')
730 if (i == ESCAPE || i == 'n' || i == 'N')
737 /* Add an auto-destroy preference line */
738 if (autopick_autoregister(o_ptr))
740 /* Auto-destroy it */
741 autopick_alter_item(item, TRUE);
744 /* The object is already destroyed. */
750 /* See how many items */
751 if (o_ptr->number > 1)
754 amt = get_quantity(NULL, o_ptr->number);
756 /* Allow user abort */
757 if (amt <= 0) return;
761 old_number = o_ptr->number;
763 object_desc(o_name, o_ptr, 0);
764 o_ptr->number = old_number;
766 p_ptr->energy_use = 100;
768 /* Artifacts cannot be destroyed */
769 if (!can_player_destroy_object(o_ptr))
771 p_ptr->energy_use = 0;
773 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
777 object_copy(q_ptr, o_ptr);
779 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
780 sound(SOUND_DESTITEM);
782 /* Reduce the charges of rods/wands */
783 reduce_charges(o_ptr, amt);
785 /* Eliminate the item (from the pack) */
788 inven_item_increase(item, -amt);
789 inven_item_describe(item);
790 inven_item_optimize(item);
793 /* Eliminate the item (from the floor) */
796 floor_item_increase(0 - item, -amt);
797 floor_item_describe(0 - item);
798 floor_item_optimize(0 - item);
801 if (high_level_book(q_ptr))
803 bool gain_expr = FALSE;
805 if (p_ptr->prace == RACE_ANDROID)
808 else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER))
812 else if (p_ptr->pclass == CLASS_PALADIN)
814 if (is_good_realm(p_ptr->realm1))
816 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
820 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
824 if (gain_expr && (p_ptr->exp < PY_MAX_EXP))
826 s32b tester_exp = p_ptr->max_exp / 20;
827 if (tester_exp > 10000) tester_exp = 10000;
828 if (q_ptr->sval < 3) tester_exp /= 4;
829 if (tester_exp<1) tester_exp = 1;
831 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
832 gain_exp(tester_exp * amt);
834 if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
836 chg_virtue(V_UNLIFE, 1);
837 chg_virtue(V_VITALITY, -1);
839 else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
841 chg_virtue(V_UNLIFE, -1);
842 chg_virtue(V_VITALITY, 1);
845 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
846 chg_virtue(V_ENCHANT, -1);
848 if (object_value_real(q_ptr) > 30000)
849 chg_virtue(V_SACRIFICE, 2);
851 else if (object_value_real(q_ptr) > 10000)
852 chg_virtue(V_SACRIFICE, 1);
855 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
856 chg_virtue(V_HARMONY, 1);
858 if (item >= INVEN_RARM) calc_android_exp();
863 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
866 void do_cmd_observe(void)
870 GAME_TEXT o_name[MAX_NLEN];
873 q = _("どのアイテムを調べますか? ", "Examine which item? ");
874 s = _("調べられるアイテムがない。", "You have nothing to examine.");
876 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
879 /* Require full knowledge */
880 if (!(o_ptr->ident & IDENT_MENTAL))
882 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
886 object_desc(o_name, o_ptr, 0);
887 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
888 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
894 * @brief アイテムの銘を消すコマンドのメインルーチン
895 * Remove the inscription from an object XXX Mention item (when done)?
898 void do_cmd_uninscribe(void)
904 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
905 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
907 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
910 /* Nothing to remove */
911 if (!o_ptr->inscription)
913 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
917 msg_print(_("銘を消した。", "Inscription removed."));
919 /* Remove the incription */
920 o_ptr->inscription = 0;
922 /* Combine the pack */
923 p_ptr->update |= (PU_COMBINE);
925 p_ptr->window |= (PW_INVEN | PW_EQUIP);
927 /* .や$の関係で, 再計算が必要なはず -- henkma */
928 p_ptr->update |= (PU_BONUS);
934 * @brief アイテムの銘を刻むコマンドのメインルーチン
935 * Inscribe an object with a comment
938 void do_cmd_inscribe(void)
942 GAME_TEXT o_name[MAX_NLEN];
946 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
947 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
949 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
952 /* Describe the activity */
953 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
955 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
958 /* Start with nothing */
961 /* Use old inscription */
962 if (o_ptr->inscription)
964 /* Start with the old inscription */
965 strcpy(out_val, quark_str(o_ptr->inscription));
968 /* Get a new inscription (possibly empty) */
969 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
971 /* Save the inscription */
972 o_ptr->inscription = quark_add(out_val);
974 /* Combine the pack */
975 p_ptr->update |= (PU_COMBINE);
977 p_ptr->window |= (PW_INVEN | PW_EQUIP);
979 /* .や$の関係で, 再計算が必要なはず -- henkma */
980 p_ptr->update |= (PU_BONUS);
987 * @brief オブジェクトがランタンの燃料になるかどうかを判定する
988 * An "item_tester_hook" for refilling lanterns
989 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
990 * @return オブジェクトがランタンの燃料になるならばTRUEを返す
992 static bool item_tester_refill_lantern(object_type *o_ptr)
994 /* Flasks of oil are okay */
995 if (o_ptr->tval == TV_FLASK) return (TRUE);
997 /* Laterns are okay */
998 if ((o_ptr->tval == TV_LITE) &&
999 (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE);
1001 /* Assume not okay */
1007 * @brief ランタンに燃料を加えるコマンドのメインルーチン
1008 * Refill the players lamp (from the pack or floor)
1011 static void do_cmd_refill_lamp(void)
1020 /* Restrict the choices */
1021 item_tester_hook = item_tester_refill_lantern;
1023 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
1024 s = _("油つぼがない。", "You have no flasks of oil.");
1026 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1029 /* Take a partial turn */
1030 p_ptr->energy_use = 50;
1032 /* Access the lantern */
1033 j_ptr = &inventory[INVEN_LITE];
1036 j_ptr->xtra4 += o_ptr->xtra4;
1037 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
1039 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1042 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
1044 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1047 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
1049 else if (j_ptr->xtra4 >= FUEL_LAMP)
1051 j_ptr->xtra4 = FUEL_LAMP;
1052 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
1055 /* Decrease the item (from the pack) */
1058 inven_item_increase(item, -1);
1059 inven_item_describe(item);
1060 inven_item_optimize(item);
1063 /* Decrease the item (from the floor) */
1066 floor_item_increase(0 - item, -1);
1067 floor_item_describe(0 - item);
1068 floor_item_optimize(0 - item);
1071 /* Recalculate torch */
1072 p_ptr->update |= (PU_TORCH);
1077 * @brief オブジェクトが松明に束ねられるかどうかを判定する
1078 * An "item_tester_hook" for refilling torches
1079 * @param o_ptr 判定したいオブジェクトの構造体参照ポインタ
1080 * @return オブジェクトが松明に束ねられるならばTRUEを返す
1082 static bool item_tester_refill_torch(object_type *o_ptr)
1084 /* Torches are okay */
1085 if ((o_ptr->tval == TV_LITE) &&
1086 (o_ptr->sval == SV_LITE_TORCH)) return (TRUE);
1088 /* Assume not okay */
1094 * @brief 松明を束ねるコマンドのメインルーチン
1095 * Refuel the players torch (from the pack or floor)
1098 static void do_cmd_refill_torch(void)
1107 /* Restrict the choices */
1108 item_tester_hook = item_tester_refill_torch;
1110 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
1111 s = _("他に松明がない。", "You have no extra torches.");
1113 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
1116 /* Take a partial turn */
1117 p_ptr->energy_use = 50;
1119 /* Access the primary torch */
1120 j_ptr = &inventory[INVEN_LITE];
1123 j_ptr->xtra4 += o_ptr->xtra4 + 5;
1125 msg_print(_("松明を結合した。", "You combine the torches."));
1127 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
1130 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
1132 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1135 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1137 /* Over-fuel message */
1138 else if (j_ptr->xtra4 >= FUEL_TORCH)
1140 j_ptr->xtra4 = FUEL_TORCH;
1141 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1144 /* Refuel message */
1147 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1150 /* Decrease the item (from the pack) */
1153 inven_item_increase(item, -1);
1154 inven_item_describe(item);
1155 inven_item_optimize(item);
1158 /* Decrease the item (from the floor) */
1161 floor_item_increase(0 - item, -1);
1162 floor_item_describe(0 - item);
1163 floor_item_optimize(0 - item);
1166 /* Recalculate torch */
1167 p_ptr->update |= (PU_TORCH);
1172 * @brief 燃料を補充するコマンドのメインルーチン
1173 * Refill the players lamp, or restock his torches
1176 void do_cmd_refill(void)
1181 o_ptr = &inventory[INVEN_LITE];
1183 if (p_ptr->special_defense & KATA_MUSOU)
1185 set_action(ACTION_NONE);
1189 if (o_ptr->tval != TV_LITE)
1191 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1195 else if (o_ptr->sval == SV_LITE_LANTERN)
1197 do_cmd_refill_lamp();
1201 else if (o_ptr->sval == SV_LITE_TORCH)
1203 do_cmd_refill_torch();
1206 /* No torch to refill */
1209 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1215 * @brief ターゲットを設定するコマンドのメインルーチン
1219 void do_cmd_target(void)
1221 if (p_ptr->wild_mode) return;
1224 if (target_set(TARGET_KILL))
1226 msg_print(_("ターゲット決定。", "Target Selected."));
1229 /* Target aborted */
1232 msg_print(_("ターゲット解除。", "Target Aborted."));
1239 * @brief 周囲を見渡すコマンドのメインルーチン
1243 void do_cmd_look(void)
1245 p_ptr->window |= PW_MONSTER_LIST;
1249 if (target_set(TARGET_LOOK))
1251 msg_print(_("ターゲット決定。", "Target Selected."));
1257 * @brief 位置を確認するコマンドのメインルーチン
1258 * Allow the player to examine other sectors on the map
1261 void do_cmd_locate(void)
1264 POSITION y1, x1, y2, x2;
1265 GAME_TEXT tmp_val[80];
1266 GAME_TEXT out_val[160];
1269 get_screen_size(&wid, &hgt);
1271 /* Start at current panel */
1272 y2 = y1 = panel_row_min;
1273 x2 = x1 = panel_col_min;
1275 /* Show panels until done */
1278 /* Describe the location */
1279 if ((y2 == y1) && (x2 == x1))
1282 strcpy(tmp_val, "真上");
1291 sprintf(tmp_val, "%s%s",
1292 ((y2 < y1) ? "北" : (y2 > y1) ? "南" : ""),
1293 ((x2 < x1) ? "西" : (x2 > x1) ? "東" : ""));
1295 sprintf(tmp_val, "%s%s of",
1296 ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""),
1297 ((x2 < x1) ? " West" : (x2 > x1) ? " East" : ""));
1302 /* Prepare to ask which way to look */
1303 sprintf(out_val, _("マップ位置 [%ld(%02ld),%ld(%02ld)] (プレイヤーの%s) 方向?",
1304 "Map sector [%ld(%02ld),%ld(%02ld)], which is%s your sector. Direction?"),
1305 y2 / (hgt / 2), y2 % (hgt / 2),
1306 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1308 /* Assume no direction */
1311 /* Get a direction */
1316 /* Get a command (or Cancel) */
1317 if (!get_com(out_val, &command, TRUE)) break;
1319 /* Extract the action (if any) */
1320 dir = get_keymap_dir(command);
1329 /* Apply the motion */
1330 if (change_panel(ddy[dir], ddx[dir]))
1338 /* Recenter the map around the player */
1341 p_ptr->update |= (PU_MONSTERS);
1342 p_ptr->redraw |= (PR_MAP);
1343 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1350 * @brief モンスター種族情報を特定の基準によりソートするための比較処理
1351 * Sorting hook -- Comp function -- see below
1352 * @param u モンスター種族情報の入れるポインタ
1354 * @param a 比較するモンスター種族のID1
1355 * @param b 比較するモンスター種族のID2
1356 * @return 2の方が大きければTRUEを返す
1357 * We use "u" to point to array of monster indexes,
1358 * and "v" to select the type of sorting to perform on "u".
1360 bool ang_sort_comp_hook(vptr u, vptr v, int a, int b)
1362 u16b *who = (u16b*)(u);
1363 u16b *why = (u16b*)(v);
1370 /* Sort by player kills */
1373 /* Extract player kills */
1374 z1 = r_info[w1].r_pkills;
1375 z2 = r_info[w2].r_pkills;
1377 /* Compare player kills */
1378 if (z1 < z2) return (TRUE);
1379 if (z1 > z2) return (FALSE);
1383 /* Sort by total kills */
1386 /* Extract total kills */
1387 z1 = r_info[w1].r_tkills;
1388 z2 = r_info[w2].r_tkills;
1390 /* Compare total kills */
1391 if (z1 < z2) return (TRUE);
1392 if (z1 > z2) return (FALSE);
1396 /* Sort by monster level */
1399 /* Extract levels */
1400 z1 = r_info[w1].level;
1401 z2 = r_info[w2].level;
1403 /* Compare levels */
1404 if (z1 < z2) return (TRUE);
1405 if (z1 > z2) return (FALSE);
1409 /* Sort by monster experience */
1412 /* Extract experience */
1413 z1 = r_info[w1].mexp;
1414 z2 = r_info[w2].mexp;
1416 /* Compare experience */
1417 if (z1 < z2) return (TRUE);
1418 if (z1 > z2) return (FALSE);
1422 /* Compare indexes */
1428 * @brief モンスター種族情報を特定の基準によりソートするためのスワップ処理
1429 * Sorting hook -- Swap function -- see below
1430 * @param u モンスター種族情報の入れるポインタ
1432 * @param a スワップするモンスター種族のID1
1433 * @param b スワップするモンスター種族のID2
1436 * We use "u" to point to array of monster indexes,
1437 * and "v" to select the type of sorting to perform.
1439 void ang_sort_swap_hook(vptr u, vptr v, int a, int b)
1441 u16b *who = (u16b*)(u);
1457 * @brief モンスターの思い出を見るコマンドのメインルーチン
1458 * Identify a character, allow recall of monsters
1462 * Several "special" responses recall "multiple" monsters:
1464 * ^U (all unique monsters)
1465 * ^N (all non-unique monsters)
1467 * The responses may be sorted in several ways, see below.
1469 * Note that the player ghosts are ignored.
1472 void do_cmd_query_symbol(void)
1486 bool recall = FALSE;
1491 /* Get a character, or abort */
1492 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1493 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1495 /* Find that character info, and describe it */
1496 for (i = 0; ident_info[i]; ++i)
1498 if (sym == ident_info[i][0]) break;
1500 if (sym == KTRL('A'))
1503 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1505 else if (sym == KTRL('U'))
1508 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1510 else if (sym == KTRL('N'))
1513 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1515 else if (sym == KTRL('R'))
1518 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1520 /* XTRA HACK WHATSEARCH */
1521 else if (sym == KTRL('M'))
1524 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1529 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1531 else if (ident_info[i])
1533 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1537 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1540 /* Display the result */
1543 /* Allocate the "who" array */
1544 C_MAKE(who, max_r_idx, MONRACE_IDX);
1546 /* Collect matching monsters */
1547 for (n = 0, i = 1; i < max_r_idx; i++)
1549 monster_race *r_ptr = &r_info[i];
1551 /* Nothing to recall */
1552 if (!cheat_know && !r_ptr->r_sights) continue;
1554 /* Require non-unique monsters if needed */
1555 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1557 /* Require unique monsters if needed */
1558 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1560 /* Require ridable monsters if needed */
1561 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1563 /* XTRA HACK WHATSEARCH */
1569 for (xx = 0; temp[xx] && xx < 80; xx++)
1572 if (iskanji(temp[xx])) { xx++; continue; }
1574 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1578 strcpy(temp2, r_name + r_ptr->E_name);
1580 strcpy(temp2, r_name + r_ptr->name);
1582 for (xx = 0; temp2[xx] && xx < 80; xx++)
1583 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1586 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1588 if (my_strstr(temp2, temp))
1593 /* Collect "appropriate" monsters */
1594 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1597 /* Nothing to recall */
1600 /* Free the "who" array */
1601 C_KILL(who, max_r_idx, IDX);
1607 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1617 /* Select the sort method */
1618 ang_sort_comp = ang_sort_comp_hook;
1619 ang_sort_swap = ang_sort_swap_hook;
1621 /* Sort the array */
1622 ang_sort(who, &why, n);
1624 /* Sort by kills (and level) */
1631 /* Catch "escape" */
1634 /* Free the "who" array */
1635 C_KILL(who, max_r_idx, IDX);
1640 /* Sort if needed */
1643 /* Select the sort method */
1644 ang_sort_comp = ang_sort_comp_hook;
1645 ang_sort_swap = ang_sort_swap_hook;
1647 /* Sort the array */
1648 ang_sort(who, &why, n);
1652 /* Start at the end */
1655 /* Scan the monster memory */
1658 /* Extract a race */
1661 /* Hack -- Auto-recall */
1662 monster_race_track(r_idx);
1673 /* Recall on screen */
1674 screen_roff(who[i], 0);
1677 /* Hack -- Begin the prompt */
1680 /* Hack -- Complete the prompt */
1681 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1693 /* Normal commands */
1694 if (query != 'r') break;
1701 if (query == ESCAPE) break;
1703 /* Move to "prev" monster */
1709 if (!expand_list) break;
1713 /* Move to "next" monster */
1719 if (!expand_list) break;
1724 /* Free the "who" array */
1725 C_KILL(who, max_r_idx, IDX);
1727 /* Re-display the identity */
1732 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1736 * XXX - Add actions for other item types
1738 void do_cmd_use(void)
1744 if (p_ptr->wild_mode)
1749 if (p_ptr->inside_arena)
1751 msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
1756 if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1758 set_action(ACTION_NONE);
1761 item_tester_hook = item_tester_hook_use;
1763 q = _("どれを使いますか?", "Use which item? ");
1764 s = _("使えるものがありません。", "You have nothing to use.");
1766 o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
1769 switch (o_ptr->tval)
1781 do_cmd_eat_food_aux(item);
1788 do_cmd_aim_wand_aux(item);
1795 do_cmd_use_staff_aux(item);
1802 do_cmd_zap_rod_aux(item);
1806 /* Quaff a potion */
1809 do_cmd_quaff_potion_aux(item);
1816 /* Check some conditions */
1819 msg_print(_("目が見えない。", "You can't see anything."));
1824 msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
1827 if (p_ptr->confused)
1829 msg_print(_("混乱していて読めない!", "You are too confused!"));
1833 do_cmd_read_scroll_aux(item, TRUE);
1842 exe_fire(item, &inventory[INVEN_BOW]);
1846 /* Activate an artifact */
1849 do_cmd_activate_aux(item);