OSDN Git Service

[Refactor] #38997 set_stun(), set_oppose_pois() に player_type * 引数を追加.
[hengband/hengband.git] / src / mind.c
index 43172ae..9000d6d 100644 (file)
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "mind.h"
+
 #include "floor.h"
 #include "melee.h"
 #include "spells.h"
@@ -22,6 +27,7 @@
 #include "avatar.h"
 #include "player-move.h"
 #include "player-status.h"
+#include "player-class.h"
 #include "spells-status.h"
 #include "cmd-spell.h"
 #include "spells-floor.h"
 #include "grid.h"
 #include "cmd-basic.h"
 #include "monster-status.h"
+#include "player-effects.h"
+#include "player-damage.h"
+#include "view-mainwindow.h"
+#include "targeting.h"
+#include "realm-song.h"
 
 /*! 特殊技能の一覧テーブル */
 mind_power const mind_powers[5] =
@@ -1095,12 +1106,12 @@ static bool cast_mindcrafter_spell(int spell)
                break;
        case 6:
                /* Character Armour */
-               set_shield((TIME_EFFECT)plev, FALSE);
-               if (plev > 14) set_oppose_acid((TIME_EFFECT)plev, FALSE);
-               if (plev > 19) set_oppose_fire((TIME_EFFECT)plev, FALSE);
-               if (plev > 24) set_oppose_cold((TIME_EFFECT)plev, FALSE);
-               if (plev > 29) set_oppose_elec((TIME_EFFECT)plev, FALSE);
-               if (plev > 34) set_oppose_pois((TIME_EFFECT)plev, FALSE);
+               set_shield(p_ptr, (TIME_EFFECT)plev, FALSE);
+               if (plev > 14) set_oppose_acid(p_ptr, (TIME_EFFECT)plev, FALSE);
+               if (plev > 19) set_oppose_fire(p_ptr, (TIME_EFFECT)plev, FALSE);
+               if (plev > 24) set_oppose_cold(p_ptr, (TIME_EFFECT)plev, FALSE);
+               if (plev > 29) set_oppose_elec(p_ptr, (TIME_EFFECT)plev, FALSE);
+               if (plev > 34) set_oppose_pois(p_ptr, (TIME_EFFECT)plev, FALSE);
                break;
        case 7:
                /* Psychometry */
@@ -1120,7 +1131,7 @@ static bool cast_mindcrafter_spell(int spell)
                break;
        case 9:
                /* Adrenaline */
-               set_afraid(0);
+               set_afraid(p_ptr, 0);
                set_stun(0);
 
                /*
@@ -1129,13 +1140,13 @@ static bool cast_mindcrafter_spell(int spell)
                 */
                if (!IS_FAST() || !IS_HERO())
                {
-                       hp_player(plev);
+                       hp_player(p_ptr, plev);
                }
 
                t = 10 + randint1((plev * 3) / 2);
-               set_hero(t, FALSE);
+               set_hero(p_ptr, t, FALSE);
                /* Haste */
-               (void)set_fast(t, FALSE);
+               (void)set_fast(p_ptr, t, FALSE);
                break;
        case 10:
                /* Telekinesis */
@@ -1197,7 +1208,7 @@ static bool cast_force_spell(int spell)
                (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
                break;
        case 2:
-               set_tim_levitation(randint1(30) + 30 + boost / 5, FALSE);
+               set_tim_levitation(p_ptr, randint1(30) + 30 + boost / 5, FALSE);
                break;
        case 3:
                project_length = plev / 8 + 3;
@@ -1206,7 +1217,7 @@ static bool cast_force_spell(int spell)
                fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
                break;
        case 4:
-               set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
+               set_resist_magic(p_ptr, randint1(20) + 20 + boost / 5, FALSE);
                break;
        case 5:
                msg_print(_("気を練った。", "You improved the Force."));
@@ -1221,7 +1232,7 @@ static bool cast_force_spell(int spell)
                else return TRUE;
                break;
        case 6:
-               set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
+               set_tim_sh_touki(p_ptr, randint1(plev / 2) + 15 + boost / 7, FALSE);
                break;
        case 7:
                return shock_power();
@@ -1248,7 +1259,7 @@ static bool cast_force_spell(int spell)
                bool success = FALSE;
 
                for (i = 0; i < 1 + boost/100; i++)
-                       if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET, '\0'))
+                       if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET))
                                success = TRUE;
                if (success)
                {
@@ -1269,7 +1280,7 @@ static bool cast_force_spell(int spell)
                fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
                break;
        case 13:
-               set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
+               set_lightspeed(p_ptr, randint1(16) + 16 + boost / 20, FALSE);
                break;
        default:
                msg_print(_("なに?", "Zap?"));
@@ -1307,9 +1318,9 @@ static bool cast_mirror_spell(int spell)
 {
        DIRECTION dir;
        PLAYER_LEVEL plev = p_ptr->lev;
-       int             tmp;
+       int tmp;
        TIME_EFFECT t;
-       int             x, y;
+       POSITION x, y;
 
        /* spell code */
        switch (spell)
@@ -1357,7 +1368,7 @@ static bool cast_mirror_spell(int spell)
                break;
                /* robe of dust */
        case 6:
-               set_dustrobe(20 + randint1(20), FALSE);
+               set_dustrobe(p_ptr, 20 + randint1(20), FALSE);
                break;
                /* banishing mirror */
        case 7:
@@ -1392,9 +1403,9 @@ static bool cast_mirror_spell(int spell)
                /* shield of water */
        case 12:
                t = 20 + randint1(20);
-               set_shield(t, FALSE);
-               if (plev > 31)set_tim_reflect(t, FALSE);
-               if (plev > 39)set_resist_magic(t, FALSE);
+               set_shield(p_ptr, t, FALSE);
+               if (plev > 31)set_tim_reflect(p_ptr, t, FALSE);
+               if (plev > 39)set_resist_magic(p_ptr, t, FALSE);
                break;
                /* super ray */
        case 13:
@@ -1429,7 +1440,7 @@ static bool cast_mirror_spell(int spell)
                return recall_player(p_ptr, randint0(21) + 15);
                /* multi-shadow */
        case 18:
-               set_multishadow(6 + randint1(6), FALSE);
+               set_multishadow(p_ptr, 6 + randint1(6), FALSE);
                break;
                /* binding field */
        case 19:
@@ -1437,7 +1448,7 @@ static bool cast_mirror_spell(int spell)
                break;
                /* mirror of Ruffnor */
        case 20:
-               (void)set_invuln(randint1(4) + 4, FALSE);
+               (void)set_invuln(p_ptr, randint1(4) + 4, FALSE);
                break;
        default:
                msg_print(_("なに?", "Zap?"));
@@ -1509,7 +1520,7 @@ static bool cast_berserk_spell(int spell)
                break;
        }
        case 3:
-               earthquake(p_ptr->y, p_ptr->x, 8+randint0(5));
+               earthquake(p_ptr->y, p_ptr->x, 8+randint0(5), 0);
                break;
        case 4:
                massacre();
@@ -1590,12 +1601,12 @@ static bool cast_ninja_spell(int spell)
        case 7:
                return ident_spell(FALSE);
        case 8:
-               set_tim_levitation(randint1(20) + 20, FALSE);
+               set_tim_levitation(p_ptr, randint1(20) + 20, FALSE);
                break;
        case 9:
                fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
                teleport_player(30, 0L);
-               set_oppose_fire((TIME_EFFECT)plev, FALSE);
+               set_oppose_fire(p_ptr, (TIME_EFFECT)plev, FALSE);
                break;
        case 10:
                return rush_attack(NULL);
@@ -1608,7 +1619,7 @@ static bool cast_ninja_spell(int spell)
 
                        for (slot = 0; slot < INVEN_PACK; slot++)
                        {
-                               if (inventory[slot].tval == TV_SPIKE) break;
+                               if (p_ptr->inventory_list[slot].tval == TV_SPIKE) break;
                        }
                        if (slot == INVEN_PACK)
                        {
@@ -1683,8 +1694,6 @@ static bool cast_ninja_spell(int spell)
                {
                        /* Auto-Recall if possible and visible */
                        if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-
-                       /* Track a new monster */
                        health_track(m_idx);
                }
 
@@ -1709,8 +1718,8 @@ static bool cast_ninja_spell(int spell)
                explosive_rune();
                break;
        case 16:
-               (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
-               set_oppose_acid((TIME_EFFECT)plev, FALSE);
+               (void)set_kabenuke(p_ptr, randint1(plev/2) + plev/2, FALSE);
+               set_oppose_acid(p_ptr, (TIME_EFFECT)plev, FALSE);
                break;
        case 17:
                fire_ball(GF_POIS, 0, 75+plev*2/3, plev/5+2);
@@ -1740,7 +1749,7 @@ static bool cast_ninja_spell(int spell)
                break;
        }
        case 19:
-               set_multishadow(6+randint1(6), FALSE);
+               set_multishadow(p_ptr, 6+randint1(6), FALSE);
                break;
        default:
                msg_print(_("なに?", "Zap?"));
@@ -1901,12 +1910,12 @@ void do_cmd_mind(void)
                                else if (b < 15)
                                {
                                        msg_print(_("奇妙な光景が目の前で踊っている...", "Weird visions seem to dance before your eyes..."));
-                                       set_image(p_ptr->image + 5 + randint1(10));
+                                       set_image(p_ptr, p_ptr->image + 5 + randint1(10));
                                }
                                else if (b < 45)
                                {
                                        msg_print(_("あなたの頭は混乱した!", "Your brain is addled!"));
-                                       set_confused(p_ptr->confused + randint1(8));
+                                       set_confused(p_ptr, p_ptr->confused + randint1(8));
                                }
                                else if (b < 90)
                                {
@@ -1935,7 +1944,7 @@ void do_cmd_mind(void)
                                else if (b < 96)
                                {
                                        msg_print(_("まわりのものがキラキラ輝いている!", "Your brain is addled!"));
-                                       set_image(p_ptr->image + 5 + randint1(10));
+                                       set_image(p_ptr, p_ptr->image + 5 + randint1(10));
                                }
                                else
                                {
@@ -2032,7 +2041,7 @@ void do_cmd_mind(void)
                msg_format(_("%sを集中しすぎて気を失ってしまった!", "You faint from the effort!"),p);
 
                /* Hack -- Bypass free action */
-               (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
+               (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(5 * oops + 1));
 
                /* Damage WIS (possibly permanently) */
                if (randint0(100) < 50)
@@ -2042,7 +2051,7 @@ void do_cmd_mind(void)
                        msg_print(_("自分の精神を攻撃してしまった!", "You have damaged your mind!"));
 
                        /* Reduce constitution */
-                       (void)dec_stat(A_WIS, 15 + randint1(10), perm);
+                       (void)dec_stat(p_ptr, A_WIS, 15 + randint1(10), perm);
                }
        }
        p_ptr->redraw |= (PR_MANA);