OSDN Git Service

忍者の超隠密は解かれる時は一瞬で解かれ, 超隠密に入る時は手間がかかる
[hengband/hengband.git] / src / spells1.c
1 /* File: spells1.c */
2
3 /*
4  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
5  *
6  * This software may be copied and distributed for educational, research,
7  * and not for profit purposes provided that this copyright and statement
8  * are included in all such copies.  Other copyrights may also apply.
9  */
10
11 /* Purpose: Spell projection */
12
13 #include "angband.h"
14
15 /* ToDo: Make this global */
16 /* 1/x chance of reducing stats (for elemental attacks) */
17 #define HURT_CHANCE 16
18
19
20 static int rakubadam_m;
21 static int rakubadam_p;
22
23 int project_length = 0;
24
25 /*
26  * Get another mirror. for SEEKER 
27  */
28 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
29 {
30         int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
31         int mirror_num=0;              /* ¶À¤Î¿ô */
32         int x,y;
33         int num;
34
35         for( x=0 ; x < cur_wid ; x++ )
36         {
37                 for( y=0 ; y < cur_hgt ; y++ )
38                 {
39                         if( is_mirror_grid(&cave[y][x])){
40                                 mirror_y[mirror_num]=y;
41                                 mirror_x[mirror_num]=x;
42                                 mirror_num++;
43                         }
44                 }
45         }
46         if( mirror_num )
47         {
48                 num=randint0(mirror_num);
49                 *next_y=mirror_y[num];
50                 *next_x=mirror_x[num];
51                 return;
52         }
53         *next_y=cury+randint0(5)-2;
54         *next_x=curx+randint0(5)-2;
55         return;
56 }
57                 
58 /*
59  * Get a legal "multi-hued" color for drawing "spells"
60  */
61 static byte mh_attr(int max)
62 {
63         switch (randint1(max))
64         {
65                 case  1: return (TERM_RED);
66                 case  2: return (TERM_GREEN);
67                 case  3: return (TERM_BLUE);
68                 case  4: return (TERM_YELLOW);
69                 case  5: return (TERM_ORANGE);
70                 case  6: return (TERM_VIOLET);
71                 case  7: return (TERM_L_RED);
72                 case  8: return (TERM_L_GREEN);
73                 case  9: return (TERM_L_BLUE);
74                 case 10: return (TERM_UMBER);
75                 case 11: return (TERM_L_UMBER);
76                 case 12: return (TERM_SLATE);
77                 case 13: return (TERM_WHITE);
78                 case 14: return (TERM_L_WHITE);
79                 case 15: return (TERM_L_DARK);
80         }
81
82         return (TERM_WHITE);
83 }
84
85
86 /*
87  * Return a color to use for the bolt/ball spells
88  */
89 static byte spell_color(int type)
90 {
91         /* Check if A.B.'s new graphics should be used (rr9) */
92         if (streq(ANGBAND_GRAF, "new"))
93         {
94                 /* Analyze */
95                 switch (type)
96                 {
97                         case GF_PSY_SPEAR:      return (0x06);
98                         case GF_MISSILE:        return (0x0F);
99                         case GF_ACID:           return (0x04);
100                         case GF_ELEC:           return (0x02);
101                         case GF_FIRE:           return (0x00);
102                         case GF_COLD:           return (0x01);
103                         case GF_POIS:           return (0x03);
104                         case GF_HOLY_FIRE:      return (0x00);
105                         case GF_HELL_FIRE:      return (0x00);
106                         case GF_MANA:           return (0x0E);
107                           /* by henkma */
108                         case GF_SEEKER:         return (0x0E);
109                         case GF_SUPER_RAY:      return (0x0E);
110
111                         case GF_ARROW:          return (0x0F);
112                         case GF_WATER:          return (0x04);
113                         case GF_NETHER:         return (0x07);
114                         case GF_CHAOS:          return (mh_attr(15));
115                         case GF_DISENCHANT:     return (0x05);
116                         case GF_NEXUS:          return (0x0C);
117                         case GF_CONFUSION:      return (mh_attr(4));
118                         case GF_SOUND:          return (0x09);
119                         case GF_SHARDS:         return (0x08);
120                         case GF_FORCE:          return (0x09);
121                         case GF_INERTIA:        return (0x09);
122                         case GF_GRAVITY:        return (0x09);
123                         case GF_TIME:           return (0x09);
124                         case GF_LITE_WEAK:      return (0x06);
125                         case GF_LITE:           return (0x06);
126                         case GF_DARK_WEAK:      return (0x07);
127                         case GF_DARK:           return (0x07);
128                         case GF_PLASMA:         return (0x0B);
129                         case GF_METEOR:         return (0x00);
130                         case GF_ICE:            return (0x01);
131                         case GF_ROCKET:         return (0x0F);
132                         case GF_DEATH_RAY:      return (0x07);
133                         case GF_NUKE:           return (mh_attr(2));
134                         case GF_DISINTEGRATE:   return (0x05);
135                         case GF_PSI:
136                         case GF_PSI_DRAIN:
137                         case GF_TELEKINESIS:
138                         case GF_DOMINATION:
139                         case GF_DRAIN_MANA:
140                         case GF_MIND_BLAST:
141                         case GF_BRAIN_SMASH:
142                                                 return (0x09);
143                         case GF_CAUSE_1:
144                         case GF_CAUSE_2:
145                         case GF_CAUSE_3:
146                         case GF_CAUSE_4:        return (0x0E);
147                         case GF_HAND_DOOM:      return (0x07);
148                         case GF_CAPTURE  :      return (0x0E);
149                         case GF_IDENTIFY:       return (0x01);
150                         case GF_ATTACK:        return (0x0F);
151                         case GF_PHOTO   :      return (0x06);
152                 }
153         }
154         /* Normal tiles or ASCII */
155         else
156         {
157                 byte a;
158                 char c;
159
160                 /* Lookup the default colors for this type */
161                 cptr s = quark_str(gf_color[type]);
162
163                 /* Oops */
164                 if (!s) return (TERM_WHITE);
165
166                 /* Pick a random color */
167                 c = s[randint0(strlen(s))];
168
169                 /* Lookup this color */
170                 a = my_strchr(color_char, c) - color_char;
171
172                 /* Invalid color (note check for < 0 removed, gave a silly
173                  * warning because bytes are always >= 0 -- RG) */
174                 if (a > 15) return (TERM_WHITE);
175
176                 /* Use this color */
177                 return (a);
178         }
179
180         /* Standard "color" */
181         return (TERM_WHITE);
182 }
183
184
185 /*
186  * Find the attr/char pair to use for a spell effect
187  *
188  * It is moving (or has moved) from (x,y) to (nx,ny).
189  *
190  * If the distance is not "one", we (may) return "*".
191  */
192 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
193 {
194         int base;
195
196         byte k;
197
198         byte a;
199         char c;
200
201         /* No motion (*) */
202         if ((ny == y) && (nx == x)) base = 0x30;
203
204         /* Vertical (|) */
205         else if (nx == x) base = 0x40;
206
207         /* Horizontal (-) */
208         else if (ny == y) base = 0x50;
209
210         /* Diagonal (/) */
211         else if ((ny - y) == (x - nx)) base = 0x60;
212
213         /* Diagonal (\) */
214         else if ((ny - y) == (nx - x)) base = 0x70;
215
216         /* Weird (*) */
217         else base = 0x30;
218
219         /* Basic spell color */
220         k = spell_color(typ);
221
222         /* Obtain attr/char */
223         a = misc_to_attr[base + k];
224         c = misc_to_char[base + k];
225
226         /* Create pict */
227         return (PICT(a, c));
228 }
229
230
231 /*
232  * Determine the path taken by a projection.
233  *
234  * The projection will always start from the grid (y1,x1), and will travel
235  * towards the grid (y2,x2), touching one grid per unit of distance along
236  * the major axis, and stopping when it enters the destination grid or a
237  * wall grid, or has travelled the maximum legal distance of "range".
238  *
239  * Note that "distance" in this function (as in the "update_view()" code)
240  * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
241  * actually has an "octagon of projection" not a "circle of projection".
242  *
243  * The path grids are saved into the grid array pointed to by "gp", and
244  * there should be room for at least "range" grids in "gp".  Note that
245  * due to the way in which distance is calculated, this function normally
246  * uses fewer than "range" grids for the projection path, so the result
247  * of this function should never be compared directly to "range".  Note
248  * that the initial grid (y1,x1) is never saved into the grid array, not
249  * even if the initial grid is also the final grid.  XXX XXX XXX
250  *
251  * The "flg" flags can be used to modify the behavior of this function.
252  *
253  * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
254  * semantics as they do for the "project" function, namely, that the path
255  * will stop as soon as it hits a monster, or that the path will continue
256  * through the destination grid, respectively.
257  *
258  * The "PROJECT_JUMP" flag, which for the "project()" function means to
259  * start at a special grid (which makes no sense in this function), means
260  * that the path should be "angled" slightly if needed to avoid any wall
261  * grids, allowing the player to "target" any grid which is in "view".
262  * This flag is non-trivial and has not yet been implemented, but could
263  * perhaps make use of the "vinfo" array (above).  XXX XXX XXX
264  *
265  * This function returns the number of grids (if any) in the path.  This
266  * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
267  *
268  * This algorithm is similar to, but slightly different from, the one used
269  * by "update_view_los()", and very different from the one used by "los()".
270  */
271 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
272 {
273         int y, x;
274
275         int n = 0;
276         int k = 0;
277
278         /* Absolute */
279         int ay, ax;
280
281         /* Offsets */
282         int sy, sx;
283
284         /* Fractions */
285         int frac;
286
287         /* Scale factors */
288         int full, half;
289
290         /* Slope */
291         int m;
292
293         /* No path necessary (or allowed) */
294         if ((x1 == x2) && (y1 == y2)) return (0);
295
296
297         /* Analyze "dy" */
298         if (y2 < y1)
299         {
300                 ay = (y1 - y2);
301                 sy = -1;
302         }
303         else
304         {
305                 ay = (y2 - y1);
306                 sy = 1;
307         }
308
309         /* Analyze "dx" */
310         if (x2 < x1)
311         {
312                 ax = (x1 - x2);
313                 sx = -1;
314         }
315         else
316         {
317                 ax = (x2 - x1);
318                 sx = 1;
319         }
320
321
322         /* Number of "units" in one "half" grid */
323         half = (ay * ax);
324
325         /* Number of "units" in one "full" grid */
326         full = half << 1;
327
328         /* Vertical */
329         if (ay > ax)
330         {
331                 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
332                 m = ax * ax * 2;
333
334                 /* Start */
335                 y = y1 + sy;
336                 x = x1;
337
338                 frac = m;
339
340                 if (frac > half)
341                 {
342                         /* Advance (X) part 2 */
343                         x += sx;
344
345                         /* Advance (X) part 3 */
346                         frac -= full;
347
348                         /* Track distance */
349                         k++;
350                 }
351
352                 /* Create the projection path */
353                 while (1)
354                 {
355                         /* Save grid */
356                         gp[n++] = GRID(y, x);
357
358                         /* Hack -- Check maximum range */
359                         if ((n + (k >> 1)) >= range) break;
360
361                         /* Sometimes stop at destination grid */
362                         if (!(flg & (PROJECT_THRU)))
363                         {
364                                 if ((x == x2) && (y == y2)) break;
365                         }
366
367                         if (flg & (PROJECT_DISI))
368                         {
369                                 if ((n > 0) && cave_stop_disintegration(y, x)) break;
370                         }
371                         else if (flg & (PROJECT_LOS))
372                         {
373                                 if ((n > 0) && !cave_los_bold(y, x)) break;
374                         }
375                         else if (!(flg & (PROJECT_PATH)))
376                         {
377                                 /* Always stop at non-initial wall grids */
378                                 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
379                         }
380
381                         /* Sometimes stop at non-initial monsters/players */
382                         if (flg & (PROJECT_STOP))
383                         {
384                                 if ((n > 0) &&
385                                     (player_bold(y, x) || cave[y][x].m_idx != 0))
386                                         break;
387                         }
388
389                         if (!in_bounds(y, x)) break;
390
391                         /* Slant */
392                         if (m)
393                         {
394                                 /* Advance (X) part 1 */
395                                 frac += m;
396
397                                 /* Horizontal change */
398                                 if (frac > half)
399                                 {
400                                         /* Advance (X) part 2 */
401                                         x += sx;
402
403                                         /* Advance (X) part 3 */
404                                         frac -= full;
405
406                                         /* Track distance */
407                                         k++;
408                                 }
409                         }
410
411                         /* Advance (Y) */
412                         y += sy;
413                 }
414         }
415
416         /* Horizontal */
417         else if (ax > ay)
418         {
419                 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
420                 m = ay * ay * 2;
421
422                 /* Start */
423                 y = y1;
424                 x = x1 + sx;
425
426                 frac = m;
427
428                 /* Vertical change */
429                 if (frac > half)
430                 {
431                         /* Advance (Y) part 2 */
432                         y += sy;
433
434                         /* Advance (Y) part 3 */
435                         frac -= full;
436
437                         /* Track distance */
438                         k++;
439                 }
440
441                 /* Create the projection path */
442                 while (1)
443                 {
444                         /* Save grid */
445                         gp[n++] = GRID(y, x);
446
447                         /* Hack -- Check maximum range */
448                         if ((n + (k >> 1)) >= range) break;
449
450                         /* Sometimes stop at destination grid */
451                         if (!(flg & (PROJECT_THRU)))
452                         {
453                                 if ((x == x2) && (y == y2)) break;
454                         }
455
456                         if (flg & (PROJECT_DISI))
457                         {
458                                 if ((n > 0) && cave_stop_disintegration(y, x)) break;
459                         }
460                         else if (flg & (PROJECT_LOS))
461                         {
462                                 if ((n > 0) && !cave_los_bold(y, x)) break;
463                         }
464                         else if (!(flg & (PROJECT_PATH)))
465                         {
466                                 /* Always stop at non-initial wall grids */
467                                 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
468                         }
469
470                         /* Sometimes stop at non-initial monsters/players */
471                         if (flg & (PROJECT_STOP))
472                         {
473                                 if ((n > 0) &&
474                                     (player_bold(y, x) || cave[y][x].m_idx != 0))
475                                         break;
476                         }
477
478                         if (!in_bounds(y, x)) break;
479
480                         /* Slant */
481                         if (m)
482                         {
483                                 /* Advance (Y) part 1 */
484                                 frac += m;
485
486                                 /* Vertical change */
487                                 if (frac > half)
488                                 {
489                                         /* Advance (Y) part 2 */
490                                         y += sy;
491
492                                         /* Advance (Y) part 3 */
493                                         frac -= full;
494
495                                         /* Track distance */
496                                         k++;
497                                 }
498                         }
499
500                         /* Advance (X) */
501                         x += sx;
502                 }
503         }
504
505         /* Diagonal */
506         else
507         {
508                 /* Start */
509                 y = y1 + sy;
510                 x = x1 + sx;
511
512                 /* Create the projection path */
513                 while (1)
514                 {
515                         /* Save grid */
516                         gp[n++] = GRID(y, x);
517
518                         /* Hack -- Check maximum range */
519                         if ((n + (n >> 1)) >= range) break;
520
521                         /* Sometimes stop at destination grid */
522                         if (!(flg & (PROJECT_THRU)))
523                         {
524                                 if ((x == x2) && (y == y2)) break;
525                         }
526
527                         if (flg & (PROJECT_DISI))
528                         {
529                                 if ((n > 0) && cave_stop_disintegration(y, x)) break;
530                         }
531                         else if (flg & (PROJECT_LOS))
532                         {
533                                 if ((n > 0) && !cave_los_bold(y, x)) break;
534                         }
535                         else if (!(flg & (PROJECT_PATH)))
536                         {
537                                 /* Always stop at non-initial wall grids */
538                                 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
539                         }
540
541                         /* Sometimes stop at non-initial monsters/players */
542                         if (flg & (PROJECT_STOP))
543                         {
544                                 if ((n > 0) &&
545                                     (player_bold(y, x) || cave[y][x].m_idx != 0))
546                                         break;
547                         }
548
549                         if (!in_bounds(y, x)) break;
550
551                         /* Advance (Y) */
552                         y += sy;
553
554                         /* Advance (X) */
555                         x += sx;
556                 }
557         }
558
559         /* Length */
560         return (n);
561 }
562
563
564
565 /*
566  * Mega-Hack -- track "affected" monsters (see "project()" comments)
567  */
568 static int project_m_n;
569 static int project_m_x;
570 static int project_m_y;
571 /* Mega-Hack -- monsters target */
572 static s16b monster_target_x;
573 static s16b monster_target_y;
574
575
576 /*
577  * We are called from "project()" to "damage" terrain features
578  *
579  * We are called both for "beam" effects and "ball" effects.
580  *
581  * The "r" parameter is the "distance from ground zero".
582  *
583  * Note that we determine if the player can "see" anything that happens
584  * by taking into account: blindness, line-of-sight, and illumination.
585  *
586  * We return "TRUE" if the effect of the projection is "obvious".
587  *
588  * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
589  *
590  * XXX XXX XXX Perhaps we should affect doors?
591  */
592 static bool project_f(int who, int r, int y, int x, int dam, int typ)
593 {
594         cave_type       *c_ptr = &cave[y][x];
595         feature_type    *f_ptr = &f_info[c_ptr->feat];
596
597         bool obvious = FALSE;
598         bool known = player_has_los_bold(y, x);
599
600
601         /* XXX XXX XXX */
602         who = who ? who : 0;
603
604         /* Reduce damage by distance */
605         dam = (dam + r) / (r + 1);
606
607
608         if (have_flag(f_ptr->flags, FF_TREE))
609         {
610                 cptr message;
611                 switch (typ)
612                 {
613                 case GF_POIS:
614                 case GF_NUKE:
615                 case GF_DEATH_RAY:
616 #ifdef JP
617                         message = "¸Ï¤ì¤¿";break;
618 #else
619                         message = "was blasted.";break;
620 #endif
621                 case GF_TIME:
622 #ifdef JP
623                         message = "½Ì¤ó¤À";break;
624 #else
625                         message = "shrank.";break;
626 #endif
627                 case GF_ACID:
628 #ifdef JP
629                         message = "ÍϤ±¤¿";break;
630 #else
631                         message = "melted.";break;
632 #endif
633                 case GF_COLD:
634                 case GF_ICE:
635 #ifdef JP
636                         message = "Åà¤ê¡¢ºÕ¤±»¶¤Ã¤¿";break;
637 #else
638                         message = "was frozen and smashed.";break;
639 #endif
640                 case GF_FIRE:
641                 case GF_ELEC:
642                 case GF_PLASMA:
643 #ifdef JP
644                         message = "dz¤¨¤¿";break;
645 #else
646                         message = "burns up!";break;
647 #endif
648                 case GF_METEOR:
649                 case GF_CHAOS:
650                 case GF_MANA:
651                 case GF_SEEKER:
652                 case GF_SUPER_RAY:
653                 case GF_SHARDS:
654                 case GF_ROCKET:
655                 case GF_SOUND:
656                 case GF_DISENCHANT:
657                 case GF_FORCE:
658                 case GF_GRAVITY:
659 #ifdef JP
660                         message = "Ê´ºÕ¤µ¤ì¤¿";break;
661 #else
662                         message = "was crushed.";break;
663 #endif
664                 default:
665                         message = NULL;break;
666                 }
667                 if (message)
668                 {
669 #ifdef JP
670                         msg_format("ÌÚ¤Ï%s¡£", message);
671 #else
672                         msg_format("A tree %s", message);
673 #endif
674                         cave_set_feat(y, x, (one_in_(3) ? FEAT_DEEP_GRASS : FEAT_GRASS));
675
676                         /* Observe */
677                         if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
678
679                         /* Update some things */
680                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
681                 }
682         }
683
684         /* Analyze the type */
685         switch (typ)
686         {
687                 /* Ignore most effects */
688                 case GF_CAPTURE:
689                 case GF_HAND_DOOM:
690                 case GF_CAUSE_1:
691                 case GF_CAUSE_2:
692                 case GF_CAUSE_3:
693                 case GF_CAUSE_4:
694                 case GF_MIND_BLAST:
695                 case GF_BRAIN_SMASH:
696                 case GF_DRAIN_MANA:
697                 case GF_PSY_SPEAR:
698                 case GF_FORCE:
699                 case GF_HOLY_FIRE:
700                 case GF_HELL_FIRE:
701                 case GF_PSI:
702                 case GF_PSI_DRAIN:
703                 case GF_TELEKINESIS:
704                 case GF_DOMINATION:
705                 case GF_IDENTIFY:
706                 case GF_ATTACK:
707                 case GF_ACID:
708                 case GF_ELEC:
709                 case GF_COLD:
710                 case GF_ICE:
711                 case GF_FIRE:
712                 case GF_PLASMA:
713                 case GF_METEOR:
714                 case GF_CHAOS:
715                 case GF_MANA:
716                 case GF_SEEKER:
717                 case GF_SUPER_RAY:
718                 {
719                         break;
720                 }
721
722                 /* Destroy Traps (and Locks) */
723                 case GF_KILL_TRAP:
724                 {
725                         /* Reveal secret doors */
726                         if (is_hidden_door(c_ptr))
727                         {
728                                 /* Pick a door */
729                                 disclose_grid(y, x);
730
731                                 /* Check line of sight */
732                                 if (known)
733                                 {
734                                         obvious = TRUE;
735                                 }
736                         }
737
738                         /* Destroy traps */
739                         if (is_trap(c_ptr->feat))
740                         {
741                                 /* Check line of sight */
742                                 if (known)
743                                 {
744 #ifdef JP
745                                         msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
746 #else
747                                         msg_print("There is a bright flash of light!");
748 #endif
749
750                                         obvious = TRUE;
751                                 }
752
753                                 /* Destroy the trap */
754                                 cave_alter_feat(y, x, FF_DISARM);
755                         }
756
757                         /* Locked doors are unlocked */
758                         if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
759                         {
760                                 s16b old_feat = c_ptr->feat;
761
762                                 /* Unlock the door */
763                                 cave_alter_feat(y, x, FF_DISARM);
764
765                                 /* Check line of sound */
766                                 if (known && (old_feat != c_ptr->feat))
767                                 {
768 #ifdef JP
769                                         msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
770 #else
771                                         msg_print("Click!");
772 #endif
773
774                                         obvious = TRUE;
775                                 }
776                         }
777
778                         /* Remove "unsafe" flag if player is not blind */
779                         if (!p_ptr->blind && player_has_los_bold(y, x))
780                         {
781                                 c_ptr->info &= ~(CAVE_UNSAFE);
782
783                                 /* Redraw */
784                                 lite_spot(y, x);
785
786                                 obvious = TRUE;
787                         }
788
789                         break;
790                 }
791
792                 /* Destroy Doors (and traps) */
793                 case GF_KILL_DOOR:
794                 {
795                         /* Destroy all doors and traps */
796                         if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
797                         {
798                                 /* Check line of sight */
799                                 if (known)
800                                 {
801                                         /* Message */
802 #ifdef JP
803                                         msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
804 #else
805                                         msg_print("There is a bright flash of light!");
806 #endif
807
808                                         obvious = TRUE;
809                                 }
810
811                                 /* Visibility change */
812                                 if (have_flag(f_ptr->flags, FF_DOOR))
813                                 {
814                                         /* Update some things */
815                                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
816                                 }
817
818                                 /* Destroy the feature */
819                                 cave_alter_feat(y, x, FF_TUNNEL);
820                         }
821
822                         /* Remove "unsafe" flag if player is not blind */
823                         if (!p_ptr->blind && player_has_los_bold(y, x))
824                         {
825                                 c_ptr->info &= ~(CAVE_UNSAFE);
826
827                                 /* Redraw */
828                                 lite_spot(y, x);
829
830                                 obvious = TRUE;
831                         }
832
833                         break;
834                 }
835
836                 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
837                 {
838                         if (have_flag(f_ptr->flags, FF_SPIKE))
839                         {
840                                 s16b old_mimic = c_ptr->mimic;
841                                 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
842
843                                 cave_alter_feat(y, x, FF_SPIKE);
844
845                                 c_ptr->mimic = old_mimic;
846
847                                 /* Notice */
848                                 note_spot(y, x);
849
850                                 /* Redraw */
851                                 lite_spot(y, x);
852
853                                 /* Check line of sight */
854                                 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
855                                 {
856                                         /* Message */
857 #ifdef JP
858                                         msg_format("%s¤Ë²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ³«¤«¤Ê¤¯¤Ê¤Ã¤¿¡£", f_name + mimic_f_ptr->name);
859 #else
860                                         msg_format("The %s seems stuck.", f_name + mimic_f_ptr->name);
861 #endif
862
863                                         obvious = TRUE;
864                                 }
865                         }
866                         break;
867                 }
868
869                 /* Destroy walls (and doors) */
870                 case GF_KILL_WALL:
871                 {
872                         if (have_flag(f_ptr->flags, FF_HURT_ROCK))
873                         {
874                                 /* Message */
875                                 if (known && (c_ptr->info & (CAVE_MARK)))
876                                 {
877 #ifdef JP
878                                         msg_format("%s¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
879 #else
880                                         msg_format("The %s turns into mud!", f_name + f_info[get_feat_mimic(c_ptr)].name);
881 #endif
882
883                                         obvious = TRUE;
884                                 }
885
886                                 /* Destroy the wall */
887                                 cave_alter_feat(y, x, FF_HURT_ROCK);
888
889                                 /* Update some things */
890                                 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
891                         }
892
893                         break;
894                 }
895
896                 /* Make doors */
897                 case GF_MAKE_DOOR:
898                 {
899                         /* Require a "naked" floor grid */
900                         if (!cave_naked_bold(y, x)) break;
901
902                         /* Not on the player */
903                         if (player_bold(y, x)) break;
904
905                         /* Create a closed door */
906                         cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
907
908                         /* Observe */
909                         if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
910
911                         /* Update some things */
912                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
913
914                         break;
915                 }
916
917                 /* Make traps */
918                 case GF_MAKE_TRAP:
919                 {
920                         /* Place a trap */
921                         place_trap(y, x);
922
923                         break;
924                 }
925
926                 /* Make doors */
927                 case GF_MAKE_TREE:
928                 {
929                         /* Require a "naked" floor grid */
930                         if (!cave_naked_bold(y, x)) break;
931
932                         /* Not on the player */
933                         if (player_bold(y, x)) break;
934
935                         /* Create a closed door */
936                         cave_set_feat(y, x, FEAT_TREES);
937
938                         /* Observe */
939                         if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
940
941                         /* Update some things */
942                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
943
944                         break;
945                 }
946
947                 case GF_MAKE_GLYPH:
948                 {
949                         /* Require a "naked" floor grid */
950                         if (!cave_naked_bold(y, x)) break;
951
952                         /* Create a glyph */
953                         c_ptr->info |= CAVE_OBJECT;
954                         c_ptr->mimic = FEAT_GLYPH;
955
956                         /* Notice */
957                         note_spot(y, x);
958
959                         /* Redraw */
960                         lite_spot(y, x);
961
962                         break;
963                 }
964
965                 case GF_STONE_WALL:
966                 {
967                         /* Require a "naked" floor grid */
968                         if (!cave_naked_bold(y, x)) break;
969
970                         /* Not on the player */
971                         if (player_bold(y, x)) break;
972
973                         /* Place a wall */
974                         cave_set_feat(y, x, FEAT_WALL);
975
976                         /* Update some things */
977                         p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
978
979                         break;
980                 }
981
982
983                 case GF_LAVA_FLOW:
984                 {
985                         /* Ignore permanent grid */
986                         if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
987
988                         /* Shallow Lava */
989                         if (dam == 1)
990                         {
991                                 /* Ignore grid without enough space */
992                                 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
993
994                                 /* Place a shallow lava */
995                                 cave_set_feat(y, x, FEAT_SHAL_LAVA);
996                         }
997                         /* Deep Lava */
998                         else if (dam)
999                         {
1000                                 /* Place a deep lava */
1001                                 cave_set_feat(y, x, FEAT_DEEP_LAVA);
1002                         }
1003                         break;
1004                 }
1005
1006                 case GF_WATER_FLOW:
1007                 {
1008                         /* Ignore permanent grid */
1009                         if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1010
1011                         /* Shallow Water */
1012                         if (dam == 1)
1013                         {
1014                                 /* Ignore grid without enough space */
1015                                 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1016
1017                                 /* Place a shallow water */
1018                                 cave_set_feat(y, x, FEAT_SHAL_WATER);
1019                         }
1020                         /* Deep Water */
1021                         else if (dam)
1022                         {
1023                                 /* Place a deep water */
1024                                 cave_set_feat(y, x, FEAT_DEEP_WATER);
1025                         }
1026                         break;
1027                 }
1028
1029                 /* Lite up the grid */
1030                 case GF_LITE_WEAK:
1031                 case GF_LITE:
1032                 {
1033                         /* Turn on the light */
1034                         if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1035                         {
1036                                 c_ptr->info |= (CAVE_GLOW);
1037
1038                                 /* Notice */
1039                                 note_spot(y, x);
1040
1041                                 /* Redraw */
1042                                 lite_spot(y, x);
1043
1044                                 update_local_illumination(y, x);
1045
1046                                 /* Observe */
1047                                 if (player_can_see_bold(y, x)) obvious = TRUE;
1048
1049                                 /* Mega-Hack -- Update the monster in the affected grid */
1050                                 /* This allows "spear of light" (etc) to work "correctly" */
1051                                 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1052
1053                                 if (p_ptr->special_defense & NINJA_S_STEALTH)
1054                                 {
1055                                         if (player_bold(y, x)) set_superstealth(FALSE);
1056                                 }
1057                         }
1058
1059                         break;
1060                 }
1061
1062                 /* Darken the grid */
1063                 case GF_DARK_WEAK:
1064                 case GF_DARK:
1065                 {
1066                         bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1067                         int j;
1068
1069                         /* Turn off the light. */
1070                         if (do_dark)
1071                         {
1072                                 if (!p_ptr->inside_arena)
1073                                 {
1074                                         for (j = 0; j < 9; j++)
1075                                         {
1076                                                 int by = y + ddy_ddd[j];
1077                                                 int bx = x + ddx_ddd[j];
1078
1079                                                 if (in_bounds2(by, bx))
1080                                                 {
1081                                                         cave_type *cc_ptr = &cave[by][bx];
1082
1083                                                         if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1084                                                         {
1085                                                                 do_dark = FALSE;
1086                                                                 break;
1087                                                         }
1088                                                 }
1089                                         }
1090
1091                                         if (!do_dark) break;
1092                                 }
1093
1094                                 c_ptr->info &= ~(CAVE_GLOW);
1095
1096                                 /* Hack -- Forget "boring" grids */
1097                                 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1098                                 {
1099                                         /* Forget */
1100                                         c_ptr->info &= ~(CAVE_MARK);
1101
1102                                         /* Notice */
1103                                         note_spot(y, x);
1104                                 }
1105
1106                                 /* Redraw */
1107                                 lite_spot(y, x);
1108
1109                                 update_local_illumination(y, x);
1110
1111                                 /* Notice */
1112                                 if (player_can_see_bold(y, x)) obvious = TRUE;
1113
1114                                 /* Mega-Hack -- Update the monster in the affected grid */
1115                                 /* This allows "spear of light" (etc) to work "correctly" */
1116                                 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1117                         }
1118
1119                         /* All done */
1120                         break;
1121                 }
1122
1123                 case GF_SHARDS:
1124                 case GF_ROCKET:
1125                 {
1126                         if (is_mirror_grid(c_ptr))
1127                         {
1128 #ifdef JP
1129                                 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1130 #else
1131                                 msg_print("The mirror was crashed!");
1132 #endif
1133                                 remove_mirror(y, x);
1134                                 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1135                         }
1136                         break;
1137                 }
1138                 case GF_SOUND:
1139                 {
1140                         if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1141                         {
1142 #ifdef JP
1143                                 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1144 #else
1145                                 msg_print("The mirror was crashed!");
1146 #endif
1147                                 remove_mirror(y, x);
1148                                 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1149                         }
1150                         break;
1151                 }
1152
1153                 case GF_DISINTEGRATE:
1154                 {
1155                         /* Destroy mirror */
1156                         if (is_mirror_grid(c_ptr)) remove_mirror(y, x);
1157
1158                         /* Permanent features don't get effect */
1159                         /* But not protect monsters and other objects */
1160                         if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1161                         {
1162                                 cave_alter_feat(y, x, FF_HURT_DISI);
1163
1164                                 /* Update some things -- similar to GF_KILL_WALL */
1165                                 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
1166                         }
1167                         break;
1168                 }
1169         }
1170
1171         lite_spot(y, x);
1172         /* Return "Anything seen?" */
1173         return (obvious);
1174 }
1175
1176
1177
1178 /*
1179  * We are called from "project()" to "damage" objects
1180  *
1181  * We are called both for "beam" effects and "ball" effects.
1182  *
1183  * Perhaps we should only SOMETIMES damage things on the ground.
1184  *
1185  * The "r" parameter is the "distance from ground zero".
1186  *
1187  * Note that we determine if the player can "see" anything that happens
1188  * by taking into account: blindness, line-of-sight, and illumination.
1189  *
1190  * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1191  *
1192  * We return "TRUE" if the effect of the projection is "obvious".
1193  */
1194 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1195 {
1196         cave_type *c_ptr = &cave[y][x];
1197
1198         s16b this_o_idx, next_o_idx = 0;
1199
1200         bool obvious = FALSE;
1201         bool known = player_has_los_bold(y, x);
1202
1203         u32b flgs[TR_FLAG_SIZE];
1204
1205         char o_name[MAX_NLEN];
1206
1207         int k_idx = 0;
1208         bool is_potion = FALSE;
1209
1210
1211         /* XXX XXX XXX */
1212         who = who ? who : 0;
1213
1214         /* Reduce damage by distance */
1215         dam = (dam + r) / (r + 1);
1216
1217
1218         /* Scan all objects in the grid */
1219         for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1220         {
1221                 /* Acquire object */
1222                 object_type *o_ptr = &o_list[this_o_idx];
1223
1224                 bool is_art = FALSE;
1225                 bool ignore = FALSE;
1226                 bool do_kill = FALSE;
1227
1228                 cptr note_kill = NULL;
1229
1230 #ifndef JP
1231                 /* Get the "plural"-ness */
1232                 bool plural = (o_ptr->number > 1);
1233 #endif
1234
1235                 /* Acquire next object */
1236                 next_o_idx = o_ptr->next_o_idx;
1237
1238                 /* Extract the flags */
1239                 object_flags(o_ptr, flgs);
1240
1241                 /* Check for artifact */
1242                 if (object_is_artifact(o_ptr)) is_art = TRUE;
1243
1244                 /* Analyze the type */
1245                 switch (typ)
1246                 {
1247                         /* Acid -- Lots of things */
1248                         case GF_ACID:
1249                         {
1250                                 if (hates_acid(o_ptr))
1251                                 {
1252                                         do_kill = TRUE;
1253 #ifdef JP
1254 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1255 #else
1256                                         note_kill = (plural ? " melt!" : " melts!");
1257 #endif
1258
1259                                         if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1260                                 }
1261                                 break;
1262                         }
1263
1264                         /* Elec -- Rings and Wands */
1265                         case GF_ELEC:
1266                         {
1267                                 if (hates_elec(o_ptr))
1268                                 {
1269                                         do_kill = TRUE;
1270 #ifdef JP
1271 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1272 #else
1273                                         note_kill = (plural ? " are destroyed!" : " is destroyed!");
1274 #endif
1275
1276                                         if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1277                                 }
1278                                 break;
1279                         }
1280
1281                         /* Fire -- Flammable objects */
1282                         case GF_FIRE:
1283                         {
1284                                 if (hates_fire(o_ptr))
1285                                 {
1286                                         do_kill = TRUE;
1287 #ifdef JP
1288 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1289 #else
1290                                         note_kill = (plural ? " burn up!" : " burns up!");
1291 #endif
1292
1293                                         if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1294                                 }
1295                                 break;
1296                         }
1297
1298                         /* Cold -- potions and flasks */
1299                         case GF_COLD:
1300                         {
1301                                 if (hates_cold(o_ptr))
1302                                 {
1303 #ifdef JP
1304 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1305 #else
1306                                         note_kill = (plural ? " shatter!" : " shatters!");
1307 #endif
1308
1309                                         do_kill = TRUE;
1310                                         if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1311                                 }
1312                                 break;
1313                         }
1314
1315                         /* Fire + Elec */
1316                         case GF_PLASMA:
1317                         {
1318                                 if (hates_fire(o_ptr))
1319                                 {
1320                                         do_kill = TRUE;
1321 #ifdef JP
1322 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1323 #else
1324                                         note_kill = (plural ? " burn up!" : " burns up!");
1325 #endif
1326
1327                                         if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1328                                 }
1329                                 if (hates_elec(o_ptr))
1330                                 {
1331                                         ignore = FALSE;
1332                                         do_kill = TRUE;
1333 #ifdef JP
1334 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1335 #else
1336                                         note_kill = (plural ? " are destroyed!" : " is destroyed!");
1337 #endif
1338
1339                                         if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1340                                 }
1341                                 break;
1342                         }
1343
1344                         /* Fire + Cold */
1345                         case GF_METEOR:
1346                         {
1347                                 if (hates_fire(o_ptr))
1348                                 {
1349                                         do_kill = TRUE;
1350 #ifdef JP
1351 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1352 #else
1353                                         note_kill = (plural ? " burn up!" : " burns up!");
1354 #endif
1355
1356                                         if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1357                                 }
1358                                 if (hates_cold(o_ptr))
1359                                 {
1360                                         ignore = FALSE;
1361                                         do_kill = TRUE;
1362 #ifdef JP
1363 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1364 #else
1365                                         note_kill = (plural ? " shatter!" : " shatters!");
1366 #endif
1367
1368                                         if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1369                                 }
1370                                 break;
1371                         }
1372
1373                         /* Hack -- break potions and such */
1374                         case GF_ICE:
1375                         case GF_SHARDS:
1376                         case GF_FORCE:
1377                         case GF_SOUND:
1378                         {
1379                                 if (hates_cold(o_ptr))
1380                                 {
1381 #ifdef JP
1382 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1383 #else
1384                                         note_kill = (plural ? " shatter!" : " shatters!");
1385 #endif
1386
1387                                         do_kill = TRUE;
1388                                 }
1389                                 break;
1390                         }
1391
1392                         /* Mana and Chaos -- destroy everything */
1393                         case GF_MANA:
1394                         case GF_SEEKER:
1395                         case GF_SUPER_RAY:
1396                         {
1397                                 do_kill = TRUE;
1398 #ifdef JP
1399 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1400 #else
1401                                 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1402 #endif
1403
1404                                 break;
1405                         }
1406
1407                         case GF_DISINTEGRATE:
1408                         {
1409                                 do_kill = TRUE;
1410 #ifdef JP
1411 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1412 #else
1413                                 note_kill = (plural ? " evaporate!" : " evaporates!");
1414 #endif
1415
1416                                 break;
1417                         }
1418
1419                         case GF_CHAOS:
1420                         {
1421                                 do_kill = TRUE;
1422 #ifdef JP
1423 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1424 #else
1425                                 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1426 #endif
1427
1428                                 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1429                                 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1430                                 break;
1431                         }
1432
1433                         /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1434                         case GF_HOLY_FIRE:
1435                         case GF_HELL_FIRE:
1436                         {
1437                                 if (object_is_cursed(o_ptr))
1438                                 {
1439                                         do_kill = TRUE;
1440 #ifdef JP
1441 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1442 #else
1443                                         note_kill = (plural ? " are destroyed!" : " is destroyed!");
1444 #endif
1445
1446                                 }
1447                                 break;
1448                         }
1449
1450                         case GF_IDENTIFY:
1451                         {
1452                                 identify_item(o_ptr);
1453
1454                                 /* Auto-inscription */
1455                                 autopick_alter_item((-this_o_idx), FALSE);
1456                                 break;
1457                         }
1458
1459                         /* Unlock chests */
1460                         case GF_KILL_TRAP:
1461                         case GF_KILL_DOOR:
1462                         {
1463                                 /* Chests are noticed only if trapped or locked */
1464                                 if (o_ptr->tval == TV_CHEST)
1465                                 {
1466                                         /* Disarm/Unlock traps */
1467                                         if (o_ptr->pval > 0)
1468                                         {
1469                                                 /* Disarm or Unlock */
1470                                                 o_ptr->pval = (0 - o_ptr->pval);
1471
1472                                                 /* Identify */
1473                                                 object_known(o_ptr);
1474
1475                                                 /* Notice */
1476                                                 if (known && o_ptr->marked)
1477                                                 {
1478 #ifdef JP
1479 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1480 #else
1481                                                         msg_print("Click!");
1482 #endif
1483
1484                                                         obvious = TRUE;
1485                                                 }
1486                                         }
1487                                 }
1488
1489                                 break;
1490                         }
1491                         case GF_ANIM_DEAD:
1492                         {
1493                                 if (o_ptr->tval == TV_CORPSE)
1494                                 {
1495                                         int i;
1496                                         u32b mode = 0L;
1497
1498                                         if (!who || is_pet(&m_list[who]))
1499                                                 mode |= PM_FORCE_PET;
1500
1501                                         for (i = 0; i < o_ptr->number ; i++)
1502                                         {
1503                                                 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1504                                                     ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1505                                                 {
1506                                                         if (!note_kill)
1507                                                         {
1508 #ifdef JP
1509 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1510 #else
1511                                         note_kill = (plural ? " become dust." : " becomes dust.");
1512 #endif
1513                                                         }
1514                                                         continue;
1515                                                 }
1516                                                 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1517                                                 {
1518 #ifdef JP
1519 note_kill = "À¸¤­Ê֤ä¿¡£";
1520 #else
1521                                         note_kill = "rivived.";
1522 #endif
1523                                                 }
1524                                                 else if (!note_kill)
1525                                                 {
1526 #ifdef JP
1527 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1528 #else
1529                                                         note_kill = (plural ? " become dust." : " becomes dust.");
1530 #endif
1531                                                 }
1532                                         }
1533                                         do_kill = TRUE;
1534                                         obvious = TRUE;
1535                                 }
1536                                 break;
1537                         }
1538                 }
1539
1540
1541                 /* Attempt to destroy the object */
1542                 if (do_kill)
1543                 {
1544                         /* Effect "observed" */
1545                         if (known && o_ptr->marked)
1546                         {
1547                                 obvious = TRUE;
1548                                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1549                         }
1550
1551                         /* Artifacts, and other objects, get to resist */
1552                         if (is_art || ignore)
1553                         {
1554                                 /* Observe the resist */
1555                                 if (known && o_ptr->marked)
1556                                 {
1557 #ifdef JP
1558 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1559    o_name);
1560 #else
1561                                         msg_format("The %s %s unaffected!",
1562                                                         o_name, (plural ? "are" : "is"));
1563 #endif
1564
1565                                 }
1566                         }
1567
1568                         /* Kill it */
1569                         else
1570                         {
1571                                 /* Describe if needed */
1572                                 if (known && o_ptr->marked && note_kill)
1573                                 {
1574 #ifdef JP
1575 msg_format("%s¤Ï%s", o_name, note_kill);
1576 #else
1577                                         msg_format("The %s%s", o_name, note_kill);
1578 #endif
1579
1580                                 }
1581
1582                                 k_idx = o_ptr->k_idx;
1583                                 is_potion = object_is_potion(o_ptr);
1584
1585
1586                                 /* Delete the object */
1587                                 delete_object_idx(this_o_idx);
1588
1589                                 /* Potions produce effects when 'shattered' */
1590                                 if (is_potion)
1591                                 {
1592                                         (void)potion_smash_effect(who, y, x, k_idx);
1593                                 }
1594
1595                                 /* Redraw */
1596                                 lite_spot(y, x);
1597                         }
1598                 }
1599         }
1600
1601         /* Return "Anything seen?" */
1602         return (obvious);
1603 }
1604
1605
1606 /*
1607  * Helper function for "project()" below.
1608  *
1609  * Handle a beam/bolt/ball causing damage to a monster.
1610  *
1611  * This routine takes a "source monster" (by index) which is mostly used to
1612  * determine if the player is causing the damage, and a "radius" (see below),
1613  * which is used to decrease the power of explosions with distance, and a
1614  * location, via integers which are modified by certain types of attacks
1615  * (polymorph and teleport being the obvious ones), a default damage, which
1616  * is modified as needed based on various properties, and finally a "damage
1617  * type" (see below).
1618  *
1619  * Note that this routine can handle "no damage" attacks (like teleport) by
1620  * taking a "zero" damage, and can even take "parameters" to attacks (like
1621  * confuse) by accepting a "damage", using it to calculate the effect, and
1622  * then setting the damage to zero.  Note that the "damage" parameter is
1623  * divided by the radius, so monsters not at the "epicenter" will not take
1624  * as much damage (or whatever)...
1625  *
1626  * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1627  * may result in a dereference of an invalid pointer.  XXX XXX XXX
1628  *
1629  * Various messages are produced, and damage is applied.
1630  *
1631  * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1632  * actually be "made" of that substance, or "breathe" big balls of it.
1633  *
1634  * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1635  * to plasma.
1636  *
1637  * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1638  * and hurts evil less.  If can breath nether, then it resists it as well.
1639  *
1640  * Damage reductions use the following formulas:
1641  *   Note that "dam = dam * 6 / (randint1(6) + 6);"
1642  *     gives avg damage of .655, ranging from .858 to .500
1643  *   Note that "dam = dam * 5 / (randint1(6) + 6);"
1644  *     gives avg damage of .544, ranging from .714 to .417
1645  *   Note that "dam = dam * 4 / (randint1(6) + 6);"
1646  *     gives avg damage of .444, ranging from .556 to .333
1647  *   Note that "dam = dam * 3 / (randint1(6) + 6);"
1648  *     gives avg damage of .327, ranging from .427 to .250
1649  *   Note that "dam = dam * 2 / (randint1(6) + 6);"
1650  *     gives something simple.
1651  *
1652  * In this function, "result" messages are postponed until the end, where
1653  * the "note" string is appended to the monster name, if not NULL.  So,
1654  * to make a spell have "no effect" just set "note" to NULL.  You should
1655  * also set "notice" to FALSE, or the player will learn what the spell does.
1656  *
1657  * We attempt to return "TRUE" if the player saw anything "useful" happen.
1658  */
1659 /* "flg" was added. */
1660 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1661 {
1662         int tmp;
1663
1664         cave_type *c_ptr = &cave[y][x];
1665
1666         monster_type *m_ptr = &m_list[c_ptr->m_idx];
1667         monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1668
1669         monster_race *r_ptr = &r_info[m_ptr->r_idx];
1670
1671         char killer[80];
1672
1673         /* Is the monster "seen"? */
1674         bool seen = m_ptr->ml;
1675         bool seen_msg = is_seen(m_ptr);
1676
1677         bool slept = (bool)(m_ptr->csleep > 0);
1678
1679         /* Were the effects "obvious" (if seen)? */
1680         bool obvious = FALSE;
1681
1682         /* Can the player know about this effect? */
1683         bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1684
1685         /* Can the player see the source of this effect? */
1686         bool see_s_msg = ((who <= 0) || is_seen(caster_ptr));
1687
1688         /* Were the effects "irrelevant"? */
1689         bool skipped = FALSE;
1690
1691         /* Gets the monster angry at the source of the effect? */
1692         bool get_angry = FALSE;
1693
1694         /* Polymorph setting (true or false) */
1695         bool do_poly = FALSE;
1696
1697         /* Teleport setting (max distance) */
1698         int do_dist = 0;
1699
1700         /* Confusion setting (amount to confuse) */
1701         int do_conf = 0;
1702
1703         /* Stunning setting (amount to stun) */
1704         int do_stun = 0;
1705
1706         /* Sleep amount (amount to sleep) */
1707         int do_sleep = 0;
1708
1709         /* Fear amount (amount to fear) */
1710         int do_fear = 0;
1711
1712         /* Time amount (amount to time) */
1713         int do_time = 0;
1714
1715         bool heal_leper = FALSE;
1716
1717         /* Hold the monster name */
1718         char m_name[80];
1719
1720 #ifndef JP
1721         char m_poss[10];
1722 #endif
1723
1724         int photo = 0;
1725
1726         /* Assume no note */
1727         cptr note = NULL;
1728
1729         /* Assume a default death */
1730         cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1731
1732         int ty = m_ptr->fy;
1733         int tx = m_ptr->fx;
1734
1735         int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1736
1737         /* Nobody here */
1738         if (!c_ptr->m_idx) return (FALSE);
1739
1740         /* Never affect projector */
1741         if (who && (c_ptr->m_idx == who)) return (FALSE);
1742         if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1743         if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1744
1745         /* Don't affect already death monsters */
1746         /* Prevents problems with chain reactions of exploding monsters */
1747         if (m_ptr->hp < 0) return (FALSE);
1748
1749         /* Reduce damage by distance */
1750         dam = (dam + r) / (r + 1);
1751
1752
1753         /* Get the monster name (BEFORE polymorphing) */
1754         monster_desc(m_name, m_ptr, 0);
1755
1756 #ifndef JP
1757         /* Get the monster possessive ("his"/"her"/"its") */
1758         monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1759 #endif
1760
1761
1762         if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1763
1764         /* Analyze the damage type */
1765         switch (typ)
1766         {
1767                 /* Magic Missile -- pure damage */
1768                 case GF_MISSILE:
1769                 {
1770                         if (seen) obvious = TRUE;
1771
1772                         if (r_ptr->flagsr & RFR_RES_ALL)
1773                         {
1774 #ifdef JP
1775                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1776 #else
1777                                 note = " is immune.";
1778 #endif
1779                                 dam = 0;
1780                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1781                                 break;
1782                         }
1783                         break;
1784                 }
1785
1786                 /* Acid */
1787                 case GF_ACID:
1788                 {
1789                         if (seen) obvious = TRUE;
1790
1791                         if (r_ptr->flagsr & RFR_RES_ALL)
1792                         {
1793 #ifdef JP
1794                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1795 #else
1796                                 note = " is immune.";
1797 #endif
1798                                 dam = 0;
1799                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1800                                 break;
1801                         }
1802                         if (r_ptr->flagsr & RFR_IM_ACID)
1803                         {
1804 #ifdef JP
1805 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
1806 #else
1807                                 note = " resists a lot.";
1808 #endif
1809
1810                                 dam /= 9;
1811                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1812                         }
1813                         break;
1814                 }
1815
1816                 /* Electricity */
1817                 case GF_ELEC:
1818                 {
1819                         if (seen) obvious = TRUE;
1820
1821                         if (r_ptr->flagsr & RFR_RES_ALL)
1822                         {
1823 #ifdef JP
1824                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1825 #else
1826                                 note = " is immune.";
1827 #endif
1828                                 dam = 0;
1829                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1830                                 break;
1831                         }
1832                         if (r_ptr->flagsr & RFR_IM_ELEC)
1833                         {
1834 #ifdef JP
1835 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
1836 #else
1837                                 note = " resists a lot.";
1838 #endif
1839
1840                                 dam /= 9;
1841                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1842                         }
1843                         break;
1844                 }
1845
1846                 /* Fire damage */
1847                 case GF_FIRE:
1848                 {
1849                         if (seen) obvious = TRUE;
1850
1851                         if (r_ptr->flagsr & RFR_RES_ALL)
1852                         {
1853 #ifdef JP
1854                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1855 #else
1856                                 note = " is immune.";
1857 #endif
1858                                 dam = 0;
1859                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1860                                 break;
1861                         }
1862                         if (r_ptr->flagsr & RFR_IM_FIRE)
1863                         {
1864 #ifdef JP
1865 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
1866 #else
1867                                 note = " resists a lot.";
1868 #endif
1869
1870                                 dam /= 9;
1871                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1872                         }
1873                         else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1874                         {
1875 #ifdef JP
1876 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1877 #else
1878                                 note = " is hit hard.";
1879 #endif
1880
1881                                 dam *= 2;
1882                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1883                         }
1884                         break;
1885                 }
1886
1887                 /* Cold */
1888                 case GF_COLD:
1889                 {
1890                         if (seen) obvious = TRUE;
1891
1892                         if (r_ptr->flagsr & RFR_RES_ALL)
1893                         {
1894 #ifdef JP
1895                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1896 #else
1897                                 note = " is immune.";
1898 #endif
1899                                 dam = 0;
1900                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1901                                 break;
1902                         }
1903                         if (r_ptr->flagsr & RFR_IM_COLD)
1904                         {
1905 #ifdef JP
1906 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
1907 #else
1908                                 note = " resists a lot.";
1909 #endif
1910
1911                                 dam /= 9;
1912                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1913                         }
1914                         else if (r_ptr->flags3 & (RF3_HURT_COLD))
1915                         {
1916 #ifdef JP
1917 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1918 #else
1919                                 note = " is hit hard.";
1920 #endif
1921
1922                                 dam *= 2;
1923                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1924                         }
1925                         break;
1926                 }
1927
1928                 /* Poison */
1929                 case GF_POIS:
1930                 {
1931                         if (seen) obvious = TRUE;
1932
1933                         if (r_ptr->flagsr & RFR_RES_ALL)
1934                         {
1935 #ifdef JP
1936                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1937 #else
1938                                 note = " is immune.";
1939 #endif
1940                                 dam = 0;
1941                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1942                                 break;
1943                         }
1944                         if (r_ptr->flagsr & RFR_IM_POIS)
1945                         {
1946 #ifdef JP
1947 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡ª";
1948 #else
1949                                 note = " resists a lot.";
1950 #endif
1951
1952                                 dam /= 9;
1953                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1954                         }
1955                         break;
1956                 }
1957
1958                 /* Nuclear waste */
1959                 case GF_NUKE:
1960                 {
1961                         if (seen) obvious = TRUE;
1962
1963                         if (r_ptr->flagsr & RFR_RES_ALL)
1964                         {
1965 #ifdef JP
1966                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1967 #else
1968                                 note = " is immune.";
1969 #endif
1970                                 dam = 0;
1971                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1972                                 break;
1973                         }
1974                         if (r_ptr->flagsr & RFR_IM_POIS)
1975                         {
1976 #ifdef JP
1977 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
1978 #else
1979                                 note = " resists.";
1980 #endif
1981
1982                                 dam *= 3; dam /= randint1(6) + 6;
1983                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1984                         }
1985                         else if (one_in_(3)) do_poly = TRUE;
1986                         break;
1987                 }
1988
1989                 /* Hellfire -- hurts Evil */
1990                 case GF_HELL_FIRE:
1991                 {
1992                         if (seen) obvious = TRUE;
1993
1994                         if (r_ptr->flagsr & RFR_RES_ALL)
1995                         {
1996 #ifdef JP
1997                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
1998 #else
1999                                 note = " is immune.";
2000 #endif
2001                                 dam = 0;
2002                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2003                                 break;
2004                         }
2005                         if (r_ptr->flags3 & RF3_GOOD)
2006                         {
2007                                 dam *= 2;
2008 #ifdef JP
2009 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2010 #else
2011                                 note = " is hit hard.";
2012 #endif
2013
2014                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2015                         }
2016                         break;
2017                 }
2018
2019                 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2020                 case GF_HOLY_FIRE:
2021                 {
2022                         if (seen) obvious = TRUE;
2023
2024                         if (r_ptr->flagsr & RFR_RES_ALL)
2025                         {
2026 #ifdef JP
2027                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2028 #else
2029                                 note = " is immune.";
2030 #endif
2031                                 dam = 0;
2032                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2033                                 break;
2034                         }
2035                         if (r_ptr->flags3 & RF3_GOOD)
2036                         {
2037                                 dam = 0;
2038 #ifdef JP
2039 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
2040 #else
2041                                 note = " is immune.";
2042 #endif
2043
2044                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2045                         }
2046                         else if (r_ptr->flags3 & RF3_EVIL)
2047                         {
2048                                 dam *= 2;
2049 #ifdef JP
2050 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2051 #else
2052                                 note = " is hit hard.";
2053 #endif
2054
2055                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2056                         }
2057                         else
2058                         {
2059 #ifdef JP
2060 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2061 #else
2062                                 note = " resists.";
2063 #endif
2064
2065                                 dam *= 3; dam /= randint1(6) + 6;
2066                         }
2067                         break;
2068                 }
2069
2070                 /* Arrow -- XXX no defense */
2071                 case GF_ARROW:
2072                 {
2073                         if (seen) obvious = TRUE;
2074
2075                         if (r_ptr->flagsr & RFR_RES_ALL)
2076                         {
2077 #ifdef JP
2078                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2079 #else
2080                                 note = " is immune.";
2081 #endif
2082                                 dam = 0;
2083                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2084                                 break;
2085                         }
2086                         break;
2087                 }
2088
2089                 /* Plasma -- XXX perhaps check ELEC or FIRE */
2090                 case GF_PLASMA:
2091                 {
2092                         if (seen) obvious = TRUE;
2093
2094                         if (r_ptr->flagsr & RFR_RES_ALL)
2095                         {
2096 #ifdef JP
2097                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2098 #else
2099                                 note = " is immune.";
2100 #endif
2101                                 dam = 0;
2102                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2103                                 break;
2104                         }
2105                         if (r_ptr->flagsr & RFR_RES_PLAS)
2106                         {
2107 #ifdef JP
2108 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2109 #else
2110                                 note = " resists.";
2111 #endif
2112
2113                                 dam *= 3; dam /= randint1(6) + 6;
2114                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2115                         }
2116                         break;
2117                 }
2118
2119                 /* Nether -- see above */
2120                 case GF_NETHER:
2121                 {
2122                         if (seen) obvious = TRUE;
2123
2124                         if (r_ptr->flagsr & RFR_RES_ALL)
2125                         {
2126 #ifdef JP
2127                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2128 #else
2129                                 note = " is immune.";
2130 #endif
2131                                 dam = 0;
2132                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2133                                 break;
2134                         }
2135                         if (r_ptr->flagsr & RFR_RES_NETH)
2136                         {
2137                                 if (r_ptr->flags3 & RF3_UNDEAD)
2138                                 {
2139 #ifdef JP
2140                                         note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
2141 #else
2142                                         note = " is immune.";
2143 #endif
2144
2145                                         dam = 0;
2146                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2147                                 }
2148                                 else
2149                                 {
2150 #ifdef JP
2151                                         note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2152 #else
2153                                         note = " resists.";
2154 #endif
2155
2156                                         dam *= 3; dam /= randint1(6) + 6;
2157                                 }
2158                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2159                         }
2160                         else if (r_ptr->flags3 & RF3_EVIL)
2161                         {
2162                                 dam /= 2;
2163 #ifdef JP
2164                                 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
2165 #else
2166                                 note = " resists somewhat.";
2167 #endif
2168
2169                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2170                         }
2171                         break;
2172                 }
2173
2174                 /* Water (acid) damage -- Water spirits/elementals are immune */
2175                 case GF_WATER:
2176                 {
2177                         if (seen) obvious = TRUE;
2178
2179                         if (r_ptr->flagsr & RFR_RES_ALL)
2180                         {
2181 #ifdef JP
2182                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2183 #else
2184                                 note = " is immune.";
2185 #endif
2186                                 dam = 0;
2187                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2188                                 break;
2189                         }
2190                         if (r_ptr->flagsr & RFR_RES_WATE)
2191                         {
2192                                 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2193                                 {
2194 #ifdef JP
2195                                         note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
2196 #else
2197                                         note = " is immune.";
2198 #endif
2199
2200                                         dam = 0;
2201                                 }
2202                                 else
2203                                 {
2204 #ifdef JP
2205                                         note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2206 #else
2207                                         note = " resists.";
2208 #endif
2209
2210                                         dam *= 3; dam /= randint1(6) + 6;
2211                                 }
2212                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2213                         }
2214                         break;
2215                 }
2216
2217                 /* Chaos -- Chaos breathers resist */
2218                 case GF_CHAOS:
2219                 {
2220                         if (seen) obvious = TRUE;
2221
2222                         if (r_ptr->flagsr & RFR_RES_ALL)
2223                         {
2224 #ifdef JP
2225                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2226 #else
2227                                 note = " is immune.";
2228 #endif
2229                                 dam = 0;
2230                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2231                                 break;
2232                         }
2233                         if (r_ptr->flagsr & RFR_RES_CHAO)
2234                         {
2235 #ifdef JP
2236                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2237 #else
2238                                 note = " resists.";
2239 #endif
2240
2241                                 dam *= 3; dam /= randint1(6) + 6;
2242                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2243                         }
2244                         else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2245                         {
2246 #ifdef JP
2247                                 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
2248 #else
2249                                 note = " resists somewhat.";
2250 #endif
2251
2252                                 dam *= 3; dam /= randint1(6) + 6;
2253                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2254                         }
2255                         else
2256                         {
2257                                 do_poly = TRUE;
2258                                 do_conf = (5 + randint1(11) + r) / (r + 1);
2259                         }
2260                         break;
2261                 }
2262
2263                 /* Shards -- Shard breathers resist */
2264                 case GF_SHARDS:
2265                 {
2266                         if (seen) obvious = TRUE;
2267
2268                         if (r_ptr->flagsr & RFR_RES_ALL)
2269                         {
2270 #ifdef JP
2271                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2272 #else
2273                                 note = " is immune.";
2274 #endif
2275                                 dam = 0;
2276                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2277                                 break;
2278                         }
2279                         if (r_ptr->flagsr & RFR_RES_SHAR)
2280                         {
2281 #ifdef JP
2282                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2283 #else
2284                                 note = " resists.";
2285 #endif
2286
2287                                 dam *= 3; dam /= randint1(6) + 6;
2288                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2289                         }
2290                         break;
2291                 }
2292
2293                 /* Rocket: Shard resistance helps */
2294                 case GF_ROCKET:
2295                 {
2296                         if (seen) obvious = TRUE;
2297
2298                         if (r_ptr->flagsr & RFR_RES_ALL)
2299                         {
2300 #ifdef JP
2301                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2302 #else
2303                                 note = " is immune.";
2304 #endif
2305                                 dam = 0;
2306                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2307                                 break;
2308                         }
2309                         if (r_ptr->flagsr & RFR_RES_SHAR)
2310                         {
2311 #ifdef JP
2312                                 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ­¤ò¼¨¤·¤¿¡£";
2313 #else
2314                                 note = " resists somewhat.";
2315 #endif
2316
2317                                 dam /= 2;
2318                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2319                         }
2320                         break;
2321                 }
2322
2323
2324                 /* Sound -- Sound breathers resist */
2325                 case GF_SOUND:
2326                 {
2327                         if (seen) obvious = TRUE;
2328
2329                         if (r_ptr->flagsr & RFR_RES_ALL)
2330                         {
2331 #ifdef JP
2332                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2333 #else
2334                                 note = " is immune.";
2335 #endif
2336                                 dam = 0;
2337                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2338                                 break;
2339                         }
2340                         if (r_ptr->flagsr & RFR_RES_SOUN)
2341                         {
2342 #ifdef JP
2343                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2344 #else
2345                                 note = " resists.";
2346 #endif
2347
2348                                 dam *= 2; dam /= randint1(6) + 6;
2349                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2350                         }
2351                         else do_stun = (10 + randint1(15) + r) / (r + 1);
2352                         break;
2353                 }
2354
2355                 /* Confusion */
2356                 case GF_CONFUSION:
2357                 {
2358                         if (seen) obvious = TRUE;
2359
2360                         if (r_ptr->flagsr & RFR_RES_ALL)
2361                         {
2362 #ifdef JP
2363                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2364 #else
2365                                 note = " is immune.";
2366 #endif
2367                                 dam = 0;
2368                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2369                                 break;
2370                         }
2371                         if (r_ptr->flags3 & RF3_NO_CONF)
2372                         {
2373 #ifdef JP
2374                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2375 #else
2376                                 note = " resists.";
2377 #endif
2378
2379                                 dam *= 3; dam /= randint1(6) + 6;
2380                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2381                         }
2382                         else do_conf = (10 + randint1(15) + r) / (r + 1);
2383                         break;
2384                 }
2385
2386                 /* Disenchantment -- Breathers and Disenchanters resist */
2387                 case GF_DISENCHANT:
2388                 {
2389                         if (seen) obvious = TRUE;
2390
2391                         if (r_ptr->flagsr & RFR_RES_ALL)
2392                         {
2393 #ifdef JP
2394                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2395 #else
2396                                 note = " is immune.";
2397 #endif
2398                                 dam = 0;
2399                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2400                                 break;
2401                         }
2402                         if (r_ptr->flagsr & RFR_RES_DISE)
2403                         {
2404 #ifdef JP
2405                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2406 #else
2407                                 note = " resists.";
2408 #endif
2409
2410                                 dam *= 3; dam /= randint1(6) + 6;
2411                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2412                         }
2413                         break;
2414                 }
2415
2416                 /* Nexus -- Breathers and Existers resist */
2417                 case GF_NEXUS:
2418                 {
2419                         if (seen) obvious = TRUE;
2420
2421                         if (r_ptr->flagsr & RFR_RES_ALL)
2422                         {
2423 #ifdef JP
2424                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2425 #else
2426                                 note = " is immune.";
2427 #endif
2428                                 dam = 0;
2429                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2430                                 break;
2431                         }
2432                         if (r_ptr->flagsr & RFR_RES_NEXU)
2433                         {
2434 #ifdef JP
2435                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2436 #else
2437                                 note = " resists.";
2438 #endif
2439
2440                                 dam *= 3; dam /= randint1(6) + 6;
2441                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2442                         }
2443                         break;
2444                 }
2445
2446                 /* Force */
2447                 case GF_FORCE:
2448                 {
2449                         if (seen) obvious = TRUE;
2450
2451                         if (r_ptr->flagsr & RFR_RES_ALL)
2452                         {
2453 #ifdef JP
2454                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2455 #else
2456                                 note = " is immune.";
2457 #endif
2458                                 dam = 0;
2459                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2460                                 break;
2461                         }
2462                         if (r_ptr->flagsr & RFR_RES_WALL)
2463                         {
2464 #ifdef JP
2465                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2466 #else
2467                                 note = " resists.";
2468 #endif
2469
2470                                 dam *= 3; dam /= randint1(6) + 6;
2471                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2472                         }
2473                         else do_stun = (randint1(15) + r) / (r + 1);
2474                         break;
2475                 }
2476
2477                 /* Inertia -- breathers resist */
2478                 case GF_INERTIA:
2479                 {
2480                         if (seen) obvious = TRUE;
2481
2482                         if (r_ptr->flagsr & RFR_RES_ALL)
2483                         {
2484 #ifdef JP
2485                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2486 #else
2487                                 note = " is immune.";
2488 #endif
2489                                 dam = 0;
2490                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2491                                 break;
2492                         }
2493                         if (r_ptr->flagsr & RFR_RES_INER)
2494                         {
2495 #ifdef JP
2496                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2497 #else
2498                                 note = " resists.";
2499 #endif
2500
2501                                 dam *= 3; dam /= randint1(6) + 6;
2502                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2503                         }
2504                         else
2505                         {
2506                                 /* Powerful monsters can resist */
2507                                 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2508                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2509                                 {
2510                                         obvious = FALSE;
2511                                 }
2512                                 /* Normal monsters slow down */
2513                                 else
2514                                 {
2515                                         if (!m_ptr->slow)
2516                                         {
2517 #ifdef JP
2518                                                 note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2519 #else
2520                                                 note = " starts moving slower.";
2521 #endif
2522                                         }
2523                                         m_ptr->slow = MIN(200, m_ptr->slow + 50);
2524                                         if (c_ptr->m_idx == p_ptr->riding)
2525                                                 p_ptr->update |= (PU_BONUS);
2526                                 }
2527                         }
2528                         break;
2529                 }
2530
2531                 /* Time -- breathers resist */
2532                 case GF_TIME:
2533                 {
2534                         if (seen) obvious = TRUE;
2535
2536                         if (r_ptr->flagsr & RFR_RES_ALL)
2537                         {
2538 #ifdef JP
2539                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2540 #else
2541                                 note = " is immune.";
2542 #endif
2543                                 dam = 0;
2544                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2545                                 break;
2546                         }
2547                         if (r_ptr->flagsr & RFR_RES_TIME)
2548                         {
2549 #ifdef JP
2550                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2551 #else
2552                                 note = " resists.";
2553 #endif
2554
2555                                 dam *= 3; dam /= randint1(6) + 6;
2556                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2557                         }
2558                         else do_time = (dam + 1) / 2;
2559                         break;
2560                 }
2561
2562                 /* Gravity -- breathers resist */
2563                 case GF_GRAVITY:
2564                 {
2565                         bool resist_tele = FALSE;
2566
2567                         if (seen) obvious = TRUE;
2568
2569                         if (r_ptr->flagsr & RFR_RES_ALL)
2570                         {
2571 #ifdef JP
2572                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2573 #else
2574                                 note = " is immune.";
2575 #endif
2576                                 dam = 0;
2577                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2578                                 break;
2579                         }
2580                         if (r_ptr->flagsr & RFR_RES_TELE)
2581                         {
2582                                 if (r_ptr->flags1 & (RF1_UNIQUE))
2583                                 {
2584                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2585 #ifdef JP
2586 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2587 #else
2588                                         note = " is unaffected!";
2589 #endif
2590
2591                                         resist_tele = TRUE;
2592                                 }
2593                                 else if (r_ptr->level > randint1(100))
2594                                 {
2595                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2596 #ifdef JP
2597 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
2598 #else
2599                                         note = " resists!";
2600 #endif
2601
2602                                         resist_tele = TRUE;
2603                                 }
2604                         }
2605
2606                         if (!resist_tele) do_dist = 10;
2607                         else do_dist = 0;
2608                         if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2609
2610                         if (r_ptr->flagsr & RFR_RES_GRAV)
2611                         {
2612 #ifdef JP
2613                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2614 #else
2615                                 note = " resists.";
2616 #endif
2617
2618                                 dam *= 3; dam /= randint1(6) + 6;
2619                                 do_dist = 0;
2620                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2621                         }
2622                         else
2623                         {
2624                                 /* 1. slowness */
2625                                 /* Powerful monsters can resist */
2626                                 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2627                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2628                                 {
2629                                         obvious = FALSE;
2630                                 }
2631                                 /* Normal monsters slow down */
2632                                 else
2633                                 {
2634                                         if (!m_ptr->slow)
2635                                         {
2636 #ifdef JP
2637 note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2638 #else
2639                                                 note = " starts moving slower.";
2640 #endif
2641                                         }
2642                                         m_ptr->slow = MIN(200, m_ptr->slow + 50);
2643                                         if (c_ptr->m_idx == p_ptr->riding)
2644                                                 p_ptr->update |= (PU_BONUS);
2645                                 }
2646
2647                                 /* 2. stun */
2648                                 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2649
2650                                 /* Attempt a saving throw */
2651                                 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2652                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2653                                 {
2654                                         /* Resist */
2655                                         do_stun = 0;
2656                                         /* No obvious effect */
2657 #ifdef JP
2658                                         note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2659 #else
2660                                         note = " is unaffected!";
2661 #endif
2662
2663                                         obvious = FALSE;
2664                                 }
2665                         }
2666                         break;
2667                 }
2668
2669                 /* Pure damage */
2670                 case GF_MANA:
2671                 case GF_SEEKER:
2672                 case GF_SUPER_RAY:
2673                 {
2674                         if (seen) obvious = TRUE;
2675
2676                         if (r_ptr->flagsr & RFR_RES_ALL)
2677                         {
2678 #ifdef JP
2679                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2680 #else
2681                                 note = " is immune.";
2682 #endif
2683                                 dam = 0;
2684                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2685                                 break;
2686                         }
2687                         break;
2688                 }
2689
2690
2691                 /* Pure damage */
2692                 case GF_DISINTEGRATE:
2693                 {
2694                         if (seen) obvious = TRUE;
2695
2696                         if (r_ptr->flagsr & RFR_RES_ALL)
2697                         {
2698 #ifdef JP
2699                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2700 #else
2701                                 note = " is immune.";
2702 #endif
2703                                 dam = 0;
2704                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2705                                 break;
2706                         }
2707                         if (r_ptr->flags3 & RF3_HURT_ROCK)
2708                         {
2709                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2710 #ifdef JP
2711 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2712 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2713 #else
2714                                 note = " loses some skin!";
2715                                 note_dies = " evaporates!";
2716 #endif
2717
2718                                 dam *= 2;
2719                         }
2720                         break;
2721                 }
2722
2723                 case GF_PSI:
2724                 {
2725                         if (seen) obvious = TRUE;
2726
2727                         /* PSI only works if the monster can see you! -- RG */
2728                         if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2729                         {
2730 #ifdef JP
2731                                 if (seen_msg) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2732 #else
2733                                 if (seen_msg) msg_format("%^s can't see you, and isn't affected!", m_name);
2734 #endif
2735                                 skipped = TRUE;
2736                                 break;
2737                         }
2738
2739                         if (r_ptr->flagsr & RFR_RES_ALL)
2740                         {
2741 #ifdef JP
2742                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2743 #else
2744                                 note = " is immune.";
2745 #endif
2746                                 dam = 0;
2747                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2748                                 break;
2749                         }
2750                         if (r_ptr->flags2 & RF2_EMPTY_MIND)
2751                         {
2752                                 dam = 0;
2753 #ifdef JP
2754                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2755 #else
2756                                 note = " is immune!";
2757 #endif
2758                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2759
2760                         }
2761                         else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2762                                  (r_ptr->flags3 & RF3_ANIMAL) ||
2763                                  (r_ptr->level > randint1(3 * dam)))
2764                         {
2765                                 dam /= 3;
2766 #ifdef JP
2767                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2768 #else
2769                                 note = " resists.";
2770 #endif
2771
2772
2773                                 /*
2774                                  * Powerful demons & undead can turn a mindcrafter's
2775                                  * attacks back on them
2776                                  */
2777                                 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2778                                     (r_ptr->level > p_ptr->lev / 2) &&
2779                                     one_in_(2))
2780                                 {
2781                                         note = NULL;
2782 #ifdef JP
2783                                         msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2784 #else
2785                                         msg_format("%^s%s corrupted mind backlashes your attack!",
2786                                             m_name, (seen ? "'s" : "s"));
2787 #endif
2788
2789                                         /* Saving throw */
2790                                         if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2791                                         {
2792 #ifdef JP
2793                                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2794 #else
2795                                                 msg_print("You resist the effects!");
2796 #endif
2797
2798                                         }
2799                                         else
2800                                         {
2801                                                 /* Injure +/- confusion */
2802                                                 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2803                                                 take_hit(DAMAGE_ATTACK, dam, killer, -1);  /* has already been /3 */
2804                                                 if (one_in_(4))
2805                                                 {
2806                                                         switch (randint1(4))
2807                                                         {
2808                                                                 case 1:
2809                                                                         set_confused(p_ptr->confused + 3 + randint1(dam));
2810                                                                         break;
2811                                                                 case 2:
2812                                                                         set_stun(p_ptr->stun + randint1(dam));
2813                                                                         break;
2814                                                                 case 3:
2815                                                                 {
2816                                                                         if (r_ptr->flags3 & RF3_NO_FEAR)
2817 #ifdef JP
2818                                                                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2819 #else
2820                                                                                 note = " is unaffected.";
2821 #endif
2822
2823                                                                         else
2824                                                                                 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2825                                                                         break;
2826                                                                 }
2827                                                                 default:
2828                                                                         if (!p_ptr->free_act)
2829                                                                                 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2830                                                                         break;
2831                                                         }
2832                                                 }
2833                                         }
2834                                         dam = 0;
2835                                 }
2836                         }
2837
2838                         if ((dam > 0) && one_in_(4))
2839                         {
2840                                 switch (randint1(4))
2841                                 {
2842                                         case 1:
2843                                                 do_conf = 3 + randint1(dam);
2844                                                 break;
2845                                         case 2:
2846                                                 do_stun = 3 + randint1(dam);
2847                                                 break;
2848                                         case 3:
2849                                                 do_fear = 3 + randint1(dam);
2850                                                 break;
2851                                         default:
2852 #ifdef JP
2853                                                 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2854 #else
2855                                                 note = " falls asleep!";
2856 #endif
2857
2858                                                 do_sleep = 3 + randint1(dam);
2859                                                 break;
2860                                 }
2861                         }
2862
2863 #ifdef JP
2864                         note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2865 #else
2866                         note_dies = " collapses, a mindless husk.";
2867 #endif
2868
2869                         break;
2870                 }
2871
2872                 case GF_PSI_DRAIN:
2873                 {
2874                         if (seen) obvious = TRUE;
2875
2876                         if (r_ptr->flagsr & RFR_RES_ALL)
2877                         {
2878 #ifdef JP
2879                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2880 #else
2881                                 note = " is immune.";
2882 #endif
2883                                 dam = 0;
2884                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2885                                 break;
2886                         }
2887                         if (r_ptr->flags2 & RF2_EMPTY_MIND)
2888                         {
2889                                 dam = 0;
2890 #ifdef JP
2891                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2892 #else
2893                                 note = " is immune!";
2894 #endif
2895
2896                         }
2897                         else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2898                                  (r_ptr->flags3 & RF3_ANIMAL) ||
2899                                  (r_ptr->level > randint1(3 * dam)))
2900                         {
2901                                 dam /= 3;
2902 #ifdef JP
2903                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
2904 #else
2905                                 note = " resists.";
2906 #endif
2907
2908
2909                                 /*
2910                                  * Powerful demons & undead can turn a mindcrafter's
2911                                  * attacks back on them
2912                                  */
2913                                 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2914                                      (r_ptr->level > p_ptr->lev / 2) &&
2915                                      (one_in_(2)))
2916                                 {
2917                                         note = NULL;
2918 #ifdef JP
2919                                         msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2920 #else
2921                                         msg_format("%^s%s corrupted mind backlashes your attack!",
2922                                             m_name, (seen ? "'s" : "s"));
2923 #endif
2924
2925                                         /* Saving throw */
2926                                         if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2927                                         {
2928 #ifdef JP
2929                                                 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2930 #else
2931                                                 msg_print("You resist the effects!");
2932 #endif
2933
2934                                         }
2935                                         else
2936                                         {
2937                                                 /* Injure + mana drain */
2938                                                 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2939 #ifdef JP
2940                                                 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2941 #else
2942                                                 msg_print("Your psychic energy is drained!");
2943 #endif
2944
2945                                                 p_ptr->csp -= damroll(5, dam) / 2;
2946                                                 if (p_ptr->csp < 0) p_ptr->csp = 0;
2947                                                 p_ptr->redraw |= PR_MANA;
2948                                                 p_ptr->window |= (PW_SPELL);
2949                                                 take_hit(DAMAGE_ATTACK, dam, killer, -1);  /* has already been /3 */
2950                                         }
2951                                         dam = 0;
2952                                 }
2953                         }
2954                         else if (dam > 0)
2955                         {
2956                                 int b = damroll(5, dam) / 4;
2957 #ifdef JP
2958                                 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
2959 #else
2960                                 msg_format("You convert %s%s pain into psychic energy!",
2961                                     m_name, (seen ? "'s" : "s"));
2962 #endif
2963
2964                                 b = MIN(p_ptr->msp, p_ptr->csp + b);
2965                                 p_ptr->csp = b;
2966                                 p_ptr->redraw |= PR_MANA;
2967                                 p_ptr->window |= (PW_SPELL);
2968                         }
2969
2970 #ifdef JP
2971                         note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2972 #else
2973                         note_dies = " collapses, a mindless husk.";
2974 #endif
2975
2976                         break;
2977                 }
2978
2979                 case GF_TELEKINESIS:
2980                 {
2981                         if (seen) obvious = TRUE;
2982
2983                         if (r_ptr->flagsr & RFR_RES_ALL)
2984                         {
2985 #ifdef JP
2986                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
2987 #else
2988                                 note = " is immune.";
2989 #endif
2990                                 dam = 0;
2991                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2992                                 break;
2993                         }
2994                         if (one_in_(4))
2995                         {
2996                                 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2997                                 else do_dist = 7;
2998                         }
2999
3000                         /* 1. stun */
3001                         do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3002
3003                         /* Attempt a saving throw */
3004                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3005                             (r_ptr->level > 5 + randint1(dam)))
3006                         {
3007                                 /* Resist */
3008                                 do_stun = 0;
3009                                 /* No obvious effect */
3010                                 obvious = FALSE;
3011                         }
3012                         break;
3013                 }
3014
3015                 /* Psycho-spear -- powerful magic missile */
3016                 case GF_PSY_SPEAR:
3017                 {
3018                         if (seen) obvious = TRUE;
3019
3020                         if (r_ptr->flagsr & RFR_RES_ALL)
3021                         {
3022 #ifdef JP
3023                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
3024 #else
3025                                 note = " is immune.";
3026 #endif
3027                                 dam = 0;
3028                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3029                                 break;
3030                         }
3031                         break;
3032                 }
3033
3034                 /* Meteor -- powerful magic missile */
3035                 case GF_METEOR:
3036                 {
3037                         if (seen) obvious = TRUE;
3038
3039                         if (r_ptr->flagsr & RFR_RES_ALL)
3040                         {
3041 #ifdef JP
3042                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
3043 #else
3044                                 note = " is immune.";
3045 #endif
3046                                 dam = 0;
3047                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3048                                 break;
3049                         }
3050                         break;
3051                 }
3052
3053                 case GF_DOMINATION:
3054                 {
3055                         if (!is_hostile(m_ptr)) break;
3056
3057                         if (seen) obvious = TRUE;
3058
3059                         if (r_ptr->flagsr & RFR_RES_ALL)
3060                         {
3061 #ifdef JP
3062                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3063 #else
3064                                 note = " is immune.";
3065 #endif
3066                                 dam = 0;
3067                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3068                                 break;
3069                         }
3070                         /* Attempt a saving throw */
3071                         if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3072                             (r_ptr->flags3 & RF3_NO_CONF) ||
3073                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3074                         {
3075                                 /* Memorize a flag */
3076                                 if (r_ptr->flags3 & RF3_NO_CONF)
3077                                 {
3078                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3079                                 }
3080
3081                                 /* Resist */
3082                                 do_conf = 0;
3083
3084                                 /*
3085                                  * Powerful demons & undead can turn a mindcrafter's
3086                                  * attacks back on them
3087                                  */
3088                                 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3089                                     (r_ptr->level > p_ptr->lev / 2) &&
3090                                     (one_in_(2)))
3091                                 {
3092                                         note = NULL;
3093 #ifdef JP
3094                                         msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3095 #else
3096                                         msg_format("%^s%s corrupted mind backlashes your attack!",
3097                                             m_name, (seen ? "'s" : "s"));
3098 #endif
3099
3100                                         /* Saving throw */
3101                                         if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3102                                         {
3103 #ifdef JP
3104                                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3105 #else
3106                                                 msg_print("You resist the effects!");
3107 #endif
3108
3109                                         }
3110                                         else
3111                                         {
3112                                                 /* Confuse, stun, terrify */
3113                                                 switch (randint1(4))
3114                                                 {
3115                                                         case 1:
3116                                                                 set_stun(p_ptr->stun + dam / 2);
3117                                                                 break;
3118                                                         case 2:
3119                                                                 set_confused(p_ptr->confused + dam / 2);
3120                                                                 break;
3121                                                         default:
3122                                                         {
3123                                                                 if (r_ptr->flags3 & RF3_NO_FEAR)
3124 #ifdef JP
3125                                                                         note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3126 #else
3127                                                                         note = " is unaffected.";
3128 #endif
3129
3130                                                                 else
3131                                                                         set_afraid(p_ptr->afraid + dam);
3132                                                         }
3133                                                 }
3134                                         }
3135                                 }
3136                                 else
3137                                 {
3138                                         /* No obvious effect */
3139 #ifdef JP
3140 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3141 #else
3142                                         note = " is unaffected!";
3143 #endif
3144
3145                                         obvious = FALSE;
3146                                 }
3147                         }
3148                         else
3149                         {
3150                                 if ((dam > 29) && (randint1(100) < dam))
3151                                 {
3152 #ifdef JP
3153 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3154 #else
3155                                         note = " is in your thrall!";
3156 #endif
3157
3158                                         set_pet(m_ptr);
3159                                 }
3160                                 else
3161                                 {
3162                                         switch (randint1(4))
3163                                         {
3164                                                 case 1:
3165                                                         do_stun = dam / 2;
3166                                                         break;
3167                                                 case 2:
3168                                                         do_conf = dam / 2;
3169                                                         break;
3170                                                 default:
3171                                                         do_fear = dam;
3172                                         }
3173                                 }
3174                         }
3175
3176                         /* No "real" damage */
3177                         dam = 0;
3178                         break;
3179                 }
3180
3181
3182
3183                 /* Ice -- Cold + Cuts + Stun */
3184                 case GF_ICE:
3185                 {
3186                         if (seen) obvious = TRUE;
3187
3188                         if (r_ptr->flagsr & RFR_RES_ALL)
3189                         {
3190 #ifdef JP
3191                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
3192 #else
3193                                 note = " is immune.";
3194 #endif
3195                                 dam = 0;
3196                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3197                                 break;
3198                         }
3199                         do_stun = (randint1(15) + 1) / (r + 1);
3200                         if (r_ptr->flagsr & RFR_IM_COLD)
3201                         {
3202 #ifdef JP
3203                                 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ­¤¬¤¢¤ë¡£";
3204 #else
3205                                 note = " resists a lot.";
3206 #endif
3207
3208                                 dam /= 9;
3209                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3210                         }
3211                         else if (r_ptr->flags3 & (RF3_HURT_COLD))
3212                         {
3213 #ifdef JP
3214                                 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3215 #else
3216                                 note = " is hit hard.";
3217 #endif
3218
3219                                 dam *= 2;
3220                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3221                         }
3222                         break;
3223                 }
3224
3225
3226                 /* Drain Life */
3227                 case GF_OLD_DRAIN:
3228                 {
3229                         if (seen) obvious = TRUE;
3230
3231                         if (r_ptr->flagsr & RFR_RES_ALL)
3232                         {
3233 #ifdef JP
3234                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
3235 #else
3236                                 note = " is immune.";
3237 #endif
3238                                 dam = 0;
3239                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3240                                 break;
3241                         }
3242                         if (!monster_living(r_ptr))
3243                         {
3244                                 if (is_original_ap_and_seen(m_ptr))
3245                                 {
3246                                         if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3247                                         if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3248                                         if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3249                                 }
3250
3251 #ifdef JP
3252                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3253 #else
3254                                 note = " is unaffected!";
3255 #endif
3256
3257                                 obvious = FALSE;
3258                                 dam = 0;
3259                         }
3260                         else do_time = (dam+7)/8;
3261
3262                         break;
3263                 }
3264
3265                 /* Death Ray */
3266                 case GF_DEATH_RAY:
3267                 {
3268                         if (seen) obvious = TRUE;
3269
3270                         if (r_ptr->flagsr & RFR_RES_ALL)
3271                         {
3272 #ifdef JP
3273                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
3274 #else
3275                                 note = " is immune.";
3276 #endif
3277                                 dam = 0;
3278                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3279                                 break;
3280                         }
3281                         if (!monster_living(r_ptr))
3282                         {
3283                                 if (is_original_ap_and_seen(m_ptr))
3284                                 {
3285                                         if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3286                                         if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3287                                         if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3288                                 }
3289
3290 #ifdef JP
3291                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡£";
3292 #else
3293                                 note = " is immune.";
3294 #endif
3295
3296                                 obvious = FALSE;
3297                                 dam = 0;
3298                         }
3299                         else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3300                                  (randint1(888) != 666)) ||
3301                                  (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3302                                  randint1(100) != 66))
3303                         {
3304 #ifdef JP
3305 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
3306 #else
3307                                 note = " resists!";
3308 #endif
3309
3310                                 obvious = FALSE;
3311                                 dam = 0;
3312                         }
3313
3314                         break;
3315                 }
3316
3317                 /* Polymorph monster (Use "dam" as "power") */
3318                 case GF_OLD_POLY:
3319                 {
3320                         if (seen) obvious = TRUE;
3321
3322                         if (r_ptr->flagsr & RFR_RES_ALL)
3323                         {
3324 #ifdef JP
3325                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3326 #else
3327                                 note = " is immune.";
3328 #endif
3329                                 dam = 0;
3330                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3331                                 break;
3332                         }
3333                         /* Attempt to polymorph (see below) */
3334                         do_poly = TRUE;
3335
3336                         /* Powerful monsters can resist */
3337                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3338                             (r_ptr->flags1 & RF1_QUESTOR) ||
3339                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3340                         {
3341 #ifdef JP
3342 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3343 #else
3344                                 note = " is unaffected!";
3345 #endif
3346
3347                                 do_poly = FALSE;
3348                                 obvious = FALSE;
3349                         }
3350
3351                         /* No "real" damage */
3352                         dam = 0;
3353
3354                         break;
3355                 }
3356
3357
3358                 /* Clone monsters (Ignore "dam") */
3359                 case GF_OLD_CLONE:
3360                 {
3361                         if (seen) obvious = TRUE;
3362
3363                         if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3364                         {
3365 #ifdef JP
3366 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3367 #else
3368  note = " is unaffected!";
3369 #endif
3370                         }
3371                         else
3372                         {
3373                                 /* Heal fully */
3374                                 m_ptr->hp = m_ptr->maxhp;
3375
3376                                 /* Attempt to clone. */
3377                                 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3378                                 {
3379 #ifdef JP
3380 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3381 #else
3382                                         note = " spawns!";
3383 #endif
3384
3385                                 }
3386                         }
3387
3388                         /* No "real" damage */
3389                         dam = 0;
3390
3391                         break;
3392                 }
3393
3394
3395                 /* Heal Monster (use "dam" as amount of healing) */
3396                 case GF_STAR_HEAL:
3397                 {
3398                         if (seen) obvious = TRUE;
3399
3400                         /* Wake up */
3401                         m_ptr->csleep = 0;
3402
3403                         if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3404
3405                         if (m_ptr->maxhp < m_ptr->max_maxhp)
3406                         {
3407 #ifdef JP
3408                                 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3409 #else
3410                                 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3411 #endif
3412                                 m_ptr->maxhp = m_ptr->max_maxhp;
3413                         }
3414                         if (!dam) break;
3415                 }
3416                 case GF_OLD_HEAL:
3417                 {
3418                         if (seen) obvious = TRUE;
3419
3420                         /* Wake up */
3421                         m_ptr->csleep = 0;
3422
3423                         if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3424
3425                         if (m_ptr->stunned)
3426                         {
3427 #ifdef JP
3428                                 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3429 #else
3430                                 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3431 #endif
3432                                 m_ptr->stunned = 0;
3433                         }
3434                         if (m_ptr->confused)
3435                         {
3436 #ifdef JP
3437                                 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3438 #else
3439                                 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3440 #endif
3441                                 m_ptr->confused = 0;
3442                         }
3443                         if (m_ptr->monfear)
3444                         {
3445 #ifdef JP
3446                                 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3447 #else
3448                                 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3449 #endif
3450                                 m_ptr->monfear = 0;
3451                         }
3452
3453                         /* Heal */
3454                         if (m_ptr->hp < 30000) m_ptr->hp += dam;
3455
3456                         /* No overflow */
3457                         if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3458
3459                         if (!who)
3460                         {
3461                                 chg_virtue(V_VITALITY, 1);
3462
3463                                 if (r_ptr->flags1 & RF1_UNIQUE)
3464                                         chg_virtue(V_INDIVIDUALISM, 1);
3465
3466                                 if (is_friendly(m_ptr))
3467                                         chg_virtue(V_HONOUR, 1);
3468                                 else if (!(r_ptr->flags3 & RF3_EVIL))
3469                                 {
3470                                         if (r_ptr->flags3 & RF3_GOOD)
3471                                                 chg_virtue(V_COMPASSION, 2);
3472                                         else
3473                                                 chg_virtue(V_COMPASSION, 1);
3474                                 }
3475
3476                                 if (r_ptr->flags3 & RF3_ANIMAL)
3477                                         chg_virtue(V_NATURE, 1);
3478                         }
3479
3480                         if (m_ptr->r_idx == MON_LEPER)
3481                         {
3482                                 heal_leper = TRUE;
3483                                 if (!who) chg_virtue(V_COMPASSION, 5);
3484                         }
3485
3486                         /* Redraw (later) if needed */
3487                         if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3488                         if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3489
3490                         /* Message */
3491 #ifdef JP
3492 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3493 #else
3494                         note = " looks healthier.";
3495 #endif
3496
3497
3498                         /* No "real" damage */
3499                         dam = 0;
3500                         break;
3501                 }
3502
3503
3504                 /* Speed Monster (Ignore "dam") */
3505                 case GF_OLD_SPEED:
3506                 {
3507                         if (seen) obvious = TRUE;
3508
3509                         /* Speed up */
3510                         if (!m_ptr->fast)
3511                         {
3512 #ifdef JP
3513 note = "¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3514 #else
3515                                 note = " starts moving faster.";
3516 #endif
3517                         }
3518                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
3519
3520                         if (c_ptr->m_idx == p_ptr->riding)
3521                                 p_ptr->update |= (PU_BONUS);
3522
3523                         if (!who)
3524                         {
3525                                 if (r_ptr->flags1 & RF1_UNIQUE)
3526                                         chg_virtue(V_INDIVIDUALISM, 1);
3527                                 if (is_friendly(m_ptr))
3528                                         chg_virtue(V_HONOUR, 1);
3529                         }
3530
3531                         /* No "real" damage */
3532                         dam = 0;
3533                         break;
3534                 }
3535
3536
3537                 /* Slow Monster (Use "dam" as "power") */
3538                 case GF_OLD_SLOW:
3539                 {
3540                         if (seen) obvious = TRUE;
3541
3542                         if (r_ptr->flagsr & RFR_RES_ALL)
3543                         {
3544 #ifdef JP
3545                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3546 #else
3547                                 note = " is immune.";
3548 #endif
3549                                 dam = 0;
3550                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3551                                 break;
3552                         }
3553                         /* Powerful monsters can resist */
3554                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3555                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3556                         {
3557 #ifdef JP
3558 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3559 #else
3560                                 note = " is unaffected!";
3561 #endif
3562
3563                                 obvious = FALSE;
3564                         }
3565
3566                         /* Normal monsters slow down */
3567                         else
3568                         {
3569                                 if (!m_ptr->slow)
3570                                 {
3571 #ifdef JP
3572 note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3573 #else
3574                                         note = " starts moving slower.";
3575 #endif
3576                                 }
3577                                 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3578
3579                                 if (c_ptr->m_idx == p_ptr->riding)
3580                                         p_ptr->update |= (PU_BONUS);
3581                         }
3582
3583                         /* No "real" damage */
3584                         dam = 0;
3585                         break;
3586                 }
3587
3588
3589                 /* Sleep (Use "dam" as "power") */
3590                 case GF_OLD_SLEEP:
3591                 {
3592                         if (seen) obvious = TRUE;
3593
3594                         if (r_ptr->flagsr & RFR_RES_ALL)
3595                         {
3596 #ifdef JP
3597                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3598 #else
3599                                 note = " is immune.";
3600 #endif
3601                                 dam = 0;
3602                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3603                                 break;
3604                         }
3605                         /* Attempt a saving throw */
3606                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3607                             (r_ptr->flags3 & RF3_NO_SLEEP) ||
3608                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3609                         {
3610                                 /* Memorize a flag */
3611                                 if (r_ptr->flags3 & RF3_NO_SLEEP)
3612                                 {
3613                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3614                                 }
3615
3616                                 /* No obvious effect */
3617 #ifdef JP
3618 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3619 #else
3620                                 note = " is unaffected!";
3621 #endif
3622
3623                                 obvious = FALSE;
3624                         }
3625                         else
3626                         {
3627                                 /* Go to sleep (much) later */
3628 #ifdef JP
3629 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3630 #else
3631                                 note = " falls asleep!";
3632 #endif
3633
3634                                 do_sleep = 500;
3635                         }
3636
3637                         /* No "real" damage */
3638                         dam = 0;
3639                         break;
3640                 }
3641
3642
3643                 /* Sleep (Use "dam" as "power") */
3644                 case GF_STASIS_EVIL:
3645                 {
3646                         if (seen) obvious = TRUE;
3647
3648                         if (r_ptr->flagsr & RFR_RES_ALL)
3649                         {
3650 #ifdef JP
3651                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3652 #else
3653                                 note = " is immune.";
3654 #endif
3655                                 dam = 0;
3656                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3657                                 break;
3658                         }
3659                         /* Attempt a saving throw */
3660                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3661                             !(r_ptr->flags3 & RF3_EVIL) ||
3662                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3663                         {
3664 #ifdef JP
3665 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3666 #else
3667                                 note = " is unaffected!";
3668 #endif
3669
3670                                 obvious = FALSE;
3671                         }
3672                         else
3673                         {
3674                                 /* Go to sleep (much) later */
3675 #ifdef JP
3676 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3677 #else
3678                                 note = " is suspended!";
3679 #endif
3680
3681                                 do_sleep = 500;
3682                         }
3683
3684                         /* No "real" damage */
3685                         dam = 0;
3686                         break;
3687                 }
3688
3689                 /* Sleep (Use "dam" as "power") */
3690                 case GF_STASIS:
3691                 {
3692                         if (seen) obvious = TRUE;
3693
3694                         if (r_ptr->flagsr & RFR_RES_ALL)
3695                         {
3696 #ifdef JP
3697                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3698 #else
3699                                 note = " is immune.";
3700 #endif
3701                                 dam = 0;
3702                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3703                                 break;
3704                         }
3705                         /* Attempt a saving throw */
3706                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
3707                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3708                         {
3709 #ifdef JP
3710 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3711 #else
3712                                 note = " is unaffected!";
3713 #endif
3714
3715                                 obvious = FALSE;
3716                         }
3717                         else
3718                         {
3719                                 /* Go to sleep (much) later */
3720 #ifdef JP
3721 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3722 #else
3723                                 note = " is suspended!";
3724 #endif
3725
3726                                 do_sleep = 500;
3727                         }
3728
3729                         /* No "real" damage */
3730                         dam = 0;
3731                         break;
3732                 }
3733
3734                 /* Charm monster */
3735                 case GF_CHARM:
3736                 {
3737                         int vir;
3738                         dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3739                         vir = virtue_number(V_HARMONY);
3740                         if (vir)
3741                         {
3742                                 dam += p_ptr->virtues[vir-1]/10;
3743                         }
3744
3745                         vir = virtue_number(V_INDIVIDUALISM);
3746                         if (vir)
3747                         {
3748                                 dam -= p_ptr->virtues[vir-1]/20;
3749                         }
3750
3751                         if (seen) obvious = TRUE;
3752
3753                         if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3754                         {
3755 #ifdef JP
3756                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3757 #else
3758                                 note = " is immune.";
3759 #endif
3760                                 dam = 0;
3761                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3762                                 break;
3763                         }
3764
3765                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3766                                 dam = dam * 2 / 3;
3767
3768                         /* Attempt a saving throw */
3769                         if ((r_ptr->flags1 & RF1_QUESTOR) ||
3770                             (r_ptr->flags3 & RF3_NO_CONF) ||
3771                             (m_ptr->mflag2 & MFLAG2_NOPET) ||
3772                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3773                         {
3774                                 /* Memorize a flag */
3775                                 if (r_ptr->flags3 & RF3_NO_CONF)
3776                                 {
3777                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3778                                 }
3779
3780                                 /* Resist */
3781                                 /* No obvious effect */
3782 #ifdef JP
3783 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3784 #else
3785                                 note = " is unaffected!";
3786 #endif
3787
3788                                 obvious = FALSE;
3789
3790                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3791                         }
3792                         else if (p_ptr->cursed & TRC_AGGRAVATE)
3793                         {
3794 #ifdef JP
3795 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3796 #else
3797                                 note = " hates you too much!";
3798 #endif
3799
3800                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3801                         }
3802                         else
3803                         {
3804 #ifdef JP
3805 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3806 #else
3807                                 note = " suddenly seems friendly!";
3808 #endif
3809
3810                                 set_pet(m_ptr);
3811
3812                                 chg_virtue(V_INDIVIDUALISM, -1);
3813                                 if (r_ptr->flags3 & RF3_ANIMAL)
3814                                         chg_virtue(V_NATURE, 1);
3815                         }
3816
3817                         /* No "real" damage */
3818                         dam = 0;
3819                         break;
3820                 }
3821
3822                 /* Control undead */
3823                 case GF_CONTROL_UNDEAD:
3824                 {
3825                         int vir;
3826                         if (seen) obvious = TRUE;
3827
3828                         vir = virtue_number(V_UNLIFE);
3829                         if (vir)
3830                         {
3831                                 dam += p_ptr->virtues[vir-1]/10;
3832                         }
3833
3834                         vir = virtue_number(V_INDIVIDUALISM);
3835                         if (vir)
3836                         {
3837                                 dam -= p_ptr->virtues[vir-1]/20;
3838                         }
3839
3840                         if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3841                         {
3842 #ifdef JP
3843                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3844 #else
3845                                 note = " is immune.";
3846 #endif
3847                                 dam = 0;
3848                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3849                                 break;
3850                         }
3851
3852                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3853                                 dam = dam * 2 / 3;
3854
3855                         /* Attempt a saving throw */
3856                         if ((r_ptr->flags1 & RF1_QUESTOR) ||
3857                           (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3858                             (m_ptr->mflag2 & MFLAG2_NOPET) ||
3859                                  (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3860                         {
3861                                 /* No obvious effect */
3862 #ifdef JP
3863 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3864 #else
3865                                 note = " is unaffected!";
3866 #endif
3867
3868                                 obvious = FALSE;
3869                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3870                         }
3871                         else if (p_ptr->cursed & TRC_AGGRAVATE)
3872                         {
3873 #ifdef JP
3874 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3875 #else
3876                                 note = " hates you too much!";
3877 #endif
3878
3879                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3880                         }
3881                         else
3882                         {
3883 #ifdef JP
3884 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3885 #else
3886                                 note = " is in your thrall!";
3887 #endif
3888
3889                                 set_pet(m_ptr);
3890                         }
3891
3892                         /* No "real" damage */
3893                         dam = 0;
3894                         break;
3895                 }
3896
3897                 /* Control demon */
3898                 case GF_CONTROL_DEMON:
3899                 {
3900                         int vir;
3901                         if (seen) obvious = TRUE;
3902
3903                         vir = virtue_number(V_UNLIFE);
3904                         if (vir)
3905                         {
3906                                 dam += p_ptr->virtues[vir-1]/10;
3907                         }
3908
3909                         vir = virtue_number(V_INDIVIDUALISM);
3910                         if (vir)
3911                         {
3912                                 dam -= p_ptr->virtues[vir-1]/20;
3913                         }
3914
3915                         if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3916                         {
3917 #ifdef JP
3918                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3919 #else
3920                                 note = " is immune.";
3921 #endif
3922                                 dam = 0;
3923                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3924                                 break;
3925                         }
3926
3927                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3928                                 dam = dam * 2 / 3;
3929
3930                         /* Attempt a saving throw */
3931                         if ((r_ptr->flags1 & RF1_QUESTOR) ||
3932                           (!(r_ptr->flags3 & RF3_DEMON)) ||
3933                             (m_ptr->mflag2 & MFLAG2_NOPET) ||
3934                                  (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3935                         {
3936                                 /* No obvious effect */
3937 #ifdef JP
3938 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3939 #else
3940                                 note = " is unaffected!";
3941 #endif
3942
3943                                 obvious = FALSE;
3944                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3945                         }
3946                         else if (p_ptr->cursed & TRC_AGGRAVATE)
3947                         {
3948 #ifdef JP
3949 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3950 #else
3951                                 note = " hates you too much!";
3952 #endif
3953
3954                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3955                         }
3956                         else
3957                         {
3958 #ifdef JP
3959 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3960 #else
3961                                 note = " is in your thrall!";
3962 #endif
3963
3964                                 set_pet(m_ptr);
3965                         }
3966
3967                         /* No "real" damage */
3968                         dam = 0;
3969                         break;
3970                 }
3971
3972                 /* Tame animal */
3973                 case GF_CONTROL_ANIMAL:
3974                 {
3975                         int vir;
3976
3977                         if (seen) obvious = TRUE;
3978
3979                         vir = virtue_number(V_NATURE);
3980                         if (vir)
3981                         {
3982                                 dam += p_ptr->virtues[vir-1]/10;
3983                         }
3984
3985                         vir = virtue_number(V_INDIVIDUALISM);
3986                         if (vir)
3987                         {
3988                                 dam -= p_ptr->virtues[vir-1]/20;
3989                         }
3990
3991                         if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3992                         {
3993 #ifdef JP
3994                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3995 #else
3996                                 note = " is immune.";
3997 #endif
3998                                 dam = 0;
3999                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4000                                 break;
4001                         }
4002
4003                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4004                                 dam = dam * 2 / 3;
4005
4006                         /* Attempt a saving throw */
4007                         if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4008                           (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4009                             (m_ptr->mflag2 & MFLAG2_NOPET) ||
4010                                  (r_ptr->flags3 & (RF3_NO_CONF)) ||
4011                                  (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4012                         {
4013                                 /* Memorize a flag */
4014                                 if (r_ptr->flags3 & (RF3_NO_CONF))
4015                                 {
4016                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4017                                 }
4018
4019                                 /* Resist */
4020                                 /* No obvious effect */
4021 #ifdef JP
4022 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4023 #else
4024                                 note = " is unaffected!";
4025 #endif
4026
4027                                 obvious = FALSE;
4028                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4029                         }
4030                         else if (p_ptr->cursed & TRC_AGGRAVATE)
4031                         {
4032 #ifdef JP
4033 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4034 #else
4035                                 note = " hates you too much!";
4036 #endif
4037
4038                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4039                         }
4040                         else
4041                         {
4042 #ifdef JP
4043 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4044 #else
4045                                 note = " is tamed!";
4046 #endif
4047
4048                                 set_pet(m_ptr);
4049
4050                                 if (r_ptr->flags3 & RF3_ANIMAL)
4051                                         chg_virtue(V_NATURE, 1);
4052                         }
4053
4054                         /* No "real" damage */
4055                         dam = 0;
4056                         break;
4057                 }
4058
4059                 /* Tame animal */
4060                 case GF_CONTROL_LIVING:
4061                 {
4062                         int vir;
4063
4064                         vir = virtue_number(V_UNLIFE);
4065                         if (seen) obvious = TRUE;
4066
4067                         dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4068                         vir = virtue_number(V_UNLIFE);
4069                         if (vir)
4070                         {
4071                                 dam -= p_ptr->virtues[vir-1]/10;
4072                         }
4073
4074                         vir = virtue_number(V_INDIVIDUALISM);
4075                         if (vir)
4076                         {
4077                                 dam -= p_ptr->virtues[vir-1]/20;
4078                         }
4079
4080                         if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4081                         if (dam < 1) dam = 1;
4082 #ifdef JP
4083 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4084 #else
4085                         msg_format("You stare into %s.", m_name);
4086 #endif
4087                         if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4088                         {
4089 #ifdef JP
4090                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4091 #else
4092                                 note = " is immune.";
4093 #endif
4094                                 dam = 0;
4095                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4096                                 break;
4097                         }
4098
4099                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4100                                 dam = dam * 2 / 3;
4101
4102                         /* Attempt a saving throw */
4103                         if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4104                             (m_ptr->mflag2 & MFLAG2_NOPET) ||
4105                                  !monster_living(r_ptr) ||
4106                                  ((r_ptr->level+10) > randint1(dam)))
4107                         {
4108                                 /* Resist */
4109                                 /* No obvious effect */
4110 #ifdef JP
4111 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4112 #else
4113                                 note = " is unaffected!";
4114 #endif
4115
4116                                 obvious = FALSE;
4117                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4118                         }
4119                         else if (p_ptr->cursed & TRC_AGGRAVATE)
4120                         {
4121 #ifdef JP
4122 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4123 #else
4124                                 note = " hates you too much!";
4125 #endif
4126
4127                                 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4128                         }
4129                         else
4130                         {
4131 #ifdef JP
4132 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4133 #else
4134                                 note = " is tamed!";
4135 #endif
4136
4137                                 set_pet(m_ptr);
4138
4139                                 if (r_ptr->flags3 & RF3_ANIMAL)
4140                                         chg_virtue(V_NATURE, 1);
4141                         }
4142
4143                         /* No "real" damage */
4144                         dam = 0;
4145                         break;
4146                 }
4147
4148                 /* Confusion (Use "dam" as "power") */
4149                 case GF_OLD_CONF:
4150                 {
4151                         if (seen) obvious = TRUE;
4152
4153                         if (r_ptr->flagsr & RFR_RES_ALL)
4154                         {
4155 #ifdef JP
4156                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4157 #else
4158                                 note = " is immune.";
4159 #endif
4160                                 dam = 0;
4161                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4162                                 break;
4163                         }
4164                         /* Get confused later */
4165                         do_conf = damroll(3, (dam / 2)) + 1;
4166
4167                         /* Attempt a saving throw */
4168                         if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4169                             (r_ptr->flags3 & (RF3_NO_CONF)) ||
4170                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4171                         {
4172                                 /* Memorize a flag */
4173                                 if (r_ptr->flags3 & (RF3_NO_CONF))
4174                                 {
4175                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4176                                 }
4177
4178                                 /* Resist */
4179                                 do_conf = 0;
4180
4181                                 /* No obvious effect */
4182 #ifdef JP
4183 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4184 #else
4185                                 note = " is unaffected!";
4186 #endif
4187
4188                                 obvious = FALSE;
4189                         }
4190
4191                         /* No "real" damage */
4192                         dam = 0;
4193                         break;
4194                 }
4195
4196                 case GF_STUN:
4197                 {
4198                         if (seen) obvious = TRUE;
4199
4200                         if (r_ptr->flagsr & RFR_RES_ALL)
4201                         {
4202 #ifdef JP
4203                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4204 #else
4205                                 note = " is immune.";
4206 #endif
4207                                 dam = 0;
4208                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4209                                 break;
4210                         }
4211                         do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4212
4213                         /* Attempt a saving throw */
4214                         if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4215                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4216                         {
4217                                 /* Resist */
4218                                 do_stun = 0;
4219
4220                                 /* No obvious effect */
4221 #ifdef JP
4222 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4223 #else
4224                                 note = " is unaffected!";
4225 #endif
4226
4227                                 obvious = FALSE;
4228                         }
4229
4230                         /* No "real" damage */
4231                         dam = 0;
4232                         break;
4233                 }
4234
4235
4236
4237
4238                 /* Lite, but only hurts susceptible creatures */
4239                 case GF_LITE_WEAK:
4240                 {
4241                         if (!dam)
4242                         {
4243                                 skipped = TRUE;
4244                                 break;
4245                         }
4246                         if (r_ptr->flagsr & RFR_RES_ALL)
4247                         {
4248                                 dam = 0;
4249                                 break;
4250                         }
4251                         /* Hurt by light */
4252                         if (r_ptr->flags3 & (RF3_HURT_LITE))
4253                         {
4254                                 /* Obvious effect */
4255                                 if (seen) obvious = TRUE;
4256
4257                                 /* Memorize the effects */
4258                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4259
4260                                 /* Special effect */
4261 #ifdef JP
4262 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4263 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4264 #else
4265                                 note = " cringes from the light!";
4266                                 note_dies = " shrivels away in the light!";
4267 #endif
4268
4269                         }
4270
4271                         /* Normally no damage */
4272                         else
4273                         {
4274                                 /* No damage */
4275                                 dam = 0;
4276                         }
4277
4278                         break;
4279                 }
4280
4281
4282
4283                 /* Lite -- opposite of Dark */
4284                 case GF_LITE:
4285                 {
4286                         if (seen) obvious = TRUE;
4287
4288                         if (r_ptr->flagsr & RFR_RES_ALL)
4289                         {
4290 #ifdef JP
4291                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
4292 #else
4293                                 note = " is immune.";
4294 #endif
4295                                 dam = 0;
4296                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4297                                 break;
4298                         }
4299                         if (r_ptr->flagsr & RFR_RES_LITE)
4300                         {
4301 #ifdef JP
4302                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
4303 #else
4304                                 note = " resists.";
4305 #endif
4306
4307                                 dam *= 2; dam /= (randint1(6)+6);
4308                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4309                         }
4310                         else if (r_ptr->flags3 & (RF3_HURT_LITE))
4311                         {
4312                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4313 #ifdef JP
4314                                 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4315                                 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4316 #else
4317                                 note = " cringes from the light!";
4318                                 note_dies = " shrivels away in the light!";
4319 #endif
4320
4321                                 dam *= 2;
4322                         }
4323                         break;
4324                 }
4325
4326
4327                 /* Dark -- opposite of Lite */
4328                 case GF_DARK:
4329                 {
4330                         if (seen) obvious = TRUE;
4331
4332                         if (r_ptr->flagsr & RFR_RES_ALL)
4333                         {
4334 #ifdef JP
4335                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
4336 #else
4337                                 note = " is immune.";
4338 #endif
4339                                 dam = 0;
4340                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4341                                 break;
4342                         }
4343                         if (r_ptr->flagsr & RFR_RES_DARK)
4344                         {
4345 #ifdef JP
4346                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
4347 #else
4348                                 note = " resists.";
4349 #endif
4350
4351                                 dam *= 2; dam /= (randint1(6)+6);
4352                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4353                         }
4354                         break;
4355                 }
4356
4357
4358                 /* Stone to Mud */
4359                 case GF_KILL_WALL:
4360                 {
4361                         if (r_ptr->flagsr & RFR_RES_ALL)
4362                         {
4363                                 dam = 0;
4364                                 break;
4365                         }
4366                         /* Hurt by rock remover */
4367                         if (r_ptr->flags3 & (RF3_HURT_ROCK))
4368                         {
4369                                 /* Notice effect */
4370                                 if (seen) obvious = TRUE;
4371
4372                                 /* Memorize the effects */
4373                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4374
4375                                 /* Cute little message */
4376 #ifdef JP
4377 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4378 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4379 #else
4380                                 note = " loses some skin!";
4381                                 note_dies = " dissolves!";
4382 #endif
4383
4384                         }
4385
4386                         /* Usually, ignore the effects */
4387                         else
4388                         {
4389                                 /* No damage */
4390                                 dam = 0;
4391                         }
4392
4393                         break;
4394                 }
4395
4396
4397                 /* Teleport undead (Use "dam" as "power") */
4398                 case GF_AWAY_UNDEAD:
4399                 {
4400                         /* Only affect undead */
4401                         if (r_ptr->flags3 & (RF3_UNDEAD))
4402                         {
4403                                 bool resists_tele = FALSE;
4404
4405                                 if (r_ptr->flagsr & RFR_RES_TELE)
4406                                 {
4407                                         if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4408                                         {
4409                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4410 #ifdef JP
4411 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4412 #else
4413                                                 note = " is unaffected!";
4414 #endif
4415
4416                                                 resists_tele = TRUE;
4417                                         }
4418                                         else if (r_ptr->level > randint1(100))
4419                                         {
4420                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4421 #ifdef JP
4422 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
4423 #else
4424                                                 note = " resists!";
4425 #endif
4426
4427                                                 resists_tele = TRUE;
4428                                         }
4429                                 }
4430
4431                                 if (!resists_tele)
4432                                 {
4433                                         if (seen) obvious = TRUE;
4434                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4435                                         do_dist = dam;
4436                                 }
4437                         }
4438
4439                         /* Others ignore */
4440                         else
4441                         {
4442                                 /* Irrelevant */
4443                                 skipped = TRUE;
4444                         }
4445
4446                         /* No "real" damage */
4447                         dam = 0;
4448                         break;
4449                 }
4450
4451
4452                 /* Teleport evil (Use "dam" as "power") */
4453                 case GF_AWAY_EVIL:
4454                 {
4455                         /* Only affect evil */
4456                         if (r_ptr->flags3 & (RF3_EVIL))
4457                         {
4458                                 bool resists_tele = FALSE;
4459
4460                                 if (r_ptr->flagsr & RFR_RES_TELE)
4461                                 {
4462                                         if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4463                                         {
4464                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4465 #ifdef JP
4466 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4467 #else
4468                                                 note = " is unaffected!";
4469 #endif
4470
4471                                                 resists_tele = TRUE;
4472                                         }
4473                                         else if (r_ptr->level > randint1(100))
4474                                         {
4475                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4476 #ifdef JP
4477 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
4478 #else
4479                                                 note = " resists!";
4480 #endif
4481
4482                                                 resists_tele = TRUE;
4483                                         }
4484                                 }
4485
4486                                 if (!resists_tele)
4487                                 {
4488                                         if (seen) obvious = TRUE;
4489                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4490                                         do_dist = dam;
4491                                 }
4492                         }
4493
4494                         /* Others ignore */
4495                         else
4496                         {
4497                                 /* Irrelevant */
4498                                 skipped = TRUE;
4499                         }
4500
4501                         /* No "real" damage */
4502                         dam = 0;
4503                         break;
4504                 }
4505
4506
4507                 /* Teleport monster (Use "dam" as "power") */
4508                 case GF_AWAY_ALL:
4509                 {
4510                         bool resists_tele = FALSE;
4511                         if (r_ptr->flagsr & RFR_RES_TELE)
4512                         {
4513                                 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4514                                 {
4515                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4516 #ifdef JP
4517                                         note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4518 #else
4519                                         note = " is unaffected!";
4520 #endif
4521
4522                                         resists_tele = TRUE;
4523                                 }
4524                                 else if (r_ptr->level > randint1(100))
4525                                 {
4526                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4527 #ifdef JP
4528                                         note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡ª";
4529 #else
4530                                         note = " resists!";
4531 #endif
4532
4533                                         resists_tele = TRUE;
4534                                 }
4535                         }
4536
4537                         if (!resists_tele)
4538                         {
4539                                 /* Obvious */
4540                                 if (seen) obvious = TRUE;
4541
4542                                 /* Prepare to teleport */
4543                                 do_dist = dam;
4544                         }
4545
4546                         /* No "real" damage */
4547                         dam = 0;
4548                         break;
4549                 }
4550
4551
4552                 /* Turn undead (Use "dam" as "power") */
4553                 case GF_TURN_UNDEAD:
4554                 {
4555                         if (r_ptr->flagsr & RFR_RES_ALL)
4556                         {
4557                                 skipped = TRUE;
4558                                 break;
4559                         }
4560                         /* Only affect undead */
4561                         if (r_ptr->flags3 & (RF3_UNDEAD))
4562                         {
4563                                 /* Obvious */
4564                                 if (seen) obvious = TRUE;
4565
4566                                 /* Learn about type */
4567                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4568
4569                                 /* Apply some fear */
4570                                 do_fear = damroll(3, (dam / 2)) + 1;
4571
4572                                 /* Attempt a saving throw */
4573                                 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4574                                 {
4575                                         /* No obvious effect */
4576 #ifdef JP
4577                                         note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4578 #else
4579                                         note = " is unaffected!";
4580 #endif
4581
4582                                         obvious = FALSE;
4583                                         do_fear = 0;
4584                                 }
4585                         }
4586
4587                         /* Others ignore */
4588                         else
4589                         {
4590                                 /* Irrelevant */
4591                                 skipped = TRUE;
4592                         }
4593
4594                         /* No "real" damage */
4595                         dam = 0;
4596                         break;
4597                 }
4598
4599
4600                 /* Turn evil (Use "dam" as "power") */
4601                 case GF_TURN_EVIL:
4602                 {
4603                         if (r_ptr->flagsr & RFR_RES_ALL)
4604                         {
4605                                 skipped = TRUE;
4606                                 break;
4607                         }
4608                         /* Only affect evil */
4609                         if (r_ptr->flags3 & (RF3_EVIL))
4610                         {
4611                                 /* Obvious */
4612                                 if (seen) obvious = TRUE;
4613
4614                                 /* Learn about type */
4615                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4616
4617                                 /* Apply some fear */
4618                                 do_fear = damroll(3, (dam / 2)) + 1;
4619
4620                                 /* Attempt a saving throw */
4621                                 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4622                                 {
4623                                         /* No obvious effect */
4624 #ifdef JP
4625                                         note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4626 #else
4627                                         note = " is unaffected!";
4628 #endif
4629
4630                                         obvious = FALSE;
4631                                         do_fear = 0;
4632                                 }
4633                         }
4634
4635                         /* Others ignore */
4636                         else
4637                         {
4638                                 /* Irrelevant */
4639                                 skipped = TRUE;
4640                         }
4641
4642                         /* No "real" damage */
4643                         dam = 0;
4644                         break;
4645                 }
4646
4647
4648                 /* Turn monster (Use "dam" as "power") */
4649                 case GF_TURN_ALL:
4650                 {
4651                         if (r_ptr->flagsr & RFR_RES_ALL)
4652                         {
4653                                 skipped = TRUE;
4654                                 break;
4655                         }
4656                         /* Obvious */
4657                         if (seen) obvious = TRUE;
4658
4659                         /* Apply some fear */
4660                         do_fear = damroll(3, (dam / 2)) + 1;
4661
4662                         /* Attempt a saving throw */
4663                         if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4664                             (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4665                             (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4666                         {
4667                                 /* No obvious effect */
4668 #ifdef JP
4669 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4670 #else
4671                                 note = " is unaffected!";
4672 #endif
4673
4674                                 obvious = FALSE;
4675                                 do_fear = 0;
4676                         }
4677
4678                         /* No "real" damage */
4679                         dam = 0;
4680                         break;
4681                 }
4682
4683
4684                 /* Dispel undead */
4685                 case GF_DISP_UNDEAD:
4686                 {
4687                         if (r_ptr->flagsr & RFR_RES_ALL)
4688                         {
4689                                 skipped = TRUE;
4690                                 dam = 0;
4691                                 break;
4692                         }
4693                         /* Only affect undead */
4694                         if (r_ptr->flags3 & (RF3_UNDEAD))
4695                         {
4696                                 /* Obvious */
4697                                 if (seen) obvious = TRUE;
4698
4699                                 /* Learn about type */
4700                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4701
4702                                 /* Message */
4703 #ifdef JP
4704                                 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4705                                 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4706 #else
4707                                 note = " shudders.";
4708                                 note_dies = " dissolves!";
4709 #endif
4710                         }
4711
4712                         /* Others ignore */
4713                         else
4714                         {
4715                                 /* Irrelevant */
4716                                 skipped = TRUE;
4717
4718                                 /* No damage */
4719                                 dam = 0;
4720                         }
4721
4722                         break;
4723                 }
4724
4725
4726                 /* Dispel evil */
4727                 case GF_DISP_EVIL:
4728                 {
4729                         if (r_ptr->flagsr & RFR_RES_ALL)
4730                         {
4731                                 skipped = TRUE;
4732                                 dam = 0;
4733                                 break;
4734                         }
4735                         /* Only affect evil */
4736                         if (r_ptr->flags3 & (RF3_EVIL))
4737                         {
4738                                 /* Obvious */
4739                                 if (seen) obvious = TRUE;
4740
4741                                 /* Learn about type */
4742                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4743
4744                                 /* Message */
4745 #ifdef JP
4746                                 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4747                                 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4748 #else
4749                                 note = " shudders.";
4750                                 note_dies = " dissolves!";
4751 #endif
4752                         }
4753
4754                         /* Others ignore */
4755                         else
4756                         {
4757                                 /* Irrelevant */
4758                                 skipped = TRUE;
4759
4760                                 /* No damage */
4761                                 dam = 0;
4762                         }
4763
4764                         break;
4765                 }
4766
4767                 /* Dispel good */
4768                 case GF_DISP_GOOD:
4769                 {
4770                         if (r_ptr->flagsr & RFR_RES_ALL)
4771                         {
4772                                 skipped = TRUE;
4773                                 dam = 0;
4774                                 break;
4775                         }
4776                         /* Only affect good */
4777                         if (r_ptr->flags3 & (RF3_GOOD))
4778                         {
4779                                 /* Obvious */
4780                                 if (seen) obvious = TRUE;
4781
4782                                 /* Learn about type */
4783                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4784
4785                                 /* Message */
4786 #ifdef JP
4787                                 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4788                                 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4789 #else
4790                                 note = " shudders.";
4791                                 note_dies = " dissolves!";
4792 #endif
4793                         }
4794
4795                         /* Others ignore */
4796                         else
4797                         {
4798                                 /* Irrelevant */
4799                                 skipped = TRUE;
4800
4801                                 /* No damage */
4802                                 dam = 0;
4803                         }
4804
4805                         break;
4806                 }
4807
4808                 /* Dispel living */
4809                 case GF_DISP_LIVING:
4810                 {
4811                         if (r_ptr->flagsr & RFR_RES_ALL)
4812                         {
4813                                 skipped = TRUE;
4814                                 dam = 0;
4815                                 break;
4816                         }
4817                         /* Only affect non-undead */
4818                         if (monster_living(r_ptr))
4819                         {
4820                                 /* Obvious */
4821                                 if (seen) obvious = TRUE;
4822
4823                                 /* Message */
4824 #ifdef JP
4825 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4826 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4827 #else
4828                                 note = " shudders.";
4829                                 note_dies = " dissolves!";
4830 #endif
4831
4832                         }
4833
4834                         /* Others ignore */
4835                         else
4836                         {
4837                                 /* Irrelevant */
4838                                 skipped = TRUE;
4839
4840                                 /* No damage */
4841                                 dam = 0;
4842                         }
4843
4844                         break;
4845                 }
4846
4847                 /* Dispel demons */
4848                 case GF_DISP_DEMON:
4849                 {
4850                         if (r_ptr->flagsr & RFR_RES_ALL)
4851                         {
4852                                 skipped = TRUE;
4853                                 dam = 0;
4854                                 break;
4855                         }
4856                         /* Only affect demons */
4857                         if (r_ptr->flags3 & (RF3_DEMON))
4858                         {
4859                                 /* Obvious */
4860                                 if (seen) obvious = TRUE;
4861
4862                                 /* Learn about type */
4863                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4864
4865                                 /* Message */
4866 #ifdef JP
4867                                 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4868                                 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4869 #else
4870                                 note = " shudders.";
4871                                 note_dies = " dissolves!";
4872 #endif
4873                         }
4874
4875                         /* Others ignore */
4876                         else
4877                         {
4878                                 /* Irrelevant */
4879                                 skipped = TRUE;
4880
4881                                 /* No damage */
4882                                 dam = 0;
4883                         }
4884
4885                         break;
4886                 }
4887
4888                 /* Dispel monster */
4889                 case GF_DISP_ALL:
4890                 {
4891                         if (r_ptr->flagsr & RFR_RES_ALL)
4892                         {
4893                                 skipped = TRUE;
4894                                 dam = 0;
4895                                 break;
4896                         }
4897                         /* Obvious */
4898                         if (seen) obvious = TRUE;
4899
4900                         /* Message */
4901 #ifdef JP
4902 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4903 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4904 #else
4905                         note = " shudders.";
4906                         note_dies = " dissolves!";
4907 #endif
4908
4909
4910                         break;
4911                 }
4912
4913                 /* Drain mana */
4914                 case GF_DRAIN_MANA:
4915                 {
4916                         if (seen) obvious = TRUE;
4917
4918                         if (r_ptr->flagsr & RFR_RES_ALL)
4919                         {
4920 #ifdef JP
4921                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
4922 #else
4923                                 note = " is immune.";
4924 #endif
4925                                 skipped = TRUE;
4926                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4927                                 break;
4928                         }
4929
4930                         if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4931                         {
4932                                 if (who > 0)
4933                                 {
4934                                         /* Heal the monster */
4935                                         if (caster_ptr->hp < caster_ptr->maxhp)
4936                                         {
4937                                                 /* Heal */
4938                                                 caster_ptr->hp += 6 * dam;
4939                                                 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4940
4941                                                 /* Redraw (later) if needed */
4942                                                 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4943                                                 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4944
4945                                                 /* Special message */
4946                                                 if (see_s_msg)
4947                                                 {
4948                                                         /* Get the monster name */
4949                                                         monster_desc(killer, caster_ptr, 0);
4950 #ifdef JP
4951                                                         msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4952 #else
4953                                                         msg_format("%^s appears healthier.", killer);
4954 #endif
4955                                                 }
4956                                         }
4957                                 }
4958                                 else
4959                                 {
4960                                         /* Message */
4961 #ifdef JP
4962                                         msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4963 #else
4964                                         msg_format("You draw psychic energy from %s.", m_name);
4965 #endif
4966
4967                                         (void)hp_player(dam);
4968                                 }
4969                         }
4970                         else
4971                         {
4972 #ifdef JP
4973                                 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4974 #else
4975                                 if (see_s_msg) msg_format("%s is unaffected.", m_name);
4976 #endif
4977                         }
4978                         dam = 0;
4979                         break;
4980                 }
4981
4982                 /* Mind blast */
4983                 case GF_MIND_BLAST:
4984                 {
4985                         if (seen) obvious = TRUE;
4986                         /* Message */
4987 #ifdef JP
4988                         if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
4989 #else
4990                         if (!who) msg_format("You gaze intently at %s.", m_name);
4991 #endif
4992
4993                         if (r_ptr->flagsr & RFR_RES_ALL)
4994                         {
4995 #ifdef JP
4996                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
4997 #else
4998                                 note = " is immune.";
4999 #endif
5000                                 skipped = TRUE;
5001                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5002                                 break;
5003                         }
5004
5005                         /* Attempt a saving throw */
5006                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
5007                                  (r_ptr->flags3 & RF3_NO_CONF) ||
5008                                  (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5009                         {
5010                                 /* Memorize a flag */
5011                                 if (r_ptr->flags3 & (RF3_NO_CONF))
5012                                 {
5013                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5014                                 }
5015 #ifdef JP
5016                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5017 #else
5018                                 note = "is unaffected!";
5019 #endif
5020                                 dam = 0;
5021                         }
5022                         else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5023                         {
5024                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5025 #ifdef JP
5026                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5027 #else
5028                                 note = " is immune!";
5029 #endif
5030                                 dam = 0;
5031                         }
5032                         else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5033                         {
5034                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5035 #ifdef JP
5036                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
5037 #else
5038                                 note = " resists.";
5039 #endif
5040                                 dam /= 3;
5041                         }
5042                         else
5043                         {
5044 #ifdef JP
5045                                 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5046                                 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5047 #else
5048                                 note = " is blasted by psionic energy.";
5049                                 note_dies = " collapses, a mindless husk.";
5050 #endif
5051
5052                                 if (who > 0) do_conf = randint0(4) + 4;
5053                                 else do_conf = randint0(8) + 8;
5054                         }
5055                         break;
5056                 }
5057
5058                 /* Brain smash */
5059                 case GF_BRAIN_SMASH:
5060                 {
5061                         if (seen) obvious = TRUE;
5062                         /* Message */
5063 #ifdef JP
5064                         if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5065 #else
5066                         if (!who) msg_format("You gaze intently at %s.", m_name);
5067 #endif
5068
5069                         if (r_ptr->flagsr & RFR_RES_ALL)
5070                         {
5071 #ifdef JP
5072                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5073 #else
5074                                 note = " is immune.";
5075 #endif
5076                                 skipped = TRUE;
5077                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5078                                 break;
5079                         }
5080
5081                         /* Attempt a saving throw */
5082                         if ((r_ptr->flags1 & RF1_UNIQUE) ||
5083                                  (r_ptr->flags3 & RF3_NO_CONF) ||
5084                                  (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5085                         {
5086                                 /* Memorize a flag */
5087                                 if (r_ptr->flags3 & (RF3_NO_CONF))
5088                                 {
5089                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5090                                 }
5091 #ifdef JP
5092                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5093 #else
5094                                 note = "is unaffected!";
5095 #endif
5096                                 dam = 0;
5097                         }
5098                         else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5099                         {
5100                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5101 #ifdef JP
5102                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5103 #else
5104                                 note = " is immune!";
5105 #endif
5106                                 dam = 0;
5107                         }
5108                         else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5109                         {
5110                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5111 #ifdef JP
5112                                 note = "¤Ë¤ÏÂÑÀ­¤¬¤¢¤ë¡£";
5113 #else
5114                                 note = " resists.";
5115 #endif
5116                                 dam /= 3;
5117                         }
5118                         else
5119                         {
5120 #ifdef JP
5121                                 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5122                                 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5123 #else
5124                                 note = " is blasted by psionic energy.";
5125                                 note_dies = " collapses, a mindless husk.";
5126 #endif
5127
5128                                 if (who > 0)
5129                                 {
5130                                         do_conf = randint0(4) + 4;
5131                                         do_stun = randint0(4) + 4;
5132                                 }
5133                                 else
5134                                 {
5135                                         do_conf = randint0(8) + 8;
5136                                         do_stun = randint0(8) + 8;
5137                                 }
5138                                 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5139                                 if (c_ptr->m_idx == p_ptr->riding)
5140                                         p_ptr->update |= (PU_BONUS);
5141                         }
5142                         break;
5143                 }
5144
5145                 /* CAUSE_1 */
5146                 case GF_CAUSE_1:
5147                 {
5148                         if (seen) obvious = TRUE;
5149                         /* Message */
5150 #ifdef JP
5151                         if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5152 #else
5153                         if (!who) msg_format("You point at %s and curses.", m_name);
5154 #endif
5155
5156                         if (r_ptr->flagsr & RFR_RES_ALL)
5157                         {
5158 #ifdef JP
5159                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5160 #else
5161                                 note = " is immune.";
5162 #endif
5163                                 skipped = TRUE;
5164                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5165                                 break;
5166                         }
5167
5168                         /* Attempt a saving throw */
5169                         if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5170                         {
5171 #ifdef JP
5172                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5173 #else
5174                                 note = "is unaffected!";
5175 #endif
5176                                 dam = 0;
5177                         }
5178                         break;
5179                 }
5180
5181                 /* CAUSE_2 */
5182                 case GF_CAUSE_2:
5183                 {
5184                         if (seen) obvious = TRUE;
5185                         /* Message */
5186 #ifdef JP
5187                         if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5188 #else
5189                         if (!who) msg_format("You point at %s and curses horribly.", m_name);
5190 #endif
5191
5192                         if (r_ptr->flagsr & RFR_RES_ALL)
5193                         {
5194 #ifdef JP
5195                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5196 #else
5197                                 note = " is immune.";
5198 #endif
5199                                 skipped = TRUE;
5200                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5201                                 break;
5202                         }
5203
5204                         /* Attempt a saving throw */
5205                         if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5206                         {
5207 #ifdef JP
5208                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5209 #else
5210                                 note = "is unaffected!";
5211 #endif
5212                                 dam = 0;
5213                         }
5214                         break;
5215                 }
5216
5217                 /* CAUSE_3 */
5218                 case GF_CAUSE_3:
5219                 {
5220                         if (seen) obvious = TRUE;
5221                         /* Message */
5222 #ifdef JP
5223                         if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5224 #else
5225                         if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5226 #endif
5227
5228                         if (r_ptr->flagsr & RFR_RES_ALL)
5229                         {
5230 #ifdef JP
5231                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5232 #else
5233                                 note = " is immune.";
5234 #endif
5235                                 skipped = TRUE;
5236                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5237                                 break;
5238                         }
5239
5240                         /* Attempt a saving throw */
5241                         if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5242                         {
5243 #ifdef JP
5244                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5245 #else
5246                                 note = "is unaffected!";
5247 #endif
5248                                 dam = 0;
5249                         }
5250                         break;
5251                 }
5252
5253                 /* CAUSE_4 */
5254                 case GF_CAUSE_4:
5255                 {
5256                         if (seen) obvious = TRUE;
5257                         /* Message */
5258 #ifdef JP
5259                         if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5260 #else
5261                         if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5262 #endif
5263
5264                         if (r_ptr->flagsr & RFR_RES_ALL)
5265                         {
5266 #ifdef JP
5267                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5268 #else
5269                                 note = " is immune.";
5270 #endif
5271                                 skipped = TRUE;
5272                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5273                                 break;
5274                         }
5275
5276                         /* Attempt a saving throw */
5277                         if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5278                         {
5279 #ifdef JP
5280                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5281 #else
5282                                 note = "is unaffected!";
5283 #endif
5284                                 dam = 0;
5285                         }
5286                         break;
5287                 }
5288
5289                 /* HAND_DOOM */
5290                 case GF_HAND_DOOM:
5291                 {
5292                         if (seen) obvious = TRUE;
5293
5294                         if (r_ptr->flagsr & RFR_RES_ALL)
5295                         {
5296 #ifdef JP
5297                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5298 #else
5299                                 note = " is immune.";
5300 #endif
5301                                 skipped = TRUE;
5302                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5303                                 break;
5304                         }
5305
5306                         if (r_ptr->flags1 & RF1_UNIQUE)
5307                         {
5308 #ifdef JP
5309                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5310 #else
5311                                 note = "is unaffected!";
5312 #endif
5313                                 dam = 0;
5314                         }
5315                         else
5316                         {
5317                                 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5318                                    (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5319                                 {
5320                                         dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5321
5322                                         if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5323                                 }
5324                                 else
5325                                 {
5326 #ifdef JP
5327                                         note = "¤ÏÂÑÀ­¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5328 #else
5329                                         note = "resists!";
5330 #endif
5331                                         dam = 0;
5332                                 }
5333                         }
5334                         break;
5335                 }
5336
5337                 /* Capture monster */
5338                 case GF_CAPTURE:
5339                 {
5340                         int nokori_hp;
5341                         if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5342                             (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
5343                         {
5344 #ifdef JP
5345 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5346 #else
5347                                 msg_format("%^s is unaffected.", m_name);
5348 #endif
5349                                 skipped = TRUE;
5350                                 break;
5351                         }
5352
5353                         if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5354                         else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5355                                 nokori_hp = m_ptr->maxhp * 3 / 10;
5356                         else
5357                                 nokori_hp = m_ptr->maxhp * 3 / 20;
5358
5359                         if (m_ptr->hp >= nokori_hp)
5360                         {
5361 #ifdef JP
5362 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5363 #else
5364                                 msg_format("You need to weaken %s more.", m_name);
5365 #endif
5366                                 skipped = TRUE;
5367                         }
5368                         else if (m_ptr->hp < randint0(nokori_hp))
5369                         {
5370                                 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5371 #ifdef JP
5372 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5373 #else
5374                                 msg_format("You capture %^s!", m_name);
5375 #endif
5376                                 cap_mon = m_list[c_ptr->m_idx].r_idx;
5377                                 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5378                                 cap_hp = m_list[c_ptr->m_idx].hp;
5379                                 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5380                                 if (m_list[c_ptr->m_idx].nickname)
5381                                         cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5382                                 else
5383                                         cap_nickname = 0;
5384                                 if (c_ptr->m_idx == p_ptr->riding)
5385                                 {
5386                                         if (rakuba(-1, FALSE))
5387                                         {
5388 #ifdef JP
5389 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5390 #else
5391                                                 msg_format("You have fallen from %s.", m_name);
5392 #endif
5393                                         }
5394                                 }
5395
5396                                 delete_monster_idx(c_ptr->m_idx);
5397
5398                                 return (TRUE);
5399                         }
5400                         else
5401                         {
5402 #ifdef JP
5403 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5404 #else
5405                                 msg_format("You failed to capture %s.", m_name);
5406 #endif
5407                                 skipped = TRUE;
5408                         }
5409                         break;
5410                 }
5411
5412                 /* Attack (Use "dam" as attack type) */
5413                 case GF_ATTACK:
5414                 {
5415                         /* Return this monster's death */
5416                         return py_attack(y, x, dam);
5417                 }
5418
5419                 /* Sleep (Use "dam" as "power") */
5420                 case GF_ENGETSU:
5421                 {
5422                         int effect = 0;
5423                         bool done = TRUE;
5424
5425                         if (seen) obvious = TRUE;
5426
5427                         if (r_ptr->flagsr & RFR_RES_ALL)
5428                         {
5429 #ifdef JP
5430                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5431 #else
5432                                 note = " is immune.";
5433 #endif
5434                                 dam = 0;
5435                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5436                                 break;
5437                         }
5438                         if (r_ptr->flags2 & RF2_EMPTY_MIND)
5439                         {
5440 #ifdef JP
5441 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5442 #else
5443                                 note = " is immune!";
5444 #endif
5445                                 dam = 0;
5446                                 skipped = TRUE;
5447                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5448                                 break;
5449                         }
5450                         if (m_ptr->csleep)
5451                         {
5452 #ifdef JP
5453 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5454 #else
5455                                 note = " is immune!";
5456 #endif
5457                                 dam = 0;
5458                                 skipped = TRUE;
5459                                 break;
5460                         }
5461
5462                         if (one_in_(5)) effect = 1;
5463                         else if (one_in_(4)) effect = 2;
5464                         else if (one_in_(3)) effect = 3;
5465                         else done = FALSE;
5466
5467                         if (effect == 1)
5468                         {
5469                                 /* Powerful monsters can resist */
5470                                 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5471                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5472                                 {
5473 #ifdef JP
5474 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5475 #else
5476                                         note = " is unaffected!";
5477 #endif
5478
5479                                         obvious = FALSE;
5480                                 }
5481
5482                                 /* Normal monsters slow down */
5483                                 else
5484                                 {
5485                                         if (!m_ptr->slow)
5486                                         {
5487 #ifdef JP
5488 note = "¤ÎÆ°¤­¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5489 #else
5490                                                 note = " starts moving slower.";
5491 #endif
5492                                         }
5493                                         m_ptr->slow = MIN(200, m_ptr->slow + 50);
5494
5495                                         if (c_ptr->m_idx == p_ptr->riding)
5496                                                 p_ptr->update |= (PU_BONUS);
5497                                 }
5498                         }
5499
5500                         else if (effect == 2)
5501                         {
5502                                 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5503
5504                                 /* Attempt a saving throw */
5505                                 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5506                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5507                                 {
5508                                         /* Resist */
5509                                         do_stun = 0;
5510
5511                                         /* No obvious effect */
5512 #ifdef JP
5513 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5514 #else
5515                                         note = " is unaffected!";
5516 #endif
5517
5518                                         obvious = FALSE;
5519                                 }
5520                         }
5521
5522                         else if (effect == 3)
5523                         {
5524                                 /* Attempt a saving throw */
5525                                 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5526                                     (r_ptr->flags3 & RF3_NO_SLEEP) ||
5527                                     (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5528                                 {
5529                                         /* Memorize a flag */
5530                                         if (r_ptr->flags3 & RF3_NO_SLEEP)
5531                                         {
5532                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5533                                         }
5534
5535                                         /* No obvious effect */
5536 #ifdef JP
5537 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5538 #else
5539                                         note = " is unaffected!";
5540 #endif
5541
5542                                         obvious = FALSE;
5543                                 }
5544                                 else
5545                                 {
5546                                         /* Go to sleep (much) later */
5547 #ifdef JP
5548 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5549 #else
5550                                         note = " falls asleep!";
5551 #endif
5552
5553                                         do_sleep = 500;
5554                                 }
5555                         }
5556
5557                         if (!done)
5558                         {
5559 #ifdef JP
5560 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5561 #else
5562                                 note = " is immune!";
5563 #endif
5564                         }
5565
5566                         /* No "real" damage */
5567                         dam = 0;
5568                         break;
5569                 }
5570
5571                 /* GENOCIDE */
5572                 case GF_GENOCIDE:
5573                 {
5574                         bool angry = FALSE;
5575                         if (seen) obvious = TRUE;
5576
5577                         if (r_ptr->flagsr & RFR_RES_ALL)
5578                         {
5579 #ifdef JP
5580                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5581 #else
5582                                 note = " is immune.";
5583 #endif
5584                                 skipped = TRUE;
5585                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5586                                 break;
5587                         }
5588
5589                         if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (c_ptr->m_idx == p_ptr->riding)) || p_ptr->inside_arena || p_ptr->inside_quest)
5590                         {
5591                                 dam = 0;
5592                                 angry = TRUE;
5593                         }
5594                         else
5595                         {
5596                                 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG2_NOGENO))
5597                                 {
5598                                         dam = 0;
5599                                         angry = TRUE;
5600                                 }
5601                                 else
5602                                 {
5603                                         delete_monster_idx(c_ptr->m_idx);
5604 #ifdef JP
5605                                         msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5606 #else
5607                                         msg_format("%^s disappered!",m_name);
5608 #endif
5609
5610 #ifdef JP
5611                                         take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5612 #else
5613                                         take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5614 #endif
5615                                         dam = 0;
5616
5617                                         chg_virtue(V_VITALITY, -1);
5618
5619                                         skipped = TRUE;
5620
5621                                         /* Redraw */
5622                                         p_ptr->redraw |= (PR_HP);
5623
5624                                         /* Window stuff */
5625                                         p_ptr->window |= (PW_PLAYER);
5626                                         return TRUE;
5627                                 }
5628                         }
5629                         if (angry)
5630                         {
5631 #ifdef JP
5632 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5633 #else
5634                                 note = "is unaffected!";
5635 #endif
5636                                 get_angry = TRUE;
5637                                 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
5638                         }
5639                         break;
5640                 }
5641
5642                 case GF_PHOTO:
5643                 {
5644 #ifdef JP
5645                         if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5646 #else
5647                         if (!who) msg_format("You take a photograph of %s.", m_name);
5648 #endif
5649                         /* Hurt by light */
5650                         if (r_ptr->flags3 & (RF3_HURT_LITE))
5651                         {
5652                                 /* Obvious effect */
5653                                 if (seen) obvious = TRUE;
5654
5655                                 /* Memorize the effects */
5656                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5657
5658                                 /* Special effect */
5659 #ifdef JP
5660                                 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5661                                 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5662 #else
5663                                 note = " cringes from the light!";
5664                                 note_dies = " shrivels away in the light!";
5665 #endif
5666                         }
5667
5668                         /* Normally no damage */
5669                         else
5670                         {
5671                                 /* No damage */
5672                                 dam = 0;
5673                         }
5674
5675                         photo = m_ptr->r_idx;
5676
5677                         break;
5678                 }
5679
5680
5681                 /* blood curse */
5682                 case GF_BLOOD_CURSE:
5683                 {
5684                         if (seen) obvious = TRUE;
5685
5686                         if (r_ptr->flagsr & RFR_RES_ALL)
5687                         {
5688 #ifdef JP
5689                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5690 #else
5691                                 note = " is immune.";
5692 #endif
5693                                 dam = 0;
5694                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5695                                 break;
5696                         }
5697                         break;
5698                 }
5699
5700                 case GF_CRUSADE:
5701                 {
5702                         bool success = FALSE;
5703                         if (seen) obvious = TRUE;
5704
5705                         if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5706                         {
5707                                 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5708                                 if (dam < 1) dam = 1;
5709
5710                                 /* No need to tame your pet */
5711                                 if (is_pet(m_ptr))
5712                                 {
5713 #ifdef JP
5714                                         note = "¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5715 #else
5716                                         note = " starts moving faster.";
5717 #endif
5718
5719                                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
5720                                         success = TRUE;
5721                                 }
5722
5723                                 /* Attempt a saving throw */
5724                                 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5725                                     (r_ptr->flags1 & (RF1_UNIQUE)) ||
5726                                     (m_ptr->mflag2 & MFLAG2_NOPET) ||
5727                                     (p_ptr->cursed & TRC_AGGRAVATE) ||
5728                                          ((r_ptr->level+10) > randint1(dam)))
5729                                 {
5730                                         /* Resist */
5731                                         if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5732                                 }
5733                                 else
5734                                 {
5735 #ifdef JP
5736 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5737 #else
5738                                         note = " is tamed!";
5739 #endif
5740
5741                                         set_pet(m_ptr);
5742                                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
5743
5744                                         /* Learn about type */
5745                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5746                                         success = TRUE;
5747                                 }
5748                         }
5749
5750                         if (!success)
5751                         {
5752                                 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5753                                 {
5754                                         do_fear = randint1(90)+10;
5755                                 }
5756                                 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5757                         }
5758
5759                         /* No "real" damage */
5760                         dam = 0;
5761                         break;
5762                 }
5763
5764                 case GF_WOUNDS:
5765                 {
5766                         if (seen) obvious = TRUE;
5767
5768                         if (r_ptr->flagsr & RFR_RES_ALL)
5769                         {
5770 #ifdef JP
5771                                 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ­¤¬¤¢¤ë¡ª";
5772 #else
5773                                 note = " is immune.";
5774 #endif
5775                                 skipped = TRUE;
5776                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5777                                 break;
5778                         }
5779
5780                         /* Attempt a saving throw */
5781                         if (randint0(100 + dam) < (r_ptr->level + 50))
5782                         {
5783
5784 #ifdef JP
5785 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5786 #else
5787                                 note = "is unaffected!";
5788 #endif
5789                                 dam = 0;
5790                         }
5791                         break;
5792                 }
5793
5794                 /* Default */
5795                 default:
5796                 {
5797                         /* Irrelevant */
5798                         skipped = TRUE;
5799
5800                         /* No damage */
5801                         dam = 0;
5802
5803                         break;
5804                 }
5805         }
5806
5807
5808         /* Absolutely no effect */
5809         if (skipped) return (FALSE);
5810
5811         /* "Unique" monsters cannot be polymorphed */
5812         if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5813
5814         /* Quest monsters cannot be polymorphed */
5815         if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5816
5817         if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5818
5819         /* "Unique" and "quest" monsters can only be "killed" by the player. */
5820         if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5821         {
5822                 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5823         }
5824
5825         if (!who && slept)
5826         {
5827                 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5828                 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5829         }
5830
5831         /* Modify the damage */
5832         tmp = dam;
5833         dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5834 #ifdef JP
5835         if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5836 #else
5837         if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5838 #endif
5839
5840         /* Check for death */
5841         if (dam > m_ptr->hp)
5842         {
5843                 /* Extract method of death */
5844                 note = note_dies;
5845         }
5846         else
5847         {
5848                 /* Sound and Impact resisters never stun */
5849                 if (do_stun &&
5850                     !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5851                     !(r_ptr->flags3 & RF3_NO_STUN))
5852                 {
5853                         /* Obvious */
5854                         if (seen) obvious = TRUE;
5855
5856                         /* Get stunned */
5857                         if (m_ptr->stunned)
5858                         {
5859 #ifdef JP
5860                                 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5861 #else
5862                                 note = " is more dazed.";
5863 #endif
5864
5865                                 tmp = m_ptr->stunned + (do_stun / 2);
5866                         }
5867                         else
5868                         {
5869 #ifdef JP
5870                                 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5871 #else
5872                                 note = " is dazed.";
5873 #endif
5874
5875                                 tmp = do_stun;
5876                         }
5877
5878                         /* Apply stun */
5879                         m_ptr->stunned = (tmp < 200) ? tmp : 200;
5880
5881                         /* Get angry */
5882                         get_angry = TRUE;
5883                 }
5884
5885                 /* Confusion and Chaos resisters (and sleepers) never confuse */
5886                 if (do_conf &&
5887                          !(r_ptr->flags3 & RF3_NO_CONF) &&
5888                          !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5889                 {
5890                         /* Obvious */
5891                         if (seen) obvious = TRUE;
5892
5893                         /* Already partially confused */
5894                         if (m_ptr->confused)
5895                         {
5896 #ifdef JP
5897                                 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5898 #else
5899                                 note = " looks more confused.";
5900 #endif
5901
5902                                 tmp = m_ptr->confused + (do_conf / 2);
5903                         }
5904
5905                         /* Was not confused */
5906                         else
5907                         {
5908 #ifdef JP
5909                                 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5910 #else
5911                                 note = " looks confused.";
5912 #endif
5913
5914                                 tmp = do_conf;
5915                         }
5916
5917                         /* Apply confusion */
5918                         m_ptr->confused = (tmp < 200) ? tmp : 200;
5919
5920                         /* Get angry */
5921                         get_angry = TRUE;
5922                 }
5923
5924                 if (do_time)
5925                 {
5926                         /* Obvious */
5927                         if (seen) obvious = TRUE;
5928
5929                         if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5930
5931                         if (do_time)
5932                         {
5933 #ifdef JP
5934                                 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5935 #else
5936                                 note = " seems weakened.";
5937 #endif
5938                                 m_ptr->maxhp -= do_time;
5939                                 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5940                         }
5941                         get_angry = TRUE;
5942                 }
5943
5944                 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5945                 if (do_poly && (randint1(90) > r_ptr->level))
5946                 {
5947                         if (polymorph_monster(y, x))
5948                         {
5949                                 /* Obvious */
5950                                 if (seen) obvious = TRUE;
5951
5952                                 /* Monster polymorphs */
5953 #ifdef JP
5954                                 note = "¤¬ÊѿȤ·¤¿¡ª";
5955 #else
5956                                 note = " changes!";
5957 #endif
5958
5959                                 /* Turn off the damage */
5960                                 dam = 0;
5961
5962                                 /* Hack -- Get new monster */
5963                                 m_ptr = &m_list[c_ptr->m_idx];
5964
5965                                 /* Hack -- Get new race */
5966                                 r_ptr = &r_info[m_ptr->r_idx];
5967                         }
5968                         else
5969                         {
5970                                 /* No polymorph */
5971 #ifdef JP
5972                                 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5973 #else
5974                                 note = " is unaffected!";
5975 #endif
5976                         }
5977                 }
5978
5979                 /* Handle "teleport" */
5980                 if (do_dist)
5981                 {
5982                         /* Obvious */
5983                         if (seen) obvious = TRUE;
5984
5985                         /* Message */
5986 #ifdef JP
5987                         note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5988 #else
5989                         note = " disappears!";
5990 #endif
5991
5992                         if (!who) chg_virtue(V_VALOUR, -1);
5993
5994                         /* Teleport */
5995                         teleport_away(c_ptr->m_idx, do_dist, (bool)(!who), TRUE);
5996
5997                         /* Hack -- get new location */
5998                         y = m_ptr->fy;
5999                         x = m_ptr->fx;
6000
6001                         /* Hack -- get new grid */
6002                         c_ptr = &cave[y][x];
6003                 }
6004
6005                 /* Fear */
6006                 if (do_fear)
6007                 {
6008                         /* Increase fear */
6009                         tmp = m_ptr->monfear + do_fear;
6010
6011                         /* Set fear */
6012                         m_ptr->monfear = (tmp < 200) ? tmp : 200;
6013
6014                         /* Get angry */
6015                         get_angry = TRUE;
6016                 }
6017         }
6018
6019         if (typ == GF_DRAIN_MANA)
6020         {
6021                 /* Drain mana does nothing */
6022         }
6023
6024         /* If another monster did the damage, hurt the monster by hand */
6025         else if (who)
6026         {
6027                 /* Redraw (later) if needed */
6028                 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
6029                 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
6030
6031                 /* Wake the monster up */
6032                 m_ptr->csleep = 0;
6033
6034                 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
6035
6036                 /* Hurt the monster */
6037                 m_ptr->hp -= dam;
6038
6039                 /* Dead monster */
6040                 if (m_ptr->hp < 0)
6041                 {
6042                         bool sad = FALSE;
6043
6044                         if (is_pet(m_ptr) && !(m_ptr->ml))
6045                                 sad = TRUE;
6046
6047                         /* Give detailed messages if destroyed */
6048                         if (known && note)
6049                         {
6050                                 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6051                                 if (see_s_msg)
6052                                 {
6053                                         msg_format("%^s%s", m_name, note);
6054                                 }
6055                                 else
6056                                 {
6057                                         mon_fight = TRUE;
6058                                 }
6059                         }
6060
6061                         monster_gain_exp(who, m_ptr->r_idx);
6062
6063                         /* Generate treasure, etc */
6064                         monster_death(c_ptr->m_idx, FALSE);
6065
6066                         /* Delete the monster */
6067                         delete_monster_idx(c_ptr->m_idx);
6068
6069                         if (sad)
6070                         {
6071 #ifdef JP
6072 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6073 #else
6074                                 msg_print("You feel sad for a moment.");
6075 #endif
6076
6077                         }
6078                 }
6079
6080                 /* Damaged monster */
6081                 else
6082                 {
6083                         /* Give detailed messages if visible or destroyed */
6084                         if (note && seen_msg) msg_format("%^s%s", m_name, note);
6085
6086                         /* Hack -- Pain message */
6087                         else if (see_s_msg)
6088                         {
6089                                 message_pain(c_ptr->m_idx, dam);
6090                         }
6091                         else
6092                         {
6093                                 mon_fight = TRUE;
6094                         }
6095
6096                         /* Hack -- handle sleep */
6097                         if (do_sleep) m_ptr->csleep = do_sleep;
6098                 }
6099         }
6100
6101         else if (heal_leper)
6102         {
6103 #ifdef JP
6104                 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6105 #else
6106                 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6107 #endif
6108
6109                 delete_monster_idx(c_ptr->m_idx);
6110         }
6111
6112         /* If the player did it, give him experience, check fear */
6113         else
6114         {
6115                 bool fear = FALSE;
6116
6117                 /* Hurt the monster, check for fear and death */
6118                 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6119                 {
6120                         /* Dead monster */
6121                 }
6122
6123                 /* Damaged monster */
6124                 else
6125                 {
6126                         /* HACK - anger the monster before showing the sleep message */
6127                         if (do_sleep) anger_monster(m_ptr);
6128
6129                         /* Give detailed messages if visible or destroyed */
6130                         if (note && seen_msg)
6131 #ifdef JP
6132                                 msg_format("%s%s", m_name, note);
6133 #else
6134                                 msg_format("%^s%s", m_name, note);
6135 #endif
6136
6137
6138                         /* Hack -- Pain message */
6139                         else if (known && (dam || !do_fear))
6140                         {
6141                                 message_pain(c_ptr->m_idx, dam);
6142                         }
6143
6144                         /* Anger monsters */
6145                         if (((dam > 0) || get_angry) && !do_sleep)
6146                                 anger_monster(m_ptr);
6147
6148                         /* Take note */
6149                         if ((fear || do_fear) && seen)
6150                         {
6151                                 /* Sound */
6152                                 sound(SOUND_FLEE);
6153
6154                                 /* Message */
6155 #ifdef JP
6156                                 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6157 #else
6158                                 msg_format("%^s flees in terror!", m_name);
6159 #endif
6160                         }
6161
6162                         /* Hack -- handle sleep */
6163                         if (do_sleep) m_ptr->csleep = do_sleep;
6164                 }
6165         }
6166
6167         if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6168         {
6169                 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6170                 int count = 0;
6171                 do
6172                 {
6173                         switch (randint1(28))
6174                         {
6175                         case 1: case 2:
6176                                 if (!count)
6177                                 {
6178 #ifdef JP
6179 msg_print("ÃÏÌ̤¬Íɤ줿...");
6180 #else
6181                                         msg_print("The ground trembles...");
6182 #endif
6183
6184                                         earthquake(ty, tx, 4 + randint0(4));
6185                                         if (!one_in_(6)) break;
6186                                 }
6187                         case 3: case 4: case 5: case 6:
6188                                 if (!count)
6189                                 {
6190                                         int dam = damroll(10, 10);
6191 #ifdef JP
6192 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6193 #else
6194                                         msg_print("A portal opens to a plane of raw mana!");
6195 #endif
6196
6197                                         project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6198                                         if (!one_in_(6)) break;
6199                                 }
6200                         case 7: case 8:
6201                                 if (!count)
6202                                 {
6203 #ifdef JP
6204 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6205 #else
6206                                         msg_print("Space warps about you!");
6207 #endif
6208
6209                                         if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE, TRUE);
6210                                         if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6211                                         if (!one_in_(6)) break;
6212                                 }
6213                         case 9: case 10: case 11:
6214 #ifdef JP
6215 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6216 #else
6217                                 msg_print("You feel a surge of energy!");
6218 #endif
6219
6220                                 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6221                                 if (!one_in_(6)) break;
6222                         case 12: case 13: case 14: case 15: case 16:
6223                                 aggravate_monsters(0);
6224                                 if (!one_in_(6)) break;
6225                         case 17: case 18:
6226                                 count += activate_hi_summon(ty, tx, TRUE);
6227                                 if (!one_in_(6)) break;
6228                         case 19: case 20: case 21: case 22:
6229                         {
6230                                 bool pet = !one_in_(3);
6231                                 u32b mode = PM_ALLOW_GROUP;
6232
6233                                 if (pet) mode |= PM_FORCE_PET;
6234                                 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6235
6236                                 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6237                                 if (!one_in_(6)) break;
6238                         }
6239                         case 23: case 24: case 25:
6240                                 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6241 #ifdef JP
6242 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6243 #else
6244                                 msg_print("You feel your life draining away...");
6245 #endif
6246
6247                                 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6248                                 else lose_exp(p_ptr->exp / 16);
6249                                 if (!one_in_(6)) break;
6250                         case 26: case 27: case 28:
6251                         {
6252                                 int i = 0;
6253                                 if (one_in_(13))
6254                                 {
6255                                         while (i < 6)
6256                                         {
6257                                                 do
6258                                                 {
6259                                                         (void)do_dec_stat(i);
6260                                                 }
6261                                                 while (one_in_(2));
6262
6263                                                 i++;
6264                                         }
6265                                 }
6266                                 else
6267                                 {
6268                                         (void)do_dec_stat(randint0(6));
6269                                 }
6270                                 break;
6271                         }
6272                         }
6273                 }
6274                 while (one_in_(5));
6275         }
6276
6277         if (p_ptr->inside_battle)
6278         {
6279                 p_ptr->health_who = c_ptr->m_idx;
6280                 p_ptr->redraw |= (PR_HEALTH);
6281                 redraw_stuff();
6282         }
6283
6284         /* XXX XXX XXX Verify this code */
6285
6286         /* Update the monster */
6287         update_mon(c_ptr->m_idx, FALSE);
6288
6289         /* Redraw the monster grid */
6290         lite_spot(y, x);
6291
6292
6293         /* Update monster recall window */
6294         if (p_ptr->monster_race_idx == m_ptr->r_idx)
6295         {
6296                 /* Window stuff */
6297                 p_ptr->window |= (PW_MONSTER);
6298         }
6299
6300         if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6301         {
6302                 if (!who)
6303                 {
6304                         if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6305                         {
6306                                 set_target(m_ptr, monster_target_y, monster_target_x);
6307                         }
6308                 }
6309                 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6310                 {
6311                         set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6312                 }
6313         }
6314
6315         if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6316         {
6317                 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6318                 rakubadam_m = (dam > 200) ? 200 : dam;
6319         }
6320
6321
6322         if (photo)
6323         {
6324                 object_type *q_ptr;
6325                 object_type forge;
6326
6327                 /* Get local object */
6328                 q_ptr = &forge;
6329
6330                 /* Prepare to make a Blade of Chaos */
6331                 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6332
6333                 q_ptr->pval = photo;
6334
6335                 /* Mark the item as fully known */
6336                 q_ptr->ident |= (IDENT_MENTAL);
6337
6338                 /* Drop it in the dungeon */
6339                 (void)drop_near(q_ptr, -1, py, px);
6340         }
6341
6342         /* Track it */
6343         project_m_n++;
6344         project_m_x = x;
6345         project_m_y = y;
6346
6347         /* Return "Anything seen?" */
6348         return (obvious);
6349 }
6350
6351
6352 /*
6353  * Helper function for "project()" below.
6354  *
6355  * Handle a beam/bolt/ball causing damage to the player.
6356  *
6357  * This routine takes a "source monster" (by index), a "distance", a default
6358  * "damage", and a "damage type".  See "project_m()" above.
6359  *
6360  * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6361  * is reduced (see "project_m()" above).  This can happen if a monster breathes
6362  * at the player and hits a wall instead.
6363  *
6364  * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6365  * to know if this is actually a ball or a bolt spell
6366  *
6367  *
6368  * We return "TRUE" if any "obvious" effects were observed.  XXX XXX Actually,
6369  * we just assume that the effects were obvious, for historical reasons.
6370  */
6371 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6372 {
6373         int k = 0;
6374         int rlev = 0;
6375
6376         /* Hack -- assume obvious */
6377         bool obvious = TRUE;
6378
6379         /* Player blind-ness */
6380         bool blind = (p_ptr->blind ? TRUE : FALSE);
6381
6382         /* Player needs a "description" (he is blind) */
6383         bool fuzzy = FALSE;
6384
6385         /* Source monster */
6386         monster_type *m_ptr = NULL;
6387
6388         /* Monster name (for attacks) */
6389         char m_name[80];
6390
6391         /* Monster name (for damage) */
6392         char killer[80];
6393
6394         /* Hack -- messages */
6395         cptr act = NULL;
6396
6397         int get_damage = 0;
6398
6399
6400         /* Player is not here */
6401         if (!player_bold(y, x)) return (FALSE);
6402
6403         if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6404         {
6405                 kawarimi(TRUE);
6406                 return FALSE;
6407         }
6408
6409         /* Player cannot hurt himself */
6410         if (!who) return (FALSE);
6411         if (who == p_ptr->riding) return (FALSE);
6412
6413         if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6414         {
6415                 byte t_y, t_x;
6416                 int max_attempts = 10;
6417
6418 #ifdef JP
6419                 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6420                 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤ­ÊÖ¤·¤¿¡ª");
6421                 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6422 #else
6423                 if (blind) msg_print("Something bounces!");
6424                 else msg_print("The attack bounces!");
6425 #endif
6426
6427
6428                 /* Choose 'new' target */
6429                 do
6430                 {
6431                         t_y = m_list[who].fy - 1 + randint1(3);
6432                         t_x = m_list[who].fx - 1 + randint1(3);
6433                         max_attempts--;
6434                 }
6435                 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6436
6437                 if (max_attempts < 1)
6438                 {
6439                         t_y = m_list[who].fy;
6440                         t_x = m_list[who].fx;
6441                 }
6442
6443                 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6444
6445                 disturb(1, 0);
6446                 return TRUE;
6447         }
6448
6449         /* XXX XXX XXX */
6450         /* Limit maximum damage */
6451         if (dam > 1600) dam = 1600;
6452
6453         /* Reduce damage by distance */
6454         dam = (dam + r) / (r + 1);
6455
6456
6457         /* If the player is blind, be more descriptive */
6458         if (blind) fuzzy = TRUE;
6459
6460
6461         if (who > 0)
6462         {
6463                 /* Get the source monster */
6464                 m_ptr = &m_list[who];
6465                 /* Extract the monster level */
6466                 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6467
6468                 /* Get the monster name */
6469                 monster_desc(m_name, m_ptr, 0);
6470
6471                 /* Get the monster's real name (gotten before polymorph!) */
6472                 strcpy(killer, who_name);
6473         }
6474         else if (who < 0)
6475         {
6476 #ifdef JP
6477                 strcpy(killer, "æ«");
6478 #else
6479                 strcpy(killer, "a trap");
6480 #endif
6481         }
6482
6483         /* Analyze the damage */
6484         switch (typ)
6485         {
6486                 /* Standard damage -- hurts inventory too */
6487                 case GF_ACID:
6488                 {
6489 #ifdef JP
6490 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6491 #else
6492                         if (fuzzy) msg_print("You are hit by acid!");
6493 #endif
6494                         
6495                         get_damage = acid_dam(dam, killer, monspell);
6496                         break;
6497                 }
6498
6499                 /* Standard damage -- hurts inventory too */
6500                 case GF_FIRE:
6501                 {
6502 #ifdef JP
6503 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6504 #else
6505                         if (fuzzy) msg_print("You are hit by fire!");
6506 #endif
6507
6508                         get_damage = fire_dam(dam, killer, monspell);
6509                         break;
6510                 }
6511
6512                 /* Standard damage -- hurts inventory too */
6513                 case GF_COLD:
6514                 {
6515 #ifdef JP
6516 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6517 #else
6518                         if (fuzzy) msg_print("You are hit by cold!");
6519 #endif
6520
6521                         get_damage = cold_dam(dam, killer, monspell);
6522                         break;
6523                 }
6524
6525                 /* Standard damage -- hurts inventory too */
6526                 case GF_ELEC:
6527                 {
6528 #ifdef JP
6529 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6530 #else
6531                         if (fuzzy) msg_print("You are hit by lightning!");
6532 #endif
6533
6534                         get_damage = elec_dam(dam, killer, monspell);
6535                         break;
6536                 }
6537
6538                 /* Standard damage -- also poisons player */
6539                 case GF_POIS:
6540                 {
6541                         bool double_resist = IS_OPPOSE_POIS();
6542 #ifdef JP
6543 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6544 #else
6545                         if (fuzzy) msg_print("You are hit by poison!");
6546 #endif
6547
6548                         if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6549                         if (double_resist) dam = (dam + 2) / 3;
6550
6551                         if ((!(double_resist || p_ptr->resist_pois)) &&
6552                              one_in_(HURT_CHANCE))
6553                         {
6554                                 do_dec_stat(A_CON);
6555                         }
6556
6557                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6558
6559                         if (!(double_resist || p_ptr->resist_pois))
6560                         {
6561                                 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6562                         }
6563                         break;
6564                 }
6565
6566                 /* Standard damage -- also poisons / mutates player */
6567                 case GF_NUKE:
6568                 {
6569                         bool double_resist = IS_OPPOSE_POIS();
6570 #ifdef JP
6571 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6572 #else
6573                         if (fuzzy) msg_print("You are hit by radiation!");
6574 #endif
6575
6576                         if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6577                         if (double_resist) dam = (2 * dam + 2) / 5;
6578                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6579                         if (!(double_resist || p_ptr->resist_pois))
6580                         {
6581                                 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6582
6583                                 if (one_in_(5)) /* 6 */
6584                                 {
6585 #ifdef JP
6586 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6587 #else
6588                                         msg_print("You undergo a freakish metamorphosis!");
6589 #endif
6590
6591                                         if (one_in_(4)) /* 4 */
6592                                                 do_poly_self();
6593                                         else
6594                                                 mutate_player();
6595                                 }
6596
6597                                 if (one_in_(6))
6598                                 {
6599                                         inven_damage(set_acid_destroy, 2);
6600                                 }
6601                         }
6602                         break;
6603                 }
6604
6605                 /* Standard damage */
6606                 case GF_MISSILE:
6607                 {
6608 #ifdef JP
6609 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6610 #else
6611                         if (fuzzy) msg_print("You are hit by something!");
6612 #endif
6613
6614                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6615                         break;
6616                 }
6617
6618                 /* Holy Orb -- Player only takes partial damage */
6619                 case GF_HOLY_FIRE:
6620                 {
6621 #ifdef JP
6622 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6623 #else
6624                         if (fuzzy) msg_print("You are hit by something!");
6625 #endif
6626
6627                         if (p_ptr->align > 10)
6628                                 dam /= 2;
6629                         else if (p_ptr->align < -10)
6630                                 dam *= 2;
6631                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6632                         break;
6633                 }
6634
6635                 case GF_HELL_FIRE:
6636                 {
6637 #ifdef JP
6638 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6639 #else
6640                         if (fuzzy) msg_print("You are hit by something!");
6641 #endif
6642
6643                         if (p_ptr->align > 10)
6644                                 dam *= 2;
6645                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6646                         break;
6647                 }
6648
6649                 /* Arrow -- XXX no dodging */
6650                 case GF_ARROW:
6651                 {
6652 #ifdef JP
6653 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6654 #else
6655                         if (fuzzy) msg_print("You are hit by something sharp!");
6656 #endif
6657
6658                         else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6659                         {
6660 #ifdef JP
6661                                 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6662 #else
6663                                 msg_print("You cut down the arrow!");
6664 #endif
6665                                 break;
6666                         }
6667                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6668                         break;
6669                 }
6670
6671                 /* Plasma -- XXX No resist */
6672                 case GF_PLASMA:
6673                 {
6674 #ifdef JP
6675                         if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6676 #else
6677                         if (fuzzy) msg_print("You are hit by something *HOT*!");
6678 #endif
6679
6680                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6681
6682                         if (!p_ptr->resist_sound)
6683                         {
6684                                 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6685                                 (void)set_stun(p_ptr->stun + k);
6686                         }
6687
6688                         if (!(p_ptr->resist_fire ||
6689                               IS_OPPOSE_FIRE() ||
6690                               p_ptr->immune_fire))
6691                         {
6692                                 inven_damage(set_acid_destroy, 3);
6693                         }
6694
6695                         break;
6696                 }
6697
6698                 /* Nether -- drain experience */
6699                 case GF_NETHER:
6700                 {
6701 #ifdef JP
6702 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6703 #else
6704                         if (fuzzy) msg_print("You are hit by nether forces!");
6705 #endif
6706
6707
6708                         if (p_ptr->resist_neth)
6709                         {
6710                                 if (!prace_is_(RACE_SPECTRE))
6711                                         dam *= 6; dam /= (randint1(4) + 7);
6712                         }
6713                         else drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6714
6715                         if (prace_is_(RACE_SPECTRE))
6716                         {
6717 #ifdef JP
6718 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6719 #else
6720                                 msg_print("You feel invigorated!");
6721 #endif
6722
6723                                 hp_player(dam / 4);
6724                                 learn_spell(monspell);
6725                         }
6726                         else
6727                         {
6728                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6729                         }
6730
6731                         break;
6732                 }
6733
6734                 /* Water -- stun/confuse */
6735                 case GF_WATER:
6736                 {
6737 #ifdef JP
6738 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6739 #else
6740                         if (fuzzy) msg_print("You are hit by something wet!");
6741 #endif
6742
6743                         if (!p_ptr->resist_sound)
6744                         {
6745                                 set_stun(p_ptr->stun + randint1(40));
6746                         }
6747                         if (!p_ptr->resist_conf)
6748                         {
6749                                 set_confused(p_ptr->confused + randint1(5) + 5);
6750                         }
6751
6752                         if (one_in_(5))
6753                         {
6754                                 inven_damage(set_cold_destroy, 3);
6755                         }
6756
6757                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6758                         break;
6759                 }
6760
6761                 /* Chaos -- many effects */
6762                 case GF_CHAOS:
6763                 {
6764 #ifdef JP
6765 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6766 #else
6767                         if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6768 #endif
6769
6770                         if (p_ptr->resist_chaos)
6771                         {
6772                                 dam *= 6; dam /= (randint1(4) + 7);
6773                         }
6774                         if (!p_ptr->resist_conf)
6775                         {
6776                                 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6777                         }
6778                         if (!p_ptr->resist_chaos)
6779                         {
6780                                 (void)set_image(p_ptr->image + randint1(10));
6781                                 if (one_in_(3))
6782                                 {
6783 #ifdef JP
6784 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6785 #else
6786                                         msg_print("Your body is twisted by chaos!");
6787 #endif
6788
6789                                         (void)gain_random_mutation(0);
6790                                 }
6791                         }
6792                         if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6793                         {
6794                                 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6795                         }
6796                         if (!p_ptr->resist_chaos || one_in_(9))
6797                         {
6798                                 inven_damage(set_elec_destroy, 2);
6799                                 inven_damage(set_fire_destroy, 2);
6800                         }
6801                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6802                         break;
6803                 }
6804
6805                 /* Shards -- mostly cutting */
6806                 case GF_SHARDS:
6807                 {
6808 #ifdef JP
6809 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6810 #else
6811                         if (fuzzy) msg_print("You are hit by something sharp!");
6812 #endif
6813
6814                         if (p_ptr->resist_shard)
6815                         {
6816                                 dam *= 6; dam /= (randint1(4) + 7);
6817                         }
6818                         else
6819                         {
6820                                 (void)set_cut(p_ptr->cut + dam);
6821                         }
6822
6823                         if (!p_ptr->resist_shard || one_in_(13))
6824                         {
6825                                 inven_damage(set_cold_destroy, 2);
6826                         }
6827
6828                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6829                         break;
6830                 }
6831
6832                 /* Sound -- mostly stunning */
6833                 case GF_SOUND:
6834                 {
6835 #ifdef JP
6836 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6837 #else
6838                         if (fuzzy) msg_print("You are hit by a loud noise!");
6839 #endif
6840
6841                         if (p_ptr->resist_sound)
6842                         {
6843                                 dam *= 5; dam /= (randint1(4) + 7);
6844                         }
6845                         else
6846                         {
6847                                 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6848                                 (void)set_stun(p_ptr->stun + k);
6849                         }
6850
6851                         if (!p_ptr->resist_sound || one_in_(13))
6852                         {
6853                                 inven_damage(set_cold_destroy, 2);
6854                         }
6855
6856                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6857                         break;
6858                 }
6859
6860                 /* Pure confusion */
6861                 case GF_CONFUSION:
6862                 {
6863 #ifdef JP
6864 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6865 #else
6866                         if (fuzzy) msg_print("You are hit by something puzzling!");
6867 #endif
6868
6869                         if (p_ptr->resist_conf)
6870                         {
6871                                 dam *= 5; dam /= (randint1(4) + 7);
6872                         }
6873                         if (!p_ptr->resist_conf)
6874                         {
6875                                 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6876                         }
6877                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6878                         break;
6879                 }
6880
6881                 /* Disenchantment -- see above */
6882                 case GF_DISENCHANT:
6883                 {
6884 #ifdef JP
6885                         if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6886 #else
6887                         if (fuzzy) msg_print("You are hit by something static!");
6888 #endif
6889
6890                         if (p_ptr->resist_disen)
6891                         {
6892                                 dam *= 6; dam /= (randint1(4) + 7);
6893                         }
6894                         else
6895                         {
6896                                 (void)apply_disenchant(0);
6897                         }
6898                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6899                         break;
6900                 }
6901
6902                 /* Nexus -- see above */
6903                 case GF_NEXUS:
6904                 {
6905 #ifdef JP
6906 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6907 #else
6908                         if (fuzzy) msg_print("You are hit by something strange!");
6909 #endif
6910
6911                         if (p_ptr->resist_nexus)
6912                         {
6913                                 dam *= 6; dam /= (randint1(4) + 7);
6914                         }
6915                         else
6916                         {
6917                                 apply_nexus(m_ptr);
6918                         }
6919                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6920                         break;
6921                 }
6922
6923                 /* Force -- mostly stun */
6924                 case GF_FORCE:
6925                 {
6926 #ifdef JP
6927 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6928 #else
6929                         if (fuzzy) msg_print("You are hit by kinetic force!");
6930 #endif
6931
6932                         if (!p_ptr->resist_sound)
6933                         {
6934                                 (void)set_stun(p_ptr->stun + randint1(20));
6935                         }
6936                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6937                         break;
6938                 }
6939
6940
6941                 /* Rocket -- stun, cut */
6942                 case GF_ROCKET:
6943                 {
6944 #ifdef JP
6945 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6946 #else
6947                         if (fuzzy) msg_print("There is an explosion!");
6948 #endif
6949
6950                         if (!p_ptr->resist_sound)
6951                         {
6952                                 (void)set_stun(p_ptr->stun + randint1(20));
6953                         }
6954                         if (p_ptr->resist_shard)
6955                         {
6956                                 dam /= 2;
6957                         }
6958                         else
6959                         {
6960                                 (void)set_cut(p_ptr->  cut + ( dam / 2));
6961                         }
6962
6963                         if ((!p_ptr->resist_shard) || one_in_(12))
6964                         {
6965                                 inven_damage(set_cold_destroy, 3);
6966                         }
6967
6968                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6969                         break;
6970                 }
6971
6972                 /* Inertia -- slowness */
6973                 case GF_INERTIA:
6974                 {
6975 #ifdef JP
6976 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6977 #else
6978                         if (fuzzy) msg_print("You are hit by something slow!");
6979 #endif
6980
6981                         (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6982                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6983                         break;
6984                 }
6985
6986                 /* Lite -- blinding */
6987                 case GF_LITE:
6988                 {
6989 #ifdef JP
6990 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6991 #else
6992                         if (fuzzy) msg_print("You are hit by something!");
6993 #endif
6994
6995                         if (p_ptr->resist_lite)
6996                         {
6997                                 dam *= 4; dam /= (randint1(4) + 7);
6998                         }
6999                         else if (!blind && !p_ptr->resist_blind)
7000                         {
7001                                 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7002                         }
7003                         if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7004                         {
7005 #ifdef JP
7006 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7007 #else
7008                                 msg_print("The light scorches your flesh!");
7009 #endif
7010
7011                                 dam *= 2;
7012                         }
7013                         else if (prace_is_(RACE_S_FAIRY))
7014                         {
7015                                 dam = dam * 4 / 3;
7016                         }
7017                         if (p_ptr->wraith_form) dam *= 2;
7018                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7019
7020                         if (p_ptr->wraith_form)
7021                         {
7022                                 p_ptr->wraith_form = 0;
7023 #ifdef JP
7024 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7025 #else
7026                                 msg_print("The light forces you out of your incorporeal shadow form.");
7027 #endif
7028
7029                                 p_ptr->redraw |= PR_MAP;
7030                                 /* Update monsters */
7031                                 p_ptr->update |= (PU_MONSTERS);
7032                                 /* Window stuff */
7033                                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7034
7035                                 /* Redraw status bar */
7036                                 p_ptr->redraw |= (PR_STATUS);
7037
7038                         }
7039
7040                         break;
7041                 }
7042
7043                 /* Dark -- blinding */
7044                 case GF_DARK:
7045                 {
7046 #ifdef JP
7047 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7048 #else
7049                         if (fuzzy) msg_print("You are hit by something!");
7050 #endif
7051
7052                         if (p_ptr->resist_dark)
7053                         {
7054                                 dam *= 4; dam /= (randint1(4) + 7);
7055
7056                                 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7057                         }
7058                         else if (!blind && !p_ptr->resist_blind)
7059                         {
7060                                 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7061                         }
7062                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7063                         break;
7064                 }
7065
7066                 /* Time -- bolt fewer effects XXX */
7067                 case GF_TIME:
7068                 {
7069 #ifdef JP
7070 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7071 #else
7072                         if (fuzzy) msg_print("You are hit by a blast from the past!");
7073 #endif
7074
7075                         if (p_ptr->resist_time)
7076                         {
7077                                 dam *= 4;
7078                                 dam /= (randint1(4) + 7);
7079 #ifdef JP
7080 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7081 #else
7082                                 msg_print("You feel as if time is passing you by.");
7083 #endif
7084
7085                         }
7086                         else
7087                         {
7088                                 switch (randint1(10))
7089                                 {
7090                                         case 1: case 2: case 3: case 4: case 5:
7091                                         {
7092                                                 if (p_ptr->prace == RACE_ANDROID) break;
7093 #ifdef JP
7094 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7095 #else
7096                                                 msg_print("You feel life has clocked back.");
7097 #endif
7098
7099                                                 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7100                                                 break;
7101                                         }
7102
7103                                         case 6: case 7: case 8: case 9:
7104                                         {
7105                                                 switch (randint1(6))
7106                                                 {
7107 #ifdef JP
7108 case 1: k = A_STR; act = "¶¯¤¯"; break;
7109 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7110 case 3: k = A_WIS; act = "¸­ÌÀ¤Ç"; break;
7111 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7112 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7113 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7114 #else
7115                                                         case 1: k = A_STR; act = "strong"; break;
7116                                                         case 2: k = A_INT; act = "bright"; break;
7117                                                         case 3: k = A_WIS; act = "wise"; break;
7118                                                         case 4: k = A_DEX; act = "agile"; break;
7119                                                         case 5: k = A_CON; act = "hale"; break;
7120                                                         case 6: k = A_CHR; act = "beautiful"; break;
7121 #endif
7122
7123                                                 }
7124
7125 #ifdef JP
7126 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7127 #else
7128                                                 msg_format("You're not as %s as you used to be...", act);
7129 #endif
7130
7131
7132                                                 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7133                                                 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7134                                                 p_ptr->update |= (PU_BONUS);
7135                                                 break;
7136                                         }
7137
7138                                         case 10:
7139                                         {
7140 #ifdef JP
7141 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7142 #else
7143                                                 msg_print("You're not as powerful as you used to be...");
7144 #endif
7145
7146
7147                                                 for (k = 0; k < 6; k++)
7148                                                 {
7149                                                         p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7150                                                         if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7151                                                 }
7152                                                 p_ptr->update |= (PU_BONUS);
7153                                                 break;
7154                                         }
7155                                 }
7156                         }
7157
7158                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7159                         break;
7160                 }
7161
7162                 /* Gravity -- stun plus slowness plus teleport */
7163                 case GF_GRAVITY:
7164                 {
7165 #ifdef JP
7166                         if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7167                         msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7168 #else
7169                         if (fuzzy) msg_print("You are hit by something heavy!");
7170                         msg_print("Gravity warps around you.");
7171 #endif
7172
7173                         teleport_player(5, TRUE);
7174                         if (!p_ptr->levitation)
7175                                 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7176                         if (!(p_ptr->resist_sound || p_ptr->levitation))
7177                         {
7178                                 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7179                                 (void)set_stun(p_ptr->stun + k);
7180                         }
7181                         if (p_ptr->levitation)
7182                         {
7183                                 dam = (dam * 2) / 3;
7184                         }
7185
7186                         if (!p_ptr->levitation || one_in_(13))
7187                         {
7188                                 inven_damage(set_cold_destroy, 2);
7189                         }
7190
7191                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7192                         break;
7193                 }
7194
7195                 /* Standard damage */
7196                 case GF_DISINTEGRATE:
7197                 {
7198 #ifdef JP
7199 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7200 #else
7201                         if (fuzzy) msg_print("You are hit by pure energy!");
7202 #endif
7203
7204                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7205                         break;
7206                 }
7207
7208                 case GF_OLD_HEAL:
7209                 {
7210 #ifdef JP
7211 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7212 #else
7213                         if (fuzzy) msg_print("You are hit by something invigorating!");
7214 #endif
7215
7216                         (void)hp_player(dam);
7217                         dam = 0;
7218                         break;
7219                 }
7220
7221                 case GF_OLD_SPEED:
7222                 {
7223 #ifdef JP
7224 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7225 #else
7226                         if (fuzzy) msg_print("You are hit by something!");
7227 #endif
7228
7229                         (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7230                         dam = 0;
7231                         break;
7232                 }
7233
7234                 case GF_OLD_SLOW:
7235                 {
7236 #ifdef JP
7237 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7238 #else
7239                         if (fuzzy) msg_print("You are hit by something slow!");
7240 #endif
7241
7242                         (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7243                         break;
7244                 }
7245
7246                 case GF_OLD_SLEEP:
7247                 {
7248                         if (p_ptr->free_act)  break;
7249 #ifdef JP
7250 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7251 #else
7252                         if (fuzzy) msg_print("You fall asleep!");
7253 #endif
7254
7255
7256                         if (ironman_nightmare)
7257                         {
7258 #ifdef JP
7259 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤­¤¿¡£");
7260 #else
7261                                 msg_print("A horrible vision enters your mind.");
7262 #endif
7263
7264
7265                                 /* Pick a nightmare */
7266                                 get_mon_num_prep(get_nightmare, NULL);
7267
7268                                 /* Have some nightmares */
7269                                 have_nightmare(get_mon_num(MAX_DEPTH));
7270
7271                                 /* Remove the monster restriction */
7272                                 get_mon_num_prep(NULL, NULL);
7273                         }
7274
7275                         set_paralyzed(p_ptr->paralyzed + dam);
7276                         dam = 0;
7277                         break;
7278                 }
7279
7280                 /* Pure damage */
7281                 case GF_MANA:
7282                 case GF_SEEKER:
7283                 case GF_SUPER_RAY:
7284                 {
7285 #ifdef JP
7286 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7287 #else
7288                         if (fuzzy) msg_print("You are hit by an aura of magic!");
7289 #endif
7290
7291                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7292                         break;
7293                 }
7294
7295                 /* Pure damage */
7296                 case GF_PSY_SPEAR:
7297                 {
7298 #ifdef JP
7299 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7300 #else
7301                         if (fuzzy) msg_print("You are hit by an energy!");
7302 #endif
7303
7304                         get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7305                         break;
7306                 }
7307
7308                 /* Pure damage */
7309                 case GF_METEOR:
7310                 {
7311 #ifdef JP
7312 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤­¤¿¡ª");
7313 #else
7314                         if (fuzzy) msg_print("Something falls from the sky on you!");
7315 #endif
7316
7317                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7318                         if (!p_ptr->resist_shard || one_in_(13))
7319                         {
7320                                 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7321                                 inven_damage(set_cold_destroy, 2);
7322                         }
7323
7324                         break;
7325                 }
7326
7327                 /* Ice -- cold plus stun plus cuts */
7328                 case GF_ICE:
7329                 {
7330 #ifdef JP
7331 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7332 #else
7333                         if (fuzzy) msg_print("You are hit by something sharp and cold!");
7334 #endif
7335
7336                         cold_dam(dam, killer, monspell);
7337                         if (!p_ptr->resist_shard)
7338                         {
7339                                 (void)set_cut(p_ptr->cut + damroll(5, 8));
7340                         }
7341                         if (!p_ptr->resist_sound)
7342                         {
7343                                 (void)set_stun(p_ptr->stun + randint1(15));
7344                         }
7345
7346                         if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7347                         {
7348                                 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7349                         }
7350
7351                         break;
7352                 }
7353
7354                 /* Death Ray */
7355                 case GF_DEATH_RAY:
7356                 {
7357 #ifdef JP
7358 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7359 #else
7360                         if (fuzzy) msg_print("You are hit by something extremely cold!");
7361 #endif
7362
7363
7364                         if (p_ptr->mimic_form)
7365                         {
7366                                 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7367                                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7368                         }
7369                         else
7370                         {
7371
7372                         switch (p_ptr->prace)
7373                         {
7374                                 /* Some races are immune */
7375                                 case RACE_GOLEM:
7376                                 case RACE_SKELETON:
7377                                 case RACE_ZOMBIE:
7378                                 case RACE_VAMPIRE:
7379                                 case RACE_DEMON:
7380                                 case RACE_SPECTRE:
7381                                 {
7382                                         dam = 0;
7383                                         break;
7384                                 }
7385                                 /* Hurt a lot */
7386                                 default:
7387                                 {
7388                                         get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7389                                         break;
7390                                 }
7391                         }
7392                         }
7393
7394                         break;
7395                 }
7396
7397                 /* Drain mana */
7398                 case GF_DRAIN_MANA:
7399                 {
7400                         if (p_ptr->csp)
7401                         {
7402                                 /* Basic message */
7403 #ifdef JP
7404                                 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7405                                 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7406 #else
7407                                 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7408                                 else msg_print("Your psychic energy is drawn!");
7409 #endif
7410
7411                                 /* Full drain */
7412                                 if (dam >= p_ptr->csp)
7413                                 {
7414                                         dam = p_ptr->csp;
7415                                         p_ptr->csp = 0;
7416                                         p_ptr->csp_frac = 0;
7417                                 }
7418
7419                                 /* Partial drain */
7420                                 else
7421                                 {
7422                                         p_ptr->csp -= dam;
7423                                 }
7424
7425                                 learn_spell(monspell);
7426
7427                                 /* Redraw mana */
7428                                 p_ptr->redraw |= (PR_MANA);
7429
7430                                 /* Window stuff */
7431                                 p_ptr->window |= (PW_PLAYER);
7432                                 p_ptr->window |= (PW_SPELL);
7433
7434                                 if (who > 0)
7435                                 {
7436                                         /* Heal the monster */
7437                                         if (m_ptr->hp < m_ptr->maxhp)
7438                                         {
7439                                                 /* Heal */
7440                                                 m_ptr->hp += (6 * dam);
7441                                                 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7442
7443                                                 /* Redraw (later) if needed */
7444                                                 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7445                                                 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7446
7447                                                 /* Special message */
7448                                                 if (m_ptr->ml)
7449                                                 {
7450 #ifdef JP
7451                                                         msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7452 #else
7453                                                         msg_format("%^s appears healthier.", m_name);
7454 #endif
7455                                                 }
7456                                         }
7457                                 }
7458                         }
7459
7460                         dam = 0;
7461                         break;
7462                 }
7463
7464                 /* Mind blast */
7465                 case GF_MIND_BLAST:
7466                 {
7467                         if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7468                         {
7469 #ifdef JP
7470                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7471 #else
7472                                 msg_print("You resist the effects!");
7473 #endif
7474                                 learn_spell(monspell);
7475                         }
7476                         else
7477                         {
7478 #ifdef JP
7479                                 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7480 #else
7481                                 msg_print("Your mind is blasted by psyonic energy.");
7482 #endif
7483
7484                                 if (!p_ptr->resist_conf)
7485                                 {
7486                                         (void)set_confused(p_ptr->confused + randint0(4) + 4);
7487                                 }
7488
7489                                 if (!p_ptr->resist_chaos && one_in_(3))
7490                                 {
7491                                         (void)set_image(p_ptr->image + randint0(250) + 150);
7492                                 }
7493
7494                                 p_ptr->csp -= 50;
7495                                 if (p_ptr->csp < 0)
7496                                 {
7497                                         p_ptr->csp = 0;
7498                                         p_ptr->csp_frac = 0;
7499                                 }
7500                                 p_ptr->redraw |= PR_MANA;
7501
7502                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7503                         }
7504                         break;
7505                 }
7506
7507                 /* Brain smash */
7508                 case GF_BRAIN_SMASH:
7509                 {
7510                         if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7511                         {
7512 #ifdef JP
7513                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7514 #else
7515                                 msg_print("You resist the effects!");
7516 #endif
7517                                 learn_spell(monspell);
7518                         }
7519                         else
7520                         {
7521 #ifdef JP
7522                                 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7523 #else
7524                                 msg_print("Your mind is blasted by psionic energy.");
7525 #endif
7526
7527                                 p_ptr->csp -= 100;
7528                                 if (p_ptr->csp < 0)
7529                                 {
7530                                         p_ptr->csp = 0;
7531                                         p_ptr->csp_frac = 0;
7532                                 }
7533                                 p_ptr->redraw |= PR_MANA;
7534
7535                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7536                                 if (!p_ptr->resist_blind)
7537                                 {
7538                                         (void)set_blind(p_ptr->blind + 8 + randint0(8));
7539                                 }
7540                                 if (!p_ptr->resist_conf)
7541                                 {
7542                                         (void)set_confused(p_ptr->confused + randint0(4) + 4);
7543                                 }
7544                                 if (!p_ptr->free_act)
7545                                 {
7546                                         (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7547                                 }
7548                                 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7549
7550                                 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7551                                         (void)do_dec_stat(A_INT);
7552                                 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7553                                         (void)do_dec_stat(A_WIS);
7554
7555                                 if (!p_ptr->resist_chaos)
7556                                 {
7557                                         (void)set_image(p_ptr->image + randint0(250) + 150);
7558                                 }
7559                         }
7560                         break;
7561                 }
7562
7563                 /* cause 1 */
7564                 case GF_CAUSE_1:
7565                 {
7566                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7567                         {
7568 #ifdef JP
7569                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7570 #else
7571                                 msg_print("You resist the effects!");
7572 #endif
7573                                 learn_spell(monspell);
7574                         }
7575                         else
7576                         {
7577                                 curse_equipment(15, 0);
7578                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7579                         }
7580                         break;
7581                 }
7582
7583                 /* cause 2 */
7584                 case GF_CAUSE_2:
7585                 {
7586                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7587                         {
7588 #ifdef JP
7589                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7590 #else
7591                                 msg_print("You resist the effects!");
7592 #endif
7593                                 learn_spell(monspell);
7594                         }
7595                         else
7596                         {
7597                                 curse_equipment(25, MIN(rlev/2-15, 5));
7598                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7599                         }
7600                         break;
7601                 }
7602
7603                 /* cause 3 */
7604                 case GF_CAUSE_3:
7605                 {
7606                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7607                         {
7608 #ifdef JP
7609                                 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7610 #else
7611                                 msg_print("You resist the effects!");
7612 #endif
7613                                 learn_spell(monspell);
7614                         }
7615                         else
7616                         {
7617                                 curse_equipment(33, MIN(rlev/2-15, 15));
7618                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7619                         }
7620                         break;
7621                 }
7622
7623                 /* cause 4 */
7624                 case GF_CAUSE_4:
7625                 {
7626                         if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
7627                         {
7628 #ifdef JP
7629                                 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7630 #else
7631                                 msg_print("You resist the effects!");
7632 #endif
7633                                 learn_spell(monspell);
7634                         }
7635                         else
7636                         {
7637                                 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7638                                 (void)set_cut(p_ptr->cut + damroll(10, 10));
7639                         }
7640                         break;
7641                 }
7642
7643                 /* Hand of Doom */
7644                 case GF_HAND_DOOM:
7645                 {
7646                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7647                         {
7648 #ifdef JP
7649                                 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7650 #else
7651                                 msg_format("You resist the effects!");
7652 #endif
7653                                 learn_spell(monspell);
7654                         }
7655                         else
7656                         {
7657 #ifdef JP
7658                                 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7659 #else
7660                                 msg_print("You feel your life fade away!");
7661 #endif
7662
7663                                 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7664                                 curse_equipment(40, 20);
7665
7666                                 if (p_ptr->chp < 1) p_ptr->chp = 1;
7667                         }
7668                         break;
7669                 }
7670
7671                 /* Default */
7672                 default:
7673                 {
7674                         /* No damage */
7675                         dam = 0;
7676
7677                         break;
7678                 }
7679         }
7680
7681         if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
7682         {
7683 #ifdef JP
7684                 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7685 #else
7686                 char m_name_self[80];
7687
7688                 /* hisself */
7689                 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7690
7691                 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7692 #endif
7693                 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7694                 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7695         }
7696
7697         if (p_ptr->riding && dam > 0)
7698         {
7699                 rakubadam_p = (dam > 200) ? 200 : dam;
7700         }
7701
7702
7703         /* Disturb */
7704         disturb(1, 0);
7705
7706
7707         if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7708         {
7709                 kawarimi(FALSE);
7710                 return obvious;
7711         }
7712
7713         /* Return "Anything seen?" */
7714         return (obvious);
7715 }
7716
7717
7718 /*
7719  * Find the distance from (x, y) to a line.
7720  */
7721 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7722 {
7723         /* Vector from (x, y) to (x1, y1) */
7724         int py = y1 - y;
7725         int px = x1 - x;
7726
7727         /* Normal vector */
7728         int ny = x2 - x1;
7729         int nx = y1 - y2;
7730
7731    /* Length of N */
7732         int pd = distance(y1, x1, y, x);
7733         int nd = distance(y1, x1, y2, x2);
7734
7735         if (pd > nd) return distance(y, x, y2, x2);
7736
7737         /* Component of P on N */
7738         nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7739
7740    /* Absolute value */
7741    return((nd >= 0) ? nd : 0 - nd);
7742 }
7743
7744
7745
7746 /*
7747  * XXX XXX XXX
7748  * Modified version of los() for calculation of disintegration balls.
7749  * Disintegration effects are stopped by permanent walls.
7750  */
7751 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7752 {
7753         /* Delta */
7754         int dx, dy;
7755
7756         /* Absolute */
7757         int ax, ay;
7758
7759         /* Signs */
7760         int sx, sy;
7761
7762         /* Fractions */
7763         int qx, qy;
7764
7765         /* Scanners */
7766         int tx, ty;
7767
7768         /* Scale factors */
7769         int f1, f2;
7770
7771         /* Slope, or 1/Slope, of LOS */
7772         int m;
7773
7774
7775         /* Extract the offset */
7776         dy = y2 - y1;
7777         dx = x2 - x1;
7778
7779         /* Extract the absolute offset */
7780         ay = ABS(dy);
7781         ax = ABS(dx);
7782
7783
7784         /* Handle adjacent (or identical) grids */
7785         if ((ax < 2) && (ay < 2)) return (TRUE);
7786
7787
7788         /* Paranoia -- require "safe" origin */
7789         /* if (!in_bounds(y1, x1)) return (FALSE); */
7790
7791
7792         /* Directly South/North */
7793         if (!dx)
7794         {
7795                 /* South -- check for walls */
7796                 if (dy > 0)
7797                 {
7798                         for (ty = y1 + 1; ty < y2; ty++)
7799                         {
7800                                 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7801                         }
7802                 }
7803
7804                 /* North -- check for walls */
7805                 else
7806                 {
7807                         for (ty = y1 - 1; ty > y2; ty--)
7808                         {
7809                                 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7810                         }
7811                 }
7812
7813                 /* Assume los */
7814                 return (TRUE);
7815         }
7816
7817         /* Directly East/West */
7818         if (!dy)
7819         {
7820                 /* East -- check for walls */
7821                 if (dx > 0)
7822                 {
7823                         for (tx = x1 + 1; tx < x2; tx++)
7824                         {
7825                                 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7826                         }
7827                 }
7828
7829                 /* West -- check for walls */
7830                 else
7831                 {
7832                         for (tx = x1 - 1; tx > x2; tx--)
7833                         {
7834                                 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7835                         }
7836                 }
7837
7838                 /* Assume los */
7839                 return (TRUE);
7840         }
7841
7842
7843         /* Extract some signs */
7844         sx = (dx < 0) ? -1 : 1;
7845         sy = (dy < 0) ? -1 : 1;
7846
7847
7848         /* Vertical "knights" */
7849         if (ax == 1)
7850         {
7851                 if (ay == 2)
7852                 {
7853                         if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7854                 }
7855         }
7856
7857         /* Horizontal "knights" */
7858         else if (ay == 1)
7859         {
7860                 if (ax == 2)
7861                 {
7862                         if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7863                 }
7864         }
7865
7866
7867         /* Calculate scale factor div 2 */
7868         f2 = (ax * ay);
7869
7870         /* Calculate scale factor */
7871         f1 = f2 << 1;
7872
7873
7874         /* Travel horizontally */
7875         if (ax >= ay)
7876         {
7877                 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7878                 qy = ay * ay;
7879                 m = qy << 1;
7880
7881                 tx = x1 + sx;
7882
7883                 /* Consider the special case where slope == 1. */
7884                 if (qy == f2)
7885                 {
7886                         ty = y1 + sy;
7887                         qy -= f1;
7888                 }
7889                 else
7890                 {
7891                         ty = y1;
7892                 }
7893
7894                 /* Note (below) the case (qy == f2), where */
7895                 /* the LOS exactly meets the corner of a tile. */
7896                 while (x2 - tx)
7897                 {
7898                         if (cave_stop_disintegration(ty, tx)) return (FALSE);
7899
7900                         qy += m;
7901
7902                         if (qy < f2)
7903                         {
7904                                 tx += sx;
7905                         }
7906                         else if (qy > f2)
7907                         {
7908                                 ty += sy;
7909                                 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7910                                 qy -= f1;
7911                                 tx += sx;
7912                         }
7913                         else
7914                         {
7915                                 ty += sy;
7916                                 qy -= f1;
7917                                 tx += sx;
7918                         }
7919                 }
7920         }
7921
7922         /* Travel vertically */
7923         else
7924         {
7925                 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7926                 qx = ax * ax;
7927                 m = qx << 1;
7928
7929                 ty = y1 + sy;
7930
7931                 if (qx == f2)
7932                 {
7933                         tx = x1 + sx;
7934                         qx -= f1;
7935                 }
7936                 else
7937                 {
7938                         tx = x1;
7939                 }
7940
7941                 /* Note (below) the case (qx == f2), where */
7942                 /* the LOS exactly meets the corner of a tile. */
7943                 while (y2 - ty)
7944                 {
7945                         if (cave_stop_disintegration(ty, tx)) return (FALSE);
7946
7947                         qx += m;
7948
7949                         if (qx < f2)
7950                         {
7951                                 ty += sy;
7952                         }
7953                         else if (qx > f2)
7954                         {
7955                                 tx += sx;
7956                                 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7957                                 qx -= f1;
7958                                 ty += sy;
7959                         }
7960                         else
7961                         {
7962                                 tx += sx;
7963                                 qx -= f1;
7964                                 ty += sy;
7965                         }
7966                 }
7967         }
7968
7969         /* Assume los */
7970         return (TRUE);
7971 }
7972
7973
7974 /*
7975  * breath shape
7976  */
7977 void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, int typ)
7978 {
7979         int by = y1;
7980         int bx = x1;
7981         int brad = 0;
7982         int brev = rad * rad / dist;
7983         int bdis = 0;
7984         int cdis;
7985         int path_n = 0;
7986         int mdis = distance(y1, x1, y2, x2) + rad;
7987
7988         while (bdis <= mdis)
7989         {
7990                 int x, y;
7991
7992                 if ((0 < dist) && (path_n < dist))
7993                 {
7994                         int ny = GRID_Y(path_g[path_n]);
7995                         int nx = GRID_X(path_g[path_n]);
7996                         int nd = distance(ny, nx, y1, x1);
7997
7998                         /* Get next base point */
7999                         if (bdis >= nd)
8000                         {
8001                                 by = ny;
8002                                 bx = nx;
8003                                 path_n++;
8004                         }
8005                 }
8006
8007                 /* Travel from center outward */
8008                 for (cdis = 0; cdis <= brad; cdis++)
8009                 {
8010                         /* Scan the maximal blast area of radius "cdis" */
8011                         for (y = by - cdis; y <= by + cdis; y++)
8012                         {
8013                                 for (x = bx - cdis; x <= bx + cdis; x++)
8014                                 {
8015                                         /* Ignore "illegal" locations */
8016                                         if (!in_bounds(y, x)) continue;
8017
8018                                         /* Enforce a circular "ripple" */
8019                                         if (distance(y1, x1, y, x) != bdis) continue;
8020
8021                                         /* Enforce an arc */
8022                                         if (distance(by, bx, y, x) != cdis) continue;
8023
8024                                         switch (typ)
8025                                         {
8026                                         case GF_LITE:
8027                                         case GF_LITE_WEAK:
8028                                                 /* Lights are stopped by opaque terrains */
8029                                                 if (!los(by, bx, y, x)) continue;
8030                                                 break;
8031                                         case GF_DISINTEGRATE:
8032                                                 /* Disintegration are stopped only by perma-walls */
8033                                                 if (!in_disintegration_range(by, bx, y, x)) continue;
8034                                                 break;
8035                                         default:
8036                                                 /* Ball explosions are stopped by walls */
8037                                                 if (!projectable(by, bx, y, x)) continue;
8038                                                 break;
8039                                         }
8040
8041                                         /* Save this grid */
8042                                         gy[*pgrids] = y;
8043                                         gx[*pgrids] = x;
8044                                         (*pgrids)++;
8045                                 }
8046                         }
8047                 }
8048
8049                 /* Encode some more "radius" info */
8050                 gm[bdis + 1] = *pgrids;
8051
8052                 /* Increase the size */
8053                 brad = rad * (path_n + brev) / (dist + brev);
8054
8055                 /* Find the next ripple */
8056                 bdis++;
8057         }
8058
8059         /* Store the effect size */
8060         *pgm_rad = bdis;
8061 }
8062
8063
8064 /*
8065  * Generic "beam"/"bolt"/"ball" projection routine.
8066  *
8067  * Input:
8068  *   who: Index of "source" monster (zero for "player")
8069  *   rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8070  *   y,x: Target location (or location to travel "towards")
8071  *   dam: Base damage roll to apply to affected monsters (or player)
8072  *   typ: Type of damage to apply to monsters (and objects)
8073  *   flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8074  *
8075  * Return:
8076  *   TRUE if any "effects" of the projection were observed, else FALSE
8077  *
8078  * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8079  * towards a given location (optionally passing over the heads of interposing
8080  * monsters), and have it do a given amount of damage to the monsters (and
8081  * optionally objects) within the given radius of the final location.
8082  *
8083  * A "bolt" travels from source to target and affects only the target grid.
8084  * A "beam" travels from source to target, affecting all grids passed through.
8085  * A "ball" travels from source to the target, exploding at the target, and
8086  *   affecting everything within the given radius of the target location.
8087  *
8088  * Traditionally, a "bolt" does not affect anything on the ground, and does
8089  * not pass over the heads of interposing monsters, much like a traditional
8090  * missile, and will "stop" abruptly at the "target" even if no monster is
8091  * positioned there, while a "ball", on the other hand, passes over the heads
8092  * of monsters between the source and target, and affects everything except
8093  * the source monster which lies within the final radius, while a "beam"
8094  * affects every monster between the source and target, except for the casting
8095  * monster (or player), and rarely affects things on the ground.
8096  *
8097  * Two special flags allow us to use this function in special ways, the
8098  * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8099  * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8100  * actually projecting from the source monster (or player).
8101  *
8102  * The player will only get "experience" for monsters killed by himself
8103  * Unique monsters can only be destroyed by attacks from the player
8104  *
8105  * Only 256 grids can be affected per projection, limiting the effective
8106  * "radius" of standard ball attacks to nine units (diameter nineteen).
8107  *
8108  * One can project in a given "direction" by combining PROJECT_THRU with small
8109  * offsets to the initial location (see "line_spell()"), or by calculating
8110  * "virtual targets" far away from the player.
8111  *
8112  * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8113  * continuing until it actually hits somethings (useful for "stone to mud").
8114  *
8115  * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8116  *
8117  * Balls must explode BEFORE hitting walls, or they would affect monsters
8118  * on both sides of a wall.  Some bug reports indicate that this is still
8119  * happening in 2.7.8 for Windows, though it appears to be impossible.
8120  *
8121  * We "pre-calculate" the blast area only in part for efficiency.
8122  * More importantly, this lets us do "explosions" from the "inside" out.
8123  * This results in a more logical distribution of "blast" treasure.
8124  * It also produces a better (in my opinion) animation of the explosion.
8125  * It could be (but is not) used to have the treasure dropped by monsters
8126  * in the middle of the explosion fall "outwards", and then be damaged by
8127  * the blast as it spreads outwards towards the treasure drop location.
8128  *
8129  * Walls and doors are included in the blast area, so that they can be
8130  * "burned" or "melted" in later versions.
8131  *
8132  * This algorithm is intended to maximize simplicity, not necessarily
8133  * efficiency, since this function is not a bottleneck in the code.
8134  *
8135  * We apply the blast effect from ground zero outwards, in several passes,
8136  * first affecting features, then objects, then monsters, then the player.
8137  * This allows walls to be removed before checking the object or monster
8138  * in the wall, and protects objects which are dropped by monsters killed
8139  * in the blast, and allows the player to see all affects before he is
8140  * killed or teleported away.  The semantics of this method are open to
8141  * various interpretations, but they seem to work well in practice.
8142  *
8143  * We process the blast area from ground-zero outwards to allow for better
8144  * distribution of treasure dropped by monsters, and because it provides a
8145  * pleasing visual effect at low cost.
8146  *
8147  * Note that the damage done by "ball" explosions decreases with distance.
8148  * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8149  *
8150  * Notice the "napalm" effect of "beam" weapons.  First they "project" to
8151  * the target, and then the damage "flows" along this beam of destruction.
8152  * The damage at every grid is the same as at the "center" of a "ball"
8153  * explosion, since the "beam" grids are treated as if they ARE at the
8154  * center of a "ball" explosion.
8155  *
8156  * Currently, specifying "beam" plus "ball" means that locations which are
8157  * covered by the initial "beam", and also covered by the final "ball", except
8158  * for the final grid (the epicenter of the ball), will be "hit twice", once
8159  * by the initial beam, and once by the exploding ball.  For the grid right
8160  * next to the epicenter, this results in 150% damage being done.  The center
8161  * does not have this problem, for the same reason the final grid in a "beam"
8162  * plus "bolt" does not -- it is explicitly removed.  Simply removing "beam"
8163  * grids which are covered by the "ball" will NOT work, as then they will
8164  * receive LESS damage than they should.  Do not combine "beam" with "ball".
8165  *
8166  * The array "gy[],gx[]" with current size "grids" is used to hold the
8167  * collected locations of all grids in the "blast area" plus "beam path".
8168  *
8169  * Note the rather complex usage of the "gm[]" array.  First, gm[0] is always
8170  * zero.  Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8171  * first blast grid (see above) with radius "N" from the blast center.  Note
8172  * that only the first gm[1] grids in the blast area thus take full damage.
8173  * Also, note that gm[rad+1] is always equal to "grids", which is the total
8174  * number of blast grids.
8175  *
8176  * Note that once the projection is complete, (y2,x2) holds the final location
8177  * of bolts/beams, and the "epicenter" of balls.
8178  *
8179  * Note also that "rad" specifies the "inclusive" radius of projection blast,
8180  * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8181  * implementation of the "distance" function.  Also, a bolt can be properly
8182  * viewed as a "ball" with a "rad" of "zero".
8183  *
8184  * Note that if no "target" is reached before the beam/bolt/ball travels the
8185  * maximum distance allowed (MAX_RANGE), no "blast" will be induced.  This
8186  * may be relevant even for bolts, since they have a "1x1" mini-blast.
8187  *
8188  * Note that for consistency, we "pretend" that the bolt actually takes "time"
8189  * to move from point A to point B, even if the player cannot see part of the
8190  * projection path.  Note that in general, the player will *always* see part
8191  * of the path, since it either starts at the player or ends on the player.
8192  *
8193  * Hack -- we assume that every "projection" is "self-illuminating".
8194  *
8195  * Hack -- when only a single monster is affected, we automatically track
8196  * (and recall) that monster, unless "PROJECT_JUMP" is used.
8197  *
8198  * Note that all projections now "explode" at their final destination, even
8199  * if they were being projected at a more distant destination.  This means
8200  * that "ball" spells will *always* explode.
8201  *
8202  * Note that we must call "handle_stuff()" after affecting terrain features
8203  * in the blast radius, in case the "illumination" of the grid was changed,
8204  * and "update_view()" and "update_monsters()" need to be called.
8205  */
8206 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8207 {
8208         int i, t, dist;
8209
8210         int y1, x1;
8211         int y2, x2;
8212         int by, bx;
8213
8214         int dist_hack = 0;
8215
8216         int y_saver, x_saver; /* For reflecting monsters */
8217
8218         int msec = delay_factor * delay_factor * delay_factor;
8219
8220         /* Assume the player sees nothing */
8221         bool notice = FALSE;
8222
8223         /* Assume the player has seen nothing */
8224         bool visual = FALSE;
8225
8226         /* Assume the player has seen no blast grids */
8227         bool drawn = FALSE;
8228
8229         /* Assume to be a normal ball spell */
8230         bool breath = FALSE;
8231
8232         /* Is the player blind? */
8233         bool blind = (p_ptr->blind ? TRUE : FALSE);
8234
8235         bool old_hide = FALSE;
8236
8237         /* Number of grids in the "path" */
8238         int path_n = 0;
8239
8240         /* Actual grids in the "path" */
8241         u16b path_g[512];
8242
8243         /* Number of grids in the "blast area" (including the "beam" path) */
8244         int grids = 0;
8245
8246         /* Coordinates of the affected grids */
8247         byte gx[1024], gy[1024];
8248
8249         /* Encoded "radius" info (see above) */
8250         byte gm[32];
8251
8252         /* Actual radius encoded in gm[] */
8253         int gm_rad = rad;
8254
8255         bool jump = FALSE;
8256
8257         /* Attacker's name (prepared before polymorph)*/
8258         char who_name[80];
8259
8260         /* Initialize by null string */
8261         who_name[0] = '\0';
8262
8263         rakubadam_p = 0;
8264         rakubadam_m = 0;
8265
8266         /* Default target of monsterspell is player */
8267         monster_target_y=py;
8268         monster_target_x=px;
8269
8270         /* Hack -- Jump to target */
8271         if (flg & (PROJECT_JUMP))
8272         {
8273                 x1 = x;
8274                 y1 = y;
8275
8276                 /* Clear the flag */
8277                 flg &= ~(PROJECT_JUMP);
8278
8279                 jump = TRUE;
8280         }
8281
8282         /* Start at player */
8283         else if (who <= 0)
8284         {
8285                 x1 = px;
8286                 y1 = py;
8287         }
8288
8289         /* Start at monster */
8290         else if (who > 0)
8291         {
8292                 x1 = m_list[who].fx;
8293                 y1 = m_list[who].fy;
8294                 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8295         }
8296
8297         /* Oops */
8298         else
8299         {
8300                 x1 = x;
8301                 y1 = y;
8302         }
8303
8304         y_saver = y1;
8305         x_saver = x1;
8306
8307         /* Default "destination" */
8308         y2 = y;
8309         x2 = x;
8310
8311
8312         /* Hack -- verify stuff */
8313         if (flg & (PROJECT_THRU))
8314         {
8315                 if ((x1 == x2) && (y1 == y2))
8316                 {
8317                         flg &= ~(PROJECT_THRU);
8318                 }
8319         }
8320
8321         /* Handle a breath attack */
8322         if (rad < 0)
8323         {
8324                 rad = 0 - rad;
8325                 breath = TRUE;
8326                 if (flg & PROJECT_HIDE) old_hide = TRUE;
8327                 flg |= PROJECT_HIDE;
8328         }
8329
8330
8331         /* Hack -- Assume there will be no blast (max radius 32) */
8332         for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8333
8334
8335         /* Initial grid */
8336         y = y1;
8337         x = x1;
8338         dist = 0;
8339
8340         /* Collect beam grids */
8341         if (flg & (PROJECT_BEAM))
8342         {
8343                 gy[grids] = y;
8344                 gx[grids] = x;
8345                 grids++;
8346         }
8347
8348         switch (typ)
8349         {
8350         case GF_LITE:
8351         case GF_LITE_WEAK:
8352                 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8353                 break;
8354         case GF_DISINTEGRATE:
8355                 flg |= (PROJECT_GRID);
8356                 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8357                 break;
8358         }
8359
8360         /* Calculate the projection path */
8361
8362         path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8363
8364         /* Hack -- Handle stuff */
8365         handle_stuff();
8366
8367         /* Giga-Hack SEEKER & SUPER_RAY */
8368
8369         if( typ == GF_SEEKER )
8370         {
8371                 int j;
8372                 int last_i=0;
8373
8374                 /* Mega-Hack */
8375                 project_m_n = 0;
8376                 project_m_x = 0;
8377                 project_m_y = 0;
8378
8379                 for (i = 0; i < path_n; ++i)
8380                 {
8381                         int oy = y;
8382                         int ox = x;
8383
8384                         int ny = GRID_Y(path_g[i]);
8385                         int nx = GRID_X(path_g[i]);
8386
8387                         /* Advance */
8388                         y = ny;
8389                         x = nx;
8390
8391                         gy[grids] = y;
8392                         gx[grids] = x;
8393                         grids++;
8394
8395
8396                         /* Only do visuals if requested */
8397                         if (!blind && !(flg & (PROJECT_HIDE)))
8398                         {
8399                                 /* Only do visuals if the player can "see" the bolt */
8400                                 if (panel_contains(y, x) && player_has_los_bold(y, x))
8401                                 {
8402                                         u16b p;
8403
8404                                         byte a;
8405                                         char c;
8406
8407                                         /* Obtain the bolt pict */
8408                                         p = bolt_pict(oy, ox, y, x, typ);
8409
8410                                         /* Extract attr/char */
8411                                         a = PICT_A(p);
8412                                         c = PICT_C(p);
8413
8414                                         /* Visual effects */
8415                                         print_rel(c, a, y, x);
8416                                         move_cursor_relative(y, x);
8417                                         /*if (fresh_before)*/ Term_fresh();
8418                                         Term_xtra(TERM_XTRA_DELAY, msec);
8419                                         lite_spot(y, x);
8420                                         /*if (fresh_before)*/ Term_fresh();
8421
8422                                         /* Display "beam" grids */
8423                                         if (flg & (PROJECT_BEAM))
8424                                         {
8425                                                 /* Obtain the explosion pict */
8426                                                 p = bolt_pict(y, x, y, x, typ);
8427
8428                                                 /* Extract attr/char */
8429                                                 a = PICT_A(p);
8430                                                 c = PICT_C(p);
8431
8432                                                 /* Visual effects */
8433                                                 print_rel(c, a, y, x);
8434                                         }
8435
8436                                         /* Hack -- Activate delay */
8437                                         visual = TRUE;
8438                                 }
8439
8440                                 /* Hack -- delay anyway for consistency */
8441                                 else if (visual)
8442                                 {
8443                                         /* Delay for consistency */
8444                                         Term_xtra(TERM_XTRA_DELAY, msec);
8445                                 }
8446                         }
8447                         if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8448                         if( is_mirror_grid(&cave[y][x]))
8449                         {
8450                           /* The target of monsterspell becomes tha mirror(broken) */
8451                                 monster_target_y=(s16b)y;
8452                                 monster_target_x=(s16b)x;
8453
8454                                 remove_mirror(y,x);
8455                                 next_mirror( &oy,&ox,y,x );
8456
8457                                 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8458                                 for( j = last_i; j <=i ; j++ )
8459                                 {
8460                                         y = GRID_Y(path_g[j]);
8461                                         x = GRID_X(path_g[j]);
8462                                         if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8463                                         if(!who && (project_m_n==1) && !jump ){
8464                                           if(cave[project_m_y][project_m_x].m_idx >0 ){
8465                                             monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8466
8467                                             /* Hack -- auto-recall */
8468                                             if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8469
8470                                             /* Hack - auto-track */
8471                                             if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8472                                           }
8473                                         }
8474                                         (void)project_f(0,0,y,x,dam,GF_SEEKER);
8475                                 }
8476                                 last_i = i;
8477                         }
8478                 }
8479                 for( i = last_i ; i < path_n ; i++ )
8480                 {
8481                         int x,y;
8482                         y = GRID_Y(path_g[i]);
8483                         x = GRID_X(path_g[i]);
8484                         if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8485                           notice=TRUE;
8486                         if(!who && (project_m_n==1) && !jump ){
8487                           if(cave[project_m_y][project_m_x].m_idx >0 ){
8488                             monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8489                             
8490                             /* Hack -- auto-recall */
8491                             if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8492                             
8493                             /* Hack - auto-track */
8494                             if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8495                           }
8496                         }
8497                         (void)project_f(0,0,y,x,dam,GF_SEEKER);
8498                 }
8499                 return notice;
8500         }
8501         else if(typ == GF_SUPER_RAY){
8502                 int j;
8503                 int second_step = 0;
8504
8505                 /* Mega-Hack */
8506                 project_m_n = 0;
8507                 project_m_x = 0;
8508                 project_m_y = 0;
8509
8510                 for (i = 0; i < path_n; ++i)
8511                 {
8512                         int oy = y;
8513                         int ox = x;
8514
8515                         int ny = GRID_Y(path_g[i]);
8516                         int nx = GRID_X(path_g[i]);
8517
8518                         /* Advance */
8519                         y = ny;
8520                         x = nx;
8521
8522                         gy[grids] = y;
8523                         gx[grids] = x;
8524                         grids++;
8525
8526
8527                         /* Only do visuals if requested */
8528                         if (!blind && !(flg & (PROJECT_HIDE)))
8529                         {
8530                                 /* Only do visuals if the player can "see" the bolt */
8531                                 if (panel_contains(y, x) && player_has_los_bold(y, x))
8532                                 {
8533                                         u16b p;
8534
8535                                         byte a;
8536                                         char c;
8537
8538                                         /* Obtain the bolt pict */
8539                                         p = bolt_pict(oy, ox, y, x, typ);
8540
8541                                         /* Extract attr/char */
8542                                         a = PICT_A(p);
8543                                         c = PICT_C(p);
8544
8545                                         /* Visual effects */
8546                                         print_rel(c, a, y, x);
8547                                         move_cursor_relative(y, x);
8548                                         /*if (fresh_before)*/ Term_fresh();
8549                                         Term_xtra(TERM_XTRA_DELAY, msec);
8550                                         lite_spot(y, x);
8551                                         /*if (fresh_before)*/ Term_fresh();
8552
8553                                         /* Display "beam" grids */
8554                                         if (flg & (PROJECT_BEAM))
8555                                         {
8556                                                 /* Obtain the explosion pict */
8557                                                 p = bolt_pict(y, x, y, x, typ);
8558
8559                                                 /* Extract attr/char */
8560                                                 a = PICT_A(p);
8561                                                 c = PICT_C(p);
8562
8563                                                 /* Visual effects */
8564                                                 print_rel(c, a, y, x);
8565                                         }
8566
8567                                         /* Hack -- Activate delay */
8568                                         visual = TRUE;
8569                                 }
8570
8571                                 /* Hack -- delay anyway for consistency */
8572                                 else if (visual)
8573                                 {
8574                                         /* Delay for consistency */
8575                                         Term_xtra(TERM_XTRA_DELAY, msec);
8576                                 }
8577                         }
8578                         if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8579                         if (!cave_have_flag_bold(y, x, FF_PROJECT))
8580                         {
8581                                 if( second_step )continue;
8582                                 break;
8583                         }
8584                         if( is_mirror_grid(&cave[y][x]) && !second_step )
8585                         {
8586                           /* The target of monsterspell becomes tha mirror(broken) */
8587                                 monster_target_y=(s16b)y;
8588                                 monster_target_x=(s16b)x;
8589
8590                                 remove_mirror(y,x);
8591                                 for( j = 0; j <=i ; j++ )
8592                                 {
8593                                         y = GRID_Y(path_g[j]);
8594                                         x = GRID_X(path_g[j]);
8595                                         (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8596                                 }
8597                                 path_n = i;
8598                                 second_step =i+1;
8599                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8600                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x  , flg);
8601                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8602                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y  , x-1, flg);
8603                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y  , x+1, flg);
8604                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8605                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x  , flg);
8606                                 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8607                         }
8608                 }
8609                 for( i = 0; i < path_n ; i++ )
8610                 {
8611                         int x,y;
8612                         y = GRID_Y(path_g[i]);
8613                         x = GRID_X(path_g[i]);
8614                         (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8615                         if(!who && (project_m_n==1) && !jump ){
8616                           if(cave[project_m_y][project_m_x].m_idx >0 ){
8617                             monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8618                             
8619                             /* Hack -- auto-recall */
8620                             if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8621                             
8622                             /* Hack - auto-track */
8623                             if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8624                           }
8625                         }
8626                         (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8627                 }
8628                 return notice;
8629         }
8630
8631         /* Project along the path */
8632         for (i = 0; i < path_n; ++i)
8633         {
8634                 int oy = y;
8635                 int ox = x;
8636
8637                 int ny = GRID_Y(path_g[i]);
8638                 int nx = GRID_X(path_g[i]);
8639
8640                 if (flg & PROJECT_DISI)
8641                 {
8642                         /* Hack -- Balls explode before reaching walls */
8643                         if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8644                 }
8645                 else if (flg & PROJECT_LOS)
8646                 {
8647                         /* Hack -- Balls explode before reaching walls */
8648                         if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8649                 }
8650                 else
8651                 {
8652                         /* Hack -- Balls explode before reaching walls */
8653                         if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8654                 }
8655
8656                 /* Advance */
8657                 y = ny;
8658                 x = nx;
8659
8660                 /* Collect beam grids */
8661                 if (flg & (PROJECT_BEAM))
8662                 {
8663                         gy[grids] = y;
8664                         gx[grids] = x;
8665                         grids++;
8666                 }
8667
8668                 /* Only do visuals if requested */
8669                 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8670                 {
8671                         /* Only do visuals if the player can "see" the bolt */
8672                         if (panel_contains(y, x) && player_has_los_bold(y, x))
8673                         {
8674                                 u16b p;
8675
8676                                 byte a;
8677                                 char c;
8678
8679                                 /* Obtain the bolt pict */
8680                                 p = bolt_pict(oy, ox, y, x, typ);
8681
8682                                 /* Extract attr/char */
8683                                 a = PICT_A(p);
8684                                 c = PICT_C(p);
8685
8686                                 /* Visual effects */
8687                                 print_rel(c, a, y, x);
8688                                 move_cursor_relative(y, x);
8689                                 /*if (fresh_before)*/ Term_fresh();
8690                                 Term_xtra(TERM_XTRA_DELAY, msec);
8691                                 lite_spot(y, x);
8692                                 /*if (fresh_before)*/ Term_fresh();
8693
8694                                 /* Display "beam" grids */
8695                                 if (flg & (PROJECT_BEAM))
8696                                 {
8697                                         /* Obtain the explosion pict */
8698                                         p = bolt_pict(y, x, y, x, typ);
8699
8700                                         /* Extract attr/char */
8701                                         a = PICT_A(p);
8702                                         c = PICT_C(p);
8703
8704                                         /* Visual effects */
8705                                         print_rel(c, a, y, x);
8706                                 }
8707
8708                                 /* Hack -- Activate delay */
8709                                 visual = TRUE;
8710                         }
8711
8712                         /* Hack -- delay anyway for consistency */
8713                         else if (visual)
8714                         {
8715                                 /* Delay for consistency */
8716                                 Term_xtra(TERM_XTRA_DELAY, msec);
8717                         }
8718                 }
8719         }
8720
8721         path_n = i;
8722
8723         /* Save the "blast epicenter" */
8724         by = y;
8725         bx = x;
8726
8727         if (breath && !path_n)
8728         {
8729                 breath = FALSE;
8730                 gm_rad = rad;
8731                 if (!old_hide)
8732                 {
8733                         flg &= ~(PROJECT_HIDE);
8734                 }
8735         }
8736
8737         /* Start the "explosion" */
8738         gm[0] = 0;
8739
8740         /* Hack -- make sure beams get to "explode" */
8741         gm[1] = grids;
8742
8743         dist = path_n;
8744         dist_hack = dist;
8745
8746         project_length = 0;
8747
8748         /* If we found a "target", explode there */
8749         if (dist <= MAX_RANGE)
8750         {
8751                 /* Mega-Hack -- remove the final "beam" grid */
8752                 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8753
8754                 /*
8755                  * Create a conical breath attack
8756                  *
8757                  *         ***
8758                  *     ********
8759                  * D********@**
8760                  *     ********
8761                  *         ***
8762                  */
8763
8764                 if (breath)
8765                 {
8766                         flg &= ~(PROJECT_HIDE);
8767
8768                         breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8769                 }
8770                 else
8771                 {
8772                         /* Determine the blast area, work from the inside out */
8773                         for (dist = 0; dist <= rad; dist++)
8774                         {
8775                                 /* Scan the maximal blast area of radius "dist" */
8776                                 for (y = by - dist; y <= by + dist; y++)
8777                                 {
8778                                         for (x = bx - dist; x <= bx + dist; x++)
8779                                         {
8780                                                 /* Ignore "illegal" locations */
8781                                                 if (!in_bounds2(y, x)) continue;
8782
8783                                                 /* Enforce a "circular" explosion */
8784                                                 if (distance(by, bx, y, x) != dist) continue;
8785
8786                                                 switch (typ)
8787                                                 {
8788                                                 case GF_LITE:
8789                                                 case GF_LITE_WEAK:
8790                                                         /* Lights are stopped by opaque terrains */
8791                                                         if (!los(by, bx, y, x)) continue;
8792                                                         break;
8793                                                 case GF_DISINTEGRATE:
8794                                                         /* Disintegration are stopped only by perma-walls */
8795                                                         if (!in_disintegration_range(by, bx, y, x)) continue;
8796                                                         break;
8797                                                 default:
8798                                                         /* Ball explosions are stopped by walls */
8799                                                         if (!projectable(by, bx, y, x)) continue;
8800                                                         break;
8801                                                 }
8802
8803                                                 /* Save this grid */
8804                                                 gy[grids] = y;
8805                                                 gx[grids] = x;
8806                                                 grids++;
8807                                         }
8808                                 }
8809
8810                                 /* Encode some more "radius" info */
8811                                 gm[dist+1] = grids;
8812                         }
8813                 }
8814         }
8815
8816         /* Speed -- ignore "non-explosions" */
8817         if (!grids) return (FALSE);
8818
8819
8820         /* Display the "blast area" if requested */
8821         if (!blind && !(flg & (PROJECT_HIDE)))
8822         {
8823                 /* Then do the "blast", from inside out */
8824                 for (t = 0; t <= gm_rad; t++)
8825                 {
8826                         /* Dump everything with this radius */
8827                         for (i = gm[t]; i < gm[t+1]; i++)
8828                         {
8829                                 /* Extract the location */
8830                                 y = gy[i];
8831                                 x = gx[i];
8832
8833                                 /* Only do visuals if the player can "see" the blast */
8834                                 if (panel_contains(y, x) && player_has_los_bold(y, x))
8835                                 {
8836                                         u16b p;
8837
8838                                         byte a;
8839                                         char c;
8840
8841                                         drawn = TRUE;
8842
8843                                         /* Obtain the explosion pict */
8844                                         p = bolt_pict(y, x, y, x, typ);
8845
8846                                         /* Extract attr/char */
8847                                         a = PICT_A(p);
8848                                         c = PICT_C(p);
8849
8850                                         /* Visual effects -- Display */
8851                                         print_rel(c, a, y, x);
8852                                 }
8853                         }
8854
8855                         /* Hack -- center the cursor */
8856                         move_cursor_relative(by, bx);
8857
8858                         /* Flush each "radius" seperately */
8859                         /*if (fresh_before)*/ Term_fresh();
8860
8861                         /* Delay (efficiently) */
8862                         if (visual || drawn)
8863                         {
8864                                 Term_xtra(TERM_XTRA_DELAY, msec);
8865                         }
8866                 }
8867
8868                 /* Flush the erasing */
8869                 if (drawn)
8870                 {
8871                         /* Erase the explosion drawn above */
8872                         for (i = 0; i < grids; i++)
8873                         {
8874                                 /* Extract the location */
8875                                 y = gy[i];
8876                                 x = gx[i];
8877
8878                                 /* Hack -- Erase if needed */
8879                                 if (panel_contains(y, x) && player_has_los_bold(y, x))
8880                                 {
8881                                         lite_spot(y, x);
8882                                 }
8883                         }
8884
8885                         /* Hack -- center the cursor */
8886                         move_cursor_relative(by, bx);
8887
8888                         /* Flush the explosion */
8889                         /*if (fresh_before)*/ Term_fresh();
8890                 }
8891         }
8892
8893
8894         /* Update stuff if needed */
8895         if (p_ptr->update) update_stuff();
8896
8897
8898         /* Check features */
8899         if (flg & (PROJECT_GRID))
8900         {
8901                 /* Start with "dist" of zero */
8902                 dist = 0;
8903
8904                 /* Scan for features */
8905                 for (i = 0; i < grids; i++)
8906                 {
8907                         /* Hack -- Notice new "dist" values */
8908                         if (gm[dist+1] == i) dist++;
8909
8910                         /* Get the grid location */
8911                         y = gy[i];
8912                         x = gx[i];
8913
8914                         /* Find the closest point in the blast */
8915                         if (breath)
8916                         {
8917                                 int d = dist_to_line(y, x, y1, x1, by, bx);
8918
8919                                 /* Affect the grid */
8920                                 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8921                         }
8922                         else
8923                         {
8924                                 /* Affect the grid */
8925                                 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8926                         }
8927                 }
8928         }
8929
8930         /* Update stuff if needed */
8931         if (p_ptr->update) update_stuff();
8932
8933         /* Check objects */
8934         if (flg & (PROJECT_ITEM))
8935         {
8936                 /* Start with "dist" of zero */
8937                 dist = 0;
8938
8939                 /* Scan for objects */
8940                 for (i = 0; i < grids; i++)
8941                 {
8942                         /* Hack -- Notice new "dist" values */
8943                         if (gm[dist+1] == i) dist++;
8944
8945                         /* Get the grid location */
8946                         y = gy[i];
8947                         x = gx[i];
8948
8949                         /* Find the closest point in the blast */
8950                         if (breath)
8951                         {
8952                                 int d = dist_to_line(y, x, y1, x1, by, bx);
8953
8954                                 /* Affect the object in the grid */
8955                                 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8956                         }
8957                         else
8958                         {
8959                                 /* Affect the object in the grid */
8960                                 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8961                         }
8962                 }
8963         }
8964
8965
8966         /* Check monsters */
8967         if (flg & (PROJECT_KILL))
8968         {
8969                 /* Mega-Hack */
8970                 project_m_n = 0;
8971                 project_m_x = 0;
8972                 project_m_y = 0;
8973
8974                 /* Start with "dist" of zero */
8975                 dist = 0;
8976
8977                 /* Scan for monsters */
8978                 for (i = 0; i < grids; i++)
8979                 {
8980                         int effective_dist;
8981
8982                         /* Hack -- Notice new "dist" values */
8983                         if (gm[dist + 1] == i) dist++;
8984
8985                         /* Get the grid location */
8986                         y = gy[i];
8987                         x = gx[i];
8988
8989                         /* A single bolt may be reflected */
8990                         if (grids <= 1)
8991                         {
8992                                 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8993                                 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
8994
8995                                 if ((ref_ptr->flags2 & RF2_REFLECTING) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1) && !one_in_(10))
8996                                 {
8997                                         byte t_y, t_x;
8998                                         int max_attempts = 10;
8999
9000                                         /* Choose 'new' target */
9001                                         do
9002                                         {
9003                                                 t_y = y_saver - 1 + randint1(3);
9004                                                 t_x = x_saver - 1 + randint1(3);
9005                                                 max_attempts--;
9006                                         }
9007                                         while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9008
9009                                         if (max_attempts < 1)
9010                                         {
9011                                                 t_y = y_saver;
9012                                                 t_x = x_saver;
9013                                         }
9014
9015                                         if (is_seen(m_ptr))
9016                                         {
9017 #ifdef JP
9018                                                 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9019                                                         msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9020                                                 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤ­ÊÖ¤·¤¿¡ª");
9021                                                 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9022 #else
9023                                                 msg_print("The attack bounces!");
9024 #endif
9025                                         }
9026                                         if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9027
9028                                         /* Reflected bolts randomly target either one */
9029                                         if (one_in_(2)) flg |= PROJECT_PLAYER;
9030                                         else flg &= ~(PROJECT_PLAYER);
9031
9032                                         /* The bolt is reflected */
9033                                         project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9034
9035                                         /* Don't affect the monster any longer */
9036                                         continue;
9037                                 }
9038                         }
9039
9040
9041                         /* Find the closest point in the blast */
9042                         if (breath)
9043                         {
9044                                 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9045                         }
9046                         else
9047                         {
9048                                 effective_dist = dist;
9049                         }
9050
9051
9052                         /* There is the riding player on this monster */
9053                         if (p_ptr->riding && player_bold(y, x))
9054                         {
9055                                 /* Aimed on the player */
9056                                 if (flg & PROJECT_PLAYER)
9057                                 {
9058                                         if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9059                                         {
9060                                                 /*
9061                                                  * A beam or bolt is well aimed
9062                                                  * at the PLAYER!
9063                                                  * So don't affects the mount.
9064                                                  */
9065                                                 continue;
9066                                         }
9067                                         else
9068                                         {
9069                                                 /*
9070                                                  * The spell is not well aimed, 
9071                                                  * So partly affect the mount too.
9072                                                  */
9073                                                 effective_dist++;
9074                                         }
9075                                 }
9076
9077                                 /*
9078                                  * This grid is the original target.
9079                                  * Or aimed on your horse.
9080                                  */
9081                                 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9082                                 {
9083                                         /* Hit the mount with full damage */
9084                                 }
9085
9086                                 /*
9087                                  * Otherwise this grid is not the
9088                                  * original target, it means that line
9089                                  * of fire is obstructed by this
9090                                  * monster.
9091                                  */
9092                                 /*
9093                                  * A beam or bolt will hit either
9094                                  * player or mount.  Choose randomly.
9095                                  */
9096                                 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9097                                 {
9098                                         if (one_in_(2))
9099                                         {
9100                                                 /* Hit the mount with full damage */
9101                                         }
9102                                         else
9103                                         {
9104                                                 /* Hit the player later */
9105                                                 flg |= PROJECT_PLAYER;
9106
9107                                                 /* Don't affect the mount */
9108                                                 continue;
9109                                         }
9110                                 }
9111
9112                                 /*
9113                                  * The spell is not well aimed, so
9114                                  * partly affect both player and
9115                                  * mount.
9116                                  */
9117                                 else
9118                                 {
9119                                         effective_dist++;
9120                                 }
9121                         }
9122
9123                         /* Affect the monster in the grid */
9124                         if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
9125                 }
9126
9127
9128                 /* Player affected one monster (without "jumping") */
9129                 if (!who && (project_m_n == 1) && !jump)
9130                 {
9131                         /* Location */
9132                         x = project_m_x;
9133                         y = project_m_y;
9134
9135                         /* Track if possible */
9136                         if (cave[y][x].m_idx > 0)
9137                         {
9138                                 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9139
9140                                 /* Hack -- auto-recall */
9141                                 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
9142
9143                                 /* Hack - auto-track */
9144                                 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9145                         }
9146                 }
9147         }
9148
9149
9150         /* Check player */
9151         if (flg & (PROJECT_KILL))
9152         {
9153                 /* Start with "dist" of zero */
9154                 dist = 0;
9155
9156                 /* Scan for player */
9157                 for (i = 0; i < grids; i++)
9158                 {
9159                         int effective_dist;
9160
9161                         /* Hack -- Notice new "dist" values */
9162                         if (gm[dist+1] == i) dist++;
9163
9164                         /* Get the grid location */
9165                         y = gy[i];
9166                         x = gx[i];
9167
9168                         /* Affect the player? */
9169                         if (!player_bold(y, x)) continue;
9170
9171                         /* Find the closest point in the blast */
9172                         if (breath)
9173                         {
9174                                 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9175                         }
9176                         else
9177                         {
9178                                 effective_dist = dist;
9179                         }
9180
9181                         /* Target may be your horse */
9182                         if (p_ptr->riding)
9183                         {
9184                                 /* Aimed on the player */
9185                                 if (flg & PROJECT_PLAYER)
9186                                 {
9187                                         /* Hit the player with full damage */
9188                                 }
9189
9190                                 /*
9191                                  * Hack -- When this grid was not the
9192                                  * original target, a beam or bolt
9193                                  * would hit either player or mount,
9194                                  * and should be choosen randomly.
9195                                  *
9196                                  * But already choosen to hit the
9197                                  * mount at this point.
9198                                  *
9199                                  * Or aimed on your horse.
9200                                  */
9201                                 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9202                                 {
9203                                         /*
9204                                          * A beam or bolt is well aimed
9205                                          * at the mount!
9206                                          * So don't affects the player.
9207                                          */
9208                                         continue;
9209                                 }
9210                                 else
9211                                 {
9212                                         /*
9213                                          * The spell is not well aimed, 
9214                                          * So partly affect the player too.
9215                                          */
9216                                         effective_dist++;
9217                                 }
9218                         }
9219
9220                         /* Affect the player */
9221                         if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9222                 }
9223         }
9224
9225         if (p_ptr->riding)
9226         {
9227                 char m_name[80];
9228
9229                 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9230
9231                 if (rakubadam_m > 0)
9232                 {
9233                         if (rakuba(rakubadam_m, FALSE))
9234                         {
9235 #ifdef JP
9236 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9237 #else
9238                                 msg_format("%^s has thrown you off!", m_name);
9239 #endif
9240                         }
9241                 }
9242                 if (p_ptr->riding && rakubadam_p > 0)
9243                 {
9244                         if(rakuba(rakubadam_p, FALSE))
9245                         {
9246 #ifdef JP
9247 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9248 #else
9249                                 msg_format("You have fallen from %s.", m_name);
9250 #endif
9251                         }
9252                 }
9253         }
9254
9255         /* Return "something was noticed" */
9256         return (notice);
9257 }
9258
9259 bool binding_field( int dam )
9260 {
9261         int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9262         int mirror_num=0;              /* ¶À¤Î¿ô */
9263         int x,y;
9264         int centersign;
9265         int x1,x2,y1,y2;
9266         u16b p;
9267         int msec= delay_factor*delay_factor*delay_factor;
9268
9269         /* »°³Ñ·Á¤ÎĺÅÀ */
9270         int point_x[3];
9271         int point_y[3];
9272
9273         /* Default target of monsterspell is player */
9274         monster_target_y=py;
9275         monster_target_x=px;
9276
9277         for( x=0 ; x < cur_wid ; x++ )
9278         {
9279                 for( y=0 ; y < cur_hgt ; y++ )
9280                 {
9281                         if( is_mirror_grid(&cave[y][x]) &&
9282                             distance(py,px,y,x) <= MAX_RANGE &&
9283                             distance(py,px,y,x) != 0 &&
9284                             player_has_los_bold(y,x) &&
9285                             projectable(py, px, y, x)
9286                             ){
9287                                 mirror_y[mirror_num]=y;
9288                                 mirror_x[mirror_num]=x;
9289                                 mirror_num++;
9290                         }
9291                 }
9292         }
9293
9294         if( mirror_num < 2 )return FALSE;
9295
9296         point_x[0] = randint0( mirror_num );
9297         do {
9298           point_x[1] = randint0( mirror_num );
9299         }
9300         while( point_x[0] == point_x[1] );
9301
9302         point_y[0]=mirror_y[point_x[0]];
9303         point_x[0]=mirror_x[point_x[0]];
9304         point_y[1]=mirror_y[point_x[1]];
9305         point_x[1]=mirror_x[point_x[1]];
9306         point_y[2]=py;
9307         point_x[2]=px;
9308
9309         x=point_x[0]+point_x[1]+point_x[2];
9310         y=point_y[0]+point_y[1]+point_y[2];
9311
9312         centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9313                 - (point_y[0]*3-y)*(point_x[1]*3-x);
9314         if( centersign == 0 )return FALSE;
9315                             
9316         x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9317         x1 = x1 < point_x[2] ? x1 : point_x[2];
9318         y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9319         y1 = y1 < point_y[2] ? y1 : point_y[2];
9320
9321         x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9322         x2 = x2 > point_x[2] ? x2 : point_x[2];
9323         y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9324         y2 = y2 > point_y[2] ? y2 : point_y[2];
9325
9326         for( y=y1 ; y <=y2 ; y++ ){
9327                 for( x=x1 ; x <=x2 ; x++ ){
9328                         if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9329                                          -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9330                             centersign*( (point_x[1]-x)*(point_y[2]-y)
9331                                          -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9332                             centersign*( (point_x[2]-x)*(point_y[0]-y)
9333                                          -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9334                         {
9335                                 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9336                                         /* Visual effects */
9337                                         if(!(p_ptr->blind)
9338                                            && panel_contains(y,x)){
9339                                           p = bolt_pict(y,x,y,x, GF_MANA );
9340                                           print_rel(PICT_C(p), PICT_A(p),y,x);
9341                                           move_cursor_relative(y, x);
9342                                           /*if (fresh_before)*/ Term_fresh();
9343                                           Term_xtra(TERM_XTRA_DELAY, msec);
9344                                         }
9345                                 }
9346                         }
9347                 }
9348         }
9349         for( y=y1 ; y <=y2 ; y++ ){
9350                 for( x=x1 ; x <=x2 ; x++ ){
9351                         if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9352                                          -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9353                             centersign*( (point_x[1]-x)*(point_y[2]-y)
9354                                          -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9355                             centersign*( (point_x[2]-x)*(point_y[0]-y)
9356                                          -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9357                         {
9358                                 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9359                                         (void)project_f(0,0,y,x,dam,GF_MANA); 
9360                                 }
9361                         }
9362                 }
9363         }
9364         for( y=y1 ; y <=y2 ; y++ ){
9365                 for( x=x1 ; x <=x2 ; x++ ){
9366                         if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9367                                          -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9368                             centersign*( (point_x[1]-x)*(point_y[2]-y)
9369                                          -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9370                             centersign*( (point_x[2]-x)*(point_y[0]-y)
9371                                          -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9372                         {
9373                                 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9374                                         (void)project_o(0,0,y,x,dam,GF_MANA); 
9375                                 }
9376                         }
9377                 }
9378         }
9379         for( y=y1 ; y <=y2 ; y++ ){
9380                 for( x=x1 ; x <=x2 ; x++ ){
9381                         if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9382                                          -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9383                             centersign*( (point_x[1]-x)*(point_y[2]-y)
9384                                          -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9385                             centersign*( (point_x[2]-x)*(point_y[0]-y)
9386                                          -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9387                         {
9388                                 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9389                                         (void)project_m(0,0,y,x,dam,GF_MANA,
9390                                           (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP));
9391                                 }
9392                         }
9393                 }
9394         }
9395         if( one_in_(7) ){
9396 #ifdef JP
9397                 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤­¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9398 #else
9399                 msg_print("The field broke a mirror");
9400 #endif  
9401                 remove_mirror(point_y[0],point_x[0]);
9402         }
9403
9404         return TRUE;
9405 }
9406
9407 void seal_of_mirror( int dam )
9408 {
9409         int x,y;
9410
9411         for( x = 0 ; x < cur_wid ; x++ )
9412         {
9413                 for( y = 0 ; y < cur_hgt ; y++ )
9414                 {
9415                         if( is_mirror_grid(&cave[y][x]))
9416                         {
9417                                 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9418                                                          (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP)))
9419                                 {
9420                                         if( !cave[y][x].m_idx )
9421                                         {
9422                                                 remove_mirror(y,x);
9423                                         }
9424                                 }
9425                         }
9426                 }
9427         }
9428         return;
9429 }
9430