2 * @file random-art-activation.cpp
3 * @brief ランダムアーティファクトの発動実装定義
6 #include "artifact/random-art-activation.h"
7 #include "artifact/random-art-bias-types.h"
8 #include "artifact/random-art-effects.h"
9 #include "object-enchant/object-boost.h"
10 #include "object-enchant/tr-types.h"
11 #include "system/item-entity.h"
12 #include "util/bit-flags-calculator.h"
13 #include "util/enum-converter.h"
15 static RandomArtActType invest_activation_elec(void)
18 return RandomArtActType::BO_ELEC_1;
22 return RandomArtActType::BA_ELEC_2;
25 return RandomArtActType::BA_ELEC_3;
28 static RandomArtActType invest_activation_fire(void)
31 return RandomArtActType::BO_FIRE_1;
35 return RandomArtActType::BA_FIRE_1;
38 return RandomArtActType::BA_FIRE_2;
41 static RandomArtActType invest_activation_cold(void)
44 return RandomArtActType::BO_COLD_1;
48 return RandomArtActType::BA_COLD_1;
52 return RandomArtActType::BA_COLD_2;
55 return RandomArtActType::BA_COLD_3;
58 static RandomArtActType invest_activation_chaos(void)
60 return one_in_(6) ? RandomArtActType::SUMMON_DEMON : RandomArtActType::CALL_CHAOS;
63 static RandomArtActType invest_activation_priest(void)
66 return RandomArtActType::CHARM_UNDEAD;
70 return RandomArtActType::BANISH_EVIL;
74 return RandomArtActType::DISP_EVIL;
78 return RandomArtActType::PROT_EVIL;
82 return RandomArtActType::CURE_1000;
86 return RandomArtActType::CURE_700;
90 return RandomArtActType::REST_ALL;
94 return RandomArtActType::REST_EXP;
97 return RandomArtActType::CURE_MW;
100 static RandomArtActType invest_activation_necromancy(void)
103 return RandomArtActType::WRAITH;
107 return RandomArtActType::DISP_GOOD;
111 return RandomArtActType::MASS_GENO;
115 return RandomArtActType::GENOCIDE;
119 return RandomArtActType::SUMMON_UNDEAD;
123 return RandomArtActType::DRAIN_2;
127 return RandomArtActType::CHARM_UNDEAD;
130 return RandomArtActType::DRAIN_1;
133 static RandomArtActType invest_activation_law(void)
136 return RandomArtActType::BANISH_EVIL;
140 return RandomArtActType::DISP_EVIL;
143 return RandomArtActType::PROT_EVIL;
146 static RandomArtActType invest_activation_rogue(void)
149 return RandomArtActType::SPEED;
153 return RandomArtActType::SLEEP;
157 return RandomArtActType::DETECT_ALL;
161 return RandomArtActType::ID_FULL;
164 return RandomArtActType::ID_PLAIN;
167 static RandomArtActType invest_activation_mage(void)
170 return RandomArtActType::SUMMON_ELEMENTAL;
174 return RandomArtActType::SUMMON_PHANTOM;
178 return RandomArtActType::RUNE_EXPLO;
181 return RandomArtActType::ESP;
184 static RandomArtActType invest_activation_warrior(void)
186 return one_in_(100) ? RandomArtActType::INVULN : RandomArtActType::BERSERK;
189 static RandomArtActType invest_activation_ranger(void)
192 return RandomArtActType::CHARM_ANIMALS;
196 return RandomArtActType::SUMMON_ANIMAL;
200 return RandomArtActType::CHARM_ANIMAL;
204 return RandomArtActType::RESIST_ALL;
208 return RandomArtActType::SATIATE;
211 return RandomArtActType::CURE_POISON;
215 * @brief ランダムアーティファクト生成中、対象のオブジェクトにバイアスに依存した発動を与える。/ Add one activaton of randam artifact depend on bias.
216 * @details バイアスが無い場合、一部のバイアスの確率によっては one_ability() に処理が移行する。
217 * @param o_ptr 対象のオブジェクト構造体ポインタ
219 void give_activation_power(ItemEntity *o_ptr)
221 RandomArtActType type = RandomArtActType::NONE;
223 switch (o_ptr->artifact_bias) {
225 type = invest_activation_elec();
229 type = RandomArtActType::BA_POIS_1;
233 type = invest_activation_fire();
237 type = invest_activation_cold();
241 type = invest_activation_chaos();
245 type = invest_activation_priest();
248 case BIAS_NECROMANTIC:
249 type = invest_activation_necromancy();
253 type = invest_activation_law();
257 type = invest_activation_rogue();
261 type = invest_activation_mage();
265 type = invest_activation_warrior();
269 type = invest_activation_ranger();
274 if ((type == RandomArtActType::NONE) || (randint1(100) >= chance)) {
275 one_activation(o_ptr);
279 o_ptr->activation_id = type;
280 o_ptr->art_flags.set(TR_ACTIVATE);