1 #include "object-enchant/others/apply-magic-lite.h"
2 #include "artifact/random-art-generator.h"
3 #include "inventory/inventory-slot-types.h"
4 #include "object-enchant/object-ego.h"
5 #include "sv-definition/sv-lite-types.h"
6 #include "system/item-entity.h"
7 #include "system/player-type-definition.h"
9 LiteEnchanter::LiteEnchanter(PlayerType *player_ptr, ItemEntity *o_ptr, int power)
10 : player_ptr(player_ptr)
14 const auto sval = this->o_ptr->bi_key.sval();
19 switch (sval.value()) {
21 o_ptr->fuel = randint1(FUEL_TORCH / 2);
24 o_ptr->fuel = randint1(FUEL_LAMP / 2);
31 void LiteEnchanter::apply_magic()
33 if (this->power > 2) {
34 become_random_artifact(this->player_ptr, this->o_ptr, false);
38 if ((this->power == 2) || ((this->power == 1) && one_in_(3))) {
39 while (!this->o_ptr->is_ego()) {
40 this->give_ego_index();
46 if (this->power == -2) {
51 void LiteEnchanter::give_ego_index()
54 auto okay_flag = true;
55 this->o_ptr->ego_idx = get_random_ego(INVEN_LITE, true);
56 switch (this->o_ptr->ego_idx) {
57 case EgoType::LITE_LONG:
58 if (this->o_ptr->bi_key.sval() == SV_LITE_FEANOR) {
73 void LiteEnchanter::give_cursed()
75 this->o_ptr->ego_idx = get_random_ego(INVEN_LITE, false);
76 switch (this->o_ptr->ego_idx) {
77 case EgoType::LITE_DARKNESS:
78 this->o_ptr->fuel = 0;
79 this->add_dark_flag();
86 void LiteEnchanter::add_dark_flag()
88 const auto sval = this->o_ptr->bi_key.sval();
93 switch (sval.value()) {
95 this->o_ptr->art_flags.set(TR_LITE_M1);
98 this->o_ptr->art_flags.set(TR_LITE_M2);
101 this->o_ptr->art_flags.set(TR_LITE_M3);