OSDN Git Service

[Refactor] #40514 calc_nexus_damage_rate() 実装. / Implement calc_nexus_damage_rate().
authordeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 11:08:42 +0000 (20:08 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 11:08:42 +0000 (20:08 +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 286f76d..c8dc0b8 100644 (file)
@@ -289,10 +289,10 @@ void effect_player_nexus(player_type *target_ptr, effect_player_type *ep_ptr)
 {
     if (target_ptr->blind)
         msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
-    if (target_ptr->resist_nexus) {
-        ep_ptr->dam *= 6;
-        ep_ptr->dam /= (randint1(4) + 7);
-    } else if (!check_multishadow(target_ptr)) {
+
+    ep_ptr->dam = ep_ptr->dam * calc_nexus_damage_rate(target_ptr, CALC_RAND) / 100;
+
+    if (!target_ptr->resist_nexus && !check_multishadow(target_ptr)) {
         apply_nexus(ep_ptr->m_ptr, target_ptr);
     }
 
index 30a1200..73acb33 100644 (file)
@@ -172,8 +172,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
         break;
 
     case GF_NEXUS:
-        if (target_ptr->resist_nexus)
-            dam = dam * 3 / 4; /* Worst case of 6 / (d4 + 7) */
+        dam = dam * calc_nexus_damage_rate(target_ptr, CALC_MAX) / 100;
         break;
 
     case GF_TIME:
index 57f8120..6f5924d 100644 (file)
@@ -274,6 +274,18 @@ PERCENTAGE calc_disenchant_damage_rate(player_type *creature_ptr, rate_calc_type
     return per;
 }
 
+PERCENTAGE calc_nexus_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
+{
+    PERCENTAGE per = 100;
+
+    if (creature_ptr->resist_disen) {
+        per *= 600;
+        per /= randrate(4, 7, mode);
+    }
+
+    return per;
+}
+
 PERCENTAGE calc_nether_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
 {
     PERCENTAGE per = 100;
index 15f49e6..bd88b8c 100644 (file)
@@ -22,5 +22,6 @@ PERCENTAGE calc_conf_damage_rate(player_type *creature_ptr, rate_calc_type_mode
 PERCENTAGE calc_chaos_damage_rate(player_type *creature_ptr, rate_calc_type_mode 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_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);