OSDN Git Service

[Refactor] #40634 Separated activate_breath_*() from activation-switcher.c to activat...
authorHourier <hourier@users.sourceforge.jp>
Tue, 18 Aug 2020 08:50:01 +0000 (17:50 +0900)
committerHourier <hourier@users.sourceforge.jp>
Tue, 18 Aug 2020 08:50:01 +0000 (17:50 +0900)
src/object-activation/activation-breath.c
src/object-activation/activation-breath.h
src/object-activation/activation-switcher.c

index a60633e..c42541c 100644 (file)
@@ -3,6 +3,9 @@
 #include "object/object-flags.h"
 #include "spell-kind/spells-launcher.h"
 #include "spell-realm/spells-hex.h"
+#include "spell/spell-types.h"
+#include "status/element-resistance.h"
+#include "sv-definition/sv-ring-types.h"
 #include "system/object-type-definition.h"
 #include "target/target-getter.h"
 #include "util/bit-flags-calculator.h"
@@ -49,3 +52,29 @@ bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr)
     fire_breath(user_ptr, type[t], dir, 250, 4);
     return TRUE;
 }
+
+bool activate_breath_fire(player_type *user_ptr, object_type *o_ptr)
+{
+    DIRECTION dir;
+    if (!get_aim_dir(user_ptr, &dir))
+        return FALSE;
+
+    fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
+    if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
+        (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
+
+    return TRUE;
+}
+
+bool activate_breath_cold(player_type *user_ptr, object_type *o_ptr)
+{
+    DIRECTION dir;
+    if (!get_aim_dir(user_ptr, &dir))
+        return FALSE;
+
+    fire_breath(user_ptr, GF_COLD, dir, 200, 2);
+    if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
+        (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
+
+    return TRUE;
+}
index 3806a3b..a304340 100644 (file)
@@ -3,3 +3,5 @@
 #include "system/angband.h"
 
 bool activate_dragon_breath(player_type *user_ptr, object_type *o_ptr);
+bool activate_breath_fire(player_type *user_ptr, object_type *o_ptr);
+bool activate_breath_cold(player_type *user_ptr, object_type *o_ptr);
index cc1ff7f..d93a27a 100644 (file)
@@ -576,28 +576,11 @@ bool switch_activation(player_type *user_ptr, object_type *o_ptr, const activati
     case ACT_BLADETURNER:
         return activate_bladeturner(user_ptr);
     case ACT_BR_FIRE:
-        if (!get_aim_dir(user_ptr, &dir))
-            return FALSE;
-
-        fire_breath(user_ptr, GF_FIRE, dir, 200, 2);
-        if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
-            (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
-
-        return TRUE;
+        return activate_breath_fire(user_ptr, o_ptr);
     case ACT_BR_COLD:
-        if (!get_aim_dir(user_ptr, &dir))
-            return FALSE;
-
-        fire_breath(user_ptr, GF_COLD, dir, 200, 2);
-        if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
-            (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
-
-        return TRUE;
+        return activate_breath_cold(user_ptr, o_ptr);
     case ACT_BR_DRAGON:
-        if (!activate_dragon_breath(user_ptr, o_ptr))
-            return FALSE;
-
-        return TRUE;
+        return activate_dragon_breath(user_ptr, o_ptr);
     case ACT_CONFUSE:
         msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
         if (!get_aim_dir(user_ptr, &dir))