1 #include "status/element-resistance.h"
2 #include "core/disturbance.h"
3 #include "core/player-redraw-types.h"
4 #include "core/stuff-handler.h"
5 #include "game-option/disturbance-options.h"
6 #include "player/player-race.h"
7 #include "player/special-defense-types.h"
8 #include "realm/realm-song-numbers.h"
9 #include "spell-realm/spells-song.h"
10 #include "system/player-type-definition.h"
11 #include "view/display-messages.h"
14 * @brief 一時的酸耐性の継続時間をセットする / Set "oppose_acid", notice observable changes
16 * @param do_dec 現在の継続時間より長い値のみ上書きする
17 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
19 bool set_oppose_acid(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
22 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
23 if (creature_ptr->is_dead)
27 if (creature_ptr->oppose_acid && !do_dec) {
28 if (creature_ptr->oppose_acid > v)
30 } else if (!is_oppose_acid(creature_ptr)) {
31 msg_print(_("酸への耐性がついた気がする!", "You feel resistant to acid!"));
35 if (creature_ptr->oppose_acid && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
36 msg_print(_("酸への耐性が薄れた気がする。", "You feel less resistant to acid."));
41 creature_ptr->oppose_acid = v;
45 creature_ptr->redraw |= (PR_STATUS);
48 disturb(creature_ptr, FALSE, FALSE);
49 handle_stuff(creature_ptr);
54 * @brief 一時的電撃耐性の継続時間をセットする / Set "oppose_elec", notice observable changes
56 * @param do_dec 現在の継続時間より長い値のみ上書きする
57 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
59 bool set_oppose_elec(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
62 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
64 if (creature_ptr->is_dead)
68 if (creature_ptr->oppose_elec && !do_dec) {
69 if (creature_ptr->oppose_elec > v)
71 } else if (!is_oppose_elec(creature_ptr)) {
72 msg_print(_("電撃への耐性がついた気がする!", "You feel resistant to electricity!"));
76 if (creature_ptr->oppose_elec && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
77 msg_print(_("電撃への耐性が薄れた気がする。", "You feel less resistant to electricity."));
82 creature_ptr->oppose_elec = v;
86 creature_ptr->redraw |= (PR_STATUS);
89 disturb(creature_ptr, FALSE, FALSE);
90 handle_stuff(creature_ptr);
95 * @brief 一時的火炎耐性の継続時間をセットする / Set "oppose_fire", notice observable changes
97 * @param do_dec 現在の継続時間より長い値のみ上書きする
98 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
100 bool set_oppose_fire(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
103 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
104 if (creature_ptr->is_dead)
107 if ((is_specific_player_race(creature_ptr, RACE_BALROG) && (creature_ptr->lev > 44)) || (creature_ptr->mimic_form == MIMIC_DEMON))
110 if (creature_ptr->oppose_fire && !do_dec) {
111 if (creature_ptr->oppose_fire > v)
113 } else if (!is_oppose_fire(creature_ptr)) {
114 msg_print(_("火への耐性がついた気がする!", "You feel resistant to fire!"));
118 if (creature_ptr->oppose_fire && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
119 msg_print(_("火への耐性が薄れた気がする。", "You feel less resistant to fire."));
124 creature_ptr->oppose_fire = v;
128 creature_ptr->redraw |= (PR_STATUS);
131 disturb(creature_ptr, FALSE, FALSE);
132 handle_stuff(creature_ptr);
137 * @brief 一時的冷気耐性の継続時間をセットする / Set "oppose_cold", notice observable changes
139 * @param do_dec 現在の継続時間より長い値のみ上書きする
140 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
142 bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
145 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
146 if (creature_ptr->is_dead)
150 if (creature_ptr->oppose_cold && !do_dec) {
151 if (creature_ptr->oppose_cold > v)
153 } else if (!is_oppose_cold(creature_ptr)) {
154 msg_print(_("冷気への耐性がついた気がする!", "You feel resistant to cold!"));
158 if (creature_ptr->oppose_cold && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
159 msg_print(_("冷気への耐性が薄れた気がする。", "You feel less resistant to cold."));
164 creature_ptr->oppose_cold = v;
168 creature_ptr->redraw |= (PR_STATUS);
171 disturb(creature_ptr, FALSE, FALSE);
172 handle_stuff(creature_ptr);
177 * @brief 一時的毒耐性の継続時間をセットする / Set "oppose_pois", notice observable changes
179 * @param do_dec 現在の継続時間より長い値のみ上書きする
180 * @return ステータスに影響を及ぼす変化があった場合TRUEを返す。
182 bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec)
185 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
186 if ((creature_ptr->pclass == CLASS_NINJA) && (creature_ptr->lev > 44))
188 if (creature_ptr->is_dead)
192 if (creature_ptr->oppose_pois && !do_dec) {
193 if (creature_ptr->oppose_pois > v)
195 } else if (!is_oppose_pois(creature_ptr)) {
196 msg_print(_("毒への耐性がついた気がする!", "You feel resistant to poison!"));
200 if (creature_ptr->oppose_pois && !music_singing(creature_ptr, MUSIC_RESIST) && !(creature_ptr->special_defense & KATA_MUSOU)) {
201 msg_print(_("毒への耐性が薄れた気がする。", "You feel less resistant to poison."));
206 creature_ptr->oppose_pois = v;
209 creature_ptr->redraw |= (PR_STATUS);
212 disturb(creature_ptr, FALSE, FALSE);
213 handle_stuff(creature_ptr);
217 bool is_oppose_acid(player_type *creature_ptr)
219 return creature_ptr->oppose_acid || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
222 bool is_oppose_elec(player_type *creature_ptr)
224 return creature_ptr->oppose_elec || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
227 bool is_oppose_fire(player_type *creature_ptr)
229 return creature_ptr->oppose_fire || music_singing(creature_ptr, MUSIC_RESIST)
230 || (creature_ptr->special_defense & KATA_MUSOU || (creature_ptr->mimic_form == MIMIC_DEMON)
231 || (is_specific_player_race(creature_ptr, RACE_BALROG) && creature_ptr->lev > 44));
234 bool is_oppose_cold(player_type *creature_ptr)
236 return creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST) || (creature_ptr->special_defense & KATA_MUSOU);
239 bool is_oppose_pois(player_type *creature_ptr)
241 return creature_ptr->oppose_pois || music_singing(creature_ptr, MUSIC_RESIST)
242 || (creature_ptr->special_defense & KATA_MUSOU || (creature_ptr->pclass == CLASS_NINJA && creature_ptr->lev > 44));