OSDN Git Service

[Refactor] #37783 (2.2.1.5) 各魅了処理の整理。 / Refactor each magical effects of charm.
[hengband/hengband.git] / src / monster1.c
index e5b7caf..270ad1c 100644 (file)
@@ -47,7 +47,7 @@ static cptr wd_his[3] =
  * @details
  * The higher the level, the fewer kills needed.
  */
-static bool know_armour(IDX r_idx)
+static bool know_armour(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -85,7 +85,7 @@ static bool know_armour(IDX r_idx)
  * the more damage an attack does, the more attacks you need
  * </pre>
  */
-static bool know_damage(IDX r_idx, int i)
+static bool know_damage(MONRACE_IDX r_idx, int i)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -177,7 +177,7 @@ void dice_to_string(int base_damage, int dice_num, int dice_side, int dice_mult,
 * @param tmp 返すメッセージを格納する配列
 * @return なし
 */
-void set_damage(IDX r_idx, int SPELL_NUM, char* msg, char* tmp)
+void set_damage(MONRACE_IDX r_idx, int SPELL_NUM, char* msg, char* tmp)
 {
     int base_damage = monspell_race_damage(SPELL_NUM, r_idx, BASE_DAM);
     int dice_num = monspell_race_damage(SPELL_NUM, r_idx, DICE_NUM);
@@ -205,7 +205,7 @@ void set_damage(IDX r_idx, int SPELL_NUM, char* msg, char* tmp)
  * left edge of the screen, on a cleared line, in which the recall is
  * to take place.  One extra blank line is left after the recall.
  */
-static void roff_aux(IDX r_idx, int mode)
+static void roff_aux(MONRACE_IDX r_idx, BIT_FLAGS mode)
 {
        monster_race    *r_ptr = &r_info[r_idx];
 
@@ -229,16 +229,16 @@ static void roff_aux(IDX r_idx, int mode)
        bool            magic = FALSE;
        bool            reinforce = FALSE;
 
-       u32b            flags1;
-       u32b            flags2;
-       u32b            flags3;
-       u32b            flags4;
-       u32b            a_ability_flags1;
-       u32b            a_ability_flags2;
-       u32b            flags7;
-       u32b            flagsr;
+       BIT_FLAGS flags1;
+       BIT_FLAGS flags2;
+       BIT_FLAGS flags3;
+       BIT_FLAGS flags4;
+       BIT_FLAGS a_ability_flags1;
+       BIT_FLAGS a_ability_flags2;
+       BIT_FLAGS flags7;
+       BIT_FLAGS flagsr;
 
-       byte drop_gold, drop_item;
+       ITEM_NUMBER drop_gold, drop_item;
 
        int             vn = 0;
        byte            color[96];
@@ -648,29 +648,23 @@ static void roff_aux(IDX r_idx, int mode)
                {
                        long i, j;
 
-#ifdef JP
-                       i = p_ptr->lev;
-                       hooked_roff(format(" %lu レベルのキャラクタにとって", (long)i));
-
-                       i = (long)r_ptr->mexp * r_ptr->level / (p_ptr->max_plv+2);
-                       j = ((((long)r_ptr->mexp * r_ptr->level % (p_ptr->max_plv+2)) *
-                              (long)1000 / (p_ptr->max_plv+2) + 5) / 10);
-
-                       hooked_roff(format(" 約%ld.%02ld ポイントの経験となる。",
-                               (long)i, (long)j ));
-#else
                        /* calculate the integer exp part */
-                       i = (long)r_ptr->mexp * r_ptr->level / (p_ptr->max_plv+2);
+                       i = (long)r_ptr->mexp * r_ptr->level / (p_ptr->max_plv + 2) * 3 / 2;
 
                        /* calculate the fractional exp part scaled by 100, */
                        /* must use long arithmetic to avoid overflow  */
-                       j = ((((long)r_ptr->mexp * r_ptr->level % (p_ptr->max_plv+2)) *
-                              (long)1000 / (p_ptr->max_plv+2) + 5) / 10);
+                       j = ((((long)r_ptr->mexp * r_ptr->level % (p_ptr->max_plv + 2) * 3 / 2) *
+                               (long)1000 / (p_ptr->max_plv + 2) + 5) / 10);
+
+#ifdef JP
+                       hooked_roff(format(" %d レベルのキャラクタにとって 約%ld.%02ld ポイントの経験となる。",
+                               p_ptr->lev, (long)i, (long)j ));
+#else
 
                        /* Mention the experience */
-                       hooked_roff(format(" is worth about %ld.%02ld point%s",
-                                   (long)i, (long)j,
-                                   (((i == 1) && (j == 0)) ? "" : "s")));
+                       hooked_roff(format(" is worth about %ld.%02ld point%s for level %d player",
+                               (long)i, (long)j,
+                               (((i == 1) && (j == 0)) ? "" : "s")), p_ptr->lev);
 
                        /* Take account of annoying English */
                        p = "th";
@@ -2001,7 +1995,7 @@ static void roff_aux(IDX r_idx, int mode)
  * @param r_idx モンスターの種族ID
  * @return なし
  */
-void roff_top(IDX r_idx)
+void roff_top(MONRACE_IDX r_idx)
 {
        monster_race    *r_ptr = &r_info[r_idx];
 
@@ -2048,7 +2042,7 @@ void roff_top(IDX r_idx)
        /* Wizards get extra info */
        if (p_ptr->wizard)
        {
-               char buf[6];
+               char buf[16];
 
                sprintf(buf, "%d", r_idx);
 
@@ -2067,7 +2061,7 @@ void roff_top(IDX r_idx)
  * @param mode 表示オプション
  * @return なし
  */
-void screen_roff(IDX r_idx, int mode)
+void screen_roff(MONRACE_IDX r_idx, BIT_FLAGS mode)
 {
        /* Flush messages */
        msg_print(NULL);
@@ -2093,7 +2087,7 @@ void screen_roff(IDX r_idx, int mode)
  * @param r_idx モンスターの種族ID
  * @return なし
  */
-void display_roff(IDX r_idx)
+void display_roff(MONRACE_IDX r_idx)
 {
        int y;
 
@@ -2124,7 +2118,7 @@ void display_roff(IDX r_idx)
  * @param roff_func 出力処理を行う関数ポインタ
  * @return なし
  */
-void output_monster_spoiler(IDX r_idx, void (*roff_func)(byte attr, cptr str))
+void output_monster_spoiler(MONRACE_IDX r_idx, void (*roff_func)(byte attr, cptr str))
 {
        hook_c_roff = roff_func;
 
@@ -2138,7 +2132,7 @@ void output_monster_spoiler(IDX r_idx, void (*roff_func)(byte attr, cptr str))
  * @param r_idx 判定するモンスターの種族ID
  * @return ダンジョンに出現するならばTRUEを返す
  */
-bool mon_hook_dungeon(IDX r_idx)
+bool mon_hook_dungeon(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2159,7 +2153,7 @@ bool mon_hook_dungeon(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 海洋に出現するならばTRUEを返す
  */
-static bool mon_hook_ocean(IDX r_idx)
+static bool mon_hook_ocean(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2175,7 +2169,7 @@ static bool mon_hook_ocean(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 海岸に出現するならばTRUEを返す
  */
-static bool mon_hook_shore(IDX r_idx)
+static bool mon_hook_shore(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2191,7 +2185,7 @@ static bool mon_hook_shore(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 荒地に出現するならばTRUEを返す
  */
-static bool mon_hook_waste(IDX r_idx)
+static bool mon_hook_waste(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2207,7 +2201,7 @@ static bool mon_hook_waste(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 荒地に出現するならばTRUEを返す
  */
-static bool mon_hook_town(IDX r_idx)
+static bool mon_hook_town(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2223,7 +2217,7 @@ static bool mon_hook_town(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 森林に出現するならばTRUEを返す
  */
-static bool mon_hook_wood(IDX r_idx)
+static bool mon_hook_wood(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2239,7 +2233,7 @@ static bool mon_hook_wood(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 火山に出現するならばTRUEを返す
  */
-static bool mon_hook_volcano(IDX r_idx)
+static bool mon_hook_volcano(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2254,7 +2248,7 @@ static bool mon_hook_volcano(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 山地に出現するならばTRUEを返す
  */
-static bool mon_hook_mountain(IDX r_idx)
+static bool mon_hook_mountain(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2270,7 +2264,7 @@ static bool mon_hook_mountain(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 森林に出現するならばTRUEを返す
  */
-static bool mon_hook_grass(IDX r_idx)
+static bool mon_hook_grass(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2285,7 +2279,7 @@ static bool mon_hook_grass(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 深い水地形に出現するならばTRUEを返す
  */
-static bool mon_hook_deep_water(IDX r_idx)
+static bool mon_hook_deep_water(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2303,7 +2297,7 @@ static bool mon_hook_deep_water(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 浅い水地形に出現するならばTRUEを返す
  */
-static bool mon_hook_shallow_water(IDX r_idx)
+static bool mon_hook_shallow_water(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2321,7 +2315,7 @@ static bool mon_hook_shallow_water(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 溶岩地形に出現するならばTRUEを返す
  */
-static bool mon_hook_lava(IDX r_idx)
+static bool mon_hook_lava(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2341,7 +2335,7 @@ static bool mon_hook_lava(IDX r_idx)
  * @param r_idx 判定するモンスターの種族ID
  * @return 通常の床地形に出現するならばTRUEを返す
  */
-static bool mon_hook_floor(IDX r_idx)
+static bool mon_hook_floor(MONRACE_IDX r_idx)
 {
        monster_race *r_ptr = &r_info[r_idx];
 
@@ -2708,7 +2702,7 @@ bool monster_living(monster_race *r_ptr)
  * @details
  * 実質バーノール=ルパート用。
  */
-bool no_questor_or_bounty_uniques(IDX r_idx)
+bool no_questor_or_bounty_uniques(MONRACE_IDX r_idx)
 {
        switch (r_idx)
        {