2 * @brief 防具類に耐性等を付与する処理の共通部分
7 #include "object-enchant/protector/abstract-protector-enchanter.h"
8 #include "object-enchant/object-boost.h"
9 #include "system/item-entity.h"
13 * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
17 AbstractProtectorEnchanter::AbstractProtectorEnchanter(ItemEntity *o_ptr, DEPTH level, int power)
21 if (this->power == 0) {
25 auto toac1 = (ARMOUR_CLASS)(randint1(5) + m_bonus(5, level));
26 auto toac2 = (ARMOUR_CLASS)m_bonus(10, level);
27 if (this->power > 0) {
28 this->o_ptr->to_a += toac1;
29 if (this->power > 1) {
30 this->o_ptr->to_a += toac2;
36 if (this->power < 0) {
37 this->o_ptr->to_a -= toac1;
38 if (this->power < -1) {
39 this->o_ptr->to_a -= toac2;
42 if (this->o_ptr->to_a < 0) {
43 this->o_ptr->curse_flags.set(CurseTraitType::CURSED);