1 #include "effect/effect-monster-evil.h"
2 #include "effect/effect-monster-util.h"
3 #include "monster-race/monster-race-hook.h"
4 #include "monster-race/monster-race.h"
5 #include "monster-race/race-flags-resistance.h"
6 #include "monster-race/race-flags1.h"
7 #include "monster-race/race-flags3.h"
8 #include "monster/monster-info.h"
9 #include "system/monster-race-definition.h"
10 #include "system/monster-type-definition.h"
11 #include "system/player-type-definition.h"
13 static bool effect_monster_away_resist(PlayerType *player_ptr, effect_monster_type *em_ptr)
15 if ((em_ptr->r_ptr->flagsr & RFR_RES_TELE) == 0) return false;
17 if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) || (em_ptr->r_ptr->flagsr & RFR_RES_ALL))
19 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flagsr |= RFR_RES_TELE;
20 em_ptr->note = _("には効果がなかった。", " is unaffected.");
24 if (em_ptr->r_ptr->level > randint1(100))
26 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flagsr |= RFR_RES_TELE;
27 em_ptr->note = _("には耐性がある!", " resists!");
35 process_result effect_monster_away_undead(PlayerType *player_ptr, effect_monster_type *em_ptr)
37 if ((em_ptr->r_ptr->flags3 & (RF3_UNDEAD)) == 0)
39 em_ptr->skipped = true;
41 return PROCESS_CONTINUE;
44 bool resists_tele = effect_monster_away_resist(player_ptr, em_ptr);
47 if (em_ptr->seen) em_ptr->obvious = true;
48 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr))
49 em_ptr->r_ptr->r_flags3 |= (RF3_UNDEAD);
51 em_ptr->do_dist = em_ptr->dam;
55 return PROCESS_CONTINUE;
59 process_result effect_monster_away_evil(PlayerType *player_ptr, effect_monster_type *em_ptr)
61 if ((em_ptr->r_ptr->flags3 & (RF3_EVIL)) == 0)
63 em_ptr->skipped = true;
65 return PROCESS_CONTINUE;
68 bool resists_tele = effect_monster_away_resist(player_ptr, em_ptr);
71 if (em_ptr->seen) em_ptr->obvious = true;
72 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr))
73 em_ptr->r_ptr->r_flags3 |= (RF3_EVIL);
75 em_ptr->do_dist = em_ptr->dam;
79 return PROCESS_CONTINUE;
83 process_result effect_monster_away_all(PlayerType *player_ptr, effect_monster_type *em_ptr)
85 bool resists_tele = effect_monster_away_resist(player_ptr, em_ptr);
88 if (em_ptr->seen) em_ptr->obvious = true;
90 em_ptr->do_dist = em_ptr->dam;
94 return PROCESS_CONTINUE;
98 process_result effect_monster_turn_undead(PlayerType *player_ptr, effect_monster_type *em_ptr)
100 if ((em_ptr->r_ptr->flags3 & (RF3_UNDEAD)) == 0)
102 em_ptr->skipped = true;
104 return PROCESS_CONTINUE;
107 if (em_ptr->seen) em_ptr->obvious = true;
109 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_UNDEAD);
111 em_ptr->do_fear = damroll(3, (em_ptr->dam / 2)) + 1;
112 if (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10)
114 em_ptr->note = _("には効果がなかった。", " is unaffected.");
115 em_ptr->obvious = false;
120 return PROCESS_CONTINUE;
124 process_result effect_monster_turn_evil(PlayerType *player_ptr, effect_monster_type *em_ptr)
126 if ((em_ptr->r_ptr->flags3 & (RF3_EVIL)) == 0)
128 em_ptr->skipped = true;
130 return PROCESS_CONTINUE;
133 if (em_ptr->seen) em_ptr->obvious = true;
135 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_EVIL);
137 em_ptr->do_fear = damroll(3, (em_ptr->dam / 2)) + 1;
138 if (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10)
140 em_ptr->note = _("には効果がなかった。", " is unaffected.");
141 em_ptr->obvious = false;
146 return PROCESS_CONTINUE;
150 process_result effect_monster_turn_all(effect_monster_type *em_ptr)
152 if (em_ptr->seen) em_ptr->obvious = true;
154 em_ptr->do_fear = damroll(3, (em_ptr->dam / 2)) + 1;
155 if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
156 (em_ptr->r_ptr->flags3 & (RF3_NO_FEAR)) ||
157 (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
159 em_ptr->note = _("には効果がなかった。", " is unaffected.");
160 em_ptr->obvious = false;
165 return PROCESS_CONTINUE;
169 process_result effect_monster_disp_undead(PlayerType *player_ptr, effect_monster_type *em_ptr)
171 if ((em_ptr->r_ptr->flags3 & (RF3_UNDEAD)) == 0)
173 em_ptr->skipped = true;
175 return PROCESS_CONTINUE;
178 if (em_ptr->seen) em_ptr->obvious = true;
180 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr))
181 em_ptr->r_ptr->r_flags3 |= (RF3_UNDEAD);
183 em_ptr->note = _("は身震いした。", " shudders.");
184 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
185 return PROCESS_CONTINUE;
189 process_result effect_monster_disp_evil(PlayerType *player_ptr, effect_monster_type *em_ptr)
191 if ((em_ptr->r_ptr->flags3 & (RF3_EVIL)) == 0)
193 em_ptr->skipped = true;
195 return PROCESS_CONTINUE;
198 if (em_ptr->seen) em_ptr->obvious = true;
200 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_EVIL);
202 em_ptr->note = _("は身震いした。", " shudders.");
203 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
204 return PROCESS_CONTINUE;
208 process_result effect_monster_disp_good(PlayerType *player_ptr, effect_monster_type *em_ptr)
210 if ((em_ptr->r_ptr->flags3 & (RF3_GOOD)) == 0)
212 em_ptr->skipped = true;
214 return PROCESS_CONTINUE;
217 if (em_ptr->seen) em_ptr->obvious = true;
219 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_GOOD);
221 em_ptr->note = _("は身震いした。", " shudders.");
222 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
223 return PROCESS_CONTINUE;
227 process_result effect_monster_disp_living(effect_monster_type *em_ptr)
229 if (!monster_living(em_ptr->m_ptr->r_idx))
231 em_ptr->skipped = true;
233 return PROCESS_CONTINUE;
236 if (em_ptr->seen) em_ptr->obvious = true;
238 em_ptr->note = _("は身震いした。", " shudders.");
239 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
240 return PROCESS_CONTINUE;
244 process_result effect_monster_disp_demon(PlayerType *player_ptr, effect_monster_type *em_ptr)
246 if ((em_ptr->r_ptr->flags3 & (RF3_DEMON)) == 0)
248 em_ptr->skipped = true;
250 return PROCESS_CONTINUE;
253 if (em_ptr->seen) em_ptr->obvious = true;
255 if (is_original_ap_and_seen(player_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_DEMON);
257 em_ptr->note = _("は身震いした。", " shudders.");
258 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
259 return PROCESS_CONTINUE;
263 process_result effect_monster_disp_all(effect_monster_type *em_ptr)
265 if (em_ptr->seen) em_ptr->obvious = true;
267 em_ptr->note = _("は身震いした。", " shudders.");
268 em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
269 return PROCESS_CONTINUE;