OSDN Git Service

[Refactor] #1314 デバッグ用の装備品強化ルーチンは最初に判定するように修正した
authorHourier <66951241+Hourier@users.noreply.github.com>
Tue, 8 Feb 2022 13:32:33 +0000 (22:32 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 10 Feb 2022 10:13:43 +0000 (19:13 +0900)
src/object-enchant/others/apply-magic-amulet.cpp
src/object-enchant/others/apply-magic-others.cpp
src/object-enchant/others/apply-magic-ring.cpp
src/object-enchant/protector/apply-magic-armor.cpp
src/object-enchant/protector/apply-magic-boots.cpp
src/object-enchant/protector/apply-magic-cloak.cpp
src/object-enchant/protector/apply-magic-crown.cpp
src/object-enchant/protector/apply-magic-gloves.cpp
src/object-enchant/protector/apply-magic-helm.cpp
src/object-enchant/protector/apply-magic-shield.cpp
src/object-enchant/weapon/apply-magic-weapon.cpp

index 2f73440..ed91e28 100644 (file)
@@ -48,7 +48,7 @@ void AmuletEnchanter::apply_magic()
     }
 
     this->enchant();
-    if ((one_in_(150) && (this->power > 0) && !this->o_ptr->is_cursed() && (this->level > 79)) || (this->power > 2)) {
+    if ((this->power > 2) || (one_in_(150) && (this->power > 0) && !this->o_ptr->is_cursed() && (this->level > 79))) {
         this->o_ptr->pval = std::min<short>(this->o_ptr->pval, 4);
         become_random_artifact(player_ptr, this->o_ptr, false);
         return;
index bc29cf0..4f14aa4 100644 (file)
@@ -35,8 +35,7 @@
  * @param player_ptr プレイヤーへの参照ポインタ
  * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
  * @param power 生成ランク
- * @details
- * Hack -- note the special code for various items
+ * @details power > 2はデバッグ専用.
  */
 void apply_magic_others(PlayerType *player_ptr, object_type *o_ptr, int power)
 {
@@ -65,7 +64,6 @@ void apply_magic_others(PlayerType *player_ptr, object_type *o_ptr, int power)
             o_ptr->pval = 0;
         }
 
-        /* power > 2はデバッグ専用. */
         if (power > 2) {
             become_random_artifact(player_ptr, o_ptr, false);
         } else if ((power == 2) || ((power == 1) && one_in_(3))) {
index 85415df..21267cb 100644 (file)
@@ -48,7 +48,7 @@ void RingEnchanter::apply_magic()
     }
 
     this->enchant();
-    if ((one_in_(400) && (this->power > 0) && !this->o_ptr->is_cursed() && (this->level > 79)) || (this->power > 2)) {
+    if ((this->power > 2) || (one_in_(400) && (this->power > 0) && !this->o_ptr->is_cursed() && (this->level > 79))) {
         this->o_ptr->pval = std::min<short>(this->o_ptr->pval, 4);
         become_random_artifact(this->player_ptr, this->o_ptr, false);
         return;
index 89930cc..65efaa1 100644 (file)
@@ -37,7 +37,7 @@ void ArmorEnchanter::apply_magic()
 
     switch (this->o_ptr->tval) {
     case ItemKindType::DRAG_ARMOR:
-        if (one_in_(50) || (this->power > 2)) {
+        if ((this->power > 2) || one_in_(50)) {
             become_random_artifact(this->player_ptr, this->o_ptr, false);
         }
 
@@ -84,7 +84,7 @@ void ArmorEnchanter::apply_magic()
  */
 void ArmorEnchanter::give_ego_index()
 {
-    if (one_in_(20) || (this->power > 2)) {
+    if ((this->power > 2) || one_in_(20)) {
         become_random_artifact(this->player_ptr, this->o_ptr, false);
         return;
     }
index 879778c..33a30b2 100644 (file)
@@ -39,7 +39,7 @@ void BootsEnchanter::apply_magic()
     }
 
     if (this->power > 1) {
-        if (one_in_(20) || (this->power > 2)) {
+        if ((this->power > 2) || one_in_(20)) {
             become_random_artifact(this->player_ptr, this->o_ptr, false);
             return;
         }
index e5b738e..4db6dcf 100644 (file)
@@ -34,7 +34,7 @@ void CloakEnchanter::apply_magic()
     }
 
     if (this->power > 1) {
-        if (one_in_(20) || (this->power > 2)) {
+        if ((this->power > 2) || one_in_(20)) {
             become_random_artifact(this->player_ptr, this->o_ptr, false);
             return;
         }
index 2fab41f..00e967f 100644 (file)
@@ -41,7 +41,7 @@ void CrownEnchanter::apply_magic()
  */
 void CrownEnchanter::give_ego_index()
 {
-    if (one_in_(20) || (this->power > 2)) {
+    if ((this->power > 2) || one_in_(20)) {
         become_random_artifact(this->player_ptr, this->o_ptr, false);
         return;
     }
index 575e282..c74ec30 100644 (file)
@@ -39,7 +39,7 @@ void GlovesEnchanter::apply_magic()
     }
 
     if (this->power > 1) {
-        if (one_in_(20) || (this->power > 2)) {
+        if ((this->power > 2) || one_in_(20)) {
             become_random_artifact(this->player_ptr, this->o_ptr, false);
             return;
         }
index 2fce7c7..5732ad5 100644 (file)
@@ -50,7 +50,7 @@ void HelmEnchanter::apply_magic()
  */
 void HelmEnchanter::give_ego_index()
 {
-    if (one_in_(20) || (this->power > 2)) {
+    if ((this->power > 2) || one_in_(20)) {
         become_random_artifact(this->player_ptr, this->o_ptr, false);
         return;
     }
index a6f2709..f0434f2 100644 (file)
@@ -42,7 +42,7 @@ void ShieldEnchanter::apply_magic()
         return;
     }
 
-    if (one_in_(20) || (this->power > 2)) {
+    if ((this->power > 2) || one_in_(20)) {
         become_random_artifact(this->player_ptr, this->o_ptr, false);
         return;
     }
index 3060955..ac9c37a 100644 (file)
@@ -33,6 +33,7 @@ WeaponEnchanter::WeaponEnchanter(PlayerType *player_ptr, object_type *o_ptr, DEP
 /*!
  * @brief 武器系オブジェクトに生成ランクごとの強化を与えるサブルーチン
  * Apply magic to an item known to be a "weapon"
+ * @details power > 2はデバッグ専用.
  */
 void WeaponEnchanter::apply_magic()
 {
@@ -42,8 +43,7 @@ void WeaponEnchanter::apply_magic()
     switch (this->o_ptr->tval) {
     case ItemKindType::DIGGING: {
         if (this->power > 1) {
-            /* this->power > 2はデバッグ専用. */
-            if (one_in_(30) || (this->power > 2))
+            if ((this->power > 2) || one_in_(30))
                 become_random_artifact(this->player_ptr, this->o_ptr, false);
             else
                 this->o_ptr->name2 = EGO_DIGGING;