OSDN Git Service

[Refactor] #40414 Separated spells-sight.c/h from spells2.c/h
authorHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 11:52:37 +0000 (20:52 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 4 Jun 2020 11:52:37 +0000 (20:52 +0900)
34 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-action/cmd-mane.c
src/cmd-action/cmd-spell.c
src/cmd-item/cmd-activate.c
src/cmd-item/cmd-read.c
src/cmd-item/cmd-usestaff.c
src/cmd-item/cmd-zaprod.c
src/grid/trap.c
src/mind/mind.c
src/mind/racial.c
src/mspell/mspell-floor.c
src/mspell/mspells3.c
src/mutation/mutation-processor.c
src/mutation/mutation.c
src/player/patron.c
src/realm/realm-crusade.c
src/realm/realm-daemon.c
src/realm/realm-death.c
src/realm/realm-hex.c
src/realm/realm-hissatsu.c
src/realm/realm-life.c
src/realm/realm-nature.c
src/realm/realm-song.c
src/realm/realm-sorcery.c
src/realm/realm-trump.c
src/specific-object/chest.c
src/spell/spells-sight.c [new file with mode: 0644]
src/spell/spells-sight.h [new file with mode: 0644]
src/spell/spells-summon.c
src/spell/spells2.c
src/spell/spells2.h
src/spell/spells3.c

index f411cea..62dfdef 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-detection.c" />\r
     <ClCompile Include="..\..\src\spell\spells-hex.c" />\r
     <ClCompile Include="..\..\src\spell\spells-launcher.c" />\r
+    <ClCompile Include="..\..\src\spell\spells-sight.c" />\r
     <ClCompile Include="..\..\src\spell\spells-teleport.c" />\r
     <ClCompile Include="..\..\src\system\system-variables.c" />\r
     <ClCompile Include="..\..\src\core\show-file.c" />\r
     <ClInclude Include="..\..\src\spell\spells-describer.h" />\r
     <ClInclude Include="..\..\src\spell\spells-hex.h" />\r
     <ClInclude Include="..\..\src\spell\spells-launcher.h" />\r
+    <ClInclude Include="..\..\src\spell\spells-sight.h" />\r
     <ClInclude Include="..\..\src\spell\spells-teleport.h" />\r
     <ClInclude Include="..\..\src\sv-definition\sv-amulet-types.h" />\r
     <ClInclude Include="..\..\src\sv-definition\sv-armor-types.h" />\r
index ae64df4..1398087 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-launcher.c">
       <Filter>spell</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell\spells-sight.c">
+      <Filter>spell</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\spell\spells-launcher.h">
       <Filter>spell</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell\spells-sight.h">
+      <Filter>spell</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 847c8dd..6ff5889 100644 (file)
@@ -395,6 +395,7 @@ hengband_SOURCES = \
        spell/spells-hex.c spell/spells-hex.h \
        spell/spells-launcher.c spell/spells-launcher.h \
        spell/spells-object.c spell/spells-object.h \
+       spell/spells-sight.c spell/spells-sight.h \
        spell/spells-summon.c spell/spells-summon.h \
        spell/spells-status.c spell/spells-status.h \
        spell/spells-teleport.c spell/spells-teleport.h \
index 41dec9f..161d786 100644 (file)
@@ -24,6 +24,7 @@
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index 30d7b12..720b9a5 100644 (file)
@@ -29,6 +29,7 @@
 #include "spell/spells-describer.h"
 #include "spell/spells-execution.h"
 #include "spell/spells-hex.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-util.h"
 #include "spell/spells2.h"
index 1985b21..e348cc9 100644 (file)
@@ -33,6 +33,7 @@
 #include "spell/spells-hex.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index 718d232..bfc5b5e 100644 (file)
@@ -29,6 +29,7 @@
 #include "spell/spells-hex.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index 042e332..8be65c9 100644 (file)
@@ -19,6 +19,7 @@
 #include "player/player-status.h"
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index f1ade29..ccfb960 100644 (file)
@@ -18,6 +18,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index a3f74fc..f6593be 100644 (file)
@@ -22,6 +22,7 @@
 #include "player/player-status.h"
 #include "spell/process-effect.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index ef0b360..a0dba66 100644 (file)
@@ -40,6 +40,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index 0813e91..66ea339 100644 (file)
@@ -36,6 +36,7 @@
 #include "spell/spells-hex.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index 539e6d3..95ac021 100644 (file)
@@ -15,6 +15,7 @@
 #include "player/player-personalities-table.h"
 #include "spell/process-effect.h"
 #include "spell/spells-hex.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
 #include "spell/spells2.h"
index b55eda9..0fa3ec1 100644 (file)
@@ -29,6 +29,7 @@
 #include "io/targeting.h"
 #include "view/display-main-window.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells2.h"
 #include "spell/spells3.h"
index 39da49c..3108bab 100644 (file)
@@ -10,6 +10,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-hex.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index 3ff47e6..4b496ed 100644 (file)
@@ -34,6 +34,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index b2c454c..fa1e8f7 100644 (file)
@@ -18,6 +18,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
index dbb0ac1..1b4d9df 100644 (file)
@@ -11,6 +11,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index 5286b28..d177f6a 100644 (file)
@@ -10,6 +10,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
index ebb24ea..83265b3 100644 (file)
@@ -13,6 +13,7 @@
 #include "spell/spells-diceroll.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
index 44515ea..c345c05 100644 (file)
@@ -38,6 +38,7 @@
 #include "spell/spells-execution.h"
 #include "spell/spells-hex.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index 0ab9428..4201845 100644 (file)
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
 #include "spell/spells-util.h"
-#include "spell/spells2.h"
 #include "spell/spells3.h"
 #include "spell/technic-info-table.h"
 #include "util/util.h"
index e45dbcc..dbe764d 100644 (file)
@@ -7,6 +7,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-type.h"
 #include "spell/spells2.h"
index 371fd0b..cd7d044 100644 (file)
@@ -17,6 +17,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
index 90e4d00..8fb2af8 100644 (file)
@@ -8,6 +8,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-type.h"
 #include "spell/spells2.h"
index 076e05f..3214d6f 100644 (file)
@@ -7,6 +7,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells-type.h"
index 4814eba..b087fe4 100644 (file)
@@ -8,6 +8,7 @@
 #include "spell/spells-detection.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
index bb59a51..369bca0 100644 (file)
@@ -13,6 +13,7 @@
 #include "player/player-effects.h"
 #include "player/player-status.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-type.h"
 #include "spell/spells2.h"
diff --git a/src/spell/spells-sight.c b/src/spell/spells-sight.c
new file mode 100644 (file)
index 0000000..aaef651
--- /dev/null
@@ -0,0 +1,270 @@
+#include "spell/spells-sight.h"
+#include "effect/effect-characteristics.h"
+#include "floor/floor.h"
+#include "monster/monster-status.h"
+#include "player/avatar.h"
+#include "spell/process-effect.h"
+#include "spell/spells-type.h"
+
+/*!
+ * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
+ * @param typ 属性効果
+ * @param dam 効果量
+ * @return 効力があった場合TRUEを返す
+ * @details
+ * <pre>
+ * Note that affected monsters are NOT auto-tracked by this usage.
+ *
+ * To avoid misbehavior when monster deaths have side-effects,
+ * this is done in two passes. -- JDL
+ * </pre>
+ */
+bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
+{
+    for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) {
+        monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
+        if (!monster_is_valid(m_ptr))
+            continue;
+
+        POSITION y = m_ptr->fy;
+        POSITION x = m_ptr->fx;
+        if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
+            continue;
+
+        m_ptr->mflag |= (MFLAG_LOS);
+    }
+
+    BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
+    bool obvious = FALSE;
+    for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) {
+        monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
+        if (!(m_ptr->mflag & (MFLAG_LOS)))
+            continue;
+
+        m_ptr->mflag &= ~(MFLAG_LOS);
+        POSITION y = m_ptr->fy;
+        POSITION x = m_ptr->fx;
+
+        if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1))
+            obvious = TRUE;
+    }
+
+    return obvious;
+}
+
+/*!
+ * @brief 視界内モンスターを加速する処理 / Speed monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool speed_monsters(player_type *caster_ptr) { return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev)); }
+
+/*!
+ * @brief 視界内モンスターを加速する処理 / Slow monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool slow_monsters(player_type *caster_ptr, int power) { return (project_all_los(caster_ptr, GF_OLD_SLOW, power)); }
+
+/*!
+ * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool sleep_monsters(player_type *caster_ptr, int power) { return (project_all_los(caster_ptr, GF_OLD_SLEEP, power)); }
+
+/*!
+ * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool banish_evil(player_type *caster_ptr, int dist) { return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist)); }
+
+/*!
+ * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
+ * @return 効力があった場合TRUEを返す
+ */
+bool turn_undead(player_type *caster_ptr)
+{
+    bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
+    if (tester)
+        chg_virtue(caster_ptr, V_UNLIFE, -1);
+    return tester;
+}
+
+/*!
+ * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
+{
+    bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
+    if (tester)
+        chg_virtue(caster_ptr, V_UNLIFE, -2);
+    return tester;
+}
+
+/*!
+ * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_evil(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_DISP_EVIL, dam)); }
+
+/*!
+ * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_good(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_DISP_GOOD, dam)); }
+
+/*!
+ * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_DISP_ALL, dam)); }
+
+/*!
+ * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_living(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_DISP_LIVING, dam)); }
+
+/*!
+ * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool dispel_demons(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_DISP_DEMON, dam)); }
+
+/*!
+ * @brief 視界内のモンスターに「聖戦」効果を与える処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 効力があった場合TRUEを返す
+ */
+bool crusade(player_type *caster_ptr) { return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4)); }
+
+/*!
+ * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
+ * @return なし
+ */
+void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
+{
+    bool sleep = FALSE;
+    bool speed = FALSE;
+    for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++) {
+        monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
+        if (!monster_is_valid(m_ptr))
+            continue;
+        if (i == who)
+            continue;
+
+        if (m_ptr->cdis < MAX_SIGHT * 2) {
+            if (MON_CSLEEP(m_ptr)) {
+                (void)set_monster_csleep(caster_ptr, i, 0);
+                sleep = TRUE;
+            }
+
+            if (!is_pet(m_ptr))
+                m_ptr->mflag2 |= MFLAG2_NOPET;
+        }
+
+        if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) {
+            if (!is_pet(m_ptr)) {
+                (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
+                speed = TRUE;
+            }
+        }
+    }
+
+    if (speed)
+        msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
+    else if (sleep)
+        msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
+    if (caster_ptr->riding)
+        caster_ptr->update |= PU_BONUS;
+}
+
+/*!
+ * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_OLD_CONF, dam)); }
+
+/*!
+ * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool charm_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_CHARM, dam)); }
+
+/*!
+ * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool charm_animals(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam)); }
+
+/*!
+ * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool stun_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_STUN, dam)); }
+
+/*!
+ * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_STASIS, dam)); }
+
+/*!
+ * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_PSI, dam)); }
+
+/*!
+ * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dist 効力(距離)
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool banish_monsters(player_type *caster_ptr, int dist) { return (project_all_los(caster_ptr, GF_AWAY_ALL, dist)); }
+
+/*!
+ * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool turn_evil(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_TURN_EVIL, dam)); }
+
+/*!
+ * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param dam 効力
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool turn_monsters(player_type *caster_ptr, HIT_POINT dam) { return (project_all_los(caster_ptr, GF_TURN_ALL, dam)); }
+
+/*!
+ * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return 作用が実際にあった場合TRUEを返す
+ */
+bool deathray_monsters(player_type *caster_ptr) { return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200)); }
diff --git a/src/spell/spells-sight.h b/src/spell/spells-sight.h
new file mode 100644 (file)
index 0000000..ba12a63
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam);
+bool speed_monsters(player_type *caster_ptr);
+bool slow_monsters(player_type *caster_ptr, int power);
+bool sleep_monsters(player_type *caster_ptr, int power);
+void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who);
+bool banish_evil(player_type *caster_ptr, int dist);
+bool turn_undead(player_type *caster_ptr);
+bool dispel_evil(player_type *caster_ptr, HIT_POINT dam);
+bool dispel_good(player_type *caster_ptr, HIT_POINT dam);
+bool dispel_undead(player_type *caster_ptr, HIT_POINT dam);
+bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool dispel_living(player_type *caster_ptr, HIT_POINT dam);
+bool dispel_demons(player_type *caster_ptr, HIT_POINT dam);
+bool crusade(player_type *caster_ptr);
+bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool charm_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool charm_animals(player_type *caster_ptr, HIT_POINT dam);
+bool stun_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool banish_monsters(player_type *caster_ptr, int dist);
+bool turn_evil(player_type *caster_ptr, HIT_POINT dam);
+bool turn_monsters(player_type *caster_ptr, HIT_POINT dam);
+bool deathray_monsters(player_type *caster_ptr);
index d1e841b..dbbab42 100644 (file)
@@ -6,8 +6,8 @@
 #include "monster/monster-status.h"
 #include "object/item-use-flags.h"
 #include "object/object-hook.h"
+#include "spell/spells-sight.h"
 #include "sv-definition/sv-other-types.h"
-#include "spell/spells2.h"
 
 /*!
 * @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
index 3750aaa..432c425 100644 (file)
@@ -56,6 +56,7 @@
 #include "spell/spells-diceroll.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
 #include "world/world.h"
 
 /*!
- * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
- * @param typ 属性効果
- * @param dam 効果量
- * @return 効力があった場合TRUEを返す
- * @details
- * <pre>
- * Note that affected monsters are NOT auto-tracked by this usage.
- *
- * To avoid misbehavior when monster deaths have side-effects,
- * this is done in two passes. -- JDL
- * </pre>
- */
-bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
-{
-       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
-       {
-               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               if (!monster_is_valid(m_ptr)) continue;
-
-               POSITION y = m_ptr->fy;
-               POSITION x = m_ptr->fx;
-               if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
-
-               m_ptr->mflag |= (MFLAG_LOS);
-       }
-
-       BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
-       bool obvious = FALSE;
-       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
-       {
-               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
-
-               m_ptr->mflag &= ~(MFLAG_LOS);
-               POSITION y = m_ptr->fy;
-               POSITION x = m_ptr->fx;
-
-               if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
-       }
-
-       return obvious;
-}
-
-
-/*!
- * @brief 視界内モンスターを加速する処理 / Speed monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool speed_monsters(player_type *caster_ptr)
-{
-       return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
-}
-
-
-/*!
- * @brief 視界内モンスターを加速する処理 / Slow monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool slow_monsters(player_type *caster_ptr, int power)
-{
-       return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
-}
-
-
-/*!
- * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool sleep_monsters(player_type *caster_ptr, int power)
-{
-       return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
-}
-
-
-/*!
- * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool banish_evil(player_type *caster_ptr, int dist)
-{
-       return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
-}
-
-
-/*!
- * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
- * @return 効力があった場合TRUEを返す
- */
-bool turn_undead(player_type *caster_ptr)
-{
-       bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
-       if (tester)
-               chg_virtue(caster_ptr, V_UNLIFE, -1);
-       return tester;
-}
-
-
-/*!
- * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
-{
-       bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
-       if (tester)
-               chg_virtue(caster_ptr, V_UNLIFE, -2);
-       return tester;
-}
-
-
-/*!
- * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
-}
-
-
-/*!
- * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
-}
-
-
-/*!
- * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
-}
-
-
-/*!
  * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
  * @brief 聖浄の杖の効果
  * @param creature_ptr プレーヤーへの参照ポインタ
@@ -266,82 +118,6 @@ bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
 
 
 /*!
- * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
-}
-
-
-/*!
- * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
-}
-
-
-/*!
- * @brief 視界内のモンスターに「聖戦」効果を与える処理
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 効力があった場合TRUEを返す
- */
-bool crusade(player_type *caster_ptr)
-{
-       return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
-}
-
-
-/*!
- * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
- * @return なし
- */
-void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
-{
-       bool sleep = FALSE;
-       bool speed = FALSE;
-       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
-       {
-               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               if (!monster_is_valid(m_ptr)) continue;
-               if (i == who) continue;
-
-               if (m_ptr->cdis < MAX_SIGHT * 2)
-               {
-                       if (MON_CSLEEP(m_ptr))
-                       {
-                               (void)set_monster_csleep(caster_ptr, i, 0);
-                               sleep = TRUE;
-                       }
-
-                       if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
-               }
-
-               if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
-               {
-                       if (!is_pet(m_ptr))
-                       {
-                               (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
-                               speed = TRUE;
-                       }
-               }
-       }
-
-       if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
-       else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
-       if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
-}
-
-
-/*!
  * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
  * @param m_idx 抹殺するモンスターID
  * @param power 抹殺の威力
@@ -1656,125 +1432,6 @@ void wall_breaker(player_type *caster_ptr)
 
 
 /*!
- * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
-}
-
-
-/*!
- * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_CHARM, dam));
-}
-
-
-/*!
- * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
-}
-
-
-/*!
- * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_STUN, dam));
-}
-
-
-/*!
- * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_STASIS, dam));
-}
-
-
-/*!
- * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_PSI, dam));
-}
-
-
-/*!
- * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dist 効力(距離)
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool banish_monsters(player_type *caster_ptr, int dist)
-{
-       return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
-}
-
-
-/*!
- * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
-}
-
-
-/*!
- * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @param dam 効力
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
-{
-       return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
-}
-
-
-/*!
- * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
- * @param caster_ptr プレーヤーへの参照ポインタ
- * @return 作用が実際にあった場合TRUEを返す
- */
-bool deathray_monsters(player_type *caster_ptr)
-{
-       return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
-}
-
-
-/*!
  * @brief チャーム・モンスター(1体)
  * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
index bb74fc4..5760633 100644 (file)
@@ -3,26 +3,13 @@
 #include "system/angband.h"
 
 bool wall_stone(player_type *caster_ptr);
-bool speed_monsters(player_type* caster_ptr);
-bool slow_monsters(player_type* caster_ptr, int power);
-bool sleep_monsters(player_type* caster_ptr, int power);
-void aggravate_monsters(player_type* caster_ptr, MONSTER_IDX who);
 bool genocide_aux(player_type* caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name);
 bool symbol_genocide(player_type* caster_ptr, int power, bool player_cast);
 bool mass_genocide(player_type* caster_ptr, int power, bool player_cast);
 bool mass_genocide_undead(player_type* caster_ptr, int power, bool player_cast);
 bool probing(player_type* caster_ptr);
-bool banish_evil(player_type* caster_ptr, int dist);
-bool dispel_evil(player_type* caster_ptr, HIT_POINT dam);
-bool dispel_good(player_type* caster_ptr, HIT_POINT dam);
-bool dispel_undead(player_type* caster_ptr, HIT_POINT dam);
-bool dispel_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool dispel_living(player_type* caster_ptr, HIT_POINT dam);
-bool dispel_demons(player_type* caster_ptr, HIT_POINT dam);
 bool cleansing_nova(player_type* creature_ptr, bool magic, bool powerful);
 bool unleash_mana_storm(player_type* creature_ptr, bool powerful);
-bool crusade(player_type* caster_ptr);
-bool turn_undead(player_type* caster_ptr);
 void lite_room(player_type* caster_ptr, POSITION y1, POSITION x1);
 bool starlight(player_type* caster_ptr, bool magic);
 void unlite_room(player_type* caster_ptr, POSITION y1, POSITION x1);
@@ -47,21 +34,10 @@ bool sleep_monsters_touch(player_type* caster_ptr);
 bool activate_ty_curse(player_type* target_ptr, bool stop_ty, int* count);
 int activate_hi_summon(player_type* caster_ptr, POSITION y, POSITION x, bool can_pet);
 void wall_breaker(player_type* caster_ptr);
-bool confuse_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool charm_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool charm_animals(player_type* caster_ptr, HIT_POINT dam);
-bool stun_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool stasis_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool banish_monsters(player_type* caster_ptr, int dist);
-bool turn_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool turn_evil(player_type* caster_ptr, HIT_POINT dam);
-bool deathray_monsters(player_type* caster_ptr);
 bool charm_monster(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL plev);
 bool control_one_undead(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL plev);
 bool control_one_demon(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL plev);
 bool charm_animal(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL plev);
-bool mindblast_monsters(player_type* caster_ptr, HIT_POINT dam);
-bool project_all_los(player_type* caster_ptr, EFFECT_ID typ, HIT_POINT dam);
 bool eat_magic(player_type* caster_ptr, int power);
 void discharge_minion(player_type* caster_ptr);
 void ring_of_power(player_type* caster_ptr, DIRECTION dir);
index c80929e..fe98a98 100644 (file)
@@ -66,6 +66,7 @@
 #include "spell/spells-execution.h"
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
+#include "spell/spells-sight.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
 #include "spell/spells2.h"