2 * @brief 軽鎧に耐性等の追加効果を付与する処理
7 #include "object-enchant/protector/apply-magic-soft-armor.h"
8 #include "object/object-kind-hook.h"
9 #include "object/tval-types.h"
10 #include "sv-definition/sv-armor-types.h"
11 #include "system/baseitem-info.h"
12 #include "system/item-entity.h"
13 #include "system/player-type-definition.h"
17 * @param player_ptr プレイヤーへの参照ポインタ
18 * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
22 SoftArmorEnchanter::SoftArmorEnchanter(PlayerType *player_ptr, ItemEntity *o_ptr, DEPTH level, int power)
23 : ArmorEnchanter{ player_ptr, o_ptr, level, power }
28 * @brief power > 2 はデバッグ専用.
30 void SoftArmorEnchanter::apply_magic()
33 if (this->power > 1) {
34 this->give_high_ego_index();
35 if (this->is_high_ego_generated) {
39 this->give_ego_index();
43 if (this->power < -1) {
48 void SoftArmorEnchanter::sval_enchant()
50 const auto sval = this->o_ptr->bi_key.sval();
51 if (!sval.has_value()) {
55 switch (sval.value()) {
57 this->o_ptr->pval = randint1(4);
59 case SV_ABUNAI_MIZUGI:
60 if (this->player_ptr->ppersonality != PERSONALITY_SEXY) {
64 this->o_ptr->pval = 3;
65 this->o_ptr->art_flags.set(TR_STR);
66 this->o_ptr->art_flags.set(TR_INT);
67 this->o_ptr->art_flags.set(TR_WIS);
68 this->o_ptr->art_flags.set(TR_DEX);
69 this->o_ptr->art_flags.set(TR_CON);
70 this->o_ptr->art_flags.set(TR_CHR);
78 * @brief ベースアイテムがローブの時、確率で永続か宵闇のローブを生成する.
79 * @return 生成条件を満たしたらtrue、満たさなかったらfalse
80 * @details 永続:12%、宵闇:3%
82 void SoftArmorEnchanter::give_high_ego_index()
84 const auto sval = this->o_ptr->bi_key.sval();
85 if ((sval != SV_ROBE) || (randint0(100) >= 15)) {
89 this->is_high_ego_generated = true;
90 auto ego_robe = one_in_(5);
91 this->o_ptr->ego_idx = ego_robe ? EgoType::TWILIGHT : EgoType::PERMANENCE;
96 const BaseitemKey key(ItemKindType::SOFT_ARMOR, SV_TWILIGHT_ROBE);
97 this->o_ptr->bi_id = lookup_baseitem_id(key);
98 this->o_ptr->bi_key = key;
100 this->o_ptr->to_a = 0;