OSDN Git Service

[Refactor] #40514 calc_rocket_damage_rate() 実装. / Implement calc_rocket_damage_rate().
authordeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 11:17:24 +0000 (20:17 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 11:17:24 +0000 (20:17 +0900)
src/effect/effect-player-resist-hurt.c
src/object/warning.c
src/player/player-status-resist.c
src/player/player-status-resist.h

index c8dc0b8..46d2d0e 100644 (file)
@@ -318,9 +318,9 @@ void effect_player_rocket(player_type *target_ptr, effect_player_type *ep_ptr)
         (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
     }
 
-    if (target_ptr->resist_shard) {
-        ep_ptr->dam /= 2;
-    } else if (!check_multishadow(target_ptr)) {
+    ep_ptr->dam = ep_ptr->dam * calc_rocket_damage_rate(target_ptr, CALC_RAND) / 100;
+
+    if (!target_ptr->resist_shard && !check_multishadow(target_ptr)) {
         (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
     }
 
index 73acb33..f008f71 100644 (file)
@@ -186,8 +186,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
         break;
 
     case GF_ROCKET:
-        if (target_ptr->resist_shard)
-            dam /= 2;
+        dam = dam * calc_rocket_damage_rate(target_ptr, CALC_MAX) / 100;
         break;
 
     case GF_NUKE:
index 6f5924d..0b5a06e 100644 (file)
@@ -286,6 +286,18 @@ PERCENTAGE calc_nexus_damage_rate(player_type *creature_ptr, rate_calc_type_mode
     return per;
 }
 
+PERCENTAGE calc_rocket_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
+{
+    (mode); // unused
+    PERCENTAGE per = 100;
+
+    if (creature_ptr->resist_shard) {
+        per /= 2;
+    }
+
+    return per;
+}
+
 PERCENTAGE calc_nether_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
 {
     PERCENTAGE per = 100;
index bd88b8c..8a23c28 100644 (file)
@@ -1,4 +1,7 @@
-#include "player/player-status.h"
+#pragma once
+
+#include "system/angband.h"
+#include "player/player-status.h"
 
 typedef enum rate_calc_type_mode {
        CALC_RAND = 0,
@@ -23,5 +26,6 @@ PERCENTAGE calc_chaos_damage_rate(player_type *creature_ptr, rate_calc_type_mode
 PERCENTAGE calc_nether_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
 PERCENTAGE calc_disenchant_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
 PERCENTAGE calc_nexus_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
+PERCENTAGE calc_rocket_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
 PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);
 PERCENTAGE calc_hell_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode);