OSDN Git Service

[Refactor] #38997 IS_OPPOSE_*() の関数マクロを普通の関数に変更し、player_type * 引数を追加 / Changed macro...
authorHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 09:05:11 +0000 (18:05 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 12 Jan 2020 16:06:58 +0000 (01:06 +0900)
18 files changed:
src/chest.c
src/cmd/cmd-eat.c
src/cmd/cmd-quaff.c
src/cmd/cmd-read.c
src/combat/melee1.c
src/core.c
src/files.c
src/monster2.c
src/mspells1.c
src/player-damage.c
src/player-effects.c
src/player-status.c
src/player-status.h
src/selfinfo.c
src/spells1.c
src/trap.c
src/view-mainwindow.c
src/warning.c

index d3538e5..36f41c9 100644 (file)
@@ -170,7 +170,7 @@ void chest_trap(player_type *target_ptr, POSITION y, POSITION x, OBJECT_IDX o_id
        if (trap & (CHEST_POISON))
        {
                msg_print(_("突如吹き出した緑色のガスに包み込まれた!", "A puff of green gas surrounds you!"));
-               if (!(target_ptr->resist_pois || IS_OPPOSE_POIS()))
+               if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)))
                {
                        (void)set_poisoned(target_ptr, target_ptr->poisoned + 10 + randint1(20));
                }
index 149cdb8..351c906 100644 (file)
@@ -58,7 +58,7 @@ void exe_eat_food(player_type *creature_ptr, INVENTORY_IDX item)
                {
                case SV_FOOD_POISON:
                {
-                       if (!(creature_ptr->resist_pois || IS_OPPOSE_POIS()))
+                       if (!(creature_ptr->resist_pois || is_oppose_pois(creature_ptr)))
                        {
                                if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(10) + 10))
                                {
index f9888f9..a14849e 100644 (file)
@@ -128,7 +128,7 @@ void exe_quaff_potion(player_type *creature_ptr, INVENTORY_IDX item)
                        break;
 
                case SV_POTION_POISON:
-                       if (!(creature_ptr->resist_pois || IS_OPPOSE_POIS()))
+                       if (!(creature_ptr->resist_pois || is_oppose_pois(creature_ptr)))
                        {
                                if (set_poisoned(creature_ptr, creature_ptr->poisoned + randint0(15) + 10))
                                {
index 4ec9bf9..a4c9ac3 100644 (file)
@@ -448,7 +448,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
                {
                        fire_ball(creature_ptr, GF_FIRE, 0, 666, 4);
                        /* Note: "Double" damage since it is centered on the player ... */
-                       if (!(IS_OPPOSE_FIRE() || creature_ptr->resist_fire || creature_ptr->immune_fire))
+                       if (!(is_oppose_fire(creature_ptr) || creature_ptr->resist_fire || creature_ptr->immune_fire))
                                take_hit(creature_ptr, DAMAGE_NOESCAPE, 50+randint1(50), _("炎の巻物", "a Scroll of Fire"), -1);
 
                        ident = TRUE;
@@ -459,7 +459,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known)
                case SV_SCROLL_ICE:
                {
                        fire_ball(creature_ptr, GF_ICE, 0, 777, 4);
-                       if (!(IS_OPPOSE_COLD() || creature_ptr->resist_cold || creature_ptr->immune_cold))
+                       if (!(is_oppose_cold(creature_ptr) || creature_ptr->resist_cold || creature_ptr->immune_cold))
                                take_hit(creature_ptr, DAMAGE_NOESCAPE, 100+randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
 
                        ident = TRUE;
index d51ff42..fb5fb6d 100644 (file)
@@ -2088,15 +2088,15 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
 
                                        if (attacker_ptr->align < 0 && mult < 20)
                                                mult = 20;
-                                       if (!(attacker_ptr->resist_acid || IS_OPPOSE_ACID() || attacker_ptr->immune_acid) && (mult < 25))
+                                       if (!(attacker_ptr->resist_acid || is_oppose_acid(attacker_ptr) || attacker_ptr->immune_acid) && (mult < 25))
                                                mult = 25;
-                                       if (!(attacker_ptr->resist_elec || IS_OPPOSE_ELEC() || attacker_ptr->immune_elec) && (mult < 25))
+                                       if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || attacker_ptr->immune_elec) && (mult < 25))
                                                mult = 25;
-                                       if (!(attacker_ptr->resist_fire || IS_OPPOSE_FIRE() || attacker_ptr->immune_fire) && (mult < 25))
+                                       if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || attacker_ptr->immune_fire) && (mult < 25))
                                                mult = 25;
-                                       if (!(attacker_ptr->resist_cold || IS_OPPOSE_COLD() || attacker_ptr->immune_cold) && (mult < 25))
+                                       if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || attacker_ptr->immune_cold) && (mult < 25))
                                                mult = 25;
-                                       if (!(attacker_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
+                                       if (!(attacker_ptr->resist_pois || is_oppose_pois(attacker_ptr)) && (mult < 25))
                                                mult = 25;
 
                                        if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (attacker_ptr->csp >(attacker_ptr->msp / 30)))
@@ -2816,7 +2816,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                                        if (explode) break;
 
                                        /* Take "poison" effect */
-                                       if (!(target_ptr->resist_pois || IS_OPPOSE_POIS()) && !CHECK_MULTISHADOW(target_ptr))
+                                       if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)) && !CHECK_MULTISHADOW(target_ptr))
                                        {
                                                if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
                                                {
@@ -3448,7 +3448,7 @@ bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
                                        if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
 
                                        /* Take "poison" effect */
-                                       if (!(target_ptr->resist_pois || IS_OPPOSE_POIS()))
+                                       if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)))
                                        {
                                                if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
                                                {
index 522cdff..62cb56d 100644 (file)
@@ -1451,7 +1451,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                {
                        if(PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
                        if(creature_ptr->resist_fire) damage = damage / 3;
-                       if(IS_OPPOSE_FIRE()) damage = damage / 3;
+                       if(is_oppose_fire(creature_ptr)) damage = damage / 3;
                        if(creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1489,7 +1489,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_cold) damage = damage / 3;
-                       if (IS_OPPOSE_COLD()) damage = damage / 3;
+                       if (is_oppose_cold(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1527,7 +1527,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_elec) damage = damage / 3;
-                       if (IS_OPPOSE_ELEC()) damage = damage / 3;
+                       if (is_oppose_elec(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1565,7 +1565,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_acid) damage = damage / 3;
-                       if (IS_OPPOSE_ACID()) damage = damage / 3;
+                       if (is_oppose_acid(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1603,7 +1603,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                if (damage)
                {
                        if (creature_ptr->resist_pois) damage = damage / 3;
-                       if (IS_OPPOSE_POIS()) damage = damage / 3;
+                       if (is_oppose_pois(creature_ptr)) damage = damage / 3;
                        if (creature_ptr->levitation) damage = damage / 5;
 
                        damage = damage / 100 + (randint0(100) < (damage % 100));
@@ -1646,7 +1646,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (PRACE_IS_(creature_ptr, RACE_ENT)) damage += damage / 3;
                        if (creature_ptr->resist_fire) damage = damage / 3;
-                       if (IS_OPPOSE_FIRE()) damage = damage / 3;
+                       if (is_oppose_fire(creature_ptr)) damage = damage / 3;
                        msg_print(_("熱い!", "It's hot!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("炎のオーラ", "Fire aura"), -1);
                }
@@ -1655,7 +1655,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (PRACE_IS_(creature_ptr, RACE_ANDROID)) damage += damage / 3;
                        if (creature_ptr->resist_elec) damage = damage / 3;
-                       if (IS_OPPOSE_ELEC()) damage = damage / 3;
+                       if (is_oppose_elec(creature_ptr)) damage = damage / 3;
                        msg_print(_("痛い!", "It hurts!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
                }
@@ -1663,7 +1663,7 @@ static void process_world_aux_hp_and_sp(player_type *creature_ptr)
                {
                        damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2;
                        if (creature_ptr->resist_cold) damage = damage / 3;
-                       if (IS_OPPOSE_COLD()) damage = damage / 3;
+                       if (is_oppose_cold(creature_ptr)) damage = damage / 3;
                        msg_print(_("冷たい!", "It's cold!"));
                        take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("冷気のオーラ", "Cold aura"), -1);
                }
index 8ed610c..7562d68 100644 (file)
@@ -2728,15 +2728,15 @@ static void tim_player_flags(player_type *creature_ptr, BIT_FLAGS flgs[TR_FLAG_S
        if (IS_FAST(creature_ptr) || creature_ptr->slow)
                add_flag(flgs, TR_SPEED);
 
-       if (IS_OPPOSE_ACID() && !(creature_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(creature_ptr, RACE_YEEK) && (creature_ptr->lev > 19)))
+       if (is_oppose_acid(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ACID) && !(PRACE_IS_(creature_ptr, RACE_YEEK) && (creature_ptr->lev > 19)))
                add_flag(flgs, TR_RES_ACID);
-       if (IS_OPPOSE_ELEC() && !(creature_ptr->special_defense & DEFENSE_ELEC))
+       if (is_oppose_elec(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ELEC))
                add_flag(flgs, TR_RES_ELEC);
-       if (IS_OPPOSE_FIRE() && !(creature_ptr->special_defense & DEFENSE_FIRE))
+       if (is_oppose_fire(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_FIRE))
                add_flag(flgs, TR_RES_FIRE);
-       if (IS_OPPOSE_COLD() && !(creature_ptr->special_defense & DEFENSE_COLD))
+       if (is_oppose_cold(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_COLD))
                add_flag(flgs, TR_RES_COLD);
-       if (IS_OPPOSE_POIS())
+       if (is_oppose_pois(creature_ptr))
                add_flag(flgs, TR_RES_POIS);
 
        if (creature_ptr->special_attack & ATTACK_ACID)
index 403d884..92fc6bc 100644 (file)
@@ -3919,31 +3919,31 @@ void update_smart_learn(MONSTER_IDX m_idx, int what)
        {
        case DRS_ACID:
                if (p_ptr->resist_acid) m_ptr->smart |= (SM_RES_ACID);
-               if (IS_OPPOSE_ACID()) m_ptr->smart |= (SM_OPP_ACID);
+               if (is_oppose_acid(p_ptr)) m_ptr->smart |= (SM_OPP_ACID);
                if (p_ptr->immune_acid) m_ptr->smart |= (SM_IMM_ACID);
                break;
 
        case DRS_ELEC:
                if (p_ptr->resist_elec) m_ptr->smart |= (SM_RES_ELEC);
-               if (IS_OPPOSE_ELEC()) m_ptr->smart |= (SM_OPP_ELEC);
+               if (is_oppose_elec(p_ptr)) m_ptr->smart |= (SM_OPP_ELEC);
                if (p_ptr->immune_elec) m_ptr->smart |= (SM_IMM_ELEC);
                break;
 
        case DRS_FIRE:
                if (p_ptr->resist_fire) m_ptr->smart |= (SM_RES_FIRE);
-               if (IS_OPPOSE_FIRE()) m_ptr->smart |= (SM_OPP_FIRE);
+               if (is_oppose_fire(p_ptr)) m_ptr->smart |= (SM_OPP_FIRE);
                if (p_ptr->immune_fire) m_ptr->smart |= (SM_IMM_FIRE);
                break;
 
        case DRS_COLD:
                if (p_ptr->resist_cold) m_ptr->smart |= (SM_RES_COLD);
-               if (IS_OPPOSE_COLD()) m_ptr->smart |= (SM_OPP_COLD);
+               if (is_oppose_cold(p_ptr)) m_ptr->smart |= (SM_OPP_COLD);
                if (p_ptr->immune_cold) m_ptr->smart |= (SM_IMM_COLD);
                break;
 
        case DRS_POIS:
                if (p_ptr->resist_pois) m_ptr->smart |= (SM_RES_POIS);
-               if (IS_OPPOSE_POIS()) m_ptr->smart |= (SM_OPP_POIS);
+               if (is_oppose_pois(p_ptr)) m_ptr->smart |= (SM_OPP_POIS);
                break;
 
 
index de366e8..aecb49a 100644 (file)
@@ -123,23 +123,21 @@ static void remove_bad_spells(MONSTER_IDX m_idx, player_type *target_ptr, u32b *
        /* Cheat if requested */
        if (smart_cheat)
        {
-               /* Know basic info */
+               /* Know element info */
                if (target_ptr->resist_acid) smart |= (SM_RES_ACID);
-               if (IS_OPPOSE_ACID()) smart |= (SM_OPP_ACID);
+               if (is_oppose_acid(target_ptr)) smart |= (SM_OPP_ACID);
                if (target_ptr->immune_acid) smart |= (SM_IMM_ACID);
                if (target_ptr->resist_elec) smart |= (SM_RES_ELEC);
-               if (IS_OPPOSE_ELEC()) smart |= (SM_OPP_ELEC);
+               if (is_oppose_elec(target_ptr)) smart |= (SM_OPP_ELEC);
                if (target_ptr->immune_elec) smart |= (SM_IMM_ELEC);
                if (target_ptr->resist_fire) smart |= (SM_RES_FIRE);
-               if (IS_OPPOSE_FIRE()) smart |= (SM_OPP_FIRE);
+               if (is_oppose_fire(target_ptr)) smart |= (SM_OPP_FIRE);
                if (target_ptr->immune_fire) smart |= (SM_IMM_FIRE);
                if (target_ptr->resist_cold) smart |= (SM_RES_COLD);
-               if (IS_OPPOSE_COLD()) smart |= (SM_OPP_COLD);
+               if (is_oppose_cold(target_ptr)) smart |= (SM_OPP_COLD);
                if (target_ptr->immune_cold) smart |= (SM_IMM_COLD);
-
-               /* Know poison info */
                if (target_ptr->resist_pois) smart |= (SM_RES_POIS);
-               if (IS_OPPOSE_POIS()) smart |= (SM_OPP_POIS);
+               if (is_oppose_pois(target_ptr)) smart |= (SM_OPP_POIS);
 
                /* Know special resistances */
                if (target_ptr->resist_neth) smart |= (SM_RES_NETH);
index ef0fc8a..b61079d 100644 (file)
@@ -190,7 +190,7 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
 {
        HIT_POINT get_damage;
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
-       bool double_resist = IS_OPPOSE_ACID();
+       bool double_resist = is_oppose_acid(creature_ptr);
 
        /* Total Immunity */
        if (creature_ptr->immune_acid || (dam <= 0))
@@ -240,7 +240,7 @@ HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
 {
        HIT_POINT get_damage;
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
-       bool double_resist = IS_OPPOSE_ELEC();
+       bool double_resist = is_oppose_elec(creature_ptr);
 
        /* Total immunity */
        if (creature_ptr->immune_elec || (dam <= 0))
@@ -289,7 +289,7 @@ HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
 {
        HIT_POINT get_damage;
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
-       bool double_resist = IS_OPPOSE_FIRE();
+       bool double_resist = is_oppose_fire(creature_ptr);
 
        /* Totally immune */
        if (creature_ptr->immune_fire || (dam <= 0))
@@ -338,7 +338,7 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
 {
        HIT_POINT get_damage;
        int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
-       bool double_resist = IS_OPPOSE_COLD();
+       bool double_resist = is_oppose_cold(creature_ptr);
 
        /* Total immunity */
        if (creature_ptr->immune_cold || (dam <= 0))
index 501c2a3..7a3e42b 100644 (file)
@@ -2366,7 +2366,7 @@ bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->oppose_acid > v) return FALSE;
                }
-               else if (!IS_OPPOSE_ACID())
+               else if (!is_oppose_acid(creature_ptr))
                {
                        msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
                        notice = TRUE;
@@ -2413,7 +2413,7 @@ bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->oppose_elec > v) return FALSE;
                }
-               else if (!IS_OPPOSE_ELEC())
+               else if (!is_oppose_elec(creature_ptr))
                {
                        msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
                        notice = TRUE;
@@ -2461,7 +2461,7 @@ bool set_oppose_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->oppose_fire > v) return FALSE;
                }
-               else if (!IS_OPPOSE_FIRE())
+               else if (!is_oppose_fire(creature_ptr))
                {
                        msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
                        notice = TRUE;
@@ -2508,7 +2508,7 @@ bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->oppose_cold > v) return FALSE;
                }
-               else if (!IS_OPPOSE_COLD())
+               else if (!is_oppose_cold(creature_ptr))
                {
                        msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
                        notice = TRUE;
@@ -2556,7 +2556,7 @@ bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
                {
                        if (creature_ptr->oppose_pois > v) return FALSE;
                }
-               else if (!IS_OPPOSE_POIS())
+               else if (!is_oppose_pois(creature_ptr))
                {
                        msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
                        notice = TRUE;
index be22fc1..ca51932 100644 (file)
@@ -5930,3 +5930,38 @@ bool is_blessed(player_type *creature_ptr)
 {
        return creature_ptr->blessed || music_singing(creature_ptr, MUSIC_BLESS) || hex_spelling(HEX_BLESS);
 }
+
+bool is_oppose_acid(player_type *creature_ptr)
+{
+       return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+bool is_oppose_elec(player_type *creature_ptr)
+{
+       return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+bool is_oppose_fire(player_type *creature_ptr)
+{
+       return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+bool is_oppose_cold(player_type *creature_ptr)
+{
+       return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+bool is_oppose_pois(player_type *creature_ptr)
+{
+       return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
+}
+
+bool is_tim_esp(player_type *creature_ptr)
+{
+       return creature_ptr->tim_esp || music_singing(creature_ptr, MUSIC_MIND) || (creature_ptr->concent >= CONCENT_TELE_THRESHOLD);
+}
+
+bool is_tim_stealth(player_type *creature_ptr)
+{
+       return creature_ptr->tim_stealth || music_singing(creature_ptr, MUSIC_STEALTH);
+}
index 7d1aba9..e0d8ff6 100644 (file)
@@ -802,17 +802,17 @@ extern const s32b player_exp_a[PY_MAX_LEVEL];
 #define IS_FAST(C) (C->fast || music_singing(C, MUSIC_SPEED) || music_singing(C, MUSIC_SHERO))
 #define IS_INVULN(C) (C->invuln || music_singing(C, MUSIC_INVULN))
 #define IS_HERO(C) (C->hero || music_singing(C, MUSIC_HERO) || music_singing(C, MUSIC_SHERO))
-#define IS_OPPOSE_ACID() (p_ptr->oppose_acid || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
-#define IS_OPPOSE_ELEC() (p_ptr->oppose_elec || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
-#define IS_OPPOSE_FIRE() (p_ptr->oppose_fire || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
-#define IS_OPPOSE_COLD() (p_ptr->oppose_cold || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
-#define IS_OPPOSE_POIS() (p_ptr->oppose_pois || music_singing(p_ptr, MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))
 #define IS_TIM_ESP() (p_ptr->tim_esp || music_singing(p_ptr, MUSIC_MIND) || (p_ptr->concent >= CONCENT_TELE_THRESHOLD))
 #define IS_TIM_STEALTH() (p_ptr->tim_stealth || music_singing(p_ptr, MUSIC_STEALTH))
 
 #define P_PTR_KI (p_ptr->magic_num1[0])
 
 extern bool is_blessed(player_type *player_ptr);
+extern bool is_oppose_acid(player_type *player_ptr);
+extern bool is_oppose_elec(player_type *player_ptr);
+extern bool is_oppose_fire(player_type *player_ptr);
+extern bool is_oppose_cold(player_type *player_ptr);
+extern bool is_oppose_pois(player_type *player_ptr);
 
 /*
  * Player "food" crucial values
index fe3c0e2..91a3b1e 100644 (file)
@@ -1231,11 +1231,11 @@ void self_knowledge(player_type *creature_ptr)
        {
                info[i++] = _("あなたは酸に対する完全なる免疫を持っている。", "You are completely immune to acid.");
        }
-       else if (creature_ptr->resist_acid && IS_OPPOSE_ACID())
+       else if (creature_ptr->resist_acid && is_oppose_acid(creature_ptr))
        {
                info[i++] = _("あなたは酸への強力な耐性を持っている。", "You resist acid exceptionally well.");
        }
-       else if (creature_ptr->resist_acid || IS_OPPOSE_ACID())
+       else if (creature_ptr->resist_acid || is_oppose_acid(creature_ptr))
        {
                info[i++] = _("あなたは酸への耐性を持っている。", "You are resistant to acid.");
        }
@@ -1244,11 +1244,11 @@ void self_knowledge(player_type *creature_ptr)
        {
                info[i++] = _("あなたは電撃に対する完全なる免疫を持っている。", "You are completely immune to lightning.");
        }
-       else if (creature_ptr->resist_elec && IS_OPPOSE_ELEC())
+       else if (creature_ptr->resist_elec && is_oppose_elec(creature_ptr))
        {
                info[i++] = _("あなたは電撃への強力な耐性を持っている。", "You resist lightning exceptionally well.");
        }
-       else if (creature_ptr->resist_elec || IS_OPPOSE_ELEC())
+       else if (creature_ptr->resist_elec || is_oppose_elec(creature_ptr))
        {
                info[i++] = _("あなたは電撃への耐性を持っている。", "You are resistant to lightning.");
        }
@@ -1262,11 +1262,11 @@ void self_knowledge(player_type *creature_ptr)
        {
                info[i++] = _("あなたは火に対する完全なる免疫を持っている。", "You are completely immune to fire.");
        }
-       else if (creature_ptr->resist_fire && IS_OPPOSE_FIRE())
+       else if (creature_ptr->resist_fire && is_oppose_fire(creature_ptr))
        {
                info[i++] = _("あなたは火への強力な耐性を持っている。", "You resist fire exceptionally well.");
        }
-       else if (creature_ptr->resist_fire || IS_OPPOSE_FIRE())
+       else if (creature_ptr->resist_fire || is_oppose_fire(creature_ptr))
        {
                info[i++] = _("あなたは火への耐性を持っている。", "You are resistant to fire.");
        }
@@ -1280,20 +1280,20 @@ void self_knowledge(player_type *creature_ptr)
        {
                info[i++] = _("あなたは冷気に対する完全なる免疫を持っている。", "You are completely immune to cold.");
        }
-       else if (creature_ptr->resist_cold && IS_OPPOSE_COLD())
+       else if (creature_ptr->resist_cold && is_oppose_cold(creature_ptr))
        {
                info[i++] = _("あなたは冷気への強力な耐性を持っている。", "You resist cold exceptionally well.");
        }
-       else if (creature_ptr->resist_cold || IS_OPPOSE_COLD())
+       else if (creature_ptr->resist_cold || is_oppose_cold(creature_ptr))
        {
                info[i++] = _("あなたは冷気への耐性を持っている。", "You are resistant to cold.");
        }
 
-       if (creature_ptr->resist_pois && IS_OPPOSE_POIS())
+       if (creature_ptr->resist_pois && is_oppose_pois(creature_ptr))
        {
                info[i++] = _("あなたは毒への強力な耐性を持っている。", "You resist poison exceptionally well.");
        }
-       else if (creature_ptr->resist_pois || IS_OPPOSE_POIS())
+       else if (creature_ptr->resist_pois || is_oppose_pois(creature_ptr))
        {
                info[i++] = _("あなたは毒への耐性を持っている。", "You are resistant to poison.");
        }
index 0eae9d4..c70c601 100644 (file)
@@ -4155,7 +4155,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name
        /* Standard damage -- also poisons player */
        case GF_POIS:
        {
-               bool double_resist = IS_OPPOSE_POIS();
+               bool double_resist = is_oppose_pois(target_ptr);
                if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
 
                if (target_ptr->resist_pois) dam = (dam + 2) / 3;
@@ -4178,7 +4178,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name
        /* Standard damage -- also poisons / mutates player */
        case GF_NUKE:
        {
-               bool double_resist = IS_OPPOSE_POIS();
+               bool double_resist = is_oppose_pois(target_ptr);
                if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
 
                if (target_ptr->resist_pois) dam = (2 * dam + 2) / 5;
@@ -4262,7 +4262,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name
                        (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
                }
 
-               if (!(target_ptr->resist_fire || IS_OPPOSE_FIRE() || target_ptr->immune_fire))
+               if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || target_ptr->immune_fire))
                {
                        inventory_damage(target_ptr, set_acid_destroy, 3);
                }
@@ -4757,7 +4757,7 @@ static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name
                                (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
                        }
 
-                       if ((!(target_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
+                       if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
                        {
                                if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
                        }
index 22d73a7..d1b098f 100644 (file)
@@ -313,7 +313,7 @@ static void hit_trap_pit(player_type *trapped_ptr, int trap_feat_type)
                (void)set_cut(trapped_ptr,trapped_ptr->cut + randint1(dam));
 
                if (trap_feat_type == TRAP_POISON_PIT) {
-                       if (trapped_ptr->resist_pois || IS_OPPOSE_POIS())
+                       if (trapped_ptr->resist_pois || is_oppose_pois(trapped_ptr))
                        {
                                msg_print(_("しかし毒の影響はなかった!", "The poison does not affect you!"));
                        }
@@ -554,7 +554,7 @@ void hit_trap(player_type *trapped_ptr, bool break_trap)
        {
                hit_trap_set_abnormal_status_p(
                        _("刺激的な緑色のガスに包み込まれた!", "A pungent green gas surrounds you!"),
-                       trapped_ptr->resist_pois || IS_OPPOSE_POIS(),
+                       trapped_ptr->resist_pois || is_oppose_pois(trapped_ptr),
                        set_poisoned, trapped_ptr->poisoned + (TIME_EFFECT)randint0(20) + 10);
                break;
        }
index 8a77b1a..d7fbe26 100644 (file)
@@ -586,22 +586,22 @@ static void prt_status(player_type *creature_ptr)
 
        /* Oppose Acid */
        if (creature_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
-       if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
+       if (is_oppose_acid(creature_ptr)) ADD_FLG(BAR_RESACID);
 
        /* Oppose Lightning */
        if (creature_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
-       if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
+       if (is_oppose_elec (creature_ptr)) ADD_FLG(BAR_RESELEC);
 
        /* Oppose Fire */
        if (creature_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
-       if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
+       if (is_oppose_fire(creature_ptr)) ADD_FLG(BAR_RESFIRE);
 
        /* Oppose Cold */
        if (creature_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
-       if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
+       if (is_oppose_cold(creature_ptr)) ADD_FLG(BAR_RESCOLD);
 
        /* Oppose Poison */
-       if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
+       if (is_oppose_pois(creature_ptr)) ADD_FLG(BAR_RESPOIS);
 
        /* Word of Recall */
        if (creature_ptr->word_recall) ADD_FLG(BAR_RECALL);
index 0172753..5ef1965 100644 (file)
@@ -82,14 +82,14 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
                        if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
                        if (PRACE_IS_(target_ptr, RACE_ANDROID)) dam += dam / 3;
                        if (target_ptr->resist_elec) dam = (dam + 2) / 3;
-                       if (IS_OPPOSE_ELEC())
+                       if (is_oppose_elec(target_ptr))
                                dam = (dam + 2) / 3;
                }
                break;
 
        case GF_POIS:
                if (target_ptr->resist_pois) dam = (dam + 2) / 3;
-               if (IS_OPPOSE_POIS()) dam = (dam + 2) / 3;
+               if (is_oppose_pois(target_ptr)) dam = (dam + 2) / 3;
                break;
 
        case GF_ACID:
@@ -103,7 +103,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
                        if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
                        if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
                        if (target_ptr->resist_acid) dam = (dam + 2) / 3;
-                       if (IS_OPPOSE_ACID()) dam = (dam + 2) / 3;
+                       if (is_oppose_acid(target_ptr)) dam = (dam + 2) / 3;
                }
                break;
 
@@ -119,7 +119,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
                        if (target_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
                        if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
                        if (target_ptr->resist_cold) dam = (dam + 2) / 3;
-                       if (IS_OPPOSE_COLD()) dam = (dam + 2) / 3;
+                       if (is_oppose_cold(target_ptr)) dam = (dam + 2) / 3;
                }
                break;
 
@@ -135,7 +135,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
                        if (PRACE_IS_(target_ptr, RACE_ENT)) dam += dam / 3;
                        if (target_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
                        if (target_ptr->resist_fire) dam = (dam + 2) / 3;
-                       if (IS_OPPOSE_FIRE()) dam = (dam + 2) / 3;
+                       if (is_oppose_fire(target_ptr)) dam = (dam + 2) / 3;
                }
                break;
 
@@ -221,7 +221,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
 
        case GF_NUKE:
                if (target_ptr->resist_pois) dam = (2 * dam + 2) / 5;
-               if (IS_OPPOSE_POIS()) dam = (2 * dam + 2) / 5;
+               if (is_oppose_pois(target_ptr)) dam = (2 * dam + 2) / 5;
                break;
 
        case GF_DEATH_RAY: