OSDN Git Service

[Refactor] #2267 powerが0ならばearly returnすることとし、武器種別に基づくスキップ判定は上流のswtichで処理されるので除去した
authorHourier <66951241+Hourier@users.noreply.github.com>
Tue, 22 Feb 2022 11:17:49 +0000 (20:17 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Wed, 23 Feb 2022 02:35:05 +0000 (11:35 +0900)
src/object-enchant/weapon/abstract-weapon-enchanter.cpp

index c193b31..de1ace0 100644 (file)
@@ -51,15 +51,12 @@ AbstractWeaponEnchanter::AbstractWeaponEnchanter(ObjectType *o_ptr, DEPTH level,
 
 void AbstractWeaponEnchanter::decide_skip()
 {
-    this->should_skip = (this->o_ptr->tval == ItemKindType::SWORD) && (this->o_ptr->sval == SV_DIAMOND_EDGE);
-    this->should_skip |= (this->o_ptr->tval == ItemKindType::SWORD) && (this->o_ptr->sval == SV_POISON_NEEDLE) && (this->power != 0);
-    this->should_skip |= (this->o_ptr->tval == ItemKindType::POLEARM) && (this->o_ptr->sval == SV_DEATH_SCYTHE) && (this->power != 0);
-    auto other_weapons_enchant = this->o_ptr->tval == ItemKindType::DIGGING;
-    other_weapons_enchant |= this->o_ptr->tval == ItemKindType::HAFTED;
-    other_weapons_enchant |= this->o_ptr->tval == ItemKindType::BOW;
-    other_weapons_enchant |= this->o_ptr->tval == ItemKindType::SHOT;
-    other_weapons_enchant |= this->o_ptr->tval == ItemKindType::ARROW;
-    other_weapons_enchant |= this->o_ptr->tval == ItemKindType::BOLT;
-    other_weapons_enchant &= this->power != 0;
-    this->should_skip |= !other_weapons_enchant;
+    if (this->power == 0) {
+        this->should_skip = true;
+        return;
+    }
+
+    this->should_skip |= (this->o_ptr->tval == ItemKindType::SWORD) && (this->o_ptr->sval == SV_DIAMOND_EDGE);
+    this->should_skip |= (this->o_ptr->tval == ItemKindType::SWORD) && (this->o_ptr->sval == SV_POISON_NEEDLE);
+    this->should_skip |= (this->o_ptr->tval == ItemKindType::POLEARM) && (this->o_ptr->sval == SV_DEATH_SCYTHE);
 }