OSDN Git Service

[Refactor] #1642 Separated poison() from influence()
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 10 Mar 2022 11:22:24 +0000 (20:22 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Fri, 11 Mar 2022 11:47:15 +0000 (20:47 +0900)
src/object-use/quaff/quaff-effects.cpp
src/object-use/quaff/quaff-effects.h

index 31bf0ba..1a399ef 100644 (file)
@@ -69,13 +69,7 @@ bool QuaffEffects::influence(const ObjectType &o_ref)
     case SV_POTION_SALT_WATER:
         return this->salt_water();
     case SV_POTION_POISON:
-        if (!(has_resist_pois(this->player_ptr) || is_oppose_pois(this->player_ptr))) {
-            if (BadStatusSetter(this->player_ptr).mod_poison(randint0(15) + 10)) {
-                return true;
-            }
-        }
-
-        return false;
+        return this->poison();
     case SV_POTION_BLINDNESS:
         if (!has_resist_blind(this->player_ptr)) {
             if (BadStatusSetter(this->player_ptr).mod_blindness(randint0(100) + 100)) {
@@ -238,6 +232,19 @@ bool QuaffEffects::salt_water()
 }
 
 /*!
+ * @brief 毒の薬
+ * @return 毒の効果を受けたらtrue
+ */
+bool QuaffEffects::poison()
+{
+    if (has_resist_pois(this->player_ptr) || is_oppose_pois(this->player_ptr)) {
+        return false;
+    }
+
+    return BadStatusSetter(this->player_ptr).mod_poison(randint0(15) + 10);
+}
+
+/*!
  * @brief 酔っ払いの薬
  * @return カオス耐性があるかその他の一部確率でFALSE、それ以外はTRUE
  */
index c35b3ff..b307684 100644 (file)
@@ -12,6 +12,7 @@ private:
     PlayerType *player_ptr;
 
     bool salt_water();
+    bool poison();
     bool booze();
     bool sleep();
     bool lose_memories();