OSDN Git Service

[Refactor] 発生源に使用されているwhoをリネーム
[hengbandforosx/hengbandosx.git] / src / spell / spells-summon.cpp
index c253741..290dc3e 100644 (file)
@@ -1,4 +1,4 @@
-#include "spell/spells-summon.h"
+#include "spell/spells-summon.h"
 #include "avatar/avatar.h"
 #include "effect/spells-effect-util.h"
 #include "floor/floor-object.h"
 #include "spell-kind/spells-lite.h"
 #include "spell-kind/spells-sight.h"
 #include "spell-kind/spells-specific-bolt.h"
-#include "spell/spell-types.h"
 #include "spell/spells-diceroll.h"
 #include "spell/spells-status.h"
 #include "spell/summon-types.h"
 #include "status/bad-status-setter.h"
 #include "sv-definition/sv-other-types.h"
 #include "system/floor-type-definition.h"
-#include "system/monster-race-definition.h"
-#include "system/monster-type-definition.h"
-#include "system/object-type-definition.h"
+#include "system/item-entity.h"
+#include "system/monster-entity.h"
+#include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "target/projection-path-calculator.h"
 #include "util/string-processor.h"
  * @param mode モンスター生成条件フラグ
  * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
  */
-bool trump_summoning(player_type *player_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, summon_type type, BIT_FLAGS mode)
+bool trump_summoning(PlayerType *player_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, summon_type type, BIT_FLAGS mode)
 {
     /* Default level */
     PLAYER_LEVEL plev = player_ptr->lev;
-    if (!lev)
+    if (!lev) {
         lev = plev * 2 / 3 + randint1(plev / 2);
+    }
 
-    MONSTER_IDX who;
+    MONSTER_IDX src_idx;
     if (pet) {
         /* Become pet */
         mode |= PM_FORCE_PET;
@@ -63,24 +63,26 @@ bool trump_summoning(player_type *player_ptr, int num, bool pet, POSITION y, POS
         /* Only sometimes allow unique monster */
         if (mode & PM_ALLOW_UNIQUE) {
             /* Forbid often */
-            if (randint1(50 + plev) >= plev / 10)
+            if (randint1(50 + plev) >= plev / 10) {
                 mode &= ~PM_ALLOW_UNIQUE;
+            }
         }
 
         /* Player is who summons */
-        who = -1;
+        src_idx = -1;
     } else {
         /* Prevent taming, allow unique monster */
         mode |= PM_NO_PET;
 
         /* Behave as if they appear by themselfs */
-        who = 0;
+        src_idx = 0;
     }
 
     bool success = false;
     for (int i = 0; i < num; i++) {
-        if (summon_specific(player_ptr, who, y, x, lev, type, mode))
+        if (summon_specific(player_ptr, src_idx, y, x, lev, type, mode)) {
             success = true;
+        }
     }
 
     if (!success) {
@@ -90,19 +92,22 @@ bool trump_summoning(player_type *player_ptr, int num, bool pet, POSITION y, POS
     return success;
 }
 
-bool cast_summon_demon(player_type *player_ptr, int power)
+bool cast_summon_demon(PlayerType *player_ptr, int power)
 {
     uint32_t flg = 0L;
     bool pet = !one_in_(3);
-    if (pet)
+    if (pet) {
         flg |= PM_FORCE_PET;
-    else
+    } else {
         flg |= PM_NO_PET;
-    if (!(pet && (player_ptr->lev < 50)))
+    }
+    if (!(pet && (player_ptr->lev < 50))) {
         flg |= PM_ALLOW_GROUP;
+    }
 
-    if (!summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_DEMON, flg))
+    if (!summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_DEMON, flg)) {
         return true;
+    }
 
     msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
     if (pet) {
@@ -114,82 +119,92 @@ bool cast_summon_demon(player_type *player_ptr, int power)
     return true;
 }
 
-bool cast_summon_undead(player_type *player_ptr, int power)
+bool cast_summon_undead(PlayerType *player_ptr, int power)
 {
     bool pet = one_in_(3);
     summon_type type = (player_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
 
     BIT_FLAGS mode = 0L;
-    if (!pet || ((player_ptr->lev > 24) && one_in_(3)))
+    if (!pet || ((player_ptr->lev > 24) && one_in_(3))) {
         mode |= PM_ALLOW_GROUP;
-    if (pet)
+    }
+    if (pet) {
         mode |= PM_FORCE_PET;
-    else
+    } else {
         mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
+    }
 
     if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, type, mode)) {
         msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
             "Cold winds begin to blow around you, carrying with them the stench of decay..."));
-        if (pet)
+        if (pet) {
             msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!", "Ancient, long-dead forms arise from the ground to serve you!"));
-        else
+        } else {
             msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!", "'The dead arise... to punish you for disturbing them!'"));
+        }
     }
     return true;
 }
 
-bool cast_summon_hound(player_type *player_ptr, int power)
+bool cast_summon_hound(PlayerType *player_ptr, int power)
 {
     BIT_FLAGS mode = PM_ALLOW_GROUP;
     bool pet = !one_in_(5);
-    if (pet)
+    if (pet) {
         mode |= PM_FORCE_PET;
-    else
+    } else {
         mode |= PM_NO_PET;
+    }
 
     if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_HOUND, mode)) {
-        if (pet)
+        if (pet) {
             msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servants."));
-        else
+        } else {
             msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemies!"));
+        }
     }
 
     return true;
 }
 
-bool cast_summon_elemental(player_type *player_ptr, int power)
+bool cast_summon_elemental(PlayerType *player_ptr, int power)
 {
     bool pet = one_in_(3);
     BIT_FLAGS mode = 0L;
-    if (!(pet && (player_ptr->lev < 50)))
+    if (!(pet && (player_ptr->lev < 50))) {
         mode |= PM_ALLOW_GROUP;
-    if (pet)
+    }
+    if (pet) {
         mode |= PM_FORCE_PET;
-    else
+    } else {
         mode |= PM_NO_PET;
+    }
 
     if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_ELEMENTAL, mode)) {
         msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
-        if (pet)
+        if (pet) {
             msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
-        else
+        } else {
             msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
+        }
     }
 
     return true;
 }
 
-bool cast_summon_octopus(player_type *player_ptr)
+bool cast_summon_octopus(PlayerType *player_ptr)
 {
     BIT_FLAGS mode = PM_ALLOW_GROUP;
     bool pet = !one_in_(5);
-    if (pet)
+    if (pet) {
         mode |= PM_FORCE_PET;
-    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_JIZOTAKO, mode)) {
-        if (pet)
+    }
+    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MonsterRaceId::JIZOTAKO, mode)) {
+        if (pet) {
             msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servants."));
-        else
+        } else {
             msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemies!"));
+        }
     }
 
     return true;
@@ -199,23 +214,24 @@ bool cast_summon_octopus(player_type *player_ptr)
  * @brief 悪魔領域のグレーターデーモン召喚を処理する / Daemon spell Summon Greater Demon
  * @return 処理を実行したならばTRUEを返す。
  */
-bool cast_summon_greater_demon(player_type *player_ptr)
+bool cast_summon_greater_demon(PlayerType *player_ptr)
 {
-    concptr q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
-    concptr s = _("捧げられる死体を持っていない。", "You have nothing to scrifice.");
-    OBJECT_IDX item;
-    object_type *o_ptr;
-    o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), FuncItemTester(&object_type::is_offerable));
-    if (!o_ptr)
+    constexpr auto q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
+    constexpr auto s = _("捧げられる死体を持っていない。", "You have nothing to sacrifice.");
+    short i_idx;
+    const auto *o_ptr = choose_object(player_ptr, &i_idx, q, s, (USE_INVEN | USE_FLOOR), FuncItemTester(&ItemEntity::is_offerable));
+    if (!o_ptr) {
         return false;
+    }
 
     PLAYER_LEVEL plev = player_ptr->lev;
-    int summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
+    auto corpse_r_idx = i2enum<MonsterRaceId>(o_ptr->pval);
+    int summon_lev = plev * 2 / 3 + monraces_info[corpse_r_idx].level;
 
     if (summon_specific(player_ptr, -1, player_ptr->y, player_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET))) {
         msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
         msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
-        vary_item(player_ptr, item, -1);
+        vary_item(player_ptr, i_idx, -1);
     } else {
         msg_print(_("悪魔は現れなかった。", "No Greater Demon arrives."));
     }
@@ -232,56 +248,59 @@ bool cast_summon_greater_demon(player_type *player_ptr)
  * @param mode 召喚オプション
  * @return ターンを消費した場合TRUEを返す
  */
-bool summon_kin_player(player_type *player_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
+bool summon_kin_player(PlayerType *player_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
 {
     bool pet = (bool)(mode & PM_FORCE_PET);
-    if (!pet)
+    if (!pet) {
         mode |= PM_NO_PET;
+    }
     return summon_specific(player_ptr, (pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
 }
 
 /*!
  * @brief サイバーデーモンの召喚
  * @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚主のモンスターID(0ならばプレイヤー)
+ * @param src_idx 召喚主のモンスターID(0ならばプレイヤー)
  * @param y 召喚位置Y座標
  * @param x 召喚位置X座標
  * @return 作用が実際にあった場合TRUEを返す
  */
-int summon_cyber(player_type *player_ptr, MONSTER_IDX who, POSITION y, POSITION x)
+int summon_cyber(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x)
 {
     /* Summoned by a monster */
     BIT_FLAGS mode = PM_ALLOW_GROUP;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (who > 0) {
-        monster_type *m_ptr = &floor_ptr->m_list[who];
-        if (is_pet(m_ptr))
+    auto *floor_ptr = player_ptr->current_floor_ptr;
+    if (src_idx > 0) {
+        auto *m_ptr = &floor_ptr->m_list[src_idx];
+        if (m_ptr->is_pet()) {
             mode |= PM_FORCE_PET;
+        }
     }
 
-    int max_cyber = (easy_band ? 1 : (floor_ptr->dun_level / 50) + randint1(2));
-    if (max_cyber > 4)
+    int max_cyber = (floor_ptr->dun_level / 50) + randint1(2);
+    if (max_cyber > 4) {
         max_cyber = 4;
+    }
 
     int count = 0;
     for (int i = 0; i < max_cyber; i++) {
-        count += summon_specific(player_ptr, who, y, x, 100, SUMMON_CYBER, mode);
+        count += summon_specific(player_ptr, src_idx, y, x, 100, SUMMON_CYBER, mode);
     }
 
     return count;
 }
 
-void mitokohmon(player_type *player_ptr)
+void mitokohmon(PlayerType *player_ptr)
 {
     int count = 0;
-    concptr sukekakusan = "";
-    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_SUKE, PM_FORCE_PET)) {
+    [[maybe_unused]] concptr sukekakusan = "";
+    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MonsterRaceId::SUKE, PM_FORCE_PET)) {
         msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
         sukekakusan = "Suke-san";
         count++;
     }
 
-    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_KAKU, PM_FORCE_PET)) {
+    if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MonsterRaceId::KAKU, PM_FORCE_PET)) {
         msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
         sukekakusan = "Kaku-san";
         count++;
@@ -289,16 +308,20 @@ void mitokohmon(player_type *player_ptr)
 
     if (!count) {
         for (int i = player_ptr->current_floor_ptr->m_max - 1; i > 0; i--) {
-            monster_type *m_ptr;
+            MonsterEntity *m_ptr;
             m_ptr = &player_ptr->current_floor_ptr->m_list[i];
-            if (!monster_is_valid(m_ptr))
+            if (!m_ptr->is_valid()) {
                 continue;
-            if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU)))
+            }
+            if (!((m_ptr->r_idx == MonsterRaceId::SUKE) || (m_ptr->r_idx == MonsterRaceId::KAKU))) {
                 continue;
-            if (!los(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x))
+            }
+            if (!los(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x)) {
                 continue;
-            if (!projectable(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x))
+            }
+            if (!projectable(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x)) {
                 continue;
+            }
             count++;
             break;
         }
@@ -309,9 +332,9 @@ void mitokohmon(player_type *player_ptr)
         return;
     }
 
-    msg_format(
-        _("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」", "%^s says 'WHO do you think this person is! Bow your head, down to your knees!'"),
-        sukekakusan);
+    msg_print(_(
+        "「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
+        format("%s^ says 'WHO do you think this person is! Bow your head, down to your knees!'", sukekakusan)));
     sukekaku = true;
     stun_monsters(player_ptr, 120);
     confuse_monsters(player_ptr, 120);
@@ -329,7 +352,7 @@ void mitokohmon(player_type *player_ptr)
  * @return 作用が実際にあった場合TRUEを返す
  * @todo 引数にPOSITION x/yは必要か? 要調査
  */
-int activate_hi_summon(player_type *player_ptr, POSITION y, POSITION x, bool can_pet)
+int activate_hi_summon(PlayerType *player_ptr, POSITION y, POSITION x, bool can_pet)
 {
     BIT_FLAGS mode = PM_ALLOW_GROUP;
     bool pet = false;
@@ -342,8 +365,9 @@ int activate_hi_summon(player_type *player_ptr, POSITION y, POSITION x, bool can
         }
     }
 
-    if (!pet)
+    if (!pet) {
         mode |= PM_NO_PET;
+    }
 
     DEPTH dungeon_level = player_ptr->current_floor_ptr->dun_level;
     DEPTH summon_lev = (pet ? player_ptr->lev * 2 / 3 + randint1(player_ptr->lev / 2) : dungeon_level);
@@ -383,34 +407,39 @@ int activate_hi_summon(player_type *player_ptr, POSITION y, POSITION x, bool can
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
             break;
         case 17:
-            if (can_pet)
+            if (can_pet) {
                 break;
+            }
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
             break;
         case 18:
         case 19:
-            if (can_pet)
+            if (can_pet) {
                 break;
+            }
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
             break;
         case 20:
         case 21:
-            if (!can_pet)
+            if (!can_pet) {
                 mode |= PM_ALLOW_UNIQUE;
+            }
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
             break;
         case 22:
         case 23:
-            if (!can_pet)
+            if (!can_pet) {
                 mode |= PM_ALLOW_UNIQUE;
+            }
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
             break;
         case 24:
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
             break;
         default:
-            if (!can_pet)
+            if (!can_pet) {
                 mode |= PM_ALLOW_UNIQUE;
+            }
             count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), SUMMON_NONE, mode);
         }
     }
@@ -423,72 +452,74 @@ int activate_hi_summon(player_type *player_ptr, POSITION y, POSITION x, bool can
  * @param player_ptr プレイヤーへの参照ポインタ
  * @param dir 方向ID
  */
-void cast_invoke_spirits(player_type *player_ptr, DIRECTION dir)
+void cast_invoke_spirits(PlayerType *player_ptr, DIRECTION dir)
 {
     PLAYER_LEVEL plev = player_ptr->lev;
     int die = randint1(100) + plev / 5;
-    int vir = virtue_number(player_ptr, V_CHANCE);
+    int vir = virtue_number(player_ptr, Virtue::CHANCE);
 
     if (vir != 0) {
         if (player_ptr->virtues[vir - 1] > 0) {
-            while (randint1(400) < player_ptr->virtues[vir - 1])
+            while (randint1(400) < player_ptr->virtues[vir - 1]) {
                 die++;
+            }
         } else {
-            while (randint1(400) < (0 - player_ptr->virtues[vir - 1]))
+            while (randint1(400) < (0 - player_ptr->virtues[vir - 1])) {
                 die--;
+            }
         }
     }
 
     msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
-    if (die < 26)
-        chg_virtue(player_ptr, V_CHANCE, 1);
+    if (die < 26) {
+        chg_virtue(player_ptr, Virtue::CHANCE, 1);
+    }
 
     if (die > 100) {
         msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
     }
 
+    BadStatusSetter bss(player_ptr);
     if (die < 8) {
         msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", "Oh no! Mouldering forms rise from the earth around you!"));
 
         (void)summon_specific(player_ptr, 0, player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
             (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
-        chg_virtue(player_ptr, V_UNLIFE, 1);
+        chg_virtue(player_ptr, Virtue::UNLIFE, 1);
     } else if (die < 14) {
         msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
-
-        set_afraid(player_ptr, player_ptr->afraid + randint1(4) + 4);
+        (void)bss.mod_fear(randint1(4) + 4);
     } else if (die < 26) {
         msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...", "Your head is invaded by a horde of gibbering spectral voices..."));
-
-        set_confused(player_ptr, player_ptr->confused + randint1(4) + 4);
+        (void)bss.mod_confusion(randint1(4) + 4);
     } else if (die < 31) {
         poly_monster(player_ptr, dir, plev);
     } else if (die < 36) {
-        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
+        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
     } else if (die < 41) {
         confuse_monster(player_ptr, dir, plev);
     } else if (die < 46) {
-        fire_ball(player_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
+        fire_ball(player_ptr, AttributeType::POIS, dir, 20 + (plev / 2), 3);
     } else if (die < 51) {
         (void)lite_line(player_ptr, dir, damroll(6, 8));
     } else if (die < 56) {
-        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, GF_ELEC, dir, damroll(3 + ((plev - 5) / 4), 8));
+        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::ELEC, dir, damroll(3 + ((plev - 5) / 4), 8));
     } else if (die < 61) {
-        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, GF_COLD, dir, damroll(5 + ((plev - 5) / 4), 8));
+        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::COLD, dir, damroll(5 + ((plev - 5) / 4), 8));
     } else if (die < 66) {
-        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), GF_ACID, dir, damroll(6 + ((plev - 5) / 4), 8));
+        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), AttributeType::ACID, dir, damroll(6 + ((plev - 5) / 4), 8));
     } else if (die < 71) {
-        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), GF_FIRE, dir, damroll(8 + ((plev - 5) / 4), 8));
+        fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), AttributeType::FIRE, dir, damroll(8 + ((plev - 5) / 4), 8));
     } else if (die < 76) {
         hypodynamic_bolt(player_ptr, dir, 75);
     } else if (die < 81) {
-        fire_ball(player_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
+        fire_ball(player_ptr, AttributeType::ELEC, dir, 30 + plev / 2, 2);
     } else if (die < 86) {
-        fire_ball(player_ptr, GF_ACID, dir, 40 + plev, 2);
+        fire_ball(player_ptr, AttributeType::ACID, dir, 40 + plev, 2);
     } else if (die < 91) {
-        fire_ball(player_ptr, GF_ICE, dir, 70 + plev, 3);
+        fire_ball(player_ptr, AttributeType::ICE, dir, 70 + plev, 3);
     } else if (die < 96) {
-        fire_ball(player_ptr, GF_FIRE, dir, 80 + plev, 3);
+        fire_ball(player_ptr, AttributeType::FIRE, dir, 80 + plev, 3);
     } else if (die < 101) {
         hypodynamic_bolt(player_ptr, dir, 100 + plev);
     } else if (die < 104) {