OSDN Git Service

[Refactor] #39963 Separated effect_monster_engetsu() from switch_effects_monster()
[hengband/hengband.git] / src / effect / effect-monster-switcher.c
1 /*!
2  * @brief 魔法種別による各種処理切り替え
3  * @date 2020/04/29
4  * @author Hourier
5  */
6
7 #include "angband.h"
8 #include "effect-monster-util.h"
9 #include "effect/effect-monster-switcher.h"
10 #include "player-damage.h"
11 #include "avatar.h"
12 #include "quest.h"
13 #include "monster-status.h"
14 #include "effect/spells-effect-util.h"
15 #include "player-effects.h"
16 #include "monsterrace-hook.h"
17 #include "combat/melee.h"
18 #include "cmd/cmd-pet.h" // 暫定、後で消すかも.
19 #include "spell/spells-type.h"
20 #include "effect/effect-monster-resist-hurt.h"
21 #include "effect/effect-monster-psi.h"
22 #include "effect/effect-monster-domination.h"
23 #include "effect/effect-monster-oldies.h"
24 #include "effect/effect-monster-charm.h"
25 #include "effect/effect-monster-lite-dark.h"
26 #include "effect/effect-monster-evil.h"
27 #include "effect/effect-monster-spirit.h"
28
29 gf_switch_result effect_monster_hypodynamia(player_type *caster_ptr, effect_monster_type *em_ptr)
30 {
31         if (em_ptr->seen) em_ptr->obvious = TRUE;
32         if (monster_living(em_ptr->m_ptr->r_idx))
33         {
34                 em_ptr->do_time = (em_ptr->dam + 7) / 8;
35                 return GF_SWITCH_CONTINUE;
36         }
37
38         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
39         {
40                 if (em_ptr->r_ptr->flags3 & RF3_DEMON) em_ptr->r_ptr->r_flags3 |= (RF3_DEMON);
41                 if (em_ptr->r_ptr->flags3 & RF3_UNDEAD) em_ptr->r_ptr->r_flags3 |= (RF3_UNDEAD);
42                 if (em_ptr->r_ptr->flags3 & RF3_NONLIVING) em_ptr->r_ptr->r_flags3 |= (RF3_NONLIVING);
43         }
44
45         em_ptr->note = _("には効果がなかった。", " is unaffected.");
46         em_ptr->obvious = FALSE;
47         em_ptr->dam = 0;
48         return GF_SWITCH_CONTINUE;
49 }
50
51
52 // todo リファクタリング前のコード時点で、単に耐性があるだけでもダメージ0だった.
53 gf_switch_result effect_monster_death_ray(player_type *caster_ptr, effect_monster_type *em_ptr)
54 {
55         if (em_ptr->seen) em_ptr->obvious = TRUE;
56
57         if (!monster_living(em_ptr->m_ptr->r_idx))
58         {
59                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
60                 {
61                         if (em_ptr->r_ptr->flags3 & RF3_DEMON) em_ptr->r_ptr->r_flags3 |= (RF3_DEMON);
62                         if (em_ptr->r_ptr->flags3 & RF3_UNDEAD) em_ptr->r_ptr->r_flags3 |= (RF3_UNDEAD);
63                         if (em_ptr->r_ptr->flags3 & RF3_NONLIVING) em_ptr->r_ptr->r_flags3 |= (RF3_NONLIVING);
64                 }
65
66                 em_ptr->note = _("には完全な耐性がある!", " is immune.");
67                 em_ptr->obvious = FALSE;
68                 em_ptr->dam = 0;
69                 return GF_SWITCH_CONTINUE;
70         }
71
72         if (((em_ptr->r_ptr->flags1 & RF1_UNIQUE) &&
73                 (randint1(888) != 666)) ||
74                 (((em_ptr->r_ptr->level + randint1(20)) > randint1((em_ptr->caster_lev / 2) + randint1(10))) &&
75                         randint1(100) != 66))
76         {
77                 em_ptr->note = _("には耐性がある!", " resists!");
78                 em_ptr->obvious = FALSE;
79                 em_ptr->dam = 0;
80         }
81
82         return GF_SWITCH_CONTINUE;
83 }
84
85
86 gf_switch_result effect_monster_stasis(effect_monster_type *em_ptr, bool to_evil)
87 {
88         if (em_ptr->seen) em_ptr->obvious = TRUE;
89
90         int stasis_damage = (em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10);
91         bool has_resistance = (em_ptr->r_ptr->flags1 & RF1_UNIQUE) != 0;
92         has_resistance |= em_ptr->r_ptr->level > randint1(stasis_damage) + 10;
93         if (to_evil) has_resistance |= (em_ptr->r_ptr->flags3 & RF3_EVIL) == 0;
94
95         if (has_resistance)
96         {
97                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
98                 em_ptr->obvious = FALSE;
99         }
100         else
101         {
102                 em_ptr->note = _("は動けなくなった!", " is suspended!");
103                 em_ptr->do_sleep = 500;
104         }
105
106         em_ptr->dam = 0;
107         return GF_SWITCH_CONTINUE;
108 }
109
110
111 gf_switch_result effect_monster_stun(effect_monster_type *em_ptr)
112 {
113         if (em_ptr->seen) em_ptr->obvious = TRUE;
114
115         em_ptr->do_stun = damroll((em_ptr->caster_lev / 20) + 3, (em_ptr->dam)) + 1;
116         if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
117                 (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
118         {
119                 em_ptr->do_stun = 0;
120                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
121                 em_ptr->obvious = FALSE;
122         }
123
124         em_ptr->dam = 0;
125         return GF_SWITCH_CONTINUE;
126 }
127
128
129 gf_switch_result effect_monster_kill_wall(player_type *caster_ptr, effect_monster_type *em_ptr)
130 {
131         if ((em_ptr->r_ptr->flags3 & (RF3_HURT_ROCK)) == 0)
132         {
133                 em_ptr->dam = 0;
134                 return GF_SWITCH_CONTINUE;
135         }
136
137         if (em_ptr->seen) em_ptr->obvious = TRUE;
138
139         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_HURT_ROCK);
140
141         em_ptr->note = _("の皮膚がただれた!", " loses some skin!");
142         em_ptr->note_dies = _("はドロドロに溶けた!", " dissolves!");
143         return GF_SWITCH_CONTINUE;
144 }
145
146
147 gf_switch_result effect_monster_curse_1(effect_monster_type *em_ptr)
148 {
149         if (em_ptr->seen) em_ptr->obvious = TRUE;
150         if (!em_ptr->who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), em_ptr->m_name);
151         if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35))
152         {
153                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
154                 em_ptr->dam = 0;
155         }
156
157         return GF_SWITCH_CONTINUE;
158 }
159
160
161 gf_switch_result effect_monster_curse_2(effect_monster_type *em_ptr)
162 {
163         if (em_ptr->seen) em_ptr->obvious = TRUE;
164         if (!em_ptr->who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), em_ptr->m_name);
165
166         if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35))
167         {
168                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
169                 em_ptr->dam = 0;
170         }
171
172         return GF_SWITCH_CONTINUE;
173 }
174
175
176 gf_switch_result effect_monster_curse_3(effect_monster_type *em_ptr)
177 {
178         if (em_ptr->seen) em_ptr->obvious = TRUE;
179         if (!em_ptr->who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), em_ptr->m_name);
180
181         if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35))
182         {
183                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
184                 em_ptr->dam = 0;
185         }
186
187         return GF_SWITCH_CONTINUE;
188 }
189
190
191 gf_switch_result effect_monster_curse_4(effect_monster_type *em_ptr)
192 {
193         if (em_ptr->seen) em_ptr->obvious = TRUE;
194         if (!em_ptr->who)
195                 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
196                         "You point at %s, screaming the word, 'DIE!'."), em_ptr->m_name);
197
198         if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && ((em_ptr->who <= 0) || (em_ptr->m_caster_ptr->r_idx != MON_KENSHIROU)))
199         {
200                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
201                 em_ptr->dam = 0;
202         }
203
204         return GF_SWITCH_CONTINUE;
205 }
206
207
208 gf_switch_result effect_monster_hand_doom(effect_monster_type *em_ptr)
209 {
210         if (em_ptr->seen) em_ptr->obvious = TRUE;
211
212         if (em_ptr->r_ptr->flags1 & RF1_UNIQUE)
213         {
214                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
215                 em_ptr->dam = 0;
216                 return GF_SWITCH_CONTINUE;
217         }
218
219         if ((em_ptr->who > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20))) :
220                 (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200))))
221         {
222                 em_ptr->dam = ((40 + randint1(20)) * em_ptr->m_ptr->hp) / 100;
223                 if (em_ptr->m_ptr->hp < em_ptr->dam)
224                         em_ptr->dam = em_ptr->m_ptr->hp - 1;
225         }
226         else
227         {
228                 em_ptr->note = _("は破滅の手に耐え切った!", "resists!");
229                 em_ptr->dam = 0;
230         }
231
232         return GF_SWITCH_CONTINUE;
233 }
234
235
236 static bool effect_monster_check_capturability(player_type *caster_ptr, effect_monster_type *em_ptr, int capturable_hp)
237 {
238         if (em_ptr->m_ptr->hp >= randint0(capturable_hp)) return FALSE;
239
240         if (em_ptr->m_ptr->mflag2 & MFLAG2_CHAMELEON)
241                 choose_new_monster(caster_ptr, em_ptr->g_ptr->m_idx, FALSE, MON_CHAMELEON);
242
243         msg_format(_("%sを捕えた!", "You capture %^s!"), em_ptr->m_name);
244         cap_mon = em_ptr->m_ptr->r_idx;
245         cap_mspeed = em_ptr->m_ptr->mspeed;
246         cap_hp = em_ptr->m_ptr->hp;
247         cap_maxhp = em_ptr->m_ptr->max_maxhp;
248         cap_nickname = em_ptr->m_ptr->nickname;
249         if ((em_ptr->g_ptr->m_idx == caster_ptr->riding) && rakuba(caster_ptr, -1, FALSE))
250                 msg_format(_("地面に落とされた。", "You have fallen from %s."), em_ptr->m_name);
251
252         delete_monster_idx(caster_ptr, em_ptr->g_ptr->m_idx);
253         return TRUE;
254 }
255
256
257 gf_switch_result effect_monster_capture(player_type *caster_ptr, effect_monster_type *em_ptr)
258 {
259         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
260         int capturable_hp;
261         if ((floor_ptr->inside_quest && (quest[floor_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(em_ptr->m_ptr)) ||
262                 (em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) || (em_ptr->r_ptr->flags7 & (RF7_NAZGUL)) || (em_ptr->r_ptr->flags7 & (RF7_UNIQUE2)) || (em_ptr->r_ptr->flags1 & RF1_QUESTOR) || em_ptr->m_ptr->parent_m_idx)
263         {
264                 msg_format(_("%sには効果がなかった。", "%s is unaffected."), em_ptr->m_name);
265                 em_ptr->skipped = TRUE;
266                 return GF_SWITCH_CONTINUE;
267         }
268
269         if (is_pet(em_ptr->m_ptr)) capturable_hp = em_ptr->m_ptr->maxhp * 4L;
270         else if ((caster_ptr->pclass == CLASS_BEASTMASTER) && monster_living(em_ptr->m_ptr->r_idx))
271                 capturable_hp = em_ptr->m_ptr->maxhp * 3 / 10;
272         else
273                 capturable_hp = em_ptr->m_ptr->maxhp * 3 / 20;
274
275         if (em_ptr->m_ptr->hp >= capturable_hp)
276         {
277                 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), em_ptr->m_name);
278                 em_ptr->skipped = TRUE;
279                 return GF_SWITCH_CONTINUE;
280         }
281         
282         if (effect_monster_check_capturability(caster_ptr, em_ptr, capturable_hp))
283                 return GF_SWITCH_TRUE;
284
285         msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), em_ptr->m_name);
286         em_ptr->skipped = TRUE;
287         return GF_SWITCH_CONTINUE;
288 }
289
290
291 gf_switch_result effect_monster_engetsu(player_type *caster_ptr, effect_monster_type *em_ptr)
292 {
293         int effect = 0;
294         bool done = TRUE;
295
296         if (em_ptr->seen) em_ptr->obvious = TRUE;
297         if (em_ptr->r_ptr->flags2 & RF2_EMPTY_MIND)
298         {
299                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
300                 em_ptr->dam = 0;
301                 em_ptr->skipped = TRUE;
302                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
303                 return GF_SWITCH_CONTINUE;
304         }
305
306         if (MON_CSLEEP(em_ptr->m_ptr))
307         {
308                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
309                 em_ptr->dam = 0;
310                 em_ptr->skipped = TRUE;
311                 return GF_SWITCH_CONTINUE;
312         }
313
314         if (one_in_(5)) effect = 1;
315         else if (one_in_(4)) effect = 2;
316         else if (one_in_(3)) effect = 3;
317         else done = FALSE;
318
319         if (effect == 1)
320         {
321                 if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) ||
322                         (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
323                 {
324                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
325                         em_ptr->obvious = FALSE;
326                 }
327                 else
328                 {
329                         if (set_monster_slow(caster_ptr, em_ptr->g_ptr->m_idx, MON_SLOW(em_ptr->m_ptr) + 50))
330                         {
331                                 em_ptr->note = _("の動きが遅くなった。", " starts moving slower.");
332                         }
333                 }
334         }
335         else if (effect == 2)
336         {
337                 em_ptr->do_stun = damroll((caster_ptr->lev / 10) + 3, (em_ptr->dam)) + 1;
338                 if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
339                         (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
340                 {
341                         em_ptr->do_stun = 0;
342                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
343                         em_ptr->obvious = FALSE;
344                 }
345         }
346         else if (effect == 3)
347         {
348                 if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) ||
349                         (em_ptr->r_ptr->flags3 & RF3_NO_SLEEP) ||
350                         (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
351                 {
352                         if (em_ptr->r_ptr->flags3 & RF3_NO_SLEEP)
353                         {
354                                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_NO_SLEEP);
355                         }
356
357                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
358                         em_ptr->obvious = FALSE;
359                 }
360                 else
361                 {
362                         /* Go to sleep (much) later */
363                         em_ptr->note = _("は眠り込んでしまった!", " falls asleep!");
364                         em_ptr->do_sleep = 500;
365                 }
366         }
367
368         if (!done)
369         {
370                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
371         }
372
373         em_ptr->dam = 0;
374         return GF_SWITCH_CONTINUE;
375 }
376
377
378 /*!
379  * @brief 魔法の効果によって様々なメッセーを出力したり与えるダメージの増減を行ったりする
380  * @param em_ptr モンスター効果構造体への参照ポインタ
381  * @return ここのスイッチングで終るならTRUEかFALSE、後続処理を実行するならCONTINUE
382  */
383 gf_switch_result switch_effects_monster(player_type *caster_ptr, effect_monster_type *em_ptr)
384 {
385         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
386         switch (em_ptr->effect_type)
387         {
388         case GF_PSY_SPEAR:
389         case GF_MISSILE:
390         case GF_ARROW:
391         case GF_MANA:
392         case GF_METEOR:
393         case GF_BLOOD_CURSE:
394         case GF_SEEKER:
395         case GF_SUPER_RAY:
396                 return effect_monster_void(em_ptr);
397         case GF_ACID:
398                 return effect_monster_acid(caster_ptr, em_ptr);
399         case GF_ELEC:
400                 return effect_monster_elec(caster_ptr, em_ptr);
401         case GF_FIRE:
402                 return effect_monster_fire(caster_ptr, em_ptr);
403         case GF_COLD:
404                 return effect_monster_cold(caster_ptr, em_ptr);
405         case GF_POIS:
406                 return effect_monster_pois(caster_ptr, em_ptr);
407         case GF_NUKE:
408                 return effect_monster_nuke(caster_ptr, em_ptr);
409         case GF_HELL_FIRE:
410                 return effect_monster_hell_fire(caster_ptr, em_ptr);
411         case GF_HOLY_FIRE:
412                 return effect_monster_holy_fire(caster_ptr, em_ptr);
413         case GF_PLASMA:
414                 return effect_monster_plasma(caster_ptr, em_ptr);
415         case GF_NETHER:
416                 return effect_monster_nether(caster_ptr, em_ptr);
417         case GF_WATER:
418                 return effect_monster_water(caster_ptr, em_ptr);
419         case GF_CHAOS:
420                 return effect_monster_chaos(caster_ptr, em_ptr);
421         case GF_SHARDS:
422                 return effect_monster_shards(caster_ptr, em_ptr);
423         case GF_ROCKET:
424                 return effect_monster_rocket(caster_ptr, em_ptr);
425         case GF_SOUND:
426                 return effect_monster_sound(caster_ptr, em_ptr);
427         case GF_CONFUSION:
428                 return effect_monster_confusion(caster_ptr, em_ptr);
429         case GF_DISENCHANT:
430                 return effect_monster_disenchant(caster_ptr, em_ptr);
431         case GF_NEXUS:
432                 return effect_monster_nexus(caster_ptr, em_ptr);
433         case GF_FORCE:
434                 return effect_monster_force(caster_ptr, em_ptr);
435         case GF_INERTIAL:
436                 return effect_monster_inertial(caster_ptr, em_ptr);
437         case GF_TIME:
438                 return effect_monster_time(caster_ptr, em_ptr);
439         case GF_GRAVITY:
440                 return effect_monster_gravity(caster_ptr, em_ptr);
441         case GF_DISINTEGRATE:
442                 return effect_monster_disintegration(caster_ptr, em_ptr);
443         case GF_PSI:
444                 return effect_monster_psi(caster_ptr, em_ptr);
445         case GF_PSI_DRAIN:
446                 return effect_monster_psi_drain(caster_ptr, em_ptr);
447         case GF_TELEKINESIS:
448                 return effect_monster_telekinesis(caster_ptr, em_ptr);
449         case GF_DOMINATION:
450                 return effect_monster_domination(caster_ptr, em_ptr);
451         case GF_ICE:
452                 return effect_monster_icee_bolt(caster_ptr, em_ptr);
453         case GF_HYPODYNAMIA:
454                 return effect_monster_hypodynamia(caster_ptr, em_ptr);
455         case GF_DEATH_RAY:
456                 return effect_monster_death_ray(caster_ptr, em_ptr);
457         case GF_OLD_POLY:
458                 return effect_monster_old_poly(em_ptr);
459         case GF_OLD_CLONE:
460                 return effect_monster_old_clone(caster_ptr, em_ptr);
461         case GF_STAR_HEAL:
462                 if (effect_monster_old_clone(caster_ptr, em_ptr) == GF_SWITCH_TRUE)
463                         return GF_SWITCH_CONTINUE;
464         /* Fall through */
465         case GF_OLD_HEAL:
466                 return effect_monster_old_heal(caster_ptr, em_ptr);
467         case GF_OLD_SPEED:
468                 return effect_monster_old_speed(caster_ptr, em_ptr);
469         case GF_OLD_SLOW:
470                 return effect_monster_old_slow(caster_ptr, em_ptr);
471         case GF_OLD_SLEEP:
472                 return effect_monster_old_sleep(caster_ptr, em_ptr);
473         case GF_STASIS_EVIL:
474                 return effect_monster_stasis(em_ptr, TRUE);
475         case GF_STASIS:
476                 return effect_monster_stasis(em_ptr, FALSE);
477         case GF_CHARM:
478                 return effect_monster_charm(caster_ptr, em_ptr);
479         case GF_CONTROL_UNDEAD:
480                 return effect_monster_control_undead(caster_ptr, em_ptr);
481         case GF_CONTROL_DEMON:
482                 return effect_monster_control_demon(caster_ptr, em_ptr);
483         case GF_CONTROL_ANIMAL:
484                 return effect_monster_control_animal(caster_ptr, em_ptr);
485         case GF_CHARM_LIVING:
486                 return effect_monster_charm_living(caster_ptr, em_ptr);
487         case GF_OLD_CONF:
488                 return effect_monster_old_conf(caster_ptr, em_ptr);
489         case GF_STUN:
490                 return effect_monster_stun(em_ptr);
491         case GF_LITE_WEAK:
492                 return effect_monster_lite_weak(caster_ptr, em_ptr);
493         case GF_LITE:
494                 return effect_monster_lite(caster_ptr, em_ptr);
495         case GF_DARK:
496                 return effect_monster_dark(caster_ptr, em_ptr);
497         case GF_KILL_WALL:
498                 return effect_monster_kill_wall(caster_ptr, em_ptr);
499         case GF_AWAY_UNDEAD:
500                 return effect_monster_away_undead(caster_ptr, em_ptr);
501         case GF_AWAY_EVIL:
502                 return effect_monster_away_evil(caster_ptr, em_ptr);
503         case GF_AWAY_ALL:
504                 return effect_monster_away_all(caster_ptr, em_ptr);
505         case GF_TURN_UNDEAD:
506                 return effect_monster_turn_undead(caster_ptr, em_ptr);
507         case GF_TURN_EVIL:
508                 return effect_monster_turn_evil(caster_ptr, em_ptr);
509         case GF_TURN_ALL:
510                 return effect_monster_turn_all(em_ptr);
511         case GF_DISP_UNDEAD:
512                 return effect_monster_disp_undead(caster_ptr, em_ptr);
513         case GF_DISP_EVIL:
514                 return effect_monster_disp_evil(caster_ptr, em_ptr);
515         case GF_DISP_GOOD:
516                 return effect_monster_disp_good(caster_ptr, em_ptr);
517         case GF_DISP_LIVING:
518                 return effect_monster_disp_living(em_ptr);
519         case GF_DISP_DEMON:
520                 return effect_monster_disp_demon(caster_ptr, em_ptr);
521         case GF_DISP_ALL:
522                 return effect_monster_disp_all(em_ptr);
523         case GF_DRAIN_MANA:
524                 return effect_monster_drain_mana(caster_ptr, em_ptr);
525         case GF_MIND_BLAST:
526                 return effect_monster_mind_blast(caster_ptr, em_ptr);
527         case GF_BRAIN_SMASH:
528                 return effect_monster_brain_smash(caster_ptr, em_ptr);
529         case GF_CAUSE_1:
530                 return effect_monster_curse_1(em_ptr);
531         case GF_CAUSE_2:
532                 return effect_monster_curse_2(em_ptr);
533         case GF_CAUSE_3:
534                 return effect_monster_curse_3(em_ptr);
535         case GF_CAUSE_4:
536                 return effect_monster_curse_4(em_ptr);
537         case GF_HAND_DOOM:
538                 return effect_monster_hand_doom(em_ptr);
539         case GF_CAPTURE:
540                 return effect_monster_capture(caster_ptr, em_ptr);
541         case GF_ATTACK:
542                 return (gf_switch_result)py_attack(caster_ptr, em_ptr->y, em_ptr->x, em_ptr->dam);
543         case GF_ENGETSU:
544                 return effect_monster_engetsu(caster_ptr, em_ptr);
545         case GF_GENOCIDE:
546         {
547                 if (em_ptr->seen) em_ptr->obvious = TRUE;
548                 if (genocide_aux(caster_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->who, (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
549                 {
550                         if (em_ptr->seen_msg) msg_format(_("%sは消滅した!", "%^s disappeared!"), em_ptr->m_name);
551                         chg_virtue(caster_ptr, V_VITALITY, -1);
552                         return GF_SWITCH_TRUE;
553                 }
554
555                 em_ptr->skipped = TRUE;
556                 break;
557         }
558         case GF_PHOTO:
559         {
560                 if (!em_ptr->who)
561                         msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name);
562
563                 if (em_ptr->r_ptr->flags3 & (RF3_HURT_LITE))
564                 {
565                         if (em_ptr->seen) em_ptr->obvious = TRUE;
566
567                         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_HURT_LITE);
568
569                         em_ptr->note = _("は光に身をすくめた!", " cringes from the light!");
570                         em_ptr->note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
571                 }
572                 else
573                 {
574                         em_ptr->dam = 0;
575                 }
576
577                 em_ptr->photo = em_ptr->m_ptr->r_idx;
578                 break;
579         }
580         case GF_CRUSADE:
581         {
582                 bool success = FALSE;
583                 if (em_ptr->seen) em_ptr->obvious = TRUE;
584
585                 if ((em_ptr->r_ptr->flags3 & (RF3_GOOD)) && !floor_ptr->inside_arena)
586                 {
587                         if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) em_ptr->dam -= 50;
588                         if (em_ptr->dam < 1) em_ptr->dam = 1;
589
590                         if (is_pet(em_ptr->m_ptr))
591                         {
592                                 em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
593                                 (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
594                                 success = TRUE;
595                         }
596                         else if ((em_ptr->r_ptr->flags1 & (RF1_QUESTOR)) ||
597                                 (em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
598                                 (em_ptr->m_ptr->mflag2 & MFLAG2_NOPET) ||
599                                 (caster_ptr->cursed & TRC_AGGRAVATE) ||
600                                 ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam)))
601                         {
602                                 if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
603                         }
604                         else
605                         {
606                                 em_ptr->note = _("を支配した。", " is tamed!");
607                                 set_pet(caster_ptr, em_ptr->m_ptr);
608                                 (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
609
610                                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_GOOD);
611                                 success = TRUE;
612                         }
613                 }
614
615                 if (!success)
616                 {
617                         if (!(em_ptr->r_ptr->flags3 & RF3_NO_FEAR))
618                         {
619                                 em_ptr->do_fear = randint1(90) + 10;
620                         }
621                         else if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
622                                 em_ptr->r_ptr->r_flags3 |= (RF3_NO_FEAR);
623                 }
624
625                 em_ptr->dam = 0;
626                 break;
627         }
628         case GF_WOUNDS:
629         {
630                 if (em_ptr->seen) em_ptr->obvious = TRUE;
631
632                 if (randint0(100 + em_ptr->dam) < (em_ptr->r_ptr->level + 50))
633                 {
634                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
635                         em_ptr->dam = 0;
636                 }
637                 break;
638         }
639         default:
640         {
641                 em_ptr->skipped = TRUE;
642                 em_ptr->dam = 0;
643                 break;
644         }
645         }
646
647         return GF_SWITCH_CONTINUE;
648 }