case ItemKindType::SHOT:
case ItemKindType::ARROW:
case ItemKindType::BOLT:
- if (power != 0) {
- WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
- }
-
+ WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
break;
case ItemKindType::POLEARM:
- if ((power != 0) && (o_ptr->sval != SV_DEATH_SCYTHE)) {
- WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
- }
-
+ WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
break;
case ItemKindType::SWORD:
- if ((power != 0) && (o_ptr->sval != SV_POISON_NEEDLE)) {
- WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
- }
-
+ // @todo いずれSwordEnchanter等作って分離する.
+ WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
break;
case ItemKindType::SHIELD:
ShieldEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
#include "object-enchant/weapon/abstract-weapon-enchanter.h"
#include "object-enchant/object-boost.h"
#include "object/tval-types.h"
+#include "sv-definition/sv-weapon-types.h"
#include "system/object-type-definition.h"
AbstractWeaponEnchanter::AbstractWeaponEnchanter(ObjectType *o_ptr, DEPTH level, int power)
, level(level)
, power(power)
{
+ this->decide_skip();
+ if (this->should_skip) {
+ return;
+ }
+
auto tohit1 = static_cast<short>(randint1(5) + m_bonus(5, this->level));
auto todam1 = static_cast<short>(randint1(5) + m_bonus(5, this->level));
auto tohit2 = static_cast<short>(m_bonus(10, this->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;
+}