OSDN Git Service

[Refactor] #39963 Separated effect_monster_curse_*() from switch_effects_monster()
[hengbandforosx/hengbandosx.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 /*!
209  * @brief 魔法の効果によって様々なメッセーを出力したり与えるダメージの増減を行ったりする
210  * @param em_ptr モンスター効果構造体への参照ポインタ
211  * @return ここのスイッチングで終るならTRUEかFALSE、後続処理を実行するならCONTINUE
212  */
213 gf_switch_result switch_effects_monster(player_type *caster_ptr, effect_monster_type *em_ptr)
214 {
215         floor_type *floor_ptr = caster_ptr->current_floor_ptr;
216         switch (em_ptr->effect_type)
217         {
218         case GF_PSY_SPEAR:
219         case GF_MISSILE:
220         case GF_ARROW:
221         case GF_MANA:
222         case GF_METEOR:
223         case GF_BLOOD_CURSE:
224         case GF_SEEKER:
225         case GF_SUPER_RAY:
226                 return effect_monster_void(em_ptr);
227         case GF_ACID:
228                 return effect_monster_acid(caster_ptr, em_ptr);
229         case GF_ELEC:
230                 return effect_monster_elec(caster_ptr, em_ptr);
231         case GF_FIRE:
232                 return effect_monster_fire(caster_ptr, em_ptr);
233         case GF_COLD:
234                 return effect_monster_cold(caster_ptr, em_ptr);
235         case GF_POIS:
236                 return effect_monster_pois(caster_ptr, em_ptr);
237         case GF_NUKE:
238                 return effect_monster_nuke(caster_ptr, em_ptr);
239         case GF_HELL_FIRE:
240                 return effect_monster_hell_fire(caster_ptr, em_ptr);
241         case GF_HOLY_FIRE:
242                 return effect_monster_holy_fire(caster_ptr, em_ptr);
243         case GF_PLASMA:
244                 return effect_monster_plasma(caster_ptr, em_ptr);
245         case GF_NETHER:
246                 return effect_monster_nether(caster_ptr, em_ptr);
247         case GF_WATER:
248                 return effect_monster_water(caster_ptr, em_ptr);
249         case GF_CHAOS:
250                 return effect_monster_chaos(caster_ptr, em_ptr);
251         case GF_SHARDS:
252                 return effect_monster_shards(caster_ptr, em_ptr);
253         case GF_ROCKET:
254                 return effect_monster_rocket(caster_ptr, em_ptr);
255         case GF_SOUND:
256                 return effect_monster_sound(caster_ptr, em_ptr);
257         case GF_CONFUSION:
258                 return effect_monster_confusion(caster_ptr, em_ptr);
259         case GF_DISENCHANT:
260                 return effect_monster_disenchant(caster_ptr, em_ptr);
261         case GF_NEXUS:
262                 return effect_monster_nexus(caster_ptr, em_ptr);
263         case GF_FORCE:
264                 return effect_monster_force(caster_ptr, em_ptr);
265         case GF_INERTIAL:
266                 return effect_monster_inertial(caster_ptr, em_ptr);
267         case GF_TIME:
268                 return effect_monster_time(caster_ptr, em_ptr);
269         case GF_GRAVITY:
270                 return effect_monster_gravity(caster_ptr, em_ptr);
271         case GF_DISINTEGRATE:
272                 return effect_monster_disintegration(caster_ptr, em_ptr);
273         case GF_PSI:
274                 return effect_monster_psi(caster_ptr, em_ptr);
275         case GF_PSI_DRAIN:
276                 return effect_monster_psi_drain(caster_ptr, em_ptr);
277         case GF_TELEKINESIS:
278                 return effect_monster_telekinesis(caster_ptr, em_ptr);
279         case GF_DOMINATION:
280                 return effect_monster_domination(caster_ptr, em_ptr);
281         case GF_ICE:
282                 return effect_monster_icee_bolt(caster_ptr, em_ptr);
283         case GF_HYPODYNAMIA:
284                 return effect_monster_hypodynamia(caster_ptr, em_ptr);
285         case GF_DEATH_RAY:
286                 return effect_monster_death_ray(caster_ptr, em_ptr);
287         case GF_OLD_POLY:
288                 return effect_monster_old_poly(em_ptr);
289         case GF_OLD_CLONE:
290                 return effect_monster_old_clone(caster_ptr, em_ptr);
291         case GF_STAR_HEAL:
292                 if (effect_monster_old_clone(caster_ptr, em_ptr) == GF_SWITCH_TRUE)
293                         return GF_SWITCH_CONTINUE;
294         /* Fall through */
295         case GF_OLD_HEAL:
296                 return effect_monster_old_heal(caster_ptr, em_ptr);
297         case GF_OLD_SPEED:
298                 return effect_monster_old_speed(caster_ptr, em_ptr);
299         case GF_OLD_SLOW:
300                 return effect_monster_old_slow(caster_ptr, em_ptr);
301         case GF_OLD_SLEEP:
302                 return effect_monster_old_sleep(caster_ptr, em_ptr);
303         case GF_STASIS_EVIL:
304                 return effect_monster_stasis(em_ptr, TRUE);
305         case GF_STASIS:
306                 return effect_monster_stasis(em_ptr, FALSE);
307         case GF_CHARM:
308                 return effect_monster_charm(caster_ptr, em_ptr);
309         case GF_CONTROL_UNDEAD:
310                 return effect_monster_control_undead(caster_ptr, em_ptr);
311         case GF_CONTROL_DEMON:
312                 return effect_monster_control_demon(caster_ptr, em_ptr);
313         case GF_CONTROL_ANIMAL:
314                 return effect_monster_control_animal(caster_ptr, em_ptr);
315         case GF_CHARM_LIVING:
316                 return effect_monster_charm_living(caster_ptr, em_ptr);
317         case GF_OLD_CONF:
318                 return effect_monster_old_conf(caster_ptr, em_ptr);
319         case GF_STUN:
320                 return effect_monster_stun(em_ptr);
321         case GF_LITE_WEAK:
322                 return effect_monster_lite_weak(caster_ptr, em_ptr);
323         case GF_LITE:
324                 return effect_monster_lite(caster_ptr, em_ptr);
325         case GF_DARK:
326                 return effect_monster_dark(caster_ptr, em_ptr);
327         case GF_KILL_WALL:
328                 return effect_monster_kill_wall(caster_ptr, em_ptr);
329         case GF_AWAY_UNDEAD:
330                 return effect_monster_away_undead(caster_ptr, em_ptr);
331         case GF_AWAY_EVIL:
332                 return effect_monster_away_evil(caster_ptr, em_ptr);
333         case GF_AWAY_ALL:
334                 return effect_monster_away_all(caster_ptr, em_ptr);
335         case GF_TURN_UNDEAD:
336                 return effect_monster_turn_undead(caster_ptr, em_ptr);
337         case GF_TURN_EVIL:
338                 return effect_monster_turn_evil(caster_ptr, em_ptr);
339         case GF_TURN_ALL:
340                 return effect_monster_turn_all(em_ptr);
341         case GF_DISP_UNDEAD:
342                 return effect_monster_disp_undead(caster_ptr, em_ptr);
343         case GF_DISP_EVIL:
344                 return effect_monster_disp_evil(caster_ptr, em_ptr);
345         case GF_DISP_GOOD:
346                 return effect_monster_disp_good(caster_ptr, em_ptr);
347         case GF_DISP_LIVING:
348                 return effect_monster_disp_living(em_ptr);
349         case GF_DISP_DEMON:
350                 return effect_monster_disp_demon(caster_ptr, em_ptr);
351         case GF_DISP_ALL:
352                 return effect_monster_disp_all(em_ptr);
353         case GF_DRAIN_MANA:
354                 return effect_monster_drain_mana(caster_ptr, em_ptr);
355         case GF_MIND_BLAST:
356                 return effect_monster_mind_blast(caster_ptr, em_ptr);
357         case GF_BRAIN_SMASH:
358                 return effect_monster_brain_smash(caster_ptr, em_ptr);
359         case GF_CAUSE_1:
360                 return effect_monster_curse_1(em_ptr);
361         case GF_CAUSE_2:
362                 return effect_monster_curse_2(em_ptr);
363         case GF_CAUSE_3:
364                 return effect_monster_curse_3(em_ptr);
365         case GF_CAUSE_4:
366                 return effect_monster_curse_4(em_ptr);
367         case GF_HAND_DOOM:
368         {
369                 if (em_ptr->seen) em_ptr->obvious = TRUE;
370                 if (em_ptr->r_ptr->flags1 & RF1_UNIQUE)
371                 {
372                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
373                         em_ptr->dam = 0;
374                 }
375                 else
376                 {
377                         if ((em_ptr->who > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20))) :
378                                 (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200))))
379                         {
380                                 em_ptr->dam = ((40 + randint1(20)) * em_ptr->m_ptr->hp) / 100;
381
382                                 if (em_ptr->m_ptr->hp < em_ptr->dam) em_ptr->dam = em_ptr->m_ptr->hp - 1;
383                         }
384                         else
385                         {
386                                 em_ptr->note = _("は破滅の手に耐え切った!", "resists!");
387                                 em_ptr->dam = 0;
388                         }
389                 }
390
391                 break;
392         }
393         case GF_CAPTURE:
394         {
395                 int nokori_hp;
396                 if ((floor_ptr->inside_quest && (quest[floor_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(em_ptr->m_ptr)) ||
397                         (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)
398                 {
399                         msg_format(_("%sには効果がなかった。", "%s is unaffected."), em_ptr->m_name);
400                         em_ptr->skipped = TRUE;
401                         break;
402                 }
403
404                 if (is_pet(em_ptr->m_ptr)) nokori_hp = em_ptr->m_ptr->maxhp * 4L;
405                 else if ((caster_ptr->pclass == CLASS_BEASTMASTER) && monster_living(em_ptr->m_ptr->r_idx))
406                         nokori_hp = em_ptr->m_ptr->maxhp * 3 / 10;
407                 else
408                         nokori_hp = em_ptr->m_ptr->maxhp * 3 / 20;
409
410                 if (em_ptr->m_ptr->hp >= nokori_hp)
411                 {
412                         msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), em_ptr->m_name);
413                         em_ptr->skipped = TRUE;
414                 }
415                 else if (em_ptr->m_ptr->hp < randint0(nokori_hp))
416                 {
417                         if (em_ptr->m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(caster_ptr, em_ptr->g_ptr->m_idx, FALSE, MON_CHAMELEON);
418                         msg_format(_("%sを捕えた!", "You capture %^s!"), em_ptr->m_name);
419                         cap_mon = em_ptr->m_ptr->r_idx;
420                         cap_mspeed = em_ptr->m_ptr->mspeed;
421                         cap_hp = em_ptr->m_ptr->hp;
422                         cap_maxhp = em_ptr->m_ptr->max_maxhp;
423                         cap_nickname = em_ptr->m_ptr->nickname;
424                         if (em_ptr->g_ptr->m_idx == caster_ptr->riding)
425                         {
426                                 if (rakuba(caster_ptr, -1, FALSE))
427                                 {
428                                         msg_format(_("地面に落とされた。", "You have fallen from %s."), em_ptr->m_name);
429                                 }
430                         }
431
432                         delete_monster_idx(caster_ptr, em_ptr->g_ptr->m_idx);
433
434                         return GF_SWITCH_TRUE;
435                 }
436                 else
437                 {
438                         msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), em_ptr->m_name);
439                         em_ptr->skipped = TRUE;
440                 }
441
442                 break;
443         }
444         case GF_ATTACK:
445         {
446                 return (gf_switch_result)py_attack(caster_ptr, em_ptr->y, em_ptr->x, em_ptr->dam);
447         }
448         case GF_ENGETSU:
449         {
450                 int effect = 0;
451                 bool done = TRUE;
452
453                 if (em_ptr->seen) em_ptr->obvious = TRUE;
454                 if (em_ptr->r_ptr->flags2 & RF2_EMPTY_MIND)
455                 {
456                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
457                         em_ptr->dam = 0;
458                         em_ptr->skipped = TRUE;
459                         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
460                         break;
461                 }
462                 if (MON_CSLEEP(em_ptr->m_ptr))
463                 {
464                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
465                         em_ptr->dam = 0;
466                         em_ptr->skipped = TRUE;
467                         break;
468                 }
469
470                 if (one_in_(5)) effect = 1;
471                 else if (one_in_(4)) effect = 2;
472                 else if (one_in_(3)) effect = 3;
473                 else done = FALSE;
474
475                 if (effect == 1)
476                 {
477                         if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) ||
478                                 (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
479                         {
480                                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
481                                 em_ptr->obvious = FALSE;
482                         }
483                         else
484                         {
485                                 if (set_monster_slow(caster_ptr, em_ptr->g_ptr->m_idx, MON_SLOW(em_ptr->m_ptr) + 50))
486                                 {
487                                         em_ptr->note = _("の動きが遅くなった。", " starts moving slower.");
488                                 }
489                         }
490                 }
491                 else if (effect == 2)
492                 {
493                         em_ptr->do_stun = damroll((caster_ptr->lev / 10) + 3, (em_ptr->dam)) + 1;
494                         if ((em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
495                                 (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
496                         {
497                                 em_ptr->do_stun = 0;
498                                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
499                                 em_ptr->obvious = FALSE;
500                         }
501                 }
502                 else if (effect == 3)
503                 {
504                         if ((em_ptr->r_ptr->flags1 & RF1_UNIQUE) ||
505                                 (em_ptr->r_ptr->flags3 & RF3_NO_SLEEP) ||
506                                 (em_ptr->r_ptr->level > randint1((em_ptr->dam - 10) < 1 ? 1 : (em_ptr->dam - 10)) + 10))
507                         {
508                                 if (em_ptr->r_ptr->flags3 & RF3_NO_SLEEP)
509                                 {
510                                         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_NO_SLEEP);
511                                 }
512
513                                 em_ptr->note = _("には効果がなかった。", " is unaffected.");
514                                 em_ptr->obvious = FALSE;
515                         }
516                         else
517                         {
518                                 /* Go to sleep (much) later */
519                                 em_ptr->note = _("は眠り込んでしまった!", " falls asleep!");
520                                 em_ptr->do_sleep = 500;
521                         }
522                 }
523
524                 if (!done)
525                 {
526                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
527                 }
528
529                 em_ptr->dam = 0;
530                 break;
531         }
532         case GF_GENOCIDE:
533         {
534                 if (em_ptr->seen) em_ptr->obvious = TRUE;
535                 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")))
536                 {
537                         if (em_ptr->seen_msg) msg_format(_("%sは消滅した!", "%^s disappeared!"), em_ptr->m_name);
538                         chg_virtue(caster_ptr, V_VITALITY, -1);
539                         return GF_SWITCH_TRUE;
540                 }
541
542                 em_ptr->skipped = TRUE;
543                 break;
544         }
545         case GF_PHOTO:
546         {
547                 if (!em_ptr->who)
548                         msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name);
549
550                 if (em_ptr->r_ptr->flags3 & (RF3_HURT_LITE))
551                 {
552                         if (em_ptr->seen) em_ptr->obvious = TRUE;
553
554                         if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_HURT_LITE);
555
556                         em_ptr->note = _("は光に身をすくめた!", " cringes from the light!");
557                         em_ptr->note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
558                 }
559                 else
560                 {
561                         em_ptr->dam = 0;
562                 }
563
564                 em_ptr->photo = em_ptr->m_ptr->r_idx;
565                 break;
566         }
567         case GF_CRUSADE:
568         {
569                 bool success = FALSE;
570                 if (em_ptr->seen) em_ptr->obvious = TRUE;
571
572                 if ((em_ptr->r_ptr->flags3 & (RF3_GOOD)) && !floor_ptr->inside_arena)
573                 {
574                         if (em_ptr->r_ptr->flags3 & (RF3_NO_CONF)) em_ptr->dam -= 50;
575                         if (em_ptr->dam < 1) em_ptr->dam = 1;
576
577                         if (is_pet(em_ptr->m_ptr))
578                         {
579                                 em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
580                                 (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
581                                 success = TRUE;
582                         }
583                         else if ((em_ptr->r_ptr->flags1 & (RF1_QUESTOR)) ||
584                                 (em_ptr->r_ptr->flags1 & (RF1_UNIQUE)) ||
585                                 (em_ptr->m_ptr->mflag2 & MFLAG2_NOPET) ||
586                                 (caster_ptr->cursed & TRC_AGGRAVATE) ||
587                                 ((em_ptr->r_ptr->level + 10) > randint1(em_ptr->dam)))
588                         {
589                                 if (one_in_(4)) em_ptr->m_ptr->mflag2 |= MFLAG2_NOPET;
590                         }
591                         else
592                         {
593                                 em_ptr->note = _("を支配した。", " is tamed!");
594                                 set_pet(caster_ptr, em_ptr->m_ptr);
595                                 (void)set_monster_fast(caster_ptr, em_ptr->g_ptr->m_idx, MON_FAST(em_ptr->m_ptr) + 100);
596
597                                 if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr)) em_ptr->r_ptr->r_flags3 |= (RF3_GOOD);
598                                 success = TRUE;
599                         }
600                 }
601
602                 if (!success)
603                 {
604                         if (!(em_ptr->r_ptr->flags3 & RF3_NO_FEAR))
605                         {
606                                 em_ptr->do_fear = randint1(90) + 10;
607                         }
608                         else if (is_original_ap_and_seen(caster_ptr, em_ptr->m_ptr))
609                                 em_ptr->r_ptr->r_flags3 |= (RF3_NO_FEAR);
610                 }
611
612                 em_ptr->dam = 0;
613                 break;
614         }
615         case GF_WOUNDS:
616         {
617                 if (em_ptr->seen) em_ptr->obvious = TRUE;
618
619                 if (randint0(100 + em_ptr->dam) < (em_ptr->r_ptr->level + 50))
620                 {
621                         em_ptr->note = _("には効果がなかった。", " is unaffected.");
622                         em_ptr->dam = 0;
623                 }
624                 break;
625         }
626         default:
627         {
628                 em_ptr->skipped = TRUE;
629                 em_ptr->dam = 0;
630                 break;
631         }
632         }
633
634         return GF_SWITCH_CONTINUE;
635 }