OSDN Git Service

#37353 HEX_REVENGE_TYPE, HEX_REVENGE_POWER, HEX_REVENGE_TURN を定義。 / Define HEX_REVENG...
[hengband/hengband.git] / src / do-spell.c
index 53625aa..9b56132 100644 (file)
@@ -487,7 +487,7 @@ static void cast_invoke_spirits(int dir)
  * @param spell 基準となる引数ID
  * @return なし
  */
-static void wild_magic(int spell)
+static void wild_magic(SPELL_IDX spell)
 {
        int counter = 0;
        int type = SUMMON_MOLD + randint0(6);
@@ -986,13 +986,13 @@ static bool cast_summon_greater_demon(void)
  * @param song 魔法効果のID
  * @return なし
  */
-static void start_singing(MAGIC_NUM2 spell, MAGIC_NUM1 song)
+static void start_singing(SPELL_IDX spell, MAGIC_NUM1 song)
 {
        /* Remember the song index */
-       p_ptr->magic_num1[0] = song;
+       SINGING_SONG_EFFECT(p_ptr) = song;
 
        /* Remember the index of the spell which activated the song */
-       p_ptr->magic_num2[0] = spell;
+       SINGING_SONG_ID(p_ptr) = spell;
 
 
        /* Now the player is singing */
@@ -1015,24 +1015,24 @@ void stop_singing(void)
        if (p_ptr->pclass != CLASS_BARD) return;
 
        /* Are there interupted song? */
-       if (p_ptr->magic_num1[1])
+       if (INTERUPTING_SONG_EFFECT(p_ptr))
        {
                /* Forget interupted song */
-               p_ptr->magic_num1[1] = 0;
+               INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
                return;
        }
 
        /* The player is singing? */
-       if (!p_ptr->magic_num1[0]) return;
+       if (!SINGING_SONG_EFFECT(p_ptr)) return;
 
        /* Hack -- if called from set_action(), avoid recursive loop */
        if (p_ptr->action == ACTION_SING) set_action(ACTION_NONE);
 
        /* Message text of each song or etc. */
-       do_spell(REALM_MUSIC, p_ptr->magic_num2[0], SPELL_STOP);
+       do_spell(REALM_MUSIC, SINGING_SONG_ID(p_ptr), SPELL_STOP);
 
-       p_ptr->magic_num1[0] = MUSIC_NONE;
-       p_ptr->magic_num2[0] = 0;
+       SINGING_SONG_EFFECT(p_ptr) = MUSIC_NONE;
+       SINGING_SONG_ID(p_ptr) = 0;
 
        /* Recalculate bonuses */
        p_ptr->update |= (PU_BONUS);
@@ -1048,7 +1048,7 @@ void stop_singing(void)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_life_spell(int spell, BIT_FLAGS mode)
+static cptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -1575,7 +1575,7 @@ static cptr do_life_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_sorcery_spell(int spell, BIT_FLAGS mode)
+static cptr do_sorcery_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -2123,7 +2123,7 @@ static cptr do_sorcery_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_nature_spell(int spell, BIT_FLAGS mode)
+static cptr do_nature_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -2728,7 +2728,7 @@ static cptr do_nature_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_chaos_spell(int spell, BIT_FLAGS mode)
+static cptr do_chaos_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -3341,7 +3341,7 @@ static cptr do_chaos_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_death_spell(int spell, BIT_FLAGS mode)
+static cptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -4014,7 +4014,7 @@ static cptr do_death_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_trump_spell(int spell, BIT_FLAGS mode)
+static cptr do_trump_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -4660,7 +4660,7 @@ static cptr do_trump_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_arcane_spell(int spell, BIT_FLAGS mode)
+static cptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -5221,7 +5221,7 @@ static cptr do_arcane_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_craft_spell(int spell, BIT_FLAGS mode)
+static cptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -5754,7 +5754,7 @@ static cptr do_craft_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_daemon_spell(int spell, BIT_FLAGS mode)
+static cptr do_daemon_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -6370,7 +6370,7 @@ static cptr do_daemon_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_crusade_spell(int spell, BIT_FLAGS mode)
+static cptr do_crusade_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -6983,7 +6983,7 @@ static cptr do_crusade_spell(int spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST / SPELL_FAIL / SPELL_CONT / SPELL_STOP)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST / SPELL_FAIL / SPELL_CONT / SPELL_STOP 時はNULL文字列を返す。
  */
-static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
+static cptr do_music_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -7215,8 +7215,7 @@ static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
                {
                        msg_print(_("静かな音楽が感覚を研ぎ澄まさせた...", "Your quiet music sharpens your sense of hearing..."));
                        /* Hack -- Initialize the turn count */
-                       p_ptr->magic_num1[2] = 0;
-
+                       SINGING_COUNT(p_ptr) = 0;
                        start_singing(spell, MUSIC_DETECT);
                }
 
@@ -7227,14 +7226,14 @@ static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
 
                        if (cont)
                        {
-                               int count = p_ptr->magic_num1[2];
+                               int count = SINGING_COUNT(p_ptr);
 
                                if (count >= 19) wiz_lite(FALSE);
                                if (count >= 11)
                                {
                                        map_area(rad);
                                        if (plev > 39 && count < 19)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                if (count >= 6)
                                {
@@ -7244,7 +7243,7 @@ static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
                                        detect_objects_normal(rad);
 
                                        if (plev > 24 && count < 11)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                if (count >= 3)
                                {
@@ -7252,14 +7251,14 @@ static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
                                        detect_monsters_normal(rad);
 
                                        if (plev > 19 && count < 6)
-                                               p_ptr->magic_num1[2] = count + 1;
+                                               SINGING_COUNT(p_ptr) = count + 1;
                                }
                                detect_traps(rad, TRUE);
                                detect_doors(rad);
                                detect_stairs(rad);
 
                                if (plev > 14 && count < 3)
-                                       p_ptr->magic_num1[2] = count + 1;
+                                       SINGING_COUNT(p_ptr) = count + 1;
                        }
                }
 
@@ -7900,7 +7899,7 @@ static cptr do_music_spell(MAGIC_NUM2 spell, BIT_FLAGS mode)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_CAST)
  * @return SPELL_NAME / SPELL_DESC 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
  */
-static cptr do_hissatsu_spell(int spell, BIT_FLAGS mode)
+static cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -8873,7 +8872,7 @@ static bool item_tester_hook_cursed(object_type *o_ptr)
  * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST / SPELL_CONT / SPELL_STOP)
  * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST / SPELL_CONT / SPELL_STOP 時はNULL文字列を返す。
  */
-static cptr do_hex_spell(int spell, BIT_FLAGS mode)
+static cptr do_hex_spell(SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -9049,22 +9048,22 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                if (name) return _("我慢", "Patience");
                if (desc) return _("数ターン攻撃を耐えた後、受けたダメージを地獄の業火として周囲に放出する。", 
                        "Bursts hell fire strongly after patients any damage while few turns.");
-               power = MIN(200, (p_ptr->magic_num1[2] * 2));
+               power = MIN(200, (HEX_REVENGE_POWER(p_ptr) * 2));
                if (info) return info_damage(0, 0, power);
                if (cast)
                {
                        int a = 3 - (p_ptr->pspeed - 100) / 10;
                        MAGIC_NUM2 r = 3 + randint1(3) + MAX(0, MIN(3, a));
 
-                       if (p_ptr->magic_num2[2] > 0)
+                       if (HEX_REVENGE_TURN(p_ptr) > 0)
                        {
                                msg_print(_("すでに我慢をしている。", "You are already patienting."));
                                return NULL;
                        }
 
-                       p_ptr->magic_num2[1] = 1;
-                       p_ptr->magic_num2[2] = r;
-                       p_ptr->magic_num1[2] = 0;
+                       HEX_REVENGE_TYPE(p_ptr) = 1;
+                       HEX_REVENGE_TURN(p_ptr) = r;
+                       HEX_REVENGE_POWER(p_ptr) = 0;
                        msg_print(_("じっと耐えることにした。", "You decide to patient all damages."));
                        add = FALSE;
                }
@@ -9072,9 +9071,9 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                {
                        int rad = 2 + (power / 50);
 
-                       p_ptr->magic_num2[2]--;
+                       HEX_REVENGE_TURN(p_ptr)--;
 
-                       if ((p_ptr->magic_num2[2] <= 0) || (power >= 200))
+                       if ((HEX_REVENGE_TURN(p_ptr) <= 0) || (power >= 200))
                        {
                                msg_print(_("我慢が解かれた!", "Time for end of patioence!"));
                                if (power)
@@ -9088,9 +9087,9 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                                }
 
                                /* Reset */
-                               p_ptr->magic_num2[1] = 0;
-                               p_ptr->magic_num2[2] = 0;
-                               p_ptr->magic_num1[2] = 0;
+                               HEX_REVENGE_TYPE(p_ptr) = 0;
+                               HEX_REVENGE_TURN(p_ptr) = 0;
+                               HEX_REVENGE_POWER(p_ptr) = 0;
                        }
                }
                break;
@@ -9129,9 +9128,9 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                if (desc) return _("呪文詠唱を中止することなく、薬の効果を得ることができる。", "Quaffs a potion without canceling of casting a spell.");
                if (cast)
                {
-                       p_ptr->magic_num1[0] |= (1L << HEX_INHAIL);
+                       CASTING_HEX_FLAGS(p_ptr) |= (1L << HEX_INHAIL);
                        do_cmd_quaff_potion();
-                       p_ptr->magic_num1[0] &= ~(1L << HEX_INHAIL);
+                       CASTING_HEX_FLAGS(p_ptr) &= ~(1L << HEX_INHAIL);
                        add = FALSE;
                }
                break;
@@ -9371,9 +9370,9 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                        if ((!o_ptr->k_idx) || (!object_is_cursed(o_ptr)))
                        {
                                do_spell(REALM_HEX, spell, SPELL_STOP);
-                               p_ptr->magic_num1[0] &= ~(1L << spell);
-                               p_ptr->magic_num2[0]--;
-                               if (!p_ptr->magic_num2[0]) set_action(ACTION_NONE);
+                               CASTING_HEX_FLAGS(p_ptr) &= ~(1L << spell);
+                               CASTING_HEX_NUM(p_ptr)--;
+                               if (!SINGING_SONG_ID(p_ptr)) set_action(ACTION_NONE);
                        }
                }
                if (stop)
@@ -9460,9 +9459,9 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                        if (!flag)
                        {
                                msg_format(_("%sの呪文の詠唱をやめた。", "Finish casting '%^s'."), do_spell(REALM_HEX, HEX_RESTORE, SPELL_NAME));
-                               p_ptr->magic_num1[0] &= ~(1L << HEX_RESTORE);
-                               if (cont) p_ptr->magic_num2[0]--;
-                               if (p_ptr->magic_num2) p_ptr->action = ACTION_NONE;
+                               CASTING_HEX_FLAGS(p_ptr) &= ~(1L << HEX_RESTORE);
+                               if (cont) CASTING_HEX_NUM(p_ptr)--;
+                               if (CASTING_HEX_NUM(p_ptr)) p_ptr->action = ACTION_NONE;
 
                                /* Redraw status */
                                p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
@@ -9614,7 +9613,7 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                if (name) return _("復讐の宣告", "Revenge sentence");
                if (desc) return _("数ターン後にそれまで受けたダメージに応じた威力の地獄の劫火の弾を放つ。", 
                        "Fires  a ball of hell fire to try revenging after few turns.");
-               power = p_ptr->magic_num1[2];
+               power = HEX_REVENGE_POWER(p_ptr);
                if (info) return info_damage(0, 0, power);
                if (cast)
                {
@@ -9622,22 +9621,22 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                        int a = 3 - (p_ptr->pspeed - 100) / 10;
                        r = 1 + randint1(2) + MAX(0, MIN(3, a));
 
-                       if (p_ptr->magic_num2[2] > 0)
+                       if (HEX_REVENGE_TURN(p_ptr) > 0)
                        {
                                msg_print(_("すでに復讐は宣告済みだ。", "You already pronounced your revenge."));
                                return NULL;
                        }
 
-                       p_ptr->magic_num2[1] = 2;
-                       p_ptr->magic_num2[2] = r;
+                       HEX_REVENGE_TYPE(p_ptr) = 2;
+                       HEX_REVENGE_TURN(p_ptr) = r;
                        msg_format(_("あなたは復讐を宣告した。あと %d ターン。", "You pronounce your revenge. %d turns left."), r);
                        add = FALSE;
                }
                if (cont)
                {
-                       p_ptr->magic_num2[2]--;
+                       HEX_REVENGE_TURN(p_ptr)--;
 
-                       if (p_ptr->magic_num2[2] <= 0)
+                       if (HEX_REVENGE_TURN(p_ptr) <= 0)
                        {
                                int dir;
 
@@ -9662,7 +9661,7 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
                                {
                                        msg_print(_("復讐する気が失せた。", "You are not a mood to revenge."));
                                }
-                               p_ptr->magic_num1[2] = 0;
+                               HEX_REVENGE_POWER(p_ptr) = 0;
                        }
                }
                break;
@@ -9672,8 +9671,8 @@ static cptr do_hex_spell(int spell, BIT_FLAGS mode)
        if ((cast) && (add))
        {
                /* add spell */
-               p_ptr->magic_num1[0] |= 1L << (spell);
-               p_ptr->magic_num2[0]++;
+               CASTING_HEX_FLAGS(p_ptr) |= 1L << (spell);
+               CASTING_HEX_NUM(p_ptr)++;
 
                if (p_ptr->action != ACTION_SPELL) set_action(ACTION_SPELL);
        }