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.
17 #include "main/sound-definitions-table.h"
22 #include "cmd-activate.h"
24 #include "cmd-quaff.h"
26 #include "cmd-usestaff.h"
27 #include "cmd-zaprod.h"
28 #include "cmd-zapwand.h"
30 #include "cmd-basic.h"
32 #include "object-flavor.h"
33 #include "object-hook.h"
34 #include "object-ego.h"
39 #include "player-status.h"
40 #include "player-effects.h"
41 #include "player-class.h"
42 #include "player-personality.h"
44 #include "view-mainwindow.h"
46 #include "object/object-kind.h"
48 #include "targeting.h"
50 #include "player-race.h"
51 #include "view-mainwindow.h"
52 #include "player-inventory.h"
55 * @brief 持ち物一覧を表示するコマンドのメインルーチン / Display inventory_list
58 void do_cmd_inven(player_type *creature_ptr)
62 if (easy_floor) command_wrk = (USE_INVEN);
64 (void)show_inventory(creature_ptr, 0, USE_FULL, 0);
67 sprintf(out_val, "持ち物: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
68 (int)lbtokg1(creature_ptr->total_weight) , (int)lbtokg2(creature_ptr->total_weight) ,
70 sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ",
71 (int)(creature_ptr->total_weight / 10), (int)(creature_ptr->total_weight % 10),
73 (long int)(creature_ptr->total_weight * 100) / weight_limit(creature_ptr));
76 command_new = inkey();
79 if (command_new == ESCAPE)
82 Term_get_size(&wid, &hgt);
84 command_gap = wid - 30;
94 * @brief 装備一覧を表示するコマンドのメインルーチン / Display equipment
97 void do_cmd_equip(player_type *creature_ptr)
101 if (easy_floor) command_wrk = (USE_EQUIP);
104 (void)show_equipment(creature_ptr, 0, USE_FULL, 0);
107 sprintf(out_val, "装備: 合計 %3d.%1d kg (限界の%ld%%) コマンド: ",
108 (int)lbtokg1(creature_ptr->total_weight) , (int)lbtokg2(creature_ptr->total_weight) ,
109 (long int)((creature_ptr->total_weight * 100) / weight_limit(creature_ptr)));
111 sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ",
112 (int)(creature_ptr->total_weight / 10), (int)(creature_ptr->total_weight % 10),
113 (long int)((creature_ptr->total_weight * 100) / weight_limit(creature_ptr)));
117 command_new = inkey();
120 if (command_new == ESCAPE)
123 Term_get_size(&wid, &hgt);
125 command_gap = wid - 30;
134 bool select_ring_slot = FALSE;
137 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
138 * @param creature_ptr プレーヤーへの参照ポインタ
141 void do_cmd_wield(player_type *creature_ptr)
143 OBJECT_IDX item, slot;
151 GAME_TEXT o_name[MAX_NLEN];
154 OBJECT_IDX need_switch_wielding = 0;
156 if (creature_ptr->special_defense & KATA_MUSOU)
158 set_action(creature_ptr, ACTION_NONE);
161 /* Restrict the choices */
162 item_tester_hook = item_tester_hook_wear;
164 q = _("どれを装備しますか? ", "Wear/Wield which item? ");
165 s = _("装備可能なアイテムがない。", "You have nothing you can wear or wield.");
167 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
171 slot = wield_slot(creature_ptr, o_ptr);
175 /* Shields and some misc. items */
180 if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
182 /* Restrict the choices */
183 item_tester_hook = item_tester_hook_melee_weapon;
185 /* Choose a weapon from the equipment only */
186 q = _("どちらの武器と取り替えますか?", "Replace which weapon? ");
187 s = _("おっと。", "Oops.");
188 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
189 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
192 else if (has_melee_weapon(creature_ptr, INVEN_LARM)) slot = INVEN_RARM;
194 /* Both arms are already used by non-weapon */
195 else if (creature_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_RARM]) &&
196 creature_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_LARM]))
198 /* Restrict the choices */
199 item_tester_hook = item_tester_hook_mochikae;
202 q = _("どちらの手に装備しますか?", "Equip which hand? ");
203 s = _("おっと。", "Oops.");
204 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
213 /* Asking for dual wielding */
214 if (slot == INVEN_LARM)
216 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
219 else if (!creature_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(creature_ptr, INVEN_LARM))
221 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
224 /* Both arms are already used */
225 else if (creature_ptr->inventory_list[INVEN_LARM].k_idx && creature_ptr->inventory_list[INVEN_RARM].k_idx)
227 /* Restrict the choices */
228 item_tester_hook = item_tester_hook_mochikae;
231 q = _("どちらの手に装備しますか?", "Equip which hand? ");
232 s = _("おっと。", "Oops.");
234 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP), 0)) return;
235 if ((slot == INVEN_LARM) && !has_melee_weapon(creature_ptr, INVEN_RARM))
236 need_switch_wielding = INVEN_RARM;
242 /* Choose a ring slot */
243 if (creature_ptr->inventory_list[INVEN_LEFT].k_idx && creature_ptr->inventory_list[INVEN_RIGHT].k_idx)
245 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
249 q = _("どちらの手に装備しますか?", "Equip which hand? ");
251 s = _("おっと。", "Oops.");
253 /* Restrict the choices */
254 select_ring_slot = TRUE;
256 if (!choose_object(creature_ptr, &slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0))
258 select_ring_slot = FALSE;
261 select_ring_slot = FALSE;
265 /* Prevent wielding into a cursed slot */
266 if (object_is_cursed(&creature_ptr->inventory_list[slot]))
268 object_desc(creature_ptr, o_name, &creature_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
270 msg_format("%s%sは呪われているようだ。", describe_use(creature_ptr, slot), o_name);
272 msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(creature_ptr, slot));
278 ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) ||
279 ((o_ptr->ident & IDENT_SENSE) &&
280 (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED))))
282 char dummy[MAX_NLEN+80];
284 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
285 sprintf(dummy, _("本当に%s{呪われている}を使いますか?", "Really use the %s {cursed}? "), o_name);
287 if (!get_check(dummy)) return;
290 if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
292 char dummy[MAX_NLEN+100];
294 object_desc(creature_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
296 sprintf(dummy, _("%sを装備すると吸血鬼になります。よろしいですか?",
297 "%s will transforms you into a vampire permanently when equiped. Do you become a vampire?"), o_name);
299 if (!get_check(dummy)) return;
302 if (need_switch_wielding && !object_is_cursed(&creature_ptr->inventory_list[need_switch_wielding]))
304 object_type *slot_o_ptr = &creature_ptr->inventory_list[slot];
305 object_type *switch_o_ptr = &creature_ptr->inventory_list[need_switch_wielding];
306 object_type object_tmp;
307 object_type *otmp_ptr = &object_tmp;
308 GAME_TEXT switch_name[MAX_NLEN];
310 object_desc(creature_ptr, switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
312 object_copy(otmp_ptr, switch_o_ptr);
313 object_copy(switch_o_ptr, slot_o_ptr);
314 object_copy(slot_o_ptr, otmp_ptr);
316 msg_format(_("%sを%sに構えなおした。", "You wield %s at %s hand."), switch_name,
317 (slot == INVEN_RARM) ? (left_hander ? _("左手", "left") : _("右手", "right")) :
318 (left_hander ? _("右手", "right") : _("左手", "left")));
319 slot = need_switch_wielding;
322 check_find_art_quest_completion(creature_ptr, o_ptr);
324 if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
326 identify_item(creature_ptr, o_ptr);
328 /* Auto-inscription */
329 autopick_alter_item(creature_ptr, item, FALSE);
332 take_turn(creature_ptr, 100);
335 /* Obtain local object */
336 object_copy(q_ptr, o_ptr);
338 /* Modify quantity */
341 /* Decrease the item (from the pack) */
344 inven_item_increase(creature_ptr, item, -1);
345 inven_item_optimize(creature_ptr, item);
347 /* Decrease the item (from the floor) */
350 floor_item_increase(creature_ptr->current_floor_ptr, 0 - item, -1);
351 floor_item_optimize(creature_ptr, 0 - item);
354 /* Access the wield slot */
355 o_ptr = &creature_ptr->inventory_list[slot];
357 /* Take off existing item */
360 /* Take off existing item */
361 (void)inven_takeoff(creature_ptr, slot, 255);
364 /* Wear the new stuff */
365 object_copy(o_ptr, q_ptr);
367 o_ptr->marked |= OM_TOUCHED;
369 creature_ptr->total_weight += q_ptr->weight;
371 /* Increment the equip counter by hand */
372 creature_ptr->equip_cnt++;
374 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
375 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
376 #define STR_WIELD_ARMS _("%s(%c)を両手で構えた。", "You are wielding %s (%c) with both hands.")
378 /* Where is the item now */
382 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && can_two_hands_wielding(creature_ptr))
383 act = STR_WIELD_ARMS;
385 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
389 if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && can_two_hands_wielding(creature_ptr))
390 act = STR_WIELD_ARMS;
392 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
396 act = _("%s(%c)を射撃用に装備した。", "You are shooting with %s (%c).");
400 act = _("%s(%c)を光源にした。", "Your light source is %s (%c).");
404 act = _("%s(%c)を装備した。", "You are wearing %s (%c).");
408 object_desc(creature_ptr, o_name, o_ptr, 0);
409 msg_format(act, o_name, index_to_label(slot));
412 if (object_is_cursed(o_ptr))
414 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
415 chg_virtue(creature_ptr, V_HARMONY, -1);
418 o_ptr->ident |= (IDENT_SENSE);
421 /* The Stone Mask make the player turn into a vampire! */
422 if ((o_ptr->name1 == ART_STONEMASK) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
424 /* Turn into a vampire */
425 change_race(creature_ptr, RACE_VAMPIRE, "");
428 creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
429 creature_ptr->redraw |= (PR_EQUIPPY);
430 creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
432 calc_android_exp(creature_ptr);
438 * @param owner_ptr プレーヤーへの参照ポインタ
439 * @param item 持ち替えを行いたい装備部位ID
442 void verify_equip_slot(player_type *owner_ptr, INVENTORY_IDX item)
444 object_type *o_ptr, *new_o_ptr;
445 GAME_TEXT o_name[MAX_NLEN];
447 if (item == INVEN_RARM)
449 if (!has_melee_weapon(owner_ptr, INVEN_LARM)) return;
451 o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
452 object_desc(owner_ptr, o_name, o_ptr, 0);
454 if (object_is_cursed(o_ptr))
456 if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
457 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
461 new_o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
462 object_copy(new_o_ptr, o_ptr);
463 owner_ptr->total_weight += o_ptr->weight;
464 inven_item_increase(owner_ptr, INVEN_LARM, -((int)o_ptr->number));
465 inven_item_optimize(owner_ptr, INVEN_LARM);
466 if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
467 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
469 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name,
470 (left_hander ? _("左手", "left") : _("右手", "right")));
474 if (item != INVEN_LARM) return;
476 o_ptr = &owner_ptr->inventory_list[INVEN_RARM];
477 if (o_ptr->k_idx) object_desc(owner_ptr, o_name, o_ptr, 0);
479 if (has_melee_weapon(owner_ptr, INVEN_RARM))
481 if (object_allow_two_hands_wielding(o_ptr) && can_two_hands_wielding(owner_ptr))
482 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
486 if ((empty_hands(owner_ptr, FALSE) & EMPTY_HAND_RARM) || object_is_cursed(o_ptr)) return;
488 new_o_ptr = &owner_ptr->inventory_list[INVEN_LARM];
489 object_copy(new_o_ptr, o_ptr);
490 owner_ptr->total_weight += o_ptr->weight;
491 inven_item_increase(owner_ptr, INVEN_RARM, -((int)o_ptr->number));
492 inven_item_optimize(owner_ptr, INVEN_RARM);
493 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);
498 * @brief 装備を外すコマンドのメインルーチン / Take off an item
501 void do_cmd_takeoff(player_type *creature_ptr)
507 if (creature_ptr->special_defense & KATA_MUSOU)
509 set_action(creature_ptr, ACTION_NONE);
512 q = _("どれを装備からはずしますか? ", "Take off which item? ");
513 s = _("はずせる装備がない。", "You are not wearing anything to take off.");
515 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
519 if (object_is_cursed(o_ptr))
521 if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (creature_ptr->pclass != CLASS_BERSERKER))
523 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
528 if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4))
530 msg_print(_("呪われた装備を力づくで剥がした!", "You tore off a piece of cursed equipment by sheer strength!"));
532 o_ptr->ident |= (IDENT_SENSE);
533 o_ptr->curse_flags = 0L;
534 o_ptr->feeling = FEEL_NONE;
536 creature_ptr->update |= (PU_BONUS);
537 creature_ptr->window |= (PW_EQUIP);
539 msg_print(_("呪いを打ち破った。", "You break the curse."));
543 msg_print(_("装備を外せなかった。", "You couldn't remove the equipment."));
544 take_turn(creature_ptr, 50);
549 take_turn(creature_ptr, 50);
551 /* Take off the item */
552 (void)inven_takeoff(creature_ptr, item, 255);
553 verify_equip_slot(creature_ptr, item);
554 calc_android_exp(creature_ptr);
555 creature_ptr->redraw |= (PR_EQUIPPY);
560 * @brief アイテムを落とすコマンドのメインルーチン / Drop an item
563 void do_cmd_drop(player_type *creature_ptr)
572 if (creature_ptr->special_defense & KATA_MUSOU)
574 set_action(creature_ptr, ACTION_NONE);
577 q = _("どのアイテムを落としますか? ", "Drop which item? ");
578 s = _("落とせるアイテムを持っていない。", "You have nothing to drop.");
580 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT), 0);
583 /* Hack -- Cannot remove cursed items */
584 if ((item >= INVEN_RARM) && object_is_cursed(o_ptr))
586 msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
590 if (o_ptr->number > 1)
592 amt = get_quantity(NULL, o_ptr->number);
593 if (amt <= 0) return;
596 take_turn(creature_ptr, 50);
598 /* Drop (some of) the item */
599 drop_from_inventory(creature_ptr, item, amt);
601 if (item >= INVEN_RARM)
603 verify_equip_slot(creature_ptr, item);
604 calc_android_exp(creature_ptr);
607 creature_ptr->redraw |= (PR_EQUIPPY);
612 * @brief アイテムを破壊するコマンドのメインルーチン / Destroy an item
613 * @param creature_ptr プレーヤーへの参照ポインタ
616 void do_cmd_destroy(player_type *creature_ptr)
626 object_type *q_ptr = &forge;
628 GAME_TEXT o_name[MAX_NLEN];
629 char out_val[MAX_NLEN+40];
633 if (creature_ptr->special_defense & KATA_MUSOU)
635 set_action(creature_ptr, ACTION_NONE);
638 /* Hack -- force destruction */
639 if (command_arg > 0) force = TRUE;
641 q = _("どのアイテムを壊しますか? ", "Destroy which item? ");
642 s = _("壊せるアイテムを持っていない。", "You have nothing to destroy.");
644 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
647 /* Verify unless quantity given beforehand */
648 if (!force && (confirm_destroy || (object_value(o_ptr) > 0)))
650 object_desc(creature_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
652 /* Make a verification */
653 sprintf(out_val, _("本当に%sを壊しますか? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name);
656 /* HACK : Add the line to message buffer */
657 message_add(out_val);
658 creature_ptr->window |= (PW_MESSAGE);
659 handle_stuff(creature_ptr);
661 /* Get an acceptable answer */
671 /* Erase the prompt */
675 if (i == 'y' || i == 'Y')
679 if (i == ESCAPE || i == 'n' || i == 'N')
686 /* Add an auto-destroy preference line */
687 if (autopick_autoregister(creature_ptr, o_ptr))
689 /* Auto-destroy it */
690 autopick_alter_item(creature_ptr, item, TRUE);
693 /* The object is already destroyed. */
699 if (o_ptr->number > 1)
701 amt = get_quantity(NULL, o_ptr->number);
702 if (amt <= 0) return;
706 old_number = o_ptr->number;
708 object_desc(creature_ptr, o_name, o_ptr, 0);
709 o_ptr->number = old_number;
711 take_turn(creature_ptr, 100);
713 /* Artifacts cannot be destroyed */
714 if (!can_player_destroy_object(o_ptr))
716 free_turn(creature_ptr);
718 msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name);
722 object_copy(q_ptr, o_ptr);
724 msg_format(_("%sを壊した。", "You destroy %s."), o_name);
725 sound(SOUND_DESTITEM);
727 /* Reduce the charges of rods/wands */
728 reduce_charges(o_ptr, amt);
730 vary_item(creature_ptr, item, -amt);
732 if (item_tester_high_level_book(q_ptr))
734 bool gain_expr = FALSE;
736 if (creature_ptr->prace == RACE_ANDROID)
739 else if ((creature_ptr->pclass == CLASS_WARRIOR) || (creature_ptr->pclass == CLASS_BERSERKER))
743 else if (creature_ptr->pclass == CLASS_PALADIN)
745 if (is_good_realm(creature_ptr->realm1))
747 if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
751 if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE;
755 if (gain_expr && (creature_ptr->exp < PY_MAX_EXP))
757 s32b tester_exp = creature_ptr->max_exp / 20;
758 if (tester_exp > 10000) tester_exp = 10000;
759 if (q_ptr->sval < 3) tester_exp /= 4;
760 if (tester_exp<1) tester_exp = 1;
762 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
763 gain_exp(creature_ptr, tester_exp * amt);
765 if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK)
767 chg_virtue(creature_ptr, V_UNLIFE, 1);
768 chg_virtue(creature_ptr, V_VITALITY, -1);
770 else if (item_tester_high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK)
772 chg_virtue(creature_ptr, V_UNLIFE, -1);
773 chg_virtue(creature_ptr, V_VITALITY, 1);
776 if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d)
777 chg_virtue(creature_ptr, V_ENCHANT, -1);
779 if (object_value_real(q_ptr) > 30000)
780 chg_virtue(creature_ptr, V_SACRIFICE, 2);
782 else if (object_value_real(q_ptr) > 10000)
783 chg_virtue(creature_ptr, V_SACRIFICE, 1);
786 if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0)
787 chg_virtue(creature_ptr, V_HARMONY, 1);
789 if (item >= INVEN_RARM) calc_android_exp(creature_ptr);
794 * @brief アイテムを調査するコマンドのメインルーチン / Observe an item which has been *identify*-ed
797 void do_cmd_observe(player_type *creature_ptr)
801 GAME_TEXT o_name[MAX_NLEN];
804 q = _("どのアイテムを調べますか? ", "Examine which item? ");
805 s = _("調べられるアイテムがない。", "You have nothing to examine.");
807 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
810 /* Require full knowledge */
811 if (!OBJECT_IS_FULL_KNOWN(o_ptr))
813 msg_print(_("このアイテムについて特に知っていることはない。", "You have no special knowledge about that item."));
817 object_desc(creature_ptr, o_name, o_ptr, 0);
818 msg_format(_("%sを調べている...", "Examining %s..."), o_name);
819 if (!screen_object(creature_ptr, o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("特に変わったところはないようだ。", "You see nothing special."));
825 * @brief アイテムの銘を消すコマンドのメインルーチン
826 * Remove the inscription from an object XXX Mention item (when done)?
829 void do_cmd_uninscribe(player_type *creature_ptr)
835 q = _("どのアイテムの銘を消しますか? ", "Un-inscribe which item? ");
836 s = _("銘を消せるアイテムがない。", "You have nothing to un-inscribe.");
838 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
841 /* Nothing to remove */
842 if (!o_ptr->inscription)
844 msg_print(_("このアイテムには消すべき銘がない。", "That item had no inscription to remove."));
848 msg_print(_("銘を消した。", "Inscription removed."));
850 /* Remove the incription */
851 o_ptr->inscription = 0;
852 creature_ptr->update |= (PU_COMBINE);
853 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
855 /* .や$の関係で, 再計算が必要なはず -- henkma */
856 creature_ptr->update |= (PU_BONUS);
862 * @brief アイテムの銘を刻むコマンドのメインルーチン
863 * Inscribe an object with a comment
866 void do_cmd_inscribe(player_type *creature_ptr)
870 GAME_TEXT o_name[MAX_NLEN];
874 q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
875 s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
877 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
880 /* Describe the activity */
881 object_desc(creature_ptr, o_name, o_ptr, OD_OMIT_INSCRIPTION);
883 msg_format(_("%sに銘を刻む。", "Inscribing %s."), o_name);
886 /* Start with nothing */
889 /* Use old inscription */
890 if (o_ptr->inscription)
892 /* Start with the old inscription */
893 strcpy(out_val, quark_str(o_ptr->inscription));
896 /* Get a new inscription (possibly empty) */
897 if (get_string(_("銘: ", "Inscription: "), out_val, 80))
899 /* Save the inscription */
900 o_ptr->inscription = quark_add(out_val);
901 creature_ptr->update |= (PU_COMBINE);
902 creature_ptr->window |= (PW_INVEN | PW_EQUIP);
904 /* .や$の関係で, 再計算が必要なはず -- henkma */
905 creature_ptr->update |= (PU_BONUS);
911 * @brief ランタンに燃料を加えるコマンドのメインルーチン
912 * Refill the players lamp (from the pack or floor)
915 static void do_cmd_refill_lamp(player_type *user_ptr)
922 /* Restrict the choices */
923 item_tester_hook = item_tester_refill_lantern;
925 q = _("どの油つぼから注ぎますか? ", "Refill with which flask? ");
926 s = _("油つぼがない。", "You have no flasks of oil.");
928 o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
931 take_turn(user_ptr, 50);
933 /* Access the lantern */
934 j_ptr = &user_ptr->inventory_list[INVEN_LITE];
937 j_ptr->xtra4 += o_ptr->xtra4;
938 msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
940 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
943 msg_print(_("ランプが消えてしまった!", "Your lamp has gone out!"));
945 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
948 msg_print(_("しかしランプは全く光らない。", "Curiously, your lamp doesn't light."));
950 else if (j_ptr->xtra4 >= FUEL_LAMP)
952 j_ptr->xtra4 = FUEL_LAMP;
953 msg_print(_("ランプの油は一杯だ。", "Your lamp is full."));
956 vary_item(user_ptr, item, -1);
958 user_ptr->update |= (PU_TORCH);
962 * @brief 松明を束ねるコマンドのメインルーチン
963 * Refuel the players torch (from the pack or floor)
966 static void do_cmd_refill_torch(player_type *creature_ptr)
975 /* Restrict the choices */
976 item_tester_hook = object_can_refill_torch;
978 q = _("どの松明で明かりを強めますか? ", "Refuel with which torch? ");
979 s = _("他に松明がない。", "You have no extra torches.");
981 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
984 take_turn(creature_ptr, 50);
986 /* Access the primary torch */
987 j_ptr = &creature_ptr->inventory_list[INVEN_LITE];
990 j_ptr->xtra4 += o_ptr->xtra4 + 5;
992 msg_print(_("松明を結合した。", "You combine the torches."));
994 if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0))
997 msg_print(_("松明が消えてしまった!", "Your torch has gone out!"));
999 else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS))
1002 msg_print(_("しかし松明は全く光らない。", "Curiously, your torch doesn't light."));
1004 /* Over-fuel message */
1005 else if (j_ptr->xtra4 >= FUEL_TORCH)
1007 j_ptr->xtra4 = FUEL_TORCH;
1008 msg_print(_("松明の寿命は十分だ。", "Your torch is fully fueled."));
1011 /* Refuel message */
1014 msg_print(_("松明はいっそう明るく輝いた。", "Your torch glows more brightly."));
1017 vary_item(creature_ptr, item, -1);
1019 creature_ptr->update |= (PU_TORCH);
1024 * @brief 燃料を補充するコマンドのメインルーチン
1025 * Refill the players lamp, or restock his torches
1028 void do_cmd_refill(player_type *creature_ptr)
1033 o_ptr = &creature_ptr->inventory_list[INVEN_LITE];
1035 if (creature_ptr->special_defense & KATA_MUSOU)
1037 set_action(creature_ptr, ACTION_NONE);
1041 if (o_ptr->tval != TV_LITE)
1043 msg_print(_("光源を装備していない。", "You are not wielding a light."));
1047 else if (o_ptr->sval == SV_LITE_LANTERN)
1049 do_cmd_refill_lamp(creature_ptr);
1053 else if (o_ptr->sval == SV_LITE_TORCH)
1055 do_cmd_refill_torch(creature_ptr);
1058 /* No torch to refill */
1061 msg_print(_("この光源は寿命を延ばせない。", "Your light cannot be refilled."));
1067 * @brief ターゲットを設定するコマンドのメインルーチン
1071 void do_cmd_target(player_type *creature_ptr)
1073 if (creature_ptr->wild_mode) return;
1076 if (target_set(creature_ptr, TARGET_KILL))
1078 msg_print(_("ターゲット決定。", "Target Selected."));
1081 /* Target aborted */
1084 msg_print(_("ターゲット解除。", "Target Aborted."));
1090 * @brief 周囲を見渡すコマンドのメインルーチン
1094 void do_cmd_look(player_type *creature_ptr)
1096 creature_ptr->window |= PW_MONSTER_LIST;
1097 handle_stuff(creature_ptr);
1100 if (target_set(creature_ptr, TARGET_LOOK))
1102 msg_print(_("ターゲット決定。", "Target Selected."));
1108 * @brief 位置を確認するコマンドのメインルーチン
1109 * Allow the player to examine other sectors on the map
1112 void do_cmd_locate(player_type *creature_ptr)
1115 POSITION y1, x1, y2, x2;
1116 GAME_TEXT tmp_val[80];
1117 GAME_TEXT out_val[160];
1120 get_screen_size(&wid, &hgt);
1122 /* Start at current panel */
1123 y2 = y1 = panel_row_min;
1124 x2 = x1 = panel_col_min;
1126 /* Show panels until done */
1129 /* Describe the location */
1130 if ((y2 == y1) && (x2 == x1))
1132 strcpy(tmp_val, _("真上", "\0"));
1136 sprintf(tmp_val, "%s%s",
1137 ((y2 < y1) ? _("北", " North") : (y2 > y1) ? _("南", " South") : ""),
1138 ((x2 < x1) ? _("西", " West") : (x2 > x1) ? _("東", " East") : ""));
1141 /* Prepare to ask which way to look */
1142 sprintf(out_val, _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?",
1143 "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?"),
1144 y2 / (hgt / 2), y2 % (hgt / 2),
1145 x2 / (wid / 2), x2 % (wid / 2), tmp_val);
1147 /* Assume no direction */
1150 /* Get a direction */
1155 /* Get a command (or Cancel) */
1156 if (!get_com(out_val, &command, TRUE)) break;
1158 /* Extract the action (if any) */
1159 dir = get_keymap_dir(command);
1168 /* Apply the motion */
1169 if (change_panel(creature_ptr, ddy[dir], ddx[dir]))
1177 /* Recenter the map around the player */
1178 verify_panel(creature_ptr);
1180 creature_ptr->update |= (PU_MONSTERS);
1181 creature_ptr->redraw |= (PR_MAP);
1182 creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1183 handle_stuff(creature_ptr);
1188 * @brief モンスターの思い出を見るコマンドのメインルーチン
1189 * Identify a character, allow recall of monsters
1190 * @param player_ptr プレーヤーへの参照ポインタ
1194 * Several "special" responses recall "multiple" monsters:
1196 * ^U (all unique monsters)
1197 * ^N (all non-unique monsters)
1199 * The responses may be sorted in several ways, see below.
1201 * Note that the player ghosts are ignored.
1204 void do_cmd_query_symbol(player_type *creature_ptr)
1218 bool recall = FALSE;
1223 /* Get a character, or abort */
1224 if (!get_com(_("知りたい文字を入力して下さい(記号 or ^A全,^Uユ,^N非ユ,^R乗馬,^M名前): ",
1225 "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return;
1227 /* Find that character info, and describe it */
1228 for (i = 0; ident_info[i]; ++i)
1230 if (sym == ident_info[i][0]) break;
1232 if (sym == KTRL('A'))
1235 strcpy(buf, _("全モンスターのリスト", "Full monster list."));
1237 else if (sym == KTRL('U'))
1240 strcpy(buf, _("ユニーク・モンスターのリスト", "Unique monster list."));
1242 else if (sym == KTRL('N'))
1245 strcpy(buf, _("ユニーク外モンスターのリスト", "Non-unique monster list."));
1247 else if (sym == KTRL('R'))
1250 strcpy(buf, _("乗馬可能モンスターのリスト", "Ridable monster list."));
1252 /* XTRA HACK WHATSEARCH */
1253 else if (sym == KTRL('M'))
1256 if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
1261 sprintf(buf, _("名前:%sにマッチ", "Monsters with a name \"%s\""),temp);
1263 else if (ident_info[i])
1265 sprintf(buf, "%c - %s.", sym, ident_info[i] + 2);
1269 sprintf(buf, "%c - %s", sym, _("無効な文字", "Unknown Symbol"));
1272 /* Display the result */
1275 /* Allocate the "who" array */
1276 C_MAKE(who, max_r_idx, MONRACE_IDX);
1278 /* Collect matching monsters */
1279 for (n = 0, i = 1; i < max_r_idx; i++)
1281 monster_race *r_ptr = &r_info[i];
1283 /* Nothing to recall */
1284 if (!cheat_know && !r_ptr->r_sights) continue;
1286 /* Require non-unique monsters if needed */
1287 if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue;
1289 /* Require unique monsters if needed */
1290 if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue;
1292 /* Require ridable monsters if needed */
1293 if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue;
1295 /* XTRA HACK WHATSEARCH */
1301 for (xx = 0; temp[xx] && xx < 80; xx++)
1304 if (iskanji(temp[xx])) { xx++; continue; }
1306 if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]);
1310 strcpy(temp2, r_name + r_ptr->E_name);
1312 strcpy(temp2, r_name + r_ptr->name);
1314 for (xx = 0; temp2[xx] && xx < 80; xx++)
1315 if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]);
1318 if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
1320 if (my_strstr(temp2, temp))
1325 /* Collect "appropriate" monsters */
1326 else if (all || (r_ptr->d_char == sym)) who[n++] = i;
1329 /* Nothing to recall */
1332 C_KILL(who, max_r_idx, MONRACE_IDX);
1337 put_str(_("思い出を見ますか? (k:殺害順/y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40));
1345 /* Sort the array */
1346 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1348 /* Sort by kills (and level) */
1355 /* Catch "escape" */
1358 C_KILL(who, max_r_idx, MONRACE_IDX);
1362 /* Sort if needed */
1365 ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
1368 /* Start at the end */
1371 /* Scan the monster memory */
1376 /* Hack -- Auto-recall */
1377 monster_race_track(creature_ptr, r_idx);
1378 handle_stuff(creature_ptr);
1387 /* Recall on screen */
1388 screen_roff(creature_ptr, who[i], 0);
1391 /* Hack -- Begin the prompt */
1394 /* Hack -- Complete the prompt */
1395 Term_addstr(-1, TERM_WHITE, _(" ['r'思い出, ESC]", " [(r)ecall, ESC]"));
1405 /* Normal commands */
1406 if (query != 'r') break;
1412 if (query == ESCAPE) break;
1414 /* Move to "prev" monster */
1420 if (!expand_list) break;
1424 /* Move to "next" monster */
1430 if (!expand_list) break;
1435 /* Free the "who" array */
1436 C_KILL(who, max_r_idx, IDX);
1438 /* Re-display the identity */
1443 * @brief アイテムを汎用的に「使う」コマンドのメインルーチン /
1447 * XXX - Add actions for other item types
1449 void do_cmd_use(player_type *creature_ptr)
1455 if (creature_ptr->wild_mode)
1460 if (cmd_limit_arena(creature_ptr)) return;
1462 if (creature_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
1464 set_action(creature_ptr, ACTION_NONE);
1467 item_tester_hook = item_tester_hook_use;
1469 q = _("どれを使いますか?", "Use which item? ");
1470 s = _("使えるものがありません。", "You have nothing to use.");
1472 o_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
1475 switch (o_ptr->tval)
1478 do_cmd_spike(creature_ptr);
1482 exe_eat_food(creature_ptr, item);
1486 exe_aim_wand(creature_ptr, item);
1490 exe_use_staff(creature_ptr, item);
1494 exe_zap_rod(creature_ptr, item);
1498 exe_quaff_potion(creature_ptr, item);
1502 if (cmd_limit_blind(creature_ptr)) return;
1503 if (cmd_limit_confused(creature_ptr)) return;
1504 exe_read(creature_ptr, item, TRUE);
1510 exe_fire(creature_ptr, item, &creature_ptr->inventory_list[INVEN_BOW], SP_NONE);
1514 exe_activate(creature_ptr, item);