OSDN Git Service

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