OSDN Git Service

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