OSDN Git Service

bb47224358feb3982ee209835628556f66bdb9ca
[hengband/hengband.git] / src / mspells1.c
1 /* File: mspells1.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: Monster spells (attack player) */
12
13 #include "angband.h"
14
15
16 #ifdef DRS_SMART_OPTIONS
17
18 /*
19  * And now for Intelligent monster attacks (including spells).
20  *
21  * Original idea and code by "DRS" (David Reeves Sward).
22  * Major modifications by "BEN" (Ben Harrison).
23  *
24  * Give monsters more intelligent attack/spell selection based on
25  * observations of previous attacks on the player, and/or by allowing
26  * the monster to "cheat" and know the player status.
27  *
28  * Maintain an idea of the player status, and use that information
29  * to occasionally eliminate "ineffective" spell attacks.  We could
30  * also eliminate ineffective normal attacks, but there is no reason
31  * for the monster to do this, since he gains no benefit.
32  * Note that MINDLESS monsters are not allowed to use this code.
33  * And non-INTELLIGENT monsters only use it partially effectively.
34  *
35  * Actually learn what the player resists, and use that information
36  * to remove attacks or spells before using them.  This will require
37  * much less space, if I am not mistaken.  Thus, each monster gets a
38  * set of 32 bit flags, "smart", build from the various "SM_*" flags.
39  *
40  * This has the added advantage that attacks and spells are related.
41  * The "smart_learn" option means that the monster "learns" the flags
42  * that should be set, and "smart_cheat" means that he "knows" them.
43  * So "smart_cheat" means that the "smart" field is always up to date,
44  * while "smart_learn" means that the "smart" field is slowly learned.
45  * Both of them have the same effect on the "choose spell" routine.
46  */
47
48
49
50 /*
51  * Internal probability routine
52  */
53 static bool int_outof(monster_race *r_ptr, int prob)
54 {
55         /* Non-Smart monsters are half as "smart" */
56         if (!(r_ptr->flags2 & RF2_SMART)) prob = prob / 2;
57
58         /* Roll the dice */
59         return (randint0(100) < prob);
60 }
61
62
63
64 /*
65  * Remove the "bad" spells from a spell list
66  */
67 static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
68 {
69         monster_type *m_ptr = &m_list[m_idx];
70         monster_race *r_ptr = &r_info[m_ptr->r_idx];
71
72         u32b f4 = (*f4p);
73         u32b f5 = (*f5p);
74         u32b f6 = (*f6p);
75
76         u32b smart = 0L;
77
78
79         /* Too stupid to know anything */
80         if (r_ptr->flags2 & RF2_STUPID) return;
81
82
83         /* Must be cheating or learning */
84         if (!smart_cheat && !smart_learn) return;
85
86
87         /* Update acquired knowledge */
88         if (smart_learn)
89         {
90                 /* Hack -- Occasionally forget player status */
91                 if (m_ptr->smart && (randint0(100) < 1)) m_ptr->smart = 0L;
92
93                 /* Use the memorized flags */
94                 smart = m_ptr->smart;
95         }
96
97
98         /* Cheat if requested */
99         if (smart_cheat)
100         {
101                 /* Know basic info */
102                 if (p_ptr->resist_acid) smart |= (SM_RES_ACID);
103                 if (p_ptr->oppose_acid) smart |= (SM_OPP_ACID);
104                 if (p_ptr->immune_acid) smart |= (SM_IMM_ACID);
105                 if (p_ptr->resist_elec) smart |= (SM_RES_ELEC);
106                 if (p_ptr->oppose_elec) smart |= (SM_OPP_ELEC);
107                 if (p_ptr->immune_elec) smart |= (SM_IMM_ELEC);
108                 if (p_ptr->resist_fire) smart |= (SM_RES_FIRE);
109                 if (p_ptr->oppose_fire) smart |= (SM_OPP_FIRE);
110                 if (p_ptr->immune_fire) smart |= (SM_IMM_FIRE);
111                 if (p_ptr->resist_cold) smart |= (SM_RES_COLD);
112                 if (p_ptr->oppose_cold) smart |= (SM_OPP_COLD);
113                 if (p_ptr->immune_cold) smart |= (SM_IMM_COLD);
114
115                 /* Know poison info */
116                 if (p_ptr->resist_pois) smart |= (SM_RES_POIS);
117                 if (p_ptr->oppose_pois) smart |= (SM_OPP_POIS);
118
119                 /* Know special resistances */
120                 if (p_ptr->resist_neth) smart |= (SM_RES_NETH);
121                 if (p_ptr->resist_lite) smart |= (SM_RES_LITE);
122                 if (p_ptr->resist_dark) smart |= (SM_RES_DARK);
123                 if (p_ptr->resist_fear) smart |= (SM_RES_FEAR);
124                 if (p_ptr->resist_conf) smart |= (SM_RES_CONF);
125                 if (p_ptr->resist_chaos) smart |= (SM_RES_CHAOS);
126                 if (p_ptr->resist_disen) smart |= (SM_RES_DISEN);
127                 if (p_ptr->resist_blind) smart |= (SM_RES_BLIND);
128                 if (p_ptr->resist_nexus) smart |= (SM_RES_NEXUS);
129                 if (p_ptr->resist_sound) smart |= (SM_RES_SOUND);
130                 if (p_ptr->resist_shard) smart |= (SM_RES_SHARD);
131                 if (p_ptr->reflect) smart |= (SM_IMM_REFLECT);
132
133                 /* Know bizarre "resistances" */
134                 if (p_ptr->free_act) smart |= (SM_IMM_FREE);
135                 if (!p_ptr->msp) smart |= (SM_IMM_MANA);
136         }
137
138
139         /* Nothing known */
140         if (!smart) return;
141
142
143         if (smart & SM_IMM_ACID)
144         {
145                 f4 &= ~(RF4_BR_ACID);
146                 f5 &= ~(RF5_BA_ACID);
147                 f5 &= ~(RF5_BO_ACID);
148         }
149         else if ((smart & (SM_OPP_ACID)) && (smart & (SM_RES_ACID)))
150         {
151                 if (int_outof(r_ptr, 80)) f4 &= ~(RF4_BR_ACID);
152                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BA_ACID);
153                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BO_ACID);
154         }
155         else if ((smart & (SM_OPP_ACID)) || (smart & (SM_RES_ACID)))
156         {
157                 if (int_outof(r_ptr, 30)) f4 &= ~(RF4_BR_ACID);
158                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BA_ACID);
159                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BO_ACID);
160         }
161
162
163         if (smart & (SM_IMM_ELEC))
164         {
165                 f4 &= ~(RF4_BR_ELEC);
166                 f5 &= ~(RF5_BA_ELEC);
167                 f5 &= ~(RF5_BO_ELEC);
168         }
169         else if ((smart & (SM_OPP_ELEC)) && (smart & (SM_RES_ELEC)))
170         {
171                 if (int_outof(r_ptr, 80)) f4 &= ~(RF4_BR_ELEC);
172                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BA_ELEC);
173                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BO_ELEC);
174         }
175         else if ((smart & (SM_OPP_ELEC)) || (smart & (SM_RES_ELEC)))
176         {
177                 if (int_outof(r_ptr, 30)) f4 &= ~(RF4_BR_ELEC);
178                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BA_ELEC);
179                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BO_ELEC);
180         }
181
182
183         if (smart & (SM_IMM_FIRE))
184         {
185                 f4 &= ~(RF4_BR_FIRE);
186                 f5 &= ~(RF5_BA_FIRE);
187                 f5 &= ~(RF5_BO_FIRE);
188         }
189         else if ((smart & (SM_OPP_FIRE)) && (smart & (SM_RES_FIRE)))
190         {
191                 if (int_outof(r_ptr, 80)) f4 &= ~(RF4_BR_FIRE);
192                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BA_FIRE);
193                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BO_FIRE);
194         }
195         else if ((smart & (SM_OPP_FIRE)) || (smart & (SM_RES_FIRE)))
196         {
197                 if (int_outof(r_ptr, 30)) f4 &= ~(RF4_BR_FIRE);
198                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BA_FIRE);
199                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BO_FIRE);
200         }
201
202
203         if (smart & (SM_IMM_COLD))
204         {
205                 f4 &= ~(RF4_BR_COLD);
206                 f5 &= ~(RF5_BA_COLD);
207                 f5 &= ~(RF5_BO_COLD);
208                 f5 &= ~(RF5_BO_ICEE);
209         }
210         else if ((smart & (SM_OPP_COLD)) && (smart & (SM_RES_COLD)))
211         {
212                 if (int_outof(r_ptr, 80)) f4 &= ~(RF4_BR_COLD);
213                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BA_COLD);
214                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BO_COLD);
215                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BO_ICEE);
216         }
217         else if ((smart & (SM_OPP_COLD)) || (smart & (SM_RES_COLD)))
218         {
219                 if (int_outof(r_ptr, 30)) f4 &= ~(RF4_BR_COLD);
220                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BA_COLD);
221                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BO_COLD);
222                 if (int_outof(r_ptr, 20)) f5 &= ~(RF5_BO_ICEE);
223         }
224
225
226         if ((smart & (SM_OPP_POIS)) && (smart & (SM_RES_POIS)))
227         {
228                 if (int_outof(r_ptr, 80)) f4 &= ~(RF4_BR_POIS);
229                 if (int_outof(r_ptr, 80)) f5 &= ~(RF5_BA_POIS);
230                 if (int_outof(r_ptr, 60)) f4 &= ~(RF4_BA_NUKE);
231                 if (int_outof(r_ptr, 60)) f4 &= ~(RF4_BR_NUKE);
232         }
233         else if ((smart & (SM_OPP_POIS)) || (smart & (SM_RES_POIS)))
234         {
235                 if (int_outof(r_ptr, 30)) f4 &= ~(RF4_BR_POIS);
236                 if (int_outof(r_ptr, 30)) f5 &= ~(RF5_BA_POIS);
237         }
238
239
240         if (smart & (SM_RES_NETH))
241         {
242                 if (prace_is_(RACE_SPECTRE))
243                 {
244                         f4 &= ~(RF4_BR_NETH);
245                         f5 &= ~(RF5_BA_NETH);
246                         f5 &= ~(RF5_BO_NETH);
247                 }
248                 else
249                 {
250                         if (int_outof(r_ptr, 20)) f4 &= ~(RF4_BR_NETH);
251                         if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_NETH);
252                         if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BO_NETH);
253                 }
254         }
255
256         if (smart & (SM_RES_LITE))
257         {
258                 if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_LITE);
259                 if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_LITE);
260         }
261
262         if (smart & (SM_RES_DARK))
263         {
264                 if (prace_is_(RACE_VAMPIRE))
265                 {
266                         f4 &= ~(RF4_BR_DARK);
267                         f5 &= ~(RF5_BA_DARK);
268                 }
269                 else
270                 {
271                         if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_DARK);
272                         if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_DARK);
273                 }
274         }
275
276         if (smart & (SM_RES_FEAR))
277         {
278                 f5 &= ~(RF5_SCARE);
279         }
280
281         if (smart & (SM_RES_CONF))
282         {
283                 f5 &= ~(RF5_CONF);
284                 if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CONF);
285         }
286
287         if (smart & (SM_RES_CHAOS))
288         {
289                 if (int_outof(r_ptr, 20)) f4 &= ~(RF4_BR_CHAO);
290                 if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BA_CHAO);
291         }
292
293         if (smart & (SM_RES_DISEN))
294         {
295                 if (int_outof(r_ptr, 40)) f4 &= ~(RF4_BR_DISE);
296         }
297
298         if (smart & (SM_RES_BLIND))
299         {
300                 f5 &= ~(RF5_BLIND);
301         }
302
303         if (smart & (SM_RES_NEXUS))
304         {
305                 if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NEXU);
306                 f6 &= ~(RF6_TELE_LEVEL);
307         }
308
309         if (smart & (SM_RES_SOUND))
310         {
311                 if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_SOUN);
312         }
313
314         if (smart & (SM_RES_SHARD))
315         {
316                 if (int_outof(r_ptr, 40)) f4 &= ~(RF4_BR_SHAR);
317         }
318
319         if (smart & (SM_IMM_REFLECT))
320         {
321                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_COLD);
322                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_FIRE);
323                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_ACID);
324                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_ELEC);
325                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_NETH);
326                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_WATE);
327                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_MANA);
328                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_PLAS);
329                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_ICEE);
330                 if (int_outof(r_ptr, 150)) f5 &= ~(RF5_MISSILE);
331                 if (int_outof(r_ptr, 150)) f4 &= ~(RF4_SHOOT);
332         }
333
334         if (smart & (SM_IMM_FREE))
335         {
336                 f5 &= ~(RF5_HOLD);
337                 f5 &= ~(RF5_SLOW);
338         }
339
340         if (smart & (SM_IMM_MANA))
341         {
342                 f5 &= ~(RF5_DRAIN_MANA);
343         }
344
345         /* XXX XXX XXX No spells left? */
346         /* if (!f4 && !f5 && !f6) ... */
347
348         (*f4p) = f4;
349         (*f5p) = f5;
350         (*f6p) = f6;
351 }
352
353 #endif /* DRS_SMART_OPTIONS */
354
355
356 /*
357  * Determine if there is a space near the player in which
358  * a summoned creature can appear
359  */
360 bool summon_possible(int y1, int x1)
361 {
362         int y, x;
363
364         /* Start at the player's location, and check 2 grids in each dir */
365         for (y = y1 - 2; y <= y1 + 2; y++)
366         {
367                 for (x = x1 - 2; x <= x1 + 2; x++)
368                 {
369                         /* Ignore illegal locations */
370                         if (!in_bounds(y, x)) continue;
371
372                         /* Only check a circular area */
373                         if (distance(y1, x1, y, x)>2) continue;
374
375                         /* ...nor on the Pattern */
376                         if ((cave[y][x].feat >= FEAT_PATTERN_START)
377                                 && (cave[y][x].feat <= FEAT_PATTERN_XTRA2)) continue;
378
379                         /* Require empty floor grid in line of sight */
380                         if ((cave_empty_bold(y, x) || (cave[y][x].feat == FEAT_TREES)) && los(y1, x1, y, x) && los(y, x, y1, x1)) return (TRUE);
381                 }
382         }
383
384         return FALSE;
385 }
386
387
388 static bool raise_possible(int y, int x)
389 {
390         int xx, yy;
391         s16b this_o_idx, next_o_idx = 0;
392         cave_type *c_ptr;
393
394         for (xx = x - 5; xx <= x + 5; xx++)
395         {
396                 for (yy = y - 5; yy <= y + 5; yy++)
397                 {
398                         if (distance(y, x, yy, xx) > 5) continue;
399                         if (!los(y, x, yy, xx)) continue;
400
401                         c_ptr = &cave[yy][xx];
402                         /* Scan the pile of objects */
403                         for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
404                         {
405                                 /* Acquire object */
406                                 object_type *o_ptr = &o_list[this_o_idx];
407
408                                 /* Acquire next object */
409                                 next_o_idx = o_ptr->next_o_idx;
410
411                                 /* Known to be worthless? */
412                                 if (o_ptr->tval == TV_CORPSE)
413                                         return TRUE;
414                         }
415                 }
416         }
417         return FALSE;
418 }
419
420
421 /*
422  * Originally, it was possible for a friendly to shoot another friendly.
423  * Change it so a "clean shot" means no equally friendly monster is
424  * between the attacker and target.
425  */
426 /*
427  * Determine if a bolt spell will hit the player.
428  *
429  * This is exactly like "projectable", but it will
430  * return FALSE if a monster is in the way.
431  * no equally friendly monster is
432  * between the attacker and target.
433  */
434 bool clean_shot(int y1, int x1, int y2, int x2, bool friend)
435 {
436         /* Must be the same as projectable() */
437
438         int i, y, x;
439
440         int grid_n = 0;
441         u16b grid_g[512];
442
443         /* Check the projection path */
444         grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, 0);
445
446         /* No grid is ever projectable from itself */
447         if (!grid_n) return (FALSE);
448
449         /* Final grid */
450         y = GRID_Y(grid_g[grid_n-1]);
451         x = GRID_X(grid_g[grid_n-1]);
452
453         /* May not end in an unrequested grid */
454         if ((y != y2) || (x != x2)) return (FALSE);
455
456         for (i = 0; i < grid_n; i++)
457         {
458                 y = GRID_Y(grid_g[i]);
459                 x = GRID_X(grid_g[i]);
460
461                 if ((cave[y][x].m_idx > 0) && !((y == y2) && (x == x2)))
462                 {
463                         monster_type *m_ptr = &m_list[cave[y][x].m_idx];
464                         if (friend == is_pet(m_ptr))
465                         {
466                                 return (FALSE);
467                         }
468                 }
469                 /* Pets may not shoot through the character - TNB */
470                 if ((y == py) && (x == px))
471                 {
472                         if (friend) return (FALSE);
473                 }
474         }
475
476         return (TRUE);
477 }
478
479 /*
480  * Cast a bolt at the player
481  * Stop if we hit a monster
482  * Affect monsters and the player
483  */
484 static void bolt(int m_idx, int typ, int dam_hp, int monspell, bool learnable)
485 {
486         int flg = PROJECT_STOP | PROJECT_KILL | PROJECT_PLAYER | PROJECT_REFLECTABLE;
487
488         /* Target the player with a bolt attack */
489         (void)project(m_idx, 0, py, px, dam_hp, typ, flg, (learnable ? monspell : -1));
490 }
491
492 static void beam(int m_idx, int typ, int dam_hp, int monspell, bool learnable)
493 {
494         int flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_THRU | PROJECT_PLAYER;
495
496         /* Target the player with a bolt attack */
497         (void)project(m_idx, 0, py, px, dam_hp, typ, flg, (learnable ? monspell : -1));
498 }
499
500
501 /*
502  * Cast a breath (or ball) attack at the player
503  * Pass over any monsters that may be in the way
504  * Affect grids, objects, monsters, and the player
505  */
506 static void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool breath, int monspell, bool learnable)
507 {
508         int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_PLAYER;
509
510         monster_type *m_ptr = &m_list[m_idx];
511         monster_race *r_ptr = &r_info[m_ptr->r_idx];
512
513         /* Determine the radius of the blast */
514         if ((rad < 1) && breath) rad = (r_ptr->flags2 & (RF2_POWERFUL)) ? 3 : 2;
515
516         /* Handle breath attacks */
517         if (breath) rad = 0 - rad;
518
519         if (typ == GF_ROCKET) flg |= PROJECT_STOP;
520         if (typ == GF_MIND_BLAST || typ == GF_BRAIN_SMASH ||
521             typ == GF_CAUSE_1 || typ == GF_CAUSE_2 || typ == GF_CAUSE_3 ||
522             typ == GF_CAUSE_4 || typ == GF_HAND_DOOM) flg |= PROJECT_HIDE;
523
524         /* Target the player with a ball attack */
525         (void)project(m_idx, rad, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
526 }
527
528
529 u32b get_curse(int power, object_type *o_ptr)
530 {
531         u32b new_curse;
532
533         while(1)
534         {
535                 new_curse = (1 << (randint0(MAX_CURSE)+4));
536                 if (power == 2)
537                 {
538                         if (!(new_curse & TRC_HEAVY_MASK)) continue;
539                 }
540                 else if (power == 1)
541                 {
542                         if (new_curse & TRC_SPECIAL_MASK) continue;
543                 }
544                 else if (power == 0)
545                 {
546                         if (new_curse & TRC_HEAVY_MASK) continue;
547                 }
548                 if (((o_ptr->tval < TV_BOW) || (o_ptr->tval > TV_SWORD)) && (new_curse == TRC_LOW_MELEE)) continue;
549                 if (((o_ptr->tval < TV_BOOTS) || (o_ptr->tval > TV_DRAG_ARMOR)) && (new_curse == TRC_LOW_AC)) continue;
550                 break;
551         }
552         return new_curse;
553 }
554
555 void curse_equipment(int chance, int heavy_chance)
556 {
557         bool        changed = FALSE;
558         int         curse_power = 0;
559         u32b        new_curse;
560         u32b oflgs[TR_FLAG_SIZE];
561         object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)];
562         char o_name[MAX_NLEN];
563
564         if (randint1(100) > chance) return;
565
566         if (!o_ptr->k_idx) return;
567
568         object_flags(o_ptr, oflgs);
569
570         object_desc(o_name, o_ptr, FALSE, 0);
571
572         /* Extra, biased saving throw for blessed items */
573         if (have_flag(oflgs, TR_BLESSED) && (randint1(888) > chance))
574         {
575 #ifdef JP
576 msg_format("%s¤Ï¼ö¤¤¤òÄ·¤ÍÊÖ¤·¤¿¡ª", o_name,
577 #else
578                 msg_format("Your %s resist%s cursing!", o_name,
579 #endif
580
581                         ((o_ptr->number > 1) ? "" : "s"));
582                 /* Hmmm -- can we wear multiple items? If not, this is unnecessary */
583                 return;
584         }
585
586         if ((randint1(100) <= heavy_chance) &&
587                 (o_ptr->name1 || o_ptr->name2 || o_ptr->art_name))
588         {
589                 if (!(o_ptr->curse_flags & TRC_HEAVY_CURSE))
590                         changed = TRUE;
591                 o_ptr->curse_flags |= TRC_HEAVY_CURSE;
592                 o_ptr->curse_flags |= TRC_CURSED;
593                 curse_power++;
594         }
595         else
596         {
597                 if (!cursed_p(o_ptr))
598                         changed = TRUE;
599                 o_ptr->curse_flags |= TRC_CURSED;
600         }
601         if (heavy_chance >= 50) curse_power++;
602
603         new_curse = get_curse(curse_power, o_ptr);
604         if (!(o_ptr->curse_flags & new_curse))
605         {
606                 changed = TRUE;
607                 o_ptr->curse_flags |= new_curse;
608         }
609
610         if (changed)
611         {
612 #ifdef JP
613 msg_format("°­°Õ¤ËËþ¤Á¤¿¹õ¤¤¥ª¡¼¥é¤¬%s¤ò¤È¤ê¤Þ¤¤¤¿...", o_name);
614 #else
615                 msg_format("There is a malignant black aura surrounding %s...", o_name);
616 #endif
617
618                 o_ptr->feeling = FEEL_NONE;
619         }
620         p_ptr->update |= (PU_BONUS);
621 }
622
623
624 /*
625  * Return TRUE if a spell is good for hurting the player (directly).
626  */
627 static bool spell_attack(byte spell)
628 {
629         /* All RF4 spells hurt (except for shriek and dispel) */
630         if (spell < 128 && spell > 98) return (TRUE);
631
632         /* Various "ball" spells */
633         if (spell >= 128 && spell <= 128 + 8) return (TRUE);
634
635         /* "Cause wounds" and "bolt" spells */
636         if (spell >= 128 + 12 && spell < 128 + 27) return (TRUE);
637
638         /* Hand of Doom */
639         if (spell == 160 + 1) return (TRUE);
640
641         /* Psycho-Spear */
642         if (spell == 160 + 11) return (TRUE);
643
644         /* Doesn't hurt */
645         return (FALSE);
646 }
647
648
649 /*
650  * Return TRUE if a spell is good for escaping.
651  */
652 static bool spell_escape(byte spell)
653 {
654         /* Blink or Teleport */
655         if (spell == 160 + 4 || spell == 160 + 5) return (TRUE);
656
657         /* Teleport the player away */
658         if (spell == 160 + 9 || spell == 160 + 10) return (TRUE);
659
660         /* Isn't good for escaping */
661         return (FALSE);
662 }
663
664 /*
665  * Return TRUE if a spell is good for annoying the player.
666  */
667 static bool spell_annoy(byte spell)
668 {
669         /* Shriek */
670         if (spell == 96 + 0) return (TRUE);
671
672         /* Brain smash, et al (added curses) */
673         if (spell >= 128 + 9 && spell <= 128 + 14) return (TRUE);
674
675         /* Scare, confuse, blind, slow, paralyze */
676         if (spell >= 128 + 27 && spell <= 128 + 31) return (TRUE);
677
678         /* Teleport to */
679         if (spell == 160 + 8) return (TRUE);
680
681         /* Teleport level */
682         if (spell == 160 + 10) return (TRUE);
683
684         /* Darkness, make traps, cause amnesia */
685         if (spell >= 160 + 12 && spell <= 160 + 14) return (TRUE);
686
687         /* Doesn't annoy */
688         return (FALSE);
689 }
690
691 /*
692  * Return TRUE if a spell summons help.
693  */
694 static bool spell_summon(byte spell)
695 {
696         /* All summon spells */
697         if (spell >= 160 + 16) return (TRUE);
698
699         /* Doesn't summon */
700         return (FALSE);
701 }
702
703
704 /*
705  * Return TRUE if a spell raise-dead.
706  */
707 static bool spell_raise(byte spell)
708 {
709         /* All raise-dead spells */
710         if (spell == 160 + 15) return (TRUE);
711
712         /* Doesn't summon */
713         return (FALSE);
714 }
715
716
717 /*
718  * Return TRUE if a spell is good in a tactical situation.
719  */
720 static bool spell_tactic(byte spell)
721 {
722         /* Blink */
723         if (spell == 160 + 4) return (TRUE);
724
725         /* Not good */
726         return (FALSE);
727 }
728
729 /*
730  * Return TRUE if a spell makes invulnerable.
731  */
732 static bool spell_invulner(byte spell)
733 {
734         /* Invulnerability */
735         if (spell == 160 + 3) return (TRUE);
736
737         /* No invulnerability */
738         return (FALSE);
739 }
740
741 /*
742  * Return TRUE if a spell hastes.
743  */
744 static bool spell_haste(byte spell)
745 {
746         /* Haste self */
747         if (spell == 160 + 0) return (TRUE);
748
749         /* Not a haste spell */
750         return (FALSE);
751 }
752
753
754 /*
755  * Return TRUE if a spell world.
756  */
757 static bool spell_world(byte spell)
758 {
759         /* world */
760         if (spell == 160 + 6) return (TRUE);
761
762         /* Not a haste spell */
763         return (FALSE);
764 }
765
766
767 /*
768  * Return TRUE if a spell special.
769  */
770 static bool spell_special(byte spell)
771 {
772         if (p_ptr->inside_battle) return FALSE;
773
774         /* world */
775         if (spell == 160 + 7) return (TRUE);
776
777         /* Not a haste spell */
778         return (FALSE);
779 }
780
781
782 /*
783  * Return TRUE if a spell psycho-spear.
784  */
785 static bool spell_psy_spe(byte spell)
786 {
787         /* world */
788         if (spell == 160 + 11) return (TRUE);
789
790         /* Not a haste spell */
791         return (FALSE);
792 }
793
794
795 /*
796  * Return TRUE if a spell is good for healing.
797  */
798 static bool spell_heal(byte spell)
799 {
800         /* Heal */
801         if (spell == 160 + 2) return (TRUE);
802
803         /* No healing */
804         return (FALSE);
805 }
806
807
808 /*
809  * Return TRUE if a spell is good for dispel.
810  */
811 static bool spell_dispel(byte spell)
812 {
813         /* Dispel */
814         if (spell == 96 + 2) return (TRUE);
815
816         /* No dispel */
817         return (FALSE);
818 }
819
820
821 /*
822  * Check should monster cast dispel spell.
823  */
824 static bool dispel_check(int m_idx)
825 {
826         monster_type *m_ptr = &m_list[m_idx];
827         monster_race *r_ptr = &r_info[m_ptr->r_idx];
828
829         /* Invulnabilty */
830         if (p_ptr->invuln) return (TRUE);
831
832         /* Wraith form */
833         if (p_ptr->wraith_form) return (TRUE);
834
835         /* Shield */
836         if (p_ptr->shield) return (TRUE);
837
838         /* Magic defence */
839         if (p_ptr->magicdef) return (TRUE);
840
841         /* Multi Shadow */
842         if (p_ptr->multishadow) return (TRUE);
843
844         /* Robe of dust */
845         if (p_ptr->dustrobe) return (TRUE);
846
847         /* Berserk Strength */
848         if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) return (TRUE);
849
850         /* Invulnability song */
851         if (music_singing(MUSIC_INVULN)) return (TRUE);
852
853         /* Demon Lord */
854         if (p_ptr->mimic_form == MIMIC_DEMON_LORD) return (TRUE);
855
856         /* Elemental resistances */
857         if (r_ptr->flags4 & RF4_BR_ACID)
858         {
859                 if (!p_ptr->immune_acid && p_ptr->oppose_acid) return (TRUE);
860
861                 if (p_ptr->special_defense & DEFENSE_ACID) return (TRUE);
862         }
863
864         if (r_ptr->flags4 & RF4_BR_FIRE)
865         {
866                 if (!(prace_is_(RACE_DEMON) && p_ptr->lev > 44))
867                 {
868                         if (!p_ptr->immune_fire && p_ptr->oppose_fire) return (TRUE);
869
870                         if (p_ptr->special_defense & DEFENSE_FIRE) return(TRUE);
871                 }
872         }
873
874         if (r_ptr->flags4 & RF4_BR_ELEC)
875         {
876                 if (!p_ptr->immune_elec && p_ptr->oppose_elec) return (TRUE);
877
878                 if (p_ptr->special_defense & DEFENSE_ELEC) return (TRUE);
879         }
880
881         if (r_ptr->flags4 & RF4_BR_COLD)
882         {
883                 if (!p_ptr->immune_cold && p_ptr->oppose_cold) return (TRUE);
884
885                 if (p_ptr->special_defense & DEFENSE_COLD) return (TRUE);
886         }
887
888         if (r_ptr->flags4 & (RF4_BR_POIS | RF4_BR_NUKE))
889         {
890                 if (!((p_ptr->pclass == CLASS_NINJA) && p_ptr->lev > 44))
891                 {
892                         if (p_ptr->oppose_pois) return (TRUE);
893
894                         if (p_ptr->special_defense & DEFENSE_POIS) return (TRUE);
895                 }
896         }
897
898         /* Elemental resist music */
899         if (music_singing(MUSIC_RESIST))
900         {
901                 if (r_ptr->flags4 & (RF4_BR_ACID | RF4_BR_FIRE | RF4_BR_ELEC | RF4_BR_COLD | RF4_BR_POIS)) return (TRUE);
902         }
903
904         /* Ultimate resistance */
905         if (p_ptr->ult_res) return (TRUE);
906
907         /* Potion of Neo Tsuyosi special */
908         if (p_ptr->tsuyoshi) return (TRUE);
909
910         /* Elemental Brands */
911         if ((p_ptr->special_attack & ATTACK_ACID) && !(r_ptr->flags3 & RF3_IM_ACID)) return (TRUE);
912         if ((p_ptr->special_attack & ATTACK_FIRE) && !(r_ptr->flags3 & RF3_IM_FIRE)) return (TRUE);
913         if ((p_ptr->special_attack & ATTACK_ELEC) && !(r_ptr->flags3 & RF3_IM_ELEC)) return (TRUE);
914         if ((p_ptr->special_attack & ATTACK_COLD) && !(r_ptr->flags3 & RF3_IM_COLD)) return (TRUE);
915         if ((p_ptr->special_attack & ATTACK_POIS) && !(r_ptr->flags3 & RF3_IM_POIS)) return (TRUE);
916
917         /* Speed */
918         if (p_ptr->pspeed < 145)
919         {
920                 if (p_ptr->fast) return (TRUE);
921
922                 if (music_singing(MUSIC_SPEED)) return (TRUE);
923
924                 if (music_singing(MUSIC_SHERO)) return (TRUE);
925         }
926
927         /* Light speed */
928         if (p_ptr->lightspeed && (m_ptr->mspeed < 136)) return (TRUE);
929
930         if (p_ptr->riding && (m_list[p_ptr->riding].mspeed < 135))
931         {
932                 if (m_list[p_ptr->riding].fast) return (TRUE);
933         }
934
935         /* No need to cast dispel spell */
936         return (FALSE);
937 }
938
939
940 /*
941  * Have a monster choose a spell from a list of "useful" spells.
942  *
943  * Note that this list does NOT include spells that will just hit
944  * other monsters, and the list is restricted when the monster is
945  * "desperate".  Should that be the job of this function instead?
946  *
947  * Stupid monsters will just pick a spell randomly.  Smart monsters
948  * will choose more "intelligently".
949  *
950  * Use the helper functions above to put spells into categories.
951  *
952  * This function may well be an efficiency bottleneck.
953  */
954 static int choose_attack_spell(int m_idx, byte spells[], byte num)
955 {
956         monster_type *m_ptr = &m_list[m_idx];
957         monster_race *r_ptr = &r_info[m_ptr->r_idx];
958
959         byte escape[96], escape_num = 0;
960         byte attack[96], attack_num = 0;
961         byte summon[96], summon_num = 0;
962         byte tactic[96], tactic_num = 0;
963         byte annoy[96], annoy_num = 0;
964         byte invul[96], invul_num = 0;
965         byte haste[96], haste_num = 0;
966         byte world[96], world_num = 0;
967         byte special[96], special_num = 0;
968         byte psy_spe[96], psy_spe_num = 0;
969         byte raise[96], raise_num = 0;
970         byte heal[96], heal_num = 0;
971         byte dispel[96], dispel_num = 0;
972
973         int i;
974
975         /* Stupid monsters choose randomly */
976         if (r_ptr->flags2 & (RF2_STUPID))
977         {
978                 /* Pick at random */
979                 return (spells[randint0(num)]);
980         }
981
982         /* Categorize spells */
983         for (i = 0; i < num; i++)
984         {
985                 /* Escape spell? */
986                 if (spell_escape(spells[i])) escape[escape_num++] = spells[i];
987
988                 /* Attack spell? */
989                 if (spell_attack(spells[i])) attack[attack_num++] = spells[i];
990
991                 /* Summon spell? */
992                 if (spell_summon(spells[i])) summon[summon_num++] = spells[i];
993
994                 /* Tactical spell? */
995                 if (spell_tactic(spells[i])) tactic[tactic_num++] = spells[i];
996
997                 /* Annoyance spell? */
998                 if (spell_annoy(spells[i])) annoy[annoy_num++] = spells[i];
999
1000                 /* Invulnerability spell? */
1001                 if (spell_invulner(spells[i])) invul[invul_num++] = spells[i];
1002
1003                 /* Haste spell? */
1004                 if (spell_haste(spells[i])) haste[haste_num++] = spells[i];
1005
1006                 /* World spell? */
1007                 if (spell_world(spells[i])) world[world_num++] = spells[i];
1008
1009                 /* Special spell? */
1010                 if (spell_special(spells[i])) special[special_num++] = spells[i];
1011
1012                 /* Psycho-spear spell? */
1013                 if (spell_psy_spe(spells[i])) psy_spe[psy_spe_num++] = spells[i];
1014
1015                 /* Raise-dead spell? */
1016                 if (spell_raise(spells[i])) raise[raise_num++] = spells[i];
1017
1018                 /* Heal spell? */
1019                 if (spell_heal(spells[i])) heal[heal_num++] = spells[i];
1020
1021                 /* Dispel spell? */
1022                 if (spell_dispel(spells[i])) dispel[dispel_num++] = spells[i];
1023         }
1024
1025         /*** Try to pick an appropriate spell type ***/
1026
1027         /* world */
1028         if (world_num && (randint0(100) < 15) && !world_monster)
1029         {
1030                 /* Choose haste spell */
1031                 return (world[randint0(world_num)]);
1032         }
1033
1034         /* special */
1035         if (special_num)
1036         {
1037                 bool success = FALSE;
1038                 switch(m_ptr->r_idx)
1039                 {
1040                         case MON_BANOR:
1041                         case MON_LUPART:
1042                                 if ((m_ptr->hp < m_ptr->maxhp / 2) && r_info[MON_BANOR].max_num && r_info[MON_LUPART].max_num) success = TRUE;
1043                                 break;
1044                         default: break;
1045                 }
1046                 if (success) return (special[randint0(special_num)]);
1047         }
1048
1049         /* Still hurt badly, couldn't flee, attempt to heal */
1050         if (m_ptr->hp < m_ptr->maxhp / 3 && one_in_(2))
1051         {
1052                 /* Choose heal spell if possible */
1053                 if (heal_num) return (heal[randint0(heal_num)]);
1054         }
1055
1056         /* Hurt badly or afraid, attempt to flee */
1057         if (((m_ptr->hp < m_ptr->maxhp / 3) || m_ptr->monfear) && one_in_(2))
1058         {
1059                 /* Choose escape spell if possible */
1060                 if (escape_num) return (escape[randint0(escape_num)]);
1061         }
1062
1063         /* special */
1064         if (special_num)
1065         {
1066                 bool success = FALSE;
1067                 switch(m_ptr->r_idx)
1068                 {
1069                         case MON_OHMU:
1070                                 if (randint0(100) < 50) success = TRUE;
1071                                 break;
1072                         case MON_BANORLUPART:
1073                                 if (randint0(100) < 70) success = TRUE;
1074                                 break;
1075                         case MON_BANOR:
1076                         case MON_LUPART:
1077                                 break;
1078                         default:
1079                                 if (randint0(100) < 50) success = TRUE;
1080                                 break;
1081                 }
1082                 if (success) return (special[randint0(special_num)]);
1083         }
1084
1085         /* Player is close and we have attack spells, blink away */
1086         if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster)
1087         {
1088                 /* Choose tactical spell */
1089                 if (tactic_num) return (tactic[randint0(tactic_num)]);
1090         }
1091
1092         /* Summon if possible (sometimes) */
1093         if (summon_num && (randint0(100) < 40))
1094         {
1095                 /* Choose summon spell */
1096                 return (summon[randint0(summon_num)]);
1097         }
1098
1099         /* dispel */
1100         if (dispel_num && one_in_(2))
1101         {
1102                 /* Choose dispel spell if possible */
1103                 if (dispel_check(m_idx))
1104                 {
1105                         return (dispel[randint0(dispel_num)]);
1106                 }
1107         }
1108
1109         /* Raise-dead if possible (sometimes) */
1110         if (raise_num && (randint0(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
1111         {
1112                 /* Choose raise-dead spell */
1113                 return (raise[randint0(raise_num)]);
1114         }
1115
1116         /* Attack spell (most of the time) */
1117         if (p_ptr->invuln)
1118         {
1119                 if (psy_spe_num && (randint0(100) < 50))
1120                 {
1121                         /* Choose attack spell */
1122                         return (psy_spe[randint0(psy_spe_num)]);
1123                 }
1124                 else if (attack_num && (randint0(100) < 40))
1125                 {
1126                         /* Choose attack spell */
1127                         return (attack[randint0(attack_num)]);
1128                 }
1129         }
1130         else if (attack_num && (randint0(100) < 85))
1131         {
1132                 /* Choose attack spell */
1133                 return (attack[randint0(attack_num)]);
1134         }
1135
1136         /* Try another tactical spell (sometimes) */
1137         if (tactic_num && (randint0(100) < 50) && !world_monster)
1138         {
1139                 /* Choose tactic spell */
1140                 return (tactic[randint0(tactic_num)]);
1141         }
1142
1143         /* Cast globe of invulnerability if not already in effect */
1144         if (invul_num && !(m_ptr->invulner) && (randint0(100) < 50))
1145         {
1146                 /* Choose Globe of Invulnerability */
1147                 return (invul[randint0(invul_num)]);
1148         }
1149
1150         /* We're hurt (not badly), try to heal */
1151         if ((m_ptr->hp < m_ptr->maxhp * 3 / 4) && (randint0(100) < 25))
1152         {
1153                 /* Choose heal spell if possible */
1154                 if (heal_num) return (heal[randint0(heal_num)]);
1155         }
1156
1157         /* Haste self if we aren't already somewhat hasted (rarely) */
1158         if (haste_num && (randint0(100) < 20) && !(m_ptr->fast))
1159         {
1160                 /* Choose haste spell */
1161                 return (haste[randint0(haste_num)]);
1162         }
1163
1164         /* Annoy player (most of the time) */
1165         if (annoy_num && (randint0(100) < 80))
1166         {
1167                 /* Choose annoyance spell */
1168                 return (annoy[randint0(annoy_num)]);
1169         }
1170
1171         /* Choose no spell */
1172         return (0);
1173 }
1174
1175
1176 /*
1177  * Creatures can cast spells, shoot missiles, and breathe.
1178  *
1179  * Returns "TRUE" if a spell (or whatever) was (successfully) cast.
1180  *
1181  * XXX XXX XXX This function could use some work, but remember to
1182  * keep it as optimized as possible, while retaining generic code.
1183  *
1184  * Verify the various "blind-ness" checks in the code.
1185  *
1186  * XXX XXX XXX Note that several effects should really not be "seen"
1187  * if the player is blind.  See also "effects.c" for other "mistakes".
1188  *
1189  * Perhaps monsters should breathe at locations *near* the player,
1190  * since this would allow them to inflict "partial" damage.
1191  *
1192  * Perhaps smart monsters should decline to use "bolt" spells if
1193  * there is a monster in the way, unless they wish to kill it.
1194  *
1195  * Note that, to allow the use of the "track_target" option at some
1196  * later time, certain non-optimal things are done in the code below,
1197  * including explicit checks against the "direct" variable, which is
1198  * currently always true by the time it is checked, but which should
1199  * really be set according to an explicit "projectable()" test, and
1200  * the use of generic "x,y" locations instead of the player location,
1201  * with those values being initialized with the player location.
1202  *
1203  * It will not be possible to "correctly" handle the case in which a
1204  * monster attempts to attack a location which is thought to contain
1205  * the player, but which in fact is nowhere near the player, since this
1206  * might induce all sorts of messages about the attack itself, and about
1207  * the effects of the attack, which the player might or might not be in
1208  * a position to observe.  Thus, for simplicity, it is probably best to
1209  * only allow "faulty" attacks by a monster if one of the important grids
1210  * (probably the initial or final grid) is in fact in view of the player.
1211  * It may be necessary to actually prevent spell attacks except when the
1212  * monster actually has line of sight to the player.  Note that a monster
1213  * could be left in a bizarre situation after the player ducked behind a
1214  * pillar and then teleported away, for example.
1215  *
1216  * Note that certain spell attacks do not use the "project()" function
1217  * but "simulate" it via the "direct" variable, which is always at least
1218  * as restrictive as the "project()" function.  This is necessary to
1219  * prevent "blindness" attacks and such from bending around walls, etc,
1220  * and to allow the use of the "track_target" option in the future.
1221  *
1222  * Note that this function attempts to optimize the use of spells for the
1223  * cases in which the monster has no spells, or has spells but cannot use
1224  * them, or has spells but they will have no "useful" effect.  Note that
1225  * this function has been an efficiency bottleneck in the past.
1226  *
1227  * Note the special "MFLAG_NICE" flag, which prevents a monster from using
1228  * any spell attacks until the player has had a single chance to move.
1229  */
1230 bool make_attack_spell(int m_idx)
1231 {
1232         int             k, thrown_spell = 0, rlev, failrate;
1233         byte            spell[96], num = 0;
1234         u32b            f4, f5, f6;
1235         monster_type    *m_ptr = &m_list[m_idx];
1236         monster_race    *r_ptr = &r_info[m_ptr->r_idx];
1237         char            m_name[80];
1238         char            m_poss[80];
1239         char            ddesc[80];
1240         bool            no_inate = FALSE;
1241         bool            do_disi = FALSE;
1242         int             dam = 0;
1243         u32b mode = 0L;
1244         int s_num_6 = (easy_band ? 2 : 6);
1245         int s_num_4 = (easy_band ? 1 : 4);
1246
1247         /* Target location */
1248         int x = px;
1249         int y = py;
1250
1251         /* Summon count */
1252         int count = 0;
1253
1254         /* Extract the blind-ness */
1255         bool blind = (p_ptr->blind ? TRUE : FALSE);
1256
1257         /* Extract the "see-able-ness" */
1258         bool seen = (!blind && m_ptr->ml);
1259
1260         bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
1261         bool learnable = (seen && maneable && !world_monster);
1262
1263         /* Assume "projectable" */
1264         bool direct = TRUE;
1265
1266         /* Cannot cast spells when confused */
1267         if (m_ptr->confused)
1268         {
1269                 reset_target(m_ptr);
1270                 return (FALSE);
1271         }
1272
1273         /* Cannot cast spells when nice */
1274         if (m_ptr->mflag & MFLAG_NICE) return (FALSE);
1275         if (!is_hostile(m_ptr)) return (FALSE);
1276
1277
1278         /* Sometimes forbid inate attacks (breaths) */
1279         if (randint0(100) >= (r_ptr->freq_spell * 2)) no_inate = TRUE;
1280
1281         /* XXX XXX XXX Handle "track_target" option (?) */
1282
1283
1284         /* Extract the racial spell flags */
1285         f4 = r_ptr->flags4;
1286         f5 = r_ptr->flags5;
1287         f6 = r_ptr->flags6;
1288
1289         /*** require projectable player ***/
1290
1291         /* Check range */
1292         if ((m_ptr->cdis > MAX_RANGE) && !m_ptr->target_y) return (FALSE);
1293
1294         /* Check path */
1295         if (projectable(m_ptr->fy, m_ptr->fx, y, x))
1296         {
1297                 /* Breath disintegration to the glyph if possible */
1298                 if ((!cave_floor_bold(y,x)) && (r_ptr->flags4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
1299         }
1300
1301         /* Check path to next grid */
1302         else
1303         {
1304                 bool success = FALSE;
1305
1306                 if ((r_ptr->flags4 & RF4_BR_DISI) &&
1307                     (m_ptr->cdis < MAX_RANGE/2) &&
1308                     in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
1309                     (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
1310                 {
1311                         do_disi = TRUE;
1312                         success = TRUE;
1313                 }
1314                 else
1315                 {
1316                         int i;
1317                         int tonari;
1318                         int tonari_y[4][8] = {{-1,-1,-1,0,0,1,1,1},
1319                                               {-1,-1,-1,0,0,1,1,1},
1320                                               {1,1,1,0,0,-1,-1,-1},
1321                                               {1,1,1,0,0,-1,-1,-1}};
1322                         int tonari_x[4][8] = {{-1,0,1,-1,1,-1,0,1},
1323                                               {1,0,-1,1,-1,1,0,-1},
1324                                               {-1,0,1,-1,1,-1,0,1},
1325                                               {1,0,-1,1,-1,1,0,-1}};
1326
1327                         if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
1328                         else if (m_ptr->fy < py) tonari = 1;
1329                         else if (m_ptr->fx < px) tonari = 2;
1330                         else tonari = 3;
1331
1332                         for (i = 0; i < 8; i++)
1333                         {
1334                                 int next_x = x + tonari_x[tonari][i];
1335                                 int next_y = y + tonari_y[tonari][i];
1336                                 cave_type *c_ptr;
1337
1338                                 /* Access the next grid */
1339                                 c_ptr = &cave[next_y][next_x];
1340
1341                                 /* Skip door, rubble, wall */
1342                                 if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
1343
1344                                 /* Skip tree */
1345                                 if (c_ptr->feat == FEAT_TREES) continue;
1346
1347                                 /* Skip mountain */
1348                                 if (c_ptr->feat == FEAT_MOUNTAIN) continue;
1349
1350                                 if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
1351                                 {
1352                                         y = next_y;
1353                                         x = next_x;
1354                                         success = TRUE;
1355                                         break;
1356                                 }
1357                         }
1358                 }
1359
1360                 if (!success)
1361                 {
1362                         if (m_ptr->target_y && m_ptr->target_x)
1363                         {
1364                                 y = m_ptr->target_y;
1365                                 x = m_ptr->target_x;
1366                                 f4 &= (RF4_INDIRECT_MASK);
1367                                 f5 &= (RF5_INDIRECT_MASK);
1368                                 f6 &= (RF6_INDIRECT_MASK);
1369                                 success = TRUE;
1370                         }
1371                 }
1372
1373                 /* No spells */
1374                 if (!success) return FALSE;
1375         }
1376
1377         reset_target(m_ptr);
1378
1379         /* Extract the monster level */
1380         rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
1381
1382         /* Forbid inate attacks sometimes */
1383         if (no_inate) f4 &= 0x500000FF;
1384
1385         if (!p_ptr->csp)
1386         {
1387                 f5 &= ~(RF5_DRAIN_MANA);
1388         }
1389         if ((p_ptr->pclass == CLASS_NINJA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)))
1390         {
1391                 f6 &= ~(RF6_DARKNESS);
1392         }
1393
1394         if (dun_level && (!p_ptr->inside_quest || (p_ptr->inside_quest < MIN_RANDOM_QUEST)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
1395         {
1396                 f4 &= (RF4_NOMAGIC_MASK);
1397                 f5 &= (RF5_NOMAGIC_MASK);
1398                 f6 &= (RF6_NOMAGIC_MASK);
1399         }
1400
1401         /* Hack -- allow "desperate" spells */
1402         if ((r_ptr->flags2 & (RF2_SMART)) &&
1403                 (m_ptr->hp < m_ptr->maxhp / 10) &&
1404                 (randint0(100) < 50))
1405         {
1406                 /* Require intelligent spells */
1407                 f4 &= (RF4_INT_MASK);
1408                 f5 &= (RF5_INT_MASK);
1409                 f6 &= (RF6_INT_MASK);
1410
1411                 /* No spells left */
1412                 if (!f4 && !f5 && !f6) return (FALSE);
1413         }
1414
1415         /* Remove the "ineffective" spells */
1416         remove_bad_spells(m_idx, &f4, &f5, &f6);
1417
1418         if (p_ptr->inside_arena)
1419         {
1420                 f4 &= ~(RF4_SUMMON_MASK);
1421                 f5 &= ~(RF5_SUMMON_MASK);
1422                 f6 &= ~(RF6_SUMMON_MASK);
1423         }
1424
1425         /* No spells left */
1426         if (!f4 && !f5 && !f6) return (FALSE);
1427
1428         /* Check for a clean bolt shot */
1429         if (((f4 & RF4_BOLT_MASK) ||
1430              (f5 & RF5_BOLT_MASK) ||
1431              (f6 & RF6_BOLT_MASK)) &&
1432             !(r_ptr->flags2 & RF2_STUPID) &&
1433             !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
1434         {
1435                 /* Remove spells that will only hurt friends */
1436                 f4 &= ~(RF4_BOLT_MASK);
1437                 f5 &= ~(RF5_BOLT_MASK);
1438                 f6 &= ~(RF6_BOLT_MASK);
1439         }
1440
1441         /* Check for a possible summon */
1442         if (((f4 & RF4_SUMMON_MASK) ||
1443              (f5 & RF5_SUMMON_MASK) ||
1444              (f6 & RF6_SUMMON_MASK)) &&
1445             !(r_ptr->flags2 & RF2_STUPID) &&
1446             !(summon_possible(y, x)))
1447         {
1448                 /* Remove summoning spells */
1449                 f4 &= ~(RF4_SUMMON_MASK);
1450                 f5 &= ~(RF5_SUMMON_MASK);
1451                 f6 &= ~(RF6_SUMMON_MASK);
1452         }
1453
1454         /* No spells left */
1455         if (!f4 && !f5 && !f6) return (FALSE);
1456
1457         /* Extract the "inate" spells */
1458         for (k = 0; k < 32; k++)
1459         {
1460                 if (f4 & (1L << k)) spell[num++] = k + 32 * 3;
1461         }
1462
1463         /* Extract the "normal" spells */
1464         for (k = 0; k < 32; k++)
1465         {
1466                 if (f5 & (1L << k)) spell[num++] = k + 32 * 4;
1467         }
1468
1469         /* Extract the "bizarre" spells */
1470         for (k = 0; k < 32; k++)
1471         {
1472                 if (f6 & (1L << k)) spell[num++] = k + 32 * 5;
1473         }
1474
1475         /* No spells left */
1476         if (!num) return (FALSE);
1477
1478         /* Stop if player is dead or gone */
1479         if (!p_ptr->playing || p_ptr->is_dead) return (FALSE);
1480
1481         /* Stop if player is leaving */
1482         if (p_ptr->leaving) return (FALSE);
1483
1484         /* Get the monster name (or "it") */
1485         monster_desc(m_name, m_ptr, 0x00);
1486
1487         /* Get the monster possessive ("his"/"her"/"its") */
1488         monster_desc(m_poss, m_ptr, 0x22);
1489
1490         /* Hack -- Get the "died from" name */
1491         monster_desc(ddesc, m_ptr, 0x288);
1492
1493         if (do_disi)
1494                 thrown_spell = 96+31;
1495         else
1496         {
1497                 int attempt = 10;
1498                 while(attempt--)
1499                 {
1500                         thrown_spell = choose_attack_spell(m_idx, spell, num);
1501                         if (thrown_spell) break;
1502                 }
1503         }
1504
1505         /* Abort if no spell was chosen */
1506         if (!thrown_spell) return (FALSE);
1507
1508         /* Calculate spell failure rate */
1509         failrate = 25 - (rlev + 3) / 4;
1510
1511         /* Hack -- Stupid monsters will never fail (for jellies and such) */
1512         if (r_ptr->flags2 & RF2_STUPID) failrate = 0;
1513
1514         /* Check for spell failure (inate attacks never fail) */
1515         if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
1516         {
1517                 disturb(1, 0);
1518                 /* Message */
1519                 if (thrown_spell != (160+7)) /* Not RF6_SPECIAL */
1520                 {
1521 #ifdef JP
1522                         msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
1523 #else
1524                         msg_format("%^s tries to cast a spell, but fails.", m_name);
1525 #endif
1526                 }
1527
1528                 return (TRUE);
1529         }
1530
1531
1532         /* Cast the spell. */
1533         switch (thrown_spell)
1534         {
1535                 /* RF4_SHRIEK */
1536                 case 96+0:
1537                 {
1538                         if (!direct) break;
1539                         disturb(1, 0);
1540 #ifdef JP
1541 msg_format("%^s¤¬¤«¤ó¹â¤¤¶âÀÚ¤êÀ¼¤ò¤¢¤²¤¿¡£", m_name);
1542 #else
1543                         msg_format("%^s makes a high pitched shriek.", m_name);
1544 #endif
1545
1546                         aggravate_monsters(m_idx);
1547                         break;
1548                 }
1549
1550                 /* RF4_XXX1 */
1551                 case 96+1:
1552                 {
1553                         /* XXX XXX XXX */
1554                         break;
1555                 }
1556
1557                 /* RF4_DISPEL */
1558                 case 96+2:
1559                 {
1560                         if (x!=px || y!=py) return (FALSE);
1561                         disturb(1, 0);
1562 #ifdef JP
1563                         if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
1564                         else msg_format("%^s¤¬ËâÎϾõî¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
1565 #else
1566                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
1567                         else msg_format("%^s invokes a dispel magic.", m_name);
1568 #endif
1569                         set_fast(0, TRUE);
1570                         set_lightspeed(0, TRUE);
1571                         set_slow(0, TRUE);
1572                         set_shield(0, TRUE);
1573                         set_blessed(0, TRUE);
1574                         set_tsuyoshi(0, TRUE);
1575                         set_hero(0, TRUE);
1576                         set_shero(0, TRUE);
1577                         set_protevil(0, TRUE);
1578                         set_invuln(0, TRUE);
1579                         set_wraith_form(0, TRUE);
1580                         set_kabenuke(0, TRUE);
1581                         set_tim_res_nether(0, TRUE);
1582                         set_tim_res_time(0, TRUE);
1583                         /* by henkma */
1584                         set_tim_reflect(0,TRUE);
1585                         set_multishadow(0,TRUE);
1586                         set_dustrobe(0,TRUE);
1587
1588                         set_tim_invis(0, TRUE);
1589                         set_tim_infra(0, TRUE);
1590                         set_tim_esp(0, TRUE);
1591                         set_tim_regen(0, TRUE);
1592                         set_tim_stealth(0, TRUE);
1593                         set_tim_ffall(0, TRUE);
1594                         set_tim_sh_touki(0, TRUE);
1595                         set_tim_sh_fire(0, TRUE);
1596                         set_tim_sh_holy(0, TRUE);
1597                         set_tim_eyeeye(0, TRUE);
1598                         set_magicdef(0, TRUE);
1599                         set_resist_magic(0, TRUE);
1600                         set_oppose_acid(0, TRUE);
1601                         set_oppose_elec(0, TRUE);
1602                         set_oppose_fire(0, TRUE);
1603                         set_oppose_cold(0, TRUE);
1604                         set_oppose_pois(0, TRUE);
1605                         set_ultimate_res(0, TRUE);
1606                         set_mimic(0, 0, TRUE);
1607                         set_ele_attack(0, 0);
1608                         set_ele_immune(0, 0);
1609                         /* Cancel glowing hands */
1610                         if (p_ptr->special_attack & ATTACK_CONFUSE)
1611                         {
1612                                 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
1613 #ifdef JP
1614                                 msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
1615 #else
1616                                 msg_print("Your hands stop glowing.");
1617 #endif
1618
1619                         }
1620                         if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0]))
1621                         {
1622                                 p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
1623                                 p_ptr->magic_num1[0] = 0;
1624 #ifdef JP
1625                                 msg_print("²Î¤¬ÅÓÀڤ줿¡£");
1626 #else
1627                                 msg_print("Your singing is interrupted.");
1628 #endif
1629                                 p_ptr->action = ACTION_NONE;
1630
1631                                 /* Recalculate bonuses */
1632                                 p_ptr->update |= (PU_BONUS | PU_HP);
1633
1634                                 /* Redraw map */
1635                                 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1636
1637                                 /* Update monsters */
1638                                 p_ptr->update |= (PU_MONSTERS);
1639
1640                                 /* Window stuff */
1641                                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1642
1643                                 p_ptr->energy_need += ENERGY_NEED();
1644                         }
1645                         if (p_ptr->riding)
1646                         {
1647                                 m_list[p_ptr->riding].invulner = 0;
1648                                 m_list[p_ptr->riding].fast = 0;
1649                                 m_list[p_ptr->riding].slow = 0;
1650                                 p_ptr->update |= PU_BONUS;
1651                                 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= PR_HEALTH;
1652                                 p_ptr->redraw |= (PR_UHEALTH);
1653                         }
1654
1655 #ifdef JP
1656                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1657                                 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
1658 #endif
1659                         learn_spell(MS_DISPEL);
1660                         break;
1661                 }
1662
1663                 /* RF4_XXX4X4 */
1664                 case 96+3:
1665                 {
1666                         disturb(1, 0);
1667 #ifdef JP
1668 if (blind) msg_format("%^s¤¬²¿¤«¤ò¼Í¤Ã¤¿¡£", m_name);
1669 #else
1670                         if (blind) msg_format("%^s shoots something.", m_name);
1671 #endif
1672
1673 #ifdef JP
1674 else msg_format("%^s¤¬¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡£", m_name);
1675 #else
1676                         else msg_format("%^s fires a rocket.", m_name);
1677 #endif
1678
1679                         dam = ((m_ptr->hp / 4) > 800 ? 800 : (m_ptr->hp / 4));
1680                         breath(y, x, m_idx, GF_ROCKET,
1681                                 dam, 2, FALSE, MS_ROCKET, learnable);
1682                         update_smart_learn(m_idx, DRS_SHARD);
1683                         break;
1684                 }
1685
1686                 /* RF4_SHOOT */
1687                 case 96+4:
1688                 {
1689                         if (x!=px || y!=py) return (FALSE);
1690                         disturb(1, 0);
1691 #ifdef JP
1692 if (blind) msg_format("%^s¤¬´ñ̯¤Ê²»¤òȯ¤·¤¿¡£", m_name);
1693 #else
1694                         if (blind) msg_format("%^s makes a strange noise.", m_name);
1695 #endif
1696
1697 #ifdef JP
1698 else msg_format("%^s¤¬Ìð¤òÊü¤Ã¤¿¡£", m_name);
1699 #else
1700                         else msg_format("%^s fires an arrow.", m_name);
1701 #endif
1702
1703                         dam = damroll(r_ptr->blow[0].d_dice, r_ptr->blow[0].d_side);
1704                         bolt(m_idx, GF_ARROW, dam, MS_SHOOT, learnable);
1705                         update_smart_learn(m_idx, DRS_REFLECT);
1706                         break;
1707                 }
1708
1709                 /* RF4_XXX2 */
1710                 case 96+5:
1711                 {
1712                         /* XXX XXX XXX */
1713                         break;
1714                 }
1715
1716                 /* RF4_XXX3 */
1717                 case 96+6:
1718                 {
1719                         /* XXX XXX XXX */
1720                         break;
1721                 }
1722
1723                 /* RF4_XXX4 */
1724                 case 96+7:
1725                 {
1726                         /* XXX XXX XXX */
1727                         break;
1728                 }
1729
1730                 /* RF4_BR_ACID */
1731                 case 96+8:
1732                 {
1733                         disturb(1, 0);
1734 #ifdef JP
1735 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1736 #else
1737                         if (blind) msg_format("%^s breathes.", m_name);
1738 #endif
1739
1740 #ifdef JP
1741 else msg_format("%^s¤¬»À¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1742 #else
1743                         else msg_format("%^s breathes acid.", m_name);
1744 #endif
1745
1746                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1747                         breath(y, x, m_idx, GF_ACID, dam, 0, TRUE, MS_BR_ACID, learnable);
1748                         update_smart_learn(m_idx, DRS_ACID);
1749                         break;
1750                 }
1751
1752                 /* RF4_BR_ELEC */
1753                 case 96+9:
1754                 {
1755                         disturb(1, 0);
1756 #ifdef JP
1757 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1758 #else
1759                         if (blind) msg_format("%^s breathes.", m_name);
1760 #endif
1761
1762 #ifdef JP
1763 else msg_format("%^s¤¬°ðºÊ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1764 #else
1765                         else msg_format("%^s breathes lightning.", m_name);
1766 #endif
1767
1768                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1769                         breath(y, x, m_idx, GF_ELEC, dam,0, TRUE, MS_BR_ELEC, learnable);
1770                         update_smart_learn(m_idx, DRS_ELEC);
1771                         break;
1772                 }
1773
1774                 /* RF4_BR_FIRE */
1775                 case 96+10:
1776                 {
1777                         disturb(1, 0);
1778 #ifdef JP
1779 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1780 #else
1781                         if (blind) msg_format("%^s breathes.", m_name);
1782 #endif
1783
1784 #ifdef JP
1785 else msg_format("%^s¤¬²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1786 #else
1787                         else msg_format("%^s breathes fire.", m_name);
1788 #endif
1789
1790                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1791                         breath(y, x, m_idx, GF_FIRE, dam,0, TRUE, MS_BR_FIRE, learnable);
1792                         update_smart_learn(m_idx, DRS_FIRE);
1793                         break;
1794                 }
1795
1796                 /* RF4_BR_COLD */
1797                 case 96+11:
1798                 {
1799                         disturb(1, 0);
1800 #ifdef JP
1801 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1802 #else
1803                         if (blind) msg_format("%^s breathes.", m_name);
1804 #endif
1805
1806 #ifdef JP
1807 else msg_format("%^s¤¬Î䵤¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1808 #else
1809                         else msg_format("%^s breathes frost.", m_name);
1810 #endif
1811
1812                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1813                         breath(y, x, m_idx, GF_COLD, dam,0, TRUE, MS_BR_COLD, learnable);
1814                         update_smart_learn(m_idx, DRS_COLD);
1815                         break;
1816                 }
1817
1818                 /* RF4_BR_POIS */
1819                 case 96+12:
1820                 {
1821                         disturb(1, 0);
1822 #ifdef JP
1823 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1824 #else
1825                         if (blind) msg_format("%^s breathes.", m_name);
1826 #endif
1827
1828 #ifdef JP
1829 else msg_format("%^s¤¬¥¬¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1830 #else
1831                         else msg_format("%^s breathes gas.", m_name);
1832 #endif
1833
1834                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
1835                         breath(y, x, m_idx, GF_POIS, dam, 0, TRUE, MS_BR_POIS, learnable);
1836                         update_smart_learn(m_idx, DRS_POIS);
1837                         break;
1838                 }
1839
1840
1841                 /* RF4_BR_NETH */
1842                 case 96+13:
1843                 {
1844                         disturb(1, 0);
1845 #ifdef JP
1846 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1847 #else
1848                         if (blind) msg_format("%^s breathes.", m_name);
1849 #endif
1850
1851 #ifdef JP
1852 else msg_format("%^s¤¬ÃϹö¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1853 #else
1854                         else msg_format("%^s breathes nether.", m_name);
1855 #endif
1856
1857                         dam = ((m_ptr->hp / 6) > 550 ? 550 : (m_ptr->hp / 6));
1858                         breath(y, x, m_idx, GF_NETHER, dam,0, TRUE, MS_BR_NETHER, learnable);
1859                         update_smart_learn(m_idx, DRS_NETH);
1860                         break;
1861                 }
1862
1863                 /* RF4_BR_LITE */
1864                 case 96+14:
1865                 {
1866                         disturb(1, 0);
1867 #ifdef JP
1868 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1869 #else
1870                         if (blind) msg_format("%^s breathes.", m_name);
1871 #endif
1872
1873 #ifdef JP
1874 else msg_format("%^s¤¬Á®¸÷¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1875 #else
1876                         else msg_format("%^s breathes light.", m_name);
1877 #endif
1878
1879                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1880                         breath(y, x, m_idx, GF_LITE, dam,0, TRUE, MS_BR_LITE, learnable);
1881                         update_smart_learn(m_idx, DRS_LITE);
1882                         break;
1883                 }
1884
1885                 /* RF4_BR_DARK */
1886                 case 96+15:
1887                 {
1888                         disturb(1, 0);
1889 #ifdef JP
1890 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1891 #else
1892                         if (blind) msg_format("%^s breathes.", m_name);
1893 #endif
1894
1895 #ifdef JP
1896 else msg_format("%^s¤¬°Å¹õ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1897 #else
1898                         else msg_format("%^s breathes darkness.", m_name);
1899 #endif
1900
1901                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1902                         breath(y, x, m_idx, GF_DARK, dam,0, TRUE, MS_BR_DARK, learnable);
1903                         update_smart_learn(m_idx, DRS_DARK);
1904                         break;
1905                 }
1906
1907                 /* RF4_BR_CONF */
1908                 case 96+16:
1909                 {
1910                         disturb(1, 0);
1911 #ifdef JP
1912 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1913 #else
1914                         if (blind) msg_format("%^s breathes.", m_name);
1915 #endif
1916
1917 #ifdef JP
1918 else msg_format("%^s¤¬º®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1919 #else
1920                         else msg_format("%^s breathes confusion.", m_name);
1921 #endif
1922
1923                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1924                         breath(y, x, m_idx, GF_CONFUSION, dam,0, TRUE, MS_BR_CONF, learnable);
1925                         update_smart_learn(m_idx, DRS_CONF);
1926                         break;
1927                 }
1928
1929                 /* RF4_BR_SOUN */
1930                 case 96+17:
1931                 {
1932                         disturb(1, 0);
1933                         if (m_ptr->r_idx == MON_JAIAN)
1934 #ifdef JP
1935                                 msg_format("¡Ö¥Ü¥©¥¨¡Á¡Á¡Á¡Á¡Á¡Á¡×");
1936 #else
1937                                 msg_format("'Booooeeeeee'");
1938 #endif
1939 #ifdef JP
1940 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1941 #else
1942                         else if (blind) msg_format("%^s breathes.", m_name);
1943 #endif
1944
1945 #ifdef JP
1946 else msg_format("%^s¤¬¹ì²»¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1947 #else
1948                         else msg_format("%^s breathes sound.", m_name);
1949 #endif
1950
1951                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1952                         breath(y, x, m_idx, GF_SOUND, dam,0, TRUE, MS_BR_SOUND, learnable);
1953                         update_smart_learn(m_idx, DRS_SOUND);
1954                         break;
1955                 }
1956
1957                 /* RF4_BR_CHAO */
1958                 case 96+18:
1959                 {
1960                         disturb(1, 0);
1961 #ifdef JP
1962 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1963 #else
1964                         if (blind) msg_format("%^s breathes.", m_name);
1965 #endif
1966
1967 #ifdef JP
1968 else msg_format("%^s¤¬¥«¥ª¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1969 #else
1970                         else msg_format("%^s breathes chaos.", m_name);
1971 #endif
1972
1973                         dam = ((m_ptr->hp / 6) > 600 ? 600 : (m_ptr->hp / 6));
1974                         breath(y, x, m_idx, GF_CHAOS, dam,0, TRUE, MS_BR_CHAOS, learnable);
1975                         update_smart_learn(m_idx, DRS_CHAOS);
1976                         break;
1977                 }
1978
1979                 /* RF4_BR_DISE */
1980                 case 96+19:
1981                 {
1982                         disturb(1, 0);
1983 #ifdef JP
1984 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1985 #else
1986                         if (blind) msg_format("%^s breathes.", m_name);
1987 #endif
1988
1989 #ifdef JP
1990 else msg_format("%^s¤¬Îô²½¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1991 #else
1992                         else msg_format("%^s breathes disenchantment.", m_name);
1993 #endif
1994
1995                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
1996                         breath(y, x, m_idx, GF_DISENCHANT, dam,0, TRUE, MS_BR_DISEN, learnable);
1997                         update_smart_learn(m_idx, DRS_DISEN);
1998                         break;
1999                 }
2000
2001                 /* RF4_BR_NEXU */
2002                 case 96+20:
2003                 {
2004                         disturb(1, 0);
2005 #ifdef JP
2006 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2007 #else
2008                         if (blind) msg_format("%^s breathes.", m_name);
2009 #endif
2010
2011 #ifdef JP
2012 else msg_format("%^s¤¬°ø²Ìº®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2013 #else
2014                         else msg_format("%^s breathes nexus.", m_name);
2015 #endif
2016
2017                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2018                         breath(y, x, m_idx, GF_NEXUS, dam,0, TRUE, MS_BR_NEXUS, learnable);
2019                         update_smart_learn(m_idx, DRS_NEXUS);
2020                         break;
2021                 }
2022
2023                 /* RF4_BR_TIME */
2024                 case 96+21:
2025                 {
2026                         disturb(1, 0);
2027 #ifdef JP
2028 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2029 #else
2030                         if (blind) msg_format("%^s breathes.", m_name);
2031 #endif
2032
2033 #ifdef JP
2034 else msg_format("%^s¤¬»þ´ÖµÕž¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2035 #else
2036                         else msg_format("%^s breathes time.", m_name);
2037 #endif
2038
2039                         dam = ((m_ptr->hp / 3) > 150 ? 150 : (m_ptr->hp / 3));
2040                         breath(y, x, m_idx, GF_TIME, dam,0, TRUE, MS_BR_TIME, learnable);
2041                         break;
2042                 }
2043
2044                 /* RF4_BR_INER */
2045                 case 96+22:
2046                 {
2047                         disturb(1, 0);
2048 #ifdef JP
2049 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2050 #else
2051                         if (blind) msg_format("%^s breathes.", m_name);
2052 #endif
2053
2054 #ifdef JP
2055 else msg_format("%^s¤¬ÃÙÆߤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2056 #else
2057                         else msg_format("%^s breathes inertia.", m_name);
2058 #endif
2059
2060                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2061                         breath(y, x, m_idx, GF_INERTIA, dam,0, TRUE, MS_BR_INERTIA, learnable);
2062                         break;
2063                 }
2064
2065                 /* RF4_BR_GRAV */
2066                 case 96+23:
2067                 {
2068                         disturb(1, 0);
2069 #ifdef JP
2070 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2071 #else
2072                         if (blind) msg_format("%^s breathes.", m_name);
2073 #endif
2074
2075 #ifdef JP
2076 else msg_format("%^s¤¬½ÅÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2077 #else
2078                         else msg_format("%^s breathes gravity.", m_name);
2079 #endif
2080
2081                         dam = ((m_ptr->hp / 3) > 200 ? 200 : (m_ptr->hp / 3));
2082                         breath(y, x, m_idx, GF_GRAVITY, dam,0, TRUE, MS_BR_GRAVITY, learnable);
2083                         break;
2084                 }
2085
2086                 /* RF4_BR_SHAR */
2087                 case 96+24:
2088                 {
2089                         disturb(1, 0);
2090                         if (m_ptr->r_idx == MON_BOTEI)
2091 #ifdef JP
2092                                 msg_format("¡Ö¥ÜÄë¥Ó¥ë¥«¥Ã¥¿¡¼¡ª¡ª¡ª¡×");
2093 #else
2094                                 msg_format("'Boty-Build cutter!!!'");
2095 #endif
2096 #ifdef JP
2097 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2098 #else
2099                         else if (blind) msg_format("%^s breathes.", m_name);
2100 #endif
2101
2102 #ifdef JP
2103 else msg_format("%^s¤¬ÇËÊҤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2104 #else
2105                         else msg_format("%^s breathes shards.", m_name);
2106 #endif
2107
2108                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
2109                         breath(y, x, m_idx, GF_SHARDS, dam,0, TRUE, MS_BR_SHARDS, learnable);
2110                         update_smart_learn(m_idx, DRS_SHARD);
2111                         break;
2112                 }
2113
2114                 /* RF4_BR_PLAS */
2115                 case 96+25:
2116                 {
2117                         disturb(1, 0);
2118 #ifdef JP
2119 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2120 #else
2121                         if (blind) msg_format("%^s breathes.", m_name);
2122 #endif
2123
2124 #ifdef JP
2125 else msg_format("%^s¤¬¥×¥é¥º¥Þ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2126 #else
2127                         else msg_format("%^s breathes plasma.", m_name);
2128 #endif
2129
2130                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2131                         breath(y, x, m_idx, GF_PLASMA, dam,0, TRUE, MS_BR_PLASMA, learnable);
2132                         break;
2133                 }
2134
2135                 /* RF4_BR_WALL */
2136                 case 96+26:
2137                 {
2138                         disturb(1, 0);
2139 #ifdef JP
2140 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2141 #else
2142                         if (blind) msg_format("%^s breathes.", m_name);
2143 #endif
2144
2145 #ifdef JP
2146 else msg_format("%^s¤¬¥Õ¥©¡¼¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2147 #else
2148                         else msg_format("%^s breathes force.", m_name);
2149 #endif
2150
2151                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2152                         breath(y, x, m_idx, GF_FORCE, dam,0, TRUE, MS_BR_FORCE, learnable);
2153                         break;
2154                 }
2155
2156                 /* RF4_BR_MANA */
2157                 case 96+27:
2158                 {
2159                         disturb(1, 0);
2160 #ifdef JP
2161 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2162 #else
2163                         if (blind) msg_format("%^s breathes.", m_name);
2164 #endif
2165
2166 #ifdef JP
2167 else msg_format("%^s¤¬ËâÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2168 #else
2169                         else msg_format("%^s breathes mana.", m_name);
2170 #endif
2171                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2172                         breath(y, x, m_idx, GF_MANA, dam,0, TRUE, MS_BR_MANA, learnable);
2173                         break;
2174                 }
2175
2176                 /* RF4_BA_NUKE */
2177                 case 96+28:
2178                 {
2179                         disturb(1, 0);
2180 #ifdef JP
2181 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2182 #else
2183                         if (blind) msg_format("%^s mumbles.", m_name);
2184 #endif
2185
2186 #ifdef JP
2187 else msg_format("%^s¤¬Êü¼Íǽµå¤òÊü¤Ã¤¿¡£", m_name);
2188 #else
2189                         else msg_format("%^s casts a ball of radiation.", m_name);
2190 #endif
2191
2192                         dam = (rlev + damroll(10, 6)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2193                         breath(y, x, m_idx, GF_NUKE, dam, 2, FALSE, MS_BALL_NUKE, learnable);
2194                         update_smart_learn(m_idx, DRS_POIS);
2195                         break;
2196                 }
2197
2198                 /* RF4_BR_NUKE */
2199                 case 96+29:
2200                 {
2201                         disturb(1, 0);
2202 #ifdef JP
2203 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2204 #else
2205                         if (blind) msg_format("%^s breathes.", m_name);
2206 #endif
2207
2208 #ifdef JP
2209 else msg_format("%^s¤¬Êü¼ÍÀ­ÇÑ´þʪ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2210 #else
2211                         else msg_format("%^s breathes toxic waste.", m_name);
2212 #endif
2213
2214                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
2215                         breath(y, x, m_idx, GF_NUKE, dam,0, TRUE, MS_BR_NUKE, learnable);
2216                         update_smart_learn(m_idx, DRS_POIS);
2217                         break;
2218                 }
2219
2220                 /* RF4_BA_CHAO */
2221                 case 96+30:
2222                 {
2223                         disturb(1, 0);
2224 #ifdef JP
2225 if (blind) msg_format("%^s¤¬¶²¤í¤·¤²¤Ë¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2226 #else
2227                         if (blind) msg_format("%^s mumbles frighteningly.", m_name);
2228 #endif
2229
2230 #ifdef JP
2231 else msg_format("%^s¤¬½ã¥í¥°¥ë¥¹¤òÊü¤Ã¤¿¡£", m_name);/*nuke me*/
2232 #else
2233                         else msg_format("%^s invokes a raw Logrus.", m_name);
2234 #endif
2235
2236                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? (rlev * 3) : (rlev * 2))+ damroll(10, 10);
2237                         breath(y, x, m_idx, GF_CHAOS, dam, 4, FALSE, MS_BALL_CHAOS, learnable);
2238                         update_smart_learn(m_idx, DRS_CHAOS);
2239                         break;
2240                 }
2241
2242                 /* RF4_BR_DISI */
2243                 case 96+31:
2244                 {
2245                         disturb(1, 0);
2246 #ifdef JP
2247 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2248 #else
2249                         if (blind) msg_format("%^s breathes.", m_name);
2250 #endif
2251
2252 #ifdef JP
2253 else msg_format("%^s¤¬Ê¬²ò¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2254 #else
2255                         else msg_format("%^s breathes disintegration.", m_name);
2256 #endif
2257
2258                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2259                         breath(y, x, m_idx, GF_DISINTEGRATE, dam,0, TRUE, MS_BR_DISI, learnable);
2260                         break;
2261                 }
2262
2263
2264
2265                 /* RF5_BA_ACID */
2266                 case 128+0:
2267                 {
2268                         disturb(1, 0);
2269 #ifdef JP
2270 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2271 #else
2272                         if (blind) msg_format("%^s mumbles.", m_name);
2273 #endif
2274
2275 #ifdef JP
2276 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2277 #else
2278                         else msg_format("%^s casts an acid ball.", m_name);
2279 #endif
2280
2281                         dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2282                         breath(y, x, m_idx, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
2283                         update_smart_learn(m_idx, DRS_ACID);
2284                         break;
2285                 }
2286
2287                 /* RF5_BA_ELEC */
2288                 case 128+1:
2289                 {
2290                         disturb(1, 0);
2291 #ifdef JP
2292 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2293 #else
2294                         if (blind) msg_format("%^s mumbles.", m_name);
2295 #endif
2296
2297 #ifdef JP
2298 else msg_format("%^s¤¬¥µ¥ó¥À¡¼¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2299 #else
2300                         else msg_format("%^s casts a lightning ball.", m_name);
2301 #endif
2302
2303                         dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2304                         breath(y, x, m_idx, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
2305                         update_smart_learn(m_idx, DRS_ELEC);
2306                         break;
2307                 }
2308
2309                 /* RF5_BA_FIRE */
2310                 case 128+2:
2311                 {
2312                         disturb(1, 0);
2313
2314                         if (m_ptr->r_idx == MON_ROLENTO)
2315                         {
2316 #ifdef JP
2317                                 if (blind)
2318                                         msg_format("%s¤¬²¿¤«¤òÅꤲ¤¿¡£", m_name);
2319                                 else 
2320                                         msg_format("%s¤Ï¼êÜØÃƤòÅꤲ¤¿¡£", m_name);
2321 #else
2322                                 if (blind)
2323                                         msg_format("%^s throws something.", m_name);
2324                                 else
2325                                         msg_format("%^s throws a hand grenade.", m_name);
2326 #endif
2327                         }
2328                         else
2329                         {
2330 #ifdef JP
2331 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2332 #else
2333                                 if (blind) msg_format("%^s mumbles.", m_name);
2334 #endif
2335
2336 #ifdef JP
2337 else msg_format("%^s¤¬¥Õ¥¡¥¤¥¢¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2338 #else
2339                                 else msg_format("%^s casts a fire ball.", m_name);
2340 #endif
2341                         }
2342
2343                         dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2344                         breath(y, x, m_idx, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
2345                         update_smart_learn(m_idx, DRS_FIRE);
2346                         break;
2347                 }
2348
2349                 /* RF5_BA_COLD */
2350                 case 128+3:
2351                 {
2352                         disturb(1, 0);
2353 #ifdef JP
2354 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2355 #else
2356                         if (blind) msg_format("%^s mumbles.", m_name);
2357 #endif
2358
2359 #ifdef JP
2360 else msg_format("%^s¤¬¥¢¥¤¥¹¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2361 #else
2362                         else msg_format("%^s casts a frost ball.", m_name);
2363 #endif
2364
2365                         dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2366                         breath(y, x, m_idx, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
2367                         update_smart_learn(m_idx, DRS_COLD);
2368                         break;
2369                 }
2370
2371                 /* RF5_BA_POIS */
2372                 case 128+4:
2373                 {
2374                         disturb(1, 0);
2375 #ifdef JP
2376 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2377 #else
2378                         if (blind) msg_format("%^s mumbles.", m_name);
2379 #endif
2380
2381 #ifdef JP
2382 else msg_format("%^s¤¬°­½­±À¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2383 #else
2384                         else msg_format("%^s casts a stinking cloud.", m_name);
2385 #endif
2386
2387                         dam = damroll(12, 2) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2388                         breath(y, x, m_idx, GF_POIS, dam, 2, FALSE, MS_BALL_POIS, learnable);
2389                         update_smart_learn(m_idx, DRS_POIS);
2390                         break;
2391                 }
2392
2393                 /* RF5_BA_NETH */
2394                 case 128+5:
2395                 {
2396                         disturb(1, 0);
2397 #ifdef JP
2398 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2399 #else
2400                         if (blind) msg_format("%^s mumbles.", m_name);
2401 #endif
2402
2403 #ifdef JP
2404 else msg_format("%^s¤¬ÃϹöµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2405 #else
2406                         else msg_format("%^s casts a nether ball.", m_name);
2407 #endif
2408
2409                         dam = 50 + damroll(10, 10) + (rlev * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1));
2410                         breath(y, x, m_idx, GF_NETHER, dam, 2, FALSE, MS_BALL_NETHER, learnable);
2411                         update_smart_learn(m_idx, DRS_NETH);
2412                         break;
2413                 }
2414
2415                 /* RF5_BA_WATE */
2416                 case 128+6:
2417                 {
2418                         disturb(1, 0);
2419 #ifdef JP
2420 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2421 #else
2422                         if (blind) msg_format("%^s mumbles.", m_name);
2423 #endif
2424
2425 #ifdef JP
2426 else msg_format("%^s¤¬Î®¤ì¤ë¤è¤¦¤Ê¿È¿¶¤ê¤ò¤·¤¿¡£", m_name);
2427 #else
2428                         else msg_format("%^s gestures fluidly.", m_name);
2429 #endif
2430
2431 #ifdef JP
2432 msg_print("¤¢¤Ê¤¿¤Ï±²´¬¤­¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£");
2433 #else
2434                         msg_print("You are engulfed in a whirlpool.");
2435 #endif
2436
2437                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
2438                         breath(y, x, m_idx, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
2439                         break;
2440                 }
2441
2442                 /* RF5_BA_MANA */
2443                 case 128+7:
2444                 {
2445                         disturb(1, 0);
2446 #ifdef JP
2447 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2448 #else
2449                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2450 #endif
2451
2452 #ifdef JP
2453 else msg_format("%^s¤¬ËâÎϤÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2454 #else
2455                         else msg_format("%^s invokes a mana storm.", m_name);
2456 #endif
2457
2458                         dam = (rlev * 4) + 50 + damroll(10, 10);
2459                         breath(y, x, m_idx, GF_MANA, dam, 4, FALSE, MS_BALL_MANA, learnable);
2460                         break;
2461                 }
2462
2463                 /* RF5_BA_DARK */
2464                 case 128+8:
2465                 {
2466                         disturb(1, 0);
2467 #ifdef JP
2468 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2469 #else
2470                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2471 #endif
2472
2473 #ifdef JP
2474 else msg_format("%^s¤¬°Å¹õ¤ÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2475 #else
2476                         else msg_format("%^s invokes a darkness storm.", m_name);
2477 #endif
2478
2479                         dam = (rlev * 4) + 50 + damroll(10, 10);
2480                         breath(y, x, m_idx, GF_DARK, dam, 4, FALSE, MS_BALL_DARK, learnable);
2481                         update_smart_learn(m_idx, DRS_DARK);
2482                         break;
2483                 }
2484
2485                 /* RF5_DRAIN_MANA */
2486                 case 128+9:
2487                 {
2488                         if (x!=px || y!=py) return (FALSE);
2489                         if (!direct) break;
2490                         disturb(1, 0);
2491                         if (p_ptr->csp)
2492                         {
2493                                 int r1;
2494
2495                                 /* Basic message */
2496 #ifdef JP
2497 msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
2498 #else
2499                                 msg_format("%^s draws psychic energy from you!", m_name);
2500 #endif
2501
2502
2503                                 /* Attack power */
2504                                 r1 = (randint1(rlev) / 2) + 1;
2505
2506                                 /* Full drain */
2507                                 if (r1 >= p_ptr->csp)
2508                                 {
2509                                         r1 = p_ptr->csp;
2510                                         p_ptr->csp = 0;
2511                                         p_ptr->csp_frac = 0;
2512                                 }
2513
2514                                 /* Partial drain */
2515                                 else
2516                                 {
2517                                         p_ptr->csp -= r1;
2518                                 }
2519
2520                                 learn_spell(MS_DRAIN_MANA);
2521
2522                                 /* Redraw mana */
2523                                 p_ptr->redraw |= (PR_MANA);
2524
2525                                 /* Window stuff */
2526                                 p_ptr->window |= (PW_PLAYER);
2527                                 p_ptr->window |= (PW_SPELL);
2528
2529                                 /* Heal the monster */
2530                                 if (m_ptr->hp < m_ptr->maxhp)
2531                                 {
2532                                         /* Heal */
2533                                         m_ptr->hp += (6 * r1);
2534                                         if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2535
2536                                         /* Redraw (later) if needed */
2537                                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
2538                                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
2539
2540                                         /* Special message */
2541                                         if (seen)
2542                                         {
2543 #ifdef JP
2544 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
2545 #else
2546                                                 msg_format("%^s appears healthier.", m_name);
2547 #endif
2548
2549                                         }
2550                                 }
2551                         }
2552                         update_smart_learn(m_idx, DRS_MANA);
2553                         break;
2554                 }
2555
2556                 /* RF5_MIND_BLAST */
2557                 case 128+10:
2558                 {
2559                         if (x!=px || y!=py) return (FALSE);
2560                         if (!direct) break;
2561                         disturb(1, 0);
2562                         if (!seen)
2563                         {
2564 #ifdef JP
2565 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2566 #else
2567                                 msg_print("You feel something focusing on your mind.");
2568 #endif
2569
2570                         }
2571                         else
2572                         {
2573 #ifdef JP
2574 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¤Ë¤é¤ó¤Ç¤¤¤ë¡£", m_name);
2575 #else
2576                                 msg_format("%^s gazes deep into your eyes.", m_name);
2577 #endif
2578
2579                         }
2580
2581                         dam = damroll(7, 7);
2582                         breath(y, x, m_idx, GF_MIND_BLAST, dam, 0, FALSE, MS_MIND_BLAST, learnable);
2583                         break;
2584                 }
2585
2586                 /* RF5_BRAIN_SMASH */
2587                 case 128+11:
2588                 {
2589                         if (x!=px || y!=py) return (FALSE);
2590                         if (!direct) break;
2591                         disturb(1, 0);
2592                         if (!seen)
2593                         {
2594 #ifdef JP
2595 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2596 #else
2597                                 msg_print("You feel something focusing on your mind.");
2598 #endif
2599
2600                         }
2601                         else
2602                         {
2603 #ifdef JP
2604 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¸«¤Æ¤¤¤ë¡£", m_name);
2605 #else
2606                                 msg_format("%^s looks deep into your eyes.", m_name);
2607 #endif
2608
2609                         }
2610
2611                         dam = damroll(12, 12);
2612                         breath(y, x, m_idx, GF_BRAIN_SMASH, dam, 0, FALSE, MS_BRAIN_SMASH, learnable);
2613                         break;
2614                 }
2615
2616                 /* RF5_CAUSE_1 */
2617                 case 128+12:
2618                 {
2619                         if (x!=px || y!=py) return (FALSE);
2620                         if (!direct) break;
2621                         disturb(1, 0);
2622 #ifdef JP
2623 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2624 #else
2625                         if (blind) msg_format("%^s mumbles.", m_name);
2626 #endif
2627
2628 #ifdef JP
2629 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¼ö¤Ã¤¿¡£", m_name);
2630 #else
2631                         else msg_format("%^s points at you and curses.", m_name);
2632 #endif
2633
2634                         dam = damroll(3, 8);
2635                         breath(y, x, m_idx, GF_CAUSE_1, dam, 0, FALSE, MS_CAUSE_1, learnable);
2636                         break;
2637                 }
2638
2639                 /* RF5_CAUSE_2 */
2640                 case 128+13:
2641                 {
2642                         if (x!=px || y!=py) return (FALSE);
2643                         if (!direct) break;
2644                         disturb(1, 0);
2645 #ifdef JP
2646 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2647 #else
2648                         if (blind) msg_format("%^s mumbles.", m_name);
2649 #endif
2650
2651 #ifdef JP
2652 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤Ã¤¿¡£", m_name);
2653 #else
2654                         else msg_format("%^s points at you and curses horribly.", m_name);
2655 #endif
2656
2657                         dam = damroll(8, 8);
2658                         breath(y, x, m_idx, GF_CAUSE_2, dam, 0, FALSE, MS_CAUSE_2, learnable);
2659                         break;
2660                 }
2661
2662                 /* RF5_CAUSE_3 */
2663                 case 128+14:
2664                 {
2665                         if (x!=px || y!=py) return (FALSE);
2666                         if (!direct) break;
2667                         disturb(1, 0);
2668 #ifdef JP
2669 if (blind) msg_format("%^s¤¬²¿¤«¤òÂçÀ¼¤Ç¶«¤ó¤À¡£", m_name);
2670 #else
2671                         if (blind) msg_format("%^s mumbles loudly.", m_name);
2672 #endif
2673
2674 #ifdef JP
2675 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
2676 #else
2677                         else msg_format("%^s points at you, incanting terribly!", m_name);
2678 #endif
2679
2680                         dam = damroll(10, 15);
2681                         breath(y, x, m_idx, GF_CAUSE_3, dam, 0, FALSE, MS_CAUSE_3, learnable);
2682                         break;
2683                 }
2684
2685                 /* RF5_CAUSE_4 */
2686                 case 128+15:
2687                 {
2688                         if (x!=px || y!=py) return (FALSE);
2689                         if (!direct) break;
2690                         disturb(1, 0);
2691 #ifdef JP
2692 if (blind) msg_format("%^s¤¬¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2693 #else
2694                         if (blind) msg_format("%^s screams the word 'DIE!'", m_name);
2695 #endif
2696
2697 #ifdef JP
2698 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÈ빦¤òÆͤ¤¤Æ¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2699 #else
2700                         else msg_format("%^s points at you, screaming the word DIE!", m_name);
2701 #endif
2702
2703                         dam = damroll(15, 15);
2704                         breath(y, x, m_idx, GF_CAUSE_4, dam, 0, FALSE, MS_CAUSE_4, learnable);
2705                         break;
2706                 }
2707
2708                 /* RF5_BO_ACID */
2709                 case 128+16:
2710                 {
2711                         if (x!=px || y!=py) return (FALSE);
2712                         disturb(1, 0);
2713 #ifdef JP
2714 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2715 #else
2716                         if (blind) msg_format("%^s mumbles.", m_name);
2717 #endif
2718
2719 #ifdef JP
2720 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2721 #else
2722                         else msg_format("%^s casts a acid bolt.", m_name);
2723 #endif
2724
2725                         dam = (damroll(7, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2726                         bolt(m_idx, GF_ACID, dam, MS_BOLT_ACID, learnable);
2727                         update_smart_learn(m_idx, DRS_ACID);
2728                         update_smart_learn(m_idx, DRS_REFLECT);
2729                         break;
2730                 }
2731
2732                 /* RF5_BO_ELEC */
2733                 case 128+17:
2734                 {
2735                         if (x!=px || y!=py) return (FALSE);
2736                         disturb(1, 0);
2737 #ifdef JP
2738 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2739 #else
2740                         if (blind) msg_format("%^s mumbles.", m_name);
2741 #endif
2742
2743 #ifdef JP
2744 else msg_format("%^s¤¬¥µ¥ó¥À¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2745 #else
2746                         else msg_format("%^s casts a lightning bolt.", m_name);
2747 #endif
2748
2749                         dam = (damroll(4, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2750                         bolt(m_idx, GF_ELEC, dam, MS_BOLT_ELEC, learnable);
2751                         update_smart_learn(m_idx, DRS_ELEC);
2752                         update_smart_learn(m_idx, DRS_REFLECT);
2753                         break;
2754                 }
2755
2756                 /* RF5_BO_FIRE */
2757                 case 128+18:
2758                 {
2759                         if (x!=px || y!=py) return (FALSE);
2760                         disturb(1, 0);
2761 #ifdef JP
2762 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2763 #else
2764                         if (blind) msg_format("%^s mumbles.", m_name);
2765 #endif
2766
2767 #ifdef JP
2768 else msg_format("%^s¤¬¥Õ¥¡¥¤¥¢¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2769 #else
2770                         else msg_format("%^s casts a fire bolt.", m_name);
2771 #endif
2772
2773                         dam = (damroll(9, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2774                         bolt(m_idx, GF_FIRE, dam, MS_BOLT_FIRE, learnable);
2775                         update_smart_learn(m_idx, DRS_FIRE);
2776                         update_smart_learn(m_idx, DRS_REFLECT);
2777                         break;
2778                 }
2779
2780                 /* RF5_BO_COLD */
2781                 case 128+19:
2782                 {
2783                         if (x!=px || y!=py) return (FALSE);
2784                         disturb(1, 0);
2785 #ifdef JP
2786 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2787 #else
2788                         if (blind) msg_format("%^s mumbles.", m_name);
2789 #endif
2790
2791 #ifdef JP
2792 else msg_format("%^s¤¬¥¢¥¤¥¹¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2793 #else
2794                         else msg_format("%^s casts a frost bolt.", m_name);
2795 #endif
2796
2797                         dam = (damroll(6, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2798                         bolt(m_idx, GF_COLD, dam, MS_BOLT_COLD, learnable);
2799                         update_smart_learn(m_idx, DRS_COLD);
2800                         update_smart_learn(m_idx, DRS_REFLECT);
2801                         break;
2802                 }
2803
2804                 /* RF5_BA_LITE */
2805                 case 128+20:
2806                 {
2807                         disturb(1, 0);
2808 #ifdef JP
2809 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2810 #else
2811                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2812 #endif
2813
2814 #ifdef JP
2815 else msg_format("%^s¤¬¥¹¥¿¡¼¥Ð¡¼¥¹¥È¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2816 #else
2817                         else msg_format("%^s invokes a starburst.", m_name);
2818 #endif
2819
2820                         dam = (rlev * 4) + 50 + damroll(10, 10);
2821                         breath(y, x, m_idx, GF_LITE, dam, 4, FALSE, MS_STARBURST, learnable);
2822                         update_smart_learn(m_idx, DRS_LITE);
2823                         break;
2824                 }
2825
2826                 /* RF5_BO_NETH */
2827                 case 128+21:
2828                 {
2829                         if (x!=px || y!=py) return (FALSE);
2830                         disturb(1, 0);
2831 #ifdef JP
2832 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2833 #else
2834                         if (blind) msg_format("%^s mumbles.", m_name);
2835 #endif
2836
2837 #ifdef JP
2838 else msg_format("%^s¤¬ÃϹö¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2839 #else
2840                         else msg_format("%^s casts a nether bolt.", m_name);
2841 #endif
2842
2843                         dam = 30 + damroll(5, 5) + (rlev * 4) / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3);
2844                         bolt(m_idx, GF_NETHER, dam, MS_BOLT_NETHER, learnable);
2845                         update_smart_learn(m_idx, DRS_NETH);
2846                         update_smart_learn(m_idx, DRS_REFLECT);
2847                         break;
2848                 }
2849
2850                 /* RF5_BO_WATE */
2851                 case 128+22:
2852                 {
2853                         if (x!=px || y!=py) return (FALSE);
2854                         disturb(1, 0);
2855 #ifdef JP
2856 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2857 #else
2858                         if (blind) msg_format("%^s mumbles.", m_name);
2859 #endif
2860
2861 #ifdef JP
2862 else msg_format("%^s¤¬¥¦¥©¡¼¥¿¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2863 #else
2864                         else msg_format("%^s casts a water bolt.", m_name);
2865 #endif
2866
2867                         dam = damroll(10, 10) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2868                         bolt(m_idx, GF_WATER, dam, MS_BOLT_WATER, learnable);
2869                         update_smart_learn(m_idx, DRS_REFLECT);
2870                         break;
2871                 }
2872
2873                 /* RF5_BO_MANA */
2874                 case 128+23:
2875                 {
2876                         if (x!=px || y!=py) return (FALSE);
2877                         disturb(1, 0);
2878 #ifdef JP
2879 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2880 #else
2881                         if (blind) msg_format("%^s mumbles.", m_name);
2882 #endif
2883
2884 #ifdef JP
2885 else msg_format("%^s¤¬ËâÎϤÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2886 #else
2887                         else msg_format("%^s casts a mana bolt.", m_name);
2888 #endif
2889
2890                         dam = randint1(rlev * 7 / 2) + 50;
2891                         bolt(m_idx, GF_MANA, dam, MS_BOLT_MANA, learnable);
2892                         update_smart_learn(m_idx, DRS_REFLECT);
2893                         break;
2894                 }
2895
2896                 /* RF5_BO_PLAS */
2897                 case 128+24:
2898                 {
2899                         if (x!=px || y!=py) return (FALSE);
2900                         disturb(1, 0);
2901 #ifdef JP
2902 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2903 #else
2904                         if (blind) msg_format("%^s mumbles.", m_name);
2905 #endif
2906
2907 #ifdef JP
2908 else msg_format("%^s¤¬¥×¥é¥º¥Þ¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2909 #else
2910                         else msg_format("%^s casts a plasma bolt.", m_name);
2911 #endif
2912
2913                         dam = 10 + damroll(8, 7) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2914                         bolt(m_idx, GF_PLASMA, dam, MS_BOLT_PLASMA, learnable);
2915                         update_smart_learn(m_idx, DRS_REFLECT);
2916                         break;
2917                 }
2918
2919                 /* RF5_BO_ICEE */
2920                 case 128+25:
2921                 {
2922                         if (x!=px || y!=py) return (FALSE);
2923                         disturb(1, 0);
2924 #ifdef JP
2925 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2926 #else
2927                         if (blind) msg_format("%^s mumbles.", m_name);
2928 #endif
2929
2930 #ifdef JP
2931 else msg_format("%^s¤¬¶Ë´¨¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2932 #else
2933                         else msg_format("%^s casts an ice bolt.", m_name);
2934 #endif
2935
2936                         dam = damroll(6, 6) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2937                         bolt(m_idx, GF_ICE, dam, MS_BOLT_ICE, learnable);
2938                         update_smart_learn(m_idx, DRS_COLD);
2939                         update_smart_learn(m_idx, DRS_REFLECT);
2940                         break;
2941                 }
2942
2943                 /* RF5_MISSILE */
2944                 case 128+26:
2945                 {
2946                         if (x!=px || y!=py) return (FALSE);
2947                         disturb(1, 0);
2948 #ifdef JP
2949 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2950 #else
2951                         if (blind) msg_format("%^s mumbles.", m_name);
2952 #endif
2953
2954 #ifdef JP
2955 else msg_format("%^s¤¬¥Þ¥¸¥Ã¥¯¡¦¥ß¥µ¥¤¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2956 #else
2957                         else msg_format("%^s casts a magic missile.", m_name);
2958 #endif
2959
2960                         dam = damroll(2, 6) + (rlev / 3);
2961                         bolt(m_idx, GF_MISSILE, dam, MS_MAGIC_MISSILE, learnable);
2962                         update_smart_learn(m_idx, DRS_REFLECT);
2963                         break;
2964                 }
2965
2966                 /* RF5_SCARE */
2967                 case 128+27:
2968                 {
2969                         if (x!=px || y!=py) return (FALSE);
2970                         if (!direct) break;
2971                         disturb(1, 0);
2972 #ifdef JP
2973 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢¶²¤í¤·¤²¤Ê²»¤¬Ê¹¤³¤¨¤¿¡£", m_name);
2974 #else
2975                         if (blind) msg_format("%^s mumbles, and you hear scary noises.", m_name);
2976 #endif
2977
2978 #ifdef JP
2979 else msg_format("%^s¤¬¶²¤í¤·¤²¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
2980 #else
2981                         else msg_format("%^s casts a fearful illusion.", m_name);
2982 #endif
2983
2984                         if (p_ptr->resist_fear)
2985                         {
2986 #ifdef JP
2987 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
2988 #else
2989                                 msg_print("You refuse to be frightened.");
2990 #endif
2991
2992                         }
2993                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
2994                         {
2995 #ifdef JP
2996 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
2997 #else
2998                                 msg_print("You refuse to be frightened.");
2999 #endif
3000
3001                         }
3002                         else
3003                         {
3004                                 (void)set_afraid(p_ptr->afraid + randint0(4) + 4);
3005                         }
3006                         learn_spell(MS_SCARE);
3007                         update_smart_learn(m_idx, DRS_FEAR);
3008                         break;
3009                 }
3010
3011                 /* RF5_BLIND */
3012                 case 128+28:
3013                 {
3014                         if (x!=px || y!=py) return (FALSE);
3015                         if (!direct) break;
3016                         disturb(1, 0);
3017 #ifdef JP
3018 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3019 #else
3020                         if (blind) msg_format("%^s mumbles.", m_name);
3021 #endif
3022
3023 #ifdef JP
3024 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¤¢¤Ê¤¿¤ÎÌܤò¤¯¤é¤Þ¤·¤¿¡ª", m_name);
3025 #else
3026                         else msg_format("%^s casts a spell, burning your eyes!", m_name);
3027 #endif
3028
3029                         if (p_ptr->resist_blind)
3030                         {
3031 #ifdef JP
3032 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3033 #else
3034                                 msg_print("You are unaffected!");
3035 #endif
3036
3037                         }
3038                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3039                         {
3040 #ifdef JP
3041 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3042 #else
3043                                 msg_print("You resist the effects!");
3044 #endif
3045
3046                         }
3047                         else
3048                         {
3049                                 (void)set_blind(12 + randint0(4));
3050                         }
3051                         learn_spell(MS_BLIND);
3052                         update_smart_learn(m_idx, DRS_BLIND);
3053                         break;
3054                 }
3055
3056                 /* RF5_CONF */
3057                 case 128+29:
3058                 {
3059                         if (x!=px || y!=py) return (FALSE);
3060                         if (!direct) break;
3061                         disturb(1, 0);
3062 #ifdef JP
3063 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢Æ¬¤òǺ¤Þ¤¹²»¤¬¤·¤¿¡£", m_name);
3064 #else
3065                         if (blind) msg_format("%^s mumbles, and you hear puzzling noises.", m_name);
3066 #endif
3067
3068 #ifdef JP
3069 else msg_format("%^s¤¬Í¶ÏÇŪ¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
3070 #else
3071                         else msg_format("%^s creates a mesmerising illusion.", m_name);
3072 #endif
3073
3074                         if (p_ptr->resist_conf)
3075                         {
3076 #ifdef JP
3077 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3078 #else
3079                                 msg_print("You disbelieve the feeble spell.");
3080 #endif
3081
3082                         }
3083                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3084                         {
3085 #ifdef JP
3086 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3087 #else
3088                                 msg_print("You disbelieve the feeble spell.");
3089 #endif
3090
3091                         }
3092                         else
3093                         {
3094                                 (void)set_confused(p_ptr->confused + randint0(4) + 4);
3095                         }
3096                         learn_spell(MS_CONF);
3097                         update_smart_learn(m_idx, DRS_CONF);
3098                         break;
3099                 }
3100
3101                 /* RF5_SLOW */
3102                 case 128+30:
3103                 {
3104                         if (x!=px || y!=py) return (FALSE);
3105                         if (!direct) break;
3106                         disturb(1, 0);
3107 #ifdef JP
3108 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¶ÚÎϤòµÛ¤¤¼è¤í¤¦¤È¤·¤¿¡ª", m_name);
3109 #else
3110                         msg_format("%^s drains power from your muscles!", m_name);
3111 #endif
3112
3113                         if (p_ptr->free_act)
3114                         {
3115 #ifdef JP
3116 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3117 #else
3118                                 msg_print("You are unaffected!");
3119 #endif
3120
3121                         }
3122                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3123                         {
3124 #ifdef JP
3125 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3126 #else
3127                                 msg_print("You resist the effects!");
3128 #endif
3129
3130                         }
3131                         else
3132                         {
3133                                 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
3134                         }
3135                         learn_spell(MS_SLOW);
3136                         update_smart_learn(m_idx, DRS_FREE);
3137                         break;
3138                 }
3139
3140                 /* RF5_HOLD */
3141                 case 128+31:
3142                 {
3143                         if (x!=px || y!=py) return (FALSE);
3144                         if (!direct) break;
3145                         disturb(1, 0);
3146 #ifdef JP
3147 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3148 #else
3149                         if (blind) msg_format("%^s mumbles.", m_name);
3150 #endif
3151
3152 #ifdef JP
3153 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÌܤò¤¸¤Ã¤È¸«¤Ä¤á¤¿¡ª", m_name);
3154 #else
3155                         else msg_format("%^s stares deep into your eyes!", m_name);
3156 #endif
3157
3158                         if (p_ptr->free_act)
3159                         {
3160 #ifdef JP
3161 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3162 #else
3163                                 msg_print("You are unaffected!");
3164 #endif
3165
3166                         }
3167                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3168                         {
3169 #ifdef JP
3170 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3171 #else
3172                                 msg_format("You resist the effects!");
3173 #endif
3174
3175                         }
3176                         else
3177                         {
3178                                 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
3179                         }
3180                         learn_spell(MS_SLEEP);
3181                         update_smart_learn(m_idx, DRS_FREE);
3182                         break;
3183                 }
3184
3185                 /* RF6_HASTE */
3186                 case 160+0:
3187                 {
3188                         disturb(1, 0);
3189                         if (blind)
3190                         {
3191 #ifdef JP
3192 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3193 #else
3194                                 msg_format("%^s mumbles.", m_name);
3195 #endif
3196
3197                         }
3198                         else
3199                         {
3200 #ifdef JP
3201 msg_format("%^s¤¬¼«Ê¬¤ÎÂΤËÇ°¤òÁ÷¤Ã¤¿¡£", m_name, m_poss);
3202 #else
3203                                 msg_format("%^s concentrates on %s body.", m_name, m_poss);
3204 #endif
3205
3206                         }
3207
3208                         /* Allow quick speed increases to base+10 */
3209                         if (!m_ptr->fast)
3210                         {
3211 #ifdef JP
3212 msg_format("%^s¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
3213 #else
3214                                 msg_format("%^s starts moving faster.", m_name);
3215 #endif
3216                         }
3217                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
3218                         if (p_ptr->riding == m_idx) p_ptr->update |= PU_BONUS;
3219                         break;
3220                 }
3221
3222                 /* RF6_HAND_DOOM */
3223                 case 160+1:
3224                 {
3225                         if (x!=px || y!=py) return (FALSE);
3226                         disturb(1, 0);
3227 #ifdef JP
3228 msg_format("%^s¤¬ÇËÌǤμê¤òÊü¤Ã¤¿¡ª", m_name);
3229 #else
3230                         msg_format("%^s invokes the Hand of Doom!", m_name);
3231 #endif
3232                         dam = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
3233                         breath(y, x, m_idx, GF_HAND_DOOM, dam, 0, FALSE, MS_HAND_DOOM, learnable);
3234                         break;
3235                 }
3236
3237                 /* RF6_HEAL */
3238                 case 160+2:
3239                 {
3240                         disturb(1, 0);
3241
3242                         /* Message */
3243                         if (blind)
3244                         {
3245 #ifdef JP
3246 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3247 #else
3248                                 msg_format("%^s mumbles.", m_name);
3249 #endif
3250
3251                         }
3252                         else
3253                         {
3254 #ifdef JP
3255 msg_format("%^s¤¬¼«Ê¬¤Î½ý¤Ë½¸Ã椷¤¿¡£", m_name);
3256 #else
3257                                 msg_format("%^s concentrates on %s wounds.", m_name, m_poss);
3258 #endif
3259
3260                         }
3261
3262                         /* Heal some */
3263                         m_ptr->hp += (rlev * 6);
3264
3265                         /* Fully healed */
3266                         if (m_ptr->hp >= m_ptr->maxhp)
3267                         {
3268                                 /* Fully healed */
3269                                 m_ptr->hp = m_ptr->maxhp;
3270
3271                                 /* Message */
3272                                 if (seen)
3273                                 {
3274 #ifdef JP
3275 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¡ª", m_name);
3276 #else
3277                                         msg_format("%^s looks completely healed!", m_name);
3278 #endif
3279
3280                                 }
3281                                 else
3282                                 {
3283 #ifdef JP
3284 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¤è¤¦¤À¡ª", m_name);
3285 #else
3286                                         msg_format("%^s sounds completely healed!", m_name);
3287 #endif
3288
3289                                 }
3290                         }
3291
3292                         /* Partially healed */
3293                         else
3294                         {
3295                                 /* Message */
3296                                 if (seen)
3297                                 {
3298 #ifdef JP
3299 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3300 #else
3301                                         msg_format("%^s looks healthier.", m_name);
3302 #endif
3303
3304                                 }
3305                                 else
3306                                 {
3307 #ifdef JP
3308 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3309 #else
3310                                         msg_format("%^s sounds healthier.", m_name);
3311 #endif
3312
3313                                 }
3314                         }
3315
3316                         /* Redraw (later) if needed */
3317                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3318                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3319
3320                         /* Cancel fear */
3321                         if (m_ptr->monfear)
3322                         {
3323                                 /* Cancel fear */
3324                                 m_ptr->monfear = 0;
3325
3326                                 /* Message */
3327 #ifdef JP
3328 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name, m_poss);
3329 #else
3330                                 msg_format("%^s recovers %s courage.", m_name, m_poss);
3331 #endif
3332
3333                         }
3334                         break;
3335                 }
3336
3337                 /* RF6_INVULNER */
3338                 case 160+3:
3339                 {
3340                         disturb(1, 0);
3341
3342                         /* Message */
3343                         if (!seen)
3344                         {
3345 #ifdef JP
3346 msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3347 #else
3348                                 msg_format("%^s mumbles powerfully.", m_name);
3349 #endif
3350
3351                         }
3352                         else
3353                         {
3354 #ifdef JP
3355 msg_format("%s¤Ï̵½ý¤Îµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3356 #else
3357                                 msg_format("%^s casts a Globe of Invulnerability.", m_name);
3358 #endif
3359
3360                         }
3361
3362                         if (!(m_ptr->invulner))
3363                                 m_ptr->invulner = randint1(4) + 4;
3364
3365                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3366                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3367                         break;
3368                 }
3369
3370                 /* RF6_BLINK */
3371                 case 160+4:
3372                 {
3373                         disturb(1, 0);
3374 #ifdef JP
3375 msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
3376 #else
3377                         msg_format("%^s blinks away.", m_name);
3378 #endif
3379
3380                         teleport_away(m_idx, 10, FALSE);
3381                         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3382                         break;
3383                 }
3384
3385                 /* RF6_TPORT */
3386                 case 160+5:
3387                 {
3388                         int i, oldfy, oldfx;
3389                         u32b flgs[TR_FLAG_SIZE];
3390                         object_type *o_ptr;
3391
3392                         oldfy = m_ptr->fy;
3393                         oldfx = m_ptr->fx;
3394
3395                         disturb(1, 0);
3396 #ifdef JP
3397 msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
3398 #else
3399                         msg_format("%^s teleports away.", m_name);
3400 #endif
3401
3402                         teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
3403
3404                         if (los(py, px, oldfy, oldfx) && !world_monster)
3405                         {
3406                                 for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
3407                                 {
3408                                         o_ptr = &inventory[i];
3409                                         if(!cursed_p(o_ptr))
3410                                         {
3411                                                 object_flags(o_ptr, flgs);
3412
3413                                                 if((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
3414                                                 {
3415 #ifdef JP
3416                                                         if(get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3417 #else
3418                                                         if(get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
3419 #endif
3420                                                         {
3421                                                                 if (one_in_(3))
3422                                                                 {
3423                                                                         teleport_player(200);
3424 #ifdef JP
3425                                                                         msg_print("¼ºÇÔ¡ª");
3426 #else
3427                                                                         msg_print("Failed!");
3428 #endif
3429                                                                 }
3430                                                                 else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3431                                                                 p_ptr->energy_need += ENERGY_NEED();
3432                                                         }
3433                                                         break;
3434                                                 }
3435                                         }
3436                                 }
3437                         }
3438                         break;
3439                 }
3440
3441                 /* RF6_WORLD */
3442                 case 160+6:
3443                 {
3444                         int who = 0;
3445                         disturb(1, 0);
3446                         if(m_ptr->r_idx == MON_DIO) who = 1;
3447                         else if(m_ptr->r_idx == MON_WONG) who = 3;
3448                         dam = who;
3449                         if (!process_the_world(randint1(2)+2, who, TRUE)) return (FALSE);
3450                         break;
3451                 }
3452
3453                 /* RF6_SPECIAL */
3454                 case 160+7:
3455                 {
3456                         int k;
3457
3458                         disturb(1, 0);
3459                         switch(m_ptr->r_idx)
3460                         {
3461                         case MON_OHMU:
3462                                 if (p_ptr->inside_arena || p_ptr->inside_battle) return FALSE;
3463                                 for (k = 0; k < 6; k++)
3464                                 {
3465                                         count += summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_BIZARRE1, PM_ALLOW_GROUP);
3466                                 }
3467                                 return FALSE;
3468                                 
3469                         case MON_BANORLUPART:
3470                                 {
3471                                         int dummy_hp = (m_ptr->hp + 1) / 2;
3472                                         int dummy_maxhp = m_ptr->maxhp/2;
3473                                         int dummy_y = m_ptr->fy;
3474                                         int dummy_x = m_ptr->fx;
3475
3476                                         if (p_ptr->inside_arena || p_ptr->inside_battle || !summon_possible(m_ptr->fy, m_ptr->fx)) return FALSE;
3477                                         delete_monster_idx(cave[m_ptr->fy][m_ptr->fx].m_idx);
3478                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode);
3479                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3480                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3481                                         summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode);
3482                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3483                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3484
3485 #ifdef JP
3486                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡¦¥ë¥Ñ¡¼¥È¡Ù¤¬Ê¬Îö¤·¤¿¡ª");
3487 #else
3488                                         msg_print("Banor=Rupart splits in two person!");
3489 #endif
3490
3491                                         break;
3492                                 }
3493                                 case MON_BANOR:
3494                                 case MON_LUPART:
3495                                 {
3496                                         int dummy_hp = 0;
3497                                         int dummy_maxhp = 0;
3498                                         int dummy_y = m_ptr->fy;
3499                                         int dummy_x = m_ptr->fx;
3500
3501                                         if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return (FALSE);
3502                                         for (k = 1; k < m_max; k++)
3503                                         {
3504                                                 if (m_list[k].r_idx == MON_BANOR || m_list[k].r_idx == MON_LUPART)
3505                                                 {
3506                                                         dummy_hp += m_list[k].hp;
3507                                                         dummy_maxhp += m_list[k].maxhp;
3508                                                         if (m_list[k].r_idx != m_ptr->r_idx)
3509                                                         {
3510                                                                 dummy_y = m_list[k].fy;
3511                                                                 dummy_x = m_list[k].fx;
3512                                                         }
3513                                                         delete_monster_idx(k);
3514                                                 }
3515                                         }
3516                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode);
3517                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3518                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3519
3520 #ifdef JP
3521                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡Ù¤È¡Ø¥ë¥Ñ¡¼¥È¡Ù¤¬¹çÂΤ·¤¿¡ª");
3522 #else
3523                                         msg_print("Banor and Rupart combine into one!");
3524 #endif
3525
3526                                         break;
3527                                 }
3528
3529                         default:
3530                                 if (r_ptr->d_char == 'B')
3531                                 {
3532                                         if (!direct) break;
3533                                         disturb(1, 0);
3534                                         if (one_in_(3) || x!=px || y!=py)
3535                                         {
3536 #ifdef JP
3537                                                 msg_format("%^s¤ÏÆÍÁ³»ë³¦¤«¤é¾Ã¤¨¤¿!", m_name);
3538 #else
3539                                                 msg_format("%^s suddenly go out of your sight!", m_name);
3540 #endif
3541                                                 teleport_away(m_idx, 10, FALSE);
3542                                                 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3543                                                 break;
3544                                         }
3545                                         else
3546                                         {
3547                                                 int dam = damroll(4, 8);
3548                                                 int get_damage = 0;
3549 #ifdef JP
3550                                                 msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
3551 #else
3552                                                 msg_format("%^s holds you, and drops from the sky.", m_name);
3553 #endif
3554                                                 teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
3555
3556                                                 sound(SOUND_FALL);
3557
3558                                                 if (p_ptr->ffall)
3559                                                 {
3560 #ifdef JP
3561                                                         msg_print("¤¢¤Ê¤¿¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£");
3562 #else
3563                                                         msg_print("You float gently down to the ground.");
3564 #endif
3565                                                 }
3566                                                 else
3567                                                 {
3568 #ifdef JP
3569                                                         msg_print("¤¢¤Ê¤¿¤ÏÃÏÌ̤Ë᤭¤Ä¤±¤é¤ì¤¿¡£");
3570 #else
3571                                                         msg_print("You crashed into the ground.");
3572 #endif
3573                                                         dam += damroll(6, 8);
3574                                                 }
3575
3576                                                 /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
3577                                                    -- henkma
3578                                                  */
3579                                                 get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1);
3580                                                 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
3581                                                 {
3582 #ifdef JP
3583                                                         msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
3584 #else
3585                                                         char m_name_self[80];
3586                 
3587                                                         /* hisself */
3588                                                         monster_desc(m_name_self, m_ptr, 0x23);
3589
3590                                                         msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
3591 #endif
3592                                                         project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
3593                                                         set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
3594                                                 }
3595                                         }
3596                                         break;
3597                                 }
3598
3599                                 /* Something is wrong */
3600                                 else return FALSE;
3601                         }
3602                         break;
3603                 }
3604
3605                 /* RF6_TELE_TO */
3606                 case 160+8:
3607                 {
3608                         if (x!=px || y!=py) return (FALSE);
3609                         if (!direct) break;
3610                         disturb(1, 0);
3611 #ifdef JP
3612 msg_format("%^s¤¬¤¢¤Ê¤¿¤ò°ú¤­Ìᤷ¤¿¡£", m_name);
3613 #else
3614                         msg_format("%^s commands you to return.", m_name);
3615 #endif
3616
3617                         teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3618                         learn_spell(MS_TELE_TO);
3619                         break;
3620                 }
3621
3622                 /* RF6_TELE_AWAY */
3623                 case 160+9:
3624                 {
3625                         if (x!=px || y!=py) return (FALSE);
3626                         if (!direct) break;
3627                         disturb(1, 0);
3628 #ifdef JP
3629 msg_format("%^s¤Ë¥Æ¥ì¥Ý¡¼¥È¤µ¤»¤é¤ì¤¿¡£", m_name);
3630                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
3631                                 msg_print("¤¯¤Ã¤½¡Á");
3632 #else
3633                         msg_format("%^s teleports you away.", m_name);
3634 #endif
3635
3636                         learn_spell(MS_TELE_AWAY);
3637                         teleport_player(100);
3638                         break;
3639                 }
3640
3641                 /* RF6_TELE_LEVEL */
3642                 case 160+10:
3643                 {
3644                         if (x!=px || y!=py) return (FALSE);
3645                         if (!direct) break;
3646                         disturb(1, 0);
3647 #ifdef JP
3648 if (blind) msg_format("%^s¤¬²¿¤«´ñ̯¤Ê¸ÀÍÕ¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3649 #else
3650                         if (blind) msg_format("%^s mumbles strangely.", m_name);
3651 #endif
3652
3653 #ifdef JP
3654 else msg_format("%^s¤¬¤¢¤Ê¤¿¤Î­¤ò»Ø¤µ¤·¤¿¡£", m_name);
3655 #else
3656                         else msg_format("%^s gestures at your feet.", m_name);
3657 #endif
3658
3659                         if (p_ptr->resist_nexus)
3660                         {
3661 #ifdef JP
3662 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3663 #else
3664                                 msg_print("You are unaffected!");
3665 #endif
3666
3667                         }
3668                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3669                         {
3670 #ifdef JP
3671 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3672 #else
3673                                 msg_print("You resist the effects!");
3674 #endif
3675
3676                         }
3677                         else
3678                         {
3679                                 teleport_player_level();
3680                         }
3681                         learn_spell(MS_TELE_LEVEL);
3682                         update_smart_learn(m_idx, DRS_NEXUS);
3683                         break;
3684                 }
3685
3686                 /* RF6_PSY_SPEAR */
3687                 case 160+11:
3688                 {
3689                         if (x!=px || y!=py) return (FALSE);
3690                         disturb(1, 0);
3691 #ifdef JP
3692 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3693 #else
3694                         if (blind) msg_format("%^s mumbles.", m_name);
3695 #endif
3696
3697 #ifdef JP
3698 else msg_format("%^s¤¬¸÷¤Î·õ¤òÊü¤Ã¤¿¡£", m_name);
3699 #else
3700                         else msg_format("%^s throw a Psycho-Spear.", m_name);
3701 #endif
3702
3703                         dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 150) : (randint1(rlev * 3 / 2) + 100);
3704                         beam(m_idx, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, learnable);
3705                         break;
3706                 }
3707
3708                 /* RF6_DARKNESS */
3709                 case 160+12:
3710                 {
3711                         if (x!=px || y!=py) return (FALSE);
3712                         if (!direct) break;
3713                         disturb(1, 0);
3714 #ifdef JP
3715 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3716 #else
3717                         if (blind) msg_format("%^s mumbles.", m_name);
3718 #endif
3719
3720 #ifdef JP
3721 else if (p_ptr->pclass == CLASS_NINJA) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
3722 else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
3723 #else
3724                         else if (p_ptr->pclass == CLASS_NINJA)
3725                                 msg_format("%^s cast a spell to light up.", m_name);
3726                         else msg_format("%^s gestures in shadow.", m_name);
3727 #endif
3728
3729                         learn_spell(MS_DARKNESS);
3730                         if (p_ptr->pclass == CLASS_NINJA)
3731                                 (void)lite_area(0, 3);
3732                         else
3733                                 (void)unlite_area(0, 3);
3734                         break;
3735                 }
3736
3737                 /* RF6_TRAPS */
3738                 case 160+13:
3739                 {
3740                         if (!direct) break;
3741                         disturb(1, 0);
3742 #ifdef JP
3743 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3744 #else
3745                         if (blind) msg_format("%^s mumbles, and then cackles evilly.", m_name);
3746 #endif
3747
3748 #ifdef JP
3749 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3750 #else
3751                         else msg_format("%^s casts a spell and cackles evilly.", m_name);
3752 #endif
3753
3754                         learn_spell(MS_MAKE_TRAP);
3755                         (void)trap_creation(y, x);
3756                         break;
3757                 }
3758
3759                 /* RF6_FORGET */
3760                 case 160+14:
3761                 {
3762                         if (x!=px || y!=py) return (FALSE);
3763                         if (!direct) break;
3764                         disturb(1, 0);
3765 #ifdef JP
3766 msg_format("%^s¤¬¤¢¤Ê¤¿¤Îµ­²±¤ò¾Ãµî¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", m_name);
3767 #else
3768                         msg_format("%^s tries to blank your mind.", m_name);
3769 #endif
3770
3771
3772                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3773                         {
3774 #ifdef JP
3775 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3776 #else
3777                                 msg_print("You resist the effects!");
3778 #endif
3779
3780                         }
3781                         else if (lose_all_info())
3782                         {
3783 #ifdef JP
3784 msg_print("µ­²±¤¬Çö¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
3785 #else
3786                                 msg_print("Your memories fade away.");
3787 #endif
3788
3789                         }
3790                         learn_spell(MS_FORGET);
3791                         break;
3792                 }
3793
3794                 /* RF6_RAISE_DEAD */
3795                 case 160+15:
3796                 {
3797                         disturb(1, 0);
3798 #ifdef JP
3799 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3800 #else
3801                         if (blind) msg_format("%^s mumbles.", m_name);
3802 #endif
3803
3804 #ifdef JP
3805 else msg_format("%^s¤¬»à¼ÔÉü³è¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3806 #else
3807                         else msg_format("%^s casts a spell to revive corpses.", m_name);
3808 #endif
3809                         animate_dead(m_idx, m_ptr->fy, m_ptr->fx);
3810                         break;
3811                 }
3812
3813                 /* RF6_SUMMON_KIN */
3814                 case 160+16:
3815                 {
3816                         disturb(1, 0);
3817                         if (m_ptr->r_idx == MON_ROLENTO)
3818                         {
3819 #ifdef JP
3820                                 if (blind)
3821                                         msg_format("%^s¤¬²¿¤«ÂçÎ̤ËÅꤲ¤¿¡£", m_name);
3822                                 else 
3823                                         msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
3824 #else
3825                                 if (blind)
3826                                         msg_format("%^s spreads something.", m_name);
3827                                 else
3828                                         msg_format("%^s throws some hand grenades.", m_name);
3829 #endif
3830                         }
3831                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3832                         {
3833 #ifdef JP
3834                                 if (blind)
3835                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3836                                 else
3837                                         msg_format("%^s¤¬¥À¥ó¥¸¥ç¥ó¤Î¼ç¤ò¾¤´­¤·¤¿¡£", m_name);
3838 #else
3839                                 if (blind)
3840                                         msg_format("%^s mumbles.", m_name);
3841                                 else
3842                                         msg_format("%^s magically summons guardians of dungeons.", m_name);
3843 #endif
3844                         }
3845                         else
3846                         {
3847 #ifdef JP
3848                                 if (blind)
3849                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3850                                 else
3851                                         msg_format("%^s¤ÏËâË¡¤Ç%s¤ò¾¤´­¤·¤¿¡£",
3852                                         m_name,
3853                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3854                                         "¼ê²¼" : "Ãç´Ö"));
3855 #else
3856                                 if (blind)
3857                                         msg_format("%^s mumbles.", m_name);
3858                                 else
3859                                         msg_format("%^s magically summons %s %s.",
3860                                         m_name, m_poss,
3861                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3862                                         "minions" : "kin"));
3863 #endif
3864                         }
3865
3866                         if(m_ptr->r_idx == MON_ROLENTO)
3867                         {
3868                                 int num = 1 + randint1(3);
3869
3870                                 for (k = 0; k < num; k++)
3871                                 {
3872                                         count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
3873                                 }
3874                         }
3875                         else if(m_ptr->r_idx == MON_THORONDOR ||
3876                                 m_ptr->r_idx == MON_GWAIHIR ||
3877                                 m_ptr->r_idx == MON_MENELDOR)
3878                         {
3879                                 int num = 4 + randint1(3);
3880                                 for (k = 0; k < num; k++)
3881                                 {
3882                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3883                                 }
3884                         }
3885                         else if(m_ptr->r_idx == MON_LOUSY)
3886                         {
3887                                 int num = 2 + randint1(3);
3888                                 for (k = 0; k < num; k++)
3889                                 {
3890                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
3891                                 }
3892                         }
3893                         else if(m_ptr->r_idx == MON_BULLGATES)
3894                         {
3895                                 int num = 2 + randint1(3);
3896                                 for (k = 0; k < num; k++)
3897                                 {
3898                                         count += summon_named_creature(m_idx, y, x, 921, mode);
3899                                 }
3900                         }
3901                         else if (m_ptr->r_idx == MON_CALDARM)
3902                         {
3903                                 int num = randint1(3);
3904                                 for (k = 0; k < num; k++)
3905                                 {
3906                                         count += summon_named_creature(m_idx, y, x, 930, mode);
3907                                 }
3908                         }
3909                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3910                         {
3911                                 int num = 2 + randint1(3);
3912
3913                                 if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
3914                                 {
3915 #ifdef JP
3916                                         msg_print("ÃÏÌ̤«¤é¿å¤¬¿á¤­½Ð¤·¤¿¡ª");
3917 #else
3918                                         msg_print("Water blew off from the ground!");
3919 #endif
3920                                         fire_ball_hide(GF_WATER_FLOW, 0, 3, 8);
3921                                 }
3922
3923                                 for (k = 0; k < num; k++)
3924                                 {
3925                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3926                                 }
3927                         }
3928                         else
3929                         {
3930
3931                                 summon_kin_type = r_ptr->d_char; /* Big hack */
3932
3933                                 for (k = 0; k < 4; k++)
3934                                 {
3935                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, PM_ALLOW_GROUP);
3936                                 }
3937                         }
3938 #ifdef JP
3939 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
3940 #else
3941                         if (blind && count) msg_print("You hear many things appear nearby.");
3942 #endif
3943
3944
3945                         break;
3946                 }
3947
3948                 /* RF6_S_CYBER */
3949                 case 160+17:
3950                 {
3951                         disturb(1, 0);
3952 #ifdef JP
3953 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3954 #else
3955                         if (blind) msg_format("%^s mumbles.", m_name);
3956 #endif
3957
3958 #ifdef JP
3959 else msg_format("%^s¤¬¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
3960 #else
3961                         else msg_format("%^s magically summons Cyberdemons!", m_name);
3962 #endif
3963
3964 #ifdef JP
3965 if (blind && count) msg_print("½Å¸ü¤Ê­²»¤¬¶á¤¯¤Çʹ¤³¤¨¤ë¡£");
3966 #else
3967                         if (blind && count) msg_print("You hear heavy steps nearby.");
3968 #endif
3969
3970                         summon_cyber(m_idx, y, x);
3971                         break;
3972                 }
3973
3974                 /* RF6_S_MONSTER */
3975                 case 160+18:
3976                 {
3977                         disturb(1, 0);
3978 #ifdef JP
3979 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3980 #else
3981                         if (blind) msg_format("%^s mumbles.", m_name);
3982 #endif
3983
3984 #ifdef JP
3985 else msg_format("%^s¤¬ËâË¡¤ÇÃç´Ö¤ò¾¤´­¤·¤¿¡ª", m_name);
3986 #else
3987                         else msg_format("%^s magically summons help!", m_name);
3988 #endif
3989
3990                         for (k = 0; k < 1; k++)
3991                         {
3992                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3993                         }
3994 #ifdef JP
3995 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
3996 #else
3997                         if (blind && count) msg_print("You hear something appear nearby.");
3998 #endif
3999
4000                         break;
4001                 }
4002
4003                 /* RF6_S_MONSTERS */
4004                 case 160+19:
4005                 {
4006                         disturb(1, 0);
4007 #ifdef JP
4008 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4009 #else
4010                         if (blind) msg_format("%^s mumbles.", m_name);
4011 #endif
4012
4013 #ifdef JP
4014 else msg_format("%^s¤¬ËâË¡¤Ç¥â¥ó¥¹¥¿¡¼¤ò¾¤´­¤·¤¿¡ª", m_name);
4015 #else
4016                         else msg_format("%^s magically summons monsters!", m_name);
4017 #endif
4018
4019                         for (k = 0; k < s_num_6; k++)
4020                         {
4021                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4022                         }
4023 #ifdef JP
4024 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4025 #else
4026                         if (blind && count) msg_print("You hear many things appear nearby.");
4027 #endif
4028
4029                         break;
4030                 }
4031
4032                 /* RF6_S_ANT */
4033                 case 160+20:
4034                 {
4035                         disturb(1, 0);
4036 #ifdef JP
4037 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4038 #else
4039                         if (blind) msg_format("%^s mumbles.", m_name);
4040 #endif
4041
4042 #ifdef JP
4043 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ê¤ò¾¤´­¤·¤¿¡£", m_name);
4044 #else
4045                         else msg_format("%^s magically summons ants.", m_name);
4046 #endif
4047
4048                         for (k = 0; k < s_num_6; k++)
4049                         {
4050                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, PM_ALLOW_GROUP);
4051                         }
4052 #ifdef JP
4053 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4054 #else
4055                         if (blind && count) msg_print("You hear many things appear nearby.");
4056 #endif
4057
4058                         break;
4059                 }
4060
4061                 /* RF6_S_SPIDER */
4062                 case 160+21:
4063                 {
4064                         disturb(1, 0);
4065 #ifdef JP
4066 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4067 #else
4068                         if (blind) msg_format("%^s mumbles.", m_name);
4069 #endif
4070
4071 #ifdef JP
4072 else msg_format("%^s¤¬ËâË¡¤Ç¥¯¥â¤ò¾¤´­¤·¤¿¡£", m_name);
4073 #else
4074                         else msg_format("%^s magically summons spiders.", m_name);
4075 #endif
4076
4077                         for (k = 0; k < s_num_6; k++)
4078                         {
4079                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, PM_ALLOW_GROUP);
4080                         }
4081 #ifdef JP
4082 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4083 #else
4084                         if (blind && count) msg_print("You hear many things appear nearby.");
4085 #endif
4086
4087                         break;
4088                 }
4089
4090                 /* RF6_S_HOUND */
4091                 case 160+22:
4092                 {
4093                         disturb(1, 0);
4094 #ifdef JP
4095 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4096 #else
4097                         if (blind) msg_format("%^s mumbles.", m_name);
4098 #endif
4099
4100 #ifdef JP
4101 else msg_format("%^s¤¬ËâË¡¤Ç¥Ï¥¦¥ó¥É¤ò¾¤´­¤·¤¿¡£", m_name);
4102 #else
4103                         else msg_format("%^s magically summons hounds.", m_name);
4104 #endif
4105
4106                         for (k = 0; k < s_num_4; k++)
4107                         {
4108                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, PM_ALLOW_GROUP);
4109                         }
4110 #ifdef JP
4111 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4112 #else
4113                         if (blind && count) msg_print("You hear many things appear nearby.");
4114 #endif
4115
4116                         break;
4117                 }
4118
4119                 /* RF6_S_HYDRA */
4120                 case 160+23:
4121                 {
4122                         disturb(1, 0);
4123 #ifdef JP
4124 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4125 #else
4126                         if (blind) msg_format("%^s mumbles.", m_name);
4127 #endif
4128
4129 #ifdef JP
4130 else msg_format("%^s¤¬ËâË¡¤Ç¥Ò¥É¥é¤ò¾¤´­¤·¤¿¡£", m_name);
4131 #else
4132                         else msg_format("%^s magically summons hydras.", m_name);
4133 #endif
4134
4135                         for (k = 0; k < s_num_4; k++)
4136                         {
4137                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, PM_ALLOW_GROUP);
4138                         }
4139 #ifdef JP
4140 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4141 #else
4142                         if (blind && count) msg_print("You hear many things appear nearby.");
4143 #endif
4144
4145                         break;
4146                 }
4147
4148                 /* RF6_S_ANGEL */
4149                 case 160+24:
4150                 {
4151                         int num = 1;
4152
4153                         disturb(1, 0);
4154 #ifdef JP
4155 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4156 #else
4157                         if (blind) msg_format("%^s mumbles.", m_name);
4158 #endif
4159
4160 #ifdef JP
4161 else msg_format("%^s¤¬ËâË¡¤ÇÅ·»È¤ò¾¤´­¤·¤¿¡ª", m_name);
4162 #else
4163                         else msg_format("%^s magically summons an angel!", m_name);
4164 #endif
4165
4166                         if ((r_ptr->flags1 & RF1_UNIQUE) && !easy_band)
4167                         {
4168                                 num += r_ptr->level/40;
4169                         }
4170
4171                         for (k = 0; k < num; k++)
4172                         {
4173                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, PM_ALLOW_GROUP);
4174                         }
4175
4176                         if (count < 2)
4177                         {
4178 #ifdef JP
4179 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4180 #else
4181                                 if (blind && count) msg_print("You hear something appear nearby.");
4182 #endif
4183                         }
4184                         else
4185                         {
4186 #ifdef JP
4187 if (blind) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4188 #else
4189                                 if (blind) msg_print("You hear many things appear nearby.");
4190 #endif
4191                         }
4192
4193                         break;
4194                 }
4195
4196                 /* RF6_S_DEMON */
4197                 case 160+25:
4198                 {
4199                         disturb(1, 0);
4200 #ifdef JP
4201 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4202 #else
4203                         if (blind) msg_format("%^s mumbles.", m_name);
4204 #endif
4205
4206 #ifdef JP
4207 else msg_format("%^s¤ÏËâË¡¤Çº®Æ٤εÜÄ¤é°­Ëâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4208 #else
4209                         else msg_format("%^s magically summons a demon from the Courts of Chaos!", m_name);
4210 #endif
4211
4212                         for (k = 0; k < 1; k++)
4213                         {
4214                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, PM_ALLOW_GROUP);
4215                         }
4216 #ifdef JP
4217 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4218 #else
4219                         if (blind && count) msg_print("You hear something appear nearby.");
4220 #endif
4221
4222                         break;
4223                 }
4224
4225                 /* RF6_S_UNDEAD */
4226                 case 160+26:
4227                 {
4228                         disturb(1, 0);
4229 #ifdef JP
4230 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4231 #else
4232                         if (blind) msg_format("%^s mumbles.", m_name);
4233 #endif
4234
4235 #ifdef JP
4236 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤Î¶¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4237 #else
4238                         else msg_format("%^s magically summons an undead adversary!", m_name);
4239 #endif
4240
4241                         for (k = 0; k < 1; k++)
4242                         {
4243                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, PM_ALLOW_GROUP);
4244                         }
4245 #ifdef JP
4246 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4247 #else
4248                         if (blind && count) msg_print("You hear something appear nearby.");
4249 #endif
4250
4251                         break;
4252                 }
4253
4254                 /* RF6_S_DRAGON */
4255                 case 160+27:
4256                 {
4257                         disturb(1, 0);
4258 #ifdef JP
4259 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4260 #else
4261                         if (blind) msg_format("%^s mumbles.", m_name);
4262 #endif
4263
4264 #ifdef JP
4265 else msg_format("%^s¤¬ËâË¡¤Ç¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4266 #else
4267                         else msg_format("%^s magically summons a dragon!", m_name);
4268 #endif
4269
4270                         for (k = 0; k < 1; k++)
4271                         {
4272                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, PM_ALLOW_GROUP);
4273                         }
4274 #ifdef JP
4275 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4276 #else
4277                         if (blind && count) msg_print("You hear something appear nearby.");
4278 #endif
4279
4280                         break;
4281                 }
4282
4283                 /* RF6_S_HI_UNDEAD */
4284                 case 160+28:
4285                 {
4286                         disturb(1, 0);
4287
4288                         if (((m_ptr->r_idx == MON_MORGOTH) || (m_ptr->r_idx == MON_SAURON) || (m_ptr->r_idx == MON_ANGMAR)) && ((r_info[MON_NAZGUL].cur_num+2) < r_info[MON_NAZGUL].max_num))
4289                         {
4290                                 int cy = y;
4291                                 int cx = x;
4292
4293 #ifdef JP
4294 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4295 #else
4296                                 if (blind) msg_format("%^s mumbles.", m_name);
4297 #endif
4298
4299 #ifdef JP
4300 else msg_format("%^s¤¬ËâË¡¤ÇÍ©µ´ÀïÂâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4301 #else
4302                                 else msg_format("%^s magically summons rangers of Nazgul!", m_name);
4303 #endif
4304                                 msg_print(NULL);
4305
4306                                 for (k = 0; k < 30; k++)
4307                                 {
4308                                         if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx))
4309                                         {
4310                                                 int j;
4311                                                 for (j = 100; j > 0; j--)
4312                                                 {
4313                                                         scatter(&cy, &cx, y, x, 2, 0);
4314                                                         if (cave_floor_bold(cy, cx)) break;
4315                                                 }
4316                                                 if (!j) break;
4317                                         }
4318                                         if (!cave_floor_bold(cy, cx)) continue;
4319
4320                                         if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
4321                                         {
4322                                                 y = cy;
4323                                                 x = cx;
4324                                                 count++;
4325                                                 if (count == 1)
4326 #ifdef JP
4327 msg_format("¡ÖÍ©µ´ÀïÂâ%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4328 #else
4329                                                         msg_format("A Nazgul says 'Nazgul-Rangers Number %d, Nazgul-Black!'",count);
4330 #endif
4331                                                 else
4332 #ifdef JP
4333 msg_format("¡ÖƱ¤¸¤¯%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4334 #else
4335                                                         msg_format("Another one says 'Number %d, Nazgul-Black!'",count);
4336 #endif
4337                                                 msg_print(NULL);
4338                                         }
4339                                 }
4340 #ifdef JP
4341 msg_format("¡Ö%dɤ¤½¤í¤Ã¤Æ¡¢¥ê¥ó¥°¥ì¥ó¥¸¥ã¡¼¡ª¡×", count);
4342 #else
4343 msg_format("They say 'The %d meets! We are the Ring-Ranger!'.", count);
4344 #endif
4345                                 msg_print(NULL);
4346                         }
4347                         else
4348                         {
4349 #ifdef JP
4350 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4351 #else
4352                                 if (blind) msg_format("%^s mumbles.", m_name);
4353 #endif
4354
4355 #ifdef JP
4356 else msg_format("%^s¤¬ËâË¡¤Ç¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡ª", m_name);
4357 #else
4358                                 else msg_format("%^s magically summons greater undead!", m_name);
4359 #endif
4360
4361                                 for (k = 0; k < s_num_6; k++)
4362                                 {
4363                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4364                                 }
4365                         }
4366                         if (blind && count)
4367                         {
4368 #ifdef JP
4369 msg_print("´Ö¶á¤Ç²¿¤«Â¿¤¯¤Î¤â¤Î¤¬Ç礤²ó¤ë²»¤¬Ê¹¤³¤¨¤ë¡£");
4370 #else
4371                                 msg_print("You hear many creepy things appear nearby.");
4372 #endif
4373
4374                         }
4375                         break;
4376                 }
4377
4378                 /* RF6_S_HI_DRAGON */
4379                 case 160+29:
4380                 {
4381                         disturb(1, 0);
4382 #ifdef JP
4383 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4384 #else
4385                         if (blind) msg_format("%^s mumbles.", m_name);
4386 #endif
4387
4388 #ifdef JP
4389 else msg_format("%^s¤¬ËâË¡¤Ç¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4390 #else
4391                         else msg_format("%^s magically summons ancient dragons!", m_name);
4392 #endif
4393
4394                         for (k = 0; k < s_num_4; k++)
4395                         {
4396                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4397                         }
4398                         if (blind && count)
4399                         {
4400 #ifdef JP
4401 msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
4402 #else
4403                                 msg_print("You hear many powerful things appear nearby.");
4404 #endif
4405
4406                         }
4407                         break;
4408                 }
4409
4410                 /* RF6_S_AMBERITES */
4411                 case 160+30:
4412                 {
4413                         disturb(1, 0);
4414 #ifdef JP
4415 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4416 #else
4417                         if (blind) msg_format("%^s mumbles.", m_name);
4418 #endif
4419
4420 #ifdef JP
4421 else msg_format("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ò¾¤´­¤·¤¿¡ª", m_name);
4422 #else
4423                         else msg_format("%^s magically summons Lords of Amber!", m_name);
4424 #endif
4425
4426
4427
4428                         for (k = 0; k < s_num_4; k++)
4429                         {
4430                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4431                         }
4432                         if (blind && count)
4433                         {
4434 #ifdef JP
4435 msg_print("ÉÔ»à¤Î¼Ô¤¬¶á¤¯¤Ë¸½¤ì¤ë¤Î¤¬Ê¹¤³¤¨¤¿¡£");
4436 #else
4437                                 msg_print("You hear immortal beings appear nearby.");
4438 #endif
4439
4440                         }
4441                         break;
4442                 }
4443
4444                 /* RF6_S_UNIQUE */
4445                 case 160+31:
4446                 {
4447                         disturb(1, 0);
4448 #ifdef JP
4449 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4450 #else
4451                         if (blind) msg_format("%^s mumbles.", m_name);
4452 #endif
4453
4454 #ifdef JP
4455 else msg_format("%^s¤¬ËâË¡¤ÇÆÃÊ̤ʶ¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4456 #else
4457                         else msg_format("%^s magically summons special opponents!", m_name);
4458 #endif
4459
4460                         for (k = 0; k < s_num_4; k++)
4461                         {
4462                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4463                         }
4464                         if (r_ptr->flags3 & RF3_GOOD)
4465                         {
4466                                 for (k = count; k < s_num_4; k++)
4467                                 {
4468                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4469                                 }
4470                         }
4471                         else
4472                         {
4473                                 for (k = count; k < s_num_4; k++)
4474                                 {
4475                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4476                                 }
4477                         }
4478                         if (blind && count)
4479                         {
4480 #ifdef JP
4481 msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
4482 #else
4483                                 msg_print("You hear many powerful things appear nearby.");
4484 #endif
4485
4486                         }
4487                         break;
4488                 }
4489         }
4490
4491         if ((p_ptr->action == ACTION_LEARN) && thrown_spell > 175)
4492         {
4493                 learn_spell(thrown_spell - 96);
4494         }
4495
4496         if (seen && maneable && !world_monster && (p_ptr->pclass == CLASS_IMITATOR))
4497         {
4498                 if (thrown_spell != 167)
4499                 {
4500                         if (p_ptr->mane_num == MAX_MANE)
4501                         {
4502                                 int i;
4503                                 p_ptr->mane_num--;
4504                                 for (i = 0;i < p_ptr->mane_num;i++)
4505                                 {
4506                                         p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
4507                                         p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
4508                                 }
4509                         }
4510                         p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
4511                         p_ptr->mane_dam[p_ptr->mane_num] = dam;
4512                         p_ptr->mane_num++;
4513                         new_mane = TRUE;
4514
4515                         p_ptr->redraw |= (PR_MANE);
4516                 }
4517         }
4518
4519         /* Remember what the monster did to us */
4520         if (seen)
4521         {
4522                 /* Inate spell */
4523                 if (thrown_spell < 32 * 4)
4524                 {
4525                         r_ptr->r_flags4 |= (1L << (thrown_spell - 32 * 3));
4526                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4527                 }
4528
4529                 /* Bolt or Ball */
4530                 else if (thrown_spell < 32 * 5)
4531                 {
4532                         r_ptr->r_flags5 |= (1L << (thrown_spell - 32 * 4));
4533                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4534                 }
4535
4536                 /* Special spell */
4537                 else if (thrown_spell < 32 * 6)
4538                 {
4539                         r_ptr->r_flags6 |= (1L << (thrown_spell - 32 * 5));
4540                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4541                 }
4542         }
4543
4544
4545         /* Always take note of monsters that kill you */
4546         if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
4547         {
4548                 r_ptr->r_deaths++;
4549         }
4550
4551         /* A spell was cast */
4552         return (TRUE);
4553 }