OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / realm-chaos.c
index eb579c8..a994114 100644 (file)
@@ -1,5 +1,8 @@
 #include "angband.h"
 #include "cmd-spell.h"
+#include "spells-summon.h"
+#include "spells-status.h"
+#include "projection.h"
 
 /*!
 * @brief カオス領域魔法の各処理を行う
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
 */
-cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
+concptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
        bool info = (mode == SPELL_INFO) ? TRUE : FALSE;
        bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
 
-       static const char s_dam[] = _("損傷:", "dam ");
-       static const char s_random[] = _("ランダム", "random");
-
        DIRECTION dir;
-       int plev = p_ptr->lev;
+       PLAYER_LEVEL plev = p_ptr->lev;
 
        switch (spell)
        {
@@ -27,8 +27,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);
 
@@ -62,8 +62,8 @@ 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;
+                       DICE_NUMBER dice = 2;
+                       DICE_SID sides = plev / 2;
                        POSITION rad = (plev / 10) + 1;
 
                        if (info) return info_damage(dice, sides, 0);
@@ -97,8 +97,8 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("魔法の球を放つ。", "Fires a ball of magic.");
 
                {
-                       int dice = 3;
-                       int sides = 5;
+                       DICE_NUMBER dice = 3;
+                       DICE_SID sides = 5;
                        POSITION rad = (plev < 30) ? 2 : 3;
                        int base;
 
@@ -130,8 +130,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 +149,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);
 
@@ -184,7 +184,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("モンスターにランダムな効果を与える。", "Fires something with random effects.");
 
                {
-                       if (info) return s_random;
+                       if (info) return KWD_RANDOM;
 
                        if (cast)
                        {
@@ -201,8 +201,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);
 
@@ -238,8 +238,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);
 
@@ -295,7 +295,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                {
                        int base = 12;
-                       int sides = 4;
+                       DICE_SID sides = 4;
 
                        if (cast)
                        {
@@ -346,8 +346,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);
 
@@ -399,7 +399,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);
 
@@ -449,26 +449,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 +459,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);
 
@@ -530,7 +511,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (desc) return _("ランダムな属性の球やビームを発生させる。", "Generate random kind of balls or beams.");
 
                {
-                       if (info) return format("%s150 / 250", s_dam);
+                       if (info) return format("%s150 / 250", KWD_DAM);
 
                        if (cast)
                        {
@@ -595,7 +576,7 @@ cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        "Fires rockets, mana balls and nuclear waste balls in all directions each unless you are not adjacent to any walls. Otherwise *destroys* huge area.");
 
                {
-                       if (info) return format("%s3 * 175", s_dam);
+                       if (info) return format("%s3 * 175", KWD_DAM);
 
                        if (cast)
                        {