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
137 * @param creature_ptr プレーヤーへの参照ポインタ
140 void do_cmd_wield(player_type *creature_ptr)
142 OBJECT_IDX item, slot;
150 GAME_TEXT o_name[MAX_NLEN];
153 OBJECT_IDX need_switch_wielding = 0;
155 if (creature_ptr->special_defense & KATA_MUSOU)
157 set_action(creature_ptr, ACTION_NONE);
160 /* Restrict the choices */
161 item_tester_hook = item_tester_hook_wear;
163 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
164 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
166 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
170 slot = wield_slot(creature_ptr, o_ptr);
174 /* Shields and some misc. items */
179 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
181 /* Restrict the choices */
182 item_tester_hook = item_tester_hook_melee_weapon;
184 /* Choose a weapon from the equipment only */
185 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
186 s = _("おっと。", "Oops.");
187 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
188 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
191 else if (has_melee_weapon(creature_ptr, INVEN_LARM)) slot = INVEN_RARM;
193 /* Both arms are already used by non-weapon */
194 else if (creature_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_RARM]) &&
195 creature_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_LARM]))
197 /* Restrict the choices */
198 item_tester_hook = item_tester_hook_mochikae;
201 q = _("どちらの手に装備しますか?", "Equip which hand? ");
202 s = _("おっと。", "Oops.");
203 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
212 /* Asking for dual wielding */
213 if (slot == INVEN_LARM)
215 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
218 else if (!creature_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(creature_ptr, INVEN_LARM))
220 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
223 /* Both arms are already used */
224 else if (creature_ptr->inventory_list[INVEN_LARM].k_idx && creature_ptr->inventory_list[INVEN_RARM].k_idx)
226 /* Restrict the choices */
227 item_tester_hook = item_tester_hook_mochikae;
230 q = _("どちらの手に装備しますか?", "Equip which hand? ");
231 s = _("おっと。", "Oops.");
233 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
234 if ((slot == INVEN_LARM) && !has_melee_weapon(creature_ptr, INVEN_RARM))
235 need_switch_wielding = INVEN_RARM;
241 /* Choose a ring slot */
242 if (creature_ptr->inventory_list[INVEN_LEFT].k_idx && creature_ptr->inventory_list[INVEN_RIGHT].k_idx)
244 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
248 q = _("どちらの手に装備しますか?", "Equip which hand? ");
250 s = _("おっと。", "Oops.");
252 /* Restrict the choices */
253 select_ring_slot = TRUE;
255 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0))
257 select_ring_slot = FALSE;
260 select_ring_slot = FALSE;
264 /* Prevent wielding into a cursed slot */
265 if (object_is_cursed(&creature_ptr->inventory_list[slot]))
267 object_desc(o_name, &creature_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
269 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
271 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot));
277 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
278 ((o_ptr->ident & IDENT_SENSE) &&
279 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
281 char dummy[MAX_NLEN+80];
283 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
284 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
286 if (!get_check(dummy)) return;
289 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
291 char dummy[MAX_NLEN+100];
293 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
295 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
296 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
298 if (!get_check(dummy)) return;
301 if (need_switch_wielding && !object_is_cursed(&creature_ptr->inventory_list[need_switch_wielding]))
303 object_type *slot_o_ptr = &creature_ptr->inventory_list[slot];
304 object_type *switch_o_ptr = &creature_ptr->inventory_list[need_switch_wielding];
305 object_type object_tmp;
306 object_type *otmp_ptr = &object_tmp;
307 GAME_TEXT switch_name[MAX_NLEN];
309 object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
311 object_copy(otmp_ptr, switch_o_ptr);
312 object_copy(switch_o_ptr, slot_o_ptr);
313 object_copy(slot_o_ptr, otmp_ptr);
315 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
316 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
317 (left_hander ? _("右手", "right") : _("左手", "left")));
318 slot = need_switch_wielding;
321 check_find_art_quest_completion(o_ptr);
323 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
325 identify_item(creature_ptr, o_ptr);
327 /* Auto-inscription */
328 autopick_alter_item(creature_ptr, item, FALSE);
331 take_turn(creature_ptr, 100);
334 /* Obtain local object */
335 object_copy(q_ptr, o_ptr);
337 /* Modify quantity */
340 /* Decrease the item (from the pack) */
343 inven_item_increase(creature_ptr, item, -1);
344 inven_item_optimize(creature_ptr, item);
346 /* Decrease the item (from the floor) */
349 floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
350 floor_item_optimize(creature_ptr->current_floor_ptr, 0 - item);
353 /* Access the wield slot */
354 o_ptr = &creature_ptr->inventory_list[slot];
356 /* Take off existing item */
359 /* Take off existing item */
360 (void)inven_takeoff(creature_ptr, slot, 255);
363 /* Wear the new stuff */
364 object_copy(o_ptr, q_ptr);
366 o_ptr->marked |= OM_TOUCHED;
368 creature_ptr->total_weight += q_ptr->weight;
370 /* Increment the equip counter by hand */
371 creature_ptr->equip_cnt++;
373 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
374 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
375 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
377 /* Where is the item now */
381 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
382 act = STR_WIELD_ARMS;
384 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
388 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
389 act = STR_WIELD_ARMS;
391 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
395 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
399 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
403 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
407 object_desc(o_name, o_ptr, 0);
408 msg_format(act, o_name, index_to_label(slot));
411 if (object_is_cursed(o_ptr))
413 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
414 chg_virtue(creature_ptr, V_HARMONY, -1);
417 o_ptr->ident |= (IDENT_SENSE);
420 /* The Stone Mask make the player turn into a vampire! */
421 if ((o_ptr->name1 == ART_STONEMASK) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
423 /* Turn into a vampire */
424 change_race(creature_ptr, RACE_VAMPIRE, "");
427 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
428 creature_ptr->redraw |= (PR_EQUIPPY);
429 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
431 calc_android_exp(creature_ptr);
436 * @param item 持ち替えを行いたい装備部位ID
439 void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
441 object_type *o_ptr, *new_o_ptr;
442 GAME_TEXT o_name[MAX_NLEN];
444 if (item == INVEN_RARM)
446 if (!has_melee_weapon(owner_ptr, INVEN_LARM)) return;
448 o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
449 object_desc(o_name, o_ptr, 0);
451 if (object_is_cursed(o_ptr))
453 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
454 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
458 new_o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
459 object_copy(new_o_ptr, o_ptr);
460 owner_ptr->total_weight += o_ptr->weight;
461 inven_item_increase(owner_ptr, INVEN_LARM, -((int)o_ptr->number));
462 inven_item_optimize(owner_ptr, INVEN_LARM);
463 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
464 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
466 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
467 (left_hander ? _("左手", "left") : _("右手", "right")));
471 if (item != INVEN_LARM) return;
473 o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
474 if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0);
476 if (has_melee_weapon(owner_ptr, INVEN_RARM))
478 if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING())
479 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
483 if ((empty_hands(owner_ptr, FALSE) & EMPTY_HAND_RARM) || object_is_cursed(o_ptr)) return;
485 new_o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
486 object_copy(new_o_ptr, o_ptr);
487 owner_ptr->total_weight += o_ptr->weight;
488 inven_item_increase(owner_ptr, INVEN_RARM, -((int)o_ptr->number));
489 inven_item_optimize(owner_ptr, INVEN_RARM);
490 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
495 * @brief 装備を外すコマンドのメインルーチン / Take off an item
498 void do_cmd_takeoff(player_type *creature_ptr)
504 if (creature_ptr->special_defense & KATA_MUSOU)
506 set_action(creature_ptr, ACTION_NONE);
509 q = _("どれを装備からはずしますか? ", "Take off which item? ");
510 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
512 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
516 if (object_is_cursed(o_ptr))
518 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (creature_ptr->pclass != CLASS_BERSERKER))
520 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
525 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
527 msg_print(_("呪われた装備を力づくで剥がした!", "You teared a cursed equipment off by sheer strength!"));
529 o_ptr->ident |= (IDENT_SENSE);
530 o_ptr->curse_flags = 0L;
531 o_ptr->feeling = FEEL_NONE;
533 creature_ptr->update |= (PU_BONUS);
534 creature_ptr->window |= (PW_EQUIP);
536 msg_print(_("呪いを打ち破った。", "You break the curse."));
540 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
541 take_turn(creature_ptr, 50);
546 take_turn(creature_ptr, 50);
548 /* Take off the item */
549 (void)inven_takeoff(creature_ptr, item, 255);
550 verify_equip_slot(creature_ptr, item);
551 calc_android_exp(creature_ptr);
552 creature_ptr->redraw |= (PR_EQUIPPY);
557 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
560 void do_cmd_drop(player_type *creature_ptr)
569 if (creature_ptr->special_defense & KATA_MUSOU)
571 set_action(creature_ptr, ACTION_NONE);
574 q = _("どのアイテムを落としますか? ", "Drop which item? ");
575 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
577 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
580 /* Hack -- Cannot remove cursed items */
581 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
583 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
587 if (o_ptr->number > 1)
589 amt = get_quantity(NULL, o_ptr->number);
590 if (amt <= 0) return;
593 take_turn(creature_ptr, 50);
595 /* Drop (some of) the item */
596 drop_from_inventory(creature_ptr, item, amt);
598 if (item >= INVEN_RARM)
600 verify_equip_slot(creature_ptr, item);
601 calc_android_exp(creature_ptr);
604 creature_ptr->redraw |= (PR_EQUIPPY);
609 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
610 * @param creature_ptr プレーヤーへの参照ポインタ
613 void do_cmd_destroy(player_type *creature_ptr)
623 object_type *q_ptr = &forge;
625 GAME_TEXT o_name[MAX_NLEN];
626 char out_val[MAX_NLEN+40];
630 if (creature_ptr->special_defense & KATA_MUSOU)
632 set_action(creature_ptr, ACTION_NONE);
635 /* Hack -- force destruction */
636 if (command_arg > 0) force = TRUE;
638 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
639 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
641 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
644 /* Verify unless quantity given beforehand */
645 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
647 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
649 /* Make a verification */
650 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
653 /* HACK : Add the line to message buffer */
654 message_add(out_val);
655 creature_ptr->window |= (PW_MESSAGE);
656 handle_stuff(creature_ptr);
658 /* Get an acceptable answer */
668 /* Erase the prompt */
672 if (i == 'y' || i == 'Y')
676 if (i == ESCAPE || i == 'n' || i == 'N')
683 /* Add an auto-destroy preference line */
684 if (autopick_autoregister(creature_ptr, o_ptr))
686 /* Auto-destroy it */
687 autopick_alter_item(creature_ptr, item, TRUE);
690 /* The object is already destroyed. */
696 if (o_ptr->number > 1)
698 amt = get_quantity(NULL, o_ptr->number);
699 if (amt <= 0) return;
703 old_number = o_ptr->number;
705 object_desc(o_name, o_ptr, 0);
706 o_ptr->number = old_number;
708 take_turn(creature_ptr, 100);
710 /* Artifacts cannot be destroyed */
711 if (!can_player_destroy_object(o_ptr))
713 free_turn(creature_ptr);
715 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
719 object_copy(q_ptr, o_ptr);
721 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
722 sound(SOUND_DESTITEM);
724 /* Reduce the charges of rods/wands */
725 reduce_charges(o_ptr, amt);
727 vary_item(creature_ptr, item, -amt);
729 if (item_tester_high_level_book(q_ptr))
731 bool gain_expr = FALSE;
733 if (creature_ptr->prace == RACE_ANDROID)
736 else if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_BERSERKER))
740 else if (creature_ptr->pclass == CLASS_PALADIN)
742 if (is_good_realm(creature_ptr->realm1))
744 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
748 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
752 if (gain_expr && (creature_ptr->exp < PY_MAX_EXP))
754 s32b tester_exp = creature_ptr->max_exp / 20;
755 if (tester_exp > 10000) tester_exp = 10000;
756 if (q_ptr->sval < 3) tester_exp /= 4;
757 if (tester_exp<1) tester_exp = 1;
759 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
760 gain_exp(creature_ptr, tester_exp * amt);
762 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
764 chg_virtue(creature_ptr, V_UNLIFE, 1);
765 chg_virtue(creature_ptr, V_VITALITY, -1);
767 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
769 chg_virtue(creature_ptr, V_UNLIFE, -1);
770 chg_virtue(creature_ptr, V_VITALITY, 1);
773 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
774 chg_virtue(creature_ptr, V_ENCHANT, -1);
776 if (object_value_real(q_ptr) > 30000)
777 chg_virtue(creature_ptr, V_SACRIFICE, 2);
779 else if (object_value_real(q_ptr) > 10000)
780 chg_virtue(creature_ptr, V_SACRIFICE, 1);
783 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
784 chg_virtue(creature_ptr, V_HARMONY, 1);
786 if (item >= INVEN_RARM) calc_android_exp(creature_ptr);
791 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
794 void do_cmd_observe(player_type *creature_ptr)
798 GAME_TEXT o_name[MAX_NLEN];
801 q = _("どのアイテムを調べますか? ", "Examine which item? ");
802 s = _("調べられるアイテムがない。", "You have nothing to examine.");
804 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
807 /* Require full knowledge */
808 if (!(o_ptr->ident & IDENT_MENTAL))
810 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
814 object_desc(o_name, o_ptr, 0);
815 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
816 if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
822 * @brief アイテムの銘を消すコマンドのメインルーチン
823 * Remove the inscription from an object XXX Mention item (when done)?
826 void do_cmd_uninscribe(player_type *creature_ptr)
832 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
833 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
835 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
838 /* Nothing to remove */
839 if (!o_ptr->inscription)
841 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
845 msg_print(_("銘を消した。", "Inscription removed."));
847 /* Remove the incription */
848 o_ptr->inscription = 0;
849 creature_ptr->update |= (PU_COMBINE);
850 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
852 /* .や$の関係で, 再計算が必要なはず -- henkma */
853 creature_ptr->update |= (PU_BONUS);
859 * @brief アイテムの銘を刻むコマンドのメインルーチン
860 * Inscribe an object with a comment
863 void do_cmd_inscribe(player_type *creature_ptr)
867 GAME_TEXT o_name[MAX_NLEN];
871 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
872 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
874 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
877 /* Describe the activity */
878 object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION);
880 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
883 /* Start with nothing */
886 /* Use old inscription */
887 if (o_ptr->inscription)
889 /* Start with the old inscription */
890 strcpy(out_val, quark_str(o_ptr->inscription));
893 /* Get a new inscription (possibly empty) */
894 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
896 /* Save the inscription */
897 o_ptr->inscription = quark_add(out_val);
898 creature_ptr->update |= (PU_COMBINE);
899 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
901 /* .や$の関係で, 再計算が必要なはず -- henkma */
902 creature_ptr->update |= (PU_BONUS);
908 * @brief ランタンに燃料を加えるコマンドのメインルーチン
909 * Refill the players lamp (from the pack or floor)
912 static void do_cmd_refill_lamp(player_type *user_ptr)
919 /* Restrict the choices */
920 item_tester_hook = item_tester_refill_lantern;
922 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
923 s = _("油つぼがない。", "You have no flasks of oil.");
925 o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
928 take_turn(user_ptr, 50);
930 /* Access the lantern */
931 j_ptr = &user_ptr->inventory_list[INVEN_LITE];
934 j_ptr->xtra4 += o_ptr->xtra4;
935 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
937 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
940 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
942 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
945 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
947 else if (j_ptr->xtra4 >= FUEL_LAMP)
949 j_ptr->xtra4 = FUEL_LAMP;
950 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
953 vary_item(user_ptr, item, -1);
955 user_ptr->update |= (PU_TORCH);
959 * @brief 松明を束ねるコマンドのメインルーチン
960 * Refuel the players torch (from the pack or floor)
963 static void do_cmd_refill_torch(player_type *creature_ptr)
972 /* Restrict the choices */
973 item_tester_hook = object_can_refill_torch;
975 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
976 s = _("他に松明がない。", "You have no extra torches.");
978 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
981 take_turn(creature_ptr, 50);
983 /* Access the primary torch */
984 j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
987 j_ptr->xtra4 += o_ptr->xtra4 + 5;
989 msg_print(_("松明を結合した。", "You combine the torches."));
991 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
994 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
996 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
999 msg_print(_("しかし松明は全く光らない。", "Curiously, your torche don't light."));
1001 /* Over-fuel message */
1002 else if (j_ptr->xtra4 >= FUEL_TORCH)
1004 j_ptr->xtra4 = FUEL_TORCH;
1005 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1008 /* Refuel message */
1011 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1014 vary_item(creature_ptr, item, -1);
1016 creature_ptr->update |= (PU_TORCH);
1021 * @brief 燃料を補充するコマンドのメインルーチン
1022 * Refill the players lamp, or restock his torches
1025 void do_cmd_refill(player_type *creature_ptr)
1030 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1032 if (creature_ptr->special_defense & KATA_MUSOU)
1034 set_action(creature_ptr, ACTION_NONE);
1038 if (o_ptr->tval != TV_LITE)
1040 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1044 else if (o_ptr->sval == SV_LITE_LANTERN)
1046 do_cmd_refill_lamp(creature_ptr);
1050 else if (o_ptr->sval == SV_LITE_TORCH)
1052 do_cmd_refill_torch(creature_ptr);
1055 /* No torch to refill */
1058 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1064 * @brief ターゲットを設定するコマンドのメインルーチン
1068 void do_cmd_target(player_type *creature_ptr)
1070 if (creature_ptr->wild_mode) return;
1073 if (target_set(creature_ptr, TARGET_KILL))
1075 msg_print(_("ターゲット決定。", "Target Selected."));
1078 /* Target aborted */
1081 msg_print(_("ターゲット解除。", "Target Aborted."));
1087 * @brief 周囲を見渡すコマンドのメインルーチン
1091 void do_cmd_look(player_type *creature_ptr)
1093 creature_ptr->window |= PW_MONSTER_LIST;
1094 handle_stuff(creature_ptr);
1097 if (target_set(creature_ptr, TARGET_LOOK))
1099 msg_print(_("ターゲット決定。", "Target Selected."));
1105 * @brief 位置を確認するコマンドのメインルーチン
1106 * Allow the player to examine other sectors on the map
1109 void do_cmd_locate(player_type *creature_ptr)
1112 POSITION y1, x1, y2, x2;
1113 GAME_TEXT tmp_val[80];
1114 GAME_TEXT out_val[160];
1117 get_screen_size(&wid, &hgt);
1119 /* Start at current panel */
1120 y2 = y1 = panel_row_min;
1121 x2 = x1 = panel_col_min;
1123 /* Show panels until done */
1126 /* Describe the location */
1127 if ((y2 == y1) && (x2 == x1))
1129 strcpy(tmp_val, _("真上", "\0"));
1133 sprintf(tmp_val, "%s%s",
1134 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1135 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1138 /* Prepare to ask which way to look */
1139 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1140 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1141 y2 / (hgt / 2), y2 % (hgt / 2),
1142 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1144 /* Assume no direction */
1147 /* Get a direction */
1152 /* Get a command (or Cancel) */
1153 if (!get_com(out_val, &command, TRUE)) break;
1155 /* Extract the action (if any) */
1156 dir = get_keymap_dir(command);
1165 /* Apply the motion */
1166 if (change_panel(ddy[dir], ddx[dir]))
1174 /* Recenter the map around the player */
1177 creature_ptr->update |= (PU_MONSTERS);
1178 creature_ptr->redraw |= (PR_MAP);
1179 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1180 handle_stuff(creature_ptr);
1185 * @brief モンスターの思い出を見るコマンドのメインルーチン
1186 * Identify a character, allow recall of monsters
1187 * @param player_ptr プレーヤーへの参照ポインタ
1191 * Several "special" responses recall "multiple" monsters:
1193 * ^U (all unique monsters)
1194 * ^N (all non-unique monsters)
1196 * The responses may be sorted in several ways, see below.
1198 * Note that the player ghosts are ignored.
1201 void do_cmd_query_symbol(player_type *creature_ptr)
1215 bool recall = FALSE;
1220 /* Get a character, or abort */
1221 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1222 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1224 /* Find that character info, and describe it */
1225 for (i = 0; ident_info[i]; ++i)
1227 if (sym == ident_info[i][0]) break;
1229 if (sym == KTRL('A'))
1232 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1234 else if (sym == KTRL('U'))
1237 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1239 else if (sym == KTRL('N'))
1242 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1244 else if (sym == KTRL('R'))
1247 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1249 /* XTRA HACK WHATSEARCH */
1250 else if (sym == KTRL('M'))
1253 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1258 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1260 else if (ident_info[i])
1262 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1266 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1269 /* Display the result */
1272 /* Allocate the "who" array */
1273 C_MAKE(who, max_r_idx, MONRACE_IDX);
1275 /* Collect matching monsters */
1276 for (n = 0, i = 1; i < max_r_idx; i++)
1278 monster_race *r_ptr = &r_info[i];
1280 /* Nothing to recall */
1281 if (!cheat_know && !r_ptr->r_sights) continue;
1283 /* Require non-unique monsters if needed */
1284 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1286 /* Require unique monsters if needed */
1287 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1289 /* Require ridable monsters if needed */
1290 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1292 /* XTRA HACK WHATSEARCH */
1298 for (xx = 0; temp[xx] && xx < 80; xx++)
1301 if (iskanji(temp[xx])) { xx++; continue; }
1303 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1307 strcpy(temp2, r_name + r_ptr->E_name);
1309 strcpy(temp2, r_name + r_ptr->name);
1311 for (xx = 0; temp2[xx] && xx < 80; xx++)
1312 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1315 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1317 if (my_strstr(temp2, temp))
1322 /* Collect "appropriate" monsters */
1323 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1326 /* Nothing to recall */
1329 C_KILL(who, max_r_idx, MONRACE_IDX);
1334 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1342 /* Sort the array */
1343 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1345 /* Sort by kills (and level) */
1352 /* Catch "escape" */
1355 C_KILL(who, max_r_idx, MONRACE_IDX);
1359 /* Sort if needed */
1362 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1365 /* Start at the end */
1368 /* Scan the monster memory */
1373 /* Hack -- Auto-recall */
1374 monster_race_track(r_idx);
1375 handle_stuff(creature_ptr);
1384 /* Recall on screen */
1385 screen_roff(who[i], 0);
1388 /* Hack -- Begin the prompt */
1391 /* Hack -- Complete the prompt */
1392 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1402 /* Normal commands */
1403 if (query != 'r') break;
1409 if (query == ESCAPE) break;
1411 /* Move to "prev" monster */
1417 if (!expand_list) break;
1421 /* Move to "next" monster */
1427 if (!expand_list) break;
1432 /* Free the "who" array */
1433 C_KILL(who, max_r_idx, IDX);
1435 /* Re-display the identity */
1440 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1444 * XXX - Add actions for other item types
1446 void do_cmd_use(player_type *creature_ptr)
1452 if (creature_ptr->wild_mode)
1457 if (cmd_limit_arena(creature_ptr)) return;
1459 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1461 set_action(creature_ptr, ACTION_NONE);
1464 item_tester_hook = item_tester_hook_use;
1466 q = _("どれを使いますか?", "Use which item? ");
1467 s = _("使えるものがありません。", "You have nothing to use.");
1469 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1472 switch (o_ptr->tval)
1475 do_cmd_spike(creature_ptr);
1479 exe_eat_food(creature_ptr, item);
1483 exe_aim_wand(creature_ptr, item);
1487 exe_use_staff(creature_ptr, item);
1491 exe_zap_rod(creature_ptr, item);
1495 exe_quaff_potion(creature_ptr, item);
1499 if (cmd_limit_blind(creature_ptr)) return;
1500 if (cmd_limit_confused(creature_ptr)) return;
1501 exe_read(creature_ptr, item, TRUE);
1507 exe_fire(creature_ptr, item, &creature_ptr->inventory_list[INVEN_BOW], SP_NONE);
1511 exe_activate(creature_ptr, item);