OSDN Git Service

[Refactor] #39963 Separated effect_player_plasma+nether() from switch_effects_player()
[hengband/hengband.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_file(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 /*!
165  * @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é
166  * @param target_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
167  * @param em_ptr \83v\83\8c\81[\83\84\81[\8cø\89Ê\8d\\91¢\91Ì\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
168  * @return \82È\82µ
169  */
170 void switch_effects_player(player_type *target_ptr, effect_player_type *ep_ptr)
171 {
172         switch (ep_ptr->effect_type)
173         {
174         case GF_ACID:
175                 effect_player_elements(target_ptr, ep_ptr, _("\8e_\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by acid!"), acid_dam);
176                 return;
177         case GF_FIRE:
178                 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);
179                 return;
180         case GF_COLD:
181                 effect_player_elements(target_ptr, ep_ptr, _("\97â\8bC\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by cold!"), cold_dam);
182                 return;
183         case GF_ELEC:
184                 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);
185                 return;
186         case GF_POIS:
187                 effect_player_poison(target_ptr, ep_ptr);
188                 return;
189         case GF_NUKE:
190                 effect_player_nuke(target_ptr, ep_ptr);
191                 return;
192         case GF_MISSILE:
193                 effect_player_missile(target_ptr, ep_ptr);
194                 return;
195         case GF_HOLY_FIRE:
196                 effect_player_holy_file(target_ptr, ep_ptr);
197                 return;
198         case GF_HELL_FIRE:
199                 effect_plyaer_hell_fire(target_ptr, ep_ptr);
200         case GF_ARROW:
201                 effect_player_arrow(target_ptr, ep_ptr);
202         case GF_PLASMA:
203                 effect_player_plasma(target_ptr, ep_ptr);
204         case GF_NETHER:
205                 effect_player_nether(target_ptr, ep_ptr);
206         case GF_WATER:
207         {
208                 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!"));
209                 if (CHECK_MULTISHADOW(target_ptr))
210                 {
211                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
212                         break;
213                 }
214
215                 if (!target_ptr->resist_sound && !target_ptr->resist_water)
216                 {
217                         set_stun(target_ptr, target_ptr->stun + randint1(40));
218                 }
219                 if (!target_ptr->resist_conf && !target_ptr->resist_water)
220                 {
221                         set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
222                 }
223
224                 if (one_in_(5) && !target_ptr->resist_water)
225                 {
226                         inventory_damage(target_ptr, set_cold_destroy, 3);
227                 }
228
229                 if (target_ptr->resist_water) ep_ptr->get_damage /= 4;
230
231                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
232                 break;
233         }
234         case GF_CHAOS:
235         {
236                 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!"));
237                 if (target_ptr->resist_chaos)
238                 {
239                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
240                 }
241
242                 if (CHECK_MULTISHADOW(target_ptr))
243                 {
244                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
245                         break;
246                 }
247
248                 if (!target_ptr->resist_conf)
249                 {
250                         (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
251                 }
252                 if (!target_ptr->resist_chaos)
253                 {
254                         (void)set_image(target_ptr, target_ptr->image + randint1(10));
255                         if (one_in_(3))
256                         {
257                                 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!"));
258                                 (void)gain_mutation(target_ptr, 0);
259                         }
260                 }
261                 if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
262                 {
263                         drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
264                 }
265
266                 if (!target_ptr->resist_chaos || one_in_(9))
267                 {
268                         inventory_damage(target_ptr, set_elec_destroy, 2);
269                         inventory_damage(target_ptr, set_fire_destroy, 2);
270                 }
271
272                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
273                 break;
274         }
275         case GF_SHARDS:
276         {
277                 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!"));
278                 if (target_ptr->resist_shard)
279                 {
280                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
281                 }
282                 else if (!CHECK_MULTISHADOW(target_ptr))
283                 {
284                         (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
285                 }
286
287                 if (!target_ptr->resist_shard || one_in_(13))
288                 {
289                         inventory_damage(target_ptr, set_cold_destroy, 2);
290                 }
291
292                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
293                 break;
294         }
295         case GF_SOUND:
296         {
297                 if (target_ptr->blind) msg_print(_("\8d\8c\89¹\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by a loud noise!"));
298                 if (target_ptr->resist_sound)
299                 {
300                         ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
301                 }
302                 else if (!CHECK_MULTISHADOW(target_ptr))
303                 {
304                         int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
305                         (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
306                 }
307
308                 if (!target_ptr->resist_sound || one_in_(13))
309                 {
310                         inventory_damage(target_ptr, set_cold_destroy, 2);
311                 }
312
313                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
314                 break;
315         }
316         case GF_CONFUSION:
317         {
318                 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!"));
319                 if (target_ptr->resist_conf)
320                 {
321                         ep_ptr->dam *= 5; ep_ptr->dam /= (randint1(4) + 7);
322                 }
323                 else if (!CHECK_MULTISHADOW(target_ptr))
324                 {
325                         (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
326                 }
327                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
328                 break;
329         }
330         case GF_DISENCHANT:
331         {
332                 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!"));
333                 if (target_ptr->resist_disen)
334                 {
335                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
336                 }
337                 else if (!CHECK_MULTISHADOW(target_ptr))
338                 {
339                         (void)apply_disenchant(target_ptr, 0);
340                 }
341                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
342                 break;
343         }
344         case GF_NEXUS:
345         {
346                 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!"));
347                 if (target_ptr->resist_nexus)
348                 {
349                         ep_ptr->dam *= 6; ep_ptr->dam /= (randint1(4) + 7);
350                 }
351                 else if (!CHECK_MULTISHADOW(target_ptr))
352                 {
353                         apply_nexus(ep_ptr->m_ptr, target_ptr);
354                 }
355
356                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
357                 break;
358         }
359         case GF_FORCE:
360         {
361                 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!"));
362                 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
363                 {
364                         (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
365                 }
366
367                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
368                 break;
369         }
370         case GF_ROCKET:
371         {
372                 if (target_ptr->blind) msg_print(_("\94\9a\94­\82ª\82 \82Á\82½\81I", "There is an explosion!"));
373                 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
374                 {
375                         (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
376                 }
377
378                 if (target_ptr->resist_shard)
379                 {
380                         ep_ptr->dam /= 2;
381                 }
382                 else if (!CHECK_MULTISHADOW(target_ptr))
383                 {
384                         (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
385                 }
386
387                 if (!target_ptr->resist_shard || one_in_(12))
388                 {
389                         inventory_damage(target_ptr, set_cold_destroy, 3);
390                 }
391
392                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
393                 break;
394         }
395         case GF_INERTIAL:
396         {
397                 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!"));
398                 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
399
400                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
401                 break;
402         }
403         case GF_LITE:
404         {
405                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
406                 if (target_ptr->resist_lite)
407                 {
408                         ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
409                 }
410                 else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
411                 {
412                         (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
413                 }
414
415                 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
416                 {
417                         if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("\8cõ\82Å\93÷\91Ì\82ª\8fÅ\82ª\82³\82ê\82½\81I", "The light scorches your flesh!"));
418                         ep_ptr->dam *= 2;
419                 }
420                 else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
421                 {
422                         ep_ptr->dam = ep_ptr->dam * 4 / 3;
423                 }
424
425                 if (target_ptr->wraith_form) ep_ptr->dam *= 2;
426                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
427
428                 if (!target_ptr->wraith_form || CHECK_MULTISHADOW(target_ptr))
429                         break;
430
431                 target_ptr->wraith_form = 0;
432                 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",
433                         "The light forces you out of your incorporeal shadow form."));
434
435                 target_ptr->redraw |= (PR_MAP | PR_STATUS);
436                 target_ptr->update |= (PU_MONSTERS);
437                 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
438                 break;
439         }
440         case GF_DARK:
441         {
442                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
443                 if (target_ptr->resist_dark)
444                 {
445                         ep_ptr->dam *= 4; ep_ptr->dam /= (randint1(4) + 7);
446
447                         if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) ep_ptr->dam = 0;
448                 }
449                 else if (!target_ptr->blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
450                 {
451                         (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
452                 }
453
454                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
455                 break;
456         }
457         case GF_TIME:
458         {
459                 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!"));
460
461                 if (target_ptr->resist_time)
462                 {
463                         ep_ptr->dam *= 4;
464                         ep_ptr->dam /= (randint1(4) + 7);
465                         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."));
466                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
467                         break;
468                 }
469
470                 if (CHECK_MULTISHADOW(target_ptr))
471                 {
472                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
473                         break;
474                 }
475
476                 switch (randint1(10))
477                 {
478                 case 1:
479                 case 2:
480                 case 3:
481                 case 4:
482                 case 5:
483                 {
484                         if (target_ptr->prace == RACE_ANDROID) break;
485
486                         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."));
487                         lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
488                         break;
489                 }
490                 case 6:
491                 case 7:
492                 case 8:
493                 case 9:
494                 {
495                         int k = 0;
496                         concptr act = NULL;
497                         switch (randint1(6))
498                         {
499                         case 1: k = A_STR; act = _("\8b­\82­", "strong"); break;
500                         case 2: k = A_INT; act = _("\91\8f\96¾\82Å", "bright"); break;
501                         case 3: k = A_WIS; act = _("\8c«\96¾\82Å", "wise"); break;
502                         case 4: k = A_DEX; act = _("\8aí\97p\82Å", "agile"); break;
503                         case 5: k = A_CON; act = _("\8c\92\8dN\82Å", "hale"); break;
504                         case 6: k = A_CHR; act = _("\94ü\82µ\82­", "beautiful"); break;
505                         }
506
507                         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);
508                         target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
509                         if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
510
511                         target_ptr->update |= (PU_BONUS);
512                         break;
513                 }
514                 case 10:
515                 {
516                         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..."));
517                         for (int k = 0; k < A_MAX; k++)
518                         {
519                                 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
520                                 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
521                         }
522
523                         target_ptr->update |= (PU_BONUS);
524                         break;
525                 }
526                 }
527
528                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
529                 break;
530         }
531         case GF_GRAVITY:
532         {
533                 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!"));
534                 msg_print(_("\8eü\95Ó\82Ì\8fd\97Í\82ª\82ä\82ª\82ñ\82¾\81B", "Gravity warps around you."));
535
536                 if (!CHECK_MULTISHADOW(target_ptr))
537                 {
538                         teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
539                         if (!target_ptr->levitation)
540                                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
541                         if (!(target_ptr->resist_sound || target_ptr->levitation))
542                         {
543                                 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
544                                 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
545                         }
546                 }
547
548                 if (target_ptr->levitation)
549                 {
550                         ep_ptr->dam = (ep_ptr->dam * 2) / 3;
551                 }
552
553                 if (!target_ptr->levitation || one_in_(13))
554                 {
555                         inventory_damage(target_ptr, set_cold_destroy, 2);
556                 }
557
558                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
559                 break;
560         }
561         case GF_DISINTEGRATE:
562         {
563                 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!"));
564
565                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
566                 break;
567         }
568         case GF_OLD_HEAL:
569         {
570                 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!"));
571
572                 (void)hp_player(target_ptr, ep_ptr->dam);
573                 ep_ptr->dam = 0;
574                 break;
575         }
576         case GF_OLD_SPEED:
577         {
578                 if (target_ptr->blind) msg_print(_("\89½\82©\82Å\8dU\8c\82\82³\82ê\82½\81I", "You are hit by something!"));
579                 (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
580                 ep_ptr->dam = 0;
581                 break;
582         }
583         case GF_OLD_SLOW:
584         {
585                 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!"));
586                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
587                 break;
588         }
589         case GF_OLD_SLEEP:
590         {
591                 if (target_ptr->free_act)  break;
592                 if (target_ptr->blind) msg_print(_("\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I", "You fall asleep!"));
593
594                 if (ironman_nightmare)
595                 {
596                         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."));
597                         /* Have some nightmares */
598                         sanity_blast(target_ptr, NULL, FALSE);
599                 }
600
601                 set_paralyzed(target_ptr, target_ptr->paralyzed + ep_ptr->dam);
602                 ep_ptr->dam = 0;
603                 break;
604         }
605         case GF_MANA:
606         case GF_SEEKER:
607         case GF_SUPER_RAY:
608         {
609                 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!"));
610
611                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
612                 break;
613         }
614         case GF_PSY_SPEAR:
615         {
616                 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!"));
617
618                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_FORCE, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
619                 break;
620         }
621         case GF_METEOR:
622         {
623                 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!"));
624
625                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
626                 if (!target_ptr->resist_shard || one_in_(13))
627                 {
628                         if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
629                         inventory_damage(target_ptr, set_cold_destroy, 2);
630                 }
631
632                 break;
633         }
634         case GF_ICE:
635         {
636                 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!"));
637
638                 ep_ptr->get_damage = cold_dam(target_ptr, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell, FALSE);
639                 if (CHECK_MULTISHADOW(target_ptr)) break;
640
641                 if (!target_ptr->resist_shard)
642                 {
643                         (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
644                 }
645
646                 if (!target_ptr->resist_sound)
647                 {
648                         (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
649                 }
650
651                 if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
652                 {
653                         if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
654                 }
655
656                 break;
657         }
658         case GF_DEATH_RAY:
659         {
660                 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!"));
661
662                 if (target_ptr->mimic_form)
663                 {
664                         if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
665                                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
666
667                         break;
668                 }
669
670                 switch (target_ptr->prace)
671                 {
672                 case RACE_GOLEM:
673                 case RACE_SKELETON:
674                 case RACE_ZOMBIE:
675                 case RACE_VAMPIRE:
676                 case RACE_DEMON:
677                 case RACE_SPECTRE:
678                 {
679                         ep_ptr->dam = 0;
680                         break;
681                 }
682                 default:
683                 {
684                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
685                         break;
686                 }
687                 }
688
689                 break;
690         }
691         case GF_DRAIN_MANA:
692         {
693                 if (CHECK_MULTISHADOW(target_ptr))
694                 {
695                         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!"));
696                         ep_ptr->dam = 0;
697                         break;
698                 }
699
700                 if (target_ptr->csp == 0)
701                 {
702                         ep_ptr->dam = 0;
703                         break;
704                 }
705
706                 if (ep_ptr->who > 0)
707                         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);
708                 else
709                         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!"));
710
711                 if (ep_ptr->dam >= target_ptr->csp)
712                 {
713                         ep_ptr->dam = target_ptr->csp;
714                         target_ptr->csp = 0;
715                         target_ptr->csp_frac = 0;
716                 }
717                 else
718                 {
719                         target_ptr->csp -= ep_ptr->dam;
720                 }
721
722                 learn_spell(target_ptr, ep_ptr->monspell);
723                 target_ptr->redraw |= (PR_MANA);
724                 target_ptr->window |= (PW_PLAYER | PW_SPELL);
725
726                 if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp))
727                 {
728                         ep_ptr->dam = 0;
729                         break;
730                 }
731
732                 ep_ptr->m_ptr->hp += ep_ptr->dam;
733                 if (ep_ptr->m_ptr->hp > ep_ptr->m_ptr->maxhp) ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp;
734
735                 if (target_ptr->health_who == ep_ptr->who) target_ptr->redraw |= (PR_HEALTH);
736                 if (target_ptr->riding == ep_ptr->who) target_ptr->redraw |= (PR_UHEALTH);
737
738                 if (ep_ptr->m_ptr->ml)
739                 {
740                         msg_format(_("%^s\82Í\8bC\95ª\82ª\97Ç\82³\82»\82¤\82¾\81B", "%^s appears healthier."), ep_ptr->m_name);
741                 }
742
743                 ep_ptr->dam = 0;
744                 break;
745         }
746         case GF_MIND_BLAST:
747         {
748                 if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
749                 {
750                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
751                         learn_spell(target_ptr, ep_ptr->monspell);
752                         break;
753                 }
754
755                 if (CHECK_MULTISHADOW(target_ptr))
756                 {
757                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
758                         break;
759                 }
760
761                 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."));
762                 if (!target_ptr->resist_conf)
763                 {
764                         (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
765                 }
766
767                 if (!target_ptr->resist_chaos && one_in_(3))
768                 {
769                         (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
770                 }
771
772                 target_ptr->csp -= 50;
773                 if (target_ptr->csp < 0)
774                 {
775                         target_ptr->csp = 0;
776                         target_ptr->csp_frac = 0;
777                 }
778
779                 target_ptr->redraw |= PR_MANA;
780                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
781                 break;
782         }
783         case GF_BRAIN_SMASH:
784         {
785                 if ((randint0(100 + ep_ptr->rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
786                 {
787                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
788                         learn_spell(target_ptr, ep_ptr->monspell);
789                         break;
790                 }
791
792                 if (!CHECK_MULTISHADOW(target_ptr))
793                 {
794                         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."));
795
796                         target_ptr->csp -= 100;
797                         if (target_ptr->csp < 0)
798                         {
799                                 target_ptr->csp = 0;
800                                 target_ptr->csp_frac = 0;
801                         }
802                         target_ptr->redraw |= PR_MANA;
803                 }
804
805                 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
806                 if (CHECK_MULTISHADOW(target_ptr)) break;
807
808                 if (!target_ptr->resist_blind)
809                 {
810                         (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
811                 }
812
813                 if (!target_ptr->resist_conf)
814                 {
815                         (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
816                 }
817
818                 if (!target_ptr->free_act)
819                 {
820                         (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
821                 }
822
823                 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
824
825                 while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
826                         (void)do_dec_stat(target_ptr, A_INT);
827                 while (randint0(100 + ep_ptr->rlev / 2) > (MAX(5, target_ptr->skill_sav)))
828                         (void)do_dec_stat(target_ptr, A_WIS);
829
830                 if (!target_ptr->resist_chaos)
831                 {
832                         (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
833                 }
834
835                 break;
836         }
837         case GF_CAUSE_1:
838         {
839                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
840                 {
841                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
842                         learn_spell(target_ptr, ep_ptr->monspell);
843                 }
844                 else
845                 {
846                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 15, 0);
847                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
848                 }
849                 break;
850         }
851         case GF_CAUSE_2:
852         {
853                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
854                 {
855                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
856                         learn_spell(target_ptr, ep_ptr->monspell);
857                 }
858                 else
859                 {
860                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 25, MIN(ep_ptr->rlev / 2 - 15, 5));
861                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
862                 }
863                 break;
864         }
865         case GF_CAUSE_3:
866         {
867                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
868                 {
869                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
870                         learn_spell(target_ptr, ep_ptr->monspell);
871                 }
872                 else
873                 {
874                         if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 33, MIN(ep_ptr->rlev / 2 - 15, 15));
875                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
876                 }
877                 break;
878         }
879         case GF_CAUSE_4:
880         {
881                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !(ep_ptr->m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
882                 {
883                         msg_print(_("\82µ\82©\82µ\94é\8dE\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
884                         learn_spell(target_ptr, ep_ptr->monspell);
885                 }
886                 else
887                 {
888                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->killer, ep_ptr->monspell);
889                         if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
890                 }
891
892                 break;
893         }
894         case GF_HAND_DOOM:
895         {
896                 if ((randint0(100 + ep_ptr->rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
897                 {
898                         msg_print(_("\82µ\82©\82µ\8cø\97Í\82ð\92µ\82Ë\95Ô\82µ\82½\81I", "You resist the effects!"));
899                         learn_spell(target_ptr, ep_ptr->monspell);
900                 }
901                 else
902                 {
903                         if (!CHECK_MULTISHADOW(target_ptr))
904                         {
905                                 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!"));
906                                 curse_equipment(target_ptr, 40, 20);
907                         }
908
909                         ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam, ep_ptr->m_name, ep_ptr->monspell);
910
911                         if (target_ptr->chp < 1) target_ptr->chp = 1;
912                 }
913
914                 break;
915         }
916         default:
917         {
918                 ep_ptr->dam = 0;
919                 break;
920         }
921         }
922 }