3 * @brief プレイヤーのアイテムに関するコマンドの実装1 / Inventory and equipment 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.
21 #include "cmd-activate.h"
23 #include "cmd-quaff.h"
25 #include "cmd-usestaff.h"
26 #include "cmd-zaprod.h"
27 #include "cmd-zapwand.h"
29 #include "cmd-basic.h"
31 #include "object-flavor.h"
32 #include "object-hook.h"
33 #include "object-ego.h"
38 #include "player-status.h"
39 #include "player-effects.h"
40 #include "player-class.h"
41 #include "player-personality.h"
43 #include "view-mainwindow.h"
45 #include "objectkind.h"
47 #include "targeting.h"
49 #include "player-race.h"
50 #include "view-mainwindow.h"
51 #include "player-inventory.h"
54 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory_list
57 void do_cmd_inven(player_type *creature_ptr)
61 if (easy_floor) command_wrk = (USE_INVEN);
63 (void)show_inven(creature_ptr, 0, USE_FULL, 0);
66 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
67 (int)lbtokg1(creature_ptr->total_weight) , (int)lbtokg2(creature_ptr->total_weight) ,
69 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
70 (int)(creature_ptr->total_weight / 10), (int)(creature_ptr->total_weight % 10),
72 (long int)(creature_ptr->total_weight * 100) / weight_limit(creature_ptr));
75 command_new = inkey();
78 if (command_new == ESCAPE)
81 Term_get_size(&wid, &hgt);
83 command_gap = wid - 30;
93 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
96 void do_cmd_equip(player_type *creature_ptr)
100 if (easy_floor) command_wrk = (USE_EQUIP);
103 (void)show_equip(creature_ptr, 0, USE_FULL, 0);
106 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
107 (int)lbtokg1(creature_ptr->total_weight) , (int)lbtokg2(creature_ptr->total_weight) ,
108 (long int)((creature_ptr->total_weight * 100) / weight_limit(creature_ptr)));
110 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
111 (int)(creature_ptr->total_weight / 10), (int)(creature_ptr->total_weight % 10),
112 (long int)((creature_ptr->total_weight * 100) / weight_limit(creature_ptr)));
116 command_new = inkey();
119 if (command_new == ESCAPE)
122 Term_get_size(&wid, &hgt);
124 command_gap = wid - 30;
133 bool select_ring_slot = FALSE;
136 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
139 void do_cmd_wield(player_type *creature_ptr)
141 OBJECT_IDX item, slot;
149 GAME_TEXT o_name[MAX_NLEN];
152 OBJECT_IDX need_switch_wielding = 0;
154 if (creature_ptr->special_defense & KATA_MUSOU)
156 set_action(creature_ptr, ACTION_NONE);
159 /* Restrict the choices */
160 item_tester_hook = item_tester_hook_wear;
162 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
163 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
165 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
169 slot = wield_slot(creature_ptr, o_ptr);
173 /* Shields and some misc. items */
178 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
180 /* Restrict the choices */
181 item_tester_hook = item_tester_hook_melee_weapon;
183 /* Choose a weapon from the equipment only */
184 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
185 s = _("おっと。", "Oops.");
186 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
187 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
190 else if (has_melee_weapon(creature_ptr, INVEN_LARM)) slot = INVEN_RARM;
192 /* Both arms are already used by non-weapon */
193 else if (creature_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_RARM]) &&
194 creature_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_LARM]))
196 /* Restrict the choices */
197 item_tester_hook = item_tester_hook_mochikae;
200 q = _("どちらの手に装備しますか?", "Equip which hand? ");
201 s = _("おっと。", "Oops.");
202 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
211 /* Asking for dual wielding */
212 if (slot == INVEN_LARM)
214 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
217 else if (!creature_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(creature_ptr, INVEN_LARM))
219 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
222 /* Both arms are already used */
223 else if (creature_ptr->inventory_list[INVEN_LARM].k_idx && creature_ptr->inventory_list[INVEN_RARM].k_idx)
225 /* Restrict the choices */
226 item_tester_hook = item_tester_hook_mochikae;
229 q = _("どちらの手に装備しますか?", "Equip which hand? ");
230 s = _("おっと。", "Oops.");
232 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
233 if ((slot == INVEN_LARM) && !has_melee_weapon(creature_ptr, INVEN_RARM))
234 need_switch_wielding = INVEN_RARM;
240 /* Choose a ring slot */
241 if (creature_ptr->inventory_list[INVEN_LEFT].k_idx && creature_ptr->inventory_list[INVEN_RIGHT].k_idx)
243 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
247 q = _("どちらの手に装備しますか?", "Equip which hand? ");
249 s = _("おっと。", "Oops.");
251 /* Restrict the choices */
252 select_ring_slot = TRUE;
254 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0))
256 select_ring_slot = FALSE;
259 select_ring_slot = FALSE;
263 /* Prevent wielding into a cursed slot */
264 if (object_is_cursed(&creature_ptr->inventory_list[slot]))
266 object_desc(o_name, &creature_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
268 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
270 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
276 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
277 ((o_ptr->ident & IDENT_SENSE) &&
278 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
280 char dummy[MAX_NLEN+80];
282 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
283 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
285 if (!get_check(dummy)) return;
288 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
290 char dummy[MAX_NLEN+100];
292 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
294 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
295 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
297 if (!get_check(dummy)) return;
300 if (need_switch_wielding && !object_is_cursed(&creature_ptr->inventory_list[need_switch_wielding]))
302 object_type *slot_o_ptr = &creature_ptr->inventory_list[slot];
303 object_type *switch_o_ptr = &creature_ptr->inventory_list[need_switch_wielding];
304 object_type object_tmp;
305 object_type *otmp_ptr = &object_tmp;
306 GAME_TEXT switch_name[MAX_NLEN];
308 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
310 object_copy(otmp_ptr, switch_o_ptr);
311 object_copy(switch_o_ptr, slot_o_ptr);
312 object_copy(slot_o_ptr, otmp_ptr);
314 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
315 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
316 (left_hander ? _("右手", "right") : _("左手", "left")));
317 slot = need_switch_wielding;
320 check_find_art_quest_completion(o_ptr);
322 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
324 identify_item(creature_ptr, o_ptr);
326 /* Auto-inscription */
327 autopick_alter_item(item, FALSE);
330 take_turn(creature_ptr, 100);
333 /* Obtain local object */
334 object_copy(q_ptr, o_ptr);
336 /* Modify quantity */
339 /* Decrease the item (from the pack) */
342 inven_item_increase(creature_ptr, item, -1);
343 inven_item_optimize(creature_ptr, item);
345 /* Decrease the item (from the floor) */
348 floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
349 floor_item_optimize(creature_ptr->current_floor_ptr, 0 - item);
352 /* Access the wield slot */
353 o_ptr = &creature_ptr->inventory_list[slot];
355 /* Take off existing item */
358 /* Take off existing item */
359 (void)inven_takeoff(creature_ptr, slot, 255);
362 /* Wear the new stuff */
363 object_copy(o_ptr, q_ptr);
365 o_ptr->marked |= OM_TOUCHED;
367 creature_ptr->total_weight += q_ptr->weight;
369 /* Increment the equip counter by hand */
370 creature_ptr->equip_cnt++;
372 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
373 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
374 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
376 /* Where is the item now */
380 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
381 act = STR_WIELD_ARMS;
383 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
387 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
388 act = STR_WIELD_ARMS;
390 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
394 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
398 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
402 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
406 object_desc(o_name, o_ptr, 0);
407 msg_format(act, o_name, index_to_label(slot));
410 if (object_is_cursed(o_ptr))
412 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
413 chg_virtue(creature_ptr, V_HARMONY, -1);
416 o_ptr->ident |= (IDENT_SENSE);
419 /* The Stone Mask make the player turn into a vampire! */
420 if ((o_ptr->name1 == ART_STONEMASK) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
422 /* Turn into a vampire */
423 change_race(creature_ptr, RACE_VAMPIRE, "");
426 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
427 creature_ptr->redraw |= (PR_EQUIPPY);
428 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
430 calc_android_exp(creature_ptr);
435 * @param item 持ち替えを行いたい装備部位ID
438 void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
440 object_type *o_ptr, *new_o_ptr;
441 GAME_TEXT o_name[MAX_NLEN];
443 if (item == INVEN_RARM)
445 if (!has_melee_weapon(owner_ptr, INVEN_LARM)) return;
447 o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
448 object_desc(o_name, o_ptr, 0);
450 if (object_is_cursed(o_ptr))
452 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
453 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
457 new_o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
458 object_copy(new_o_ptr, o_ptr);
459 owner_ptr->total_weight += o_ptr->weight;
460 inven_item_increase(owner_ptr, INVEN_LARM, -((int)o_ptr->number));
461 inven_item_optimize(owner_ptr, INVEN_LARM);
462 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
463 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
465 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
466 (left_hander ? _("左手", "left") : _("右手", "right")));
470 if (item != INVEN_LARM) return;
472 o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
473 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
475 if (has_melee_weapon(owner_ptr, INVEN_RARM))
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);
482 if ((empty_hands(owner_ptr, FALSE) & EMPTY_HAND_RARM) || object_is_cursed(o_ptr)) return;
484 new_o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
485 object_copy(new_o_ptr, o_ptr);
486 owner_ptr->total_weight += o_ptr->weight;
487 inven_item_increase(owner_ptr, INVEN_RARM, -((int)o_ptr->number));
488 inven_item_optimize(owner_ptr, INVEN_RARM);
489 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
494 * @brief 装備を外すコマンドのメインルーチン / Take off an item
497 void do_cmd_takeoff(player_type *creature_ptr)
503 if (creature_ptr->special_defense & KATA_MUSOU)
505 set_action(creature_ptr, ACTION_NONE);
508 q = _("どれを装備からはずしますか? ", "Take off which item? ");
509 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
511 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
515 if (object_is_cursed(o_ptr))
517 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (creature_ptr->pclass != CLASS_BERSERKER))
519 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
524 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
526 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
528 o_ptr->ident |= (IDENT_SENSE);
529 o_ptr->curse_flags = 0L;
530 o_ptr->feeling = FEEL_NONE;
532 creature_ptr->update |= (PU_BONUS);
533 creature_ptr->window |= (PW_EQUIP);
535 msg_print(_("呪いを打ち破った。", "You break the curse."));
539 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
540 take_turn(creature_ptr, 50);
545 take_turn(creature_ptr, 50);
547 /* Take off the item */
548 (void)inven_takeoff(creature_ptr, item, 255);
549 verify_equip_slot(creature_ptr, item);
550 calc_android_exp(creature_ptr);
551 creature_ptr->redraw |= (PR_EQUIPPY);
556 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
559 void do_cmd_drop(player_type *creature_ptr)
568 if (creature_ptr->special_defense & KATA_MUSOU)
570 set_action(creature_ptr, ACTION_NONE);
573 q = _("どのアイテムを落としますか? ", "Drop which item? ");
574 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
576 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
579 /* Hack -- Cannot remove cursed items */
580 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
582 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
586 if (o_ptr->number > 1)
588 amt = get_quantity(NULL, o_ptr->number);
589 if (amt <= 0) return;
592 take_turn(creature_ptr, 50);
594 /* Drop (some of) the item */
595 drop_from_inventory(creature_ptr, item, amt);
597 if (item >= INVEN_RARM)
599 verify_equip_slot(creature_ptr, item);
600 calc_android_exp(creature_ptr);
603 creature_ptr->redraw |= (PR_EQUIPPY);
608 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
611 void do_cmd_destroy(player_type *creature_ptr)
621 object_type *q_ptr = &forge;
623 GAME_TEXT o_name[MAX_NLEN];
624 char out_val[MAX_NLEN+40];
628 if (creature_ptr->special_defense & KATA_MUSOU)
630 set_action(creature_ptr, ACTION_NONE);
633 /* Hack -- force destruction */
634 if (command_arg > 0) force = TRUE;
636 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
637 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
639 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
642 /* Verify unless quantity given beforehand */
643 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
645 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
647 /* Make a verification */
648 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
651 /* HACK : Add the line to message buffer */
652 message_add(out_val);
653 creature_ptr->window |= (PW_MESSAGE);
654 handle_stuff(creature_ptr);
656 /* Get an acceptable answer */
666 /* Erase the prompt */
670 if (i == 'y' || i == 'Y')
674 if (i == ESCAPE || i == 'n' || i == 'N')
681 /* Add an auto-destroy preference line */
682 if (autopick_autoregister(o_ptr))
684 /* Auto-destroy it */
685 autopick_alter_item(item, TRUE);
688 /* The object is already destroyed. */
694 if (o_ptr->number > 1)
696 amt = get_quantity(NULL, o_ptr->number);
697 if (amt <= 0) return;
701 old_number = o_ptr->number;
703 object_desc(o_name, o_ptr, 0);
704 o_ptr->number = old_number;
706 take_turn(creature_ptr, 100);
708 /* Artifacts cannot be destroyed */
709 if (!can_player_destroy_object(o_ptr))
711 free_turn(creature_ptr);
713 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
717 object_copy(q_ptr, o_ptr);
719 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
720 sound(SOUND_DESTITEM);
722 /* Reduce the charges of rods/wands */
723 reduce_charges(o_ptr, amt);
725 vary_item(creature_ptr, item, -amt);
727 if (item_tester_high_level_book(q_ptr))
729 bool gain_expr = FALSE;
731 if (creature_ptr->prace == RACE_ANDROID)
734 else if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_BERSERKER))
738 else if (creature_ptr->pclass == CLASS_PALADIN)
740 if (is_good_realm(creature_ptr->realm1))
742 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
746 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
750 if (gain_expr && (creature_ptr->exp < PY_MAX_EXP))
752 s32b tester_exp = creature_ptr->max_exp / 20;
753 if (tester_exp > 10000) tester_exp = 10000;
754 if (q_ptr->sval < 3) tester_exp /= 4;
755 if (tester_exp<1) tester_exp = 1;
757 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
758 gain_exp(creature_ptr, tester_exp * amt);
760 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
762 chg_virtue(creature_ptr, V_UNLIFE, 1);
763 chg_virtue(creature_ptr, V_VITALITY, -1);
765 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
767 chg_virtue(creature_ptr, V_UNLIFE, -1);
768 chg_virtue(creature_ptr, V_VITALITY, 1);
771 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
772 chg_virtue(creature_ptr, V_ENCHANT, -1);
774 if (object_value_real(q_ptr) > 30000)
775 chg_virtue(creature_ptr, V_SACRIFICE, 2);
777 else if (object_value_real(q_ptr) > 10000)
778 chg_virtue(creature_ptr, V_SACRIFICE, 1);
781 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
782 chg_virtue(creature_ptr, V_HARMONY, 1);
784 if (item >= INVEN_RARM) calc_android_exp(creature_ptr);
789 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
792 void do_cmd_observe(player_type *creature_ptr)
796 GAME_TEXT o_name[MAX_NLEN];
799 q = _("どのアイテムを調べますか? ", "Examine which item? ");
800 s = _("調べられるアイテムがない。", "You have nothing to examine.");
802 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
805 /* Require full knowledge */
806 if (!(o_ptr->ident & IDENT_MENTAL))
808 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
812 object_desc(o_name, o_ptr, 0);
813 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
814 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
820 * @brief アイテムの銘を消すコマンドのメインルーチン
821 * Remove the inscription from an object XXX Mention item (when done)?
824 void do_cmd_uninscribe(player_type *creature_ptr)
830 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
831 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
833 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
836 /* Nothing to remove */
837 if (!o_ptr->inscription)
839 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
843 msg_print(_("銘を消した。", "Inscription removed."));
845 /* Remove the incription */
846 o_ptr->inscription = 0;
847 creature_ptr->update |= (PU_COMBINE);
848 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
850 /* .や$の関係で, 再計算が必要なはず -- henkma */
851 creature_ptr->update |= (PU_BONUS);
857 * @brief アイテムの銘を刻むコマンドのメインルーチン
858 * Inscribe an object with a comment
861 void do_cmd_inscribe(player_type *creature_ptr)
865 GAME_TEXT o_name[MAX_NLEN];
869 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
870 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
872 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
875 /* Describe the activity */
876 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
878 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
881 /* Start with nothing */
884 /* Use old inscription */
885 if (o_ptr->inscription)
887 /* Start with the old inscription */
888 strcpy(out_val, quark_str(o_ptr->inscription));
891 /* Get a new inscription (possibly empty) */
892 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
894 /* Save the inscription */
895 o_ptr->inscription = quark_add(out_val);
896 creature_ptr->update |= (PU_COMBINE);
897 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
899 /* .や$の関係で, 再計算が必要なはず -- henkma */
900 creature_ptr->update |= (PU_BONUS);
906 * @brief ランタンに燃料を加えるコマンドのメインルーチン
907 * Refill the players lamp (from the pack or floor)
910 static void do_cmd_refill_lamp(player_type *user_ptr)
917 /* Restrict the choices */
918 item_tester_hook = item_tester_refill_lantern;
920 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
921 s = _("油つぼがない。", "You have no flasks of oil.");
923 o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
926 take_turn(user_ptr, 50);
928 /* Access the lantern */
929 j_ptr = &user_ptr->inventory_list[INVEN_LITE];
932 j_ptr->xtra4 += o_ptr->xtra4;
933 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
935 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
938 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
940 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
943 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
945 else if (j_ptr->xtra4 >= FUEL_LAMP)
947 j_ptr->xtra4 = FUEL_LAMP;
948 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
951 vary_item(user_ptr, item, -1);
953 user_ptr->update |= (PU_TORCH);
957 * @brief 松明を束ねるコマンドのメインルーチン
958 * Refuel the players torch (from the pack or floor)
961 static void do_cmd_refill_torch(player_type *creature_ptr)
970 /* Restrict the choices */
971 item_tester_hook = object_can_refill_torch;
973 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
974 s = _("他に松明がない。", "You have no extra torches.");
976 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
979 take_turn(creature_ptr, 50);
981 /* Access the primary torch */
982 j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
985 j_ptr->xtra4 += o_ptr->xtra4 + 5;
987 msg_print(_("松明を結合した。", "You combine the torches."));
989 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
992 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
994 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
997 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
999 /* Over-fuel message */
1000 else if (j_ptr->xtra4 >= FUEL_TORCH)
1002 j_ptr->xtra4 = FUEL_TORCH;
1003 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1006 /* Refuel message */
1009 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1012 vary_item(creature_ptr, item, -1);
1014 creature_ptr->update |= (PU_TORCH);
1019 * @brief 燃料を補充するコマンドのメインルーチン
1020 * Refill the players lamp, or restock his torches
1023 void do_cmd_refill(player_type *creature_ptr)
1028 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1030 if (creature_ptr->special_defense & KATA_MUSOU)
1032 set_action(creature_ptr, ACTION_NONE);
1036 if (o_ptr->tval != TV_LITE)
1038 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1042 else if (o_ptr->sval == SV_LITE_LANTERN)
1044 do_cmd_refill_lamp(creature_ptr);
1048 else if (o_ptr->sval == SV_LITE_TORCH)
1050 do_cmd_refill_torch(creature_ptr);
1053 /* No torch to refill */
1056 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1062 * @brief ターゲットを設定するコマンドのメインルーチン
1066 void do_cmd_target(player_type *creature_ptr)
1068 if (creature_ptr->wild_mode) return;
1071 if (target_set(creature_ptr, TARGET_KILL))
1073 msg_print(_("ターゲット決定。", "Target Selected."));
1076 /* Target aborted */
1079 msg_print(_("ターゲット解除。", "Target Aborted."));
1085 * @brief 周囲を見渡すコマンドのメインルーチン
1089 void do_cmd_look(player_type *creature_ptr)
1091 creature_ptr->window |= PW_MONSTER_LIST;
1092 handle_stuff(creature_ptr);
1095 if (target_set(creature_ptr, TARGET_LOOK))
1097 msg_print(_("ターゲット決定。", "Target Selected."));
1103 * @brief 位置を確認するコマンドのメインルーチン
1104 * Allow the player to examine other sectors on the map
1107 void do_cmd_locate(player_type *creature_ptr)
1110 POSITION y1, x1, y2, x2;
1111 GAME_TEXT tmp_val[80];
1112 GAME_TEXT out_val[160];
1115 get_screen_size(&wid, &hgt);
1117 /* Start at current panel */
1118 y2 = y1 = panel_row_min;
1119 x2 = x1 = panel_col_min;
1121 /* Show panels until done */
1124 /* Describe the location */
1125 if ((y2 == y1) && (x2 == x1))
1127 strcpy(tmp_val, _("真上", "\0"));
1131 sprintf(tmp_val, "%s%s",
1132 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1133 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1136 /* Prepare to ask which way to look */
1137 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1138 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1139 y2 / (hgt / 2), y2 % (hgt / 2),
1140 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1142 /* Assume no direction */
1145 /* Get a direction */
1150 /* Get a command (or Cancel) */
1151 if (!get_com(out_val, &command, TRUE)) break;
1153 /* Extract the action (if any) */
1154 dir = get_keymap_dir(command);
1163 /* Apply the motion */
1164 if (change_panel(ddy[dir], ddx[dir]))
1172 /* Recenter the map around the player */
1175 creature_ptr->update |= (PU_MONSTERS);
1176 creature_ptr->redraw |= (PR_MAP);
1177 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1178 handle_stuff(creature_ptr);
1183 * @brief モンスターの思い出を見るコマンドのメインルーチン
1184 * Identify a character, allow recall of monsters
1185 * @param player_ptr プレーヤーへの参照ポインタ
1189 * Several "special" responses recall "multiple" monsters:
1191 * ^U (all unique monsters)
1192 * ^N (all non-unique monsters)
1194 * The responses may be sorted in several ways, see below.
1196 * Note that the player ghosts are ignored.
1199 void do_cmd_query_symbol(player_type *creature_ptr)
1213 bool recall = FALSE;
1218 /* Get a character, or abort */
1219 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1220 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1222 /* Find that character info, and describe it */
1223 for (i = 0; ident_info[i]; ++i)
1225 if (sym == ident_info[i][0]) break;
1227 if (sym == KTRL('A'))
1230 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1232 else if (sym == KTRL('U'))
1235 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1237 else if (sym == KTRL('N'))
1240 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1242 else if (sym == KTRL('R'))
1245 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1247 /* XTRA HACK WHATSEARCH */
1248 else if (sym == KTRL('M'))
1251 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1256 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1258 else if (ident_info[i])
1260 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1264 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1267 /* Display the result */
1270 /* Allocate the "who" array */
1271 C_MAKE(who, max_r_idx, MONRACE_IDX);
1273 /* Collect matching monsters */
1274 for (n = 0, i = 1; i < max_r_idx; i++)
1276 monster_race *r_ptr = &r_info[i];
1278 /* Nothing to recall */
1279 if (!cheat_know && !r_ptr->r_sights) continue;
1281 /* Require non-unique monsters if needed */
1282 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1284 /* Require unique monsters if needed */
1285 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1287 /* Require ridable monsters if needed */
1288 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1290 /* XTRA HACK WHATSEARCH */
1296 for (xx = 0; temp[xx] && xx < 80; xx++)
1299 if (iskanji(temp[xx])) { xx++; continue; }
1301 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1305 strcpy(temp2, r_name + r_ptr->E_name);
1307 strcpy(temp2, r_name + r_ptr->name);
1309 for (xx = 0; temp2[xx] && xx < 80; xx++)
1310 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1313 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1315 if (my_strstr(temp2, temp))
1320 /* Collect "appropriate" monsters */
1321 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1324 /* Nothing to recall */
1327 C_KILL(who, max_r_idx, MONRACE_IDX);
1332 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1340 /* Sort the array */
1341 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1343 /* Sort by kills (and level) */
1350 /* Catch "escape" */
1353 C_KILL(who, max_r_idx, MONRACE_IDX);
1357 /* Sort if needed */
1360 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1363 /* Start at the end */
1366 /* Scan the monster memory */
1371 /* Hack -- Auto-recall */
1372 monster_race_track(r_idx);
1373 handle_stuff(creature_ptr);
1382 /* Recall on screen */
1383 screen_roff(who[i], 0);
1386 /* Hack -- Begin the prompt */
1389 /* Hack -- Complete the prompt */
1390 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1400 /* Normal commands */
1401 if (query != 'r') break;
1407 if (query == ESCAPE) break;
1409 /* Move to "prev" monster */
1415 if (!expand_list) break;
1419 /* Move to "next" monster */
1425 if (!expand_list) break;
1430 /* Free the "who" array */
1431 C_KILL(who, max_r_idx, IDX);
1433 /* Re-display the identity */
1438 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1442 * XXX - Add actions for other item types
1444 void do_cmd_use(player_type *creature_ptr)
1450 if (creature_ptr->wild_mode)
1455 if (cmd_limit_arena(creature_ptr)) return;
1457 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1459 set_action(creature_ptr, ACTION_NONE);
1462 item_tester_hook = item_tester_hook_use;
1464 q = _("どれを使いますか?", "Use which item? ");
1465 s = _("使えるものがありません。", "You have nothing to use.");
1467 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1470 switch (o_ptr->tval)
1473 do_cmd_spike(creature_ptr);
1477 exe_eat_food(creature_ptr, item);
1481 exe_aim_wand(creature_ptr, item);
1485 exe_use_staff(creature_ptr, item);
1489 exe_zap_rod(creature_ptr, item);
1493 exe_quaff_potion(creature_ptr, item);
1497 if (cmd_limit_blind(creature_ptr)) return;
1498 if (cmd_limit_confused(creature_ptr)) return;
1499 exe_read(creature_ptr, item, TRUE);
1505 exe_fire(creature_ptr, item, &creature_ptr->inventory_list[INVEN_BOW], SP_NONE);
1509 exe_activate(creature_ptr, item);