OSDN Git Service

[Refactor] #38997 IS_INVULN() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Tue, 24 Dec 2019 08:31:40 +0000 (17:31 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 24 Dec 2019 08:31:40 +0000 (17:31 +0900)
src/core.c
src/grid.c
src/mspells1.c
src/player-damage.c
src/player-effects.c
src/player-move.c
src/player-status.c
src/player-status.h
src/selfinfo.c
src/view-mainwindow.c

index 905a087..fcf3717 100644 (file)
@@ -729,14 +729,14 @@ static bool pattern_effect(player_type *creature_ptr)
                break;
 
        case PATTERN_TILE_WRECKED:
-               if (!IS_INVULN())
+               if (!IS_INVULN(creature_ptr))
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, 200, _("壊れた「パターン」を歩いたダメージ", "walking the corrupted Pattern"), -1);
                break;
 
        default:
                if (PRACE_IS_(creature_ptr, RACE_AMBERITE) && !one_in_(2))
                        return TRUE;
-               else if (!IS_INVULN())
+               else if (!IS_INVULN(creature_ptr))
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(1, 3), _("「パターン」を歩いたダメージ", "walking the Pattern"), -1);
                break;
        }
@@ -1320,7 +1320,7 @@ static void process_world_aux_digestion(player_type *creature_ptr)
                                /* Calculate damage */
                                HIT_POINT dam = (PY_FOOD_STARVE - creature_ptr->food) / 10;
 
-                               if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
+                               if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_LOSELIFE, dam, _("空腹", "starvation"), -1);
                        }
                }
        }
@@ -1344,13 +1344,13 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        /*** Damage over Time ***/
 
        /* Take damage from poison */
-       if (creature_ptr->poisoned && !IS_INVULN())
+       if (creature_ptr->poisoned && !IS_INVULN(creature_ptr))
        {
                take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, _("毒", "poison"), -1);
        }
 
        /* Take damage from cuts */
-       if (creature_ptr->cut && !IS_INVULN())
+       if (creature_ptr->cut && !IS_INVULN(creature_ptr))
        {
                HIT_POINT dam;
 
@@ -1398,7 +1398,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
        /* (Vampires) Take damage from sunlight */
        if (PRACE_IS_(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE))
        {
-               if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN() && is_daytime())
+               if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->resist_lite && !IS_INVULN(creature_ptr) && is_daytime())
                {
                        if ((creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
                        {
@@ -1425,11 +1425,11 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        object_desc(o_name, o_ptr, OD_NAME_ONLY);
                        sprintf(ouch, _("%sを装備したダメージ", "wielding %s"), o_name);
 
-                       if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
+                       if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, 1, ouch, -1);
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !creature_ptr->immune_fire)
+       if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_fire)
        {
                int damage = 0;
 
@@ -1468,7 +1468,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_cold)
+       if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_cold)
        {
                int damage = 0;
 
@@ -1506,7 +1506,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_elec)
+       if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_elec)
        {
                int damage = 0;
 
@@ -1544,7 +1544,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !creature_ptr->immune_acid)
+       if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN(creature_ptr) && !creature_ptr->immune_acid)
        {
                int damage = 0;
 
@@ -1582,7 +1582,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                }
        }
 
-       if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN())
+       if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN(creature_ptr))
        {
                int damage = 0;
 
@@ -1673,7 +1673,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
         */
        if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY))
        {
-               if (!IS_INVULN() && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
+               if (!IS_INVULN(creature_ptr) && !creature_ptr->wraith_form && !creature_ptr->kabenuke && ((creature_ptr->chp > (creature_ptr->lev / 5)) || !creature_ptr->pass_wall))
                {
                        concptr dam_desc;
                        cave_no_regen = TRUE;
index 01d2532..d6cca0f 100644 (file)
@@ -571,7 +571,7 @@ void print_rel(SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x)
                if (!use_graphics)
                {
                        if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                       else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                }
 
@@ -727,7 +727,7 @@ void lite_spot(POSITION y, POSITION x)
                if (!use_graphics)
                {
                        if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                       else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                }
 
@@ -1299,7 +1299,7 @@ bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode)
                        if (!p_ptr->levitation && !p_ptr->can_swim) return FALSE;
                }
 
-               if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN())
+               if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN(p_ptr))
                {
                        /* Always forbid deep lava */
                        if (have_flag(f_ptr->flags, FF_DEEP)) return FALSE;
index 40aeec4..52843b7 100644 (file)
@@ -877,7 +877,7 @@ bool dispel_check(MONSTER_IDX m_idx)
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
        /* Invulnabilty (including the song) */
-       if (IS_INVULN()) return (TRUE);
+       if (IS_INVULN(p_ptr)) return (TRUE);
 
        /* Wraith form */
        if (p_ptr->wraith_form) return (TRUE);
@@ -1151,7 +1151,7 @@ static int choose_attack_spell(MONSTER_IDX m_idx, byte spells[], byte num)
        }
 
        /* Attack spell (most of the time) */
-       if (IS_INVULN())
+       if (IS_INVULN(p_ptr))
        {
                if (psy_spe_num && (randint0(100) < 50))
                {
index 6a50b6b..30a4b93 100644 (file)
@@ -412,7 +412,7 @@ int take_hit(player_type *creature_ptr, int damage_type, HIT_POINT damage, concp
        /* Mega-Hack -- Apply "invulnerability" */
        if ((damage_type != DAMAGE_USELIFE) && (damage_type != DAMAGE_LOSELIFE))
        {
-               if (IS_INVULN() && (damage < 9000))
+               if (IS_INVULN(creature_ptr) && (damage < 9000))
                {
                        if (damage_type == DAMAGE_FORCE)
                        {
index 5b2e8fe..f6ac642 100644 (file)
@@ -1332,7 +1332,7 @@ bool set_invuln(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->invuln > v) return FALSE;
                }
-               else if (!IS_INVULN())
+               else if (!IS_INVULN(creature_ptr))
                {
                        msg_print(_("無敵だ!", "Invulnerability!"));
                        notice = TRUE;
index f6303ab..0522441 100644 (file)
@@ -1608,7 +1608,7 @@ static bool run_test(void)
                                }
 
                                /* Lava */
-                               else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
+                               else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN(p_ptr)))
                                {
                                        /* Ignore */
                                        notice = FALSE;
index 21106fc..c3c61d4 100644 (file)
@@ -5178,7 +5178,7 @@ void wreck_the_pattern(player_type *creature_ptr)
        msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
        msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
 
-       if (!IS_INVULN()) take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
+       if (!IS_INVULN(creature_ptr)) take_hit(creature_ptr, DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
        to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
index e43bc2e..3e33949 100644 (file)
@@ -801,7 +801,7 @@ extern const s32b player_exp_a[PY_MAX_LEVEL];
 
 /* Temporary flags macro */
 #define IS_FAST(C) (C->fast || music_singing(C, MUSIC_SPEED) || music_singing(C, MUSIC_SHERO))
-#define IS_INVULN() (p_ptr->invuln || music_singing(p_ptr, MUSIC_INVULN))
+#define IS_INVULN(C) (C->invuln || music_singing(C, MUSIC_INVULN))
 #define IS_HERO() (p_ptr->hero || music_singing(p_ptr, MUSIC_HERO) || music_singing(p_ptr, MUSIC_SHERO))
 #define IS_BLESSED() (p_ptr->blessed || music_singing(p_ptr, MUSIC_BLESS) || hex_spelling(HEX_BLESS))
 #define IS_OPPOSE_ACID() (p_ptr->oppose_acid || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
index ff231b2..a8ffb98 100644 (file)
@@ -1040,7 +1040,7 @@ void self_knowledge(player_type *creature_ptr)
        {
                info[i++] = _("あなたは神秘のシールドで守られている。", "You are protected by a mystic shield.");
        }
-       if (IS_INVULN())
+       if (IS_INVULN(creature_ptr))
        {
                info[i++] = _("あなたは現在傷つかない。", "You are temporarily invulnerable.");
        }
index 27150ff..c713427 100644 (file)
@@ -556,7 +556,7 @@ static void prt_status(player_type *creature_ptr)
        if (creature_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
 
        /* Invulnerability */
-       if (IS_INVULN()) ADD_FLG(BAR_INVULN);
+       if (IS_INVULN(creature_ptr)) ADD_FLG(BAR_INVULN);
 
        /* Wraith form */
        if (creature_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
@@ -1935,7 +1935,7 @@ static void display_dungeon(void)
                                if (!use_graphics)
                                {
                                        if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                                       else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
                                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                                }
 
@@ -2557,7 +2557,7 @@ void prt_map(void)
                        if (!use_graphics)
                        {
                                if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                               else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
                                else if (p_ptr->wraith_form) a = TERM_L_DARK;
                        }
 
@@ -3580,7 +3580,7 @@ void display_map(floor_type *floor_ptr, int *cy, int *cx)
                        if (!use_graphics)
                        {
                                if (current_world_ptr->timewalk_m_idx) ta = TERM_DARK;
-                               else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
+                               else if (IS_INVULN(p_ptr) || p_ptr->timewalk) ta = TERM_WHITE;
                                else if (p_ptr->wraith_form) ta = TERM_L_DARK;
                        }
 
@@ -3823,7 +3823,7 @@ void prt_path(POSITION y, POSITION x)
                        if (!use_graphics)
                        {
                                if (current_world_ptr->timewalk_m_idx) a = TERM_DARK;
-                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
+                               else if (IS_INVULN(p_ptr) || p_ptr->timewalk) a = TERM_WHITE;
                                else if (p_ptr->wraith_form) a = TERM_L_DARK;
                        }