From fe7ebd92248d35d52920fb7d1dc8566396fe88a8 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 12 Jan 2020 18:05:11 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20IS=5FOPPOSE=5F*()=20?= =?utf8?q?=E3=81=AE=E9=96=A2=E6=95=B0=E3=83=9E=E3=82=AF=E3=83=AD=E3=82=92?= =?utf8?q?=E6=99=AE=E9=80=9A=E3=81=AE=E9=96=A2=E6=95=B0=E3=81=AB=E5=A4=89?= =?utf8?q?=E6=9B=B4=E3=81=97=E3=80=81player=5Ftype=20*=20=E5=BC=95?= =?utf8?q?=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0=20/=20Changed=20macro=20fun?= =?utf8?q?ction=20IS=5FOPPOSE=5F*()=20to=20normal=20function=20and=20added?= =?utf8?q?=20player=5Ftype=20*=20argument=20to=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/chest.c | 2 +- src/cmd/cmd-eat.c | 2 +- src/cmd/cmd-quaff.c | 2 +- src/cmd/cmd-read.c | 4 ++-- src/combat/melee1.c | 14 +++++++------- src/core.c | 16 ++++++++-------- src/files.c | 10 +++++----- src/monster2.c | 10 +++++----- src/mspells1.c | 14 ++++++-------- src/player-damage.c | 8 ++++---- src/player-effects.c | 10 +++++----- src/player-status.c | 35 +++++++++++++++++++++++++++++++++++ src/player-status.h | 10 +++++----- src/selfinfo.c | 20 ++++++++++---------- src/spells1.c | 8 ++++---- src/trap.c | 4 ++-- src/view-mainwindow.c | 10 +++++----- src/warning.c | 12 ++++++------ 18 files changed, 112 insertions(+), 79 deletions(-) diff --git a/src/chest.c b/src/chest.c index d3538e5d3..36f41c955 100644 --- a/src/chest.c +++ b/src/chest.c @@ -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)); } diff --git a/src/cmd/cmd-eat.c b/src/cmd/cmd-eat.c index 149cdb82a..351c90637 100644 --- a/src/cmd/cmd-eat.c +++ b/src/cmd/cmd-eat.c @@ -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)) { diff --git a/src/cmd/cmd-quaff.c b/src/cmd/cmd-quaff.c index f9888f918..a14849e41 100644 --- a/src/cmd/cmd-quaff.c +++ b/src/cmd/cmd-quaff.c @@ -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)) { diff --git a/src/cmd/cmd-read.c b/src/cmd/cmd-read.c index 4ec9bf9b3..a4c9ac313 100644 --- a/src/cmd/cmd-read.c +++ b/src/cmd/cmd-read.c @@ -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; diff --git a/src/combat/melee1.c b/src/combat/melee1.c index d51ff423d..fb5fb6dd4 100644 --- a/src/combat/melee1.c +++ b/src/combat/melee1.c @@ -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)) { diff --git a/src/core.c b/src/core.c index 522cdfff2..62cb56d78 100644 --- a/src/core.c +++ b/src/core.c @@ -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); } diff --git a/src/files.c b/src/files.c index 8ed610cac..7562d687e 100644 --- a/src/files.c +++ b/src/files.c @@ -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) diff --git a/src/monster2.c b/src/monster2.c index 403d884a0..92fc6bc9f 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -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; diff --git a/src/mspells1.c b/src/mspells1.c index de366e8b4..aecb49adc 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -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); diff --git a/src/player-damage.c b/src/player-damage.c index ef0fc8ac2..b61079d66 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -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)) diff --git a/src/player-effects.c b/src/player-effects.c index 501c2a371..7a3e42b65 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -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; diff --git a/src/player-status.c b/src/player-status.c index be22fc193..ca5193202 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -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); +} diff --git a/src/player-status.h b/src/player-status.h index 7d1aba959..e0d8ff65c 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -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 diff --git a/src/selfinfo.c b/src/selfinfo.c index fe3c0e207..91a3b1efa 100644 --- a/src/selfinfo.c +++ b/src/selfinfo.c @@ -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."); } diff --git a/src/spells1.c b/src/spells1.c index 0eae9d4fe..c70c601ac 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -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); } diff --git a/src/trap.c b/src/trap.c index 22d73a706..d1b098f39 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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; } diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 8a77b1a70..d7fbe268a 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -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); diff --git a/src/warning.c b/src/warning.c index 0172753ae..5ef19650d 100644 --- a/src/warning.c +++ b/src/warning.c @@ -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: -- 2.11.0