OSDN Git Service

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