OSDN Git Service

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