OSDN Git Service

[Refactor] #1599 Defined mod_afraidness() and replaced the calls
authorHourier <66951241+Hourier@users.noreply.github.com>
Fri, 24 Sep 2021 01:20:07 +0000 (10:20 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Fri, 24 Sep 2021 01:20:07 +0000 (10:20 +0900)
12 files changed:
src/cmd-item/cmd-eat.cpp
src/core/magic-effects-timeout-reducer.cpp
src/effect/effect-monster-charm.cpp
src/effect/effect-monster-psi.cpp
src/effect/effect-player-resist-hurt.cpp
src/inventory/inventory-curse.cpp
src/monster-attack/monster-attack-status.cpp
src/mspell/mspell-status.cpp
src/mutation/mutation-processor.cpp
src/spell/spells-summon.cpp
src/status/bad-status-setter.cpp
src/status/bad-status-setter.h

index e97726e..d0aa20f 100644 (file)
@@ -68,7 +68,7 @@ bool exe_eat_food_type_object(player_type *player_ptr, object_type *o_ptr)
     case SV_FOOD_BLINDNESS:
         return !has_resist_blind(player_ptr) && bss.mod_blindness(randint0(200) + 200);
     case SV_FOOD_PARANOIA:
-        return !has_resist_fear(player_ptr) && bss.afraidness(player_ptr->afraid + randint0(10) + 10);
+        return !has_resist_fear(player_ptr) && bss.mod_afraidness(randint0(10) + 10);
     case SV_FOOD_CONFUSION:
         return !has_resist_conf(player_ptr) && bss.mod_confusion(randint0(10) + 10);
     case SV_FOOD_HALLUCINATION:
index d8b0484..1728751 100644 (file)
@@ -135,7 +135,7 @@ void reduce_magic_effects_timeout(player_type *player_ptr)
     }
 
     if (player_ptr->afraid) {
-        (void)bss.afraidness(player_ptr->afraid - dec_count);
+        (void)bss.mod_afraidness(-dec_count);
     }
 
     if (player_ptr->fast) {
index 851b7cb..7660e4d 100644 (file)
@@ -226,7 +226,7 @@ static void effect_monster_domination_corrupted_addition(player_type *player_ptr
         if (any_bits(em_ptr->r_ptr->flags3, RF3_NO_FEAR)) {
             em_ptr->note = _("には効果がなかった。", " is unaffected.");
         } else {
-            (void)bss.afraidness(player_ptr->afraid + em_ptr->dam);
+            (void)bss.mod_afraidness(em_ptr->dam);
         }
 
         return;
index c4f67fe..f32b926 100644 (file)
@@ -113,7 +113,7 @@ static void effect_monster_psi_reflect_extra_effect(player_type *player_ptr, eff
         if (any_bits(em_ptr->r_ptr->flags3, RF3_NO_FEAR)) {
             em_ptr->note = _("には効果がなかった。", " is unaffected.");
         } else {
-            (void)bss.afraidness(player_ptr->afraid + 3 + randint1(em_ptr->dam));
+            (void)bss.mod_afraidness(3 + randint1(em_ptr->dam));
         }
 
         return;
index 5f0f5e8..77169e3 100644 (file)
@@ -691,6 +691,6 @@ void effect_player_abyss(player_type *player_ptr, effect_player_type *ep_ptr)
     }
 
     if (!has_resist_fear(player_ptr)) {
-        (void)bss.afraidness(player_ptr->afraid + randint1(10));
+        (void)bss.mod_afraidness(randint1(10));
     }
 }
index 6ccf85f..01d73ae 100644 (file)
@@ -317,7 +317,7 @@ static void curse_cowardice(player_type *player_ptr)
 
     disturb(player_ptr, false, true);
     msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
-    (void)BadStatusSetter(player_ptr).afraidness(player_ptr->afraid + 13 + randint1(26));
+    (void)BadStatusSetter(player_ptr).mod_afraidness(13 + randint1(26));
 }
 
 /*!
index 8ce2939..671fb81 100644 (file)
@@ -65,7 +65,7 @@ void process_terrify_attack(player_type *player_ptr, monap_type *monap_ptr)
         return;
     }
 
-    if (BadStatusSetter(player_ptr).afraidness(player_ptr->afraid + 3 + randint1(monap_ptr->rlev))) {
+    if (BadStatusSetter(player_ptr).mod_afraidness(3 + randint1(monap_ptr->rlev))) {
         monap_ptr->obvious = true;
     }
 }
index d5e321b..669841d 100644 (file)
@@ -240,7 +240,7 @@ MonsterSpellResult spell_RF5_SCARE(MONSTER_IDX m_idx, player_type *player_ptr, M
             _("しかし恐怖に侵されなかった。", "You refuse to be frightened."), resist, saving_throw, TARGET_TYPE);
 
         if (!resist && !saving_throw) {
-            (void)BadStatusSetter(player_ptr).afraidness(player_ptr->afraid + randint0(4) + 4);
+            (void)BadStatusSetter(player_ptr).mod_afraidness(randint0(4) + 4);
         }
 
         update_smart_learn(player_ptr, m_idx, DRS_FEAR);
index c066d30..24247ce 100644 (file)
@@ -131,7 +131,7 @@ void process_world_aux_mutation(player_type *player_ptr)
         if (!has_resist_fear(player_ptr)) {
             disturb(player_ptr, false, true);
             msg_print(_("とても暗い... とても恐い!", "It's so dark... so scary!"));
-            (void)bss.afraidness(player_ptr->afraid + 13 + randint1(26));
+            (void)bss.mod_afraidness(13 + randint1(26));
         }
     }
 
index e2f3447..6c8ca5a 100644 (file)
@@ -456,7 +456,7 @@ void cast_invoke_spirits(player_type *player_ptr, DIRECTION dir)
         chg_virtue(player_ptr, V_UNLIFE, 1);
     } else if (die < 14) {
         msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
-        (void)bss.afraidness(player_ptr->afraid + randint1(4) + 4);
+        (void)bss.mod_afraidness(randint1(4) + 4);
     } else if (die < 26) {
         msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...", "Your head is invaded by a horde of gibbering spectral voices..."));
         (void)bss.mod_confusion(randint1(4) + 4);
index 35c534d..562ddce 100644 (file)
@@ -266,6 +266,11 @@ bool BadStatusSetter::afraidness(const TIME_EFFECT tmp_v)
     return true;
 }
 
+bool BadStatusSetter::mod_afraidness(const TIME_EFFECT tmp_v)
+{
+    return this->afraidness(this->player_ptr->afraid + tmp_v);
+}
+
 /*!
  * @brief 麻痺の継続時間をセットする / Set "paralyzed", notice observable changes
  * @param v 継続時間
index 885528e..89f96d6 100644 (file)
@@ -21,6 +21,7 @@ public:
     bool poison(const TIME_EFFECT tmp_v);
     bool mod_poison(const TIME_EFFECT tmp_v);
     bool afraidness(const TIME_EFFECT tmp_v);
+    bool mod_afraidness(const TIME_EFFECT tmp_v);
     bool paralysis(const TIME_EFFECT tmp_v);
     bool hallucination(const TIME_EFFECT tmp_v);
     bool slowness(const TIME_EFFECT tmp_v, bool do_dec);