OSDN Git Service

[Refactor] #40414 Separated spells-pet.c/h from spells2.c/h
authorHourier <hourier@users.sourceforge.jp>
Fri, 5 Jun 2020 09:49:24 +0000 (18:49 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 5 Jun 2020 09:49:32 +0000 (18:49 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/realm/realm-daemon.c
src/spell/spells-pet.c [new file with mode: 0644]
src/spell/spells-pet.h [new file with mode: 0644]
src/spell/spells2.c
src/spell/spells2.h

index e58f289..cf8df28 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-hex.c" />\r
     <ClCompile Include="..\..\src\spell\spells-launcher.c" />\r
     <ClCompile Include="..\..\src\spell\spells-lite.c" />\r
+    <ClCompile Include="..\..\src\spell\spells-pet.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
     <ClInclude Include="..\..\src\spell\spells-hex.h" />\r
     <ClInclude Include="..\..\src\spell\spells-launcher.h" />\r
     <ClInclude Include="..\..\src\spell\spells-lite.h" />\r
+    <ClInclude Include="..\..\src\spell\spells-pet.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
index 885c6d0..e13e407 100644 (file)
     <ClCompile Include="..\..\src\spell\spells-staff-only.c">
       <Filter>spell</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\spell\spells-pet.c">
+      <Filter>spell</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\cmd\cmd-basic.h">
     <ClInclude Include="..\..\src\spell\spells-staff-only.h">
       <Filter>spell</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\spell\spells-pet.h">
+      <Filter>spell</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index 1355f4a..9c5a6c4 100644 (file)
@@ -400,6 +400,7 @@ hengband_SOURCES = \
        spell/spells-launcher.c spell/spells-launcher.h \
        spell/spells-lite.c spell/spells-lite.h \
        spell/spells-object.c spell/spells-object.h \
+       spell/spells-pet.c spell/spells-pet.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 \
index d177f6a..07f2c7c 100644 (file)
@@ -10,6 +10,7 @@
 #include "spell/spells-floor.h"
 #include "spell/spells-launcher.h"
 #include "spell/spells-object.h"
+#include "spell/spells-pet.h"
 #include "spell/spells-sight.h"
 #include "spell/spells-status.h"
 #include "spell/spells-summon.h"
diff --git a/src/spell/spells-pet.c b/src/spell/spells-pet.c
new file mode 100644 (file)
index 0000000..1143eb9
--- /dev/null
@@ -0,0 +1,61 @@
+#include "spell/spells-pet.h"
+#include "effect/effect-characteristics.h"
+#include "floor/floor.h"
+#include "io/write-diary.h"
+#include "spell/process-effect.h"
+#include "spell/spells-type.h"
+
+/*!
+ * @brief ペット爆破処理 /
+ * @return なし
+ */
+void discharge_minion(player_type *caster_ptr)
+{
+    bool okay = TRUE;
+    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->r_idx || !is_pet(m_ptr))
+            continue;
+        if (m_ptr->nickname)
+            okay = FALSE;
+    }
+
+    if (!okay || caster_ptr->riding) {
+        if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
+            return;
+    }
+
+    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->r_idx || !is_pet(m_ptr))
+            continue;
+
+        monster_race *r_ptr;
+        r_ptr = &r_info[m_ptr->r_idx];
+        if (r_ptr->flags1 & RF1_UNIQUE) {
+            GAME_TEXT m_name[MAX_NLEN];
+            monster_desc(caster_ptr, m_name, m_ptr, 0x00);
+            msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
+            delete_monster_idx(caster_ptr, i);
+            continue;
+        }
+
+        HIT_POINT dam = m_ptr->maxhp / 2;
+        if (dam > 100)
+            dam = (dam - 100) / 2 + 100;
+        if (dam > 400)
+            dam = (dam - 400) / 2 + 400;
+        if (dam > 800)
+            dam = 800;
+        project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA, PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
+
+        if (record_named_pet && m_ptr->nickname) {
+            GAME_TEXT m_name[MAX_NLEN];
+
+            monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
+            exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
+        }
+
+        delete_monster_idx(caster_ptr, i);
+    }
+}
diff --git a/src/spell/spells-pet.h b/src/spell/spells-pet.h
new file mode 100644 (file)
index 0000000..524a123
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "system/angband.h"
+
+void discharge_minion(player_type *caster_ptr);
index 4b5348e..af74d43 100644 (file)
 #include "world/world.h"
 
 /*!
- * @brief ペット爆破処理 /
- * @return なし
- */
-void discharge_minion(player_type *caster_ptr)
-{
-       bool okay = TRUE;
-       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->r_idx || !is_pet(m_ptr)) continue;
-               if (m_ptr->nickname) okay = FALSE;
-       }
-
-       if (!okay || caster_ptr->riding)
-       {
-               if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
-                       return;
-       }
-
-       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->r_idx || !is_pet(m_ptr)) continue;
-
-               monster_race *r_ptr;
-               r_ptr = &r_info[m_ptr->r_idx];
-               if (r_ptr->flags1 & RF1_UNIQUE)
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(caster_ptr, m_name, m_ptr, 0x00);
-                       msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
-                       delete_monster_idx(caster_ptr, i);
-                       continue;
-               }
-
-               HIT_POINT dam = m_ptr->maxhp / 2;
-               if (dam > 100) dam = (dam - 100) / 2 + 100;
-               if (dam > 400) dam = (dam - 400) / 2 + 400;
-               if (dam > 800) dam = 800;
-               project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
-                       PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
-
-               if (record_named_pet && m_ptr->nickname)
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-
-                       monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
-               }
-
-               delete_monster_idx(caster_ptr, i);
-       }
-}
-
-
-/*!
  * @brief 衰弱ボルト処理
  * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
index deded05..e673e9d 100644 (file)
@@ -26,7 +26,6 @@ bool control_one_undead(player_type* caster_ptr, DIRECTION dir, PLAYER_LEVEL ple
 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 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);
 void wild_magic(player_type* caster_ptr, int spell);
 void cast_meteor(player_type* caster_ptr, HIT_POINT dam, POSITION rad);