OSDN Git Service

[Refactor] #39963 Separated several effect_player_*() functions from switch_effects_p...
[hengbandforosx/hengbandosx.git] / src / effect / effect-player-switcher.c
1 #include "angband.h"
2 #include "effect-player-util.h"
3 #include "effect/effect-player-switcher.h"
4 #include "spell/spells-type.h"
5 #include "player-damage.h"
6 #include "world.h"
7 #include "object-broken.h"
8 #include "player-effects.h"
9 #include "spells-status.h"
10 #include "artifact.h"
11 #include "player/mimic-info-table.h"
12 #include "monster-spell.h"
13 #include "mutation.h"
14 #include "object-curse.h"
15
16 // \93Å\82ð\8f\9c\82­4\8c³\91f.
17 void effect_player_elements(player_type *target_ptr, effect_player_type *ep_ptr, concptr attack_message,
18         HIT_POINT(*damage_func)(player_type*, HIT_POINT, concptr, int, bool))
19 {
20         if (target_ptr->blind) msg_print(attack_message);
21
22         ep_ptr->get_damage = (*damage_func)(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
23 }
24
25
26 void effect_player_poison(player_type *target_ptr, effect_player_type *ep_ptr)
27 {
28         bool double_resist = is_oppose_pois(target_ptr);
29         if (target_ptr->blind) msg_print(_("\93Å\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by poison!"));
30
31         if (target_ptr->resist_pois) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
32         if (double_resist) ep_ptr->dam = (ep_ptr->dam + 2) / 3;
33
34         if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(target_ptr))
35         {
36                 do_dec_stat(target_ptr, A_CON);
37         }
38
39         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
40
41         if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
42                 set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
43 }
44
45
46 void effect_player_nuke(player_type *target_ptr, effect_player_type *ep_ptr)
47 {
48         bool double_resist = is_oppose_pois(target_ptr);
49         if (target_ptr->blind) msg_print(_("\95ú\8eË\94\\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by radiation!"));
50
51         if (target_ptr->resist_pois) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
52         if (double_resist) ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
53
54         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
55         if ((double_resist || target_ptr->resist_pois) || CHECK_MULTISHADOW(target_ptr))
56                 return;
57
58         set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
59         if (one_in_(5)) /* 6 */
60         {
61                 msg_print(_("\8aï\8c`\93I\82È\95Ï\90g\82ð\90\8b\82°\82½\81I", "You undergo a freakish metamorphosis!"));
62                 if (one_in_(4)) /* 4 */
63                         do_poly_self(target_ptr);
64                 else
65                         status_shuffle(target_ptr);
66         }
67
68         if (one_in_(6))
69                 inventory_damage(target_ptr, set_acid_destroy, 2);
70 }
71
72
73 void effect_player_missile(player_type *target_ptr, effect_player_type *ep_ptr)
74 {
75         if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
76
77         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
78 }
79
80
81 void effect_player_holy_fire(player_type *target_ptr, effect_player_type *ep_ptr)
82 {
83         if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
84
85         if (target_ptr->align > 10)
86                 ep_ptr->dam /= 2;
87         else if (target_ptr->align < -10)
88                 ep_ptr->dam *= 2;
89
90         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
91 }
92
93
94 void effect_player_hell_fire(player_type *target_ptr, effect_player_type *ep_ptr)
95 {
96         if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
97
98         if (target_ptr->align > 10)
99                 ep_ptr->dam *= 2;
100
101         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
102 }
103
104
105 void effect_player_arrow(player_type *target_ptr, effect_player_type *ep_ptr)
106 {
107         if (target_ptr->blind)
108         {
109                 msg_print(_("\89½\82©\89s\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp!"));
110                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
111                 return;
112         }
113         
114         if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
115         {
116                 msg_print(_("\96î\82ð\8ea\82è\8eÌ\82Ä\82½\81I", "You cut down the arrow!"));
117                 return;
118         }
119
120         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
121 }
122
123
124 void effect_player_plasma(player_type *target_ptr, effect_player_type *ep_ptr)
125 {
126         if (target_ptr->blind) msg_print(_("\89½\82©\82Æ\82Ä\82à\94M\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something *HOT*!"));
127
128         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
129
130         if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
131         {
132                 int plus_stun = (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
133                 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
134         }
135
136         if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || target_ptr->immune_fire))
137                 inventory_damage(target_ptr, set_acid_destroy, 3);
138 }
139
140
141 void effect_player_nether(player_type *target_ptr, effect_player_type *ep_ptr)
142 {
143         if (target_ptr->blind) msg_print(_("\92n\8d\96\82Ì\97Í\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by nether forces!"));
144
145         if (target_ptr->resist_neth)
146         {
147                 if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
148                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
149         }
150         else if (!CHECK_MULTISHADOW(target_ptr)) drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
151
152         if (!PRACE_IS_(target_ptr, RACE_SPECTRE) || CHECK_MULTISHADOW(target_ptr))
153         {
154                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
155                 return;
156         }
157
158         msg_print(_("\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\81B", "You feel invigorated!"));
159         hp_player(target_ptr, ep_ptr->dam / 4);
160         learn_spell(target_ptr, ep_ptr->monspell);
161 }
162
163
164 void effect_player_water(player_type *target_ptr, effect_player_type *ep_ptr)
165 {
166         if (target_ptr->blind) msg_print(_("\89½\82©\8e¼\82Á\82½\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something wet!"));
167         if (CHECK_MULTISHADOW(target_ptr))
168         {
169                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
170                 return;
171         }
172
173         if (!target_ptr->resist_sound && !target_ptr->resist_water)
174         {
175                 set_stun(target_ptr, target_ptr->stun + randint1(40));
176         }
177         if (!target_ptr->resist_conf && !target_ptr->resist_water)
178         {
179                 set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
180         }
181
182         if (one_in_(5) && !target_ptr->resist_water)
183         {
184                 inventory_damage(target_ptr, set_cold_destroy, 3);
185         }
186
187         if (target_ptr->resist_water) ep_ptr->get_damage /= 4;
188
189         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
190 }
191
192
193 void effect_player_chaos(player_type *target_ptr, effect_player_type *ep_ptr)
194 {
195         if (target_ptr->blind) msg_print(_("\96³\92\81\8f\98\82Ì\94g\93®\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a wave of anarchy!"));
196         if (target_ptr->resist_chaos)
197         {
198                 ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
199         }
200
201         if (CHECK_MULTISHADOW(target_ptr))
202         {
203                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
204                 return;
205         }
206
207         if (!target_ptr->resist_conf)
208         {
209                 (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
210         }
211         if (!target_ptr->resist_chaos)
212         {
213                 (void)set_image(target_ptr, target_ptr->image + randint1(10));
214                 if (one_in_(3))
215                 {
216                         msg_print(_("\82 \82È\82½\82Ì\90g\91Ì\82Í\83J\83I\83X\82Ì\97Í\82Å\94P\82\8bÈ\82°\82ç\82ê\82½\81I", "Your body is twisted by chaos!"));
217                         (void)gain_mutation(target_ptr, 0);
218                 }
219         }
220         if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
221         {
222                 drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
223         }
224
225         if (!target_ptr->resist_chaos || one_in_(9))
226         {
227                 inventory_damage(target_ptr, set_elec_destroy, 2);
228                 inventory_damage(target_ptr, set_fire_destroy, 2);
229         }
230
231         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
232 }
233
234
235 void effect_player_shards(player_type *target_ptr, effect_player_type *ep_ptr)
236 {
237         if (target_ptr->blind) msg_print(_("\89½\82©\89s\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp!"));
238         if (target_ptr->resist_shard)
239         {
240                 ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
241         }
242         else if (!CHECK_MULTISHADOW(target_ptr))
243         {
244                 (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
245         }
246
247         if (!target_ptr->resist_shard || one_in_(13))
248                 inventory_damage(target_ptr, set_cold_destroy, 2);
249
250         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
251 }
252
253
254 void effect_player_sound(player_type *target_ptr, effect_player_type *ep_ptr)
255 {
256         if (target_ptr->blind) msg_print(_("\8d\8c\89¹\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a loud noise!"));
257         if (target_ptr->resist_sound)
258         {
259                 ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
260         }
261         else if (!CHECK_MULTISHADOW(target_ptr))
262         {
263                 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
264                 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
265         }
266
267         if (!target_ptr->resist_sound || one_in_(13))
268                 inventory_damage(target_ptr, set_cold_destroy, 2);
269
270         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
271 }
272
273
274 /*!
275  * @brief \96\82\96@\82Ì\8cø\89Ê\82É\82æ\82Á\82Ä\97l\81X\82È\83\81\83b\83Z\81[\82ð\8fo\97Í\82µ\82½\82è\97^\82¦\82é\83_\83\81\81[\83W\82Ì\91\9d\8c¸\82ð\8ds\82Á\82½\82è\82·\82é
276  * @param target_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
277  * @param em_ptr \83v\83\8c\81[\83\84\81[\8cø\89Ê\8d\\91¢\91Ì\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
278  * @return \82È\82µ
279  */
280 void switch_effects_player(player_type *target_ptr, effect_player_type *ep_ptr)
281 {
282         switch (ep_ptr->effect_type)
283         {
284         case GF_ACID:
285                 effect_player_elements(target_ptr, ep_ptr, _("\8e_\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by acid!"), acid_dam);
286                 return;
287         case GF_FIRE:
288                 effect_player_elements(target_ptr, ep_ptr, _("\89Î\89\8a\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by fire!"), fire_dam);
289                 return;
290         case GF_COLD:
291                 effect_player_elements(target_ptr, ep_ptr, _("\97â\8bC\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by cold!"), cold_dam);
292                 return;
293         case GF_ELEC:
294                 effect_player_elements(target_ptr, ep_ptr, _("\93d\8c\82\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by lightning!"), elec_dam);
295                 return;
296         case GF_POIS:
297                 effect_player_poison(target_ptr, ep_ptr);
298                 return;
299         case GF_NUKE:
300                 effect_player_nuke(target_ptr, ep_ptr);
301                 return;
302         case GF_MISSILE:
303                 effect_player_missile(target_ptr, ep_ptr);
304                 return;
305         case GF_HOLY_FIRE:
306                 effect_player_holy_fire(target_ptr, ep_ptr);
307                 return;
308         case GF_HELL_FIRE:
309                 effect_player_hell_fire(target_ptr, ep_ptr);
310                 return;
311         case GF_ARROW:
312                 effect_player_arrow(target_ptr, ep_ptr);
313                 return;
314         case GF_PLASMA:
315                 effect_player_plasma(target_ptr, ep_ptr);
316                 return;
317         case GF_NETHER:
318                 effect_player_nether(target_ptr, ep_ptr);
319                 return;
320         case GF_WATER:
321                 effect_player_water(target_ptr, ep_ptr);
322                 return;
323         case GF_CHAOS:
324                 effect_player_chaos(target_ptr, ep_ptr);
325                 return;
326         case GF_SHARDS:
327                 effect_player_shards(target_ptr, ep_ptr);
328                 return;
329         case GF_SOUND:
330                 effect_player_sound(target_ptr, ep_ptr);
331                 return;
332         case GF_CONFUSION:
333         {
334                 if (target_ptr->blind) msg_print(_("\89½\82©\8d¬\97\90\82·\82é\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something puzzling!"));
335                 if (target_ptr->resist_conf)
336                 {
337                         ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
338                 }
339                 else if (!CHECK_MULTISHADOW(target_ptr))
340                 {
341                         (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
342                 }
343                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
344                 break;
345         }
346         case GF_DISENCHANT:
347         {
348                 if (target_ptr->blind) msg_print(_("\89½\82©\82³\82¦\82È\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something static!"));
349                 if (target_ptr->resist_disen)
350                 {
351                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
352                 }
353                 else if (!CHECK_MULTISHADOW(target_ptr))
354                 {
355                         (void)apply_disenchant(target_ptr, 0);
356                 }
357                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
358                 break;
359         }
360         case GF_NEXUS:
361         {
362                 if (target_ptr->blind) msg_print(_("\89½\82©\8aï\96­\82È\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something strange!"));
363                 if (target_ptr->resist_nexus)
364                 {
365                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
366                 }
367                 else if (!CHECK_MULTISHADOW(target_ptr))
368                 {
369                         apply_nexus(ep_ptr->m_ptr, target_ptr);
370                 }
371
372                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
373                 break;
374         }
375         case GF_FORCE:
376         {
377                 if (target_ptr->blind) msg_print(_("\89^\93®\83G\83l\83\8b\83M\81[\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by kinetic force!"));
378                 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
379                 {
380                         (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
381                 }
382
383                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
384                 break;
385         }
386         case GF_ROCKET:
387         {
388                 if (target_ptr->blind) msg_print(_("\94\9a\94­\82ª\82 \82Á\82½\81I", "There is an explosion!"));
389                 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
390                 {
391                         (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
392                 }
393
394                 if (target_ptr->resist_shard)
395                 {
396                         ep_ptr->dam /= 2;
397                 }
398                 else if (!CHECK_MULTISHADOW(target_ptr))
399                 {
400                         (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
401                 }
402
403                 if (!target_ptr->resist_shard || one_in_(12))
404                 {
405                         inventory_damage(target_ptr, set_cold_destroy, 3);
406                 }
407
408                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
409                 break;
410         }
411         case GF_INERTIAL:
412         {
413                 if (target_ptr->blind) msg_print(_("\89½\82©\92x\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something slow!"));
414                 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
415
416                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
417                 break;
418         }
419         case GF_LITE:
420         {
421                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
422                 if (target_ptr->resist_lite)
423                 {
424                         ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
425                 }
426                 else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
427                 {
428                         (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
429                 }
430
431                 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
432                 {
433                         if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("\8cõ\82Å\93÷\91Ì\82ª\8fÅ\82ª\82³\82ê\82½\81I", "The light scorches your flesh!"));
434                         ep_ptr->dam *= 2;
435                 }
436                 else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
437                 {
438                         ep_ptr->dam = ep_ptr->dam * 4 / 3;
439                 }
440
441                 if (target_ptr->wraith_form) ep_ptr->dam *= 2;
442                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
443
444                 if (!target_ptr->wraith_form || CHECK_MULTISHADOW(target_ptr))
445                         break;
446
447                 target_ptr->wraith_form = 0;
448                 msg_print(_("\91M\8cõ\82Ì\82½\82ß\94ñ\95¨\8e¿\93I\82È\89e\82Ì\91\8dÝ\82Å\82¢\82ç\82ê\82È\82­\82È\82Á\82½\81B",
449                         "The light forces you out of your incorporeal shadow form."));
450
451                 target_ptr->redraw |= (PR_MAP | PR_STATUS);
452                 target_ptr->update |= (PU_MONSTERS);
453                 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
454                 break;
455         }
456         case GF_DARK:
457         {
458                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
459                 if (target_ptr->resist_dark)
460                 {
461                         ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
462
463                         if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) ep_ptr->dam = 0;
464                 }
465                 else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
466                 {
467                         (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
468                 }
469
470                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
471                 break;
472         }
473         case GF_TIME:
474         {
475                 if (target_ptr->blind) msg_print(_("\89ß\8b\8e\82©\82ç\82Ì\8fÕ\8c\82\82É\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a blast from the past!"));
476
477                 if (target_ptr->resist_time)
478                 {
479                         ep_ptr->dam *= 4;
480                         ep_ptr->dam /= (randint1(4) + 7);
481                         msg_print(_("\8e\9e\8aÔ\82ª\92Ê\82è\89ß\82¬\82Ä\82¢\82­\8bC\82ª\82·\82é\81B", "You feel as if time is passing you by."));
482                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
483                         break;
484                 }
485
486                 if (CHECK_MULTISHADOW(target_ptr))
487                 {
488                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
489                         break;
490                 }
491
492                 switch (randint1(10))
493                 {
494                 case 1:
495                 case 2:
496                 case 3:
497                 case 4:
498                 case 5:
499                 {
500                         if (target_ptr->prace == RACE_ANDROID) break;
501
502                         msg_print(_("\90l\90\82ª\8bt\96ß\82è\82µ\82½\8bC\82ª\82·\82é\81B", "You feel like a chunk of the past has been ripped away."));
503                         lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
504                         break;
505                 }
506                 case 6:
507                 case 7:
508                 case 8:
509                 case 9:
510                 {
511                         int k = 0;
512                         concptr act = NULL;
513                         switch (randint1(6))
514                         {
515                         case 1: k = A_STR; act = _("\8b­\82­", "strong"); break;
516                         case 2: k = A_INT; act = _("\91\8f\96¾\82Å", "bright"); break;
517                         case 3: k = A_WIS; act = _("\8c«\96¾\82Å", "wise"); break;
518                         case 4: k = A_DEX; act = _("\8aí\97p\82Å", "agile"); break;
519                         case 5: k = A_CON; act = _("\8c\92\8dN\82Å", "hale"); break;
520                         case 6: k = A_CHR; act = _("\94ü\82µ\82­", "beautiful"); break;
521                         }
522
523                         msg_format(_("\82 \82È\82½\82Í\88È\91O\82Ù\82Ç%s\82È\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½...\81B", "You're not as %s as you used to be..."), act);
524                         target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
525                         if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
526
527                         target_ptr->update |= (PU_BONUS);
528                         break;
529                 }
530                 case 10:
531                 {
532                         msg_print(_("\82 \82È\82½\82Í\88È\91O\82Ù\82Ç\97Í\8b­\82­\82È\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½...\81B", "You're not as powerful as you used to be..."));
533                         for (int k = 0; k < A_MAX; k++)
534                         {
535                                 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
536                                 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
537                         }
538
539                         target_ptr->update |= (PU_BONUS);
540                         break;
541                 }
542                 }
543
544                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
545                 break;
546         }
547         case GF_GRAVITY:
548         {
549                 if (target_ptr->blind) msg_print(_("\89½\82©\8fd\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something heavy!"));
550                 msg_print(_("\8eü\95Ó\82Ì\8fd\97Í\82ª\82ä\82ª\82ñ\82¾\81B", "Gravity warps around you."));
551
552                 if (!CHECK_MULTISHADOW(target_ptr))
553                 {
554                         teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
555                         if (!target_ptr->levitation)
556                                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
557                         if (!(target_ptr->resist_sound || target_ptr->levitation))
558                         {
559                                 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
560                                 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
561                         }
562                 }
563
564                 if (target_ptr->levitation)
565                 {
566                         ep_ptr->dam = (ep_ptr->dam * 2) / 3;
567                 }
568
569                 if (!target_ptr->levitation || one_in_(13))
570                 {
571                         inventory_damage(target_ptr, set_cold_destroy, 2);
572                 }
573
574                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
575                 break;
576         }
577         case GF_DISINTEGRATE:
578         {
579                 if (target_ptr->blind) msg_print(_("\8f\83\90\88\82È\83G\83l\83\8b\83M\81[\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by pure energy!"));
580
581                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
582                 break;
583         }
584         case GF_OLD_HEAL:
585         {
586                 if (target_ptr->blind) msg_print(_("\89½\82ç\82©\82Ì\8dU\8c\82\82É\82æ\82Á\82Ä\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\81B", "You are hit by something invigorating!"));
587
588                 (void)hp_player(target_ptr, ep_ptr->dam);
589                 ep_ptr->dam = 0;
590                 break;
591         }
592         case GF_OLD_SPEED:
593         {
594                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
595                 (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
596                 ep_ptr->dam = 0;
597                 break;
598         }
599         case GF_OLD_SLOW:
600         {
601                 if (target_ptr->blind) msg_print(_("\89½\82©\92x\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something slow!"));
602                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
603                 break;
604         }
605         case GF_OLD_SLEEP:
606         {
607                 if (target_ptr->free_act)  break;
608                 if (target_ptr->blind) msg_print(_("\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I", "You fall asleep!"));
609
610                 if (ironman_nightmare)
611                 {
612                         msg_print(_("\8b°\82ë\82µ\82¢\8cõ\8ci\82ª\93ª\82É\95\82\82©\82ñ\82Å\82«\82½\81B", "A horrible vision enters your mind."));
613                         /* Have some nightmares */
614                         sanity_blast(target_ptr, NULL, FALSE);
615                 }
616
617                 set_paralyzed(target_ptr, target_ptr->paralyzed + ep_ptr->dam);
618                 ep_ptr->dam = 0;
619                 break;
620         }
621         case GF_MANA:
622         case GF_SEEKER:
623         case GF_SUPER_RAY:
624         {
625                 if (target_ptr->blind) msg_print(_("\96\82\96@\82Ì\83I\81[\83\89\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by an aura of magic!"));
626
627                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
628                 break;
629         }
630         case GF_PSY_SPEAR:
631         {
632                 if (target_ptr->blind) msg_print(_("\83G\83l\83\8b\83M\81[\82Ì\89ò\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by an energy!"));
633
634                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_FORCE, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
635                 break;
636         }
637         case GF_METEOR:
638         {
639                 if (target_ptr->blind) msg_print(_("\89½\82©\82ª\8bó\82©\82ç\82 \82È\82½\82Ì\93ª\8fã\82É\97\8e\82¿\82Ä\82«\82½\81I", "Something falls from the sky on you!"));
640
641                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
642                 if (!target_ptr->resist_shard || one_in_(13))
643                 {
644                         if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
645                         inventory_damage(target_ptr, set_cold_destroy, 2);
646                 }
647
648                 break;
649         }
650         case GF_ICE:
651         {
652                 if (target_ptr->blind) msg_print(_("\89½\82©\89s\82­\97â\82½\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something sharp and cold!"));
653
654                 ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
655                 if (CHECK_MULTISHADOW(target_ptr)) break;
656
657                 if (!target_ptr->resist_shard)
658                 {
659                         (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
660                 }
661
662                 if (!target_ptr->resist_sound)
663                 {
664                         (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
665                 }
666
667                 if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
668                 {
669                         if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
670                 }
671
672                 break;
673         }
674         case GF_DEATH_RAY:
675         {
676                 if (target_ptr->blind) msg_print(_("\89½\82©\94ñ\8fí\82É\97â\82½\82¢\82à\82Ì\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something extremely cold!"));
677
678                 if (target_ptr->mimic_form)
679                 {
680                         if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
681                                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
682
683                         break;
684                 }
685
686                 switch (target_ptr->prace)
687                 {
688                 case RACE_GOLEM:
689                 case RACE_SKELETON:
690                 case RACE_ZOMBIE:
691                 case RACE_VAMPIRE:
692                 case RACE_DEMON:
693                 case RACE_SPECTRE:
694                 {
695                         ep_ptr->dam = 0;
696                         break;
697                 }
698                 default:
699                 {
700                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
701                         break;
702                 }
703                 }
704
705                 break;
706         }
707         case GF_DRAIN_MANA:
708         {
709                 if (CHECK_MULTISHADOW(target_ptr))
710                 {
711                         msg_print(_("\8dU\8c\82\82Í\8c\89e\82É\96½\92\86\82µ\81A\82 \82È\82½\82É\82Í\93Í\82©\82È\82©\82Á\82½\81B", "The attack hits Shadow, but you are unharmed!"));
712                         ep_ptr->dam = 0;
713                         break;
714                 }
715
716                 if (target_ptr->csp == 0)
717                 {
718                         ep_ptr->dam = 0;
719                         break;
720                 }
721
722                 if (ep_ptr->who > 0)
723                         msg_format(_("%^s\82É\90¸\90_\83G\83l\83\8b\83M\81[\82ð\8bz\82¢\8eæ\82ç\82ê\82Ä\82µ\82Ü\82Á\82½\81I", "%^s draws psychic energy from you!"), ep_ptr->m_name);
724                 else
725                         msg_print(_("\90¸\90_\83G\83l\83\8b\83M\81[\82ð\8bz\82¢\8eæ\82ç\82ê\82Ä\82µ\82Ü\82Á\82½\81I", "Your psychic energy is drawn!"));
726
727                 if (ep_ptr->dam >= target_ptr->csp)
728                 {
729                         ep_ptr->dam = target_ptr->csp;
730                         target_ptr->csp = 0;
731                         target_ptr->csp_frac = 0;
732                 }
733                 else
734                 {
735                         target_ptr->csp -= ep_ptr->dam;
736                 }
737
738                 learn_spell(target_ptr, ep_ptr->monspell);
739                 target_ptr->redraw |= (PR_MANA);
740                 target_ptr->window |= (PW_PLAYER | PW_SPELL);
741
742                 if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp))
743                 {
744                         ep_ptr->dam = 0;
745                         break;
746                 }
747
748                 ep_ptr->m_ptr->hp += ep_ptr->dam;
749                 if (ep_ptr->m_ptr->hp > ep_ptr->m_ptr->maxhp) ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp;
750
751                 if (target_ptr->health_who == ep_ptr->who) target_ptr->redraw |= (PR_HEALTH);
752                 if (target_ptr->riding == ep_ptr->who) target_ptr->redraw |= (PR_UHEALTH);
753
754                 if (ep_ptr->m_ptr->ml)
755                 {
756                         msg_format(_("%^s\82Í\8bC\95ª\82ª\97Ç\82³\82»\82¤\82¾\81B", "%^s appears healthier."), ep_ptr->m_name);
757                 }
758
759                 ep_ptr->dam = 0;
760                 break;
761         }
762         case GF_MIND_BLAST:
763         {
764                 if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
765                 {
766                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
767                         learn_spell(target_ptr, ep_ptr->monspell);
768                         break;
769                 }
770
771                 if (CHECK_MULTISHADOW(target_ptr))
772                 {
773                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
774                         break;
775                 }
776
777                 msg_print(_("\97ì\93I\83G\83l\83\8b\83M\81[\82Å\90¸\90_\82ª\8dU\8c\82\82³\82ê\82½\81B", "Your mind is blasted by psionic energy."));
778                 if (!target_ptr->resist_conf)
779                 {
780                         (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
781                 }
782
783                 if (!target_ptr->resist_chaos && one_in_(3))
784                 {
785                         (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
786                 }
787
788                 target_ptr->csp -= 50;
789                 if (target_ptr->csp < 0)
790                 {
791                         target_ptr->csp = 0;
792                         target_ptr->csp_frac = 0;
793                 }
794
795                 target_ptr->redraw |= PR_MANA;
796                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
797                 break;
798         }
799         case GF_BRAIN_SMASH:
800         {
801                 if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
802                 {
803                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
804                         learn_spell(target_ptr, ep_ptr->monspell);
805                         break;
806                 }
807
808                 if (!CHECK_MULTISHADOW(target_ptr))
809                 {
810                         msg_print(_("\97ì\93I\83G\83l\83\8b\83M\81[\82Å\90¸\90_\82ª\8dU\8c\82\82³\82ê\82½\81B", "Your mind is blasted by psionic energy."));
811
812                         target_ptr->csp -= 100;
813                         if (target_ptr->csp < 0)
814                         {
815                                 target_ptr->csp = 0;
816                                 target_ptr->csp_frac = 0;
817                         }
818                         target_ptr->redraw |= PR_MANA;
819                 }
820
821                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
822                 if (CHECK_MULTISHADOW(target_ptr)) break;
823
824                 if (!target_ptr->resist_blind)
825                 {
826                         (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
827                 }
828
829                 if (!target_ptr->resist_conf)
830                 {
831                         (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
832                 }
833
834                 if (!target_ptr->free_act)
835                 {
836                         (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
837                 }
838
839                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
840
841                 while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
842                         (void)do_dec_stat(target_ptr, A_INT);
843                 while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
844                         (void)do_dec_stat(target_ptr, A_WIS);
845
846                 if (!target_ptr->resist_chaos)
847                 {
848                         (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
849                 }
850
851                 break;
852         }
853         case GF_CAUSE_1:
854         {
855                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
856                 {
857                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
858                         learn_spell(target_ptr, ep_ptr->monspell);
859                 }
860                 else
861                 {
862                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 15, 0);
863                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
864                 }
865                 break;
866         }
867         case GF_CAUSE_2:
868         {
869                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
870                 {
871                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
872                         learn_spell(target_ptr, ep_ptr->monspell);
873                 }
874                 else
875                 {
876                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 25, MIN(ep_ptr->rlev / 2 - 15, 5));
877                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
878                 }
879                 break;
880         }
881         case GF_CAUSE_3:
882         {
883                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
884                 {
885                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
886                         learn_spell(target_ptr, ep_ptr->monspell);
887                 }
888                 else
889                 {
890                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 33, MIN(ep_ptr->rlev / 2 - 15, 15));
891                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
892                 }
893                 break;
894         }
895         case GF_CAUSE_4:
896         {
897                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !(ep_ptr->m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
898                 {
899                         msg_print(_("\82µ\82©\82µ\94é\8dE\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
900                         learn_spell(target_ptr, ep_ptr->monspell);
901                 }
902                 else
903                 {
904                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
905                         if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
906                 }
907
908                 break;
909         }
910         case GF_HAND_DOOM:
911         {
912                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
913                 {
914                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
915                         learn_spell(target_ptr, ep_ptr->monspell);
916                 }
917                 else
918                 {
919                         if (!CHECK_MULTISHADOW(target_ptr))
920                         {
921                                 msg_print(_("\82 \82È\82½\82Í\96½\82ª\94\96\82Ü\82Á\82Ä\82¢\82­\82æ\82¤\82É\8a´\82\82½\81I", "You feel your life fade away!"));
922                                 curse_equipment(target_ptr, 40, 20);
923                         }
924
925                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->m_name, ep_ptr->monspell);
926
927                         if (target_ptr->chp < 1) target_ptr->chp = 1;
928                 }
929
930                 break;
931         }
932         default:
933         {
934                 ep_ptr->dam = 0;
935                 break;
936         }
937         }
938 }