X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd-item.c;h=3e374754db198711c4e736447190ca40c76148ae;hb=refs%2Fheads%2Fmaster;hp=cf5e6b70dfa0a06a23c9968d2decc7442bf1d3d4;hpb=b0a7483c73fd45223e4c263aab7031be1236dac4;p=hengband%2Fhengband.git diff --git a/src/cmd-item.c b/src/cmd-item.c deleted file mode 100644 index cf5e6b70d..000000000 --- a/src/cmd-item.c +++ /dev/null @@ -1,1853 +0,0 @@ -/*! - * @file cmd3.c - * @brief ãã¬ã¤ã¤ã¼ã®ã¢ã¤ãã ã«é¢ããã³ãã³ãã®å®è£ 1 / Inventory commands - * @date 2014/01/02 - * @author - * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke - * - * This software may be copied and distributed for educational, research, - * and not for profit purposes provided that this copyright and statement - * are included in all such copies. Other copyrights may also apply. - */ - - -#include "angband.h" -#include "selfinfo.h" -#include "cmd-activate.h" -#include "cmd-eat.h" -#include "cmd-quaff.h" -#include "cmd-read.h" -#include "cmd-usestaff.h" -#include "cmd-zaprod.h" -#include "cmd-zapwand.h" - -#include "object-hook.h" -#include "sort.h" -#include "quest.h" -#include "artifact.h" -#include "avatar.h" -#include "player-status.h" - - -/*! - * @brief æã¡ç©ä¸è¦§ã表示ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Display inventory - * @return ãªã - */ -void do_cmd_inven(void) -{ - char out_val[160]; - - /* Note that we are in "inventory" mode */ - command_wrk = FALSE; - - /* Note that we are in "inventory" mode */ - if (easy_floor) command_wrk = (USE_INVEN); - screen_save(); - - /* Display the inventory */ - (void)show_inven(0, USE_FULL); - -#ifdef JP - sprintf(out_val, "æã¡ç©ï¼ åè¨ %3d.%1d kg (éçã®%ld%%) ã³ãã³ã: ", - (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) , - (long int)((p_ptr->total_weight * 100) / weight_limit())); -#else - sprintf(out_val, "Inventory: carrying %d.%d pounds (%ld%% of capacity). Command: ", - (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10), - (p_ptr->total_weight * 100) / weight_limit()); -#endif - - prt(out_val, 0, 0); - command_new = inkey(); - screen_load(); - - /* Process "Escape" */ - if (command_new == ESCAPE) - { - int wid, hgt; - - Term_get_size(&wid, &hgt); - - /* Reset stuff */ - command_new = 0; - command_gap = wid - 30; - } - - /* Process normal keys */ - else - { - /* Hack -- Use "display" mode */ - command_see = TRUE; - } -} - - -/*! - * @brief è£ åä¸è¦§ã表示ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Display equipment - * @return ãªã - */ -void do_cmd_equip(void) -{ - char out_val[160]; - - - /* Note that we are in "equipment" mode */ - command_wrk = TRUE; - - /* Note that we are in "equipment" mode */ - if (easy_floor) command_wrk = (USE_EQUIP); - screen_save(); - - (void)show_equip(0, USE_FULL); - - /* Build a prompt */ -#ifdef JP - sprintf(out_val, "è£ åï¼ åè¨ %3d.%1d kg (éçã®%ld%%) ã³ãã³ã: ", - (int)lbtokg1(p_ptr->total_weight) , (int)lbtokg2(p_ptr->total_weight) , - (long int)((p_ptr->total_weight * 100) / weight_limit())); -#else - sprintf(out_val, "Equipment: carrying %d.%d pounds (%ld%% of capacity). Command: ", - (int)(p_ptr->total_weight / 10), (int)(p_ptr->total_weight % 10), - (long int)((p_ptr->total_weight * 100) / weight_limit())); -#endif - - prt(out_val, 0, 0); - command_new = inkey(); - screen_load(); - - /* Process "Escape" */ - if (command_new == ESCAPE) - { - int wid, hgt; - - Term_get_size(&wid, &hgt); - - /* Reset stuff */ - command_new = 0; - command_gap = wid - 30; - } - - /* Process normal keys */ - else - { - /* Enter "display" mode */ - command_see = TRUE; - } -} - - - - -bool select_ring_slot = FALSE; - -/*! - * @brief è£ åããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Wield or wear a single item from the pack or floor - * @return ãªã - */ -void do_cmd_wield(void) -{ - OBJECT_IDX item, slot; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; - - concptr act; - concptr q, s; - - GAME_TEXT o_name[MAX_NLEN]; - - - OBJECT_IDX need_switch_wielding = 0; - - if (p_ptr->special_defense & KATA_MUSOU) - { - set_action(ACTION_NONE); - } - - /* Restrict the choices */ - item_tester_hook = item_tester_hook_wear; - - q = _("ã©ããè£ åãã¾ãã? ", "Wear/Wield which item? "); - s = _("è£ åå¯è½ãªã¢ã¤ãã ããªãã", "You have nothing you can wear or wield."); - - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); - if (!o_ptr) return; - - /* Check the slot */ - slot = wield_slot(o_ptr); - - switch (o_ptr->tval) - { - /* Shields and some misc. items */ - case TV_CAPTURE: - case TV_SHIELD: - case TV_CARD: - /* Dual wielding */ - if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM)) - { - /* Restrict the choices */ - item_tester_hook = item_tester_hook_melee_weapon; - - /* Choose a weapon from the equipment only */ - q = _("ã©ã¡ãã®æ¦å¨ã¨åãæ¿ãã¾ãã?", "Replace which weapon? "); - s = _("ãã£ã¨ã", "Oops."); - if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return; - if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM; - } - - else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM; - - /* Both arms are already used by non-weapon */ - else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) && - inventory[INVEN_LARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_LARM])) - { - /* Restrict the choices */ - item_tester_hook = item_tester_hook_mochikae; - - /* Choose a hand */ - q = _("ã©ã¡ãã®æã«è£ åãã¾ãã?", "Equip which hand? "); - s = _("ãã£ã¨ã", "Oops."); - if (!choose_object(&slot, q, s, (USE_EQUIP))) return; - } - break; - - /* Melee weapons */ - case TV_DIGGING: - case TV_HAFTED: - case TV_POLEARM: - case TV_SWORD: - /* Asking for dual wielding */ - if (slot == INVEN_LARM) - { - if (!get_check(_("äºåæµã§æ¦ãã¾ããï¼", "Dual wielding? "))) slot = INVEN_RARM; - } - - else if (!inventory[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM)) - { - if (!get_check(_("äºåæµã§æ¦ãã¾ããï¼", "Dual wielding? "))) slot = INVEN_LARM; - } - - /* Both arms are already used */ - else if (inventory[INVEN_LARM].k_idx && inventory[INVEN_RARM].k_idx) - { - /* Restrict the choices */ - item_tester_hook = item_tester_hook_mochikae; - - /* Choose a hand */ - q = _("ã©ã¡ãã®æã«è£ åãã¾ãã?", "Equip which hand? "); - s = _("ãã£ã¨ã", "Oops."); - - if (!choose_object(&slot, q, s, (USE_EQUIP))) return; - if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM)) - need_switch_wielding = INVEN_RARM; - } - break; - - /* Rings */ - case TV_RING: - /* Choose a ring slot */ - if (inventory[INVEN_LEFT].k_idx && inventory[INVEN_RIGHT].k_idx) - { - q = _("ã©ã¡ãã®æ輪ã¨åãæ¿ãã¾ãã?", "Replace which ring? "); - } - else - { - q = _("ã©ã¡ãã®æã«è£ åãã¾ãã?", "Equip which hand? "); - } - s = _("ãã£ã¨ã", "Oops."); - - /* Restrict the choices */ - select_ring_slot = TRUE; - - if (!choose_object(&slot, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) - { - select_ring_slot = FALSE; - return; - } - select_ring_slot = FALSE; - break; - } - - /* Prevent wielding into a cursed slot */ - if (object_is_cursed(&inventory[slot])) - { - object_desc(o_name, &inventory[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY)); - -#ifdef JP - msg_format("%s%sã¯åªããã¦ããããã ã", describe_use(slot) , o_name ); -#else - msg_format("The %s you are %s appears to be cursed.", o_name, describe_use(slot)); -#endif - - /* Cancel the command */ - return; - } - - if (confirm_wear && - ((object_is_cursed(o_ptr) && object_is_known(o_ptr)) || - ((o_ptr->ident & IDENT_SENSE) && - (FEEL_BROKEN <= o_ptr->feeling) && (o_ptr->feeling <= FEEL_CURSED)))) - { - char dummy[MAX_NLEN+80]; - - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - sprintf(dummy, _("æ¬å½ã«%s{åªããã¦ãã}ã使ãã¾ããï¼", "Really use the %s {cursed}? "), o_name); - - if (!get_check(dummy)) return; - } - - if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID)) - { - char dummy[MAX_NLEN+80]; - - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - -#ifdef JP - sprintf(dummy, "%sãè£ åããã¨å¸è¡é¬¼ã«ãªãã¾ããããããã§ããï¼", o_name); -#else - msg_format("%s will transforms you into a vampire permanently when equiped.", o_name); - sprintf(dummy, "Do you become a vampire?"); -#endif - - if (!get_check(dummy)) return; - } - - if (need_switch_wielding && !object_is_cursed(&inventory[need_switch_wielding])) - { - object_type *slot_o_ptr = &inventory[slot]; - object_type *switch_o_ptr = &inventory[need_switch_wielding]; - object_type object_tmp; - object_type *otmp_ptr = &object_tmp; - GAME_TEXT switch_name[MAX_NLEN]; - - object_desc(switch_name, switch_o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - object_copy(otmp_ptr, switch_o_ptr); - object_copy(switch_o_ptr, slot_o_ptr); - object_copy(slot_o_ptr, otmp_ptr); - - msg_format(_("%sã%sã«æ§ããªãããã", "You wield %s at %s hand."), switch_name, - (slot == INVEN_RARM) ? (left_hander ? _("å·¦æ", "left") : _("å³æ", "right")) : - (left_hander ? _("å³æ", "right") : _("å·¦æ", "left"))); - slot = need_switch_wielding; - } - - check_find_art_quest_completion(o_ptr); - - if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) - { - identify_item(o_ptr); - - /* Auto-inscription */ - autopick_alter_item(item, FALSE); - } - - p_ptr->energy_use = 100; - q_ptr = &forge; - - /* Obtain local object */ - object_copy(q_ptr, o_ptr); - - /* Modify quantity */ - q_ptr->number = 1; - - /* Decrease the item (from the pack) */ - if (item >= 0) - { - inven_item_increase(item, -1); - inven_item_optimize(item); - } - - /* Decrease the item (from the floor) */ - else - { - floor_item_increase(0 - item, -1); - floor_item_optimize(0 - item); - } - - /* Access the wield slot */ - o_ptr = &inventory[slot]; - - /* Take off existing item */ - if (o_ptr->k_idx) - { - /* Take off existing item */ - (void)inven_takeoff(slot, 255); - } - - /* Wear the new stuff */ - object_copy(o_ptr, q_ptr); - - o_ptr->marked |= OM_TOUCHED; - - p_ptr->total_weight += q_ptr->weight; - - /* Increment the equip counter by hand */ - equip_cnt++; - -#ifdef JP -#define STR_WIELD_RARM "%s(%c)ãå³æã«è£ åããã" -#define STR_WIELD_LARM "%s(%c)ãå·¦æã«è£ åããã" -#define STR_WIELD_ARMS "%s(%c)ã両æã§æ§ããã" -#else -#define STR_WIELD_RARM "You are wielding %s (%c) in your right hand." -#define STR_WIELD_LARM "You are wielding %s (%c) in your left hand." -#define STR_WIELD_ARMS "You are wielding %s (%c) with both hands." -#endif - - /* Where is the item now */ - switch (slot) - { - case INVEN_RARM: - if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING()) - act = STR_WIELD_ARMS; - else - act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM); - break; - - case INVEN_LARM: - if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING()) - act = STR_WIELD_ARMS; - else - act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM); - break; - - case INVEN_BOW: - act = _("%s(%c)ãå°æç¨ã«è£ åããã", "You are shooting with %s (%c)."); - break; - - case INVEN_LITE: - act = _("%s(%c)ãå æºã«ããã", "Your light source is %s (%c)."); - break; - - default: - act = _("%s(%c)ãè£ åããã", "You are wearing %s (%c)."); - break; - } - - object_desc(o_name, o_ptr, 0); - msg_format(act, o_name, index_to_label(slot)); - - /* Cursed! */ - if (object_is_cursed(o_ptr)) - { - msg_print(_("ããï¼ ããã¾ããå·ããï¼", "Oops! It feels deathly cold!")); - chg_virtue(V_HARMONY, -1); - - /* Note the curse */ - o_ptr->ident |= (IDENT_SENSE); - } - - /* The Stone Mask make the player turn into a vampire! */ - if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID)) - { - /* Turn into a vampire */ - change_race(RACE_VAMPIRE, ""); - } - - p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA); - p_ptr->redraw |= (PR_EQUIPPY); - p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); - - calc_android_exp(); -} - -/*! - * @brief æã¡æ¿ãå¦ç - * @param item æã¡æ¿ããè¡ãããè£ åé¨ä½ID - * @return ãªã - */ -void kamaenaoshi(INVENTORY_IDX item) -{ - object_type *o_ptr, *new_o_ptr; - GAME_TEXT o_name[MAX_NLEN]; - - if (item == INVEN_RARM) - { - if (has_melee_weapon(INVEN_LARM)) - { - o_ptr = &inventory[INVEN_LARM]; - object_desc(o_name, o_ptr, 0); - - if (!object_is_cursed(o_ptr)) - { - new_o_ptr = &inventory[INVEN_RARM]; - object_copy(new_o_ptr, o_ptr); - p_ptr->total_weight += o_ptr->weight; - inven_item_increase(INVEN_LARM, -((int)o_ptr->number)); - inven_item_optimize(INVEN_LARM); - if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING()) - msg_format(_("%sã両æã§æ§ããã", "You are wielding %s with both hands."), o_name); - else - msg_format(_("%sã%sã§æ§ããã", "You are wielding %s in your %s hand."), o_name, - (left_hander ? _("å·¦æ", "left") : _("å³æ", "right"))); - } - else - { - if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING()) - msg_format(_("%sã両æã§æ§ããã", "You are wielding %s with both hands."), o_name); - } - } - } - else if (item == INVEN_LARM) - { - o_ptr = &inventory[INVEN_RARM]; - if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0); - - if (has_melee_weapon(INVEN_RARM)) - { - if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING()) - msg_format(_("%sã両æã§æ§ããã", "You are wielding %s with both hands."), o_name); - } - else if (!(empty_hands(FALSE) & EMPTY_HAND_RARM) && !object_is_cursed(o_ptr)) - { - new_o_ptr = &inventory[INVEN_LARM]; - object_copy(new_o_ptr, o_ptr); - p_ptr->total_weight += o_ptr->weight; - inven_item_increase(INVEN_RARM, -((int)o_ptr->number)); - inven_item_optimize(INVEN_RARM); - msg_format(_("%sãæã¡æ¿ããã", "You switched hand of %s."), o_name); - } - } -} - - -/*! - * @brief è£ åãå¤ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Take off an item - * @return ãªã - */ -void do_cmd_takeoff(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - concptr q, s; - - if (p_ptr->special_defense & KATA_MUSOU) - { - set_action(ACTION_NONE); - } - - q = _("ã©ããè£ åããã¯ããã¾ãã? ", "Take off which item? "); - s = _("ã¯ãããè£ åããªãã", "You are not wearing anything to take off."); - - o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - /* Item is cursed */ - if (object_is_cursed(o_ptr)) - { - if ((o_ptr->curse_flags & TRC_PERMA_CURSE) || (p_ptr->pclass != CLASS_BERSERKER)) - { - msg_print(_("ãµã¼ããã©ãããåªããã¦ããããã ã", "Hmmm, it seems to be cursed.")); - - return; - } - - if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && one_in_(7)) || one_in_(4)) - { - msg_print(_("åªãããè£ åãåã¥ãã§å¥ãããï¼", "You teared a cursed equipment off by sheer strength!")); - - o_ptr->ident |= (IDENT_SENSE); - o_ptr->curse_flags = 0L; - o_ptr->feeling = FEEL_NONE; - - p_ptr->update |= (PU_BONUS); - p_ptr->window |= (PW_EQUIP); - - msg_print(_("åªããæã¡ç ´ã£ãã", "You break the curse.")); - } - else - { - msg_print(_("è£ åãå¤ããªãã£ãã", "You couldn't remove the equipment.")); - p_ptr->energy_use = 50; - return; - } - } - - /* Take a partial turn */ - p_ptr->energy_use = 50; - - /* Take off the item */ - (void)inven_takeoff(item, 255); - kamaenaoshi(item); - calc_android_exp(); - p_ptr->redraw |= (PR_EQUIPPY); -} - - -/*! - * @brief ã¢ã¤ãã ãè½ã¨ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Drop an item - * @return ãªã - */ -void do_cmd_drop(void) -{ - OBJECT_IDX item; - int amt = 1; - - object_type *o_ptr; - - concptr q, s; - - if (p_ptr->special_defense & KATA_MUSOU) - { - set_action(ACTION_NONE); - } - - q = _("ã©ã®ã¢ã¤ãã ãè½ã¨ãã¾ãã? ", "Drop which item? "); - s = _("è½ã¨ããã¢ã¤ãã ãæã£ã¦ããªãã", "You have nothing to drop."); - - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - /* Hack -- Cannot remove cursed items */ - if ((item >= INVEN_RARM) && object_is_cursed(o_ptr)) - { - msg_print(_("ãµã¼ããã©ãããåªããã¦ããããã ã", "Hmmm, it seems to be cursed.")); - return; - } - - - /* See how many items */ - if (o_ptr->number > 1) - { - /* Get a quantity */ - amt = get_quantity(NULL, o_ptr->number); - - /* Allow user abort */ - if (amt <= 0) return; - } - - - /* Take a partial turn */ - p_ptr->energy_use = 50; - - /* Drop (some of) the item */ - inven_drop(item, amt); - - if (item >= INVEN_RARM) - { - kamaenaoshi(item); - calc_android_exp(); - } - - p_ptr->redraw |= (PR_EQUIPPY); -} - -/*! - * @brief ãªãã¸ã§ã¯ããé«ä½ã®éæ³æ¸ãã©ãããå¤å®ãã - * @param o_ptr å¤å®ããããªãã¸ã§ã¯ãã®æ§é ä½åç §ãã¤ã³ã¿ - * @return ãªãã¸ã§ã¯ããé«ä½ã®éæ³æ¸ãªãã°TRUEãè¿ã - */ -static bool high_level_book(object_type *o_ptr) -{ - if ((o_ptr->tval == TV_LIFE_BOOK) || - (o_ptr->tval == TV_SORCERY_BOOK) || - (o_ptr->tval == TV_NATURE_BOOK) || - (o_ptr->tval == TV_CHAOS_BOOK) || - (o_ptr->tval == TV_DEATH_BOOK) || - (o_ptr->tval == TV_TRUMP_BOOK) || - (o_ptr->tval == TV_CRAFT_BOOK) || - (o_ptr->tval == TV_DAEMON_BOOK) || - (o_ptr->tval == TV_CRUSADE_BOOK) || - (o_ptr->tval == TV_MUSIC_BOOK) || - (o_ptr->tval == TV_HEX_BOOK)) - { - if (o_ptr->sval > 1) - return TRUE; - else - return FALSE; - } - - return FALSE; -} - - -/*! - * @brief ã¢ã¤ãã ãç ´å£ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Destroy an item - * @return ãªã - */ -void do_cmd_destroy(void) -{ - OBJECT_IDX item; - QUANTITY amt = 1; - QUANTITY old_number; - - bool force = FALSE; - - object_type *o_ptr; - object_type forge; - object_type *q_ptr = &forge; - - GAME_TEXT o_name[MAX_NLEN]; - char out_val[MAX_NLEN+40]; - - concptr q, s; - - if (p_ptr->special_defense & KATA_MUSOU) - { - set_action(ACTION_NONE); - } - - /* Hack -- force destruction */ - if (command_arg > 0) force = TRUE; - - q = _("ã©ã®ã¢ã¤ãã ãå£ãã¾ãã? ", "Destroy which item? "); - s = _("å£ããã¢ã¤ãã ãæã£ã¦ããªãã", "You have nothing to destroy."); - - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); - if (!o_ptr) return; - - /* Verify unless quantity given beforehand */ - if (!force && (confirm_destroy || (object_value(o_ptr) > 0))) - { - object_desc(o_name, o_ptr, OD_OMIT_PREFIX); - - /* Make a verification */ - sprintf(out_val, _("æ¬å½ã«%sãå£ãã¾ãã? [y/n/Auto]", "Really destroy %s? [y/n/Auto]"), o_name); - msg_print(NULL); - - /* HACK : Add the line to message buffer */ - message_add(out_val); - p_ptr->window |= (PW_MESSAGE); - handle_stuff(); - - /* Get an acceptable answer */ - while (TRUE) - { - char i; - - /* Prompt */ - prt(out_val, 0, 0); - - i = inkey(); - - /* Erase the prompt */ - prt("", 0, 0); - - - if (i == 'y' || i == 'Y') - { - break; - } - if (i == ESCAPE || i == 'n' || i == 'N') - { - /* Cancel */ - return; - } - if (i == 'A') - { - /* Add an auto-destroy preference line */ - if (autopick_autoregister(o_ptr)) - { - /* Auto-destroy it */ - autopick_alter_item(item, TRUE); - } - - /* The object is already destroyed. */ - return; - } - } /* while (TRUE) */ - } - - /* See how many items */ - if (o_ptr->number > 1) - { - /* Get a quantity */ - amt = get_quantity(NULL, o_ptr->number); - - /* Allow user abort */ - if (amt <= 0) return; - } - - - old_number = o_ptr->number; - o_ptr->number = amt; - object_desc(o_name, o_ptr, 0); - o_ptr->number = old_number; - - p_ptr->energy_use = 100; - - /* Artifacts cannot be destroyed */ - if (!can_player_destroy_object(o_ptr)) - { - p_ptr->energy_use = 0; - - msg_format(_("%sã¯ç ´å£ä¸å¯è½ã ã", "You cannot destroy %s."), o_name); - return; - } - - object_copy(q_ptr, o_ptr); - - msg_format(_("%sãå£ããã", "You destroy %s."), o_name); - sound(SOUND_DESTITEM); - - /* Reduce the charges of rods/wands */ - reduce_charges(o_ptr, amt); - - /* Eliminate the item (from the pack) */ - if (item >= 0) - { - inven_item_increase(item, -amt); - inven_item_describe(item); - inven_item_optimize(item); - } - - /* Eliminate the item (from the floor) */ - else - { - floor_item_increase(0 - item, -amt); - floor_item_describe(0 - item); - floor_item_optimize(0 - item); - } - - if (high_level_book(q_ptr)) - { - bool gain_expr = FALSE; - - if (p_ptr->prace == RACE_ANDROID) - { - } - else if ((p_ptr->pclass == CLASS_WARRIOR) || (p_ptr->pclass == CLASS_BERSERKER)) - { - gain_expr = TRUE; - } - else if (p_ptr->pclass == CLASS_PALADIN) - { - if (is_good_realm(p_ptr->realm1)) - { - if (!is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE; - } - else - { - if (is_good_realm(tval2realm(q_ptr->tval))) gain_expr = TRUE; - } - } - - if (gain_expr && (p_ptr->exp < PY_MAX_EXP)) - { - s32b tester_exp = p_ptr->max_exp / 20; - if (tester_exp > 10000) tester_exp = 10000; - if (q_ptr->sval < 3) tester_exp /= 4; - if (tester_exp<1) tester_exp = 1; - - msg_print(_("æ´ã«çµé¨ãç©ãã ãããªæ°ãããã", "You feel more experienced.")); - gain_exp(tester_exp * amt); - } - if (high_level_book(q_ptr) && q_ptr->tval == TV_LIFE_BOOK) - { - chg_virtue(V_UNLIFE, 1); - chg_virtue(V_VITALITY, -1); - } - else if (high_level_book(q_ptr) && q_ptr->tval == TV_DEATH_BOOK) - { - chg_virtue(V_UNLIFE, -1); - chg_virtue(V_VITALITY, 1); - } - - if (q_ptr->to_a || q_ptr->to_h || q_ptr->to_d) - chg_virtue(V_ENCHANT, -1); - - if (object_value_real(q_ptr) > 30000) - chg_virtue(V_SACRIFICE, 2); - - else if (object_value_real(q_ptr) > 10000) - chg_virtue(V_SACRIFICE, 1); - } - - if (q_ptr->to_a != 0 || q_ptr->to_d != 0 || q_ptr->to_h != 0) - chg_virtue(V_HARMONY, 1); - - if (item >= INVEN_RARM) calc_android_exp(); -} - - -/*! - * @brief ã¢ã¤ãã ã調æ»ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / Observe an item which has been *identify*-ed - * @return ãªã - */ -void do_cmd_observe(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - GAME_TEXT o_name[MAX_NLEN]; - concptr q, s; - - q = _("ã©ã®ã¢ã¤ãã ã調ã¹ã¾ãã? ", "Examine which item? "); - s = _("調ã¹ãããã¢ã¤ãã ããªãã", "You have nothing to examine."); - - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - /* Require full knowledge */ - if (!(o_ptr->ident & IDENT_MENTAL)) - { - msg_print(_("ãã®ã¢ã¤ãã ã«ã¤ãã¦ç¹ã«ç¥ã£ã¦ãããã¨ã¯ãªãã", "You have no special knowledge about that item.")); - return; - } - - object_desc(o_name, o_ptr, 0); - msg_format(_("%sã調ã¹ã¦ãã...", "Examining %s..."), o_name); - if (!screen_object(o_ptr, SCROBJ_FORCE_DETAIL)) msg_print(_("ç¹ã«å¤ãã£ãã¨ããã¯ãªãããã ã", "You see nothing special.")); -} - - - -/*! - * @brief ã¢ã¤ãã ã®éãæ¶ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Remove the inscription from an object XXX Mention item (when done)? - * @return ãªã - */ -void do_cmd_uninscribe(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - concptr q, s; - - q = _("ã©ã®ã¢ã¤ãã ã®éãæ¶ãã¾ãã? ", "Un-inscribe which item? "); - s = _("éãæ¶ããã¢ã¤ãã ããªãã", "You have nothing to un-inscribe."); - - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - /* Nothing to remove */ - if (!o_ptr->inscription) - { - msg_print(_("ãã®ã¢ã¤ãã ã«ã¯æ¶ãã¹ãéããªãã", "That item had no inscription to remove.")); - return; - } - - msg_print(_("éãæ¶ããã", "Inscription removed.")); - - /* Remove the incription */ - o_ptr->inscription = 0; - - /* Combine the pack */ - p_ptr->update |= (PU_COMBINE); - - p_ptr->window |= (PW_INVEN | PW_EQUIP); - - /* .ã$ã®é¢ä¿ã§, åè¨ç®ãå¿ è¦ãªã¯ã -- henkma */ - p_ptr->update |= (PU_BONUS); - -} - - -/*! - * @brief ã¢ã¤ãã ã®éãå»ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Inscribe an object with a comment - * @return ãªã - */ -void do_cmd_inscribe(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - GAME_TEXT o_name[MAX_NLEN]; - char out_val[80]; - concptr q, s; - - q = _("ã©ã®ã¢ã¤ãã ã«éãå»ã¿ã¾ãã? ", "Inscribe which item? "); - s = _("éãå»ããã¢ã¤ãã ããªãã", "You have nothing to inscribe."); - - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - /* Describe the activity */ - object_desc(o_name, o_ptr, OD_OMIT_INSCRIPTION); - - msg_format(_("%sã«éãå»ãã", "Inscribing %s."), o_name); - msg_print(NULL); - - /* Start with nothing */ - strcpy(out_val, ""); - - /* Use old inscription */ - if (o_ptr->inscription) - { - /* Start with the old inscription */ - strcpy(out_val, quark_str(o_ptr->inscription)); - } - - /* Get a new inscription (possibly empty) */ - if (get_string(_("é: ", "Inscription: "), out_val, 80)) - { - /* Save the inscription */ - o_ptr->inscription = quark_add(out_val); - - /* Combine the pack */ - p_ptr->update |= (PU_COMBINE); - - p_ptr->window |= (PW_INVEN | PW_EQUIP); - - /* .ã$ã®é¢ä¿ã§, åè¨ç®ãå¿ è¦ãªã¯ã -- henkma */ - p_ptr->update |= (PU_BONUS); - } -} - - - -/*! - * @brief ãªãã¸ã§ã¯ããã©ã³ã¿ã³ã®çæã«ãªããã©ãããå¤å®ãã - * An "item_tester_hook" for refilling lanterns - * @param o_ptr å¤å®ããããªãã¸ã§ã¯ãã®æ§é ä½åç §ãã¤ã³ã¿ - * @return ãªãã¸ã§ã¯ããã©ã³ã¿ã³ã®çæã«ãªããªãã°TRUEãè¿ã - */ -static bool item_tester_refill_lantern(object_type *o_ptr) -{ - /* Flasks of oil are okay */ - if (o_ptr->tval == TV_FLASK) return (TRUE); - - /* Laterns are okay */ - if ((o_ptr->tval == TV_LITE) && - (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE); - - /* Assume not okay */ - return (FALSE); -} - - -/*! - * @brief ã©ã³ã¿ã³ã«çæãå ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Refill the players lamp (from the pack or floor) - * @return ãªã - */ -static void do_cmd_refill_lamp(void) -{ - OBJECT_IDX item; - - object_type *o_ptr; - object_type *j_ptr; - - concptr q, s; - - /* Restrict the choices */ - item_tester_hook = item_tester_refill_lantern; - - q = _("ã©ã®æ²¹ã¤ã¼ãã注ãã¾ãã? ", "Refill with which flask? "); - s = _("æ²¹ã¤ã¼ããªãã", "You have no flasks of oil."); - - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); - if (!o_ptr) return; - - /* Take a partial turn */ - p_ptr->energy_use = 50; - - /* Access the lantern */ - j_ptr = &inventory[INVEN_LITE]; - - /* Refuel */ - j_ptr->xtra4 += o_ptr->xtra4; - msg_print(_("ã©ã³ãã«æ²¹ã注ãã ã", "You fuel your lamp.")); - - if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) - { - j_ptr->xtra4 = 0; - msg_print(_("ã©ã³ããæ¶ãã¦ãã¾ã£ãï¼", "Your lamp has gone out!")); - } - else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) - { - j_ptr->xtra4 = 0; - msg_print(_("ãããã©ã³ãã¯å ¨ãå ããªãã", "Curiously, your lamp doesn't light.")); - } - else if (j_ptr->xtra4 >= FUEL_LAMP) - { - j_ptr->xtra4 = FUEL_LAMP; - msg_print(_("ã©ã³ãã®æ²¹ã¯ä¸æ¯ã ã", "Your lamp is full.")); - } - - /* Decrease the item (from the pack) */ - if (item >= 0) - { - inven_item_increase(item, -1); - inven_item_describe(item); - inven_item_optimize(item); - } - - /* Decrease the item (from the floor) */ - else - { - floor_item_increase(0 - item, -1); - floor_item_describe(0 - item); - floor_item_optimize(0 - item); - } - - /* Recalculate torch */ - p_ptr->update |= (PU_TORCH); -} - - -/*! - * @brief ãªãã¸ã§ã¯ããæ¾æã«æãããããã©ãããå¤å®ãã - * An "item_tester_hook" for refilling torches - * @param o_ptr å¤å®ããããªãã¸ã§ã¯ãã®æ§é ä½åç §ãã¤ã³ã¿ - * @return ãªãã¸ã§ã¯ããæ¾æã«æãããããªãã°TRUEãè¿ã - */ -static bool item_tester_refill_torch(object_type *o_ptr) -{ - /* Torches are okay */ - if ((o_ptr->tval == TV_LITE) && - (o_ptr->sval == SV_LITE_TORCH)) return (TRUE); - - /* Assume not okay */ - return (FALSE); -} - - -/*! - * @brief æ¾æãæããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Refuel the players torch (from the pack or floor) - * @return ãªã - */ -static void do_cmd_refill_torch(void) -{ - OBJECT_IDX item; - - object_type *o_ptr; - object_type *j_ptr; - - concptr q, s; - - /* Restrict the choices */ - item_tester_hook = item_tester_refill_torch; - - q = _("ã©ã®æ¾æã§æãããå¼·ãã¾ãã? ", "Refuel with which torch? "); - s = _("ä»ã«æ¾æããªãã", "You have no extra torches."); - - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); - if (!o_ptr) return; - - /* Take a partial turn */ - p_ptr->energy_use = 50; - - /* Access the primary torch */ - j_ptr = &inventory[INVEN_LITE]; - - /* Refuel */ - j_ptr->xtra4 += o_ptr->xtra4 + 5; - - msg_print(_("æ¾æãçµåããã", "You combine the torches.")); - - if ((o_ptr->name2 == EGO_LITE_DARKNESS) && (j_ptr->xtra4 > 0)) - { - j_ptr->xtra4 = 0; - msg_print(_("æ¾æãæ¶ãã¦ãã¾ã£ãï¼", "Your torch has gone out!")); - } - else if ((o_ptr->name2 == EGO_LITE_DARKNESS) || (j_ptr->name2 == EGO_LITE_DARKNESS)) - { - j_ptr->xtra4 = 0; - msg_print(_("ãããæ¾æã¯å ¨ãå ããªãã", "Curiously, your torche don't light.")); - } - /* Over-fuel message */ - else if (j_ptr->xtra4 >= FUEL_TORCH) - { - j_ptr->xtra4 = FUEL_TORCH; - msg_print(_("æ¾æã®å¯¿å½ã¯ååã ã", "Your torch is fully fueled.")); - } - - /* Refuel message */ - else - { - msg_print(_("æ¾æã¯ãã£ããæããè¼ããã", "Your torch glows more brightly.")); - } - - /* Decrease the item (from the pack) */ - if (item >= 0) - { - inven_item_increase(item, -1); - inven_item_describe(item); - inven_item_optimize(item); - } - - /* Decrease the item (from the floor) */ - else - { - floor_item_increase(0 - item, -1); - floor_item_describe(0 - item); - floor_item_optimize(0 - item); - } - - /* Recalculate torch */ - p_ptr->update |= (PU_TORCH); -} - - -/*! - * @brief çæãè£å ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Refill the players lamp, or restock his torches - * @return ãªã - */ -void do_cmd_refill(void) -{ - object_type *o_ptr; - - /* Get the light */ - o_ptr = &inventory[INVEN_LITE]; - - if (p_ptr->special_defense & KATA_MUSOU) - { - set_action(ACTION_NONE); - } - - /* It is nothing */ - if (o_ptr->tval != TV_LITE) - { - msg_print(_("å æºãè£ åãã¦ããªãã", "You are not wielding a light.")); - } - - /* It's a lamp */ - else if (o_ptr->sval == SV_LITE_LANTERN) - { - do_cmd_refill_lamp(); - } - - /* It's a torch */ - else if (o_ptr->sval == SV_LITE_TORCH) - { - do_cmd_refill_torch(); - } - - /* No torch to refill */ - else - { - msg_print(_("ãã®å æºã¯å¯¿å½ã延ã°ããªãã", "Your light cannot be refilled.")); - } -} - - -/*! - * @brief ã¿ã¼ã²ãããè¨å®ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Target command - * @return ãªã - */ -void do_cmd_target(void) -{ - if (p_ptr->wild_mode) return; - - /* Target set */ - if (target_set(TARGET_KILL)) - { - msg_print(_("ã¿ã¼ã²ãã決å®ã", "Target Selected.")); - } - - /* Target aborted */ - else - { - msg_print(_("ã¿ã¼ã²ãã解é¤ã", "Target Aborted.")); - } -} - - - -/*! - * @brief å¨å²ãè¦æ¸¡ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Look command - * @return ãªã - */ -void do_cmd_look(void) -{ - p_ptr->window |= PW_MONSTER_LIST; - handle_stuff(); - - /* Look around */ - if (target_set(TARGET_LOOK)) - { - msg_print(_("ã¿ã¼ã²ãã決å®ã", "Target Selected.")); - } -} - - -/*! - * @brief ä½ç½®ã確èªããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Allow the player to examine other sectors on the map - * @return ãªã - */ -void do_cmd_locate(void) -{ - DIRECTION dir; - POSITION y1, x1, y2, x2; - GAME_TEXT tmp_val[80]; - GAME_TEXT out_val[160]; - TERM_LEN wid, hgt; - - get_screen_size(&wid, &hgt); - - /* Start at current panel */ - y2 = y1 = panel_row_min; - x2 = x1 = panel_col_min; - - /* Show panels until done */ - while (1) - { - /* Describe the location */ - if ((y2 == y1) && (x2 == x1)) - { -#ifdef JP - strcpy(tmp_val, "çä¸"); -#else - tmp_val[0] = '\0'; -#endif - - } - else - { -#ifdef JP - sprintf(tmp_val, "%s%s", - ((y2 < y1) ? "å" : (y2 > y1) ? "å" : ""), - ((x2 < x1) ? "西" : (x2 > x1) ? "æ±" : "")); -#else - sprintf(tmp_val, "%s%s of", - ((y2 < y1) ? " North" : (y2 > y1) ? " South" : ""), - ((x2 < x1) ? " West" : (x2 > x1) ? " East" : "")); -#endif - - } - - /* Prepare to ask which way to look */ - sprintf(out_val, _("ãããä½ç½® [%ld(%02ld),%ld(%02ld)] (ãã¬ã¤ã¤ã¼ã®%s) æ¹å?", - "Map sector [%ld(%02ld),%ld(%02ld)], which is%s your sector. Direction?"), - y2 / (hgt / 2), y2 % (hgt / 2), - x2 / (wid / 2), x2 % (wid / 2), tmp_val); - - /* Assume no direction */ - dir = 0; - - /* Get a direction */ - while (!dir) - { - char command; - - /* Get a command (or Cancel) */ - if (!get_com(out_val, &command, TRUE)) break; - - /* Extract the action (if any) */ - dir = get_keymap_dir(command); - - /* Error */ - if (!dir) bell(); - } - - /* No direction */ - if (!dir) break; - - /* Apply the motion */ - if (change_panel(ddy[dir], ddx[dir])) - { - y2 = panel_row_min; - x2 = panel_col_min; - } - } - - - /* Recenter the map around the player */ - verify_panel(); - - p_ptr->update |= (PU_MONSTERS); - p_ptr->redraw |= (PR_MAP); - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - handle_stuff(); -} - - - -/*! - * @brief ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±ãç¹å®ã®åºæºã«ããã½ã¼ãããããã®æ¯è¼å¦ç - * Sorting hook -- Comp function -- see below - * @param u ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±ã®å ¥ãããã¤ã³ã¿ - * @param v æ¡ä»¶åºæºID - * @param a æ¯è¼ããã¢ã³ã¹ã¿ã¼ç¨®æã®ID1 - * @param b æ¯è¼ããã¢ã³ã¹ã¿ã¼ç¨®æã®ID2 - * @return 2ã®æ¹ã大ãããã°TRUEãè¿ã - * We use "u" to point to array of monster indexes, - * and "v" to select the type of sorting to perform on "u". - */ -bool ang_sort_comp_hook(vptr u, vptr v, int a, int b) -{ - u16b *who = (u16b*)(u); - u16b *why = (u16b*)(v); - - int w1 = who[a]; - int w2 = who[b]; - - int z1, z2; - - /* Sort by player kills */ - if (*why >= 4) - { - /* Extract player kills */ - z1 = r_info[w1].r_pkills; - z2 = r_info[w2].r_pkills; - - /* Compare player kills */ - if (z1 < z2) return (TRUE); - if (z1 > z2) return (FALSE); - } - - - /* Sort by total kills */ - if (*why >= 3) - { - /* Extract total kills */ - z1 = r_info[w1].r_tkills; - z2 = r_info[w2].r_tkills; - - /* Compare total kills */ - if (z1 < z2) return (TRUE); - if (z1 > z2) return (FALSE); - } - - - /* Sort by monster level */ - if (*why >= 2) - { - /* Extract levels */ - z1 = r_info[w1].level; - z2 = r_info[w2].level; - - /* Compare levels */ - if (z1 < z2) return (TRUE); - if (z1 > z2) return (FALSE); - } - - - /* Sort by monster experience */ - if (*why >= 1) - { - /* Extract experience */ - z1 = r_info[w1].mexp; - z2 = r_info[w2].mexp; - - /* Compare experience */ - if (z1 < z2) return (TRUE); - if (z1 > z2) return (FALSE); - } - - - /* Compare indexes */ - return (w1 <= w2); -} - - -/*! - * @brief ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±ãç¹å®ã®åºæºã«ããã½ã¼ãããããã®ã¹ã¯ããå¦ç - * Sorting hook -- Swap function -- see below - * @param u ã¢ã³ã¹ã¿ã¼ç¨®ææ å ±ã®å ¥ãããã¤ã³ã¿ - * @param v æªä½¿ç¨ - * @param a ã¹ã¯ããããã¢ã³ã¹ã¿ã¼ç¨®æã®ID1 - * @param b ã¹ã¯ããããã¢ã³ã¹ã¿ã¼ç¨®æã®ID2 - * @return ãªã - * @details - * We use "u" to point to array of monster indexes, - * and "v" to select the type of sorting to perform. - */ -void ang_sort_swap_hook(vptr u, vptr v, int a, int b) -{ - u16b *who = (u16b*)(u); - - u16b holder; - - /* Unused */ - (void)v; - - /* Swap */ - holder = who[a]; - who[a] = who[b]; - who[b] = holder; -} - - - -/*! - * @brief ã¢ã³ã¹ã¿ã¼ã®æãåºãè¦ãã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ - * Identify a character, allow recall of monsters - * @return ãªã - * @details - *
- * Several "special" responses recall "multiple" monsters: - * ^A (all monsters) - * ^U (all unique monsters) - * ^N (all non-unique monsters) - * - * The responses may be sorted in several ways, see below. - * - * Note that the player ghosts are ignored. - *- */ -void do_cmd_query_symbol(void) -{ - IDX i; - int n; - MONRACE_IDX r_idx; - char sym, query; - char buf[128]; - - bool all = FALSE; - bool uniq = FALSE; - bool norm = FALSE; - bool ride = FALSE; - char temp[80] = ""; - - bool recall = FALSE; - - u16b why = 0; - IDX *who; - - /* Get a character, or abort */ - if (!get_com(_("ç¥ãããæåãå ¥åãã¦ä¸ãã(è¨å· or ^Aå ¨,^Uã¦,^Néã¦,^Rä¹é¦¬,^Måå): ", - "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) return; - - /* Find that character info, and describe it */ - for (i = 0; ident_info[i]; ++i) - { - if (sym == ident_info[i][0]) break; - } - if (sym == KTRL('A')) - { - all = TRUE; - strcpy(buf, _("å ¨ã¢ã³ã¹ã¿ã¼ã®ãªã¹ã", "Full monster list.")); - } - else if (sym == KTRL('U')) - { - all = uniq = TRUE; - strcpy(buf, _("ã¦ãã¼ã¯ã»ã¢ã³ã¹ã¿ã¼ã®ãªã¹ã", "Unique monster list.")); - } - else if (sym == KTRL('N')) - { - all = norm = TRUE; - strcpy(buf, _("ã¦ãã¼ã¯å¤ã¢ã³ã¹ã¿ã¼ã®ãªã¹ã", "Non-unique monster list.")); - } - else if (sym == KTRL('R')) - { - all = ride = TRUE; - strcpy(buf, _("ä¹é¦¬å¯è½ã¢ã³ã¹ã¿ã¼ã®ãªã¹ã", "Ridable monster list.")); - } - /* XTRA HACK WHATSEARCH */ - else if (sym == KTRL('M')) - { - all = TRUE; - if (!get_string(_("åå(è±èªã®å ´åå°æåã§å¯)", "Enter name:"),temp, 70)) - { - temp[0]=0; - return; - } - sprintf(buf, _("åå:%sã«ããã", "Monsters with a name \"%s\""),temp); - } - else if (ident_info[i]) - { - sprintf(buf, "%c - %s.", sym, ident_info[i] + 2); - } - else - { - sprintf(buf, "%c - %s", sym, _("ç¡å¹ãªæå", "Unknown Symbol")); - } - - /* Display the result */ - prt(buf, 0, 0); - - /* Allocate the "who" array */ - C_MAKE(who, max_r_idx, MONRACE_IDX); - - /* Collect matching monsters */ - for (n = 0, i = 1; i < max_r_idx; i++) - { - monster_race *r_ptr = &r_info[i]; - - /* Nothing to recall */ - if (!cheat_know && !r_ptr->r_sights) continue; - - /* Require non-unique monsters if needed */ - if (norm && (r_ptr->flags1 & (RF1_UNIQUE))) continue; - - /* Require unique monsters if needed */ - if (uniq && !(r_ptr->flags1 & (RF1_UNIQUE))) continue; - - /* Require ridable monsters if needed */ - if (ride && !(r_ptr->flags7 & (RF7_RIDING))) continue; - - /* XTRA HACK WHATSEARCH */ - if (temp[0]) - { - TERM_LEN xx; - char temp2[80]; - - for (xx = 0; temp[xx] && xx < 80; xx++) - { -#ifdef JP - if (iskanji(temp[xx])) { xx++; continue; } -#endif - if (isupper(temp[xx])) temp[xx] = (char)tolower(temp[xx]); - } - -#ifdef JP - strcpy(temp2, r_name + r_ptr->E_name); -#else - strcpy(temp2, r_name + r_ptr->name); -#endif - for (xx = 0; temp2[xx] && xx < 80; xx++) - if (isupper(temp2[xx])) temp2[xx] = (char)tolower(temp2[xx]); - -#ifdef JP - if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp)) -#else - if (my_strstr(temp2, temp)) -#endif - who[n++] = i; - } - - /* Collect "appropriate" monsters */ - else if (all || (r_ptr->d_char == sym)) who[n++] = i; - } - - /* Nothing to recall */ - if (!n) - { - /* Free the "who" array */ - C_KILL(who, max_r_idx, IDX); - - return; - } - - /* Prompt */ - put_str(_("æãåºãè¦ã¾ãã? (k:殺害é /y/n): ", "Recall details? (k/y/n): "), 0, _(36, 40)); - - /* Query */ - query = inkey(); - prt(buf, 0, 0); - - why = 2; - - /* Select the sort method */ - ang_sort_comp = ang_sort_comp_hook; - ang_sort_swap = ang_sort_swap_hook; - - /* Sort the array */ - ang_sort(who, &why, n); - - /* Sort by kills (and level) */ - if (query == 'k') - { - why = 4; - query = 'y'; - } - - /* Catch "escape" */ - if (query != 'y') - { - /* Free the "who" array */ - C_KILL(who, max_r_idx, IDX); - - return; - } - - /* Sort if needed */ - if (why == 4) - { - /* Select the sort method */ - ang_sort_comp = ang_sort_comp_hook; - ang_sort_swap = ang_sort_swap_hook; - - /* Sort the array */ - ang_sort(who, &why, n); - } - - - /* Start at the end */ - i = n - 1; - - /* Scan the monster memory */ - while (1) - { - /* Extract a race */ - r_idx = who[i]; - - /* Hack -- Auto-recall */ - monster_race_track(r_idx); - handle_stuff(); - - /* Interact */ - while (1) - { - /* Recall */ - if (recall) - { - screen_save(); - - /* Recall on screen */ - screen_roff(who[i], 0); - } - - /* Hack -- Begin the prompt */ - roff_top(r_idx); - - /* Hack -- Complete the prompt */ - Term_addstr(-1, TERM_WHITE, _(" ['r'æãåº, ESC]", " [(r)ecall, ESC]")); - - /* Command */ - query = inkey(); - - /* Unrecall */ - if (recall) - { - screen_load(); - } - - /* Normal commands */ - if (query != 'r') break; - - /* Toggle recall */ - recall = !recall; - } - - /* Stop scanning */ - if (query == ESCAPE) break; - - /* Move to "prev" monster */ - if (query == '-') - { - if (++i == n) - { - i = 0; - if (!expand_list) break; - } - } - - /* Move to "next" monster */ - else - { - if (i-- == 0) - { - i = n - 1; - if (!expand_list) break; - } - } - } - - /* Free the "who" array */ - C_KILL(who, max_r_idx, IDX); - - /* Re-display the identity */ - prt(buf, 0, 0); -} - -/*! - * @brief ã¢ã¤ãã ãæ±ç¨çã«ã使ããã³ãã³ãã®ã¡ã¤ã³ã«ã¼ãã³ / - * Use an item - * @return ãªã - * @details - * XXX - Add actions for other item types - */ -void do_cmd_use(void) -{ - OBJECT_IDX item; - object_type *o_ptr; - concptr q, s; - - if (p_ptr->wild_mode) - { - return; - } - - if (p_ptr->inside_arena) - { - msg_print(_("ã¢ãªã¼ããéæ³ãå¸åããï¼", "The arena absorbs all attempted magic!")); - msg_print(NULL); - return; - } - - if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN)) - { - set_action(ACTION_NONE); - } - - item_tester_hook = item_tester_hook_use; - - q = _("ã©ãã使ãã¾ããï¼", "Use which item? "); - s = _("使ãããã®ãããã¾ããã", "You have nothing to use."); - - o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); - if (!o_ptr) return; - - switch (o_ptr->tval) - { - /* Spike a door */ - case TV_SPIKE: - { - do_cmd_spike(); - break; - } - - /* Eat some food */ - case TV_FOOD: - { - do_cmd_eat_food_aux(item); - break; - } - - /* Aim a wand */ - case TV_WAND: - { - do_cmd_aim_wand_aux(item); - break; - } - - /* Use a staff */ - case TV_STAFF: - { - do_cmd_use_staff_aux(item); - break; - } - - /* Zap a rod */ - case TV_ROD: - { - do_cmd_zap_rod_aux(item); - break; - } - - /* Quaff a potion */ - case TV_POTION: - { - do_cmd_quaff_potion_aux(item); - break; - } - - /* Read a scroll */ - case TV_SCROLL: - { - /* Check some conditions */ - if (p_ptr->blind) - { - msg_print(_("ç®ãè¦ããªãã", "You can't see anything.")); - return; - } - if (no_lite()) - { - msg_print(_("æããããªãã®ã§ãæãã¦èªããªãã", "You have no light to read by.")); - return; - } - if (p_ptr->confused) - { - msg_print(_("æ··ä¹±ãã¦ãã¦èªããªãï¼", "You are too confused!")); - return; - } - - do_cmd_read_scroll_aux(item, TRUE); - break; - } - - /* Fire ammo */ - case TV_SHOT: - case TV_ARROW: - case TV_BOLT: - { - exe_fire(item, &inventory[INVEN_BOW]); - break; - } - - /* Activate an artifact */ - default: - { - do_cmd_activate_aux(item); - break; - } - } -} -