OSDN Git Service

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