OSDN Git Service

c_ptr->mimicを活用する一連の改造:
[hengband/hengband.git] / src / mspells1.c
1 /* File: mspells1.c */
2
3 /* Purpose: Monster spells (attack player) */
4
5 /*
6  * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
7  *
8  * This software may be copied and distributed for educational, research, and
9  * not for profit purposes provided that this copyright and statement are
10  * included in all such copies.
11  */
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 (!((p_ptr->prace == 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, chance, 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 "normal" target */
1264         bool normal = TRUE;
1265
1266         /* Assume "projectable" */
1267         bool direct = TRUE;
1268
1269         /* Cannot cast spells when confused */
1270         if (m_ptr->confused)
1271         {
1272                 reset_target(m_ptr);
1273                 return (FALSE);
1274         }
1275
1276         /* Cannot cast spells when nice */
1277         if (m_ptr->mflag & MFLAG_NICE) return (FALSE);
1278         if (!is_hostile(m_ptr)) return (FALSE);
1279
1280         /* Hack -- Extract the spell probability */
1281         chance = (r_ptr->freq_inate + r_ptr->freq_spell) / 2;
1282
1283         /* Not allowed to cast spells */
1284         if (!chance) return (FALSE);
1285
1286
1287         if (stupid_monsters)
1288         {
1289                 /* Only do spells occasionally */
1290                 if (randint0(100) >= chance) return (FALSE);
1291         }
1292         else
1293         {
1294                 if (randint0(100) >=  chance) return (FALSE);
1295
1296                 /* Sometimes forbid inate attacks (breaths) */
1297                 if (randint0(100) >= (chance * 2)) no_inate = TRUE;
1298         }
1299
1300         /* XXX XXX XXX Handle "track_target" option (?) */
1301
1302
1303         /* Extract the racial spell flags */
1304         f4 = r_ptr->flags4;
1305         f5 = r_ptr->flags5;
1306         f6 = r_ptr->flags6;
1307
1308         /* Hack -- require projectable player */
1309         if (normal)
1310         {
1311                 /* Check range */
1312                 if ((m_ptr->cdis > MAX_RANGE) && !m_ptr->target_y) return (FALSE);
1313
1314                 /* Check path */
1315                 if (projectable(m_ptr->fy, m_ptr->fx, y, x))
1316                 {
1317                         /* Breath disintegration to the glyph */
1318                         if ((!cave_floor_bold(y,x)) && (r_ptr->flags4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
1319                 }
1320
1321                 /* Check path to next grid */
1322                 else
1323                 {
1324                         bool success = FALSE;
1325
1326                         if ((r_ptr->flags4 & RF4_BR_DISI) &&
1327                             (m_ptr->cdis < MAX_RANGE/2) &&
1328                             in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
1329                             (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
1330                         {
1331                                 do_disi = TRUE;
1332                                 success = TRUE;
1333                         }
1334                         else
1335                         {
1336                                 int i;
1337                                 int tonari;
1338                                 int tonari_y[4][8] = {{-1,-1,-1,0,0,1,1,1},
1339                                                       {-1,-1,-1,0,0,1,1,1},
1340                                                       {1,1,1,0,0,-1,-1,-1},
1341                                                       {1,1,1,0,0,-1,-1,-1}};
1342                                 int tonari_x[4][8] = {{-1,0,1,-1,1,-1,0,1},
1343                                                       {1,0,-1,1,-1,1,0,-1},
1344                                                       {-1,0,1,-1,1,-1,0,1},
1345                                                       {1,0,-1,1,-1,1,0,-1}};
1346
1347                                 if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
1348                                 else if (m_ptr->fy < py) tonari = 1;
1349                                 else if (m_ptr->fx < px) tonari = 2;
1350                                 else tonari = 3;
1351
1352                                 for (i = 0; i < 8; i++)
1353                                 {
1354                                         int next_x = x + tonari_x[tonari][i];
1355                                         int next_y = y + tonari_y[tonari][i];
1356                                         cave_type *c_ptr;
1357
1358                                         /* Access the next grid */
1359                                         c_ptr = &cave[next_y][next_x];
1360
1361                                         /* Skip door, rubble, wall */
1362                                         if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
1363
1364                                         /* Skip tree */
1365                                         if (c_ptr->feat == FEAT_TREES) continue;
1366
1367                                         /* Skip mountain */
1368                                         if (c_ptr->feat == FEAT_MOUNTAIN) continue;
1369
1370                                         if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
1371                                         {
1372                                                 y = next_y;
1373                                                 x = next_x;
1374                                                 success = TRUE;
1375                                                 break;
1376                                         }
1377                                 }
1378                         }
1379
1380                         if (!success)
1381                         {
1382                                 if (m_ptr->target_y && m_ptr->target_x)
1383                                 {
1384                                         y = m_ptr->target_y;
1385                                         x = m_ptr->target_x;
1386                                         f4 &= (RF4_INDIRECT_MASK);
1387                                         f5 &= (RF5_INDIRECT_MASK);
1388                                         f6 &= (RF6_INDIRECT_MASK);
1389                                         success = TRUE;
1390                                 }
1391                         }
1392
1393                         /* No spells */
1394                         if (!success) return FALSE;
1395                 }
1396         }
1397
1398         reset_target(m_ptr);
1399
1400         /* Extract the monster level */
1401         rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
1402
1403         if (!stupid_monsters)
1404         {
1405                 /* Forbid inate attacks sometimes */
1406                 if (no_inate) f4 &= 0x500000FF;
1407         }
1408
1409         if (!p_ptr->csp)
1410         {
1411                 f5 &= ~(RF5_DRAIN_MANA);
1412         }
1413         if ((p_ptr->pclass == CLASS_NINJA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)))
1414         {
1415                 f6 &= ~(RF6_DARKNESS);
1416         }
1417
1418         if (dun_level && (!p_ptr->inside_quest || (p_ptr->inside_quest < MIN_RANDOM_QUEST)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
1419         {
1420                 f4 &= (RF4_NOMAGIC_MASK);
1421                 f5 &= (RF5_NOMAGIC_MASK);
1422                 f6 &= (RF6_NOMAGIC_MASK);
1423         }
1424
1425         /* Hack -- allow "desperate" spells */
1426         if ((r_ptr->flags2 & (RF2_SMART)) &&
1427                 (m_ptr->hp < m_ptr->maxhp / 10) &&
1428                 (randint0(100) < 50))
1429         {
1430                 /* Require intelligent spells */
1431                 f4 &= (RF4_INT_MASK);
1432                 f5 &= (RF5_INT_MASK);
1433                 f6 &= (RF6_INT_MASK);
1434
1435                 /* No spells left */
1436                 if (!f4 && !f5 && !f6) return (FALSE);
1437         }
1438
1439         /* Remove the "ineffective" spells */
1440         remove_bad_spells(m_idx, &f4, &f5, &f6);
1441
1442         if (p_ptr->inside_arena)
1443         {
1444                 f4 &= ~(RF4_SUMMON_MASK);
1445                 f5 &= ~(RF5_SUMMON_MASK);
1446                 f6 &= ~(RF6_SUMMON_MASK);
1447         }
1448
1449         /* No spells left */
1450         if (!f4 && !f5 && !f6) return (FALSE);
1451
1452         if (!stupid_monsters)
1453         {
1454                 /* Check for a clean bolt shot */
1455                 if (((f4 & RF4_BOLT_MASK) ||
1456                      (f5 & RF5_BOLT_MASK) ||
1457                      (f6 & RF6_BOLT_MASK)) &&
1458                      !(r_ptr->flags2 & RF2_STUPID) &&
1459                      !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
1460                 {
1461                         /* Remove spells that will only hurt friends */
1462                         f4 &= ~(RF4_BOLT_MASK);
1463                         f5 &= ~(RF5_BOLT_MASK);
1464                         f6 &= ~(RF6_BOLT_MASK);
1465                 }
1466
1467                 /* Check for a possible summon */
1468                 if (((f4 & RF4_SUMMON_MASK) ||
1469                      (f5 & RF5_SUMMON_MASK) ||
1470                      (f6 & RF6_SUMMON_MASK)) &&
1471                      !(r_ptr->flags2 & RF2_STUPID) &&
1472                      !(summon_possible(y, x)))
1473                 {
1474                         /* Remove summoning spells */
1475                         f4 &= ~(RF4_SUMMON_MASK);
1476                         f5 &= ~(RF5_SUMMON_MASK);
1477                         f6 &= ~(RF6_SUMMON_MASK);
1478                 }
1479
1480                 /* No spells left */
1481                 if (!f4 && !f5 && !f6) return (FALSE);
1482         }
1483
1484         /* Extract the "inate" spells */
1485         for (k = 0; k < 32; k++)
1486         {
1487                 if (f4 & (1L << k)) spell[num++] = k + 32 * 3;
1488         }
1489
1490         /* Extract the "normal" spells */
1491         for (k = 0; k < 32; k++)
1492         {
1493                 if (f5 & (1L << k)) spell[num++] = k + 32 * 4;
1494         }
1495
1496         /* Extract the "bizarre" spells */
1497         for (k = 0; k < 32; k++)
1498         {
1499                 if (f6 & (1L << k)) spell[num++] = k + 32 * 5;
1500         }
1501
1502         /* No spells left */
1503         if (!num) return (FALSE);
1504
1505         /* Stop if player is dead or gone */
1506         if (!p_ptr->playing || p_ptr->is_dead) return (FALSE);
1507
1508         /* Stop if player is leaving */
1509         if (p_ptr->leaving) return (FALSE);
1510
1511         /* Get the monster name (or "it") */
1512         monster_desc(m_name, m_ptr, 0x00);
1513
1514         /* Get the monster possessive ("his"/"her"/"its") */
1515         monster_desc(m_poss, m_ptr, 0x22);
1516
1517         /* Hack -- Get the "died from" name */
1518         monster_desc(ddesc, m_ptr, 0x288);
1519
1520         if (stupid_monsters)
1521         {
1522                 /* Choose a spell to cast */
1523                 thrown_spell = spell[randint0(num)];
1524         }
1525         else
1526         {
1527                 int attempt = 10;
1528                 if (do_disi) thrown_spell = 96+31;
1529                 else
1530                 {
1531                         while(attempt--)
1532                         {
1533                                 thrown_spell = choose_attack_spell(m_idx, spell, num);
1534                                 if (thrown_spell) break;
1535                         }
1536                 }
1537
1538                 /* Abort if no spell was chosen */
1539                 if (!thrown_spell) return (FALSE);
1540
1541                 /* Calculate spell failure rate */
1542                 failrate = 25 - (rlev + 3) / 4;
1543
1544                 /* Hack -- Stupid monsters will never fail (for jellies and such) */
1545                 if (r_ptr->flags2 & RF2_STUPID) failrate = 0;
1546
1547                 /* Check for spell failure (inate attacks never fail) */
1548                 if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
1549                 {
1550                         disturb(1, 0);
1551                         /* Message */
1552                         if (thrown_spell != (160+7)) /* Not RF6_SPECIAL */
1553                         {
1554 #ifdef JP
1555 msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
1556 #else
1557                                 msg_format("%^s tries to cast a spell, but fails.", m_name);
1558 #endif
1559                         }
1560
1561                         return (TRUE);
1562                 }
1563         }
1564
1565
1566         /* Cast the spell. */
1567         switch (thrown_spell)
1568         {
1569                 /* RF4_SHRIEK */
1570                 case 96+0:
1571                 {
1572                         if (!direct) break;
1573                         disturb(1, 0);
1574 #ifdef JP
1575 msg_format("%^s¤¬¤«¤ó¹â¤¤¶âÀÚ¤êÀ¼¤ò¤¢¤²¤¿¡£", m_name);
1576 #else
1577                         msg_format("%^s makes a high pitched shriek.", m_name);
1578 #endif
1579
1580                         aggravate_monsters(m_idx);
1581                         break;
1582                 }
1583
1584                 /* RF4_XXX1 */
1585                 case 96+1:
1586                 {
1587                         /* XXX XXX XXX */
1588                         break;
1589                 }
1590
1591                 /* RF4_DISPEL */
1592                 case 96+2:
1593                 {
1594                         if (x!=px || y!=py) return (FALSE);
1595                         disturb(1, 0);
1596 #ifdef JP
1597                         if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
1598                         else msg_format("%^s¤¬ËâÎϾõî¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
1599 #else
1600                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
1601                         else msg_format("%^s invokes a dispel magic.", m_name);
1602 #endif
1603                         set_fast(0, TRUE);
1604                         set_lightspeed(0, TRUE);
1605                         set_slow(0, TRUE);
1606                         set_shield(0, TRUE);
1607                         set_blessed(0, TRUE);
1608                         set_tsuyoshi(0, TRUE);
1609                         set_hero(0, TRUE);
1610                         set_shero(0, TRUE);
1611                         set_protevil(0, TRUE);
1612                         set_invuln(0, TRUE);
1613                         set_wraith_form(0, TRUE);
1614                         set_kabenuke(0, TRUE);
1615                         set_tim_res_nether(0, TRUE);
1616                         set_tim_res_time(0, TRUE);
1617                         /* by henkma */
1618                         set_tim_reflect(0,TRUE);
1619                         set_multishadow(0,TRUE);
1620                         set_dustrobe(0,TRUE);
1621
1622                         set_tim_invis(0, TRUE);
1623                         set_tim_infra(0, TRUE);
1624                         set_tim_esp(0, TRUE);
1625                         set_tim_regen(0, TRUE);
1626                         set_tim_stealth(0, TRUE);
1627                         set_tim_ffall(0, TRUE);
1628                         set_tim_sh_touki(0, TRUE);
1629                         set_tim_sh_fire(0, TRUE);
1630                         set_tim_sh_holy(0, TRUE);
1631                         set_tim_eyeeye(0, TRUE);
1632                         set_magicdef(0, TRUE);
1633                         set_resist_magic(0, TRUE);
1634                         set_oppose_acid(0, TRUE);
1635                         set_oppose_elec(0, TRUE);
1636                         set_oppose_fire(0, TRUE);
1637                         set_oppose_cold(0, TRUE);
1638                         set_oppose_pois(0, TRUE);
1639                         set_ultimate_res(0, TRUE);
1640                         set_mimic(0, 0, TRUE);
1641                         set_ele_attack(0, 0);
1642                         set_ele_immune(0, 0);
1643                         /* Cancel glowing hands */
1644                         if (p_ptr->special_attack & ATTACK_CONFUSE)
1645                         {
1646                                 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
1647 #ifdef JP
1648                                 msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
1649 #else
1650                                 msg_print("Your hands stop glowing.");
1651 #endif
1652
1653                         }
1654                         if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0]))
1655                         {
1656                                 p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
1657                                 p_ptr->magic_num1[0] = 0;
1658 #ifdef JP
1659                                 msg_print("²Î¤¬ÅÓÀڤ줿¡£");
1660 #else
1661                                 msg_print("Your singing is interrupted.");
1662 #endif
1663                                 p_ptr->action = ACTION_NONE;
1664
1665                                 /* Recalculate bonuses */
1666                                 p_ptr->update |= (PU_BONUS | PU_HP);
1667
1668                                 /* Redraw map */
1669                                 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1670
1671                                 /* Update monsters */
1672                                 p_ptr->update |= (PU_MONSTERS);
1673
1674                                 /* Window stuff */
1675                                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1676
1677                                 p_ptr->energy_need += ENERGY_NEED();
1678                         }
1679                         if (p_ptr->riding)
1680                         {
1681                                 m_list[p_ptr->riding].invulner = 0;
1682                                 m_list[p_ptr->riding].fast = 0;
1683                                 m_list[p_ptr->riding].slow = 0;
1684                                 p_ptr->update |= PU_BONUS;
1685                                 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= PR_HEALTH;
1686                                 p_ptr->redraw |= (PR_UHEALTH);
1687                         }
1688
1689 #ifdef JP
1690                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1691                                 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
1692 #endif
1693                         learn_spell(MS_DISPEL);
1694                         break;
1695                 }
1696
1697                 /* RF4_XXX4X4 */
1698                 case 96+3:
1699                 {
1700                         disturb(1, 0);
1701 #ifdef JP
1702 if (blind) msg_format("%^s¤¬²¿¤«¤ò¼Í¤Ã¤¿¡£", m_name);
1703 #else
1704                         if (blind) msg_format("%^s shoots something.", m_name);
1705 #endif
1706
1707 #ifdef JP
1708 else msg_format("%^s¤¬¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡£", m_name);
1709 #else
1710                         else msg_format("%^s fires a rocket.", m_name);
1711 #endif
1712
1713                         dam = ((m_ptr->hp / 4) > 800 ? 800 : (m_ptr->hp / 4));
1714                         breath(y, x, m_idx, GF_ROCKET,
1715                                 dam, 2, FALSE, MS_ROCKET, learnable);
1716                         update_smart_learn(m_idx, DRS_SHARD);
1717                         break;
1718                 }
1719
1720                 /* RF4_SHOOT */
1721                 case 96+4:
1722                 {
1723                         if (x!=px || y!=py) return (FALSE);
1724                         disturb(1, 0);
1725 #ifdef JP
1726 if (blind) msg_format("%^s¤¬´ñ̯¤Ê²»¤òȯ¤·¤¿¡£", m_name);
1727 #else
1728                         if (blind) msg_format("%^s makes a strange noise.", m_name);
1729 #endif
1730
1731 #ifdef JP
1732 else msg_format("%^s¤¬Ìð¤òÊü¤Ã¤¿¡£", m_name);
1733 #else
1734                         else msg_format("%^s fires an arrow.", m_name);
1735 #endif
1736
1737                         dam = damroll(r_ptr->blow[0].d_dice, r_ptr->blow[0].d_side);
1738                         bolt(m_idx, GF_ARROW, dam, MS_SHOOT, learnable);
1739                         update_smart_learn(m_idx, DRS_REFLECT);
1740                         break;
1741                 }
1742
1743                 /* RF4_XXX2 */
1744                 case 96+5:
1745                 {
1746                         /* XXX XXX XXX */
1747                         break;
1748                 }
1749
1750                 /* RF4_XXX3 */
1751                 case 96+6:
1752                 {
1753                         /* XXX XXX XXX */
1754                         break;
1755                 }
1756
1757                 /* RF4_XXX4 */
1758                 case 96+7:
1759                 {
1760                         /* XXX XXX XXX */
1761                         break;
1762                 }
1763
1764                 /* RF4_BR_ACID */
1765                 case 96+8:
1766                 {
1767                         disturb(1, 0);
1768 #ifdef JP
1769 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1770 #else
1771                         if (blind) msg_format("%^s breathes.", m_name);
1772 #endif
1773
1774 #ifdef JP
1775 else msg_format("%^s¤¬»À¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1776 #else
1777                         else msg_format("%^s breathes acid.", m_name);
1778 #endif
1779
1780                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1781                         breath(y, x, m_idx, GF_ACID, dam, 0, TRUE, MS_BR_ACID, learnable);
1782                         update_smart_learn(m_idx, DRS_ACID);
1783                         break;
1784                 }
1785
1786                 /* RF4_BR_ELEC */
1787                 case 96+9:
1788                 {
1789                         disturb(1, 0);
1790 #ifdef JP
1791 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1792 #else
1793                         if (blind) msg_format("%^s breathes.", m_name);
1794 #endif
1795
1796 #ifdef JP
1797 else msg_format("%^s¤¬°ðºÊ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1798 #else
1799                         else msg_format("%^s breathes lightning.", m_name);
1800 #endif
1801
1802                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1803                         breath(y, x, m_idx, GF_ELEC, dam,0, TRUE, MS_BR_ELEC, learnable);
1804                         update_smart_learn(m_idx, DRS_ELEC);
1805                         break;
1806                 }
1807
1808                 /* RF4_BR_FIRE */
1809                 case 96+10:
1810                 {
1811                         disturb(1, 0);
1812 #ifdef JP
1813 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1814 #else
1815                         if (blind) msg_format("%^s breathes.", m_name);
1816 #endif
1817
1818 #ifdef JP
1819 else msg_format("%^s¤¬²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1820 #else
1821                         else msg_format("%^s breathes fire.", m_name);
1822 #endif
1823
1824                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1825                         breath(y, x, m_idx, GF_FIRE, dam,0, TRUE, MS_BR_FIRE, learnable);
1826                         update_smart_learn(m_idx, DRS_FIRE);
1827                         break;
1828                 }
1829
1830                 /* RF4_BR_COLD */
1831                 case 96+11:
1832                 {
1833                         disturb(1, 0);
1834 #ifdef JP
1835 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1836 #else
1837                         if (blind) msg_format("%^s breathes.", m_name);
1838 #endif
1839
1840 #ifdef JP
1841 else msg_format("%^s¤¬Î䵤¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1842 #else
1843                         else msg_format("%^s breathes frost.", m_name);
1844 #endif
1845
1846                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1847                         breath(y, x, m_idx, GF_COLD, dam,0, TRUE, MS_BR_COLD, learnable);
1848                         update_smart_learn(m_idx, DRS_COLD);
1849                         break;
1850                 }
1851
1852                 /* RF4_BR_POIS */
1853                 case 96+12:
1854                 {
1855                         disturb(1, 0);
1856 #ifdef JP
1857 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1858 #else
1859                         if (blind) msg_format("%^s breathes.", m_name);
1860 #endif
1861
1862 #ifdef JP
1863 else msg_format("%^s¤¬¥¬¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1864 #else
1865                         else msg_format("%^s breathes gas.", m_name);
1866 #endif
1867
1868                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
1869                         breath(y, x, m_idx, GF_POIS, dam, 0, TRUE, MS_BR_POIS, learnable);
1870                         update_smart_learn(m_idx, DRS_POIS);
1871                         break;
1872                 }
1873
1874
1875                 /* RF4_BR_NETH */
1876                 case 96+13:
1877                 {
1878                         disturb(1, 0);
1879 #ifdef JP
1880 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1881 #else
1882                         if (blind) msg_format("%^s breathes.", m_name);
1883 #endif
1884
1885 #ifdef JP
1886 else msg_format("%^s¤¬ÃϹö¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1887 #else
1888                         else msg_format("%^s breathes nether.", m_name);
1889 #endif
1890
1891                         dam = ((m_ptr->hp / 6) > 550 ? 550 : (m_ptr->hp / 6));
1892                         breath(y, x, m_idx, GF_NETHER, dam,0, TRUE, MS_BR_NETHER, learnable);
1893                         update_smart_learn(m_idx, DRS_NETH);
1894                         break;
1895                 }
1896
1897                 /* RF4_BR_LITE */
1898                 case 96+14:
1899                 {
1900                         disturb(1, 0);
1901 #ifdef JP
1902 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1903 #else
1904                         if (blind) msg_format("%^s breathes.", m_name);
1905 #endif
1906
1907 #ifdef JP
1908 else msg_format("%^s¤¬Á®¸÷¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1909 #else
1910                         else msg_format("%^s breathes light.", m_name);
1911 #endif
1912
1913                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1914                         breath(y, x, m_idx, GF_LITE, dam,0, TRUE, MS_BR_LITE, learnable);
1915                         update_smart_learn(m_idx, DRS_LITE);
1916                         break;
1917                 }
1918
1919                 /* RF4_BR_DARK */
1920                 case 96+15:
1921                 {
1922                         disturb(1, 0);
1923 #ifdef JP
1924 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1925 #else
1926                         if (blind) msg_format("%^s breathes.", m_name);
1927 #endif
1928
1929 #ifdef JP
1930 else msg_format("%^s¤¬°Å¹õ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1931 #else
1932                         else msg_format("%^s breathes darkness.", m_name);
1933 #endif
1934
1935                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1936                         breath(y, x, m_idx, GF_DARK, dam,0, TRUE, MS_BR_DARK, learnable);
1937                         update_smart_learn(m_idx, DRS_DARK);
1938                         break;
1939                 }
1940
1941                 /* RF4_BR_CONF */
1942                 case 96+16:
1943                 {
1944                         disturb(1, 0);
1945 #ifdef JP
1946 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1947 #else
1948                         if (blind) msg_format("%^s breathes.", m_name);
1949 #endif
1950
1951 #ifdef JP
1952 else msg_format("%^s¤¬º®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1953 #else
1954                         else msg_format("%^s breathes confusion.", m_name);
1955 #endif
1956
1957                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1958                         breath(y, x, m_idx, GF_CONFUSION, dam,0, TRUE, MS_BR_CONF, learnable);
1959                         update_smart_learn(m_idx, DRS_CONF);
1960                         break;
1961                 }
1962
1963                 /* RF4_BR_SOUN */
1964                 case 96+17:
1965                 {
1966                         disturb(1, 0);
1967                         if (m_ptr->r_idx == MON_JAIAN)
1968 #ifdef JP
1969                                 msg_format("¡Ö¥Ü¥©¥¨¡Á¡Á¡Á¡Á¡Á¡Á¡×");
1970 #else
1971                                 msg_format("'Booooeeeeee'");
1972 #endif
1973 #ifdef JP
1974 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1975 #else
1976                         else if (blind) msg_format("%^s breathes.", m_name);
1977 #endif
1978
1979 #ifdef JP
1980 else msg_format("%^s¤¬¹ì²»¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1981 #else
1982                         else msg_format("%^s breathes sound.", m_name);
1983 #endif
1984
1985                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1986                         breath(y, x, m_idx, GF_SOUND, dam,0, TRUE, MS_BR_SOUND, learnable);
1987                         update_smart_learn(m_idx, DRS_SOUND);
1988                         break;
1989                 }
1990
1991                 /* RF4_BR_CHAO */
1992                 case 96+18:
1993                 {
1994                         disturb(1, 0);
1995 #ifdef JP
1996 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1997 #else
1998                         if (blind) msg_format("%^s breathes.", m_name);
1999 #endif
2000
2001 #ifdef JP
2002 else msg_format("%^s¤¬¥«¥ª¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2003 #else
2004                         else msg_format("%^s breathes chaos.", m_name);
2005 #endif
2006
2007                         dam = ((m_ptr->hp / 6) > 600 ? 600 : (m_ptr->hp / 6));
2008                         breath(y, x, m_idx, GF_CHAOS, dam,0, TRUE, MS_BR_CHAOS, learnable);
2009                         update_smart_learn(m_idx, DRS_CHAOS);
2010                         break;
2011                 }
2012
2013                 /* RF4_BR_DISE */
2014                 case 96+19:
2015                 {
2016                         disturb(1, 0);
2017 #ifdef JP
2018 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2019 #else
2020                         if (blind) msg_format("%^s breathes.", m_name);
2021 #endif
2022
2023 #ifdef JP
2024 else msg_format("%^s¤¬Îô²½¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2025 #else
2026                         else msg_format("%^s breathes disenchantment.", m_name);
2027 #endif
2028
2029                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
2030                         breath(y, x, m_idx, GF_DISENCHANT, dam,0, TRUE, MS_BR_DISEN, learnable);
2031                         update_smart_learn(m_idx, DRS_DISEN);
2032                         break;
2033                 }
2034
2035                 /* RF4_BR_NEXU */
2036                 case 96+20:
2037                 {
2038                         disturb(1, 0);
2039 #ifdef JP
2040 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2041 #else
2042                         if (blind) msg_format("%^s breathes.", m_name);
2043 #endif
2044
2045 #ifdef JP
2046 else msg_format("%^s¤¬°ø²Ìº®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2047 #else
2048                         else msg_format("%^s breathes nexus.", m_name);
2049 #endif
2050
2051                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2052                         breath(y, x, m_idx, GF_NEXUS, dam,0, TRUE, MS_BR_NEXUS, learnable);
2053                         update_smart_learn(m_idx, DRS_NEXUS);
2054                         break;
2055                 }
2056
2057                 /* RF4_BR_TIME */
2058                 case 96+21:
2059                 {
2060                         disturb(1, 0);
2061 #ifdef JP
2062 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2063 #else
2064                         if (blind) msg_format("%^s breathes.", m_name);
2065 #endif
2066
2067 #ifdef JP
2068 else msg_format("%^s¤¬»þ´ÖµÕž¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2069 #else
2070                         else msg_format("%^s breathes time.", m_name);
2071 #endif
2072
2073                         dam = ((m_ptr->hp / 3) > 150 ? 150 : (m_ptr->hp / 3));
2074                         breath(y, x, m_idx, GF_TIME, dam,0, TRUE, MS_BR_TIME, learnable);
2075                         break;
2076                 }
2077
2078                 /* RF4_BR_INER */
2079                 case 96+22:
2080                 {
2081                         disturb(1, 0);
2082 #ifdef JP
2083 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2084 #else
2085                         if (blind) msg_format("%^s breathes.", m_name);
2086 #endif
2087
2088 #ifdef JP
2089 else msg_format("%^s¤¬ÃÙÆߤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2090 #else
2091                         else msg_format("%^s breathes inertia.", m_name);
2092 #endif
2093
2094                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2095                         breath(y, x, m_idx, GF_INERTIA, dam,0, TRUE, MS_BR_INERTIA, learnable);
2096                         break;
2097                 }
2098
2099                 /* RF4_BR_GRAV */
2100                 case 96+23:
2101                 {
2102                         disturb(1, 0);
2103 #ifdef JP
2104 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2105 #else
2106                         if (blind) msg_format("%^s breathes.", m_name);
2107 #endif
2108
2109 #ifdef JP
2110 else msg_format("%^s¤¬½ÅÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2111 #else
2112                         else msg_format("%^s breathes gravity.", m_name);
2113 #endif
2114
2115                         dam = ((m_ptr->hp / 3) > 200 ? 200 : (m_ptr->hp / 3));
2116                         breath(y, x, m_idx, GF_GRAVITY, dam,0, TRUE, MS_BR_GRAVITY, learnable);
2117                         break;
2118                 }
2119
2120                 /* RF4_BR_SHAR */
2121                 case 96+24:
2122                 {
2123                         disturb(1, 0);
2124                         if (m_ptr->r_idx == MON_BOTEI)
2125 #ifdef JP
2126                                 msg_format("¡Ö¥ÜÄë¥Ó¥ë¥«¥Ã¥¿¡¼¡ª¡ª¡ª¡×");
2127 #else
2128                                 msg_format("'Boty-Build cutter!!!'");
2129 #endif
2130 #ifdef JP
2131 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2132 #else
2133                         else if (blind) msg_format("%^s breathes.", m_name);
2134 #endif
2135
2136 #ifdef JP
2137 else msg_format("%^s¤¬ÇËÊҤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2138 #else
2139                         else msg_format("%^s breathes shards.", m_name);
2140 #endif
2141
2142                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
2143                         breath(y, x, m_idx, GF_SHARDS, dam,0, TRUE, MS_BR_SHARDS, learnable);
2144                         update_smart_learn(m_idx, DRS_SHARD);
2145                         break;
2146                 }
2147
2148                 /* RF4_BR_PLAS */
2149                 case 96+25:
2150                 {
2151                         disturb(1, 0);
2152 #ifdef JP
2153 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2154 #else
2155                         if (blind) msg_format("%^s breathes.", m_name);
2156 #endif
2157
2158 #ifdef JP
2159 else msg_format("%^s¤¬¥×¥é¥º¥Þ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2160 #else
2161                         else msg_format("%^s breathes plasma.", m_name);
2162 #endif
2163
2164                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2165                         breath(y, x, m_idx, GF_PLASMA, dam,0, TRUE, MS_BR_PLASMA, learnable);
2166                         break;
2167                 }
2168
2169                 /* RF4_BR_WALL */
2170                 case 96+26:
2171                 {
2172                         disturb(1, 0);
2173 #ifdef JP
2174 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2175 #else
2176                         if (blind) msg_format("%^s breathes.", m_name);
2177 #endif
2178
2179 #ifdef JP
2180 else msg_format("%^s¤¬¥Õ¥©¡¼¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2181 #else
2182                         else msg_format("%^s breathes force.", m_name);
2183 #endif
2184
2185                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2186                         breath(y, x, m_idx, GF_FORCE, dam,0, TRUE, MS_BR_FORCE, learnable);
2187                         break;
2188                 }
2189
2190                 /* RF4_BR_MANA */
2191                 case 96+27:
2192                 {
2193                         disturb(1, 0);
2194 #ifdef JP
2195 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2196 #else
2197                         if (blind) msg_format("%^s breathes.", m_name);
2198 #endif
2199
2200 #ifdef JP
2201 else msg_format("%^s¤¬ËâÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2202 #else
2203                         else msg_format("%^s breathes mana.", m_name);
2204 #endif
2205                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2206                         breath(y, x, m_idx, GF_MANA, dam,0, TRUE, MS_BR_MANA, learnable);
2207                         break;
2208                 }
2209
2210                 /* RF4_BA_NUKE */
2211                 case 96+28:
2212                 {
2213                         disturb(1, 0);
2214 #ifdef JP
2215 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2216 #else
2217                         if (blind) msg_format("%^s mumbles.", m_name);
2218 #endif
2219
2220 #ifdef JP
2221 else msg_format("%^s¤¬Êü¼Íǽµå¤òÊü¤Ã¤¿¡£", m_name);
2222 #else
2223                         else msg_format("%^s casts a ball of radiation.", m_name);
2224 #endif
2225
2226                         dam = (rlev + damroll(10, 6)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2227                         breath(y, x, m_idx, GF_NUKE, dam, 2, FALSE, MS_BALL_NUKE, learnable);
2228                         update_smart_learn(m_idx, DRS_POIS);
2229                         break;
2230                 }
2231
2232                 /* RF4_BR_NUKE */
2233                 case 96+29:
2234                 {
2235                         disturb(1, 0);
2236 #ifdef JP
2237 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2238 #else
2239                         if (blind) msg_format("%^s breathes.", m_name);
2240 #endif
2241
2242 #ifdef JP
2243 else msg_format("%^s¤¬Êü¼ÍÀ­ÇÑ´þʪ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2244 #else
2245                         else msg_format("%^s breathes toxic waste.", m_name);
2246 #endif
2247
2248                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
2249                         breath(y, x, m_idx, GF_NUKE, dam,0, TRUE, MS_BR_NUKE, learnable);
2250                         update_smart_learn(m_idx, DRS_POIS);
2251                         break;
2252                 }
2253
2254                 /* RF4_BA_CHAO */
2255                 case 96+30:
2256                 {
2257                         disturb(1, 0);
2258 #ifdef JP
2259 if (blind) msg_format("%^s¤¬¶²¤í¤·¤²¤Ë¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2260 #else
2261                         if (blind) msg_format("%^s mumbles frighteningly.", m_name);
2262 #endif
2263
2264 #ifdef JP
2265 else msg_format("%^s¤¬½ã¥í¥°¥ë¥¹¤òÊü¤Ã¤¿¡£", m_name);/*nuke me*/
2266 #else
2267                         else msg_format("%^s invokes a raw Logrus.", m_name);
2268 #endif
2269
2270                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? (rlev * 3) : (rlev * 2))+ damroll(10, 10);
2271                         breath(y, x, m_idx, GF_CHAOS, dam, 4, FALSE, MS_BALL_CHAOS, learnable);
2272                         update_smart_learn(m_idx, DRS_CHAOS);
2273                         break;
2274                 }
2275
2276                 /* RF4_BR_DISI */
2277                 case 96+31:
2278                 {
2279                         disturb(1, 0);
2280 #ifdef JP
2281 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2282 #else
2283                         if (blind) msg_format("%^s breathes.", m_name);
2284 #endif
2285
2286 #ifdef JP
2287 else msg_format("%^s¤¬Ê¬²ò¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2288 #else
2289                         else msg_format("%^s breathes disintegration.", m_name);
2290 #endif
2291
2292                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2293                         breath(y, x, m_idx, GF_DISINTEGRATE, dam,0, TRUE, MS_BR_DISI, learnable);
2294                         break;
2295                 }
2296
2297
2298
2299                 /* RF5_BA_ACID */
2300                 case 128+0:
2301                 {
2302                         disturb(1, 0);
2303 #ifdef JP
2304 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2305 #else
2306                         if (blind) msg_format("%^s mumbles.", m_name);
2307 #endif
2308
2309 #ifdef JP
2310 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2311 #else
2312                         else msg_format("%^s casts an acid ball.", m_name);
2313 #endif
2314
2315                         dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2316                         breath(y, x, m_idx, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
2317                         update_smart_learn(m_idx, DRS_ACID);
2318                         break;
2319                 }
2320
2321                 /* RF5_BA_ELEC */
2322                 case 128+1:
2323                 {
2324                         disturb(1, 0);
2325 #ifdef JP
2326 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2327 #else
2328                         if (blind) msg_format("%^s mumbles.", m_name);
2329 #endif
2330
2331 #ifdef JP
2332 else msg_format("%^s¤¬¥µ¥ó¥À¡¼¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2333 #else
2334                         else msg_format("%^s casts a lightning ball.", m_name);
2335 #endif
2336
2337                         dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2338                         breath(y, x, m_idx, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
2339                         update_smart_learn(m_idx, DRS_ELEC);
2340                         break;
2341                 }
2342
2343                 /* RF5_BA_FIRE */
2344                 case 128+2:
2345                 {
2346                         disturb(1, 0);
2347
2348                         if (m_ptr->r_idx == MON_ROLENTO)
2349                         {
2350 #ifdef JP
2351                                 if (blind)
2352                                         msg_format("%s¤¬²¿¤«¤òÅꤲ¤¿¡£", m_name);
2353                                 else 
2354                                         msg_format("%s¤Ï¼êÜØÃƤòÅꤲ¤¿¡£", m_name);
2355 #else
2356                                 if (blind)
2357                                         msg_format("%^s throws something.", m_name);
2358                                 else
2359                                         msg_format("%^s throws a hand grenade.", m_name);
2360 #endif
2361                         }
2362                         else
2363                         {
2364 #ifdef JP
2365 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2366 #else
2367                                 if (blind) msg_format("%^s mumbles.", m_name);
2368 #endif
2369
2370 #ifdef JP
2371 else msg_format("%^s¤¬¥Õ¥¡¥¤¥¢¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2372 #else
2373                                 else msg_format("%^s casts a fire ball.", m_name);
2374 #endif
2375                         }
2376
2377                         dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2378                         breath(y, x, m_idx, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
2379                         update_smart_learn(m_idx, DRS_FIRE);
2380                         break;
2381                 }
2382
2383                 /* RF5_BA_COLD */
2384                 case 128+3:
2385                 {
2386                         disturb(1, 0);
2387 #ifdef JP
2388 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2389 #else
2390                         if (blind) msg_format("%^s mumbles.", m_name);
2391 #endif
2392
2393 #ifdef JP
2394 else msg_format("%^s¤¬¥¢¥¤¥¹¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2395 #else
2396                         else msg_format("%^s casts a frost ball.", m_name);
2397 #endif
2398
2399                         dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2400                         breath(y, x, m_idx, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
2401                         update_smart_learn(m_idx, DRS_COLD);
2402                         break;
2403                 }
2404
2405                 /* RF5_BA_POIS */
2406                 case 128+4:
2407                 {
2408                         disturb(1, 0);
2409 #ifdef JP
2410 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2411 #else
2412                         if (blind) msg_format("%^s mumbles.", m_name);
2413 #endif
2414
2415 #ifdef JP
2416 else msg_format("%^s¤¬°­½­±À¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2417 #else
2418                         else msg_format("%^s casts a stinking cloud.", m_name);
2419 #endif
2420
2421                         dam = damroll(12, 2) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2422                         breath(y, x, m_idx, GF_POIS, dam, 2, FALSE, MS_BALL_POIS, learnable);
2423                         update_smart_learn(m_idx, DRS_POIS);
2424                         break;
2425                 }
2426
2427                 /* RF5_BA_NETH */
2428                 case 128+5:
2429                 {
2430                         disturb(1, 0);
2431 #ifdef JP
2432 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2433 #else
2434                         if (blind) msg_format("%^s mumbles.", m_name);
2435 #endif
2436
2437 #ifdef JP
2438 else msg_format("%^s¤¬ÃϹöµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2439 #else
2440                         else msg_format("%^s casts a nether ball.", m_name);
2441 #endif
2442
2443                         dam = 50 + damroll(10, 10) + (rlev * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1));
2444                         breath(y, x, m_idx, GF_NETHER, dam, 2, FALSE, MS_BALL_NETHER, learnable);
2445                         update_smart_learn(m_idx, DRS_NETH);
2446                         break;
2447                 }
2448
2449                 /* RF5_BA_WATE */
2450                 case 128+6:
2451                 {
2452                         disturb(1, 0);
2453 #ifdef JP
2454 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2455 #else
2456                         if (blind) msg_format("%^s mumbles.", m_name);
2457 #endif
2458
2459 #ifdef JP
2460 else msg_format("%^s¤¬Î®¤ì¤ë¤è¤¦¤Ê¿È¿¶¤ê¤ò¤·¤¿¡£", m_name);
2461 #else
2462                         else msg_format("%^s gestures fluidly.", m_name);
2463 #endif
2464
2465 #ifdef JP
2466 msg_print("¤¢¤Ê¤¿¤Ï±²´¬¤­¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£");
2467 #else
2468                         msg_print("You are engulfed in a whirlpool.");
2469 #endif
2470
2471                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
2472                         breath(y, x, m_idx, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
2473                         break;
2474                 }
2475
2476                 /* RF5_BA_MANA */
2477                 case 128+7:
2478                 {
2479                         disturb(1, 0);
2480 #ifdef JP
2481 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2482 #else
2483                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2484 #endif
2485
2486 #ifdef JP
2487 else msg_format("%^s¤¬ËâÎϤÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2488 #else
2489                         else msg_format("%^s invokes a mana storm.", m_name);
2490 #endif
2491
2492                         dam = (rlev * 4) + 50 + damroll(10, 10);
2493                         breath(y, x, m_idx, GF_MANA, dam, 4, FALSE, MS_BALL_MANA, learnable);
2494                         break;
2495                 }
2496
2497                 /* RF5_BA_DARK */
2498                 case 128+8:
2499                 {
2500                         disturb(1, 0);
2501 #ifdef JP
2502 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2503 #else
2504                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2505 #endif
2506
2507 #ifdef JP
2508 else msg_format("%^s¤¬°Å¹õ¤ÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2509 #else
2510                         else msg_format("%^s invokes a darkness storm.", m_name);
2511 #endif
2512
2513                         dam = (rlev * 4) + 50 + damroll(10, 10);
2514                         breath(y, x, m_idx, GF_DARK, dam, 4, FALSE, MS_BALL_DARK, learnable);
2515                         update_smart_learn(m_idx, DRS_DARK);
2516                         break;
2517                 }
2518
2519                 /* RF5_DRAIN_MANA */
2520                 case 128+9:
2521                 {
2522                         if (x!=px || y!=py) return (FALSE);
2523                         if (!direct) break;
2524                         disturb(1, 0);
2525                         if (p_ptr->csp)
2526                         {
2527                                 int r1;
2528
2529                                 /* Basic message */
2530 #ifdef JP
2531 msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
2532 #else
2533                                 msg_format("%^s draws psychic energy from you!", m_name);
2534 #endif
2535
2536
2537                                 /* Attack power */
2538                                 r1 = (randint1(rlev) / 2) + 1;
2539
2540                                 /* Full drain */
2541                                 if (r1 >= p_ptr->csp)
2542                                 {
2543                                         r1 = p_ptr->csp;
2544                                         p_ptr->csp = 0;
2545                                         p_ptr->csp_frac = 0;
2546                                 }
2547
2548                                 /* Partial drain */
2549                                 else
2550                                 {
2551                                         p_ptr->csp -= r1;
2552                                 }
2553
2554                                 learn_spell(MS_DRAIN_MANA);
2555
2556                                 /* Redraw mana */
2557                                 p_ptr->redraw |= (PR_MANA);
2558
2559                                 /* Window stuff */
2560                                 p_ptr->window |= (PW_PLAYER);
2561                                 p_ptr->window |= (PW_SPELL);
2562
2563                                 /* Heal the monster */
2564                                 if (m_ptr->hp < m_ptr->maxhp)
2565                                 {
2566                                         /* Heal */
2567                                         m_ptr->hp += (6 * r1);
2568                                         if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2569
2570                                         /* Redraw (later) if needed */
2571                                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
2572                                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
2573
2574                                         /* Special message */
2575                                         if (seen)
2576                                         {
2577 #ifdef JP
2578 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
2579 #else
2580                                                 msg_format("%^s appears healthier.", m_name);
2581 #endif
2582
2583                                         }
2584                                 }
2585                         }
2586                         update_smart_learn(m_idx, DRS_MANA);
2587                         break;
2588                 }
2589
2590                 /* RF5_MIND_BLAST */
2591                 case 128+10:
2592                 {
2593                         if (x!=px || y!=py) return (FALSE);
2594                         if (!direct) break;
2595                         disturb(1, 0);
2596                         if (!seen)
2597                         {
2598 #ifdef JP
2599 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2600 #else
2601                                 msg_print("You feel something focusing on your mind.");
2602 #endif
2603
2604                         }
2605                         else
2606                         {
2607 #ifdef JP
2608 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¤Ë¤é¤ó¤Ç¤¤¤ë¡£", m_name);
2609 #else
2610                                 msg_format("%^s gazes deep into your eyes.", m_name);
2611 #endif
2612
2613                         }
2614
2615                         dam = damroll(7, 7);
2616                         breath(y, x, m_idx, GF_MIND_BLAST, dam, 0, FALSE, MS_MIND_BLAST, learnable);
2617                         break;
2618                 }
2619
2620                 /* RF5_BRAIN_SMASH */
2621                 case 128+11:
2622                 {
2623                         if (x!=px || y!=py) return (FALSE);
2624                         if (!direct) break;
2625                         disturb(1, 0);
2626                         if (!seen)
2627                         {
2628 #ifdef JP
2629 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2630 #else
2631                                 msg_print("You feel something focusing on your mind.");
2632 #endif
2633
2634                         }
2635                         else
2636                         {
2637 #ifdef JP
2638 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¸«¤Æ¤¤¤ë¡£", m_name);
2639 #else
2640                                 msg_format("%^s looks deep into your eyes.", m_name);
2641 #endif
2642
2643                         }
2644
2645                         dam = damroll(12, 12);
2646                         breath(y, x, m_idx, GF_BRAIN_SMASH, dam, 0, FALSE, MS_BRAIN_SMASH, learnable);
2647                         break;
2648                 }
2649
2650                 /* RF5_CAUSE_1 */
2651                 case 128+12:
2652                 {
2653                         if (x!=px || y!=py) return (FALSE);
2654                         if (!direct) break;
2655                         disturb(1, 0);
2656 #ifdef JP
2657 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2658 #else
2659                         if (blind) msg_format("%^s mumbles.", m_name);
2660 #endif
2661
2662 #ifdef JP
2663 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¼ö¤Ã¤¿¡£", m_name);
2664 #else
2665                         else msg_format("%^s points at you and curses.", m_name);
2666 #endif
2667
2668                         dam = damroll(3, 8);
2669                         breath(y, x, m_idx, GF_CAUSE_1, dam, 0, FALSE, MS_CAUSE_1, learnable);
2670                         break;
2671                 }
2672
2673                 /* RF5_CAUSE_2 */
2674                 case 128+13:
2675                 {
2676                         if (x!=px || y!=py) return (FALSE);
2677                         if (!direct) break;
2678                         disturb(1, 0);
2679 #ifdef JP
2680 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2681 #else
2682                         if (blind) msg_format("%^s mumbles.", m_name);
2683 #endif
2684
2685 #ifdef JP
2686 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤Ã¤¿¡£", m_name);
2687 #else
2688                         else msg_format("%^s points at you and curses horribly.", m_name);
2689 #endif
2690
2691                         dam = damroll(8, 8);
2692                         breath(y, x, m_idx, GF_CAUSE_2, dam, 0, FALSE, MS_CAUSE_2, learnable);
2693                         break;
2694                 }
2695
2696                 /* RF5_CAUSE_3 */
2697                 case 128+14:
2698                 {
2699                         if (x!=px || y!=py) return (FALSE);
2700                         if (!direct) break;
2701                         disturb(1, 0);
2702 #ifdef JP
2703 if (blind) msg_format("%^s¤¬²¿¤«¤òÂçÀ¼¤Ç¶«¤ó¤À¡£", m_name);
2704 #else
2705                         if (blind) msg_format("%^s mumbles loudly.", m_name);
2706 #endif
2707
2708 #ifdef JP
2709 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
2710 #else
2711                         else msg_format("%^s points at you, incanting terribly!", m_name);
2712 #endif
2713
2714                         dam = damroll(10, 15);
2715                         breath(y, x, m_idx, GF_CAUSE_3, dam, 0, FALSE, MS_CAUSE_3, learnable);
2716                         break;
2717                 }
2718
2719                 /* RF5_CAUSE_4 */
2720                 case 128+15:
2721                 {
2722                         if (x!=px || y!=py) return (FALSE);
2723                         if (!direct) break;
2724                         disturb(1, 0);
2725 #ifdef JP
2726 if (blind) msg_format("%^s¤¬¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2727 #else
2728                         if (blind) msg_format("%^s screams the word 'DIE!'", m_name);
2729 #endif
2730
2731 #ifdef JP
2732 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÈ빦¤òÆͤ¤¤Æ¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2733 #else
2734                         else msg_format("%^s points at you, screaming the word DIE!", m_name);
2735 #endif
2736
2737                         dam = damroll(15, 15);
2738                         breath(y, x, m_idx, GF_CAUSE_4, dam, 0, FALSE, MS_CAUSE_4, learnable);
2739                         break;
2740                 }
2741
2742                 /* RF5_BO_ACID */
2743                 case 128+16:
2744                 {
2745                         if (x!=px || y!=py) return (FALSE);
2746                         disturb(1, 0);
2747 #ifdef JP
2748 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2749 #else
2750                         if (blind) msg_format("%^s mumbles.", m_name);
2751 #endif
2752
2753 #ifdef JP
2754 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2755 #else
2756                         else msg_format("%^s casts a acid bolt.", m_name);
2757 #endif
2758
2759                         dam = (damroll(7, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2760                         bolt(m_idx, GF_ACID, dam, MS_BOLT_ACID, learnable);
2761                         update_smart_learn(m_idx, DRS_ACID);
2762                         update_smart_learn(m_idx, DRS_REFLECT);
2763                         break;
2764                 }
2765
2766                 /* RF5_BO_ELEC */
2767                 case 128+17:
2768                 {
2769                         if (x!=px || y!=py) return (FALSE);
2770                         disturb(1, 0);
2771 #ifdef JP
2772 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2773 #else
2774                         if (blind) msg_format("%^s mumbles.", m_name);
2775 #endif
2776
2777 #ifdef JP
2778 else msg_format("%^s¤¬¥µ¥ó¥À¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2779 #else
2780                         else msg_format("%^s casts a lightning bolt.", m_name);
2781 #endif
2782
2783                         dam = (damroll(4, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2784                         bolt(m_idx, GF_ELEC, dam, MS_BOLT_ELEC, learnable);
2785                         update_smart_learn(m_idx, DRS_ELEC);
2786                         update_smart_learn(m_idx, DRS_REFLECT);
2787                         break;
2788                 }
2789
2790                 /* RF5_BO_FIRE */
2791                 case 128+18:
2792                 {
2793                         if (x!=px || y!=py) return (FALSE);
2794                         disturb(1, 0);
2795 #ifdef JP
2796 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2797 #else
2798                         if (blind) msg_format("%^s mumbles.", m_name);
2799 #endif
2800
2801 #ifdef JP
2802 else msg_format("%^s¤¬¥Õ¥¡¥¤¥¢¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2803 #else
2804                         else msg_format("%^s casts a fire bolt.", m_name);
2805 #endif
2806
2807                         dam = (damroll(9, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2808                         bolt(m_idx, GF_FIRE, dam, MS_BOLT_FIRE, learnable);
2809                         update_smart_learn(m_idx, DRS_FIRE);
2810                         update_smart_learn(m_idx, DRS_REFLECT);
2811                         break;
2812                 }
2813
2814                 /* RF5_BO_COLD */
2815                 case 128+19:
2816                 {
2817                         if (x!=px || y!=py) return (FALSE);
2818                         disturb(1, 0);
2819 #ifdef JP
2820 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2821 #else
2822                         if (blind) msg_format("%^s mumbles.", m_name);
2823 #endif
2824
2825 #ifdef JP
2826 else msg_format("%^s¤¬¥¢¥¤¥¹¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2827 #else
2828                         else msg_format("%^s casts a frost bolt.", m_name);
2829 #endif
2830
2831                         dam = (damroll(6, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2832                         bolt(m_idx, GF_COLD, dam, MS_BOLT_COLD, learnable);
2833                         update_smart_learn(m_idx, DRS_COLD);
2834                         update_smart_learn(m_idx, DRS_REFLECT);
2835                         break;
2836                 }
2837
2838                 /* RF5_BA_LITE */
2839                 case 128+20:
2840                 {
2841                         disturb(1, 0);
2842 #ifdef JP
2843 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2844 #else
2845                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2846 #endif
2847
2848 #ifdef JP
2849 else msg_format("%^s¤¬¥¹¥¿¡¼¥Ð¡¼¥¹¥È¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2850 #else
2851                         else msg_format("%^s invokes a starburst.", m_name);
2852 #endif
2853
2854                         dam = (rlev * 4) + 50 + damroll(10, 10);
2855                         breath(y, x, m_idx, GF_LITE, dam, 4, FALSE, MS_STARBURST, learnable);
2856                         update_smart_learn(m_idx, DRS_LITE);
2857                         break;
2858                 }
2859
2860                 /* RF5_BO_NETH */
2861                 case 128+21:
2862                 {
2863                         if (x!=px || y!=py) return (FALSE);
2864                         disturb(1, 0);
2865 #ifdef JP
2866 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2867 #else
2868                         if (blind) msg_format("%^s mumbles.", m_name);
2869 #endif
2870
2871 #ifdef JP
2872 else msg_format("%^s¤¬ÃϹö¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2873 #else
2874                         else msg_format("%^s casts a nether bolt.", m_name);
2875 #endif
2876
2877                         dam = 30 + damroll(5, 5) + (rlev * 4) / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3);
2878                         bolt(m_idx, GF_NETHER, dam, MS_BOLT_NETHER, learnable);
2879                         update_smart_learn(m_idx, DRS_NETH);
2880                         update_smart_learn(m_idx, DRS_REFLECT);
2881                         break;
2882                 }
2883
2884                 /* RF5_BO_WATE */
2885                 case 128+22:
2886                 {
2887                         if (x!=px || y!=py) return (FALSE);
2888                         disturb(1, 0);
2889 #ifdef JP
2890 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2891 #else
2892                         if (blind) msg_format("%^s mumbles.", m_name);
2893 #endif
2894
2895 #ifdef JP
2896 else msg_format("%^s¤¬¥¦¥©¡¼¥¿¡¼¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2897 #else
2898                         else msg_format("%^s casts a water bolt.", m_name);
2899 #endif
2900
2901                         dam = damroll(10, 10) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2902                         bolt(m_idx, GF_WATER, dam, MS_BOLT_WATER, learnable);
2903                         update_smart_learn(m_idx, DRS_REFLECT);
2904                         break;
2905                 }
2906
2907                 /* RF5_BO_MANA */
2908                 case 128+23:
2909                 {
2910                         if (x!=px || y!=py) return (FALSE);
2911                         disturb(1, 0);
2912 #ifdef JP
2913 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2914 #else
2915                         if (blind) msg_format("%^s mumbles.", m_name);
2916 #endif
2917
2918 #ifdef JP
2919 else msg_format("%^s¤¬ËâÎϤÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2920 #else
2921                         else msg_format("%^s casts a mana bolt.", m_name);
2922 #endif
2923
2924                         dam = randint1(rlev * 7 / 2) + 50;
2925                         bolt(m_idx, GF_MANA, dam, MS_BOLT_MANA, learnable);
2926                         update_smart_learn(m_idx, DRS_REFLECT);
2927                         break;
2928                 }
2929
2930                 /* RF5_BO_PLAS */
2931                 case 128+24:
2932                 {
2933                         if (x!=px || y!=py) return (FALSE);
2934                         disturb(1, 0);
2935 #ifdef JP
2936 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2937 #else
2938                         if (blind) msg_format("%^s mumbles.", m_name);
2939 #endif
2940
2941 #ifdef JP
2942 else msg_format("%^s¤¬¥×¥é¥º¥Þ¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2943 #else
2944                         else msg_format("%^s casts a plasma bolt.", m_name);
2945 #endif
2946
2947                         dam = 10 + damroll(8, 7) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2948                         bolt(m_idx, GF_PLASMA, dam, MS_BOLT_PLASMA, learnable);
2949                         update_smart_learn(m_idx, DRS_REFLECT);
2950                         break;
2951                 }
2952
2953                 /* RF5_BO_ICEE */
2954                 case 128+25:
2955                 {
2956                         if (x!=px || y!=py) return (FALSE);
2957                         disturb(1, 0);
2958 #ifdef JP
2959 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2960 #else
2961                         if (blind) msg_format("%^s mumbles.", m_name);
2962 #endif
2963
2964 #ifdef JP
2965 else msg_format("%^s¤¬¶Ë´¨¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2966 #else
2967                         else msg_format("%^s casts an ice bolt.", m_name);
2968 #endif
2969
2970                         dam = damroll(6, 6) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2971                         bolt(m_idx, GF_ICE, dam, MS_BOLT_ICE, learnable);
2972                         update_smart_learn(m_idx, DRS_COLD);
2973                         update_smart_learn(m_idx, DRS_REFLECT);
2974                         break;
2975                 }
2976
2977                 /* RF5_MISSILE */
2978                 case 128+26:
2979                 {
2980                         if (x!=px || y!=py) return (FALSE);
2981                         disturb(1, 0);
2982 #ifdef JP
2983 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2984 #else
2985                         if (blind) msg_format("%^s mumbles.", m_name);
2986 #endif
2987
2988 #ifdef JP
2989 else msg_format("%^s¤¬¥Þ¥¸¥Ã¥¯¡¦¥ß¥µ¥¤¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2990 #else
2991                         else msg_format("%^s casts a magic missile.", m_name);
2992 #endif
2993
2994                         dam = damroll(2, 6) + (rlev / 3);
2995                         bolt(m_idx, GF_MISSILE, dam, MS_MAGIC_MISSILE, learnable);
2996                         update_smart_learn(m_idx, DRS_REFLECT);
2997                         break;
2998                 }
2999
3000                 /* RF5_SCARE */
3001                 case 128+27:
3002                 {
3003                         if (x!=px || y!=py) return (FALSE);
3004                         if (!direct) break;
3005                         disturb(1, 0);
3006 #ifdef JP
3007 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢¶²¤í¤·¤²¤Ê²»¤¬Ê¹¤³¤¨¤¿¡£", m_name);
3008 #else
3009                         if (blind) msg_format("%^s mumbles, and you hear scary noises.", m_name);
3010 #endif
3011
3012 #ifdef JP
3013 else msg_format("%^s¤¬¶²¤í¤·¤²¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
3014 #else
3015                         else msg_format("%^s casts a fearful illusion.", m_name);
3016 #endif
3017
3018                         if (p_ptr->resist_fear)
3019                         {
3020 #ifdef JP
3021 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3022 #else
3023                                 msg_print("You refuse to be frightened.");
3024 #endif
3025
3026                         }
3027                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3028                         {
3029 #ifdef JP
3030 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3031 #else
3032                                 msg_print("You refuse to be frightened.");
3033 #endif
3034
3035                         }
3036                         else
3037                         {
3038                                 (void)set_afraid(p_ptr->afraid + randint0(4) + 4);
3039                         }
3040                         learn_spell(MS_SCARE);
3041                         update_smart_learn(m_idx, DRS_FEAR);
3042                         break;
3043                 }
3044
3045                 /* RF5_BLIND */
3046                 case 128+28:
3047                 {
3048                         if (x!=px || y!=py) return (FALSE);
3049                         if (!direct) break;
3050                         disturb(1, 0);
3051 #ifdef JP
3052 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3053 #else
3054                         if (blind) msg_format("%^s mumbles.", m_name);
3055 #endif
3056
3057 #ifdef JP
3058 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¤¢¤Ê¤¿¤ÎÌܤò¤¯¤é¤Þ¤·¤¿¡ª", m_name);
3059 #else
3060                         else msg_format("%^s casts a spell, burning your eyes!", m_name);
3061 #endif
3062
3063                         if (p_ptr->resist_blind)
3064                         {
3065 #ifdef JP
3066 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3067 #else
3068                                 msg_print("You are unaffected!");
3069 #endif
3070
3071                         }
3072                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3073                         {
3074 #ifdef JP
3075 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3076 #else
3077                                 msg_print("You resist the effects!");
3078 #endif
3079
3080                         }
3081                         else
3082                         {
3083                                 (void)set_blind(12 + randint0(4));
3084                         }
3085                         learn_spell(MS_BLIND);
3086                         update_smart_learn(m_idx, DRS_BLIND);
3087                         break;
3088                 }
3089
3090                 /* RF5_CONF */
3091                 case 128+29:
3092                 {
3093                         if (x!=px || y!=py) return (FALSE);
3094                         if (!direct) break;
3095                         disturb(1, 0);
3096 #ifdef JP
3097 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢Æ¬¤òǺ¤Þ¤¹²»¤¬¤·¤¿¡£", m_name);
3098 #else
3099                         if (blind) msg_format("%^s mumbles, and you hear puzzling noises.", m_name);
3100 #endif
3101
3102 #ifdef JP
3103 else msg_format("%^s¤¬Í¶ÏÇŪ¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
3104 #else
3105                         else msg_format("%^s creates a mesmerising illusion.", m_name);
3106 #endif
3107
3108                         if (p_ptr->resist_conf)
3109                         {
3110 #ifdef JP
3111 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3112 #else
3113                                 msg_print("You disbelieve the feeble spell.");
3114 #endif
3115
3116                         }
3117                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3118                         {
3119 #ifdef JP
3120 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3121 #else
3122                                 msg_print("You disbelieve the feeble spell.");
3123 #endif
3124
3125                         }
3126                         else
3127                         {
3128                                 (void)set_confused(p_ptr->confused + randint0(4) + 4);
3129                         }
3130                         learn_spell(MS_CONF);
3131                         update_smart_learn(m_idx, DRS_CONF);
3132                         break;
3133                 }
3134
3135                 /* RF5_SLOW */
3136                 case 128+30:
3137                 {
3138                         if (x!=px || y!=py) return (FALSE);
3139                         if (!direct) break;
3140                         disturb(1, 0);
3141 #ifdef JP
3142 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¶ÚÎϤòµÛ¤¤¼è¤í¤¦¤È¤·¤¿¡ª", m_name);
3143 #else
3144                         msg_format("%^s drains power from your muscles!", m_name);
3145 #endif
3146
3147                         if (p_ptr->free_act)
3148                         {
3149 #ifdef JP
3150 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3151 #else
3152                                 msg_print("You are unaffected!");
3153 #endif
3154
3155                         }
3156                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3157                         {
3158 #ifdef JP
3159 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3160 #else
3161                                 msg_print("You resist the effects!");
3162 #endif
3163
3164                         }
3165                         else
3166                         {
3167                                 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
3168                         }
3169                         learn_spell(MS_SLOW);
3170                         update_smart_learn(m_idx, DRS_FREE);
3171                         break;
3172                 }
3173
3174                 /* RF5_HOLD */
3175                 case 128+31:
3176                 {
3177                         if (x!=px || y!=py) return (FALSE);
3178                         if (!direct) break;
3179                         disturb(1, 0);
3180 #ifdef JP
3181 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3182 #else
3183                         if (blind) msg_format("%^s mumbles.", m_name);
3184 #endif
3185
3186 #ifdef JP
3187 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÌܤò¤¸¤Ã¤È¸«¤Ä¤á¤¿¡ª", m_name);
3188 #else
3189                         else msg_format("%^s stares deep into your eyes!", m_name);
3190 #endif
3191
3192                         if (p_ptr->free_act)
3193                         {
3194 #ifdef JP
3195 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3196 #else
3197                                 msg_print("You are unaffected!");
3198 #endif
3199
3200                         }
3201                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3202                         {
3203 #ifdef JP
3204 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3205 #else
3206                                 msg_format("You resist the effects!");
3207 #endif
3208
3209                         }
3210                         else
3211                         {
3212                                 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
3213                         }
3214                         learn_spell(MS_SLEEP);
3215                         update_smart_learn(m_idx, DRS_FREE);
3216                         break;
3217                 }
3218
3219                 /* RF6_HASTE */
3220                 case 160+0:
3221                 {
3222                         disturb(1, 0);
3223                         if (blind)
3224                         {
3225 #ifdef JP
3226 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3227 #else
3228                                 msg_format("%^s mumbles.", m_name);
3229 #endif
3230
3231                         }
3232                         else
3233                         {
3234 #ifdef JP
3235 msg_format("%^s¤¬¼«Ê¬¤ÎÂΤËÇ°¤òÁ÷¤Ã¤¿¡£", m_name, m_poss);
3236 #else
3237                                 msg_format("%^s concentrates on %s body.", m_name, m_poss);
3238 #endif
3239
3240                         }
3241
3242                         /* Allow quick speed increases to base+10 */
3243                         if (!m_ptr->fast)
3244                         {
3245 #ifdef JP
3246 msg_format("%^s¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
3247 #else
3248                                 msg_format("%^s starts moving faster.", m_name);
3249 #endif
3250                         }
3251                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
3252                         if (p_ptr->riding == m_idx) p_ptr->update |= PU_BONUS;
3253                         break;
3254                 }
3255
3256                 /* RF6_HAND_DOOM */
3257                 case 160+1:
3258                 {
3259                         if (x!=px || y!=py) return (FALSE);
3260                         disturb(1, 0);
3261 #ifdef JP
3262 msg_format("%^s¤¬ÇËÌǤμê¤òÊü¤Ã¤¿¡ª", m_name);
3263 #else
3264                         msg_format("%^s invokes the Hand of Doom!", m_name);
3265 #endif
3266                         dam = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
3267                         breath(y, x, m_idx, GF_HAND_DOOM, dam, 0, FALSE, MS_HAND_DOOM, learnable);
3268                         break;
3269                 }
3270
3271                 /* RF6_HEAL */
3272                 case 160+2:
3273                 {
3274                         disturb(1, 0);
3275
3276                         /* Message */
3277                         if (blind)
3278                         {
3279 #ifdef JP
3280 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3281 #else
3282                                 msg_format("%^s mumbles.", m_name);
3283 #endif
3284
3285                         }
3286                         else
3287                         {
3288 #ifdef JP
3289 msg_format("%^s¤¬¼«Ê¬¤Î½ý¤Ë½¸Ã椷¤¿¡£", m_name);
3290 #else
3291                                 msg_format("%^s concentrates on %s wounds.", m_name, m_poss);
3292 #endif
3293
3294                         }
3295
3296                         /* Heal some */
3297                         m_ptr->hp += (rlev * 6);
3298
3299                         /* Fully healed */
3300                         if (m_ptr->hp >= m_ptr->maxhp)
3301                         {
3302                                 /* Fully healed */
3303                                 m_ptr->hp = m_ptr->maxhp;
3304
3305                                 /* Message */
3306                                 if (seen)
3307                                 {
3308 #ifdef JP
3309 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¡ª", m_name);
3310 #else
3311                                         msg_format("%^s looks completely healed!", m_name);
3312 #endif
3313
3314                                 }
3315                                 else
3316                                 {
3317 #ifdef JP
3318 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¤è¤¦¤À¡ª", m_name);
3319 #else
3320                                         msg_format("%^s sounds completely healed!", m_name);
3321 #endif
3322
3323                                 }
3324                         }
3325
3326                         /* Partially healed */
3327                         else
3328                         {
3329                                 /* Message */
3330                                 if (seen)
3331                                 {
3332 #ifdef JP
3333 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3334 #else
3335                                         msg_format("%^s looks healthier.", m_name);
3336 #endif
3337
3338                                 }
3339                                 else
3340                                 {
3341 #ifdef JP
3342 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3343 #else
3344                                         msg_format("%^s sounds healthier.", m_name);
3345 #endif
3346
3347                                 }
3348                         }
3349
3350                         /* Redraw (later) if needed */
3351                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3352                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3353
3354                         /* Cancel fear */
3355                         if (m_ptr->monfear)
3356                         {
3357                                 /* Cancel fear */
3358                                 m_ptr->monfear = 0;
3359
3360                                 /* Message */
3361 #ifdef JP
3362 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name, m_poss);
3363 #else
3364                                 msg_format("%^s recovers %s courage.", m_name, m_poss);
3365 #endif
3366
3367                         }
3368                         break;
3369                 }
3370
3371                 /* RF6_INVULNER */
3372                 case 160+3:
3373                 {
3374                         disturb(1, 0);
3375
3376                         /* Message */
3377                         if (!seen)
3378                         {
3379 #ifdef JP
3380 msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3381 #else
3382                                 msg_format("%^s mumbles powerfully.", m_name);
3383 #endif
3384
3385                         }
3386                         else
3387                         {
3388 #ifdef JP
3389 msg_format("%s¤Ï̵½ý¤Îµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3390 #else
3391                                 msg_format("%^s casts a Globe of Invulnerability.", m_name);
3392 #endif
3393
3394                         }
3395
3396                         if (!(m_ptr->invulner))
3397                                 m_ptr->invulner = randint1(4) + 4;
3398
3399                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3400                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3401                         break;
3402                 }
3403
3404                 /* RF6_BLINK */
3405                 case 160+4:
3406                 {
3407                         disturb(1, 0);
3408 #ifdef JP
3409 msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
3410 #else
3411                         msg_format("%^s blinks away.", m_name);
3412 #endif
3413
3414                         teleport_away(m_idx, 10, FALSE);
3415                         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3416                         break;
3417                 }
3418
3419                 /* RF6_TPORT */
3420                 case 160+5:
3421                 {
3422                         int i, oldfy, oldfx;
3423                         u32b flgs[TR_FLAG_SIZE];
3424                         object_type *o_ptr;
3425
3426                         oldfy = m_ptr->fy;
3427                         oldfx = m_ptr->fx;
3428
3429                         disturb(1, 0);
3430 #ifdef JP
3431 msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
3432 #else
3433                         msg_format("%^s teleports away.", m_name);
3434 #endif
3435
3436                         teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
3437
3438                         if (los(py, px, oldfy, oldfx) && !world_monster)
3439                         {
3440                                 for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
3441                                 {
3442                                         o_ptr = &inventory[i];
3443                                         if(!cursed_p(o_ptr))
3444                                         {
3445                                                 object_flags(o_ptr, flgs);
3446
3447                                                 if((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
3448                                                 {
3449 #ifdef JP
3450                                                         if(get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3451 #else
3452                                                         if(get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
3453 #endif
3454                                                         {
3455                                                                 if (one_in_(3))
3456                                                                 {
3457                                                                         teleport_player(200);
3458 #ifdef JP
3459                                                                         msg_print("¼ºÇÔ¡ª");
3460 #else
3461                                                                         msg_print("Failed!");
3462 #endif
3463                                                                 }
3464                                                                 else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3465                                                                 p_ptr->energy_need += ENERGY_NEED();
3466                                                         }
3467                                                         break;
3468                                                 }
3469                                         }
3470                                 }
3471                         }
3472                         break;
3473                 }
3474
3475                 /* RF6_WORLD */
3476                 case 160+6:
3477                 {
3478                         int who = 0;
3479                         disturb(1, 0);
3480                         if(m_ptr->r_idx == MON_DIO) who = 1;
3481                         else if(m_ptr->r_idx == MON_WONG) who = 3;
3482                         dam = who;
3483                         if (!process_the_world(randint1(2)+2, who, TRUE)) return (FALSE);
3484                         break;
3485                 }
3486
3487                 /* RF6_SPECIAL */
3488                 case 160+7:
3489                 {
3490                         int k;
3491
3492                         disturb(1, 0);
3493                         switch(m_ptr->r_idx)
3494                         {
3495                         case MON_OHMU:
3496                                 if (p_ptr->inside_arena || p_ptr->inside_battle) return FALSE;
3497                                 for (k = 0; k < 6; k++)
3498                                 {
3499                                         count += summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_BIZARRE1, PM_ALLOW_GROUP);
3500                                 }
3501                                 return FALSE;
3502                                 
3503                         case MON_BANORLUPART:
3504                                 {
3505                                         int dummy_hp = (m_ptr->hp + 1) / 2;
3506                                         int dummy_maxhp = m_ptr->maxhp/2;
3507                                         int dummy_y = m_ptr->fy;
3508                                         int dummy_x = m_ptr->fx;
3509
3510                                         if (p_ptr->inside_arena || p_ptr->inside_battle || !summon_possible(m_ptr->fy, m_ptr->fx)) return FALSE;
3511                                         delete_monster_idx(cave[m_ptr->fy][m_ptr->fx].m_idx);
3512                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode);
3513                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3514                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3515                                         summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode);
3516                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3517                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3518
3519 #ifdef JP
3520                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡¦¥ë¥Ñ¡¼¥È¡Ù¤¬Ê¬Îö¤·¤¿¡ª");
3521 #else
3522                                         msg_print("Banor=Rupart splits in two person!");
3523 #endif
3524
3525                                         break;
3526                                 }
3527                                 case MON_BANOR:
3528                                 case MON_LUPART:
3529                                 {
3530                                         int dummy_hp = 0;
3531                                         int dummy_maxhp = 0;
3532                                         int dummy_y = m_ptr->fy;
3533                                         int dummy_x = m_ptr->fx;
3534
3535                                         if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return (FALSE);
3536                                         for (k = 1; k < m_max; k++)
3537                                         {
3538                                                 if (m_list[k].r_idx == MON_BANOR || m_list[k].r_idx == MON_LUPART)
3539                                                 {
3540                                                         dummy_hp += m_list[k].hp;
3541                                                         dummy_maxhp += m_list[k].maxhp;
3542                                                         if (m_list[k].r_idx != m_ptr->r_idx)
3543                                                         {
3544                                                                 dummy_y = m_list[k].fy;
3545                                                                 dummy_x = m_list[k].fx;
3546                                                         }
3547                                                         delete_monster_idx(k);
3548                                                 }
3549                                         }
3550                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode);
3551                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3552                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3553
3554 #ifdef JP
3555                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡Ù¤È¡Ø¥ë¥Ñ¡¼¥È¡Ù¤¬¹çÂΤ·¤¿¡ª");
3556 #else
3557                                         msg_print("Banor and Rupart combine into one!");
3558 #endif
3559
3560                                         break;
3561                                 }
3562
3563                         default:
3564                                 if (r_ptr->d_char == 'B')
3565                                 {
3566                                         if (!direct) break;
3567                                         disturb(1, 0);
3568                                         if (one_in_(3) || x!=px || y!=py)
3569                                         {
3570 #ifdef JP
3571                                                 msg_format("%^s¤ÏÆÍÁ³»ë³¦¤«¤é¾Ã¤¨¤¿!", m_name);
3572 #else
3573                                                 msg_format("%^s suddenly go out of your sight!", m_name);
3574 #endif
3575                                                 teleport_away(m_idx, 10, FALSE);
3576                                                 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3577                                                 break;
3578                                         }
3579                                         else
3580                                         {
3581                                                 int dam = damroll(4, 8);
3582                                                 int get_damage = 0;
3583 #ifdef JP
3584                                                 msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
3585 #else
3586                                                 msg_format("%^s holds you, and drops from the sky.", m_name);
3587 #endif
3588                                                 teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
3589
3590                                                 sound(SOUND_FALL);
3591
3592                                                 if (p_ptr->ffall)
3593                                                 {
3594 #ifdef JP
3595                                                         msg_print("¤¢¤Ê¤¿¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£");
3596 #else
3597                                                         msg_print("You float gently down to the ground.");
3598 #endif
3599                                                 }
3600                                                 else
3601                                                 {
3602 #ifdef JP
3603                                                         msg_print("¤¢¤Ê¤¿¤ÏÃÏÌ̤Ë᤭¤Ä¤±¤é¤ì¤¿¡£");
3604 #else
3605                                                         msg_print("You crashed into the ground.");
3606 #endif
3607                                                         dam += damroll(6, 8);
3608                                                 }
3609
3610                                                 /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
3611                                                    -- henkma
3612                                                  */
3613                                                 get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1);
3614                                                 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
3615                                                 {
3616 #ifdef JP
3617                                                         msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
3618 #else
3619                                                         char m_name_self[80];
3620                 
3621                                                         /* hisself */
3622                                                         monster_desc(m_name_self, m_ptr, 0x23);
3623
3624                                                         msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
3625 #endif
3626                                                         project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
3627                                                         set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
3628                                                 }
3629                                         }
3630                                         break;
3631                                 }
3632
3633                                 /* Something is wrong */
3634                                 else return FALSE;
3635                         }
3636                         break;
3637                 }
3638
3639                 /* RF6_TELE_TO */
3640                 case 160+8:
3641                 {
3642                         if (x!=px || y!=py) return (FALSE);
3643                         if (!direct) break;
3644                         disturb(1, 0);
3645 #ifdef JP
3646 msg_format("%^s¤¬¤¢¤Ê¤¿¤ò°ú¤­Ìᤷ¤¿¡£", m_name);
3647 #else
3648                         msg_format("%^s commands you to return.", m_name);
3649 #endif
3650
3651                         teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3652                         learn_spell(MS_TELE_TO);
3653                         break;
3654                 }
3655
3656                 /* RF6_TELE_AWAY */
3657                 case 160+9:
3658                 {
3659                         if (x!=px || y!=py) return (FALSE);
3660                         if (!direct) break;
3661                         disturb(1, 0);
3662 #ifdef JP
3663 msg_format("%^s¤Ë¥Æ¥ì¥Ý¡¼¥È¤µ¤»¤é¤ì¤¿¡£", m_name);
3664                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
3665                                 msg_print("¤¯¤Ã¤½¡Á");
3666 #else
3667                         msg_format("%^s teleports you away.", m_name);
3668 #endif
3669
3670                         learn_spell(MS_TELE_AWAY);
3671                         teleport_player(100);
3672                         break;
3673                 }
3674
3675                 /* RF6_TELE_LEVEL */
3676                 case 160+10:
3677                 {
3678                         if (x!=px || y!=py) return (FALSE);
3679                         if (!direct) break;
3680                         disturb(1, 0);
3681 #ifdef JP
3682 if (blind) msg_format("%^s¤¬²¿¤«´ñ̯¤Ê¸ÀÍÕ¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3683 #else
3684                         if (blind) msg_format("%^s mumbles strangely.", m_name);
3685 #endif
3686
3687 #ifdef JP
3688 else msg_format("%^s¤¬¤¢¤Ê¤¿¤Î­¤ò»Ø¤µ¤·¤¿¡£", m_name);
3689 #else
3690                         else msg_format("%^s gestures at your feet.", m_name);
3691 #endif
3692
3693                         if (p_ptr->resist_nexus)
3694                         {
3695 #ifdef JP
3696 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3697 #else
3698                                 msg_print("You are unaffected!");
3699 #endif
3700
3701                         }
3702                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3703                         {
3704 #ifdef JP
3705 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3706 #else
3707                                 msg_print("You resist the effects!");
3708 #endif
3709
3710                         }
3711                         else
3712                         {
3713                                 teleport_player_level();
3714                         }
3715                         learn_spell(MS_TELE_LEVEL);
3716                         update_smart_learn(m_idx, DRS_NEXUS);
3717                         break;
3718                 }
3719
3720                 /* RF6_PSY_SPEAR */
3721                 case 160+11:
3722                 {
3723                         if (x!=px || y!=py) return (FALSE);
3724                         disturb(1, 0);
3725 #ifdef JP
3726 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3727 #else
3728                         if (blind) msg_format("%^s mumbles.", m_name);
3729 #endif
3730
3731 #ifdef JP
3732 else msg_format("%^s¤¬¸÷¤Î·õ¤òÊü¤Ã¤¿¡£", m_name);
3733 #else
3734                         else msg_format("%^s throw a Psycho-Spear.", m_name);
3735 #endif
3736
3737                         dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 150) : (randint1(rlev * 3 / 2) + 100);
3738                         beam(m_idx, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, learnable);
3739                         break;
3740                 }
3741
3742                 /* RF6_DARKNESS */
3743                 case 160+12:
3744                 {
3745                         if (x!=px || y!=py) return (FALSE);
3746                         if (!direct) break;
3747                         disturb(1, 0);
3748 #ifdef JP
3749 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3750 #else
3751                         if (blind) msg_format("%^s mumbles.", m_name);
3752 #endif
3753
3754 #ifdef JP
3755 else if (p_ptr->pclass == CLASS_NINJA) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
3756 else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
3757 #else
3758                         else if (p_ptr->pclass == CLASS_NINJA)
3759                                 msg_format("%^s cast a spell to light up.", m_name);
3760                         else msg_format("%^s gestures in shadow.", m_name);
3761 #endif
3762
3763                         learn_spell(MS_DARKNESS);
3764                         if (p_ptr->pclass == CLASS_NINJA)
3765                                 (void)lite_area(0, 3);
3766                         else
3767                                 (void)unlite_area(0, 3);
3768                         break;
3769                 }
3770
3771                 /* RF6_TRAPS */
3772                 case 160+13:
3773                 {
3774                         if (!direct) break;
3775                         disturb(1, 0);
3776 #ifdef JP
3777 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3778 #else
3779                         if (blind) msg_format("%^s mumbles, and then cackles evilly.", m_name);
3780 #endif
3781
3782 #ifdef JP
3783 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3784 #else
3785                         else msg_format("%^s casts a spell and cackles evilly.", m_name);
3786 #endif
3787
3788                         learn_spell(MS_MAKE_TRAP);
3789                         (void)trap_creation(y, x);
3790                         break;
3791                 }
3792
3793                 /* RF6_FORGET */
3794                 case 160+14:
3795                 {
3796                         if (x!=px || y!=py) return (FALSE);
3797                         if (!direct) break;
3798                         disturb(1, 0);
3799 #ifdef JP
3800 msg_format("%^s¤¬¤¢¤Ê¤¿¤Îµ­²±¤ò¾Ãµî¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", m_name);
3801 #else
3802                         msg_format("%^s tries to blank your mind.", m_name);
3803 #endif
3804
3805
3806                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3807                         {
3808 #ifdef JP
3809 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3810 #else
3811                                 msg_print("You resist the effects!");
3812 #endif
3813
3814                         }
3815                         else if (lose_all_info())
3816                         {
3817 #ifdef JP
3818 msg_print("µ­²±¤¬Çö¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
3819 #else
3820                                 msg_print("Your memories fade away.");
3821 #endif
3822
3823                         }
3824                         learn_spell(MS_FORGET);
3825                         break;
3826                 }
3827
3828                 /* RF6_RAISE_DEAD */
3829                 case 160+15:
3830                 {
3831                         disturb(1, 0);
3832 #ifdef JP
3833 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3834 #else
3835                         if (blind) msg_format("%^s mumbles.", m_name);
3836 #endif
3837
3838 #ifdef JP
3839 else msg_format("%^s¤¬»à¼ÔÉü³è¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3840 #else
3841                         else msg_format("%^s casts a spell to revive corpses.", m_name);
3842 #endif
3843                         animate_dead(m_idx, m_ptr->fy, m_ptr->fx);
3844                         break;
3845                 }
3846
3847                 /* RF6_SUMMON_KIN */
3848                 case 160+16:
3849                 {
3850                         disturb(1, 0);
3851                         if (m_ptr->r_idx == MON_ROLENTO)
3852                         {
3853 #ifdef JP
3854                                 if (blind)
3855                                         msg_format("%^s¤¬²¿¤«ÂçÎ̤ËÅꤲ¤¿¡£", m_name);
3856                                 else 
3857                                         msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
3858 #else
3859                                 if (blind)
3860                                         msg_format("%^s spreads something.", m_name);
3861                                 else
3862                                         msg_format("%^s throws some hand grenades.", m_name);
3863 #endif
3864                         }
3865                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3866                         {
3867 #ifdef JP
3868                                 if (blind)
3869                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3870                                 else
3871                                         msg_format("%^s¤¬¥À¥ó¥¸¥ç¥ó¤Î¼ç¤ò¾¤´­¤·¤¿¡£", m_name);
3872 #else
3873                                 if (blind)
3874                                         msg_format("%^s mumbles.", m_name);
3875                                 else
3876                                         msg_format("%^s magically summons guardians of dungeons.", m_name);
3877 #endif
3878                         }
3879                         else
3880                         {
3881 #ifdef JP
3882                                 if (blind)
3883                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3884                                 else
3885                                         msg_format("%^s¤ÏËâË¡¤Ç%s¤ò¾¤´­¤·¤¿¡£",
3886                                         m_name,
3887                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3888                                         "¼ê²¼" : "Ãç´Ö"));
3889 #else
3890                                 if (blind)
3891                                         msg_format("%^s mumbles.", m_name);
3892                                 else
3893                                         msg_format("%^s magically summons %s %s.",
3894                                         m_name, m_poss,
3895                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3896                                         "minions" : "kin"));
3897 #endif
3898                         }
3899
3900                         if(m_ptr->r_idx == MON_ROLENTO)
3901                         {
3902                                 int num = 1 + randint1(3);
3903
3904                                 for (k = 0; k < num; k++)
3905                                 {
3906                                         count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
3907                                 }
3908                         }
3909                         else if(m_ptr->r_idx == MON_THORONDOR ||
3910                                 m_ptr->r_idx == MON_GWAIHIR ||
3911                                 m_ptr->r_idx == MON_MENELDOR)
3912                         {
3913                                 int num = 4 + randint1(3);
3914                                 for (k = 0; k < num; k++)
3915                                 {
3916                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3917                                 }
3918                         }
3919                         else if(m_ptr->r_idx == MON_LOUSY)
3920                         {
3921                                 int num = 2 + randint1(3);
3922                                 for (k = 0; k < num; k++)
3923                                 {
3924                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
3925                                 }
3926                         }
3927                         else if(m_ptr->r_idx == MON_BULLGATES)
3928                         {
3929                                 int num = 2 + randint1(3);
3930                                 for (k = 0; k < num; k++)
3931                                 {
3932                                         count += summon_named_creature(m_idx, y, x, 921, mode);
3933                                 }
3934                         }
3935                         else if (m_ptr->r_idx == MON_CALDARM)
3936                         {
3937                                 int num = randint1(3);
3938                                 for (k = 0; k < num; k++)
3939                                 {
3940                                         count += summon_named_creature(m_idx, y, x, 930, mode);
3941                                 }
3942                         }
3943                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3944                         {
3945                                 int num = 2 + randint1(3);
3946
3947                                 if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
3948                                 {
3949 #ifdef JP
3950                                         msg_print("ÃÏÌ̤«¤é¿å¤¬¿á¤­½Ð¤·¤¿¡ª");
3951 #else
3952                                         msg_print("Water blew off from the ground!");
3953 #endif
3954                                         fire_ball_hide(GF_WATER_FLOW, 0, 3, 8);
3955                                 }
3956
3957                                 for (k = 0; k < num; k++)
3958                                 {
3959                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3960                                 }
3961                         }
3962                         else
3963                         {
3964
3965                                 summon_kin_type = r_ptr->d_char; /* Big hack */
3966
3967                                 for (k = 0; k < 4; k++)
3968                                 {
3969                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, PM_ALLOW_GROUP);
3970                                 }
3971                         }
3972 #ifdef JP
3973 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
3974 #else
3975                         if (blind && count) msg_print("You hear many things appear nearby.");
3976 #endif
3977
3978
3979                         break;
3980                 }
3981
3982                 /* RF6_S_CYBER */
3983                 case 160+17:
3984                 {
3985                         disturb(1, 0);
3986 #ifdef JP
3987 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3988 #else
3989                         if (blind) msg_format("%^s mumbles.", m_name);
3990 #endif
3991
3992 #ifdef JP
3993 else msg_format("%^s¤¬¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
3994 #else
3995                         else msg_format("%^s magically summons Cyberdemons!", m_name);
3996 #endif
3997
3998 #ifdef JP
3999 if (blind && count) msg_print("½Å¸ü¤Ê­²»¤¬¶á¤¯¤Çʹ¤³¤¨¤ë¡£");
4000 #else
4001                         if (blind && count) msg_print("You hear heavy steps nearby.");
4002 #endif
4003
4004                         summon_cyber(m_idx, y, x);
4005                         break;
4006                 }
4007
4008                 /* RF6_S_MONSTER */
4009                 case 160+18:
4010                 {
4011                         disturb(1, 0);
4012 #ifdef JP
4013 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4014 #else
4015                         if (blind) msg_format("%^s mumbles.", m_name);
4016 #endif
4017
4018 #ifdef JP
4019 else msg_format("%^s¤¬ËâË¡¤ÇÃç´Ö¤ò¾¤´­¤·¤¿¡ª", m_name);
4020 #else
4021                         else msg_format("%^s magically summons help!", m_name);
4022 #endif
4023
4024                         for (k = 0; k < 1; k++)
4025                         {
4026                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4027                         }
4028 #ifdef JP
4029 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4030 #else
4031                         if (blind && count) msg_print("You hear something appear nearby.");
4032 #endif
4033
4034                         break;
4035                 }
4036
4037                 /* RF6_S_MONSTERS */
4038                 case 160+19:
4039                 {
4040                         disturb(1, 0);
4041 #ifdef JP
4042 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4043 #else
4044                         if (blind) msg_format("%^s mumbles.", m_name);
4045 #endif
4046
4047 #ifdef JP
4048 else msg_format("%^s¤¬ËâË¡¤Ç¥â¥ó¥¹¥¿¡¼¤ò¾¤´­¤·¤¿¡ª", m_name);
4049 #else
4050                         else msg_format("%^s magically summons monsters!", m_name);
4051 #endif
4052
4053                         for (k = 0; k < s_num_6; k++)
4054                         {
4055                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4056                         }
4057 #ifdef JP
4058 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4059 #else
4060                         if (blind && count) msg_print("You hear many things appear nearby.");
4061 #endif
4062
4063                         break;
4064                 }
4065
4066                 /* RF6_S_ANT */
4067                 case 160+20:
4068                 {
4069                         disturb(1, 0);
4070 #ifdef JP
4071 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4072 #else
4073                         if (blind) msg_format("%^s mumbles.", m_name);
4074 #endif
4075
4076 #ifdef JP
4077 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ê¤ò¾¤´­¤·¤¿¡£", m_name);
4078 #else
4079                         else msg_format("%^s magically summons ants.", m_name);
4080 #endif
4081
4082                         for (k = 0; k < s_num_6; k++)
4083                         {
4084                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, PM_ALLOW_GROUP);
4085                         }
4086 #ifdef JP
4087 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4088 #else
4089                         if (blind && count) msg_print("You hear many things appear nearby.");
4090 #endif
4091
4092                         break;
4093                 }
4094
4095                 /* RF6_S_SPIDER */
4096                 case 160+21:
4097                 {
4098                         disturb(1, 0);
4099 #ifdef JP
4100 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4101 #else
4102                         if (blind) msg_format("%^s mumbles.", m_name);
4103 #endif
4104
4105 #ifdef JP
4106 else msg_format("%^s¤¬ËâË¡¤Ç¥¯¥â¤ò¾¤´­¤·¤¿¡£", m_name);
4107 #else
4108                         else msg_format("%^s magically summons spiders.", m_name);
4109 #endif
4110
4111                         for (k = 0; k < s_num_6; k++)
4112                         {
4113                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, PM_ALLOW_GROUP);
4114                         }
4115 #ifdef JP
4116 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4117 #else
4118                         if (blind && count) msg_print("You hear many things appear nearby.");
4119 #endif
4120
4121                         break;
4122                 }
4123
4124                 /* RF6_S_HOUND */
4125                 case 160+22:
4126                 {
4127                         disturb(1, 0);
4128 #ifdef JP
4129 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4130 #else
4131                         if (blind) msg_format("%^s mumbles.", m_name);
4132 #endif
4133
4134 #ifdef JP
4135 else msg_format("%^s¤¬ËâË¡¤Ç¥Ï¥¦¥ó¥É¤ò¾¤´­¤·¤¿¡£", m_name);
4136 #else
4137                         else msg_format("%^s magically summons hounds.", m_name);
4138 #endif
4139
4140                         for (k = 0; k < s_num_4; k++)
4141                         {
4142                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, PM_ALLOW_GROUP);
4143                         }
4144 #ifdef JP
4145 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4146 #else
4147                         if (blind && count) msg_print("You hear many things appear nearby.");
4148 #endif
4149
4150                         break;
4151                 }
4152
4153                 /* RF6_S_HYDRA */
4154                 case 160+23:
4155                 {
4156                         disturb(1, 0);
4157 #ifdef JP
4158 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4159 #else
4160                         if (blind) msg_format("%^s mumbles.", m_name);
4161 #endif
4162
4163 #ifdef JP
4164 else msg_format("%^s¤¬ËâË¡¤Ç¥Ò¥É¥é¤ò¾¤´­¤·¤¿¡£", m_name);
4165 #else
4166                         else msg_format("%^s magically summons hydras.", m_name);
4167 #endif
4168
4169                         for (k = 0; k < s_num_4; k++)
4170                         {
4171                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, PM_ALLOW_GROUP);
4172                         }
4173 #ifdef JP
4174 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4175 #else
4176                         if (blind && count) msg_print("You hear many things appear nearby.");
4177 #endif
4178
4179                         break;
4180                 }
4181
4182                 /* RF6_S_ANGEL */
4183                 case 160+24:
4184                 {
4185                         int num = 1;
4186
4187                         disturb(1, 0);
4188 #ifdef JP
4189 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4190 #else
4191                         if (blind) msg_format("%^s mumbles.", m_name);
4192 #endif
4193
4194 #ifdef JP
4195 else msg_format("%^s¤¬ËâË¡¤ÇÅ·»È¤ò¾¤´­¤·¤¿¡ª", m_name);
4196 #else
4197                         else msg_format("%^s magically summons an angel!", m_name);
4198 #endif
4199
4200                         if ((r_ptr->flags1 & RF1_UNIQUE) && !easy_band)
4201                         {
4202                                 num += r_ptr->level/40;
4203                         }
4204
4205                         for (k = 0; k < num; k++)
4206                         {
4207                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, PM_ALLOW_GROUP);
4208                         }
4209
4210                         if (count < 2)
4211                         {
4212 #ifdef JP
4213 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4214 #else
4215                                 if (blind && count) msg_print("You hear something appear nearby.");
4216 #endif
4217                         }
4218                         else
4219                         {
4220 #ifdef JP
4221 if (blind) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4222 #else
4223                                 if (blind) msg_print("You hear many things appear nearby.");
4224 #endif
4225                         }
4226
4227                         break;
4228                 }
4229
4230                 /* RF6_S_DEMON */
4231                 case 160+25:
4232                 {
4233                         disturb(1, 0);
4234 #ifdef JP
4235 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4236 #else
4237                         if (blind) msg_format("%^s mumbles.", m_name);
4238 #endif
4239
4240 #ifdef JP
4241 else msg_format("%^s¤ÏËâË¡¤Çº®Æ٤εÜÄ¤é°­Ëâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4242 #else
4243                         else msg_format("%^s magically summons a demon from the Courts of Chaos!", m_name);
4244 #endif
4245
4246                         for (k = 0; k < 1; k++)
4247                         {
4248                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, PM_ALLOW_GROUP);
4249                         }
4250 #ifdef JP
4251 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4252 #else
4253                         if (blind && count) msg_print("You hear something appear nearby.");
4254 #endif
4255
4256                         break;
4257                 }
4258
4259                 /* RF6_S_UNDEAD */
4260                 case 160+26:
4261                 {
4262                         disturb(1, 0);
4263 #ifdef JP
4264 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4265 #else
4266                         if (blind) msg_format("%^s mumbles.", m_name);
4267 #endif
4268
4269 #ifdef JP
4270 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤Î¶¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4271 #else
4272                         else msg_format("%^s magically summons an undead adversary!", m_name);
4273 #endif
4274
4275                         for (k = 0; k < 1; k++)
4276                         {
4277                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, PM_ALLOW_GROUP);
4278                         }
4279 #ifdef JP
4280 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4281 #else
4282                         if (blind && count) msg_print("You hear something appear nearby.");
4283 #endif
4284
4285                         break;
4286                 }
4287
4288                 /* RF6_S_DRAGON */
4289                 case 160+27:
4290                 {
4291                         disturb(1, 0);
4292 #ifdef JP
4293 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4294 #else
4295                         if (blind) msg_format("%^s mumbles.", m_name);
4296 #endif
4297
4298 #ifdef JP
4299 else msg_format("%^s¤¬ËâË¡¤Ç¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4300 #else
4301                         else msg_format("%^s magically summons a dragon!", m_name);
4302 #endif
4303
4304                         for (k = 0; k < 1; k++)
4305                         {
4306                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, PM_ALLOW_GROUP);
4307                         }
4308 #ifdef JP
4309 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4310 #else
4311                         if (blind && count) msg_print("You hear something appear nearby.");
4312 #endif
4313
4314                         break;
4315                 }
4316
4317                 /* RF6_S_HI_UNDEAD */
4318                 case 160+28:
4319                 {
4320                         disturb(1, 0);
4321
4322                         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))
4323                         {
4324                                 int cy = y;
4325                                 int cx = x;
4326
4327 #ifdef JP
4328 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4329 #else
4330                                 if (blind) msg_format("%^s mumbles.", m_name);
4331 #endif
4332
4333 #ifdef JP
4334 else msg_format("%^s¤¬ËâË¡¤ÇÍ©µ´ÀïÂâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4335 #else
4336                                 else msg_format("%^s magically summons rangers of Nazgul!", m_name);
4337 #endif
4338                                 msg_print(NULL);
4339
4340                                 for (k = 0; k < 30; k++)
4341                                 {
4342                                         if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx))
4343                                         {
4344                                                 int j;
4345                                                 for (j = 100; j > 0; j--)
4346                                                 {
4347                                                         scatter(&cy, &cx, y, x, 2, 0);
4348                                                         if (cave_floor_bold(cy, cx)) break;
4349                                                 }
4350                                                 if (!j) break;
4351                                         }
4352                                         if (!cave_floor_bold(cy, cx)) continue;
4353
4354                                         if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
4355                                         {
4356                                                 y = cy;
4357                                                 x = cx;
4358                                                 count++;
4359                                                 if (count == 1)
4360 #ifdef JP
4361 msg_format("¡ÖÍ©µ´ÀïÂâ%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4362 #else
4363                                                         msg_format("A Nazgul says 'Nazgul-Rangers Number %d, Nazgul-Black!'",count);
4364 #endif
4365                                                 else
4366 #ifdef JP
4367 msg_format("¡ÖƱ¤¸¤¯%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4368 #else
4369                                                         msg_format("Another one says 'Number %d, Nazgul-Black!'",count);
4370 #endif
4371                                                 msg_print(NULL);
4372                                         }
4373                                 }
4374 #ifdef JP
4375 msg_format("¡Ö%dɤ¤½¤í¤Ã¤Æ¡¢¥ê¥ó¥°¥ì¥ó¥¸¥ã¡¼¡ª¡×", count);
4376 #else
4377 msg_format("They say 'The %d meets! We are the Ring-Ranger!'.", count);
4378 #endif
4379                                 msg_print(NULL);
4380                         }
4381                         else
4382                         {
4383 #ifdef JP
4384 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4385 #else
4386                                 if (blind) msg_format("%^s mumbles.", m_name);
4387 #endif
4388
4389 #ifdef JP
4390 else msg_format("%^s¤¬ËâË¡¤Ç¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡ª", m_name);
4391 #else
4392                                 else msg_format("%^s magically summons greater undead!", m_name);
4393 #endif
4394
4395                                 for (k = 0; k < s_num_6; k++)
4396                                 {
4397                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4398                                 }
4399                         }
4400                         if (blind && count)
4401                         {
4402 #ifdef JP
4403 msg_print("´Ö¶á¤Ç²¿¤«Â¿¤¯¤Î¤â¤Î¤¬Ç礤²ó¤ë²»¤¬Ê¹¤³¤¨¤ë¡£");
4404 #else
4405                                 msg_print("You hear many creepy things appear nearby.");
4406 #endif
4407
4408                         }
4409                         break;
4410                 }
4411
4412                 /* RF6_S_HI_DRAGON */
4413                 case 160+29:
4414                 {
4415                         disturb(1, 0);
4416 #ifdef JP
4417 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4418 #else
4419                         if (blind) msg_format("%^s mumbles.", m_name);
4420 #endif
4421
4422 #ifdef JP
4423 else msg_format("%^s¤¬ËâË¡¤Ç¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4424 #else
4425                         else msg_format("%^s magically summons ancient dragons!", m_name);
4426 #endif
4427
4428                         for (k = 0; k < s_num_4; k++)
4429                         {
4430                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, (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 many powerful things appear nearby.");
4438 #endif
4439
4440                         }
4441                         break;
4442                 }
4443
4444                 /* RF6_S_AMBERITES */
4445                 case 160+30:
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 Lords of Amber!", m_name);
4458 #endif
4459
4460
4461
4462                         for (k = 0; k < s_num_4; k++)
4463                         {
4464                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4465                         }
4466                         if (blind && count)
4467                         {
4468 #ifdef JP
4469 msg_print("ÉÔ»à¤Î¼Ô¤¬¶á¤¯¤Ë¸½¤ì¤ë¤Î¤¬Ê¹¤³¤¨¤¿¡£");
4470 #else
4471                                 msg_print("You hear immortal beings appear nearby.");
4472 #endif
4473
4474                         }
4475                         break;
4476                 }
4477
4478                 /* RF6_S_UNIQUE */
4479                 case 160+31:
4480                 {
4481                         disturb(1, 0);
4482 #ifdef JP
4483 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4484 #else
4485                         if (blind) msg_format("%^s mumbles.", m_name);
4486 #endif
4487
4488 #ifdef JP
4489 else msg_format("%^s¤¬ËâË¡¤ÇÆÃÊ̤ʶ¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4490 #else
4491                         else msg_format("%^s magically summons special opponents!", m_name);
4492 #endif
4493
4494                         for (k = 0; k < s_num_4; k++)
4495                         {
4496                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4497                         }
4498                         if (r_ptr->flags3 & RF3_GOOD)
4499                         {
4500                                 for (k = count; k < s_num_4; k++)
4501                                 {
4502                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4503                                 }
4504                         }
4505                         else
4506                         {
4507                                 for (k = count; k < s_num_4; k++)
4508                                 {
4509                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4510                                 }
4511                         }
4512                         if (blind && count)
4513                         {
4514 #ifdef JP
4515 msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
4516 #else
4517                                 msg_print("You hear many powerful things appear nearby.");
4518 #endif
4519
4520                         }
4521                         break;
4522                 }
4523         }
4524
4525         if ((p_ptr->action == ACTION_LEARN) && thrown_spell > 175)
4526         {
4527                 learn_spell(thrown_spell - 96);
4528         }
4529
4530         if (seen && maneable && !world_monster && (p_ptr->pclass == CLASS_IMITATOR))
4531         {
4532                 if (thrown_spell != 167)
4533                 {
4534                         if (p_ptr->mane_num == MAX_MANE)
4535                         {
4536                                 int i;
4537                                 p_ptr->mane_num--;
4538                                 for (i = 0;i < p_ptr->mane_num;i++)
4539                                 {
4540                                         p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
4541                                         p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
4542                                 }
4543                         }
4544                         p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
4545                         p_ptr->mane_dam[p_ptr->mane_num] = dam;
4546                         p_ptr->mane_num++;
4547                         new_mane = TRUE;
4548
4549                         p_ptr->redraw |= (PR_MANE);
4550                 }
4551         }
4552
4553         /* Remember what the monster did to us */
4554         if (seen)
4555         {
4556                 /* Inate spell */
4557                 if (thrown_spell < 32 * 4)
4558                 {
4559                         r_ptr->r_flags4 |= (1L << (thrown_spell - 32 * 3));
4560                         if (r_ptr->r_cast_inate < MAX_UCHAR) r_ptr->r_cast_inate++;
4561                 }
4562
4563                 /* Bolt or Ball */
4564                 else if (thrown_spell < 32 * 5)
4565                 {
4566                         r_ptr->r_flags5 |= (1L << (thrown_spell - 32 * 4));
4567                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4568                 }
4569
4570                 /* Special spell */
4571                 else if (thrown_spell < 32 * 6)
4572                 {
4573                         r_ptr->r_flags6 |= (1L << (thrown_spell - 32 * 5));
4574                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4575                 }
4576         }
4577
4578
4579         /* Always take note of monsters that kill you */
4580         if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
4581         {
4582                 r_ptr->r_deaths++;
4583         }
4584
4585         /* A spell was cast */
4586         return (TRUE);
4587 }