OSDN Git Service

Corrected spelling in English description of the hatchet of Elmi the Murderer.
[hengbandforosx/hengbandosx.git] / src / bldg.c
index 5430c53..2b70a38 100644 (file)
 
 #include "angband.h"
 #include "floor.h"
+#include "object-boost.h"
 #include "object-hook.h"
+#include "monster.h"
 #include "monsterrace-hook.h"
 #include "melee.h"
+#include "wild.h"
 #include "world.h"
 #include "sort.h"
 
+#include "avatar.h"
 #include "mutation.h"
+#include "quest.h"
+#include "artifact.h"
+#include "cmd-spell.h"
+#include "rumor.h"
+#include "player-status.h"
+#include "spells-status.h"
 
 /*!
  * ループ中で / hack as in leave_store in store.c
@@ -1438,6 +1448,7 @@ void battle_monsters(void)
                }
                for (i=0;i<4;i++)
                {
+                       if (power[i] <= 0) break;
                        power[i] = total*60/power[i];
                        if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
                        if ((power[i] < 160) && randint0(20)) break;
@@ -1454,15 +1465,15 @@ void battle_monsters(void)
  */
 static bool kakutoujou(void)
 {
-       s32b maxbet;
-       s32b wager;
+       PRICE maxbet;
+       PRICE wager;
        char out_val[160], tmp_str[80];
        concptr p;
 
-       if ((turn - old_battle) > TURNS_PER_TICK*250)
+       if ((current_world_ptr->game_turn - old_battle) > TURNS_PER_TICK * 250)
        {
                battle_monsters();
-               old_battle = turn;
+               old_battle = current_world_ptr->game_turn;
        }
 
        screen_save();
@@ -1513,9 +1524,9 @@ static bool kakutoujou(void)
                        else bell();
                }
 
-               clear_bldg(4,4);
-               for (i=0;i<4;i++)
-                       if (i !=sel_monster) clear_bldg(i+5,i+5);
+               clear_bldg(4, 4);
+               for (i = 0; i < 4; i++)
+                       if (i != sel_monster) clear_bldg(i + 5, i + 5);
 
                maxbet = p_ptr->lev * 200;
 
@@ -1606,7 +1617,7 @@ static void today_target(void)
 static void tsuchinoko(void)
 {
        clear_bldg(4,18);
-       c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance to quick money!!!"), 5, 10);
+       c_put_str(TERM_YELLOW, _("一獲千金の大チャンス!!!", "Big chance for quick money!!!"), 5, 10);
        c_put_str(TERM_YELLOW, _("ターゲット:幻の珍獣「ツチノコ」", "target: the rarest animal 'Tsuchinoko'"), 6, 10);
        c_put_str(TERM_WHITE, _("生け捕り ---- $1,000,000", "catch alive ---- $1,000,000"), 8, 10);
        c_put_str(TERM_WHITE, _("死体     ----   $200,000", "corpse      ----   $200,000"), 9, 10);
@@ -1630,9 +1641,9 @@ static void shoukinkubi(void)
        {
                byte color;
                concptr done_mark;
-               monster_race *r_ptr = &r_info[(kubi_r_idx[i] > 10000 ? kubi_r_idx[i] - 10000 : kubi_r_idx[i])];
+               monster_race *r_ptr = &r_info[(current_world_ptr->bounty_r_idx[i] > 10000 ? current_world_ptr->bounty_r_idx[i] - 10000 : current_world_ptr->bounty_r_idx[i])];
 
-               if (kubi_r_idx[i] > 10000)
+               if (current_world_ptr->bounty_r_idx[i] > 10000)
                {
                        color = TERM_RED;
                        done_mark = _("(済)", "(done)");
@@ -1822,7 +1833,7 @@ static bool kankin(void)
                for (i = INVEN_PACK-1; i >= 0; i--)
                {
                        o_ptr = &inventory[i];
-                       if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == kubi_r_idx[j]))
+                       if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval == current_world_ptr->bounty_r_idx[j]))
                        {
                                char buf[MAX_NLEN+20];
                                int num, k;
@@ -1834,14 +1845,14 @@ static bool kankin(void)
                                if (!get_check(buf)) continue;
 
 #if 0 /* Obsoleted */
-                               msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[kubi_r_idx[j]].level + 1) * 300 * o_ptr->number);
-                               p_ptr->au += (r_info[kubi_r_idx[j]].level+1) * 300 * o_ptr->number;
+                               msg_format(_("賞金 %ld$を手に入れた。", "You get %ldgp."), (r_info[current_world_ptr->bounty_r_idx[j]].level + 1) * 300 * o_ptr->number);
+                               p_ptr->au += (r_info[current_world_ptr->bounty_r_idx[j]].level+1) * 300 * o_ptr->number;
                                p_ptr->redraw |= (PR_GOLD);
                                inven_item_increase(i, -o_ptr->number);
                                inven_item_describe(i);
                                inven_item_optimize(i);
                                chg_virtue(V_JUSTICE, 5);
-                               kubi_r_idx[j] += 10000;
+                               current_world_ptr->bounty_r_idx[j] += 10000;
 
                                change = TRUE;
 #endif /* Obsoleted */
@@ -1852,20 +1863,19 @@ static bool kankin(void)
                                inven_item_optimize(i);
 
                                chg_virtue(V_JUSTICE, 5);
-                               kubi_r_idx[j] += 10000;
+                               current_world_ptr->bounty_r_idx[j] += 10000;
 
                                /* Count number of unique corpses already handed */
                                for (num = 0, k = 0; k < MAX_KUBI; k++)
                                {
-                                       if (kubi_r_idx[k] >= 10000) num++;
+                                       if (current_world_ptr->bounty_r_idx[k] >= 10000) num++;
                                }
                                msg_format(_("これで合計 %d ポイント獲得しました。" ,"You earned %d point%s total."), num, (num > 1 ? "s" : ""));
 
                                /* Prepare to make a prize */
                                object_prep(&forge, lookup_kind(prize_list[num-1].tval, prize_list[num-1].sval));
-                               apply_magic(&forge, object_level, AM_NO_FIXED_ART);
+                               apply_magic(&forge, current_floor_ptr->object_level, AM_NO_FIXED_ART);
 
-                               /* Identify it fully */
                                object_aware(&forge);
                                object_known(&forge);
 
@@ -1932,7 +1942,7 @@ static bool inn_comm(int cmd)
                        }
                        else
                        {
-                               s32b oldturn = turn;
+                               s32b oldturn = current_world_ptr->game_turn;
                                int prev_day, prev_hour, prev_min;
 
                                extract_day_hour_min(&prev_day, &prev_hour, &prev_min);
@@ -1941,11 +1951,11 @@ static bool inn_comm(int cmd)
                                else
                                        do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("宿屋に泊まった。", "stay over night at the inn."));
                                
-                               turn = (turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
-                               if (dungeon_turn < dungeon_turn_limit)
+                               current_world_ptr->game_turn = (current_world_ptr->game_turn / (TURNS_PER_TICK * TOWN_DAWN / 2) + 1) * (TURNS_PER_TICK * TOWN_DAWN / 2);
+                               if (current_world_ptr->dungeon_turn < current_world_ptr->dungeon_turn_limit)
                                {
-                                       dungeon_turn += MIN((turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
-                                       if (dungeon_turn > dungeon_turn_limit) dungeon_turn = dungeon_turn_limit;
+                                       current_world_ptr->dungeon_turn += MIN((current_world_ptr->game_turn - oldturn), TURNS_PER_TICK * 250) * INN_DUNGEON_TURN_ADJ;
+                                       if (current_world_ptr->dungeon_turn > current_world_ptr->dungeon_turn_limit) current_world_ptr->dungeon_turn = current_world_ptr->dungeon_turn_limit;
                                }
 
                                prevent_turn_overflow();
@@ -2021,7 +2031,7 @@ static bool inn_comm(int cmd)
 static void get_questinfo(IDX questnum, bool do_init)
 {
        int i;
-       IDX old_quest;
+       QUEST_IDX old_quest;
        GAME_TEXT tmp_str[80];
 
        /* Clear the text */
@@ -2064,16 +2074,16 @@ 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;
-       concptr            name;
+       QUEST_IDX q_index = 0;
+       monster_race *r_ptr;
+       quest_type *q_ptr;
+       concptr name;
 
 
        clear_bldg(4, 18);
 
        /* Current quest of the building */
-       q_index = cave[p_ptr->y][p_ptr->x].special;
+       q_index = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
 
        /* Is there a quest available at the building? */
        if (!q_index)
@@ -2146,7 +2156,11 @@ static void castle_quest(void)
 
                        q_ptr->cur_num = 0;
                        name = (r_name + r_ptr->name);
-                       msg_format(_("クエスト: %sを %d体倒す", "Your quest: kill %d %s"), name,q_ptr->max_num);
+#ifdef JP
+                       msg_format("クエスト: %sを %d体倒す", name, q_ptr->max_num);
+#else
+                       msg_format("Your quest: kill %d %s", q_ptr->max_num, name);
+#endif
                }
                else
                {
@@ -2820,23 +2834,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);
+       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("敵のレベル      :", 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);
-       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)
        {
@@ -3145,7 +3149,7 @@ static PRICE repair_broken_weapon_aux(PRICE bcost)
                        one_ability(o_ptr);
                }
 
-               msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptionally."));
+               msg_print(_("これはかなりの業物だったようだ。", "This blade seems to be exceptional."));
        }
 
        object_desc(basenm, o_ptr, OD_NAME_ONLY);
@@ -3295,13 +3299,13 @@ static bool enchant_item(PRICE cost, HIT_PROB to_hit, HIT_POINT to_dam, ARMOUR_C
 
 
 /*!
- * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staves
+ * @brief 魔道具の使用回数を回復させる施設のメインルーチン / Recharge rods, wands and staffs
  * @details
  * The player can select the number of charges to add\n
  * (up to a limit), and the recharge never fails.\n
  *\n
  * The cost for rods depends on the level of the rod. The prices\n
- * for recharging wands and staves are dependent on the cost of\n
+ * for recharging wands and staffs are dependent on the cost of\n
  * the base-item.\n
  * @return なし
  */
@@ -3467,7 +3471,7 @@ static void building_recharge(void)
                else
                        max_charges = o_ptr->number * k_ptr->pval - o_ptr->pval;
 
-               /* Get the quantity for staves and wands */
+               /* Get the quantity for staffs and wands */
                charges = (PARAMETER_VALUE)get_quantity(format(_("一回分$%d で何回分充填しますか?", "Add how many charges for %d gold? "), price), 
                                        MIN(p_ptr->au / price, max_charges));
 
@@ -3491,8 +3495,6 @@ static void building_recharge(void)
 #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->update |= (PU_COMBINE | PU_REORDER);
 
        p_ptr->window |= (PW_INVEN);
@@ -3506,13 +3508,13 @@ static void building_recharge(void)
 
 
 /*!
- * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staves
+ * @brief 魔道具の使用回数を回復させる施設の一括処理向けサブルーチン / Recharge rods, wands and staffs
  * @details
  * The player can select the number of charges to add\n
  * (up to a limit), and the recharge never fails.\n
  *\n
  * The cost for rods depends on the level of the rod. The prices\n
- * for recharging wands and staves are dependent on the cost of\n
+ * for recharging wands and staffs are dependent on the cost of\n
  * the base-item.\n
  * @return なし
  */
@@ -3635,8 +3637,6 @@ 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->update |= (PU_COMBINE | PU_REORDER);
 
        p_ptr->window |= (PW_INVEN);
@@ -3658,7 +3658,7 @@ bool tele_town(void)
        POSITION x, y;
        int num = 0;
 
-       if (dun_level)
+       if (current_floor_ptr->dun_level)
        {
                msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
                return FALSE;
@@ -3679,7 +3679,7 @@ bool tele_town(void)
 
                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);
+               sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
                prt(buf, 5 + i, 5);
                num++;
        }
@@ -3692,7 +3692,7 @@ bool tele_town(void)
                return FALSE;
        }
 
-       prt(_("どこに行きますか:", "Which town you go: "), 0, 0);
+       prt(_("どこに行きますか:", "Where do you want to go: "), 0, 0);
        while(1)
        {
                i = inkey();
@@ -3707,9 +3707,9 @@ bool tele_town(void)
                break;
        }
 
-       for (y = 0; y < max_wild_y; y++)
+       for (y = 0; y < current_world_ptr->max_wild_y; y++)
        {
-               for (x = 0; x < max_wild_x; x++)
+               for (x = 0; x < current_world_ptr->max_wild_x; x++)
                {
                        if(wilderness[y][x].town == (i-'a'+1))
                        {
@@ -3744,9 +3744,9 @@ 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 */
@@ -3760,7 +3760,6 @@ static bool research_mon(void)
                                   "Enter character to be identified(^A:All,^U:Uniqs,^N:Non uniqs,^M:Name): "), &sym, FALSE)) 
 
        {
-               /* Restore */
                screen_load();
 
                return (FALSE);
@@ -3794,8 +3793,6 @@ static bool research_mon(void)
                if (!get_string(_("名前(英語の場合小文字で可)", "Enter name:"),temp, 70))
                {
                        temp[0]=0;
-
-                       /* Restore */
                        screen_load();
 
                        return FALSE;
@@ -3814,7 +3811,6 @@ static bool research_mon(void)
        /* Display the result */
        prt(buf, 16, 10);
 
-
        /* Allocate the "who" array */
        C_MAKE(who, max_r_idx, MONRACE_IDX);
 
@@ -3874,8 +3870,6 @@ static bool research_mon(void)
        {
                /* Free the "who" array */
                C_KILL(who, max_r_idx, MONRACE_IDX);
-
-               /* Restore */
                screen_load();
 
                return (FALSE);
@@ -3888,12 +3882,7 @@ static bool research_mon(void)
        /* Sort if needed */
        if (why)
        {
-               /* 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);
+               ang_sort(who, &why, n, ang_sort_comp_hook, ang_sort_swap_hook);
        }
 
 
@@ -3980,8 +3969,6 @@ static bool research_mon(void)
 
        /* Free the "who" array */
        C_KILL(who, max_r_idx, MONRACE_IDX);
-
-       /* Restore */
        screen_load();
 
        return (!notpicked);
@@ -4208,7 +4195,7 @@ void do_cmd_quest(void)
 {
        if(p_ptr->wild_mode) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER))
        {
@@ -4229,8 +4216,8 @@ void do_cmd_quest(void)
 
                leave_quest_check();
 
-               if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
-               p_ptr->inside_quest = cave[p_ptr->y][p_ptr->x].special;
+               if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) current_floor_ptr->dun_level = 1;
+               p_ptr->inside_quest = current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special;
 
                p_ptr->leaving = TRUE;
        }
@@ -4250,7 +4237,7 @@ void do_cmd_bldg(void)
 
        if(p_ptr->wild_mode) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
        {
@@ -4258,7 +4245,7 @@ void do_cmd_bldg(void)
                return;
        }
 
-       which = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype;
+       which = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
 
        bldg = &building[which];
 
@@ -4288,7 +4275,7 @@ void do_cmd_bldg(void)
                        command_new = SPECIAL_KEY_BUILDING;
 
                        /* No energy needed to re-enter the arena */
-                       p_ptr->energy_use = 0;
+                       free_turn(p_ptr);
                }
 
                return;
@@ -4305,7 +4292,7 @@ void do_cmd_bldg(void)
                command_new = SPECIAL_KEY_BUILDING;
 
                /* No energy needed to re-enter the arena */
-               p_ptr->energy_use = 0;
+               free_turn(p_ptr);
 
                return;
        }
@@ -4384,121 +4371,3 @@ void do_cmd_bldg(void)
        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 concptr 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];
-       MONSTER_NUMBER q_num = q_ptr->max_num;
-       GAME_TEXT name[MAX_NLEN];
-
-       /* 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;
-}