OSDN Git Service

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