OSDN Git Service

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