OSDN Git Service

[Refactor] #40414 Separated spells-staff-only.c/h from spells2.c/h
authorHourier <hourier@users.sourceforge.jp>
Fri, 5 Jun 2020 09:41:01 +0000 (18:41 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 5 Jun 2020 09:41:01 +0000 (18:41 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd-item/cmd-usestaff.c
src/spell/spells-staff-only.c [new file with mode: 0644]
src/spell/spells-staff-only.h [new file with mode: 0644]
src/spell/spells2.c
src/spell/spells2.h

index f28cd35..e58f289 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-launcher.c" />\r
     <ClCompile Include="..\..\src\spell\spells-lite.c" />\r
     <ClCompile Include="..\..\src\spell\spells-sight.c" />\r
+    <ClCompile Include="..\..\src\spell\spells-staff-only.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-launcher.h" />\r
     <ClInclude Include="..\..\src\spell\spells-lite.h" />\r
     <ClInclude Include="..\..\src\spell\spells-sight.h" />\r
+    <ClInclude Include="..\..\src\spell\spells-staff-only.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 1abf8fd..885c6d0 100644 (file)
     <ClCompile Include="..\..\src\mind\racial-balrog.c">
       <Filter>mind</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell\spells-staff-only.c">
+      <Filter>spell</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\mind\racial-balrog.h">
       <Filter>mind</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell\spells-staff-only.h">
+      <Filter>spell</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 1849971..1355f4a 100644 (file)
@@ -402,6 +402,7 @@ hengband_SOURCES = \
        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-staff-only.c spell/spells-staff-only.h \
        spell/spells-status.c spell/spells-status.h \
        spell/spells-teleport.c spell/spells-teleport.h \
        spell/spells-util.h spell/spells-type.h \
index 92561a2..a15cb06 100644 (file)
@@ -22,6 +22,7 @@
 #include "spell/spells-genocide.h"
 #include "spell/spells-lite.h"
 #include "spell/spells-sight.h"
+#include "spell/spells-staff-only.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
 #include "spell/spells-teleport.h"
diff --git a/src/spell/spells-staff-only.c b/src/spell/spells-staff-only.c
new file mode 100644 (file)
index 0000000..6b2443b
--- /dev/null
@@ -0,0 +1,63 @@
+#include "spell/spells-staff-only.h"
+#include "effect/effect-characteristics.h"
+#include "player/player-damage.h"
+#include "player/player-effects.h"
+#include "spell/process-effect.h"
+#include "spell/spells-sight.h"
+#include "spell/spells-type.h"
+
+/*!
+ * @brief 聖浄の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
+bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
+{
+    bool ident = FALSE;
+    if (dispel_evil(creature_ptr, powerful ? 225 : 150))
+        ident = TRUE;
+
+    int k = 3 * creature_ptr->lev;
+    if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE))
+        ident = TRUE;
+
+    if (set_poisoned(creature_ptr, 0))
+        ident = TRUE;
+
+    if (set_afraid(creature_ptr, 0))
+        ident = TRUE;
+
+    if (hp_player(creature_ptr, 50))
+        ident = TRUE;
+
+    if (set_stun(creature_ptr, 0))
+        ident = TRUE;
+
+    if (set_cut(creature_ptr, 0))
+        ident = TRUE;
+
+    return ident;
+}
+
+/*!
+ * @brief 魔力の嵐の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
+bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
+{
+    msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
+    project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x, (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA,
+        PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
+
+    bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
+    is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
+    is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
+    is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
+    is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
+    if (is_special_class)
+        (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
+
+    return TRUE;
+}
diff --git a/src/spell/spells-staff-only.h b/src/spell/spells-staff-only.h
new file mode 100644 (file)
index 0000000..8b80aad
--- /dev/null
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "system/angband.h"
+
+bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful);
+bool unleash_mana_storm(player_type *creature_ptr, bool powerful);
index 1bad7ef..cf3895f 100644 (file)
 #include "world/world.h"
 
 /*!
- * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
- * @brief 聖浄の杖の効果
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
- * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
- */
-bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
-{
-       bool ident = FALSE;
-       if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
-       int k = 3 * creature_ptr->lev;
-       if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
-       if (set_poisoned(creature_ptr, 0)) ident = TRUE;
-       if (set_afraid(creature_ptr, 0)) ident = TRUE;
-       if (hp_player(creature_ptr, 50)) ident = TRUE;
-       if (set_stun(creature_ptr, 0)) ident = TRUE;
-       if (set_cut(creature_ptr, 0)) ident = TRUE;
-       return ident;
-}
-
-
-/*!
- * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
- * @brief 魔力の嵐の杖の効果
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
- */
-bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
-{
-       msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
-       project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
-               (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
-
-       bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
-       is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
-       is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
-       is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
-       is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
-       if (is_special_class)
-       {
-               (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
-       }
-
-       return TRUE;
-}
-
-
-/*!
  * @brief 周辺モンスターを調査する / Probe nearby monsters
  * @return 効力があった場合TRUEを返す
  */
index 094e072..010dce9 100644 (file)
@@ -4,8 +4,6 @@
 
 bool wall_stone(player_type *caster_ptr);
 bool probing(player_type* caster_ptr);
-bool cleansing_nova(player_type* creature_ptr, bool magic, bool powerful);
-bool unleash_mana_storm(player_type* creature_ptr, bool powerful);
 void call_chaos(player_type* caster_ptr);
 bool hypodynamic_bolt(player_type* caster_ptr, DIRECTION dir, HIT_POINT dam);
 bool death_ray(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL plev);