OSDN Git Service

[Refactor] #37353 cave_type 構造体を grid_type に改名。 / Rename cave_type structure to grid_...
[hengbandforosx/hengbandosx.git] / src / spells2.c
index 172b86e..bf77bcb 100644 (file)
@@ -25,6 +25,7 @@
 #include "avatar.h"
 
 #include "spells-status.h"
+#include "realm-hex.h"
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
@@ -37,9 +38,9 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
 {
        POSITION x, y;
        bool detect = FALSE;
-       cave_type *c_ptr;
+       grid_type *c_ptr;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan the current panel */
        for (y = 1; y < cur_hgt - 1; y++)
@@ -171,7 +172,7 @@ bool detect_objects_gold(POSITION range)
 
        bool detect = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
        for (i = 1; i < o_max; i++)
@@ -226,7 +227,7 @@ bool detect_objects_normal(POSITION range)
 
        bool detect = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
        for (i = 1; i < o_max; i++)
@@ -289,7 +290,7 @@ bool detect_objects_magic(POSITION range)
 
        bool detect = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan all objects */
        for (i = 1; i < o_max; i++)
@@ -364,7 +365,7 @@ bool detect_monsters_normal(POSITION range)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -412,7 +413,7 @@ bool detect_monsters_invis(POSITION range)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -465,7 +466,7 @@ bool detect_monsters_evil(POSITION range)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -522,7 +523,7 @@ bool detect_monsters_nonliving(POSITION range)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -572,7 +573,7 @@ bool detect_monsters_mind(POSITION range)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -625,7 +626,7 @@ bool detect_monsters_string(POSITION range, concptr Match)
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -680,7 +681,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
        bool flag = FALSE;
        concptr desc_monsters = _("変なモンスター", "weird monsters");
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        for (i = 1; i < m_max; i++)
        {
@@ -927,9 +928,9 @@ bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
 {
        msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
-       project(0, (powerful ? 7 : 5), p_ptr->y, p_ptr->x,
+       project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
        (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
-       if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE))
+       if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE))
        {
                (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
        }
@@ -971,8 +972,8 @@ bool crusade(void)
 void aggravate_monsters(MONSTER_IDX who)
 {
        MONSTER_IDX i;
-       bool    sleep = FALSE;
-       bool    speed = FALSE;
+       bool sleep = FALSE;
+       bool speed = FALSE;
 
        /* Aggravate everyone nearby */
        for (i = 1; i < m_max; i++)
@@ -1040,7 +1041,6 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
        else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
        else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
 
-
        else
        {
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
@@ -1394,7 +1394,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
 {
        POSITION y, x;
        int k, t;
-       cave_type *c_ptr;
+       grid_type *c_ptr;
        bool flag = FALSE;
 
        /* Prevent destruction of quest levels and town */
@@ -1542,7 +1542,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                        else
                                        {
                                                /* Create floor */
-                                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                                               cave_set_feat(y, x, feat_ground_type[randint0(100)]);
                                        }
                                }
                                else /* In generation */
@@ -1593,11 +1593,11 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
                                c_ptr = &cave[y][x];
 
                                if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
-                               else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+                               else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
                                {
                                        DIRECTION i;
                                        POSITION yy, xx;
-                                       cave_type *cc_ptr;
+                                       grid_type *cc_ptr;
 
                                        for (i = 0; i < 9; i++)
                                        {
@@ -1682,7 +1682,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
        int sn = 0;
        POSITION sy = 0, sx = 0;
        bool hurt = FALSE;
-       cave_type *c_ptr;
+       grid_type *c_ptr;
        bool map[32][32];
 
        /* Prevent destruction of quest levels and town */
@@ -2040,7 +2040,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                                else
                                {
                                        /* Create floor */
-                                       cave_set_feat(yy, xx, floor_type[randint0(100)]);
+                                       cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
                                }
                        }
                }
@@ -2063,11 +2063,11 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        c_ptr = &cave[yy][xx];
 
                        if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
-                       else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+                       else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
                        {
                                DIRECTION ii;
                                POSITION yyy, xxx;
-                               cave_type *cc_ptr;
+                               grid_type *cc_ptr;
 
                                for (ii = 0; ii < 9; ii++)
                                {
@@ -2086,7 +2086,6 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
        }
 
        /* Mega-Hack -- Forget the view and lite */
-       /* Update the health bar */
        p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
        p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
@@ -2197,7 +2196,7 @@ static void cave_temp_room_lite(void)
                POSITION y = temp_y[i];
                POSITION x = temp_x[i];
 
-               cave_type *c_ptr = &cave[y][x];
+               grid_type *c_ptr = &cave[y][x];
 
                /* No longer in the array */
                c_ptr->info &= ~(CAVE_TEMP);
@@ -2238,11 +2237,8 @@ static void cave_temp_room_lite(void)
                        }
                }
 
-               /* Note */
                note_spot(y, x);
-
                lite_spot(y, x);
-
                update_local_illumination(y, x);
        }
 
@@ -2275,7 +2271,7 @@ static void cave_temp_room_unlite(void)
                POSITION x = temp_x[i];
                int j;
 
-               cave_type *c_ptr = &cave[y][x];
+               grid_type *c_ptr = &cave[y][x];
                bool do_dark = !is_mirror_grid(c_ptr);
 
                /* No longer in the array */
@@ -2288,12 +2284,12 @@ static void cave_temp_room_unlite(void)
                        {
                                for (j = 0; j < 9; j++)
                                {
-                                       int by = y + ddy_ddd[j];
-                                       int bx = x + ddx_ddd[j];
+                                       POSITION by = y + ddy_ddd[j];
+                                       POSITION bx = x + ddx_ddd[j];
 
                                        if (in_bounds2(by, bx))
                                        {
-                                               cave_type *cc_ptr = &cave[by][bx];
+                                               grid_type *cc_ptr = &cave[by][bx];
 
                                                if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                                {
@@ -2313,7 +2309,6 @@ static void cave_temp_room_unlite(void)
                        {
                                /* Forget the grid */
                                if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
-
                                note_spot(y, x);
                        }
 
@@ -2324,7 +2319,6 @@ static void cave_temp_room_unlite(void)
                        }
 
                        lite_spot(y, x);
-
                        update_local_illumination(y, x);
                }
        }
@@ -2408,7 +2402,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
  */
 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
 {
-       cave_type *c_ptr;
+       grid_type *c_ptr;
 
        /* Get the grid */
        c_ptr = &cave[y][x];
@@ -2604,7 +2598,7 @@ bool starlight(bool magic)
                        if (!player_bold(y, x)) break;
                }
 
-               project(0, 0, p_ptr->y, p_ptr->x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
+               project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
                        (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
        }
        return TRUE;
@@ -2622,13 +2616,12 @@ bool lite_area(HIT_POINT dam, POSITION rad)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
 
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
        {
                msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
                return FALSE;
        }
 
-       /* Hack -- Message */
        if (!p_ptr->blind)
        {
                msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
@@ -2637,7 +2630,6 @@ bool lite_area(HIT_POINT dam, POSITION rad)
        /* Hook into the "project()" function */
        (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
 
-       /* Lite up the room */
        lite_room(p_ptr->y, p_ptr->x);
 
        /* Assume seen */
@@ -2664,7 +2656,6 @@ bool unlite_area(HIT_POINT dam, POSITION rad)
        /* Hook into the "project()" function */
        (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
 
-       /* Lite up the room */
        unlite_room(p_ptr->y, p_ptr->x);
 
        /* Assume seen */
@@ -2900,7 +2891,7 @@ bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int n
 bool teleport_swap(DIRECTION dir)
 {
        POSITION tx, ty;
-       cave_type* c_ptr;
+       grid_type* c_ptr;
        monster_type* m_ptr;
        monster_race* r_ptr;
 
@@ -2925,16 +2916,12 @@ bool teleport_swap(DIRECTION dir)
        if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
        {
                msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
-
-               /* Failure */
                return FALSE;
        }
 
        if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
        {
                msg_print(_("失敗した。", "Failed to swap."));
-
-               /* Failure */
                return FALSE;
        }
 
@@ -2946,10 +2933,7 @@ bool teleport_swap(DIRECTION dir)
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
                msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
-
                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
-
-               /* Failure */
                return FALSE;
        }
 
@@ -3201,13 +3185,9 @@ bool glyph_creation(void)
 bool wall_stone(void)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-
        bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
-
        p_ptr->update |= (PU_FLOW);
-
        p_ptr->redraw |= (PR_MAP);
-
        return dummy;
 }
 
@@ -3320,8 +3300,7 @@ void call_chaos(void)
  */
 bool activate_ty_curse(bool stop_ty, int *count)
 {
-       int     i = 0;
-
+       int i = 0;
        BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
 
        do
@@ -3513,38 +3492,6 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
        return count;
 }
 
-
-/*!
- * @brief サイバーデーモンの召喚
- * @param who 召喚主のモンスターID(0ならばプレイヤー)
- * @param y 召喚位置Y座標
- * @param x 召喚位置X座標
- * @return 作用が実際にあった場合TRUEを返す
- */
-int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
-{
-       int i;
-       int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
-       int count = 0;
-       BIT_FLAGS mode = PM_ALLOW_GROUP;
-
-       /* Summoned by a monster */
-       if (who > 0)
-       {
-               monster_type *m_ptr = &m_list[who];
-               if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
-       }
-
-       if (max_cyber > 4) max_cyber = 4;
-
-       for (i = 0; i < max_cyber; i++)
-       {
-               count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode, '\0');
-       }
-
-       return count;
-}
-
 /*!
  * @brief 周辺破壊効果(プレイヤー中心)
  * @return 作用が実際にあった場合TRUEを返す
@@ -3968,10 +3915,7 @@ void ring_of_power(DIRECTION dir)
        case 3:
        {
                msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
-
-               /* Dispel monsters */
                dispel_monsters(1000);
-
                break;
        }
 
@@ -3979,9 +3923,7 @@ void ring_of_power(DIRECTION dir)
        case 5:
        case 6:
        {
-               /* Mana Ball */
                fire_ball(GF_MANA, dir, 600, 3);
-
                break;
        }
 
@@ -3990,9 +3932,7 @@ void ring_of_power(DIRECTION dir)
        case 9:
        case 10:
        {
-               /* Mana Bolt */
                fire_bolt(GF_MANA, dir, 500);
-
                break;
        }
        }
@@ -4628,7 +4568,7 @@ void cast_shuffle(void)
        else if (die < 111)
        {
                msg_print(_("《審判》だ。", "It's the Judgement."));
-               do_cmd_rerate(FALSE);
+               roll_hitdice(0L);
                lose_all_mutations();
        }
        else if (die < 120)
@@ -4651,145 +4591,6 @@ void cast_shuffle(void)
        }
 }
 
-bool_hack life_stream(bool_hack message, bool_hack virtue_change)
-{
-       if(virtue_change)
-       {
-               chg_virtue(V_VITALITY, 1);
-               chg_virtue(V_UNLIFE, -5);
-       }
-       if(message)
-       {
-               msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
-       }
-       restore_level();
-       (void)set_poisoned(0);
-       (void)set_blind(0);
-       (void)set_confused(0);
-       (void)set_image(0);
-       (void)set_stun(0);
-       (void)set_cut(0);
-       (void)restore_all_status();
-       (void)set_shero(0, TRUE);
-       handle_stuff();
-       hp_player(5000);
-
-       return TRUE;
-}
-
-bool_hack heroism(int base)
-{
-       bool_hack ident = FALSE;
-       if(set_afraid(0)) ident = TRUE;
-       if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
-       if(hp_player(10)) ident = TRUE;
-       return ident;
-}
-
-bool_hack berserk(int base)
-{
-       bool_hack ident = FALSE;
-       if (set_afraid(0)) ident = TRUE;
-       if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
-       if (hp_player(30)) ident = TRUE;
-       return ident;
-}
-
-bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
-{
-       bool_hack ident = FALSE;
-       if (hp_player(damroll(dice, sides))) ident = TRUE;
-       if (set_blind(0)) ident = TRUE;
-       if (set_cut(p_ptr->cut - 10)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
-       return ident;
-}
-
-bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
-{
-       bool_hack ident = FALSE;
-       if (hp_player(damroll(dice, sides))) ident = TRUE;
-       if (set_blind(0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
-       if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
-       return ident;
-}
-
-bool_hack cure_critical_wounds(HIT_POINT pow)
-{
-       bool_hack ident = FALSE;
-       if (hp_player(pow)) ident = TRUE;
-       if (set_blind(0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
-       if (set_poisoned(0)) ident = TRUE;
-       if (set_stun(0)) ident = TRUE;
-       if (set_cut(0)) ident = TRUE;
-       if (set_shero(0, TRUE)) ident = TRUE;
-       return ident;
-}
-
-bool_hack true_healing(HIT_POINT pow)
-{
-       bool_hack ident = FALSE;
-       if (hp_player(pow)) ident = TRUE;
-       if (set_blind(0)) ident = TRUE;
-       if (set_confused(0)) ident = TRUE;
-       if (set_poisoned(0)) ident = TRUE;
-       if (set_stun(0)) ident = TRUE;
-       if (set_cut(0)) ident = TRUE;
-       if (set_image(0)) ident = TRUE;
-       return ident;
-}
-
-bool_hack restore_mana(bool_hack magic_eater)
-{
-       bool_hack ident = FALSE;
-
-       if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
-       {
-               int i;
-               for (i = 0; i < EATER_EXT * 2; i++)
-               {
-                       p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
-                       if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
-               }
-               for (; i < EATER_EXT * 3; i++)
-               {
-                       KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
-                       p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
-                       if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
-               }
-               msg_print(_("頭がハッキリとした。", "You feel your head clear."));
-               p_ptr->window |= (PW_PLAYER);
-               ident = TRUE;
-       }
-       else if (p_ptr->csp < p_ptr->msp)
-       {
-               p_ptr->csp = p_ptr->msp;
-               p_ptr->csp_frac = 0;
-               msg_print(_("頭がハッキリとした。", "You feel your head clear."));
-               p_ptr->redraw |= (PR_MANA);
-               p_ptr->window |= (PW_PLAYER);
-               p_ptr->window |= (PW_SPELL);
-               ident = TRUE;
-       }
-
-       return ident;
-}
-
-bool restore_all_status(void)
-{
-       bool ident = FALSE; 
-       if (do_res_stat(A_STR)) ident = TRUE;
-       if (do_res_stat(A_INT)) ident = TRUE;
-       if (do_res_stat(A_WIS)) ident = TRUE;
-       if (do_res_stat(A_DEX)) ident = TRUE;
-       if (do_res_stat(A_CON)) ident = TRUE;
-       if (do_res_stat(A_CHR)) ident = TRUE;
-       return ident;
-}
-
 /*!
  * @brief 口を使う継続的な処理を中断する
  * @return なし
@@ -4806,9 +4607,9 @@ bool_hack vampirism(void)
        DIRECTION dir;
        POSITION x, y;
        int dummy;
-       cave_type *c_ptr;
+       grid_type *c_ptr;
 
-       if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
+       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
        {
                msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
                return FALSE;
@@ -4894,7 +4695,7 @@ bool panic_hit(void)
 bool psychometry(void)
 {
        OBJECT_IDX      item;
-       object_type     *o_ptr;
+       object_type *o_ptr;
        GAME_TEXT o_name[MAX_NLEN];
        byte            feel;
        concptr            q, s;
@@ -4934,18 +4735,11 @@ bool psychometry(void)
 #endif
 
 
-       /* We have "felt" it */
        o_ptr->ident |= (IDENT_SENSE);
-
-       /* "Inscribe" it */
        o_ptr->feeling = feel;
-
-       /* Player touches it */
        o_ptr->marked |= OM_TOUCHED;
 
-       /* Combine / Reorder the pack (later) */
        p_ptr->update |= (PU_COMBINE | PU_REORDER);
-
        p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
        /* Valid "tval" codes */
@@ -5175,7 +4969,7 @@ void hayagake(player_type *creature_ptr)
        }
        else
        {
-               cave_type *c_ptr = &cave[creature_ptr->y][creature_ptr->x];
+               grid_type *c_ptr = &cave[creature_ptr->y][creature_ptr->x];
                feature_type *f_ptr = &f_info[c_ptr->feat];
 
                if (!have_flag(f_ptr->flags, FF_PROJECT) ||
@@ -5258,7 +5052,6 @@ bool comvert_mp_to_hp(player_type *creature_ptr)
        {
                msg_print(_("変換に失敗した。", "You failed to convert."));
        }
-       /* Redraw mana and hp */
        creature_ptr->redraw |= (PR_HP | PR_MANA);
        return TRUE;
 }
@@ -5305,7 +5098,7 @@ bool sword_dancing(player_type *creature_ptr)
        DIRECTION dir;
        POSITION y = 0, x = 0;
        int i;
-       cave_type *c_ptr;
+       grid_type *c_ptr;
 
        for (i = 0; i < 6; i++)
        {
@@ -5328,11 +5121,11 @@ bool sword_dancing(player_type *creature_ptr)
 bool confusing_light(player_type *creature_ptr)
 {
        msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
-       slow_monsters(p_ptr->lev);
-       stun_monsters(p_ptr->lev * 4);
-       confuse_monsters(p_ptr->lev * 4);
-       turn_monsters(p_ptr->lev * 4);
-       stasis_monsters(p_ptr->lev * 4);
+       slow_monsters(creature_ptr->lev);
+       stun_monsters(creature_ptr->lev * 4);
+       confuse_monsters(creature_ptr->lev * 4);
+       turn_monsters(creature_ptr->lev * 4);
+       stasis_monsters(creature_ptr->lev * 4);
        return TRUE;
 }