OSDN Git Service

[Refactor] #1642 Separated death() from influence()
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 10 Mar 2022 11:20:13 +0000 (20:20 +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 66940f8..2bf6f23 100644 (file)
@@ -141,12 +141,7 @@ bool QuaffEffects::influence(const ObjectType &o_ref)
         ident = this->detonation();
         break;
     case SV_POTION_DEATH:
-        chg_virtue(this->player_ptr, V_VITALITY, -1);
-        chg_virtue(this->player_ptr, V_UNLIFE, 5);
-        msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
-        take_hit(this->player_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"));
-        ident = true;
-        break;
+        return this->death();
     case SV_POTION_INFRAVISION:
         if (set_tim_infra(this->player_ptr, this->player_ptr->tim_infra + 100 + randint1(100), false)) {
             ident = true;
@@ -475,7 +470,7 @@ bool QuaffEffects::ruination()
 
 /*!
  * @brief 爆発の薬 / Fumble ramble
- * @return 常にTRUE
+ * @return 常にtrue
  */
 bool QuaffEffects::detonation()
 {
@@ -488,6 +483,19 @@ bool QuaffEffects::detonation()
 }
 
 /*!
+ * @brief 死の薬
+ * @return 常にtrue
+ */
+bool QuaffEffects::death()
+{
+    chg_virtue(this->player_ptr, V_VITALITY, -1);
+    chg_virtue(this->player_ptr, V_UNLIFE, 5);
+    msg_print(_("死の予感が体中を駆けめぐった。", "A feeling of Death flows through your body."));
+    take_hit(this->player_ptr, DAMAGE_LOSELIFE, 5000, _("死の薬", "a potion of Death"));
+    return true;
+}
+
+/*!
  * @brief 増強の薬
  * @return アビリティスコアのどれか1つでも向上したらtrue
  */
index 03882e7..c35b3ff 100644 (file)
@@ -17,6 +17,7 @@ private:
     bool lose_memories();
     bool ruination();
     bool detonation();
+    bool death();
     bool augmentation();
     bool enlightenment();
     bool star_enlightenment();