2 * @brief 剣に耐性等の追加効果を付与する処理
7 #include "object-enchant/weapon/apply-magic-sword.h"
8 #include "floor/floor-base-definitions.h"
9 #include "inventory/inventory-slot-types.h"
10 #include "object-enchant/object-boost.h"
11 #include "sv-definition/sv-weapon-types.h"
12 #include "system/item-entity.h"
13 #include "view/display-messages.h"
16 * @brief 剣強化クラスのコンストラクタ
17 * @param player_ptr プレイヤーへの参照ポインタ
18 * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
22 SwordEnchanter::SwordEnchanter(PlayerType *player_ptr, ItemEntity *o_ptr, DEPTH level, int power)
23 : MeleeWeaponEnchanter(player_ptr, o_ptr, level, power)
27 void SwordEnchanter::decide_skip()
29 AbstractWeaponEnchanter::decide_skip();
30 const auto sval = this->o_ptr->bi_key.sval();
31 this->should_skip |= sval == SV_POISON_NEEDLE;
34 void SwordEnchanter::apply_magic()
37 if (this->should_skip) {
41 this->give_killing_bonus();
42 const auto sval = this->o_ptr->bi_key.sval();
43 if (sval == SV_DIAMOND_EDGE) {
47 MeleeWeaponEnchanter::apply_magic();
50 void SwordEnchanter::give_ego_index()
53 this->o_ptr->ego_idx = get_random_ego(INVEN_MAIN_HAND, true);
54 if (this->o_ptr->ego_idx == EgoType::EARTHQUAKES) {
61 switch (this->o_ptr->ego_idx) {
62 case EgoType::SHARPNESS:
63 this->o_ptr->pval = static_cast<short>(m_bonus(5, this->level) + 1);
70 void SwordEnchanter::give_cursed()
72 if (randint0(MAX_DEPTH) >= this->level) {
77 const auto sval = this->o_ptr->bi_key.sval();
79 this->o_ptr->ego_idx = get_random_ego(INVEN_MAIN_HAND, false);
80 if ((sval != SV_HAYABUSA) || (this->o_ptr->get_ego().max_pval >= 0)) {
85 msg_print(_("エラー:隼の剣に割り当てるエゴ無し", "Error: Cannot find for Hayabusa."));