OSDN Git Service

[Fix] #41188 影フェアリーの反感装備ペナが機能していない
authordis- <dis.rogue@gmail.com>
Tue, 19 Jan 2021 03:29:01 +0000 (12:29 +0900)
committerdis- <dis.rogue@gmail.com>
Tue, 19 Jan 2021 03:29:01 +0000 (12:29 +0900)
反感と影フェアリーのフラグ処理が散らばっていたので集約した。

src/effect/effect-monster-charm.c
src/mind/mind-ninja.c
src/monster/monster-processor.c
src/player-info/self-info.c
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index d995b42..7b013a5 100644 (file)
@@ -17,6 +17,7 @@
 #include "object-enchant/trc-types.h"
 #include "pet/pet-fall-off.h"
 #include "player-info/avatar.h"
+#include "player/player-status-flags.h"
 #include "status/bad-status-setter.h"
 #include "spell/spells-diceroll.h"
 #include "system/floor-type-definition.h"
@@ -30,7 +31,7 @@ static void effect_monster_charm_resist(player_type *caster_ptr, effect_monster_
 
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-    } else if (caster_ptr->cursed & TRC_AGGRAVATE) {
+    } else if (has_aggravate(caster_ptr)) {
         em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -84,7 +85,7 @@ process_result effect_monster_control_undead(player_type *caster_ptr, effect_mon
         em_ptr->obvious = FALSE;
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-    } else if (caster_ptr->cursed & TRC_AGGRAVATE) {
+    } else if (has_aggravate(caster_ptr)) {
         em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -117,7 +118,7 @@ process_result effect_monster_control_demon(player_type *caster_ptr, effect_mons
         em_ptr->obvious = FALSE;
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-    } else if (caster_ptr->cursed & TRC_AGGRAVATE) {
+    } else if (has_aggravate(caster_ptr)) {
         em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -150,7 +151,7 @@ process_result effect_monster_control_animal(player_type *caster_ptr, effect_mon
         em_ptr->obvious = FALSE;
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-    } else if (caster_ptr->cursed & TRC_AGGRAVATE) {
+    } else if (has_aggravate(caster_ptr)) {
         em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -188,7 +189,7 @@ process_result effect_monster_charm_living(player_type *caster_ptr, effect_monst
         em_ptr->obvious = FALSE;
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
-    } else if (caster_ptr->cursed & TRC_AGGRAVATE) {
+    } else if (has_aggravate(caster_ptr)) {
         em_ptr->note = _("はあなたに敵意を抱いている!", " hates you too much!");
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -305,7 +306,7 @@ static bool effect_monster_crusade_domination(player_type *caster_ptr, effect_mo
     }
 
     if ((em_ptr->r_ptr->flags1 & RF1_QUESTOR) || (em_ptr->r_ptr->flags1 & RF1_UNIQUE) || (em_ptr->m_ptr->mflag2 & MFLAG2_NOPET)
-        || (caster_ptr->cursed & TRC_AGGRAVATE) || ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam))) {
+        || has_aggravate(caster_ptr) || ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam))) {
         if (one_in_(4))
             em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
 
index 78e965b..8969b7b 100644 (file)
@@ -203,7 +203,7 @@ void process_surprise_attack(player_type *attacker_ptr, player_attack_type *pa_p
     int tmp = attacker_ptr->lev * 6 + (attacker_ptr->skill_stl + 10) * 4;
     if (attacker_ptr->monlite && (pa_ptr->mode != HISSATSU_NYUSIN))
         tmp /= 3;
-    if (attacker_ptr->cursed & TRC_AGGRAVATE)
+    if (has_aggravate(attacker_ptr))
         tmp /= 2;
     if (r_ptr->level > (attacker_ptr->lev * attacker_ptr->lev / 20 + 10))
         tmp /= 3;
index 1c786b7..6f83f35 100644 (file)
@@ -197,7 +197,7 @@ bool process_stealth(player_type *target_ptr, MONSTER_IDX m_idx)
     if (target_ptr->monlite)
         tmp /= 3;
 
-    if (target_ptr->cursed & TRC_AGGRAVATE)
+    if (has_aggravate(target_ptr))
         tmp /= 2;
 
     if (r_ptr->level > (target_ptr->lev * target_ptr->lev / 20 + 10))
@@ -273,7 +273,7 @@ bool awake_monster(player_type *target_ptr, MONSTER_IDX m_idx)
     if (!monster_csleep_remaining(m_ptr))
         return TRUE;
 
-    if ((target_ptr->cursed & TRC_AGGRAVATE) == 0)
+    if (has_aggravate(target_ptr))
         return FALSE;
 
     (void)set_monster_csleep(target_ptr, m_idx, 0);
@@ -301,7 +301,7 @@ void process_angar(player_type *target_ptr, MONSTER_IDX m_idx, bool see_m)
     monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
     monster_race *r_ptr = &r_info[m_ptr->r_idx];
     bool gets_angry = FALSE;
-    if (is_friendly(m_ptr) && (target_ptr->cursed & TRC_AGGRAVATE))
+    if (is_friendly(m_ptr) && has_aggravate(target_ptr))
         gets_angry = TRUE;
 
     if (is_pet(m_ptr)
@@ -588,7 +588,7 @@ bool decide_process_continue(player_type *target_ptr, monster_type *m_ptr)
     if (m_ptr->cdis <= (is_pet(m_ptr) ? (r_ptr->aaf > MAX_SIGHT ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
         return TRUE;
 
-    if ((m_ptr->cdis <= MAX_SIGHT || target_ptr->phase_out) && (player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx) || (target_ptr->cursed & TRC_AGGRAVATE)))
+    if ((m_ptr->cdis <= MAX_SIGHT || target_ptr->phase_out) && (player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx) || has_aggravate(target_ptr)))
         return TRUE;
 
     if (m_ptr->target_y)
index cfca593..2020d97 100644 (file)
@@ -23,6 +23,7 @@
 #include "player-info/self-info-util.h"
 #include "player-info/weapon-effect-info.h"
 #include "player/attack-defense-types.h"
+#include "player/player-status-flags.h"
 #include "term/screen-processor.h"
 #include "view/display-self-info.h"
 
@@ -55,7 +56,7 @@ static void set_curse_info(player_type *creature_ptr, self_info_type *self_ptr)
     if (creature_ptr->cursed & TRC_TY_CURSE)
         self_ptr->info[self_ptr->line++] = _("あなたは邪悪な怨念に包まれている。", "You carry an ancient foul curse.");
 
-    if (creature_ptr->cursed & TRC_AGGRAVATE)
+    if (has_aggravate(creature_ptr))
         self_ptr->info[self_ptr->line++] = _("あなたはモンスターを怒らせている。", "You aggravate monsters.");
 
     if (creature_ptr->cursed & TRC_DRAIN_EXP)
index da2164e..94aeabe 100644 (file)
@@ -947,10 +947,6 @@ void has_curses(player_type *creature_ptr)
 
     if (creature_ptr->cursed & TRC_TELEPORT)
         creature_ptr->cursed &= ~(TRC_TELEPORT_SELF);
-
-    if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
-        creature_ptr->cursed &= ~(TRC_AGGRAVATE);
-    }
 }
 
 BIT_FLAGS has_impact(player_type *creature_ptr)
@@ -1719,3 +1715,16 @@ bool has_not_monk_weapon(player_type *creature_ptr, int i)
 }
 
 bool has_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 & MUT3_GOOD_LUCK); }
+
+BIT_FLAGS has_aggravate(player_type *creature_ptr)
+{
+    if (creature_ptr->cursed & TRC_AGGRAVATE) {
+        if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY)) {
+            return AGGRAVATE_S_FAIRY;
+        }
+        return AGGRAVATE_NORMAL;
+    }
+    
+    return AGGRAVATE_NONE; 
+}
+
index d8b086f..6a7d394 100644 (file)
@@ -22,6 +22,12 @@ enum flag_cause {
     FLAG_CAUSE_MAX = 18
 };
 
+enum status_aggravate {
+    AGGRAVATE_NONE = 0x00000000L,
+    AGGRAVATE_NORMAL = 0x00000001L,
+    AGGRAVATE_S_FAIRY = 0x00000002L,
+};
+
 bool has_pass_wall(player_type *creature_ptr);
 bool has_kill_wall(player_type *creature_ptr);
 BIT_FLAGS has_xtra_might(player_type *creature_ptr);
@@ -112,3 +118,4 @@ bool has_not_monk_weapon(player_type *creature_ptr, int i);
 bool has_icky_wield_weapon(player_type *creature_ptr, int i);
 bool has_riding_wield_weapon(player_type *creature_ptr, int i);
 bool has_good_luck(player_type *creature_ptr);
+BIT_FLAGS has_aggravate(player_type *creature_ptr);
index 6882872..7425ceb 100644 (file)
@@ -1260,7 +1260,7 @@ static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr)
         if (hex_spelling_any(creature_ptr))
             pow -= (1 + casting_hex_num(creature_ptr));
     }
-    if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
+    if (has_aggravate(creature_ptr) == AGGRAVATE_S_FAIRY) {
         pow = MIN(pow - 3, (pow + 2) / 2);
     }