1 #include "temporary-resistances.h"
2 #include "object-enchant/tr-types.h"
3 #include "player/attack-defense-types.h"
4 #include "player/player-race-types.h"
5 #include "player/player-race.h"
6 #include "player/special-defense-types.h"
7 #include "realm/realm-hex-numbers.h"
8 #include "realm/realm-song-numbers.h"
9 #include "realm/realm-types.h"
10 #include "spell-realm/spells-hex.h"
11 #include "status/element-resistance.h"
12 #include "system/object-type-definition.h"
13 #include "util/bit-flags-calculator.h"
16 * @brief プレイヤーの一時的魔法効果による耐性を返す
17 * Prints ratings on certain abilities
18 * @param creature_ptr プレーヤーへの参照ポインタ
19 * @param flags フラグを保管する配列
22 * xtra1.c周りと多重実装になっているのを何とかする
24 void tim_player_flags(player_type *creature_ptr, BIT_FLAGS *flags)
26 for (int i = 0; i < TR_FLAG_SIZE; i++)
29 if (is_hero(creature_ptr) || creature_ptr->shero)
30 add_flag(flags, TR_RES_FEAR);
31 if (creature_ptr->tim_invis)
32 add_flag(flags, TR_SEE_INVIS);
33 if (creature_ptr->tim_regen)
34 add_flag(flags, TR_REGEN);
35 if (is_time_limit_esp(creature_ptr))
36 add_flag(flags, TR_TELEPATHY);
37 if (is_fast(creature_ptr) || creature_ptr->slow)
38 add_flag(flags, TR_SPEED);
40 if (is_oppose_acid(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ACID)
41 && !(is_specific_player_race(creature_ptr, RACE_YEEK) && (creature_ptr->lev > 19)))
42 add_flag(flags, TR_RES_ACID);
43 if (is_oppose_elec(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_ELEC))
44 add_flag(flags, TR_RES_ELEC);
45 if (is_oppose_fire(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_FIRE))
46 add_flag(flags, TR_RES_FIRE);
47 if (is_oppose_cold(creature_ptr) && !(creature_ptr->special_defense & DEFENSE_COLD))
48 add_flag(flags, TR_RES_COLD);
49 if (is_oppose_pois(creature_ptr))
50 add_flag(flags, TR_RES_POIS);
52 if (creature_ptr->special_attack & ATTACK_ACID)
53 add_flag(flags, TR_BRAND_ACID);
54 if (creature_ptr->special_attack & ATTACK_ELEC)
55 add_flag(flags, TR_BRAND_ELEC);
56 if (creature_ptr->special_attack & ATTACK_FIRE)
57 add_flag(flags, TR_BRAND_FIRE);
58 if (creature_ptr->special_attack & ATTACK_COLD)
59 add_flag(flags, TR_BRAND_COLD);
60 if (creature_ptr->special_attack & ATTACK_POIS)
61 add_flag(flags, TR_BRAND_POIS);
62 if (creature_ptr->special_defense & DEFENSE_ACID)
63 add_flag(flags, TR_IM_ACID);
64 if (creature_ptr->special_defense & DEFENSE_ELEC)
65 add_flag(flags, TR_IM_ELEC);
66 if (creature_ptr->special_defense & DEFENSE_FIRE)
67 add_flag(flags, TR_IM_FIRE);
68 if (creature_ptr->special_defense & DEFENSE_COLD)
69 add_flag(flags, TR_IM_COLD);
70 if (creature_ptr->wraith_form)
71 add_flag(flags, TR_REFLECT);
72 if (creature_ptr->tim_reflect)
73 add_flag(flags, TR_REFLECT);
75 if (creature_ptr->magicdef) {
76 add_flag(flags, TR_RES_BLIND);
77 add_flag(flags, TR_RES_CONF);
78 add_flag(flags, TR_REFLECT);
79 add_flag(flags, TR_FREE_ACT);
80 add_flag(flags, TR_LEVITATION);
83 if (creature_ptr->tim_res_nether)
84 add_flag(flags, TR_RES_NETHER);
86 if (creature_ptr->tim_sh_fire)
87 add_flag(flags, TR_SH_FIRE);
89 if (creature_ptr->ult_res) {
90 add_flag(flags, TR_RES_FEAR);
91 add_flag(flags, TR_RES_LITE);
92 add_flag(flags, TR_RES_DARK);
93 add_flag(flags, TR_RES_BLIND);
94 add_flag(flags, TR_RES_CONF);
95 add_flag(flags, TR_RES_SOUND);
96 add_flag(flags, TR_RES_SHARDS);
97 add_flag(flags, TR_RES_NETHER);
98 add_flag(flags, TR_RES_NEXUS);
99 add_flag(flags, TR_RES_CHAOS);
100 add_flag(flags, TR_RES_DISEN);
101 add_flag(flags, TR_REFLECT);
102 add_flag(flags, TR_HOLD_EXP);
103 add_flag(flags, TR_FREE_ACT);
104 add_flag(flags, TR_SH_FIRE);
105 add_flag(flags, TR_SH_ELEC);
106 add_flag(flags, TR_SH_COLD);
107 add_flag(flags, TR_LEVITATION);
108 add_flag(flags, TR_LITE_1);
109 add_flag(flags, TR_SEE_INVIS);
110 add_flag(flags, TR_TELEPATHY);
111 add_flag(flags, TR_SLOW_DIGEST);
112 add_flag(flags, TR_REGEN);
113 add_flag(flags, TR_SUST_STR);
114 add_flag(flags, TR_SUST_INT);
115 add_flag(flags, TR_SUST_WIS);
116 add_flag(flags, TR_SUST_DEX);
117 add_flag(flags, TR_SUST_CON);
118 add_flag(flags, TR_SUST_CHR);
121 if (creature_ptr->realm1 != REALM_HEX)
124 if (hex_spelling(creature_ptr, HEX_DEMON_AURA)) {
125 add_flag(flags, TR_SH_FIRE);
126 add_flag(flags, TR_REGEN);
129 if (hex_spelling(creature_ptr, HEX_ICE_ARMOR))
130 add_flag(flags, TR_SH_COLD);
131 if (hex_spelling(creature_ptr, HEX_SHOCK_CLOAK))
132 add_flag(flags, TR_SH_ELEC);