OSDN Git Service

[Refactor] #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / realm-chaos.c
index 5af95e8..a29cbe0 100644 (file)
@@ -1,5 +1,6 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "spells-summon.h"
 
 /*!
 * @brief カオス領域魔法の各処理を行う
@@ -18,7 +19,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
        static const char s_random[] = _("ランダム", "random");
 
        DIRECTION dir;
-       int plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        switch (spell)
        {
@@ -27,8 +28,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("弱い魔法の矢を放つ。", "Fires a weak bolt of magic.");
 
                {
-                       int dice = 3 + ((plev - 1) / 5);
-                       int sides = 4;
+                       DICE_NUMBER dice = 3 + ((plev - 1) / 5);
+                       DICE_SID sides = 4;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -46,7 +47,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("隣接する罠と扉を破壊する。", "Destroys all traps in adjacent squares.");
 
                {
-                       int rad = 1;
+                       POSITION rad = 1;
 
                        if (info) return info_radius(rad);
 
@@ -62,9 +63,9 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("光源が照らしている範囲か部屋全体を永久に明るくする。", "Lights up nearby area and the inside of a room permanently.");
 
                {
-                       int dice = 2;
-                       int sides = plev / 2;
-                       int rad = (plev / 10) + 1;
+                       DICE_NUMBER dice = 2;
+                       DICE_SID sides = plev / 2;
+                       POSITION rad = (plev / 10) + 1;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -97,9 +98,9 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("魔法の球を放つ。", "Fires a ball of magic.");
 
                {
-                       int dice = 3;
-                       int sides = 5;
-                       int rad = (plev < 30) ? 2 : 3;
+                       DICE_NUMBER dice = 3;
+                       DICE_SID sides = 5;
+                       POSITION rad = (plev < 30) ? 2 : 3;
                        int base;
 
                        if (IS_WIZARD_CLASS())
@@ -130,8 +131,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("炎のボルトもしくはビームを放つ。", "Fires a bolt or beam of fire.");
 
                {
-                       int dice = 8 + (plev - 5) / 4;
-                       int sides = 8;
+                       DICE_NUMBER dice = 8 + (plev - 5) / 4;
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -149,8 +150,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("ごく小さな分解の球を放つ。", "Fires a tiny ball of disintegration.");
 
                {
-                       int dice = 8 + ((plev - 5) / 4);
-                       int sides = 8;
+                       DICE_NUMBER dice = 8 + ((plev - 5) / 4);
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -201,8 +202,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("カオスのボルトもしくはビームを放つ。", "Fires a bolt or ball of chaos.");
 
                {
-                       int dice = 10 + (plev - 5) / 4;
-                       int sides = 8;
+                       DICE_NUMBER dice = 10 + (plev - 5) / 4;
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -221,7 +222,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = 60 + plev;
-                       int rad = plev / 10 + 2;
+                       POSITION rad = plev / 10 + 2;
 
                        if (info) return info_damage(0, 0, dam / 2);
 
@@ -238,8 +239,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("純粋な魔力のビームを放つ。", "Fires a beam of pure mana.");
 
                {
-                       int dice = 11 + (plev - 5) / 4;
-                       int sides = 8;
+                       DICE_NUMBER dice = 11 + (plev - 5) / 4;
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -258,7 +259,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = plev + 55;
-                       int rad = 2;
+                       POSITION rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -295,7 +296,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        int base = 12;
-                       int sides = 4;
+                       DICE_SID sides = 4;
 
                        if (cast)
                        {
@@ -310,7 +311,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = plev * 2 + 99;
-                       int rad = plev / 5;
+                       POSITION rad = plev / 5;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -346,8 +347,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("全方向に対して電撃のビームを放つ。", "Fires lightning beams in all directions.");
 
                {
-                       int dice = 5 + plev / 10;
-                       int sides = 8;
+                       DICE_NUMBER dice = 5 + plev / 10;
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -380,7 +381,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = plev + 70;
-                       int rad = 3 + plev / 40;
+                       POSITION rad = 3 + plev / 40;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -399,7 +400,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        int base = 15;
-                       int sides = 20;
+                       DICE_SID sides = 20;
 
                        if (info) return info_delay(base, sides);
 
@@ -416,7 +417,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = 120 + plev * 2;
-                       int rad = 2;
+                       POSITION rad = 2;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -449,26 +450,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               u32b flg = 0L;
-                               bool pet = !one_in_(3);
-
-                               if (pet) flg |= PM_FORCE_PET;
-                               else flg |= PM_NO_PET;
-                               if (!(pet && (plev < 50))) flg |= PM_ALLOW_GROUP;
-
-                               if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (plev * 3) / 2, SUMMON_DEMON, flg))
-                               {
-                                       msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
-                                       if (pet)
-                                       {
-                                               msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
-                                       }
-                                       else
-                                       {
-                                               msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
-                                                       "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
-                                       }
-                               }
+                               cast_summon_demon((plev * 3) / 2);
                        }
                }
                break;
@@ -478,8 +460,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("重力のビームを放つ。", "Fires a beam of gravity.");
 
                {
-                       int dice = 9 + (plev - 5) / 4;
-                       int sides = 8;
+                       DICE_NUMBER dice = 9 + (plev - 5) / 4;
+                       DICE_SID sides = 8;
 
                        if (info) return info_damage(dice, sides, 0);
 
@@ -497,7 +479,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = plev * 2;
-                       int rad = 2;
+                       POSITION rad = 2;
 
                        if (info) return info_multi_damage(dam);
 
@@ -514,7 +496,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = 300 + 3 * plev;
-                       int rad = 8;
+                       POSITION rad = 8;
 
                        if (info) return info_damage(0, 0, dam / 2);
 
@@ -558,7 +540,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = 300 + plev * 4;
-                       int rad = 4;
+                       POSITION rad = 4;
 
                        if (info) return info_damage(0, 0, dam);
 
@@ -576,7 +558,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        HIT_POINT dam = p_ptr->chp;
-                       int rad = 2;
+                       POSITION rad = 2;
 
                        if (info) return info_damage(0, 0, dam);