OSDN Git Service

[Refactor] #38997 confuse_monsters()、charm_monsters()、charm_animals()、stun_monsters...
[hengband/hengband.git] / src / realm-life.c
index 85ef354..8af69d5 100644 (file)
@@ -2,14 +2,20 @@
 #include "cmd-spell.h"
 #include "spells-status.h"
 #include "spells-floor.h"
+#include "spells.h"
+#include "player-status.h"
+#include "player-effects.h"
+#include "floor.h"
+#include "targeting.h"
 
 /*!
 * @brief 生命領域魔法の各処理を行う
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell 魔法ID
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_INFO / SPELL_CAST)
 * @return SPELL_NAME / SPELL_DESC / SPELL_INFO 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
 */
-concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
+concptr do_life_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
@@ -17,7 +23,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
        bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
 
        DIRECTION dir;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
 
        switch (spell)
        {
@@ -28,7 +34,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        DICE_NUMBER dice = 2;
                        DICE_SID sides = 10;
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_light_wounds(dice, sides);                 
+                       if (cast) (void)cure_light_wounds(caster_ptr, dice, sides);
                }
                break;
 
@@ -42,7 +48,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_blessed(randint1(base) + base, FALSE);
+                               set_blessed(caster_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -59,7 +65,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -76,7 +82,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               lite_area(damroll(dice, sides), rad);
+                               lite_area(caster_ptr, damroll(dice, sides), rad);
                        }
                }
                break;
@@ -91,9 +97,9 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               detect_traps(rad, TRUE);
-                               detect_doors(rad);
-                               detect_stairs(rad);
+                               detect_traps(caster_ptr, rad, TRUE);
+                               detect_doors(caster_ptr, rad);
+                               detect_stairs(caster_ptr, rad);
                        }
                }
                break;
@@ -106,7 +112,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        DICE_SID sides = 10;
 
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_serious_wounds(dice, sides);
+                       if (cast) (void)cure_serious_wounds(caster_ptr, dice, sides);
                }
                break;
 
@@ -116,7 +122,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               set_poisoned(0);
+                               set_poisoned(caster_ptr, 0);
                        }
                }
                break;
@@ -127,7 +133,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               set_food(PY_FOOD_MAX - 1);
+                               set_food(caster_ptr, PY_FOOD_MAX - 1);
                        }
                }
                break;
@@ -136,7 +142,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("解呪", "Remove Curse");
                if (desc) return _("アイテムにかかった弱い呪いを解除する。", "Removes normal curses from equipped items.");
                {
-                       if (cast) (void)remove_curse();
+                       if (cast) (void)remove_curse(caster_ptr);
                }
                break;
 
@@ -152,7 +158,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -165,7 +171,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        DICE_SID sides = 10;
 
                        if (info) return info_heal(dice, sides, 0);
-                       if (cast) (void)cure_critical_wounds(damroll(dice, sides));
+                       if (cast) (void)cure_critical_wounds(caster_ptr, damroll(dice, sides));
                }
                break;
 
@@ -181,8 +187,8 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               set_oppose_cold(randint1(base) + base, FALSE);
-                               set_oppose_fire(randint1(base) + base, FALSE);
+                               set_oppose_cold(caster_ptr, randint1(base) + base, FALSE);
+                               set_oppose_fire(caster_ptr, randint1(base) + base, FALSE);
                        }
                }
                break;
@@ -198,7 +204,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               map_area(rad);
+                               map_area(caster_ptr, rad);
                        }
                }
                break;
@@ -210,7 +216,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               turn_undead();
+                               turn_undead(caster_ptr);
                        }
                }
                break;
@@ -222,7 +228,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        int heal = 300;
                        if (info) return info_heal(0, 0, heal);
-                       if (cast) (void)cure_critical_wounds(heal);
+                       if (cast) (void)cure_critical_wounds(caster_ptr, heal);
                }
                break;
 
@@ -234,7 +240,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               warding_glyph();
+                               warding_glyph(caster_ptr);
                        }
                }
                break;
@@ -243,7 +249,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (name) return _("*解呪*", "Dispel Curse");
                if (desc) return _("アイテムにかかった強力な呪いを解除する。", "Removes normal and heavy curse from equipped items.");
                {
-                       if (cast) (void)remove_all_curse();
+                       if (cast) (void)remove_all_curse(caster_ptr);
                }
                break;
 
@@ -254,7 +260,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               if (!ident_spell(FALSE)) return NULL;
+                               if (!ident_spell(caster_ptr, FALSE)) return NULL;
                        }
                }
                break;
@@ -271,7 +277,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               dispel_undead(damroll(dice, sides));
+                               dispel_undead(caster_ptr, damroll(dice, sides));
                        }
                }
                break;
@@ -287,7 +293,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               charm_monsters(power);
+                               charm_monsters(caster_ptr, power);
                        }
                }
                break;
@@ -305,7 +311,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                if (!get_aim_dir(&dir)) return NULL;
-                               fire_ball_hide(GF_WOUNDS, dir, damroll(dice, sides), 0);
+                               fire_ball_hide(caster_ptr, GF_WOUNDS, dir, damroll(dice, sides), 0);
                        }
                }
                break;
@@ -322,7 +328,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               if (!recall_player(p_ptr, randint0(21) + 15)) return NULL;
+                               if (!recall_player(caster_ptr, randint0(21) + 15)) return NULL;
                        }
                }
                break;
@@ -339,7 +345,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               alter_reality();
+                               reserve_alter_reality(caster_ptr);
                        }
                }
                break;
@@ -355,8 +361,8 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               warding_glyph();
-                               glyph_creation();
+                               warding_glyph(caster_ptr);
+                               glyph_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
                        }
                }
                break;
@@ -368,7 +374,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               current_floor_ptr->num_repro += MAX_REPRO;
+                               caster_ptr->current_floor_ptr->num_repro += MAX_REPRO;
                        }
                }
                break;
@@ -384,7 +390,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               detect_all(rad);
+                               detect_all(caster_ptr, rad);
                        }
                }
                break;
@@ -401,7 +407,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cast)
                        {
-                               mass_genocide_undead(power, TRUE);
+                               mass_genocide_undead(caster_ptr, power, TRUE);
                        }
                }
                break;
@@ -413,7 +419,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               wiz_lite(FALSE);
+                               wiz_lite(caster_ptr, FALSE);
                        }
                }
                break;
@@ -425,8 +431,8 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (cast)
                        {
-                               (void)restore_all_status();
-                               restore_level();
+                               (void)restore_all_status(caster_ptr);
+                               restore_level(caster_ptr);
                        }
                }
                break;
@@ -438,7 +444,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        int heal = 2000;
                        if (info) return info_heal(0, 0, heal);
-                       if (cast) (void)cure_critical_wounds(heal);
+                       if (cast) (void)cure_critical_wounds(caster_ptr, heal);
                }
                break;
 
@@ -466,13 +472,13 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (cast)
                        {
                                TIME_EFFECT v = randint1(base) + base;
-                               set_fast(v, FALSE);
-                               set_oppose_acid(v, FALSE);
-                               set_oppose_elec(v, FALSE);
-                               set_oppose_fire(v, FALSE);
-                               set_oppose_cold(v, FALSE);
-                               set_oppose_pois(v, FALSE);
-                               set_ultimate_res(v, FALSE);
+                               set_fast(caster_ptr, v, FALSE);
+                               set_oppose_acid(caster_ptr, v, FALSE);
+                               set_oppose_elec(caster_ptr, v, FALSE);
+                               set_oppose_fire(caster_ptr, v, FALSE);
+                               set_oppose_cold(caster_ptr, v, FALSE);
+                               set_oppose_pois(caster_ptr, v, FALSE);
+                               set_ultimate_res(caster_ptr, v, FALSE);
                        }
                }
                break;