OSDN Git Service

[Refactor] #1642 Separated tsuyoshi() and neo_tsuyoshi() from influence()
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 10 Mar 2022 11:00:00 +0000 (20:00 +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 305494b..5a216b5 100644 (file)
@@ -349,21 +349,9 @@ bool QuaffEffects::influence(const ObjectType &o_ref)
         ident = true;
         break;
     case SV_POTION_NEO_TSUYOSHI:
-        (void)BadStatusSetter(this->player_ptr).hallucination(0);
-        (void)set_tsuyoshi(this->player_ptr, this->player_ptr->tsuyoshi + randint1(100) + 100, false);
-        ident = true;
-        break;
+        return this->neo_tsuyoshi();
     case SV_POTION_TSUYOSHI:
-        msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
-        msg_print(nullptr);
-        this->player_ptr->tsuyoshi = 1;
-        (void)set_tsuyoshi(this->player_ptr, 0, true);
-        if (!has_resist_chaos(this->player_ptr)) {
-            (void)BadStatusSetter(this->player_ptr).hallucination(50 + randint1(50));
-        }
-
-        ident = true;
-        break;
+        return this->tsuyoshi();
     case SV_POTION_POLYMORPH:
         return this->polymorph();
     }
@@ -603,6 +591,34 @@ bool QuaffEffects::experience()
 }
 
 /*!
+ * @brief ネオ・つよしスペシャルの薬
+ * @return 常にtrue
+ */
+bool QuaffEffects::neo_tsuyoshi()
+{
+    (void)BadStatusSetter(this->player_ptr).hallucination(0);
+    (void)set_tsuyoshi(this->player_ptr, this->player_ptr->tsuyoshi + randint1(100) + 100, false);
+    return true;
+}
+
+/*!
+ * @brief つよしスペシャルの薬
+ * @return 常にtrue
+ */
+bool QuaffEffects::tsuyoshi()
+{
+    msg_print(_("「オクレ兄さん!」", "Brother OKURE!"));
+    msg_print(nullptr);
+    this->player_ptr->tsuyoshi = 1;
+    (void)set_tsuyoshi(this->player_ptr, 0, true);
+    if (!has_resist_chaos(this->player_ptr)) {
+        (void)BadStatusSetter(this->player_ptr).hallucination(50 + randint1(50));
+    }
+
+    return true;
+}
+
+/*!
  * @brief 自己変容の薬
  * @return 突然変異を得たか失ったらtrue、そのままならfalse
  */
index e8b751b..8648902 100644 (file)
@@ -21,5 +21,7 @@ private:
     bool enlightenment();
     bool star_enlightenment();
     bool experience();
+    bool neo_tsuyoshi();
+    bool tsuyoshi();
     bool polymorph();
 };