X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fbldg.c;h=557f9b2f99029a9c3b0c64096cd25c9a4b413b0b;hb=744271a78568822e914a3fe1faf3c153b1ba9954;hp=59443e18bb2543fc2025760b0a4ff667bc48b509;hpb=bd23dab5010eee32b843ffabf83d10cbdbc9fe9d;p=hengband%2Fhengband.git diff --git a/src/bldg.c b/src/bldg.c index 59443e18b..557f9b2f9 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -13,7 +13,17 @@ */ #include "angband.h" +#include "floor.h" #include "object-hook.h" +#include "monsterrace-hook.h" +#include "melee.h" +#include "world.h" +#include "sort.h" + +#include "avatar.h" +#include "mutation.h" +#include "quest.h" +#include "artifact.h" /*! * ループ中で / hack as in leave_store in store.c @@ -213,7 +223,7 @@ static void show_building(building_type* bldg) static void arena_comm(int cmd) { monster_race *r_ptr; - cptr name; + concptr name; switch (cmd) @@ -302,19 +312,15 @@ static void arena_comm(int cmd) p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx; p_ptr->window |= (PW_MONSTER); - window_stuff(); + handle_stuff(); } break; case BACT_ARENA_RULES: - - /* Save screen */ screen_save(); /* Peruse the arena help file */ (void)show_file(TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0); - - /* Load screen */ screen_load(); break; @@ -730,8 +736,8 @@ static void display_cards(void) int i, j; char suitcolor[4] = {TERM_YELLOW, TERM_L_RED, TERM_L_BLUE, TERM_L_GREEN}; #ifdef JP - cptr suit[4] = {"★", "●", "¶", "†"}; - cptr card_grph[13][7] = {{"A %s ", + concptr suit[4] = {"★", "●", "¶", "†"}; + concptr card_grph[13][7] = {{"A %s ", " 変 ", " 愚 ", " 蛮 ", @@ -822,7 +828,7 @@ static void display_cards(void) " υ ∂ ", " σ ノ %s", " K"}}; - cptr joker_grph[7] = { " ", + concptr joker_grph[7] = { " ", " J ", " O ", " K ", @@ -832,8 +838,8 @@ static void display_cards(void) #else - cptr suit[4] = {"[]", "qp", "<>", "db"}; - cptr card_grph[13][7] = {{"A %s ", + concptr suit[4] = {"[]", "qp", "<>", "db"}; + concptr card_grph[13][7] = {{"A %s ", " He ", " ng ", " ba ", @@ -924,7 +930,7 @@ static void display_cards(void) " c & ", " v__/ %s", " K"}}; - cptr joker_grph[7] = { " ", + concptr joker_grph[7] = { " ", " J ", " O ", " K ", @@ -979,95 +985,6 @@ static int do_poker(void) cards[i] = deck[deck_ptr++]; kaeruka[i] = 0; /* default:nokosu */ } - -#if 0 - /* debug:RF */ - cards[0] = 12; - cards[1] = 0; - cards[2] = 9; - cards[3] = 11; - cards[4] = 10; -#endif -#if 0 - /* debug:SF */ - cards[0] = 3; - cards[1] = 2; - cards[2] = 4; - cards[3] = 6; - cards[4] = 5; -#endif -#if 0 - /* debug:Four Cards */ - cards[0] = 0; - cards[1] = 0 + 13 * 1; - cards[2] = 0 + 13 * 2; - cards[3] = 0 + 13 * 3; - cards[4] = 51; -#endif -#if 0 - /* debug:Straight1 */ - cards[0] = 1; - cards[1] = 0 + 13; - cards[2] = 3; - cards[3] = 2 + 26; - cards[4] = 4; -#endif -#if 0 - /* debug:Straight2 */ - cards[0] = 12; - cards[1] = 0; - cards[2] = 9; - cards[3] = 11 + 13 * 2; - cards[4] = 10; -#endif -#if 0 - /* debug:Straight3 */ - cards[0] = 52; - cards[1] = 0; - cards[2] = 9; - cards[3] = 11 + 13 * 2; - cards[4] = 10; -#endif -#if 0 - /* debug:Straight4 */ - cards[0] = 12; - cards[1] = 52; - cards[2] = 9; - cards[3] = 11 + 13 * 2; - cards[4] = 10; -#endif -#if 0 - /* debug:Straight5 */ - cards[0] = 4; - cards[1] = 5 + 13; - cards[2] = 6; - cards[3] = 7 + 26; - cards[4] = 3; -#endif -#if 0 - /* debug:Five Card1 */ - cards[0] = 4; - cards[1] = 52; - cards[2] = 4 + 13; - cards[3] = 4 + 26; - cards[4] = 4 + 39; -#endif -#if 0 - /* debug:Five Card2 */ - cards[1] = 52; - cards[0] = 4; - cards[2] = 4 + 13; - cards[3] = 4 + 26; - cards[4] = 4 + 39; -#endif -#if 0 - /* debug */ - cards[0] = 52; - cards[1] = 0; - cards[2] = 1; - cards[3] = 2; - cards[4] = 3; -#endif /* suteruno wo kimeru */ prt(_("残すカードを決めて下さい(方向で移動, スペースで選択)。", "Stay witch? "), 0, 0); @@ -1135,7 +1052,7 @@ static bool gamble_comm(int cmd) s32b oldgold; char out_val[160], tmp_str[80], again; - cptr p; + concptr p; screen_save(); @@ -1432,43 +1349,6 @@ static bool gamble_comm(int cmd) } /*! - * @brief モンスター闘技場に参加できるモンスターの判定 - * @param r_idx モンスターID - * @details 基準はNEVER_MOVE MULTIPLY QUANTUM RF7_AQUATIC RF7_CHAMELEONのいずれも持たず、 - * 自爆以外のなんらかのHP攻撃手段を持っていること。 - * @return 参加できるか否か - */ -static bool vault_aux_battle(MONRACE_IDX r_idx) -{ - int i; - HIT_POINT dam = 0; - - monster_race *r_ptr = &r_info[r_idx]; - - /* Decline town monsters */ -/* if (!mon_hook_dungeon(r_idx)) return FALSE; */ - - /* Decline unique monsters */ -/* if (r_ptr->flags1 & (RF1_UNIQUE)) return (FALSE); */ -/* if (r_ptr->flags7 & (RF7_NAZGUL)) return (FALSE); */ - - if (r_ptr->flags1 & (RF1_NEVER_MOVE)) return (FALSE); - if (r_ptr->flags2 & (RF2_MULTIPLY)) return (FALSE); - if (r_ptr->flags2 & (RF2_QUANTUM)) return (FALSE); - if (r_ptr->flags7 & (RF7_AQUATIC)) return (FALSE); - if (r_ptr->flags7 & (RF7_CHAMELEON)) return (FALSE); - - for (i = 0; i < 4; i++) - { - if (r_ptr->blow[i].method == RBM_EXPLODE) return (FALSE); - if (r_ptr->blow[i].effect != RBE_DR_MANA) dam += r_ptr->blow[i].d_dice; - } - if (!dam && !(r_ptr->flags4 & (RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_BREATH_MASK)) && !(r_ptr->a_ability_flags1 & (RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_BREATH_MASK)) && !(r_ptr->a_ability_flags2 & (RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_BREATH_MASK))) return (FALSE); - - return (TRUE); -} - -/*! * @brief モンスター闘技場に参加するモンスターをリセットする。 * @return なし */ @@ -1506,7 +1386,7 @@ void battle_monsters(void) int j; while (1) { - get_mon_num_prep(vault_aux_battle, NULL); + get_mon_num_prep(monster_can_entry_arena, NULL); p_ptr->inside_battle = TRUE; r_idx = get_mon_num(mon_level); p_ptr->inside_battle = old_inside_battle; @@ -1580,7 +1460,7 @@ static bool kakutoujou(void) s32b maxbet; s32b wager; char out_val[160], tmp_str[80]; - cptr p; + concptr p; if ((turn - old_battle) > TURNS_PER_TICK*250) { @@ -1752,7 +1632,7 @@ static void shoukinkubi(void) for (i = 0; i < MAX_KUBI; i++) { byte color; - cptr done_mark; + concptr done_mark; monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])]; if (kubi_r_idx[i] > 10000) @@ -1823,7 +1703,7 @@ static bool kankin(void) INVENTORY_IDX i; int j; bool change = FALSE; - char o_name[MAX_NLEN]; + GAME_TEXT o_name[MAX_NLEN]; object_type *o_ptr; /* Loop for inventory and right/left arm */ @@ -1999,14 +1879,11 @@ static bool kankin(void) */ item_new = inven_carry(&forge); - /* Describe the object */ object_desc(o_name, &forge, 0); msg_format(_("%s(%c)を貰った。", "You get %s (%c). "), o_name, index_to_label(item_new)); /* Auto-inscription */ autopick_alter_item(item_new, FALSE); - - /* Handle stuff */ handle_stuff(); change = TRUE; @@ -2024,25 +1901,6 @@ static bool kankin(void) } /*! - * @brief 悪夢の元凶となるモンスターかどうかを返す。 - * @param r_idx 判定対象となるモンスターのID - * @return 悪夢の元凶となり得るか否か。 - */ -bool get_nightmare(MONRACE_IDX r_idx) -{ - monster_race *r_ptr = &r_info[r_idx]; - - /* Require eldritch horrors */ - if (!(r_ptr->flags2 & (RF2_ELDRITCH_HORROR))) return (FALSE); - - /* Require high level */ - if (r_ptr->level <= p_ptr->lev) return (FALSE); - - /* Accept this monster */ - return (TRUE); -} - -/*! * @brief 宿屋の利用サブルーチン * @details inn commands\n * Note that resting for the night was a perfect way to avoid player\n @@ -2165,9 +2023,9 @@ static bool inn_comm(int cmd) */ static void get_questinfo(IDX questnum, bool do_init) { - int i; - IDX old_quest; - char tmp_str[80]; + int i; + QUEST_IDX old_quest; + GAME_TEXT tmp_str[80]; /* Clear the text */ for (i = 0; i < 10; i++) @@ -2209,10 +2067,10 @@ static void get_questinfo(IDX questnum, bool do_init) */ static void castle_quest(void) { - IDX q_index = 0; - monster_race *r_ptr; - quest_type *q_ptr; - cptr name; + QUEST_IDX q_index = 0; + monster_race *r_ptr; + quest_type *q_ptr; + concptr name; clear_bldg(4, 18); @@ -2307,13 +2165,10 @@ static void castle_quest(void) */ static void town_history(void) { - /* Save screen */ screen_save(); /* Peruse the building help file */ (void)show_file(TRUE, _("jbldg.txt", "bldg.txt"), NULL, 0, 0); - - /* Load screen */ screen_load(); } @@ -2505,9 +2360,9 @@ static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, WEIGHT wei * the current +dam of the player.\n * @return なし */ -static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, cptr attr, byte color) +static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, int dam_bonus, concptr attr, byte color) { - char tmp_str[80]; + GAME_TEXT tmp_str[80]; int mindam, maxdam; mindam = blows * (mindice + dam_bonus); @@ -2739,28 +2594,6 @@ static void compare_weapon_aux(object_type *o_ptr, int col, int r) } /*! - * @brief モンスターへの命中率の計算 - * @param to_h 命中値 - * @param ac 敵AC - * @return 命中確率 - */ -static PERCENTAGE hit_chance(HIT_PROB to_h, ARMOUR_CLASS ac) -{ - PERCENTAGE chance = 0; - int meichuu = p_ptr->skill_thn + (p_ptr->to_h[0] + to_h) * BTH_PLUS_ADJ; - - if (meichuu <= 0) return 5; - - chance = 100 - ((ac * 75) / meichuu); - - if (chance > 95) chance = 95; - if (chance < 5) chance = 5; - if (p_ptr->pseikaku == SEIKAKU_NAMAKE) - chance = (chance * 19 + 9) / 20; - return chance; -} - -/*! * @brief 武器匠における武器一つ毎の完全情報を表示する。 * @param o_ptr オブジェクトの構造体の参照ポインタ。 * @param row 表示する列の左端 @@ -2774,12 +2607,12 @@ static PERCENTAGE hit_chance(HIT_PROB to_h, ARMOUR_CLASS ac) */ static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col) { - char o_name[MAX_NLEN]; - char tmp_str[80]; + GAME_TEXT o_name[MAX_NLEN]; + GAME_TEXT tmp_str[80]; - /* Effective dices */ DICE_NUMBER eff_dd = o_ptr->dd + p_ptr->to_dd[0]; DICE_SID eff_ds = o_ptr->ds + p_ptr->to_ds[0]; + HIT_RELIABILITY reli = p_ptr->skill_thn + (p_ptr->to_h[0] + o_ptr->to_h) * BTH_PLUS_ADJ; /* Print the weapon name */ object_desc(o_name, o_ptr, OD_NAME_ONLY); @@ -2795,8 +2628,11 @@ static void list_weapon(object_type *o_ptr, TERM_LEN row, TERM_LEN col) /* Print the weapons base damage dice */ sprintf(tmp_str, " %2d %2d %2d %2d %2d (%%)", - hit_chance(o_ptr->to_h, 0), hit_chance(o_ptr->to_h, 50), hit_chance(o_ptr->to_h, 100), - hit_chance(o_ptr->to_h, 150), hit_chance(o_ptr->to_h, 200)); + (int)hit_chance(reli, 0), + (int)hit_chance(reli, 50), + (int)hit_chance(reli, 100), + (int)hit_chance(reli, 150), + (int)hit_chance(reli, 200)); put_str(tmp_str, row+3, col); c_put_str(TERM_YELLOW, _("可能なダメージ:", "Possible Damage:"), row+5, col); @@ -2829,7 +2665,7 @@ static PRICE compare_weapons(PRICE bcost) object_type *o_ptr[2]; object_type orig_weapon; object_type *i_ptr; - cptr q, s; + concptr q, s; TERM_LEN row = 2; TERM_LEN wid = 38, mgn = 2; bool old_character_xtra = character_xtra; @@ -2837,42 +2673,34 @@ static PRICE compare_weapons(PRICE bcost) PRICE total = 0; PRICE cost = 0; /* First time no price */ - /* Save the screen */ screen_save(); - - /* Clear the screen */ clear_bldg(0, 22); /* Store copy of original wielded weapon */ i_ptr = &inventory[INVEN_RARM]; object_copy(&orig_weapon, i_ptr); - /* Only compare melee weapons */ - item_tester_no_ryoute = TRUE; item_tester_hook = item_tester_hook_orthodox_melee_weapons; /* Get the first weapon */ q = _("第一の武器は?", "What is your first weapon? "); s = _("比べるものがありません。", "You have nothing to compare."); - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) + o_ptr[0] = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr[0]) { screen_load(); return (0); } - /* Get the item (in the pack) */ - o_ptr[0] = &inventory[item]; n = 1; total = bcost; while (TRUE) { - /* Clear the screen */ clear_bldg(0, 22); /* Only compare melee weapons */ - item_tester_no_ryoute = TRUE; item_tester_hook = item_tester_hook_orthodox_melee_weapons; /* Hack -- prevent "icky" message */ @@ -2886,8 +2714,8 @@ static PRICE compare_weapons(PRICE bcost) /* Copy i-th weapon into the weapon slot (if it's not already there) */ if (o_ptr[i] != i_ptr) object_copy(i_ptr, o_ptr[i]); - /* Get the new values */ - calc_bonuses(); + p_ptr->update |= PU_BONUS; + handle_stuff(); /* List the new values */ list_weapon(o_ptr[i], row, col); @@ -2898,7 +2726,8 @@ static PRICE compare_weapons(PRICE bcost) } /* Reset the values for the old weapon */ - calc_bonuses(); + p_ptr->update |= PU_BONUS; + handle_stuff(); character_xtra = old_character_xtra; @@ -2928,13 +2757,11 @@ static PRICE compare_weapons(PRICE bcost) s = _("比べるものがありません。", "You have nothing to compare."); /* Get the second weapon */ - if (!get_item(&item2, q, s, (USE_EQUIP | USE_INVEN))) continue; + o_ptr[1] = choose_object(&item2, q, s, (USE_EQUIP | USE_INVEN | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr[1]) continue; total += cost; cost = bcost / 2; - - /* Get the item (in the pack) */ - o_ptr[1] = &inventory[item2]; n = 2; } else @@ -2942,8 +2769,6 @@ static PRICE compare_weapons(PRICE bcost) break; } } - - /* Restore the screen */ screen_load(); return (total); @@ -2998,23 +2823,13 @@ static bool eval_ac(ARMOUR_CLASS iAC) screen_save(); clear_bldg(0, 22); -#ifdef JP - put_str(format("あなたの現在のAC: %3d", iAC), row++, 0); - put_str(format("ダメージ軽減率 : %3d%%", protection), row++, 0); - row++; - - put_str("敵のレベル :", row + 0, 0); - put_str("回避率 :", row + 1, 0); - put_str("ダメージ期待値 :", row + 2, 0); -#else - put_str(format("Your current AC : %3d", iAC), row++, 0); - put_str(format("Protection rate : %3d%%", protection), row++, 0); + put_str(format(_("あなたの現在のAC: %3d", "Your current AC : %3d"), iAC), row++, 0); + put_str(format(_("ダメージ軽減率 : %3d%%", "Protection rate : %3d%%"), protection), row++, 0); row++; - put_str("Level of Monster:", row + 0, 0); - put_str("Dodge Rate :", row + 1, 0); - put_str("Average Damage :", row + 2, 0); -#endif + put_str(_("敵のレベル :", "Level of Monster:"), row + 0, 0); + put_str(_("回避率 :", "Dodge Rate :"), row + 1, 0); + put_str(_("ダメージ期待値 :", "Average Damage :"), row + 2, 0); for (col = 17 + 1, lvl = 0; lvl <= 100; lvl += 10, col += 5) { @@ -3119,13 +2934,10 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) int i, dd_bonus, ds_bonus; KIND_OBJECT_IDX k_idx; char basenm[MAX_NLEN]; - cptr q, s; /* For get_item prompt */ + concptr q, s; int row = 7; - - /* Clear screen */ clear_bldg(0, 22); - /* Notice */ prt(_("修復には材料となるもう1つの武器が必要です。", "Hand one material weapon to repair a broken weapon."), row, 2); prt(_("材料に使用した武器はなくなります!", "The material weapon will disappear after repairing!!"), row+1, 2); @@ -3135,10 +2947,8 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) /* Only forge broken weapons */ item_tester_hook = item_tester_hook_broken_weapon; - if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (0); - - /* Get the item (in the pack) */ - o_ptr = &inventory[item]; + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP)); + if (!o_ptr) return (0); /* It is worthless */ if (!object_is_ego(o_ptr) && !object_is_artifact(o_ptr)) @@ -3164,16 +2974,14 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) /* Only forge broken weapons */ item_tester_hook = item_tester_hook_orthodox_melee_weapons; - if (!get_item(&mater, q, s, (USE_INVEN | USE_EQUIP))) return (0); + mo_ptr = choose_object(&mater, q, s, (USE_INVEN | USE_EQUIP)); + if (!mo_ptr) return (0); if (mater == item) { msg_print(_("クラインの壷じゃない!", "This is not a klein bottle!")); return (0); } - /* Get the item (in the pack) */ - mo_ptr = &inventory[mater]; - /* Display item name */ object_desc(basenm, mo_ptr, OD_NAME_ONLY); prt(format(_("材料とする武器: %s", "Material : %s"), basenm), row+4, 2); @@ -3192,9 +3000,11 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) return (0); } + p_ptr->total_weight -= o_ptr->weight; + if (o_ptr->sval == SV_BROKEN_DAGGER) { - IDX j; + KIND_OBJECT_IDX j; int n = 1; /* Suppress compiler warning */ @@ -3290,7 +3100,6 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) } } - /* */ if (have_flag(k_ptr->flags, TR_BLOWS)) { int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds))); @@ -3346,6 +3155,9 @@ static PRICE repair_broken_weapon_aux(PRICE bcost) /* Add repaired flag */ o_ptr->discount = 99; + p_ptr->total_weight += o_ptr->weight; + calc_android_exp(); + /* Decrease material object */ inven_item_increase(mater, -1); inven_item_optimize(mater); @@ -3383,32 +3195,23 @@ static int repair_broken_weapon(PRICE bcost) */ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_CLASS to_ac) { - int i; - OBJECT_IDX item; - bool okay = FALSE; + int i; + OBJECT_IDX item; + bool okay = FALSE; object_type *o_ptr; - cptr q, s; - int maxenchant = (p_ptr->lev / 5); - char tmp_str[MAX_NLEN]; + concptr q, s; + int maxenchant = (p_ptr->lev / 5); + char tmp_str[MAX_NLEN]; clear_bldg(4, 18); -#ifdef JP - prt(format("現在のあなたの技量だと、+%d まで改良できます。", maxenchant), 5, 0); - prt(format(" 改良の料金は一個につき$%d です。", cost), 7, 0); -#else - prt(format(" Based on your skill, we can improve up to +%d.", maxenchant), 5, 0); - prt(format(" The price for the service is %d gold per item.", cost), 7, 0); -#endif - - item_tester_no_ryoute = TRUE; + prt(format(_("現在のあなたの技量だと、+%d まで改良できます。", " Based on your skill, we can improve up to +%d."), maxenchant), 5, 0); + prt(format(_(" 改良の料金は一個につき$%d です。", " The price for the service is %d gold per item."), cost), 7, 0); q = _("どのアイテムを改良しますか?", "Improve which item? "); s = _("改良できるものがありません。", "You have nothing to improve."); - if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP))) return (FALSE); - - /* Get the item (in the pack) */ - o_ptr = &inventory[item]; + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_EQUIP | IGNORE_BOTHHAND_SLOT)); + if (!o_ptr) return (FALSE); /* Check if the player has enough money */ if (p_ptr->au < (cost * o_ptr->number)) @@ -3460,11 +3263,8 @@ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_C /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - msg_print(_("改良に失敗した。", "The improvement failed.")); - return (FALSE); } else @@ -3504,7 +3304,7 @@ static void building_recharge(void) DEPTH lev; object_type *o_ptr; object_kind *k_ptr; - cptr q, s; + concptr q, s; PRICE price; PARAMETER_VALUE charges; int max_charges; @@ -3522,19 +3322,9 @@ static void building_recharge(void) q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? "); s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge."); - if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; - /* Get the item (in the pack) */ - if (item >= 0) - { - o_ptr = &inventory[item]; - } - - /* Get the item (on the floor) */ - else - { - o_ptr = &o_list[0 - item]; - } + o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR)); + if (!o_ptr) return; k_ptr = &k_info[o_ptr->k_idx]; @@ -3552,13 +3342,8 @@ static void building_recharge(void) get_check(_("$50で鑑定しますか? ", "Identify for 50 gold? "))) { - /* Pay the price */ p_ptr->au -= 50; - - /* Identify it */ identify_item(o_ptr); - - /* Description */ object_desc(tmp_str, o_ptr, 0); msg_format(_("%s です。", "You have: %s."), tmp_str); @@ -3653,8 +3438,7 @@ static void building_recharge(void) if (o_ptr->tval == TV_ROD) { #ifdef JP -if (get_check(format("そのロッドを$%d で再充填しますか?", - price))) + if (get_check(format("そのロッドを$%d で再充填しますか?", price))) #else if (get_check(format("Recharge the %s for %d gold? ", ((o_ptr->number > 1) ? "rods" : "rod"), price))) @@ -3700,9 +3484,7 @@ if (get_check(format("そのロッドを$%d で再充填しますか?", #else msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price); #endif - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); + p_ptr->update |= (PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN); @@ -3813,7 +3595,6 @@ static void building_recharge_all(void) /* skip non magic device */ if (o_ptr->tval < TV_STAFF || o_ptr->tval > TV_ROD) continue; - /* Identify it */ if (!object_is_known(o_ptr)) { identify_item(o_ptr); @@ -3845,9 +3626,7 @@ static void building_recharge_all(void) /* Give feedback */ msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost); msg_print(NULL); - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); + p_ptr->update |= (PU_COMBINE | PU_REORDER); p_ptr->window |= (PW_INVEN); @@ -3864,7 +3643,8 @@ static void building_recharge_all(void) */ bool tele_town(void) { - int i, x, y; + int i; + POSITION x, y; int num = 0; if (dun_level) @@ -3953,17 +3733,15 @@ static bool research_mon(void) MONSTER_IDX *who; /* XTRA HACK WHATSEARCH */ - bool all = FALSE; - bool uniq = FALSE; - bool norm = FALSE; + bool all = FALSE; + bool uniq = FALSE; + bool norm = FALSE; char temp[80] = ""; /* XTRA HACK REMEMBER_IDX */ static int old_sym = '\0'; static IDX old_i = 0; - - /* Save the screen */ screen_save(); /* Get a character, or abort */ @@ -4027,7 +3805,7 @@ static bool research_mon(void) /* Allocate the "who" array */ - C_MAKE(who, max_r_idx, IDX); + C_MAKE(who, max_r_idx, MONRACE_IDX); /* Collect matching monsters */ for (n = 0, i = 1; i < max_r_idx; i++) @@ -4084,7 +3862,7 @@ static bool research_mon(void) if (!n) { /* Free the "who" array */ - C_KILL(who, max_r_idx, IDX); + C_KILL(who, max_r_idx, MONRACE_IDX); /* Restore */ screen_load(); @@ -4140,8 +3918,6 @@ static bool research_mon(void) /* Save this monster ID */ monster_race_track(r_idx); - - /* Hack -- Handle stuff */ handle_stuff(); /* know every thing mode */ @@ -4192,7 +3968,7 @@ static bool research_mon(void) /* prt(buf, 5, 5);*/ /* Free the "who" array */ - C_KILL(who, max_r_idx, IDX); + C_KILL(who, max_r_idx, MONRACE_IDX); /* Restore */ screen_load(); @@ -4212,11 +3988,9 @@ static void bldg_process_command(building_type *bldg, int i) BACT_IDX bact = bldg->actions[i]; PRICE bcost; bool paid = FALSE; - int amt; - /* Flush messages */ msg_flag = FALSE; - msg_print(NULL); + msg_erase(); if (is_owner(bldg)) bcost = bldg->member_costs[i]; @@ -4327,50 +4101,19 @@ static void bldg_process_command(building_type *bldg, int i) item_tester_tval = TV_BOW; enchant_item(bcost, 1, 1, 0); break; + case BACT_RECALL: - if (recall_player(1)) paid = TRUE; + if (recall_player(p_ptr, 1)) paid = TRUE; break; - case BACT_TELEPORT_LEVEL: - { - IDX select_dungeon; - DEPTH max_depth; + case BACT_TELEPORT_LEVEL: clear_bldg(4, 20); - select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0); - show_building(bldg); - if (!select_dungeon) return; - - max_depth = d_info[select_dungeon].maxdepth; - - /* Limit depth in Angband */ - if (select_dungeon == DUNGEON_ANGBAND) - { - if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98; - else if(quest[QUEST_SERPENT].status != QUEST_STATUS_FINISHED) max_depth = 99; - } - amt = get_quantity(format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "), - d_name + d_info[select_dungeon].name), (QUANTITY)max_depth); - - if (amt > 0) - { - p_ptr->word_recall = 1; - p_ptr->recall_dungeon = select_dungeon; - max_dlv[p_ptr->recall_dungeon] = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt)); - if (record_maxdepth) - do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower")); - - msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged...")); - - paid = TRUE; - p_ptr->redraw |= (PR_STATUS); - } + paid = free_level_recall(p_ptr); break; - } + case BACT_LOSE_MUTATION: - if (p_ptr->muta1 || p_ptr->muta2 || - (p_ptr->muta3 & ~MUT3_GOOD_LUCK) || - (p_ptr->pseikaku != SEIKAKU_LUCKY && - (p_ptr->muta3 & MUT3_GOOD_LUCK))) + if (p_ptr->muta1 || p_ptr->muta2 || (p_ptr->muta3 & ~MUT3_GOOD_LUCK) || + (p_ptr->pseikaku != SEIKAKU_LUCKY && (p_ptr->muta3 & MUT3_GOOD_LUCK))) { while(!lose_mutation(0)); paid = TRUE; @@ -4381,21 +4124,27 @@ static void bldg_process_command(building_type *bldg, int i) msg_print(NULL); } break; + case BACT_BATTLE: kakutoujou(); break; + case BACT_TSUCHINOKO: tsuchinoko(); break; + case BACT_KUBI: shoukinkubi(); break; + case BACT_TARGET: today_target(); break; + case BACT_KANKIN: kankin(); break; + case BACT_HEIKOUKA: msg_print(_("平衡化の儀式を行なった。", "You received an equalization ritual.")); set_virtue(V_COMPASSION, 0); @@ -4419,12 +4168,15 @@ static void bldg_process_command(building_type *bldg, int i) get_virtues(); paid = TRUE; break; + case BACT_TELE_TOWN: paid = tele_town(); break; + case BACT_EVAL_AC: paid = eval_ac(p_ptr->dis_ac + p_ptr->dis_to_a); break; + case BACT_BROKEN_WEAPON: paid = TRUE; bcost = repair_broken_weapon(bcost); @@ -4443,6 +4195,8 @@ static void bldg_process_command(building_type *bldg, int i) */ void do_cmd_quest(void) { + if(p_ptr->wild_mode) return; + p_ptr->energy_use = 100; if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER)) @@ -4456,6 +4210,7 @@ void do_cmd_quest(void) if (!get_check(_("クエストに入りますか?", "Do you enter? "))) return; if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON)) msg_print(_("『とにかく入ってみようぜぇ。』", "")); + else if(p_ptr->pseikaku == SEIKAKU_CHARGEMAN) msg_print("『全滅してやるぞ!』"); /* Player enters a new quest */ p_ptr->oldpy = 0; @@ -4482,6 +4237,7 @@ void do_cmd_bldg(void) bool validcmd; building_type *bldg; + if(p_ptr->wild_mode) return; p_ptr->energy_use = 100; @@ -4548,10 +4304,7 @@ void do_cmd_bldg(void) p_ptr->oldpx = p_ptr->x; } - /* Forget the lite */ forget_lite(); - - /* Forget the view */ forget_view(); /* Hack -- Increase "icky" depth */ @@ -4595,21 +4348,15 @@ void do_cmd_bldg(void) } } - if (validcmd) - bldg_process_command(bldg, i); - - /* Notice stuff */ - notice_stuff(); + if(validcmd) bldg_process_command(bldg, i); - /* Handle stuff */ handle_stuff(); } select_floor_music(); - /* Flush messages */ msg_flag = FALSE; - msg_print(NULL); + msg_erase(); /* Reinit wilderness to activate quests ... */ if (reinit_wilderness) @@ -4620,133 +4367,9 @@ void do_cmd_bldg(void) /* Hack -- Decrease "icky" depth */ character_icky--; - /* Clear the screen */ Term_clear(); - /* Update the visuals */ p_ptr->update |= (PU_VIEW | PU_MONSTERS | PU_BONUS | PU_LITE | PU_MON_LITE); - - /* Redraw entire screen */ p_ptr->redraw |= (PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP); - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } - - -/*! - * @brief クエスト突入時のメッセージテーブル / Array of places to find an inscription - */ -static cptr find_quest[] = -{ - _("床にメッセージが刻まれている:", "You find the following inscription in the floor"), - _("壁にメッセージが刻まれている:", "You see a message inscribed in the wall"), - _("メッセージを見つけた:", "There is a sign saying"), - _("何かが階段の上に書いてある:", "Something is written on the staircase"), - _("巻物を見つけた。メッセージが書いてある:", "You find a scroll with the following message"), -}; - - -/*! - * @brief クエストの導入メッセージを表示する / Discover quest - * @param q_idx 開始されたクエストのID - */ -void quest_discovery(QUEST_IDX q_idx) -{ - quest_type *q_ptr = &quest[q_idx]; - monster_race *r_ptr = &r_info[q_ptr->r_idx]; - int q_num = q_ptr->max_num; - char name[80]; - - /* No quest index */ - if (!q_idx) return; - - strcpy(name, (r_name + r_ptr->name)); - - msg_print(find_quest[rand_range(0, 4)]); - msg_print(NULL); - - if (q_num == 1) - { - /* Unique */ - - /* Hack -- "unique" monsters must be "unique" */ - if ((r_ptr->flags1 & RF1_UNIQUE) && - (0 == r_ptr->max_num)) - { - msg_print(_("この階は以前は誰かによって守られていたようだ…。", "It seems that this level was protected by someone before...")); - /* The unique is already dead */ - quest[q_idx].status = QUEST_STATUS_FINISHED; - q_ptr->complev = 0; - update_playtime(); - q_ptr->comptime = playtime; - } - else - { - msg_format(_("注意せよ!この階は%sによって守られている!", "Beware, this level is protected by %s!"), name); - } - } - else - { - /* Normal monsters */ -#ifndef JP - plural_aux(name); -#endif - msg_format(_("注意しろ!この階は%d体の%sによって守られている!", "Be warned, this level is guarded by %d %s!"), q_num, name); - - } -} - - -/*! - * @brief 新しく入ったダンジョンの階層に固定されている一般のクエストを探し出しIDを返す。 - * / Hack -- Check if a level is a "quest" level - * @param level 検索対象になる階 - * @return クエストIDを返す。該当がない場合0を返す。 - */ -QUEST_IDX quest_number(DEPTH level) -{ - QUEST_IDX i; - - /* Check quests */ - if (p_ptr->inside_quest) - return (p_ptr->inside_quest); - - for (i = 0; i < max_q_idx; i++) - { - if (quest[i].status != QUEST_STATUS_TAKEN) continue; - - if ((quest[i].type == QUEST_TYPE_KILL_LEVEL) && - !(quest[i].flags & QUEST_FLAG_PRESET) && - (quest[i].level == level) && - (quest[i].dungeon == dungeon_type)) - return (i); - } - - /* Check for random quest */ - return (random_quest_number(level)); -} - -/*! - * @brief 新しく入ったダンジョンの階層に固定されているランダムクエストを探し出しIDを返す。 - * @param level 検索対象になる階 - * @return クエストIDを返す。該当がない場合0を返す。 - */ -QUEST_IDX random_quest_number(DEPTH level) -{ - QUEST_IDX i; - - if (dungeon_type != DUNGEON_ANGBAND) return 0; - - for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++) - { - if ((quest[i].type == QUEST_TYPE_RANDOM) && - (quest[i].status == QUEST_STATUS_TAKEN) && - (quest[i].level == level) && - (quest[i].dungeon == DUNGEON_ANGBAND)) - { - return i; - } - } - - return 0; -}