X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fbldg.c;h=557f9b2f99029a9c3b0c64096cd25c9a4b413b0b;hb=744271a78568822e914a3fe1faf3c153b1ba9954;hp=c5bc79bab553a5aa9303c12017b09a8fb01228a0;hpb=6cf96c6b1c3341ee94382b482f969b4b7f9d5858;p=hengband%2Fhengband.git diff --git a/src/bldg.c b/src/bldg.c index c5bc79bab..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,44 +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); - - /* Okay */ - return (TRUE); -} - -/*! * @brief モンスター闘技場に参加するモンスターをリセットする。 * @return なし */ @@ -1507,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; @@ -1581,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) { @@ -1744,7 +1623,7 @@ static void tsuchinoko(void) static void shoukinkubi(void) { int i; - int y = 0; + TERM_LEN y = 0; clear_bldg(4,18); prt(_("死体を持ち帰れば報酬を差し上げます。", "Offer a prize when you bring a wanted monster's corpse"),4 ,10); @@ -1753,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) @@ -1821,9 +1700,10 @@ static struct { */ static bool kankin(void) { - int i, j; + 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 */ @@ -1948,7 +1828,8 @@ static bool kankin(void) if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j])) { char buf[MAX_NLEN+20]; - int num, k, item_new; + int num, k; + INVENTORY_IDX item_new; object_type forge; object_desc(o_name, o_ptr, 0); @@ -1998,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; @@ -2023,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 @@ -2164,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++) @@ -2208,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); @@ -2306,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(); } @@ -2356,7 +2212,7 @@ HIT_POINT calc_crit_ratio_shot(HIT_POINT plus_ammo, HIT_POINT plus_bow) * @param dam 基本ダメージ量 * @return ダメージ期待値 */ -HIT_POINT calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, HIT_POINT dam) +HIT_POINT calc_expect_crit_shot(WEIGHT weight, int plus_ammo, int plus_bow, HIT_POINT dam) { u32b num; int i, k, crit; @@ -2398,7 +2254,7 @@ HIT_POINT calc_expect_crit_shot(int weight, int plus_ammo, int plus_bow, HIT_PO * @param dokubari 毒針処理か否か * @return ダメージ期待値 */ -HIT_POINT calc_expect_crit(int weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari) +HIT_POINT calc_expect_crit(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, bool dokubari) { u32b k, num; int i; @@ -2477,7 +2333,7 @@ static HIT_POINT calc_slaydam(HIT_POINT dam, int mult, int div, bool force) * @param vorpal_div 切れ味倍率(割り算部分) * @return ダメージ期待値 */ -static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, int weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div) +static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, WEIGHT weight, int plus, s16b meichuu, bool dokubari, int vorpal_mult, int vorpal_div) { dam = calc_slaydam(dam, mult, div, force); dam = calc_expect_crit(weight, plus, dam, meichuu, dokubari); @@ -2504,9 +2360,9 @@ static u32b calc_expect_dice(u32b dam, int mult, int div, bool force, int weight * 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); @@ -2537,7 +2393,7 @@ static void show_weapon_dmg(int r, int c, int mindice, int maxdice, int blows, i */ static void compare_weapon_aux(object_type *o_ptr, int col, int r) { - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; int blow = p_ptr->num_blow[0]; bool force = FALSE; bool dokubari = FALSE; @@ -2738,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 int hit_chance(int to_h, int ac) -{ - int 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 表示する列の左端 @@ -2771,14 +2605,14 @@ static int hit_chance(int to_h, int ac) * various info about the player's +to_dam and number of blows. * @return なし */ -static void list_weapon(object_type *o_ptr, int row, int col) +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 */ - int eff_dd = o_ptr->dd + p_ptr->to_dd[0]; - int eff_ds = o_ptr->ds + p_ptr->to_ds[0]; + 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); @@ -2794,8 +2628,11 @@ static void list_weapon(object_type *o_ptr, int row, int 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); @@ -2812,53 +2649,6 @@ static void list_weapon(object_type *o_ptr, int row, int col) put_str(tmp_str, row+7, col+1); } - -/*! - * @brief 武器匠の「武器」鑑定対象になるかを判定する。/ Hook to specify "weapon" - * @param o_ptr オブジェクトの構造体の参照ポインタ。 - * @return 対象になるならTRUEを返す。 - */ -static bool item_tester_hook_melee_weapon(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_HAFTED: - case TV_POLEARM: - case TV_DIGGING: - { - return (TRUE); - } - case TV_SWORD: - { - if (o_ptr->sval != SV_DOKUBARI) return (TRUE); - } - } - - return (FALSE); -} - - -/*! - * @brief 武器匠の「矢弾」鑑定対象になるかを判定する。/ Hook to specify "weapon" - * @param o_ptr オブジェクトの構造体の参照ポインタ。 - * @return 対象になるならTRUEを返す。 - */ -static bool item_tester_hook_ammo(object_type *o_ptr) -{ - switch (o_ptr->tval) - { - case TV_SHOT: - case TV_ARROW: - case TV_BOLT: - { - return (TRUE); - } - } - - return (FALSE); -} - - /*! * @brief 武器匠鑑定1回分(オブジェクト2種)の処理。/ Compare weapons * @details @@ -2868,58 +2658,50 @@ static bool item_tester_hook_ammo(object_type *o_ptr) * @param bcost 基本鑑定費用 * @return 最終的にかかった費用 */ -static int compare_weapons(int bcost) +static PRICE compare_weapons(PRICE bcost) { int i, n; OBJECT_IDX item, item2; object_type *o_ptr[2]; object_type orig_weapon; object_type *i_ptr; - cptr q, s; - int row = 2; - int wid = 38, mgn = 2; + concptr q, s; + TERM_LEN row = 2; + TERM_LEN wid = 38, mgn = 2; bool old_character_xtra = character_xtra; char ch; - int total = 0; - int cost = 0; /* First time no price */ + 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_melee_weapon; + 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_melee_weapon; + item_tester_hook = item_tester_hook_orthodox_melee_weapons; /* Hack -- prevent "icky" message */ character_xtra = TRUE; @@ -2932,8 +2714,8 @@ static int compare_weapons(int 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); @@ -2944,7 +2726,8 @@ static int compare_weapons(int bcost) } /* Reset the values for the old weapon */ - calc_bonuses(); + p_ptr->update |= PU_BONUS; + handle_stuff(); character_xtra = old_character_xtra; @@ -2974,13 +2757,11 @@ static int compare_weapons(int 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 @@ -2988,11 +2769,8 @@ static int compare_weapons(int bcost) break; } } - - /* Restore the screen */ screen_load(); - /* Done */ return (total); } @@ -3005,7 +2783,7 @@ static int compare_weapons(int bcost) * @param iAC プレイヤーのAC。 * @return 常にTRUEを返す。 */ -static bool eval_ac(int iAC) +static bool eval_ac(ARMOUR_CLASS iAC) { #ifdef JP const char memo[] = @@ -3032,8 +2810,8 @@ static bool eval_ac(int iAC) #endif int protection; - int col, row = 2; - int lvl; + TERM_LEN col, row = 2; + DEPTH lvl; char buf[80*20], *t; /* AC lower than zero has no effect */ @@ -3045,23 +2823,13 @@ static bool eval_ac(int 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) { @@ -3085,40 +2853,16 @@ static bool eval_ac(int iAC) for (t = buf; t[0]; t += strlen(t) + 1) put_str(t, (row++) + 4, 4); -#ifdef JP - prt("現在のあなたの装備からすると、あなたの防御力は" - "これくらいです:", 0, 0); -#else - prt("Defense abilities from your current Armor Class are evaluated below.", 0, 0); -#endif + prt(_("現在のあなたの装備からすると、あなたの防御力はこれくらいです:", "Defense abilities from your current Armor Class are evaluated below."), 0, 0); flush(); (void)inkey(); screen_load(); - /* Done */ return (TRUE); } -/*! - * @brief 修復対象となる壊れた武器かを判定する。 / Hook to specify "broken weapon" - * @param o_ptr オブジェクトの構造体の参照ポインタ。 - * @return 修復対象になるならTRUEを返す。 - */ -static bool item_tester_hook_broken_weapon(object_type *o_ptr) -{ - if (o_ptr->tval != TV_SWORD) return FALSE; - - switch (o_ptr->sval) - { - case SV_BROKEN_DAGGER: - case SV_BROKEN_SWORD: - return TRUE; - } - - return FALSE; -} /*! * @brief 修復材料のオブジェクトから修復対象に特性を移植する。 @@ -3130,8 +2874,8 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt { int i, n = 0; int cand[TR_FLAG_MAX]; - u32b to_flgs[TR_FLAG_SIZE]; - u32b from_flgs[TR_FLAG_SIZE]; + BIT_FLAGS to_flgs[TR_FLAG_SIZE]; + BIT_FLAGS from_flgs[TR_FLAG_SIZE]; object_flags(to_ptr, to_flgs); object_flags(from_ptr, from_flgs); @@ -3178,39 +2922,33 @@ static void give_one_ability_of_object(object_type *to_ptr, object_type *from_pt /*! * @brief アイテム修復処理のメインルーチン / Repair broken weapon - * @param bcost 基本鑑定費用 + * @param bcost 基本修復費用 * @return 実際にかかった費用 */ -static int repair_broken_weapon_aux(int bcost) +static PRICE repair_broken_weapon_aux(PRICE bcost) { - s32b cost; + PRICE cost; OBJECT_IDX item, mater; object_type *o_ptr, *mo_ptr; /* broken weapon and material weapon */ object_kind *k_ptr; int i, dd_bonus, ds_bonus; - IDX k_idx; + 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); - /* Get an item */ q = _("どの折れた武器を修復しますか?", "Repair which broken weapon? "); s = _("修復できる折れた武器がありません。", "You have no broken weapon to repair."); /* 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)) @@ -3230,23 +2968,20 @@ static int repair_broken_weapon_aux(int bcost) object_desc(basenm, o_ptr, OD_NAME_ONLY); prt(format(_("修復する武器 : %s", "Repairing: %s"), basenm), row+3, 2); - /* Get an item */ q = _("材料となる武器は?", "Which weapon for material? "); s = _("材料となる武器がありません。", "You have no material to repair."); /* Only forge broken weapons */ - item_tester_hook = item_tester_hook_melee_weapon; + 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); @@ -3260,15 +2995,16 @@ static int repair_broken_weapon_aux(int bcost) if (p_ptr->au < cost) { object_desc(basenm, o_ptr, OD_NAME_ONLY); - msg_format(_("%sを修復するだけのゴールドがありません!", - "You do not have the gold to repair %s!"), basenm); + msg_format(_("%sを修復するだけのゴールドがありません!", "You do not have the gold to repair %s!"), basenm); msg_print(NULL); 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 */ @@ -3364,7 +3100,6 @@ static int repair_broken_weapon_aux(int bcost) } } - /* */ if (have_flag(k_ptr->flags, TR_BLOWS)) { int bmax = MIN(3, MAX(1, 40 / (o_ptr->dd * o_ptr->ds))); @@ -3420,6 +3155,9 @@ static int repair_broken_weapon_aux(int 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); @@ -3437,10 +3175,9 @@ static int repair_broken_weapon_aux(int bcost) * @param bcost 基本鑑定費用 * @return 実際にかかった費用 */ -static int repair_broken_weapon(int bcost) +static int repair_broken_weapon(PRICE bcost) { - int cost; - + PRICE cost; screen_save(); cost = repair_broken_weapon_aux(bcost); screen_load(); @@ -3454,37 +3191,27 @@ static int repair_broken_weapon(int bcost) * @param to_hit 命中をアップさせる量 * @param to_dam ダメージをアップさせる量 * @param to_ac ACをアップさせる量 - * @return 実際にかかった費用 + * @return 実際に行ったらTRUE */ -static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac) +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); - /* Get an item */ 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)) @@ -3536,12 +3263,8 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac) /* Failure */ if (!okay) { - /* Flush */ if (flush_failure) flush(); - - /* Message */ msg_print(_("改良に失敗した。", "The improvement failed.")); - return (FALSE); } else @@ -3578,11 +3301,11 @@ static bool enchant_item(int cost, int to_hit, int to_dam, int to_ac) static void building_recharge(void) { OBJECT_IDX item; - int lev; + DEPTH lev; object_type *o_ptr; object_kind *k_ptr; - cptr q, s; - int price; + concptr q, s; + PRICE price; PARAMETER_VALUE charges; int max_charges; char tmp_str[MAX_NLEN]; @@ -3597,22 +3320,11 @@ static void building_recharge(void) /* Only accept legal items */ item_tester_hook = item_tester_hook_recharge; - /* Get an item */ 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]; @@ -3630,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); @@ -3731,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))) @@ -3778,11 +3484,8 @@ if (get_check(format("そのロッドを$%d で再充填しますか?", #else msg_format("%^s %s recharged for %d gold.", tmp_str, ((o_ptr->number > 1) ? "were" : "was"), price); #endif + p_ptr->update |= (PU_COMBINE | PU_REORDER); - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ p_ptr->window |= (PW_INVEN); /* Pay the price */ @@ -3806,12 +3509,12 @@ if (get_check(format("そのロッドを$%d で再充填しますか?", */ static void building_recharge_all(void) { - int i; - int lev; + INVENTORY_IDX i; + DEPTH lev; object_type *o_ptr; object_kind *k_ptr; - int price = 0; - int total_cost = 0; + PRICE price = 0; + PRICE total_cost = 0; /* Display some info */ @@ -3892,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); @@ -3924,11 +3626,8 @@ static void building_recharge_all(void) /* Give feedback */ msg_format(_("$%d で再充填しました。", "You pay %d gold."), total_cost); msg_print(NULL); + p_ptr->update |= (PU_COMBINE | PU_REORDER); - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ p_ptr->window |= (PW_INVEN); /* Pay the price */ @@ -3944,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) @@ -3962,14 +3662,14 @@ bool tele_town(void) screen_save(); clear_bldg(4, 10); - for (i=1;itown_num) || !(p_ptr->visit & (1L << (i-1)))) continue; + if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue; - sprintf(buf,"%c) %-20s", I2A(i-1), town[i].name); - prt(buf, 5+i, 5); + sprintf(buf, "%c) %-20s", I2A(i - 1), town[i].name); + prt(buf, 5 + i, 5); num++; } @@ -4027,27 +3727,21 @@ static bool research_mon(void) MONRACE_IDX r_idx; char sym, query; char buf[128]; - bool notpicked; - bool recall = FALSE; - u16b why = 0; - - IDX *who; + 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 */ @@ -4111,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++) @@ -4168,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(); @@ -4224,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 */ @@ -4276,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(); @@ -4296,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 XXX XXX XXX */ msg_flag = FALSE; - msg_print(NULL); + msg_erase(); if (is_owner(bldg)) bcost = bldg->member_costs[i]; @@ -4386,16 +4076,9 @@ static void bldg_process_command(building_type *bldg, int i) building_recharge_all(); break; case BACT_IDENTS: /* needs work */ -#ifdef JP - if (!get_check("持ち物を全て鑑定してよろしいですか?")) break; + if (!get_check(_("持ち物を全て鑑定してよろしいですか?", "Do you pay for identify all your possession? "))) break; identify_pack(); - msg_print(" 持ち物全てが鑑定されました。"); -#else - if (!get_check("Do you pay for identify all your possession? ")) break; - identify_pack(); - msg_print("Your possessions have been identified."); -#endif - + msg_print(_(" 持ち物全てが鑑定されました。", "Your possessions have been identified.")); paid = TRUE; break; case BACT_IDENT_ONE: /* needs work */ @@ -4405,21 +4088,10 @@ static void bldg_process_command(building_type *bldg, int i) do_cmd_study(); break; case BACT_HEALING: /* needs work */ - hp_player(200); - set_poisoned(0); - set_blind(0); - set_confused(0); - set_cut(0); - set_stun(0); - paid = TRUE; + paid = cure_critical_wounds(200); break; case BACT_RESTORE: /* needs work */ - if (do_res_stat(A_STR)) paid = TRUE; - if (do_res_stat(A_INT)) paid = TRUE; - if (do_res_stat(A_WIS)) paid = TRUE; - if (do_res_stat(A_DEX)) paid = TRUE; - if (do_res_stat(A_CON)) paid = TRUE; - if (do_res_stat(A_CHR)) paid = TRUE; + paid = restore_all_status(); break; case BACT_ENCHANT_ARROWS: item_tester_hook = item_tester_hook_ammo; @@ -4429,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; @@ -4483,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); @@ -4521,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); @@ -4545,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)) @@ -4558,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; @@ -4584,6 +4237,7 @@ void do_cmd_bldg(void) bool validcmd; building_type *bldg; + if(p_ptr->wild_mode) return; p_ptr->energy_use = 100; @@ -4650,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 */ @@ -4697,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 XXX XXX XXX */ msg_flag = FALSE; - msg_print(NULL); + msg_erase(); /* Reinit wilderness to activate quests ... */ if (reinit_wilderness) @@ -4722,135 +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); - - /* Window stuff */ 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(int 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を返す。 - */ -IDX quest_number(DEPTH level) -{ - IDX i; - - /* Check quests */ - if (p_ptr->inside_quest) - return (p_ptr->inside_quest); - - for (i = 0; i < max_quests; 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を返す。 - */ -IDX random_quest_number(DEPTH level) -{ - 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; - } - } - - /* Nope */ - return 0; -}