2 * @brief ランダムアーティファクトにpvalを追加する処理
7 #include "artifact/random-art-pval-investor.h"
8 #include "artifact/random-art-bias-types.h"
9 #include "object-enchant/tr-types.h"
10 #include "object-hook/hook-weapon.h"
11 #include "sv-definition/sv-armor-types.h"
12 #include "system/object-type-definition.h"
13 #include "util/bit-flags-calculator.h"
15 static bool random_art_bias_strength(object_type *o_ptr)
17 if (has_flag(o_ptr->art_flags, TR_STR))
20 add_flag(o_ptr->art_flags, TR_STR);
24 static bool random_art_bias_intelligence(object_type *o_ptr)
26 if (has_flag(o_ptr->art_flags, TR_INT))
29 add_flag(o_ptr->art_flags, TR_INT);
33 static bool random_art_bias_wisdom(object_type *o_ptr)
35 if (has_flag(o_ptr->art_flags, TR_WIS))
38 add_flag(o_ptr->art_flags, TR_WIS);
42 static bool random_art_bias_dexterity(object_type *o_ptr)
44 if (has_flag(o_ptr->art_flags, TR_DEX))
47 add_flag(o_ptr->art_flags, TR_DEX);
51 static bool random_art_bias_constitution(object_type *o_ptr)
53 if (has_flag(o_ptr->art_flags, TR_CON))
56 add_flag(o_ptr->art_flags, TR_CON);
60 static bool random_art_bias_charisma(object_type *o_ptr)
62 if (has_flag(o_ptr->art_flags, TR_CHR))
65 add_flag(o_ptr->art_flags, TR_CHR);
69 static bool random_art_bias_magic_mastery(object_type *o_ptr)
71 if ((o_ptr->tval != TV_GLOVES) || has_flag(o_ptr->art_flags, TR_MAGIC_MASTERY))
74 add_flag(o_ptr->art_flags, TR_MAGIC_MASTERY);
78 static bool random_art_bias_stealth(object_type *o_ptr)
80 if (has_flag(o_ptr->art_flags, TR_STEALTH))
83 add_flag(o_ptr->art_flags, TR_STEALTH);
87 static bool random_art_bias_search(object_type *o_ptr)
89 if (has_flag(o_ptr->art_flags, TR_SEARCH))
92 add_flag(o_ptr->art_flags, TR_SEARCH);
96 static bool switch_random_art_bias(object_type *o_ptr)
98 switch (o_ptr->artifact_bias) {
100 return random_art_bias_strength(o_ptr) || random_art_bias_constitution(o_ptr) || random_art_bias_dexterity(o_ptr);
102 return random_art_bias_intelligence(o_ptr) || random_art_bias_magic_mastery(o_ptr);
104 return random_art_bias_dexterity(o_ptr) || random_art_bias_constitution(o_ptr) || random_art_bias_strength(o_ptr);
106 return random_art_bias_stealth(o_ptr) || random_art_bias_search(o_ptr);
108 return random_art_bias_strength(o_ptr);
110 return random_art_bias_intelligence(o_ptr);
113 return random_art_bias_wisdom(o_ptr);
115 return random_art_bias_dexterity(o_ptr);
117 return random_art_bias_constitution(o_ptr);
119 return random_art_bias_charisma(o_ptr);
125 static bool random_art_bias_decrease_mana(object_type *o_ptr)
127 if (((o_ptr->artifact_bias != BIAS_MAGE) && (o_ptr->artifact_bias != BIAS_PRIESTLY)) || (o_ptr->tval != TV_SOFT_ARMOR) || (o_ptr->sval != SV_ROBE)
128 || has_flag(o_ptr->art_flags, TR_DEC_MANA) || !one_in_(3))
131 add_flag(o_ptr->art_flags, TR_DEC_MANA);
136 * @brief ランダムアーティファクト生成中、対象のオブジェクトにpval能力を付加する。/ Add one pval on generation of randam artifact.
137 * @details 優先的に付加されるpvalがランダムアーティファクトバイアスに依存して存在する。
138 * 原則的候補は腕力、知力、賢さ、器用さ、耐久、魅力、探索、隠密、赤外線視力、加速。武器のみ採掘、追加攻撃も候補に入る。
139 * @attention オブジェクトのtval、svalに依存したハードコーディング処理がある。
140 * @param o_ptr 対象のオブジェクト構造体ポインタ
143 void random_plus(object_type *o_ptr)
145 if (switch_random_art_bias(o_ptr) || random_art_bias_decrease_mana(o_ptr))
148 int this_type = object_is_weapon_ammo(o_ptr) ? 23 : 19;
149 switch (randint1(this_type)) {
152 add_flag(o_ptr->art_flags, TR_STR);
153 if (!o_ptr->artifact_bias && !one_in_(13))
154 o_ptr->artifact_bias = BIAS_STR;
155 else if (!o_ptr->artifact_bias && one_in_(7))
156 o_ptr->artifact_bias = BIAS_WARRIOR;
161 add_flag(o_ptr->art_flags, TR_INT);
162 if (!o_ptr->artifact_bias && !one_in_(13))
163 o_ptr->artifact_bias = BIAS_INT;
164 else if (!o_ptr->artifact_bias && one_in_(7))
165 o_ptr->artifact_bias = BIAS_MAGE;
170 add_flag(o_ptr->art_flags, TR_WIS);
171 if (!o_ptr->artifact_bias && !one_in_(13))
172 o_ptr->artifact_bias = BIAS_WIS;
173 else if (!o_ptr->artifact_bias && one_in_(7))
174 o_ptr->artifact_bias = BIAS_PRIESTLY;
179 add_flag(o_ptr->art_flags, TR_DEX);
180 if (!o_ptr->artifact_bias && !one_in_(13))
181 o_ptr->artifact_bias = BIAS_DEX;
182 else if (!o_ptr->artifact_bias && one_in_(7))
183 o_ptr->artifact_bias = BIAS_ROGUE;
188 add_flag(o_ptr->art_flags, TR_CON);
189 if (!o_ptr->artifact_bias && !one_in_(13))
190 o_ptr->artifact_bias = BIAS_CON;
191 else if (!o_ptr->artifact_bias && one_in_(9))
192 o_ptr->artifact_bias = BIAS_RANGER;
197 add_flag(o_ptr->art_flags, TR_CHR);
198 if (!o_ptr->artifact_bias && !one_in_(13))
199 o_ptr->artifact_bias = BIAS_CHR;
204 add_flag(o_ptr->art_flags, TR_STEALTH);
205 if (!o_ptr->artifact_bias && one_in_(3))
206 o_ptr->artifact_bias = BIAS_ROGUE;
211 add_flag(o_ptr->art_flags, TR_SEARCH);
212 if (!o_ptr->artifact_bias && one_in_(9))
213 o_ptr->artifact_bias = BIAS_RANGER;
218 add_flag(o_ptr->art_flags, TR_INFRA);
221 add_flag(o_ptr->art_flags, TR_SPEED);
222 if (!o_ptr->artifact_bias && one_in_(11))
223 o_ptr->artifact_bias = BIAS_ROGUE;
228 add_flag(o_ptr->art_flags, TR_TUNNEL);
232 if (o_ptr->tval == TV_BOW) {
237 add_flag(o_ptr->art_flags, TR_BLOWS);
238 if (!o_ptr->artifact_bias && one_in_(11))
239 o_ptr->artifact_bias = BIAS_WARRIOR;