OSDN Git Service

19711a68e4596fbc53ea3e7818824bc31711c4e9
[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 gf_switch_result effect_monster_genocide(player_type *caster_ptr, effect_monster_type *em_ptr)
379 {
380         if (em_ptr->seen) em_ptr->obvious = TRUE;
381         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")))
382         {
383                 if (em_ptr->seen_msg) msg_format(_("%sは消滅した!", "%^s disappeared!"), em_ptr->m_name);
384                 chg_virtue(caster_ptr, V_VITALITY, -1);
385                 return GF_SWITCH_TRUE;
386         }
387
388         em_ptr->skipped = TRUE;
389         return GF_SWITCH_CONTINUE;
390 }
391
392
393 gf_switch_result effect_monster_photo(player_type *caster_ptr, effect_monster_type *em_ptr)
394 {
395         if (!em_ptr->who)
396                 msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name);
397
398         if (em_ptr->r_ptr->flags3 & (RF3_HURT_LITE))
399         {
400                 if (em_ptr->seen) em_ptr->obvious = TRUE;
401
402                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_HURT_LITE);
403
404                 em_ptr->note = _("は光に身をすくめた!", " cringes from the light!");
405                 em_ptr->note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
406         }
407         else
408         {
409                 em_ptr->dam = 0;
410         }
411
412         em_ptr->photo = em_ptr->m_ptr->r_idx;
413         return GF_SWITCH_CONTINUE;
414 }
415
416
417 gf_switch_result effect_monster_crusade(player_type *caster_ptr, effect_monster_type *em_ptr)
418 {
419         bool success = FALSE;
420         if (em_ptr->seen) em_ptr->obvious = TRUE;
421
422         if ((em_ptr->r_ptr->flags3 & (RF3_GOOD)) && !caster_ptr->current_floor_ptr->inside_arena)
423         {
424                 if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) em_ptr->dam -= 50;
425                 if (em_ptr->dam < 1) em_ptr->dam = 1;
426
427                 if (is_pet(em_ptr->m_ptr))
428                 {
429                         em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
430                         (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
431                         success = TRUE;
432                 }
433                 else if ((em_ptr->r_ptr->flags1 & (RF1_QUESTOR)) ||
434                         (em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
435                         (em_ptr->m_ptr->mflag2 & MFLAG2_NOPET) ||
436                         (caster_ptr->cursed & TRC_AGGRAVATE) ||
437                         ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam)))
438                 {
439                         if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
440                 }
441                 else
442                 {
443                         em_ptr->note = _("を支配した。", " is tamed!");
444                         set_pet(caster_ptr, em_ptr->m_ptr);
445                         (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
446
447                         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_GOOD);
448                         success = TRUE;
449                 }
450         }
451
452         if (!success)
453         {
454                 if (!(em_ptr->r_ptr->flags3 & RF3_NO_FEAR))
455                 {
456                         em_ptr->do_fear = randint1(90) + 10;
457                 }
458                 else if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
459                         em_ptr->r_ptr->r_flags3 |= (RF3_NO_FEAR);
460         }
461
462         em_ptr->dam = 0;
463         return GF_SWITCH_CONTINUE;
464 }
465
466
467 gf_switch_result effect_monster_wounds(effect_monster_type *em_ptr)
468 {
469         if (em_ptr->seen) em_ptr->obvious = TRUE;
470
471         if (randint0(100 + em_ptr->dam) < (em_ptr->r_ptr->level + 50))
472         {
473                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
474                 em_ptr->dam = 0;
475         }
476
477         return GF_SWITCH_CONTINUE;
478 }
479
480
481 /*!
482  * @brief 魔法の効果によって様々なメッセーを出力したり与えるダメージの増減を行ったりする
483  * @param em_ptr モンスター効果構造体への参照ポインタ
484  * @return ここのスイッチングで終るならTRUEかFALSE、後続処理を実行するならCONTINUE
485  */
486 gf_switch_result switch_effects_monster(player_type *caster_ptr, effect_monster_type *em_ptr)
487 {
488         switch (em_ptr->effect_type)
489         {
490         case GF_PSY_SPEAR:
491         case GF_MISSILE:
492         case GF_ARROW:
493         case GF_MANA:
494         case GF_METEOR:
495         case GF_BLOOD_CURSE:
496         case GF_SEEKER:
497         case GF_SUPER_RAY:
498                 return effect_monster_void(em_ptr);
499         case GF_ACID:
500                 return effect_monster_acid(caster_ptr, em_ptr);
501         case GF_ELEC:
502                 return effect_monster_elec(caster_ptr, em_ptr);
503         case GF_FIRE:
504                 return effect_monster_fire(caster_ptr, em_ptr);
505         case GF_COLD:
506                 return effect_monster_cold(caster_ptr, em_ptr);
507         case GF_POIS:
508                 return effect_monster_pois(caster_ptr, em_ptr);
509         case GF_NUKE:
510                 return effect_monster_nuke(caster_ptr, em_ptr);
511         case GF_HELL_FIRE:
512                 return effect_monster_hell_fire(caster_ptr, em_ptr);
513         case GF_HOLY_FIRE:
514                 return effect_monster_holy_fire(caster_ptr, em_ptr);
515         case GF_PLASMA:
516                 return effect_monster_plasma(caster_ptr, em_ptr);
517         case GF_NETHER:
518                 return effect_monster_nether(caster_ptr, em_ptr);
519         case GF_WATER:
520                 return effect_monster_water(caster_ptr, em_ptr);
521         case GF_CHAOS:
522                 return effect_monster_chaos(caster_ptr, em_ptr);
523         case GF_SHARDS:
524                 return effect_monster_shards(caster_ptr, em_ptr);
525         case GF_ROCKET:
526                 return effect_monster_rocket(caster_ptr, em_ptr);
527         case GF_SOUND:
528                 return effect_monster_sound(caster_ptr, em_ptr);
529         case GF_CONFUSION:
530                 return effect_monster_confusion(caster_ptr, em_ptr);
531         case GF_DISENCHANT:
532                 return effect_monster_disenchant(caster_ptr, em_ptr);
533         case GF_NEXUS:
534                 return effect_monster_nexus(caster_ptr, em_ptr);
535         case GF_FORCE:
536                 return effect_monster_force(caster_ptr, em_ptr);
537         case GF_INERTIAL:
538                 return effect_monster_inertial(caster_ptr, em_ptr);
539         case GF_TIME:
540                 return effect_monster_time(caster_ptr, em_ptr);
541         case GF_GRAVITY:
542                 return effect_monster_gravity(caster_ptr, em_ptr);
543         case GF_DISINTEGRATE:
544                 return effect_monster_disintegration(caster_ptr, em_ptr);
545         case GF_PSI:
546                 return effect_monster_psi(caster_ptr, em_ptr);
547         case GF_PSI_DRAIN:
548                 return effect_monster_psi_drain(caster_ptr, em_ptr);
549         case GF_TELEKINESIS:
550                 return effect_monster_telekinesis(caster_ptr, em_ptr);
551         case GF_DOMINATION:
552                 return effect_monster_domination(caster_ptr, em_ptr);
553         case GF_ICE:
554                 return effect_monster_icee_bolt(caster_ptr, em_ptr);
555         case GF_HYPODYNAMIA:
556                 return effect_monster_hypodynamia(caster_ptr, em_ptr);
557         case GF_DEATH_RAY:
558                 return effect_monster_death_ray(caster_ptr, em_ptr);
559         case GF_OLD_POLY:
560                 return effect_monster_old_poly(em_ptr);
561         case GF_OLD_CLONE:
562                 return effect_monster_old_clone(caster_ptr, em_ptr);
563         case GF_STAR_HEAL:
564                 if (effect_monster_old_clone(caster_ptr, em_ptr) == GF_SWITCH_TRUE)
565                         return GF_SWITCH_CONTINUE;
566         /* Fall through */
567         case GF_OLD_HEAL:
568                 return effect_monster_old_heal(caster_ptr, em_ptr);
569         case GF_OLD_SPEED:
570                 return effect_monster_old_speed(caster_ptr, em_ptr);
571         case GF_OLD_SLOW:
572                 return effect_monster_old_slow(caster_ptr, em_ptr);
573         case GF_OLD_SLEEP:
574                 return effect_monster_old_sleep(caster_ptr, em_ptr);
575         case GF_STASIS_EVIL:
576                 return effect_monster_stasis(em_ptr, TRUE);
577         case GF_STASIS:
578                 return effect_monster_stasis(em_ptr, FALSE);
579         case GF_CHARM:
580                 return effect_monster_charm(caster_ptr, em_ptr);
581         case GF_CONTROL_UNDEAD:
582                 return effect_monster_control_undead(caster_ptr, em_ptr);
583         case GF_CONTROL_DEMON:
584                 return effect_monster_control_demon(caster_ptr, em_ptr);
585         case GF_CONTROL_ANIMAL:
586                 return effect_monster_control_animal(caster_ptr, em_ptr);
587         case GF_CHARM_LIVING:
588                 return effect_monster_charm_living(caster_ptr, em_ptr);
589         case GF_OLD_CONF:
590                 return effect_monster_old_conf(caster_ptr, em_ptr);
591         case GF_STUN:
592                 return effect_monster_stun(em_ptr);
593         case GF_LITE_WEAK:
594                 return effect_monster_lite_weak(caster_ptr, em_ptr);
595         case GF_LITE:
596                 return effect_monster_lite(caster_ptr, em_ptr);
597         case GF_DARK:
598                 return effect_monster_dark(caster_ptr, em_ptr);
599         case GF_KILL_WALL:
600                 return effect_monster_kill_wall(caster_ptr, em_ptr);
601         case GF_AWAY_UNDEAD:
602                 return effect_monster_away_undead(caster_ptr, em_ptr);
603         case GF_AWAY_EVIL:
604                 return effect_monster_away_evil(caster_ptr, em_ptr);
605         case GF_AWAY_ALL:
606                 return effect_monster_away_all(caster_ptr, em_ptr);
607         case GF_TURN_UNDEAD:
608                 return effect_monster_turn_undead(caster_ptr, em_ptr);
609         case GF_TURN_EVIL:
610                 return effect_monster_turn_evil(caster_ptr, em_ptr);
611         case GF_TURN_ALL:
612                 return effect_monster_turn_all(em_ptr);
613         case GF_DISP_UNDEAD:
614                 return effect_monster_disp_undead(caster_ptr, em_ptr);
615         case GF_DISP_EVIL:
616                 return effect_monster_disp_evil(caster_ptr, em_ptr);
617         case GF_DISP_GOOD:
618                 return effect_monster_disp_good(caster_ptr, em_ptr);
619         case GF_DISP_LIVING:
620                 return effect_monster_disp_living(em_ptr);
621         case GF_DISP_DEMON:
622                 return effect_monster_disp_demon(caster_ptr, em_ptr);
623         case GF_DISP_ALL:
624                 return effect_monster_disp_all(em_ptr);
625         case GF_DRAIN_MANA:
626                 return effect_monster_drain_mana(caster_ptr, em_ptr);
627         case GF_MIND_BLAST:
628                 return effect_monster_mind_blast(caster_ptr, em_ptr);
629         case GF_BRAIN_SMASH:
630                 return effect_monster_brain_smash(caster_ptr, em_ptr);
631         case GF_CAUSE_1:
632                 return effect_monster_curse_1(em_ptr);
633         case GF_CAUSE_2:
634                 return effect_monster_curse_2(em_ptr);
635         case GF_CAUSE_3:
636                 return effect_monster_curse_3(em_ptr);
637         case GF_CAUSE_4:
638                 return effect_monster_curse_4(em_ptr);
639         case GF_HAND_DOOM:
640                 return effect_monster_hand_doom(em_ptr);
641         case GF_CAPTURE:
642                 return effect_monster_capture(caster_ptr, em_ptr);
643         case GF_ATTACK:
644                 return (gf_switch_result)py_attack(caster_ptr, em_ptr->y, em_ptr->x, em_ptr->dam);
645         case GF_ENGETSU:
646                 return effect_monster_engetsu(caster_ptr, em_ptr);
647         case GF_GENOCIDE:
648                 return effect_monster_genocide(caster_ptr, em_ptr);
649         case GF_PHOTO:
650                 return effect_monster_photo(caster_ptr, em_ptr);
651         case GF_CRUSADE:
652                 return effect_monster_crusade(caster_ptr, em_ptr);
653         case GF_WOUNDS:
654                 return effect_monster_wounds(em_ptr);
655         default:
656         {
657                 em_ptr->skipped = TRUE;
658                 em_ptr->dam = 0;
659                 return GF_SWITCH_CONTINUE;
660         }
661         }
662 }