OSDN Git Service

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