OSDN Git Service

Made the magic mapping part a complete sentence in the English description for the...
[hengbandforosx/hengbandosx.git] / src / spells2.c
index 90eccf0..07f59e6 100644 (file)
@@ -28,6 +28,8 @@
 #include "spells-floor.h"
 #include "realm-hex.h"
 #include "object-hook.h"
+#include "monster-status.h"
+#include "player-status.h"
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
@@ -373,9 +375,7 @@ bool detect_monsters_normal(POSITION range)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -422,8 +422,7 @@ bool detect_monsters_invis(POSITION range)
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -474,9 +473,7 @@ bool detect_monsters_evil(POSITION range)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -530,9 +527,7 @@ bool detect_monsters_nonliving(POSITION range)
        for (i = 1; i < m_max; i++)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -581,9 +576,7 @@ bool detect_monsters_mind(POSITION range)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -634,9 +627,7 @@ bool detect_monsters_string(POSITION range, concptr Match)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -689,9 +680,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -786,14 +775,11 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
        BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
        bool obvious = FALSE;
 
-
        /* Mark all (nearby) monsters */
        for (i = 1; i < m_max; i++)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -802,7 +788,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
                if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
 
                /* Mark the monster */
-               m_ptr->mflag |= (MFLAG_TEMP);
+               m_ptr->mflag |= (MFLAG_LOS);
        }
 
        /* Affect all marked monsters */
@@ -811,10 +797,10 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
                /* Skip unmarked monsters */
-               if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
+               if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
 
                /* Remove mark */
-               m_ptr->mflag &= ~(MFLAG_TEMP);
+               m_ptr->mflag &= ~(MFLAG_LOS);
 
                y = m_ptr->fy;
                x = m_ptr->fx;
@@ -981,9 +967,7 @@ void aggravate_monsters(MONSTER_IDX who)
        for (i = 1; i < m_max; i++)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip aggravating monster (or player) */
                if (i == who) continue;
@@ -1132,9 +1116,7 @@ bool symbol_genocide(int power, bool player_cast)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip "wrong" monsters */
                if (r_ptr->d_char != typ) continue;
@@ -1173,9 +1155,7 @@ bool mass_genocide(int power, bool player_cast)
        for (i = 1; i < m_max; i++)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip distant monsters */
                if (m_ptr->cdis > MAX_SIGHT) continue;
@@ -1216,9 +1196,7 @@ bool mass_genocide_undead(int power, bool player_cast)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
 
@@ -1262,9 +1240,7 @@ bool probing(void)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-               /* Paranoia -- Skip dead monsters */
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                /* Require line of sight */
                if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
@@ -1302,7 +1278,7 @@ bool probing(void)
                        if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
                        else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
                        else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
-                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
                        else align = _("中立", "neutral");
@@ -1491,8 +1467,6 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                {
                                        object_type *o_ptr;
                                        o_ptr = &current_floor_ptr->o_list[this_o_idx];
-
-                                       /* Acquire next object */
                                        next_o_idx = o_ptr->next_o_idx;
 
                                        /* Hack -- Preserve unknown artifacts */
@@ -1659,7 +1633,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
  * @details
  * <pre>
  *
- * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
+ * This will turn some walls into floors and some floors into walls.
  *
  * The player will take damage and "jump" into a safe grid if possible,
  * otherwise, he will "tunnel" through the rubble instantaneously.
@@ -1671,7 +1645,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
  * Note that thus the player and monsters (except eaters of walls and
  * passers through walls) will never occupy the same grid as a wall.
  * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
- * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
+ * for a single turn, unless that monster can pass_walls or kill_walls.
  * This has allowed massive simplification of the "monster" code.
  * </pre>
  */
@@ -1745,7 +1719,6 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                /* Check around the player */
                for (i = 0; i < 8; i++)
                {
-                       /* Access the location */
                        y = p_ptr->y + ddy_ddd[i];
                        x = p_ptr->x + ddx_ddd[i];
 
@@ -1838,10 +1811,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        {
                                GAME_TEXT m_name[MAX_NLEN];
                                monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
-
-                               /* Get the monster's real name */
-                               monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
+                               monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
                                killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
                        }
                        else
@@ -2148,7 +2118,7 @@ void discharge_minion(void)
                {
                        GAME_TEXT m_name[MAX_NLEN];
                        monster_desc(m_name, m_ptr, 0x00);
-                       msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
+                       msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
                        delete_monster_idx(i);
                        continue;
                }
@@ -2193,10 +2163,10 @@ static void cave_temp_room_lite(void)
        int i;
 
        /* Clear them all */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               POSITION y = temp_y[i];
-               POSITION x = temp_x[i];
+               POSITION y = tmp_pos.y[i];
+               POSITION x = tmp_pos.x[i];
 
                grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
@@ -2212,7 +2182,7 @@ static void cave_temp_room_lite(void)
                /* Process affected monsters */
                if (g_ptr->m_idx)
                {
-                       int chance = 25;
+                       PERCENTAGE chance = 25;
                        monster_type    *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
                        update_monster(g_ptr->m_idx, FALSE);
@@ -2245,7 +2215,7 @@ static void cave_temp_room_lite(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 }
 
 
@@ -2267,10 +2237,10 @@ static void cave_temp_room_unlite(void)
        int i;
 
        /* Clear them all */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               POSITION y = temp_y[i];
-               POSITION x = temp_x[i];
+               POSITION y = tmp_pos.y[i];
+               POSITION x = tmp_pos.x[i];
                int j;
 
                grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
@@ -2326,7 +2296,7 @@ static void cave_temp_room_unlite(void)
        }
 
        /* None left */
-       temp_n = 0;
+       tmp_pos.n = 0;
 }
 
 
@@ -2395,7 +2365,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
 
 
 /*!
- * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 部屋内のy座標1点
  * @param x 部屋内のx座標1点
  * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
@@ -2435,15 +2405,15 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
        }
 
        /* Paranoia -- verify space */
-       if (temp_n == TEMP_MAX) return;
+       if (tmp_pos.n == TEMP_MAX) return;
 
        /* Mark the grid as "seen" */
        g_ptr->info |= (CAVE_TEMP);
 
        /* Add it to the "seen" set */
-       temp_y[temp_n] = y;
-       temp_x[temp_n] = x;
-       temp_n++;
+       tmp_pos.y[tmp_pos.n] = y;
+       tmp_pos.x[tmp_pos.n] = x;
+       tmp_pos.n++;
 }
 
 /*!
@@ -2458,7 +2428,7 @@ static bool cave_pass_lite_bold(POSITION y, POSITION x)
 }
 
 /*!
- * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
@@ -2481,7 +2451,7 @@ static bool cave_pass_dark_bold(POSITION y, POSITION x)
 
 
 /*!
- * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
@@ -2507,9 +2477,9 @@ void lite_room(POSITION y1, POSITION x1)
        cave_temp_lite_room_aux(y1, x1);
 
        /* While grids are in the queue, add their neighbors */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               x = temp_x[i], y = temp_y[i];
+               x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get lit, but stop light */
                if (!cave_pass_lite_bold(y, x)) continue;
@@ -2552,9 +2522,9 @@ void unlite_room(POSITION y1, POSITION x1)
        cave_temp_unlite_room_aux(y1, x1);
 
        /* Spread, breadth first */
-       for (i = 0; i < temp_n; i++)
+       for (i = 0; i < tmp_pos.n; i++)
        {
-               x = temp_x[i], y = temp_y[i];
+               x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get dark, but stop darkness */
                if (!cave_pass_dark_bold(y, x)) continue;
@@ -2618,7 +2588,7 @@ bool lite_area(HIT_POINT dam, POSITION rad)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
        {
-               msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
+               msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs your light."));
                return FALSE;
        }
 
@@ -2647,7 +2617,6 @@ bool unlite_area(HIT_POINT dam, POSITION rad)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
 
-       /* Hack -- Message */
        if (!p_ptr->blind)
        {
                msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
@@ -4611,7 +4580,7 @@ bool_hack vampirism(void)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
        {
-               msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
+               msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
                return FALSE;
        }
 
@@ -5023,7 +4992,7 @@ bool double_attack(player_type *creature_ptr)
 
 bool comvert_hp_to_mp(player_type *creature_ptr)
 {
-       int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
+       int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
        if (gain_sp)
        {
                creature_ptr->csp += gain_sp;
@@ -5071,7 +5040,7 @@ bool mirror_concentration(player_type *creature_ptr)
 {
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                return FALSE;
        }
        if (is_mirror_grid(&current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
@@ -5088,7 +5057,7 @@ bool mirror_concentration(player_type *creature_ptr)
        }
        else
        {
-               msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
+               msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
        }
        return TRUE;
 }
@@ -5164,10 +5133,8 @@ bool rodeo(player_type *creature_ptr)
        }
        else
        {
-               msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
+               msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
                rakuba(1, TRUE);
-
-               /* Paranoia */
                /* 落馬処理に失敗してもとにかく乗馬解除 */
                creature_ptr->riding = 0;
        }
@@ -5178,7 +5145,7 @@ bool clear_mind(player_type *creature_ptr)
 {
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                return FALSE;
        }
        msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
@@ -5199,12 +5166,12 @@ bool concentration(player_type *creature_ptr)
 
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                return FALSE;
        }
        if (creature_ptr->special_defense & KATA_MASK)
        {
-               msg_print(_("今は構えに集中している。", "You need concentration on your form."));
+               msg_print(_("今は構えに集中している。", "You're already concentrating on your stance."));
                return FALSE;
        }
        msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));