OSDN Git Service

通常の一時フラグと, それに対応する歌の状態の扱いが少しずれていたので,
[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  * Creatures can cast spells, shoot missiles, and breathe.
1160  *
1161  * Returns "TRUE" if a spell (or whatever) was (successfully) cast.
1162  *
1163  * XXX XXX XXX This function could use some work, but remember to
1164  * keep it as optimized as possible, while retaining generic code.
1165  *
1166  * Verify the various "blind-ness" checks in the code.
1167  *
1168  * XXX XXX XXX Note that several effects should really not be "seen"
1169  * if the player is blind.  See also "effects.c" for other "mistakes".
1170  *
1171  * Perhaps monsters should breathe at locations *near* the player,
1172  * since this would allow them to inflict "partial" damage.
1173  *
1174  * Perhaps smart monsters should decline to use "bolt" spells if
1175  * there is a monster in the way, unless they wish to kill it.
1176  *
1177  * Note that, to allow the use of the "track_target" option at some
1178  * later time, certain non-optimal things are done in the code below,
1179  * including explicit checks against the "direct" variable, which is
1180  * currently always true by the time it is checked, but which should
1181  * really be set according to an explicit "projectable()" test, and
1182  * the use of generic "x,y" locations instead of the player location,
1183  * with those values being initialized with the player location.
1184  *
1185  * It will not be possible to "correctly" handle the case in which a
1186  * monster attempts to attack a location which is thought to contain
1187  * the player, but which in fact is nowhere near the player, since this
1188  * might induce all sorts of messages about the attack itself, and about
1189  * the effects of the attack, which the player might or might not be in
1190  * a position to observe.  Thus, for simplicity, it is probably best to
1191  * only allow "faulty" attacks by a monster if one of the important grids
1192  * (probably the initial or final grid) is in fact in view of the player.
1193  * It may be necessary to actually prevent spell attacks except when the
1194  * monster actually has line of sight to the player.  Note that a monster
1195  * could be left in a bizarre situation after the player ducked behind a
1196  * pillar and then teleported away, for example.
1197  *
1198  * Note that certain spell attacks do not use the "project()" function
1199  * but "simulate" it via the "direct" variable, which is always at least
1200  * as restrictive as the "project()" function.  This is necessary to
1201  * prevent "blindness" attacks and such from bending around walls, etc,
1202  * and to allow the use of the "track_target" option in the future.
1203  *
1204  * Note that this function attempts to optimize the use of spells for the
1205  * cases in which the monster has no spells, or has spells but cannot use
1206  * them, or has spells but they will have no "useful" effect.  Note that
1207  * this function has been an efficiency bottleneck in the past.
1208  *
1209  * Note the special "MFLAG_NICE" flag, which prevents a monster from using
1210  * any spell attacks until the player has had a single chance to move.
1211  */
1212 bool make_attack_spell(int m_idx)
1213 {
1214         int             k, thrown_spell = 0, rlev, failrate;
1215         byte            spell[96], num = 0;
1216         u32b            f4, f5, f6;
1217         monster_type    *m_ptr = &m_list[m_idx];
1218         monster_race    *r_ptr = &r_info[m_ptr->r_idx];
1219         char            m_name[80];
1220         char            m_poss[80];
1221         char            ddesc[80];
1222         bool            no_inate = FALSE;
1223         bool            do_disi = FALSE;
1224         int             dam = 0;
1225         u32b mode = 0L;
1226         int s_num_6 = (easy_band ? 2 : 6);
1227         int s_num_4 = (easy_band ? 1 : 4);
1228
1229         /* Target location */
1230         int x = px;
1231         int y = py;
1232
1233         /* Summon count */
1234         int count = 0;
1235
1236         /* Extract the blind-ness */
1237         bool blind = (p_ptr->blind ? TRUE : FALSE);
1238
1239         /* Extract the "see-able-ness" */
1240         bool seen = (!blind && m_ptr->ml);
1241
1242         bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
1243         bool learnable = (seen && maneable && !world_monster);
1244
1245         /* Assume "projectable" */
1246         bool direct = TRUE;
1247
1248         /* Cannot cast spells when confused */
1249         if (m_ptr->confused)
1250         {
1251                 reset_target(m_ptr);
1252                 return (FALSE);
1253         }
1254
1255         /* Cannot cast spells when nice */
1256         if (m_ptr->mflag & MFLAG_NICE) return (FALSE);
1257         if (!is_hostile(m_ptr)) return (FALSE);
1258
1259
1260         /* Sometimes forbid inate attacks (breaths) */
1261         if (randint0(100) >= (r_ptr->freq_spell * 2)) no_inate = TRUE;
1262
1263         /* XXX XXX XXX Handle "track_target" option (?) */
1264
1265
1266         /* Extract the racial spell flags */
1267         f4 = r_ptr->flags4;
1268         f5 = r_ptr->flags5;
1269         f6 = r_ptr->flags6;
1270
1271         /*** require projectable player ***/
1272
1273         /* Check range */
1274         if ((m_ptr->cdis > MAX_RANGE) && !m_ptr->target_y) return (FALSE);
1275
1276         /* Check path */
1277         if (projectable(m_ptr->fy, m_ptr->fx, y, x))
1278         {
1279                 /* Breath disintegration to the glyph if possible */
1280                 if ((!cave_floor_bold(y,x)) && (r_ptr->flags4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE;
1281         }
1282
1283         /* Check path to next grid */
1284         else
1285         {
1286                 bool success = FALSE;
1287
1288                 if ((r_ptr->flags4 & RF4_BR_DISI) &&
1289                     (m_ptr->cdis < MAX_RANGE/2) &&
1290                     in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) &&
1291                     (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
1292                 {
1293                         do_disi = TRUE;
1294                         success = TRUE;
1295                 }
1296                 else
1297                 {
1298                         int i;
1299                         int tonari;
1300                         int tonari_y[4][8] = {{-1,-1,-1,0,0,1,1,1},
1301                                               {-1,-1,-1,0,0,1,1,1},
1302                                               {1,1,1,0,0,-1,-1,-1},
1303                                               {1,1,1,0,0,-1,-1,-1}};
1304                         int tonari_x[4][8] = {{-1,0,1,-1,1,-1,0,1},
1305                                               {1,0,-1,1,-1,1,0,-1},
1306                                               {-1,0,1,-1,1,-1,0,1},
1307                                               {1,0,-1,1,-1,1,0,-1}};
1308
1309                         if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
1310                         else if (m_ptr->fy < py) tonari = 1;
1311                         else if (m_ptr->fx < px) tonari = 2;
1312                         else tonari = 3;
1313
1314                         for (i = 0; i < 8; i++)
1315                         {
1316                                 int next_x = x + tonari_x[tonari][i];
1317                                 int next_y = y + tonari_y[tonari][i];
1318                                 cave_type *c_ptr;
1319
1320                                 /* Access the next grid */
1321                                 c_ptr = &cave[next_y][next_x];
1322
1323                                 /* Skip door, rubble, wall */
1324                                 if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
1325
1326                                 /* Skip tree */
1327                                 if (c_ptr->feat == FEAT_TREES) continue;
1328
1329                                 /* Skip mountain */
1330                                 if (c_ptr->feat == FEAT_MOUNTAIN) continue;
1331
1332                                 if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
1333                                 {
1334                                         y = next_y;
1335                                         x = next_x;
1336                                         success = TRUE;
1337                                         break;
1338                                 }
1339                         }
1340                 }
1341
1342                 if (!success)
1343                 {
1344                         if (m_ptr->target_y && m_ptr->target_x)
1345                         {
1346                                 y = m_ptr->target_y;
1347                                 x = m_ptr->target_x;
1348                                 f4 &= (RF4_INDIRECT_MASK);
1349                                 f5 &= (RF5_INDIRECT_MASK);
1350                                 f6 &= (RF6_INDIRECT_MASK);
1351                                 success = TRUE;
1352                         }
1353                 }
1354
1355                 /* No spells */
1356                 if (!success) return FALSE;
1357         }
1358
1359         reset_target(m_ptr);
1360
1361         /* Extract the monster level */
1362         rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
1363
1364         /* Forbid inate attacks sometimes */
1365         if (no_inate) f4 &= 0x500000FF;
1366
1367         if (!p_ptr->csp)
1368         {
1369                 f5 &= ~(RF5_DRAIN_MANA);
1370         }
1371         if ((p_ptr->pclass == CLASS_NINJA) && (r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)))
1372         {
1373                 f6 &= ~(RF6_DARKNESS);
1374         }
1375
1376         if (dun_level && (!p_ptr->inside_quest || (p_ptr->inside_quest < MIN_RANDOM_QUEST)) && (d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
1377         {
1378                 f4 &= (RF4_NOMAGIC_MASK);
1379                 f5 &= (RF5_NOMAGIC_MASK);
1380                 f6 &= (RF6_NOMAGIC_MASK);
1381         }
1382
1383         /* Hack -- allow "desperate" spells */
1384         if ((r_ptr->flags2 & (RF2_SMART)) &&
1385                 (m_ptr->hp < m_ptr->maxhp / 10) &&
1386                 (randint0(100) < 50))
1387         {
1388                 /* Require intelligent spells */
1389                 f4 &= (RF4_INT_MASK);
1390                 f5 &= (RF5_INT_MASK);
1391                 f6 &= (RF6_INT_MASK);
1392
1393                 /* No spells left */
1394                 if (!f4 && !f5 && !f6) return (FALSE);
1395         }
1396
1397         /* Remove the "ineffective" spells */
1398         remove_bad_spells(m_idx, &f4, &f5, &f6);
1399
1400         if (p_ptr->inside_arena)
1401         {
1402                 f4 &= ~(RF4_SUMMON_MASK);
1403                 f5 &= ~(RF5_SUMMON_MASK);
1404                 f6 &= ~(RF6_SUMMON_MASK);
1405         }
1406
1407         /* No spells left */
1408         if (!f4 && !f5 && !f6) return (FALSE);
1409
1410         /* Check for a clean bolt shot */
1411         if (((f4 & RF4_BOLT_MASK) ||
1412              (f5 & RF5_BOLT_MASK) ||
1413              (f6 & RF6_BOLT_MASK)) &&
1414             !(r_ptr->flags2 & RF2_STUPID) &&
1415             !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
1416         {
1417                 /* Remove spells that will only hurt friends */
1418                 f4 &= ~(RF4_BOLT_MASK);
1419                 f5 &= ~(RF5_BOLT_MASK);
1420                 f6 &= ~(RF6_BOLT_MASK);
1421         }
1422
1423         /* Check for a possible summon */
1424         if (((f4 & RF4_SUMMON_MASK) ||
1425              (f5 & RF5_SUMMON_MASK) ||
1426              (f6 & RF6_SUMMON_MASK)) &&
1427             !(r_ptr->flags2 & RF2_STUPID) &&
1428             !(summon_possible(y, x)))
1429         {
1430                 /* Remove summoning spells */
1431                 f4 &= ~(RF4_SUMMON_MASK);
1432                 f5 &= ~(RF5_SUMMON_MASK);
1433                 f6 &= ~(RF6_SUMMON_MASK);
1434         }
1435
1436         /* No spells left */
1437         if (!f4 && !f5 && !f6) return (FALSE);
1438
1439         /* Extract the "inate" spells */
1440         for (k = 0; k < 32; k++)
1441         {
1442                 if (f4 & (1L << k)) spell[num++] = k + 32 * 3;
1443         }
1444
1445         /* Extract the "normal" spells */
1446         for (k = 0; k < 32; k++)
1447         {
1448                 if (f5 & (1L << k)) spell[num++] = k + 32 * 4;
1449         }
1450
1451         /* Extract the "bizarre" spells */
1452         for (k = 0; k < 32; k++)
1453         {
1454                 if (f6 & (1L << k)) spell[num++] = k + 32 * 5;
1455         }
1456
1457         /* No spells left */
1458         if (!num) return (FALSE);
1459
1460         /* Stop if player is dead or gone */
1461         if (!p_ptr->playing || p_ptr->is_dead) return (FALSE);
1462
1463         /* Stop if player is leaving */
1464         if (p_ptr->leaving) return (FALSE);
1465
1466         /* Get the monster name (or "it") */
1467         monster_desc(m_name, m_ptr, 0x00);
1468
1469         /* Get the monster possessive ("his"/"her"/"its") */
1470         monster_desc(m_poss, m_ptr, 0x22);
1471
1472         /* Hack -- Get the "died from" name */
1473         monster_desc(ddesc, m_ptr, 0x288);
1474
1475         if (do_disi)
1476                 thrown_spell = 96+31;
1477         else
1478         {
1479                 int attempt = 10;
1480                 while(attempt--)
1481                 {
1482                         thrown_spell = choose_attack_spell(m_idx, spell, num);
1483                         if (thrown_spell) break;
1484                 }
1485         }
1486
1487         /* Abort if no spell was chosen */
1488         if (!thrown_spell) return (FALSE);
1489
1490         /* Calculate spell failure rate */
1491         failrate = 25 - (rlev + 3) / 4;
1492
1493         /* Hack -- Stupid monsters will never fail (for jellies and such) */
1494         if (r_ptr->flags2 & RF2_STUPID) failrate = 0;
1495
1496         /* Check for spell failure (inate attacks never fail) */
1497         if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
1498         {
1499                 disturb(1, 0);
1500                 /* Message */
1501                 if (thrown_spell != (160+7)) /* Not RF6_SPECIAL */
1502                 {
1503 #ifdef JP
1504                         msg_format("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", m_name);
1505 #else
1506                         msg_format("%^s tries to cast a spell, but fails.", m_name);
1507 #endif
1508                 }
1509
1510                 return (TRUE);
1511         }
1512
1513
1514         /* Cast the spell. */
1515         switch (thrown_spell)
1516         {
1517                 /* RF4_SHRIEK */
1518                 case 96+0:
1519                 {
1520                         if (!direct) break;
1521                         disturb(1, 0);
1522 #ifdef JP
1523 msg_format("%^s¤¬¤«¤ó¹â¤¤¶âÀÚ¤êÀ¼¤ò¤¢¤²¤¿¡£", m_name);
1524 #else
1525                         msg_format("%^s makes a high pitched shriek.", m_name);
1526 #endif
1527
1528                         aggravate_monsters(m_idx);
1529                         break;
1530                 }
1531
1532                 /* RF4_XXX1 */
1533                 case 96+1:
1534                 {
1535                         /* XXX XXX XXX */
1536                         break;
1537                 }
1538
1539                 /* RF4_DISPEL */
1540                 case 96+2:
1541                 {
1542                         if (x!=px || y!=py) return (FALSE);
1543                         disturb(1, 0);
1544 #ifdef JP
1545                         if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
1546                         else msg_format("%^s¤¬ËâÎϾõî¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
1547 #else
1548                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
1549                         else msg_format("%^s invokes a dispel magic.", m_name);
1550 #endif
1551                         set_fast(0, TRUE);
1552                         set_lightspeed(0, TRUE);
1553                         set_slow(0, TRUE);
1554                         set_shield(0, TRUE);
1555                         set_blessed(0, TRUE);
1556                         set_tsuyoshi(0, TRUE);
1557                         set_hero(0, TRUE);
1558                         set_shero(0, TRUE);
1559                         set_protevil(0, TRUE);
1560                         set_invuln(0, TRUE);
1561                         set_wraith_form(0, TRUE);
1562                         set_kabenuke(0, TRUE);
1563                         set_tim_res_nether(0, TRUE);
1564                         set_tim_res_time(0, TRUE);
1565                         /* by henkma */
1566                         set_tim_reflect(0,TRUE);
1567                         set_multishadow(0,TRUE);
1568                         set_dustrobe(0,TRUE);
1569
1570                         set_tim_invis(0, TRUE);
1571                         set_tim_infra(0, TRUE);
1572                         set_tim_esp(0, TRUE);
1573                         set_tim_regen(0, TRUE);
1574                         set_tim_stealth(0, TRUE);
1575                         set_tim_ffall(0, TRUE);
1576                         set_tim_sh_touki(0, TRUE);
1577                         set_tim_sh_fire(0, TRUE);
1578                         set_tim_sh_holy(0, TRUE);
1579                         set_tim_eyeeye(0, TRUE);
1580                         set_magicdef(0, TRUE);
1581                         set_resist_magic(0, TRUE);
1582                         set_oppose_acid(0, TRUE);
1583                         set_oppose_elec(0, TRUE);
1584                         set_oppose_fire(0, TRUE);
1585                         set_oppose_cold(0, TRUE);
1586                         set_oppose_pois(0, TRUE);
1587                         set_ultimate_res(0, TRUE);
1588                         set_mimic(0, 0, TRUE);
1589                         set_ele_attack(0, 0);
1590                         set_ele_immune(0, 0);
1591                         /* Cancel glowing hands */
1592                         if (p_ptr->special_attack & ATTACK_CONFUSE)
1593                         {
1594                                 p_ptr->special_attack &= ~(ATTACK_CONFUSE);
1595 #ifdef JP
1596                                 msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
1597 #else
1598                                 msg_print("Your hands stop glowing.");
1599 #endif
1600
1601                         }
1602                         if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0]))
1603                         {
1604                                 p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
1605                                 p_ptr->magic_num1[0] = 0;
1606 #ifdef JP
1607                                 msg_print("²Î¤¬ÅÓÀڤ줿¡£");
1608 #else
1609                                 msg_print("Your singing is interrupted.");
1610 #endif
1611                                 p_ptr->action = ACTION_NONE;
1612
1613                                 /* Recalculate bonuses */
1614                                 p_ptr->update |= (PU_BONUS | PU_HP);
1615
1616                                 /* Redraw map */
1617                                 p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
1618
1619                                 /* Update monsters */
1620                                 p_ptr->update |= (PU_MONSTERS);
1621
1622                                 /* Window stuff */
1623                                 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1624
1625                                 p_ptr->energy_need += ENERGY_NEED();
1626                         }
1627                         if (p_ptr->riding)
1628                         {
1629                                 m_list[p_ptr->riding].invulner = 0;
1630                                 m_list[p_ptr->riding].fast = 0;
1631                                 m_list[p_ptr->riding].slow = 0;
1632                                 p_ptr->update |= PU_BONUS;
1633                                 if (p_ptr->health_who == p_ptr->riding) p_ptr->redraw |= PR_HEALTH;
1634                                 p_ptr->redraw |= (PR_UHEALTH);
1635                         }
1636
1637 #ifdef JP
1638                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
1639                                 msg_print("¤ä¤ê¤ä¤¬¤Ã¤¿¤Ê¡ª");
1640 #endif
1641                         learn_spell(MS_DISPEL);
1642                         break;
1643                 }
1644
1645                 /* RF4_XXX4X4 */
1646                 case 96+3:
1647                 {
1648                         disturb(1, 0);
1649 #ifdef JP
1650 if (blind) msg_format("%^s¤¬²¿¤«¤ò¼Í¤Ã¤¿¡£", m_name);
1651 #else
1652                         if (blind) msg_format("%^s shoots something.", m_name);
1653 #endif
1654
1655 #ifdef JP
1656 else msg_format("%^s¤¬¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡£", m_name);
1657 #else
1658                         else msg_format("%^s fires a rocket.", m_name);
1659 #endif
1660
1661                         dam = ((m_ptr->hp / 4) > 800 ? 800 : (m_ptr->hp / 4));
1662                         breath(y, x, m_idx, GF_ROCKET,
1663                                 dam, 2, FALSE, MS_ROCKET, learnable);
1664                         update_smart_learn(m_idx, DRS_SHARD);
1665                         break;
1666                 }
1667
1668                 /* RF4_SHOOT */
1669                 case 96+4:
1670                 {
1671                         if (x!=px || y!=py) return (FALSE);
1672                         disturb(1, 0);
1673 #ifdef JP
1674 if (blind) msg_format("%^s¤¬´ñ̯¤Ê²»¤òȯ¤·¤¿¡£", m_name);
1675 #else
1676                         if (blind) msg_format("%^s makes a strange noise.", m_name);
1677 #endif
1678
1679 #ifdef JP
1680 else msg_format("%^s¤¬Ìð¤òÊü¤Ã¤¿¡£", m_name);
1681 #else
1682                         else msg_format("%^s fires an arrow.", m_name);
1683 #endif
1684
1685                         dam = damroll(r_ptr->blow[0].d_dice, r_ptr->blow[0].d_side);
1686                         bolt(m_idx, GF_ARROW, dam, MS_SHOOT, learnable);
1687                         update_smart_learn(m_idx, DRS_REFLECT);
1688                         break;
1689                 }
1690
1691                 /* RF4_XXX2 */
1692                 case 96+5:
1693                 {
1694                         /* XXX XXX XXX */
1695                         break;
1696                 }
1697
1698                 /* RF4_XXX3 */
1699                 case 96+6:
1700                 {
1701                         /* XXX XXX XXX */
1702                         break;
1703                 }
1704
1705                 /* RF4_XXX4 */
1706                 case 96+7:
1707                 {
1708                         /* XXX XXX XXX */
1709                         break;
1710                 }
1711
1712                 /* RF4_BR_ACID */
1713                 case 96+8:
1714                 {
1715                         disturb(1, 0);
1716 #ifdef JP
1717 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1718 #else
1719                         if (blind) msg_format("%^s breathes.", m_name);
1720 #endif
1721
1722 #ifdef JP
1723 else msg_format("%^s¤¬»À¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1724 #else
1725                         else msg_format("%^s breathes acid.", m_name);
1726 #endif
1727
1728                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1729                         breath(y, x, m_idx, GF_ACID, dam, 0, TRUE, MS_BR_ACID, learnable);
1730                         update_smart_learn(m_idx, DRS_ACID);
1731                         break;
1732                 }
1733
1734                 /* RF4_BR_ELEC */
1735                 case 96+9:
1736                 {
1737                         disturb(1, 0);
1738 #ifdef JP
1739 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1740 #else
1741                         if (blind) msg_format("%^s breathes.", m_name);
1742 #endif
1743
1744 #ifdef JP
1745 else msg_format("%^s¤¬°ðºÊ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1746 #else
1747                         else msg_format("%^s breathes lightning.", m_name);
1748 #endif
1749
1750                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1751                         breath(y, x, m_idx, GF_ELEC, dam,0, TRUE, MS_BR_ELEC, learnable);
1752                         update_smart_learn(m_idx, DRS_ELEC);
1753                         break;
1754                 }
1755
1756                 /* RF4_BR_FIRE */
1757                 case 96+10:
1758                 {
1759                         disturb(1, 0);
1760 #ifdef JP
1761 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1762 #else
1763                         if (blind) msg_format("%^s breathes.", m_name);
1764 #endif
1765
1766 #ifdef JP
1767 else msg_format("%^s¤¬²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1768 #else
1769                         else msg_format("%^s breathes fire.", m_name);
1770 #endif
1771
1772                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1773                         breath(y, x, m_idx, GF_FIRE, dam,0, TRUE, MS_BR_FIRE, learnable);
1774                         update_smart_learn(m_idx, DRS_FIRE);
1775                         break;
1776                 }
1777
1778                 /* RF4_BR_COLD */
1779                 case 96+11:
1780                 {
1781                         disturb(1, 0);
1782 #ifdef JP
1783 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1784 #else
1785                         if (blind) msg_format("%^s breathes.", m_name);
1786 #endif
1787
1788 #ifdef JP
1789 else msg_format("%^s¤¬Î䵤¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1790 #else
1791                         else msg_format("%^s breathes frost.", m_name);
1792 #endif
1793
1794                         dam = ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3));
1795                         breath(y, x, m_idx, GF_COLD, dam,0, TRUE, MS_BR_COLD, learnable);
1796                         update_smart_learn(m_idx, DRS_COLD);
1797                         break;
1798                 }
1799
1800                 /* RF4_BR_POIS */
1801                 case 96+12:
1802                 {
1803                         disturb(1, 0);
1804 #ifdef JP
1805 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1806 #else
1807                         if (blind) msg_format("%^s breathes.", m_name);
1808 #endif
1809
1810 #ifdef JP
1811 else msg_format("%^s¤¬¥¬¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1812 #else
1813                         else msg_format("%^s breathes gas.", m_name);
1814 #endif
1815
1816                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
1817                         breath(y, x, m_idx, GF_POIS, dam, 0, TRUE, MS_BR_POIS, learnable);
1818                         update_smart_learn(m_idx, DRS_POIS);
1819                         break;
1820                 }
1821
1822
1823                 /* RF4_BR_NETH */
1824                 case 96+13:
1825                 {
1826                         disturb(1, 0);
1827 #ifdef JP
1828 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1829 #else
1830                         if (blind) msg_format("%^s breathes.", m_name);
1831 #endif
1832
1833 #ifdef JP
1834 else msg_format("%^s¤¬ÃϹö¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1835 #else
1836                         else msg_format("%^s breathes nether.", m_name);
1837 #endif
1838
1839                         dam = ((m_ptr->hp / 6) > 550 ? 550 : (m_ptr->hp / 6));
1840                         breath(y, x, m_idx, GF_NETHER, dam,0, TRUE, MS_BR_NETHER, learnable);
1841                         update_smart_learn(m_idx, DRS_NETH);
1842                         break;
1843                 }
1844
1845                 /* RF4_BR_LITE */
1846                 case 96+14:
1847                 {
1848                         disturb(1, 0);
1849 #ifdef JP
1850 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1851 #else
1852                         if (blind) msg_format("%^s breathes.", m_name);
1853 #endif
1854
1855 #ifdef JP
1856 else msg_format("%^s¤¬Á®¸÷¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1857 #else
1858                         else msg_format("%^s breathes light.", m_name);
1859 #endif
1860
1861                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1862                         breath(y, x, m_idx, GF_LITE, dam,0, TRUE, MS_BR_LITE, learnable);
1863                         update_smart_learn(m_idx, DRS_LITE);
1864                         break;
1865                 }
1866
1867                 /* RF4_BR_DARK */
1868                 case 96+15:
1869                 {
1870                         disturb(1, 0);
1871 #ifdef JP
1872 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1873 #else
1874                         if (blind) msg_format("%^s breathes.", m_name);
1875 #endif
1876
1877 #ifdef JP
1878 else msg_format("%^s¤¬°Å¹õ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1879 #else
1880                         else msg_format("%^s breathes darkness.", m_name);
1881 #endif
1882
1883                         dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
1884                         breath(y, x, m_idx, GF_DARK, dam,0, TRUE, MS_BR_DARK, learnable);
1885                         update_smart_learn(m_idx, DRS_DARK);
1886                         break;
1887                 }
1888
1889                 /* RF4_BR_CONF */
1890                 case 96+16:
1891                 {
1892                         disturb(1, 0);
1893 #ifdef JP
1894 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1895 #else
1896                         if (blind) msg_format("%^s breathes.", m_name);
1897 #endif
1898
1899 #ifdef JP
1900 else msg_format("%^s¤¬º®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1901 #else
1902                         else msg_format("%^s breathes confusion.", m_name);
1903 #endif
1904
1905                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1906                         breath(y, x, m_idx, GF_CONFUSION, dam,0, TRUE, MS_BR_CONF, learnable);
1907                         update_smart_learn(m_idx, DRS_CONF);
1908                         break;
1909                 }
1910
1911                 /* RF4_BR_SOUN */
1912                 case 96+17:
1913                 {
1914                         disturb(1, 0);
1915                         if (m_ptr->r_idx == MON_JAIAN)
1916 #ifdef JP
1917                                 msg_format("¡Ö¥Ü¥©¥¨¡Á¡Á¡Á¡Á¡Á¡Á¡×");
1918 #else
1919                                 msg_format("'Booooeeeeee'");
1920 #endif
1921 #ifdef JP
1922 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1923 #else
1924                         else if (blind) msg_format("%^s breathes.", m_name);
1925 #endif
1926
1927 #ifdef JP
1928 else msg_format("%^s¤¬¹ì²»¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1929 #else
1930                         else msg_format("%^s breathes sound.", m_name);
1931 #endif
1932
1933                         dam = ((m_ptr->hp / 6) > 450 ? 450 : (m_ptr->hp / 6));
1934                         breath(y, x, m_idx, GF_SOUND, dam,0, TRUE, MS_BR_SOUND, learnable);
1935                         update_smart_learn(m_idx, DRS_SOUND);
1936                         break;
1937                 }
1938
1939                 /* RF4_BR_CHAO */
1940                 case 96+18:
1941                 {
1942                         disturb(1, 0);
1943 #ifdef JP
1944 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1945 #else
1946                         if (blind) msg_format("%^s breathes.", m_name);
1947 #endif
1948
1949 #ifdef JP
1950 else msg_format("%^s¤¬¥«¥ª¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1951 #else
1952                         else msg_format("%^s breathes chaos.", m_name);
1953 #endif
1954
1955                         dam = ((m_ptr->hp / 6) > 600 ? 600 : (m_ptr->hp / 6));
1956                         breath(y, x, m_idx, GF_CHAOS, dam,0, TRUE, MS_BR_CHAOS, learnable);
1957                         update_smart_learn(m_idx, DRS_CHAOS);
1958                         break;
1959                 }
1960
1961                 /* RF4_BR_DISE */
1962                 case 96+19:
1963                 {
1964                         disturb(1, 0);
1965 #ifdef JP
1966 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1967 #else
1968                         if (blind) msg_format("%^s breathes.", m_name);
1969 #endif
1970
1971 #ifdef JP
1972 else msg_format("%^s¤¬Îô²½¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1973 #else
1974                         else msg_format("%^s breathes disenchantment.", m_name);
1975 #endif
1976
1977                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
1978                         breath(y, x, m_idx, GF_DISENCHANT, dam,0, TRUE, MS_BR_DISEN, learnable);
1979                         update_smart_learn(m_idx, DRS_DISEN);
1980                         break;
1981                 }
1982
1983                 /* RF4_BR_NEXU */
1984                 case 96+20:
1985                 {
1986                         disturb(1, 0);
1987 #ifdef JP
1988 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1989 #else
1990                         if (blind) msg_format("%^s breathes.", m_name);
1991 #endif
1992
1993 #ifdef JP
1994 else msg_format("%^s¤¬°ø²Ìº®Íð¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
1995 #else
1996                         else msg_format("%^s breathes nexus.", m_name);
1997 #endif
1998
1999                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2000                         breath(y, x, m_idx, GF_NEXUS, dam,0, TRUE, MS_BR_NEXUS, learnable);
2001                         update_smart_learn(m_idx, DRS_NEXUS);
2002                         break;
2003                 }
2004
2005                 /* RF4_BR_TIME */
2006                 case 96+21:
2007                 {
2008                         disturb(1, 0);
2009 #ifdef JP
2010 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2011 #else
2012                         if (blind) msg_format("%^s breathes.", m_name);
2013 #endif
2014
2015 #ifdef JP
2016 else msg_format("%^s¤¬»þ´ÖµÕž¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2017 #else
2018                         else msg_format("%^s breathes time.", m_name);
2019 #endif
2020
2021                         dam = ((m_ptr->hp / 3) > 150 ? 150 : (m_ptr->hp / 3));
2022                         breath(y, x, m_idx, GF_TIME, dam,0, TRUE, MS_BR_TIME, learnable);
2023                         break;
2024                 }
2025
2026                 /* RF4_BR_INER */
2027                 case 96+22:
2028                 {
2029                         disturb(1, 0);
2030 #ifdef JP
2031 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2032 #else
2033                         if (blind) msg_format("%^s breathes.", m_name);
2034 #endif
2035
2036 #ifdef JP
2037 else msg_format("%^s¤¬ÃÙÆߤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2038 #else
2039                         else msg_format("%^s breathes inertia.", m_name);
2040 #endif
2041
2042                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2043                         breath(y, x, m_idx, GF_INERTIA, dam,0, TRUE, MS_BR_INERTIA, learnable);
2044                         break;
2045                 }
2046
2047                 /* RF4_BR_GRAV */
2048                 case 96+23:
2049                 {
2050                         disturb(1, 0);
2051 #ifdef JP
2052 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2053 #else
2054                         if (blind) msg_format("%^s breathes.", m_name);
2055 #endif
2056
2057 #ifdef JP
2058 else msg_format("%^s¤¬½ÅÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2059 #else
2060                         else msg_format("%^s breathes gravity.", m_name);
2061 #endif
2062
2063                         dam = ((m_ptr->hp / 3) > 200 ? 200 : (m_ptr->hp / 3));
2064                         breath(y, x, m_idx, GF_GRAVITY, dam,0, TRUE, MS_BR_GRAVITY, learnable);
2065                         break;
2066                 }
2067
2068                 /* RF4_BR_SHAR */
2069                 case 96+24:
2070                 {
2071                         disturb(1, 0);
2072                         if (m_ptr->r_idx == MON_BOTEI)
2073 #ifdef JP
2074                                 msg_format("¡Ö¥ÜÄë¥Ó¥ë¥«¥Ã¥¿¡¼¡ª¡ª¡ª¡×");
2075 #else
2076                                 msg_format("'Boty-Build cutter!!!'");
2077 #endif
2078 #ifdef JP
2079 else if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2080 #else
2081                         else if (blind) msg_format("%^s breathes.", m_name);
2082 #endif
2083
2084 #ifdef JP
2085 else msg_format("%^s¤¬ÇËÊҤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2086 #else
2087                         else msg_format("%^s breathes shards.", m_name);
2088 #endif
2089
2090                         dam = ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6));
2091                         breath(y, x, m_idx, GF_SHARDS, dam,0, TRUE, MS_BR_SHARDS, learnable);
2092                         update_smart_learn(m_idx, DRS_SHARD);
2093                         break;
2094                 }
2095
2096                 /* RF4_BR_PLAS */
2097                 case 96+25:
2098                 {
2099                         disturb(1, 0);
2100 #ifdef JP
2101 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2102 #else
2103                         if (blind) msg_format("%^s breathes.", m_name);
2104 #endif
2105
2106 #ifdef JP
2107 else msg_format("%^s¤¬¥×¥é¥º¥Þ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2108 #else
2109                         else msg_format("%^s breathes plasma.", m_name);
2110 #endif
2111
2112                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2113                         breath(y, x, m_idx, GF_PLASMA, dam,0, TRUE, MS_BR_PLASMA, learnable);
2114                         break;
2115                 }
2116
2117                 /* RF4_BR_WALL */
2118                 case 96+26:
2119                 {
2120                         disturb(1, 0);
2121 #ifdef JP
2122 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2123 #else
2124                         if (blind) msg_format("%^s breathes.", m_name);
2125 #endif
2126
2127 #ifdef JP
2128 else msg_format("%^s¤¬¥Õ¥©¡¼¥¹¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2129 #else
2130                         else msg_format("%^s breathes force.", m_name);
2131 #endif
2132
2133                         dam = ((m_ptr->hp / 6) > 200 ? 200 : (m_ptr->hp / 6));
2134                         breath(y, x, m_idx, GF_FORCE, dam,0, TRUE, MS_BR_FORCE, learnable);
2135                         break;
2136                 }
2137
2138                 /* RF4_BR_MANA */
2139                 case 96+27:
2140                 {
2141                         disturb(1, 0);
2142 #ifdef JP
2143 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2144 #else
2145                         if (blind) msg_format("%^s breathes.", m_name);
2146 #endif
2147
2148 #ifdef JP
2149 else msg_format("%^s¤¬ËâÎϤΥ֥쥹¤òÅǤ¤¤¿¡£", m_name);
2150 #else
2151                         else msg_format("%^s breathes mana.", m_name);
2152 #endif
2153                         dam = ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3));
2154                         breath(y, x, m_idx, GF_MANA, dam,0, TRUE, MS_BR_MANA, learnable);
2155                         break;
2156                 }
2157
2158                 /* RF4_BA_NUKE */
2159                 case 96+28:
2160                 {
2161                         disturb(1, 0);
2162 #ifdef JP
2163 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2164 #else
2165                         if (blind) msg_format("%^s mumbles.", m_name);
2166 #endif
2167
2168 #ifdef JP
2169 else msg_format("%^s¤¬Êü¼Íǽµå¤òÊü¤Ã¤¿¡£", m_name);
2170 #else
2171                         else msg_format("%^s casts a ball of radiation.", m_name);
2172 #endif
2173
2174                         dam = (rlev + damroll(10, 6)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2175                         breath(y, x, m_idx, GF_NUKE, dam, 2, FALSE, MS_BALL_NUKE, learnable);
2176                         update_smart_learn(m_idx, DRS_POIS);
2177                         break;
2178                 }
2179
2180                 /* RF4_BR_NUKE */
2181                 case 96+29:
2182                 {
2183                         disturb(1, 0);
2184 #ifdef JP
2185 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2186 #else
2187                         if (blind) msg_format("%^s breathes.", m_name);
2188 #endif
2189
2190 #ifdef JP
2191 else msg_format("%^s¤¬Êü¼ÍÀ­ÇÑ´þʪ¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2192 #else
2193                         else msg_format("%^s breathes toxic waste.", m_name);
2194 #endif
2195
2196                         dam = ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3));
2197                         breath(y, x, m_idx, GF_NUKE, dam,0, TRUE, MS_BR_NUKE, learnable);
2198                         update_smart_learn(m_idx, DRS_POIS);
2199                         break;
2200                 }
2201
2202                 /* RF4_BA_CHAO */
2203                 case 96+30:
2204                 {
2205                         disturb(1, 0);
2206 #ifdef JP
2207 if (blind) msg_format("%^s¤¬¶²¤í¤·¤²¤Ë¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2208 #else
2209                         if (blind) msg_format("%^s mumbles frighteningly.", m_name);
2210 #endif
2211
2212 #ifdef JP
2213 else msg_format("%^s¤¬½ã¥í¥°¥ë¥¹¤òÊü¤Ã¤¿¡£", m_name);/*nuke me*/
2214 #else
2215                         else msg_format("%^s invokes a raw Logrus.", m_name);
2216 #endif
2217
2218                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? (rlev * 3) : (rlev * 2))+ damroll(10, 10);
2219                         breath(y, x, m_idx, GF_CHAOS, dam, 4, FALSE, MS_BALL_CHAOS, learnable);
2220                         update_smart_learn(m_idx, DRS_CHAOS);
2221                         break;
2222                 }
2223
2224                 /* RF4_BR_DISI */
2225                 case 96+31:
2226                 {
2227                         disturb(1, 0);
2228 #ifdef JP
2229 if (blind) msg_format("%^s¤¬²¿¤«¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2230 #else
2231                         if (blind) msg_format("%^s breathes.", m_name);
2232 #endif
2233
2234 #ifdef JP
2235 else msg_format("%^s¤¬Ê¬²ò¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", m_name);
2236 #else
2237                         else msg_format("%^s breathes disintegration.", m_name);
2238 #endif
2239
2240                         dam = ((m_ptr->hp / 6) > 150 ? 150 : (m_ptr->hp / 6));
2241                         breath(y, x, m_idx, GF_DISINTEGRATE, dam,0, TRUE, MS_BR_DISI, learnable);
2242                         break;
2243                 }
2244
2245
2246
2247                 /* RF5_BA_ACID */
2248                 case 128+0:
2249                 {
2250                         disturb(1, 0);
2251 #ifdef JP
2252 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2253 #else
2254                         if (blind) msg_format("%^s mumbles.", m_name);
2255 #endif
2256
2257 #ifdef JP
2258 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2259 #else
2260                         else msg_format("%^s casts an acid ball.", m_name);
2261 #endif
2262
2263                         dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2264                         breath(y, x, m_idx, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
2265                         update_smart_learn(m_idx, DRS_ACID);
2266                         break;
2267                 }
2268
2269                 /* RF5_BA_ELEC */
2270                 case 128+1:
2271                 {
2272                         disturb(1, 0);
2273 #ifdef JP
2274 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2275 #else
2276                         if (blind) msg_format("%^s mumbles.", m_name);
2277 #endif
2278
2279 #ifdef JP
2280 else msg_format("%^s¤¬¥µ¥ó¥À¡¼¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2281 #else
2282                         else msg_format("%^s casts a lightning ball.", m_name);
2283 #endif
2284
2285                         dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2286                         breath(y, x, m_idx, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
2287                         update_smart_learn(m_idx, DRS_ELEC);
2288                         break;
2289                 }
2290
2291                 /* RF5_BA_FIRE */
2292                 case 128+2:
2293                 {
2294                         disturb(1, 0);
2295
2296                         if (m_ptr->r_idx == MON_ROLENTO)
2297                         {
2298 #ifdef JP
2299                                 if (blind)
2300                                         msg_format("%s¤¬²¿¤«¤òÅꤲ¤¿¡£", m_name);
2301                                 else 
2302                                         msg_format("%s¤Ï¼êÜØÃƤòÅꤲ¤¿¡£", m_name);
2303 #else
2304                                 if (blind)
2305                                         msg_format("%^s throws something.", m_name);
2306                                 else
2307                                         msg_format("%^s throws a hand grenade.", m_name);
2308 #endif
2309                         }
2310                         else
2311                         {
2312 #ifdef JP
2313 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2314 #else
2315                                 if (blind) msg_format("%^s mumbles.", m_name);
2316 #endif
2317
2318 #ifdef JP
2319 else msg_format("%^s¤¬¥Õ¥¡¥¤¥¢¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2320 #else
2321                                 else msg_format("%^s casts a fire ball.", m_name);
2322 #endif
2323                         }
2324
2325                         dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2326                         breath(y, x, m_idx, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
2327                         update_smart_learn(m_idx, DRS_FIRE);
2328                         break;
2329                 }
2330
2331                 /* RF5_BA_COLD */
2332                 case 128+3:
2333                 {
2334                         disturb(1, 0);
2335 #ifdef JP
2336 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2337 #else
2338                         if (blind) msg_format("%^s mumbles.", m_name);
2339 #endif
2340
2341 #ifdef JP
2342 else msg_format("%^s¤¬¥¢¥¤¥¹¡¦¥Ü¡¼¥ë¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2343 #else
2344                         else msg_format("%^s casts a frost ball.", m_name);
2345 #endif
2346
2347                         dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2348                         breath(y, x, m_idx, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
2349                         update_smart_learn(m_idx, DRS_COLD);
2350                         break;
2351                 }
2352
2353                 /* RF5_BA_POIS */
2354                 case 128+4:
2355                 {
2356                         disturb(1, 0);
2357 #ifdef JP
2358 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2359 #else
2360                         if (blind) msg_format("%^s mumbles.", m_name);
2361 #endif
2362
2363 #ifdef JP
2364 else msg_format("%^s¤¬°­½­±À¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2365 #else
2366                         else msg_format("%^s casts a stinking cloud.", m_name);
2367 #endif
2368
2369                         dam = damroll(12, 2) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2370                         breath(y, x, m_idx, GF_POIS, dam, 2, FALSE, MS_BALL_POIS, learnable);
2371                         update_smart_learn(m_idx, DRS_POIS);
2372                         break;
2373                 }
2374
2375                 /* RF5_BA_NETH */
2376                 case 128+5:
2377                 {
2378                         disturb(1, 0);
2379 #ifdef JP
2380 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2381 #else
2382                         if (blind) msg_format("%^s mumbles.", m_name);
2383 #endif
2384
2385 #ifdef JP
2386 else msg_format("%^s¤¬ÃϹöµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2387 #else
2388                         else msg_format("%^s casts a nether ball.", m_name);
2389 #endif
2390
2391                         dam = 50 + damroll(10, 10) + (rlev * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1));
2392                         breath(y, x, m_idx, GF_NETHER, dam, 2, FALSE, MS_BALL_NETHER, learnable);
2393                         update_smart_learn(m_idx, DRS_NETH);
2394                         break;
2395                 }
2396
2397                 /* RF5_BA_WATE */
2398                 case 128+6:
2399                 {
2400                         disturb(1, 0);
2401 #ifdef JP
2402 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2403 #else
2404                         if (blind) msg_format("%^s mumbles.", m_name);
2405 #endif
2406
2407 #ifdef JP
2408 else msg_format("%^s¤¬Î®¤ì¤ë¤è¤¦¤Ê¿È¿¶¤ê¤ò¤·¤¿¡£", m_name);
2409 #else
2410                         else msg_format("%^s gestures fluidly.", m_name);
2411 #endif
2412
2413 #ifdef JP
2414 msg_print("¤¢¤Ê¤¿¤Ï±²´¬¤­¤Ë°û¤ß¹þ¤Þ¤ì¤¿¡£");
2415 #else
2416                         msg_print("You are engulfed in a whirlpool.");
2417 #endif
2418
2419                         dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
2420                         breath(y, x, m_idx, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
2421                         break;
2422                 }
2423
2424                 /* RF5_BA_MANA */
2425                 case 128+7:
2426                 {
2427                         disturb(1, 0);
2428 #ifdef JP
2429 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2430 #else
2431                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2432 #endif
2433
2434 #ifdef JP
2435 else msg_format("%^s¤¬ËâÎϤÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2436 #else
2437                         else msg_format("%^s invokes a mana storm.", m_name);
2438 #endif
2439
2440                         dam = (rlev * 4) + 50 + damroll(10, 10);
2441                         breath(y, x, m_idx, GF_MANA, dam, 4, FALSE, MS_BALL_MANA, learnable);
2442                         break;
2443                 }
2444
2445                 /* RF5_BA_DARK */
2446                 case 128+8:
2447                 {
2448                         disturb(1, 0);
2449 #ifdef JP
2450 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2451 #else
2452                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2453 #endif
2454
2455 #ifdef JP
2456 else msg_format("%^s¤¬°Å¹õ¤ÎÍò¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2457 #else
2458                         else msg_format("%^s invokes a darkness storm.", m_name);
2459 #endif
2460
2461                         dam = (rlev * 4) + 50 + damroll(10, 10);
2462                         breath(y, x, m_idx, GF_DARK, dam, 4, FALSE, MS_BALL_DARK, learnable);
2463                         update_smart_learn(m_idx, DRS_DARK);
2464                         break;
2465                 }
2466
2467                 /* RF5_DRAIN_MANA */
2468                 case 128+9:
2469                 {
2470                         if (x!=px || y!=py) return (FALSE);
2471                         if (!direct) break;
2472                         disturb(1, 0);
2473                         if (p_ptr->csp)
2474                         {
2475                                 int r1;
2476
2477                                 /* Basic message */
2478 #ifdef JP
2479 msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
2480 #else
2481                                 msg_format("%^s draws psychic energy from you!", m_name);
2482 #endif
2483
2484
2485                                 /* Attack power */
2486                                 r1 = (randint1(rlev) / 2) + 1;
2487
2488                                 /* Full drain */
2489                                 if (r1 >= p_ptr->csp)
2490                                 {
2491                                         r1 = p_ptr->csp;
2492                                         p_ptr->csp = 0;
2493                                         p_ptr->csp_frac = 0;
2494                                 }
2495
2496                                 /* Partial drain */
2497                                 else
2498                                 {
2499                                         p_ptr->csp -= r1;
2500                                 }
2501
2502                                 learn_spell(MS_DRAIN_MANA);
2503
2504                                 /* Redraw mana */
2505                                 p_ptr->redraw |= (PR_MANA);
2506
2507                                 /* Window stuff */
2508                                 p_ptr->window |= (PW_PLAYER);
2509                                 p_ptr->window |= (PW_SPELL);
2510
2511                                 /* Heal the monster */
2512                                 if (m_ptr->hp < m_ptr->maxhp)
2513                                 {
2514                                         /* Heal */
2515                                         m_ptr->hp += (6 * r1);
2516                                         if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2517
2518                                         /* Redraw (later) if needed */
2519                                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
2520                                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
2521
2522                                         /* Special message */
2523                                         if (seen)
2524                                         {
2525 #ifdef JP
2526 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
2527 #else
2528                                                 msg_format("%^s appears healthier.", m_name);
2529 #endif
2530
2531                                         }
2532                                 }
2533                         }
2534                         update_smart_learn(m_idx, DRS_MANA);
2535                         break;
2536                 }
2537
2538                 /* RF5_MIND_BLAST */
2539                 case 128+10:
2540                 {
2541                         if (x!=px || y!=py) return (FALSE);
2542                         if (!direct) break;
2543                         disturb(1, 0);
2544                         if (!seen)
2545                         {
2546 #ifdef JP
2547 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2548 #else
2549                                 msg_print("You feel something focusing on your mind.");
2550 #endif
2551
2552                         }
2553                         else
2554                         {
2555 #ifdef JP
2556 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¤Ë¤é¤ó¤Ç¤¤¤ë¡£", m_name);
2557 #else
2558                                 msg_format("%^s gazes deep into your eyes.", m_name);
2559 #endif
2560
2561                         }
2562
2563                         dam = damroll(7, 7);
2564                         breath(y, x, m_idx, GF_MIND_BLAST, dam, 0, FALSE, MS_MIND_BLAST, learnable);
2565                         break;
2566                 }
2567
2568                 /* RF5_BRAIN_SMASH */
2569                 case 128+11:
2570                 {
2571                         if (x!=px || y!=py) return (FALSE);
2572                         if (!direct) break;
2573                         disturb(1, 0);
2574                         if (!seen)
2575                         {
2576 #ifdef JP
2577 msg_print("²¿¤«¤¬¤¢¤Ê¤¿¤ÎÀº¿À¤ËÇ°¤òÊü¤Ã¤Æ¤¤¤ë¤è¤¦¤À¡£");
2578 #else
2579                                 msg_print("You feel something focusing on your mind.");
2580 #endif
2581
2582                         }
2583                         else
2584                         {
2585 #ifdef JP
2586 msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÆ·¤ò¤¸¤Ã¤È¸«¤Æ¤¤¤ë¡£", m_name);
2587 #else
2588                                 msg_format("%^s looks deep into your eyes.", m_name);
2589 #endif
2590
2591                         }
2592
2593                         dam = damroll(12, 12);
2594                         breath(y, x, m_idx, GF_BRAIN_SMASH, dam, 0, FALSE, MS_BRAIN_SMASH, learnable);
2595                         break;
2596                 }
2597
2598                 /* RF5_CAUSE_1 */
2599                 case 128+12:
2600                 {
2601                         if (x!=px || y!=py) return (FALSE);
2602                         if (!direct) break;
2603                         disturb(1, 0);
2604 #ifdef JP
2605 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2606 #else
2607                         if (blind) msg_format("%^s mumbles.", m_name);
2608 #endif
2609
2610 #ifdef JP
2611 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¼ö¤Ã¤¿¡£", m_name);
2612 #else
2613                         else msg_format("%^s points at you and curses.", m_name);
2614 #endif
2615
2616                         dam = damroll(3, 8);
2617                         breath(y, x, m_idx, GF_CAUSE_1, dam, 0, FALSE, MS_CAUSE_1, learnable);
2618                         break;
2619                 }
2620
2621                 /* RF5_CAUSE_2 */
2622                 case 128+13:
2623                 {
2624                         if (x!=px || y!=py) return (FALSE);
2625                         if (!direct) break;
2626                         disturb(1, 0);
2627 #ifdef JP
2628 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2629 #else
2630                         if (blind) msg_format("%^s mumbles.", m_name);
2631 #endif
2632
2633 #ifdef JP
2634 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤Ã¤¿¡£", m_name);
2635 #else
2636                         else msg_format("%^s points at you and curses horribly.", m_name);
2637 #endif
2638
2639                         dam = damroll(8, 8);
2640                         breath(y, x, m_idx, GF_CAUSE_2, dam, 0, FALSE, MS_CAUSE_2, learnable);
2641                         break;
2642                 }
2643
2644                 /* RF5_CAUSE_3 */
2645                 case 128+14:
2646                 {
2647                         if (x!=px || y!=py) return (FALSE);
2648                         if (!direct) break;
2649                         disturb(1, 0);
2650 #ifdef JP
2651 if (blind) msg_format("%^s¤¬²¿¤«¤òÂçÀ¼¤Ç¶«¤ó¤À¡£", m_name);
2652 #else
2653                         if (blind) msg_format("%^s mumbles loudly.", m_name);
2654 #endif
2655
2656 #ifdef JP
2657 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ò»Ø¤µ¤·¤Æ¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
2658 #else
2659                         else msg_format("%^s points at you, incanting terribly!", m_name);
2660 #endif
2661
2662                         dam = damroll(10, 15);
2663                         breath(y, x, m_idx, GF_CAUSE_3, dam, 0, FALSE, MS_CAUSE_3, learnable);
2664                         break;
2665                 }
2666
2667                 /* RF5_CAUSE_4 */
2668                 case 128+15:
2669                 {
2670                         if (x!=px || y!=py) return (FALSE);
2671                         if (!direct) break;
2672                         disturb(1, 0);
2673 #ifdef JP
2674 if (blind) msg_format("%^s¤¬¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2675 #else
2676                         if (blind) msg_format("%^s screams the word 'DIE!'", m_name);
2677 #endif
2678
2679 #ifdef JP
2680 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÈ빦¤òÆͤ¤¤Æ¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
2681 #else
2682                         else msg_format("%^s points at you, screaming the word DIE!", m_name);
2683 #endif
2684
2685                         dam = damroll(15, 15);
2686                         breath(y, x, m_idx, GF_CAUSE_4, dam, 0, FALSE, MS_CAUSE_4, learnable);
2687                         break;
2688                 }
2689
2690                 /* RF5_BO_ACID */
2691                 case 128+16:
2692                 {
2693                         if (x!=px || y!=py) return (FALSE);
2694                         disturb(1, 0);
2695 #ifdef JP
2696 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2697 #else
2698                         if (blind) msg_format("%^s mumbles.", m_name);
2699 #endif
2700
2701 #ifdef JP
2702 else msg_format("%^s¤¬¥¢¥·¥Ã¥É¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2703 #else
2704                         else msg_format("%^s casts a acid bolt.", m_name);
2705 #endif
2706
2707                         dam = (damroll(7, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2708                         bolt(m_idx, GF_ACID, dam, MS_BOLT_ACID, learnable);
2709                         update_smart_learn(m_idx, DRS_ACID);
2710                         update_smart_learn(m_idx, DRS_REFLECT);
2711                         break;
2712                 }
2713
2714                 /* RF5_BO_ELEC */
2715                 case 128+17:
2716                 {
2717                         if (x!=px || y!=py) 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 lightning bolt.", m_name);
2729 #endif
2730
2731                         dam = (damroll(4, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2732                         bolt(m_idx, GF_ELEC, dam, MS_BOLT_ELEC, learnable);
2733                         update_smart_learn(m_idx, DRS_ELEC);
2734                         update_smart_learn(m_idx, DRS_REFLECT);
2735                         break;
2736                 }
2737
2738                 /* RF5_BO_FIRE */
2739                 case 128+18:
2740                 {
2741                         if (x!=px || y!=py) 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 fire bolt.", m_name);
2753 #endif
2754
2755                         dam = (damroll(9, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2756                         bolt(m_idx, GF_FIRE, dam, MS_BOLT_FIRE, learnable);
2757                         update_smart_learn(m_idx, DRS_FIRE);
2758                         update_smart_learn(m_idx, DRS_REFLECT);
2759                         break;
2760                 }
2761
2762                 /* RF5_BO_COLD */
2763                 case 128+19:
2764                 {
2765                         if (x!=px || y!=py) 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 frost bolt.", m_name);
2777 #endif
2778
2779                         dam = (damroll(6, 8) + (rlev / 3)) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
2780                         bolt(m_idx, GF_COLD, dam, MS_BOLT_COLD, learnable);
2781                         update_smart_learn(m_idx, DRS_COLD);
2782                         update_smart_learn(m_idx, DRS_REFLECT);
2783                         break;
2784                 }
2785
2786                 /* RF5_BA_LITE */
2787                 case 128+20:
2788                 {
2789                         disturb(1, 0);
2790 #ifdef JP
2791 if (blind) msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2792 #else
2793                         if (blind) msg_format("%^s mumbles powerfully.", m_name);
2794 #endif
2795
2796 #ifdef JP
2797 else msg_format("%^s¤¬¥¹¥¿¡¼¥Ð¡¼¥¹¥È¤Î¼öʸ¤òÇ°¤¸¤¿¡£", m_name);
2798 #else
2799                         else msg_format("%^s invokes a starburst.", m_name);
2800 #endif
2801
2802                         dam = (rlev * 4) + 50 + damroll(10, 10);
2803                         breath(y, x, m_idx, GF_LITE, dam, 4, FALSE, MS_STARBURST, learnable);
2804                         update_smart_learn(m_idx, DRS_LITE);
2805                         break;
2806                 }
2807
2808                 /* RF5_BO_NETH */
2809                 case 128+21:
2810                 {
2811                         if (x!=px || y!=py) return (FALSE);
2812                         disturb(1, 0);
2813 #ifdef JP
2814 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2815 #else
2816                         if (blind) msg_format("%^s mumbles.", m_name);
2817 #endif
2818
2819 #ifdef JP
2820 else msg_format("%^s¤¬ÃϹö¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2821 #else
2822                         else msg_format("%^s casts a nether bolt.", m_name);
2823 #endif
2824
2825                         dam = 30 + damroll(5, 5) + (rlev * 4) / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3);
2826                         bolt(m_idx, GF_NETHER, dam, MS_BOLT_NETHER, learnable);
2827                         update_smart_learn(m_idx, DRS_NETH);
2828                         update_smart_learn(m_idx, DRS_REFLECT);
2829                         break;
2830                 }
2831
2832                 /* RF5_BO_WATE */
2833                 case 128+22:
2834                 {
2835                         if (x!=px || y!=py) 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 water bolt.", m_name);
2847 #endif
2848
2849                         dam = damroll(10, 10) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2850                         bolt(m_idx, GF_WATER, dam, MS_BOLT_WATER, learnable);
2851                         update_smart_learn(m_idx, DRS_REFLECT);
2852                         break;
2853                 }
2854
2855                 /* RF5_BO_MANA */
2856                 case 128+23:
2857                 {
2858                         if (x!=px || y!=py) return (FALSE);
2859                         disturb(1, 0);
2860 #ifdef JP
2861 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2862 #else
2863                         if (blind) msg_format("%^s mumbles.", m_name);
2864 #endif
2865
2866 #ifdef JP
2867 else msg_format("%^s¤¬ËâÎϤÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2868 #else
2869                         else msg_format("%^s casts a mana bolt.", m_name);
2870 #endif
2871
2872                         dam = randint1(rlev * 7 / 2) + 50;
2873                         bolt(m_idx, GF_MANA, dam, MS_BOLT_MANA, learnable);
2874                         update_smart_learn(m_idx, DRS_REFLECT);
2875                         break;
2876                 }
2877
2878                 /* RF5_BO_PLAS */
2879                 case 128+24:
2880                 {
2881                         if (x!=px || y!=py) return (FALSE);
2882                         disturb(1, 0);
2883 #ifdef JP
2884 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2885 #else
2886                         if (blind) msg_format("%^s mumbles.", m_name);
2887 #endif
2888
2889 #ifdef JP
2890 else msg_format("%^s¤¬¥×¥é¥º¥Þ¡¦¥Ü¥ë¥È¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2891 #else
2892                         else msg_format("%^s casts a plasma bolt.", m_name);
2893 #endif
2894
2895                         dam = 10 + damroll(8, 7) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2896                         bolt(m_idx, GF_PLASMA, dam, MS_BOLT_PLASMA, learnable);
2897                         update_smart_learn(m_idx, DRS_REFLECT);
2898                         break;
2899                 }
2900
2901                 /* RF5_BO_ICEE */
2902                 case 128+25:
2903                 {
2904                         if (x!=px || y!=py) return (FALSE);
2905                         disturb(1, 0);
2906 #ifdef JP
2907 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
2908 #else
2909                         if (blind) msg_format("%^s mumbles.", m_name);
2910 #endif
2911
2912 #ifdef JP
2913 else msg_format("%^s¤¬¶Ë´¨¤ÎÌð¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
2914 #else
2915                         else msg_format("%^s casts an ice bolt.", m_name);
2916 #endif
2917
2918                         dam = damroll(6, 6) + (rlev * 3 / ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 3));
2919                         bolt(m_idx, GF_ICE, dam, MS_BOLT_ICE, learnable);
2920                         update_smart_learn(m_idx, DRS_COLD);
2921                         update_smart_learn(m_idx, DRS_REFLECT);
2922                         break;
2923                 }
2924
2925                 /* RF5_MISSILE */
2926                 case 128+26:
2927                 {
2928                         if (x!=px || y!=py) 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 a magic missile.", m_name);
2940 #endif
2941
2942                         dam = damroll(2, 6) + (rlev / 3);
2943                         bolt(m_idx, GF_MISSILE, dam, MS_MAGIC_MISSILE, learnable);
2944                         update_smart_learn(m_idx, DRS_REFLECT);
2945                         break;
2946                 }
2947
2948                 /* RF5_SCARE */
2949                 case 128+27:
2950                 {
2951                         if (x!=px || y!=py) return (FALSE);
2952                         if (!direct) break;
2953                         disturb(1, 0);
2954 #ifdef JP
2955 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢¶²¤í¤·¤²¤Ê²»¤¬Ê¹¤³¤¨¤¿¡£", m_name);
2956 #else
2957                         if (blind) msg_format("%^s mumbles, and you hear scary noises.", m_name);
2958 #endif
2959
2960 #ifdef JP
2961 else msg_format("%^s¤¬¶²¤í¤·¤²¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
2962 #else
2963                         else msg_format("%^s casts a fearful illusion.", m_name);
2964 #endif
2965
2966                         if (p_ptr->resist_fear)
2967                         {
2968 #ifdef JP
2969 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
2970 #else
2971                                 msg_print("You refuse to be frightened.");
2972 #endif
2973
2974                         }
2975                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
2976                         {
2977 #ifdef JP
2978 msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
2979 #else
2980                                 msg_print("You refuse to be frightened.");
2981 #endif
2982
2983                         }
2984                         else
2985                         {
2986                                 (void)set_afraid(p_ptr->afraid + randint0(4) + 4);
2987                         }
2988                         learn_spell(MS_SCARE);
2989                         update_smart_learn(m_idx, DRS_FEAR);
2990                         break;
2991                 }
2992
2993                 /* RF5_BLIND */
2994                 case 128+28:
2995                 {
2996                         if (x!=px || y!=py) return (FALSE);
2997                         if (!direct) break;
2998                         disturb(1, 0);
2999 #ifdef JP
3000 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3001 #else
3002                         if (blind) msg_format("%^s mumbles.", m_name);
3003 #endif
3004
3005 #ifdef JP
3006 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¤¢¤Ê¤¿¤ÎÌܤò¤¯¤é¤Þ¤·¤¿¡ª", m_name);
3007 #else
3008                         else msg_format("%^s casts a spell, burning your eyes!", m_name);
3009 #endif
3010
3011                         if (p_ptr->resist_blind)
3012                         {
3013 #ifdef JP
3014 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3015 #else
3016                                 msg_print("You are unaffected!");
3017 #endif
3018
3019                         }
3020                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3021                         {
3022 #ifdef JP
3023 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3024 #else
3025                                 msg_print("You resist the effects!");
3026 #endif
3027
3028                         }
3029                         else
3030                         {
3031                                 (void)set_blind(12 + randint0(4));
3032                         }
3033                         learn_spell(MS_BLIND);
3034                         update_smart_learn(m_idx, DRS_BLIND);
3035                         break;
3036                 }
3037
3038                 /* RF5_CONF */
3039                 case 128+29:
3040                 {
3041                         if (x!=px || y!=py) return (FALSE);
3042                         if (!direct) break;
3043                         disturb(1, 0);
3044 #ifdef JP
3045 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¯¤È¡¢Æ¬¤òǺ¤Þ¤¹²»¤¬¤·¤¿¡£", m_name);
3046 #else
3047                         if (blind) msg_format("%^s mumbles, and you hear puzzling noises.", m_name);
3048 #endif
3049
3050 #ifdef JP
3051 else msg_format("%^s¤¬Í¶ÏÇŪ¤Ê¸¸³Ð¤òºî¤ê½Ð¤·¤¿¡£", m_name);
3052 #else
3053                         else msg_format("%^s creates a mesmerising illusion.", m_name);
3054 #endif
3055
3056                         if (p_ptr->resist_conf)
3057                         {
3058 #ifdef JP
3059 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3060 #else
3061                                 msg_print("You disbelieve the feeble spell.");
3062 #endif
3063
3064                         }
3065                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3066                         {
3067 #ifdef JP
3068 msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
3069 #else
3070                                 msg_print("You disbelieve the feeble spell.");
3071 #endif
3072
3073                         }
3074                         else
3075                         {
3076                                 (void)set_confused(p_ptr->confused + randint0(4) + 4);
3077                         }
3078                         learn_spell(MS_CONF);
3079                         update_smart_learn(m_idx, DRS_CONF);
3080                         break;
3081                 }
3082
3083                 /* RF5_SLOW */
3084                 case 128+30:
3085                 {
3086                         if (x!=px || y!=py) return (FALSE);
3087                         if (!direct) break;
3088                         disturb(1, 0);
3089 #ifdef JP
3090 msg_format("%^s¤¬¤¢¤Ê¤¿¤Î¶ÚÎϤòµÛ¤¤¼è¤í¤¦¤È¤·¤¿¡ª", m_name);
3091 #else
3092                         msg_format("%^s drains power from your muscles!", m_name);
3093 #endif
3094
3095                         if (p_ptr->free_act)
3096                         {
3097 #ifdef JP
3098 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3099 #else
3100                                 msg_print("You are unaffected!");
3101 #endif
3102
3103                         }
3104                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3105                         {
3106 #ifdef JP
3107 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3108 #else
3109                                 msg_print("You resist the effects!");
3110 #endif
3111
3112                         }
3113                         else
3114                         {
3115                                 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
3116                         }
3117                         learn_spell(MS_SLOW);
3118                         update_smart_learn(m_idx, DRS_FREE);
3119                         break;
3120                 }
3121
3122                 /* RF5_HOLD */
3123                 case 128+31:
3124                 {
3125                         if (x!=px || y!=py) return (FALSE);
3126                         if (!direct) break;
3127                         disturb(1, 0);
3128 #ifdef JP
3129 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3130 #else
3131                         if (blind) msg_format("%^s mumbles.", m_name);
3132 #endif
3133
3134 #ifdef JP
3135 else msg_format("%^s¤¬¤¢¤Ê¤¿¤ÎÌܤò¤¸¤Ã¤È¸«¤Ä¤á¤¿¡ª", m_name);
3136 #else
3137                         else msg_format("%^s stares deep into your eyes!", m_name);
3138 #endif
3139
3140                         if (p_ptr->free_act)
3141                         {
3142 #ifdef JP
3143 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3144 #else
3145                                 msg_print("You are unaffected!");
3146 #endif
3147
3148                         }
3149                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3150                         {
3151 #ifdef JP
3152 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3153 #else
3154                                 msg_format("You resist the effects!");
3155 #endif
3156
3157                         }
3158                         else
3159                         {
3160                                 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
3161                         }
3162                         learn_spell(MS_SLEEP);
3163                         update_smart_learn(m_idx, DRS_FREE);
3164                         break;
3165                 }
3166
3167                 /* RF6_HASTE */
3168                 case 160+0:
3169                 {
3170                         disturb(1, 0);
3171                         if (blind)
3172                         {
3173 #ifdef JP
3174 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3175 #else
3176                                 msg_format("%^s mumbles.", m_name);
3177 #endif
3178
3179                         }
3180                         else
3181                         {
3182 #ifdef JP
3183 msg_format("%^s¤¬¼«Ê¬¤ÎÂΤËÇ°¤òÁ÷¤Ã¤¿¡£", m_name, m_poss);
3184 #else
3185                                 msg_format("%^s concentrates on %s body.", m_name, m_poss);
3186 #endif
3187
3188                         }
3189
3190                         /* Allow quick speed increases to base+10 */
3191                         if (!m_ptr->fast)
3192                         {
3193 #ifdef JP
3194 msg_format("%^s¤ÎÆ°¤­¤¬Â®¤¯¤Ê¤Ã¤¿¡£", m_name);
3195 #else
3196                                 msg_format("%^s starts moving faster.", m_name);
3197 #endif
3198                         }
3199                         m_ptr->fast = MIN(200, m_ptr->fast + 100);
3200                         if (p_ptr->riding == m_idx) p_ptr->update |= PU_BONUS;
3201                         break;
3202                 }
3203
3204                 /* RF6_HAND_DOOM */
3205                 case 160+1:
3206                 {
3207                         if (x!=px || y!=py) return (FALSE);
3208                         disturb(1, 0);
3209 #ifdef JP
3210 msg_format("%^s¤¬ÇËÌǤμê¤òÊü¤Ã¤¿¡ª", m_name);
3211 #else
3212                         msg_format("%^s invokes the Hand of Doom!", m_name);
3213 #endif
3214                         dam = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
3215                         breath(y, x, m_idx, GF_HAND_DOOM, dam, 0, FALSE, MS_HAND_DOOM, learnable);
3216                         break;
3217                 }
3218
3219                 /* RF6_HEAL */
3220                 case 160+2:
3221                 {
3222                         disturb(1, 0);
3223
3224                         /* Message */
3225                         if (blind)
3226                         {
3227 #ifdef JP
3228 msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3229 #else
3230                                 msg_format("%^s mumbles.", m_name);
3231 #endif
3232
3233                         }
3234                         else
3235                         {
3236 #ifdef JP
3237 msg_format("%^s¤¬¼«Ê¬¤Î½ý¤Ë½¸Ã椷¤¿¡£", m_name);
3238 #else
3239                                 msg_format("%^s concentrates on %s wounds.", m_name, m_poss);
3240 #endif
3241
3242                         }
3243
3244                         /* Heal some */
3245                         m_ptr->hp += (rlev * 6);
3246
3247                         /* Fully healed */
3248                         if (m_ptr->hp >= m_ptr->maxhp)
3249                         {
3250                                 /* Fully healed */
3251                                 m_ptr->hp = m_ptr->maxhp;
3252
3253                                 /* Message */
3254                                 if (seen)
3255                                 {
3256 #ifdef JP
3257 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¡ª", m_name);
3258 #else
3259                                         msg_format("%^s looks completely healed!", m_name);
3260 #endif
3261
3262                                 }
3263                                 else
3264                                 {
3265 #ifdef JP
3266 msg_format("%^s¤Ï´°Á´¤Ë¼£¤Ã¤¿¤è¤¦¤À¡ª", m_name);
3267 #else
3268                                         msg_format("%^s sounds completely healed!", m_name);
3269 #endif
3270
3271                                 }
3272                         }
3273
3274                         /* Partially healed */
3275                         else
3276                         {
3277                                 /* Message */
3278                                 if (seen)
3279                                 {
3280 #ifdef JP
3281 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3282 #else
3283                                         msg_format("%^s looks healthier.", m_name);
3284 #endif
3285
3286                                 }
3287                                 else
3288                                 {
3289 #ifdef JP
3290 msg_format("%^s¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£", m_name);
3291 #else
3292                                         msg_format("%^s sounds healthier.", m_name);
3293 #endif
3294
3295                                 }
3296                         }
3297
3298                         /* Redraw (later) if needed */
3299                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3300                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3301
3302                         /* Cancel fear */
3303                         if (m_ptr->monfear)
3304                         {
3305                                 /* Cancel fear */
3306                                 m_ptr->monfear = 0;
3307
3308                                 /* Message */
3309 #ifdef JP
3310 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name, m_poss);
3311 #else
3312                                 msg_format("%^s recovers %s courage.", m_name, m_poss);
3313 #endif
3314
3315                         }
3316                         break;
3317                 }
3318
3319                 /* RF6_INVULNER */
3320                 case 160+3:
3321                 {
3322                         disturb(1, 0);
3323
3324                         /* Message */
3325                         if (!seen)
3326                         {
3327 #ifdef JP
3328 msg_format("%^s¤¬²¿¤«¤òÎ϶¯¤¯¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3329 #else
3330                                 msg_format("%^s mumbles powerfully.", m_name);
3331 #endif
3332
3333                         }
3334                         else
3335                         {
3336 #ifdef JP
3337 msg_format("%s¤Ï̵½ý¤Îµå¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3338 #else
3339                                 msg_format("%^s casts a Globe of Invulnerability.", m_name);
3340 #endif
3341
3342                         }
3343
3344                         if (!(m_ptr->invulner))
3345                                 m_ptr->invulner = randint1(4) + 4;
3346
3347                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3348                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3349                         break;
3350                 }
3351
3352                 /* RF6_BLINK */
3353                 case 160+4:
3354                 {
3355                         disturb(1, 0);
3356 #ifdef JP
3357 msg_format("%^s¤¬½Ö»þ¤Ë¾Ã¤¨¤¿¡£", m_name);
3358 #else
3359                         msg_format("%^s blinks away.", m_name);
3360 #endif
3361
3362                         teleport_away(m_idx, 10, FALSE);
3363                         p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3364                         break;
3365                 }
3366
3367                 /* RF6_TPORT */
3368                 case 160+5:
3369                 {
3370                         int i, oldfy, oldfx;
3371                         u32b flgs[TR_FLAG_SIZE];
3372                         object_type *o_ptr;
3373
3374                         oldfy = m_ptr->fy;
3375                         oldfx = m_ptr->fx;
3376
3377                         disturb(1, 0);
3378 #ifdef JP
3379 msg_format("%^s¤¬¥Æ¥ì¥Ý¡¼¥È¤·¤¿¡£", m_name);
3380 #else
3381                         msg_format("%^s teleports away.", m_name);
3382 #endif
3383
3384                         teleport_away(m_idx, MAX_SIGHT * 2 + 5, FALSE);
3385
3386                         if (los(py, px, oldfy, oldfx) && !world_monster)
3387                         {
3388                                 for (i=INVEN_RARM;i<INVEN_TOTAL;i++)
3389                                 {
3390                                         o_ptr = &inventory[i];
3391                                         if(!cursed_p(o_ptr))
3392                                         {
3393                                                 object_flags(o_ptr, flgs);
3394
3395                                                 if((have_flag(flgs, TR_TELEPORT)) || (p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR))
3396                                                 {
3397 #ifdef JP
3398                                                         if(get_check_strict("¤Ä¤¤¤Æ¤¤¤­¤Þ¤¹¤«¡©", CHECK_OKAY_CANCEL))
3399 #else
3400                                                         if(get_check_strict("Do you follow it? ", CHECK_OKAY_CANCEL))
3401 #endif
3402                                                         {
3403                                                                 if (one_in_(3))
3404                                                                 {
3405                                                                         teleport_player(200);
3406 #ifdef JP
3407                                                                         msg_print("¼ºÇÔ¡ª");
3408 #else
3409                                                                         msg_print("Failed!");
3410 #endif
3411                                                                 }
3412                                                                 else teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3413                                                                 p_ptr->energy_need += ENERGY_NEED();
3414                                                         }
3415                                                         break;
3416                                                 }
3417                                         }
3418                                 }
3419                         }
3420                         break;
3421                 }
3422
3423                 /* RF6_WORLD */
3424                 case 160+6:
3425                 {
3426                         int who = 0;
3427                         disturb(1, 0);
3428                         if(m_ptr->r_idx == MON_DIO) who = 1;
3429                         else if(m_ptr->r_idx == MON_WONG) who = 3;
3430                         dam = who;
3431                         if (!process_the_world(randint1(2)+2, who, TRUE)) return (FALSE);
3432                         break;
3433                 }
3434
3435                 /* RF6_SPECIAL */
3436                 case 160+7:
3437                 {
3438                         int k;
3439
3440                         disturb(1, 0);
3441                         switch(m_ptr->r_idx)
3442                         {
3443                         case MON_OHMU:
3444                                 if (p_ptr->inside_arena || p_ptr->inside_battle) return FALSE;
3445                                 for (k = 0; k < 6; k++)
3446                                 {
3447                                         count += summon_specific(m_idx, m_ptr->fy, m_ptr->fx, rlev, SUMMON_BIZARRE1, PM_ALLOW_GROUP);
3448                                 }
3449                                 return FALSE;
3450                                 
3451                         case MON_BANORLUPART:
3452                                 {
3453                                         int dummy_hp = (m_ptr->hp + 1) / 2;
3454                                         int dummy_maxhp = m_ptr->maxhp/2;
3455                                         int dummy_y = m_ptr->fy;
3456                                         int dummy_x = m_ptr->fx;
3457
3458                                         if (p_ptr->inside_arena || p_ptr->inside_battle || !summon_possible(m_ptr->fy, m_ptr->fx)) return FALSE;
3459                                         delete_monster_idx(cave[m_ptr->fy][m_ptr->fx].m_idx);
3460                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANOR, mode);
3461                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3462                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3463                                         summon_named_creature(0, dummy_y, dummy_x, MON_LUPART, mode);
3464                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3465                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3466
3467 #ifdef JP
3468                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡¦¥ë¥Ñ¡¼¥È¡Ù¤¬Ê¬Îö¤·¤¿¡ª");
3469 #else
3470                                         msg_print("Banor=Rupart splits in two person!");
3471 #endif
3472
3473                                         break;
3474                                 }
3475                                 case MON_BANOR:
3476                                 case MON_LUPART:
3477                                 {
3478                                         int dummy_hp = 0;
3479                                         int dummy_maxhp = 0;
3480                                         int dummy_y = m_ptr->fy;
3481                                         int dummy_x = m_ptr->fx;
3482
3483                                         if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return (FALSE);
3484                                         for (k = 1; k < m_max; k++)
3485                                         {
3486                                                 if (m_list[k].r_idx == MON_BANOR || m_list[k].r_idx == MON_LUPART)
3487                                                 {
3488                                                         dummy_hp += m_list[k].hp;
3489                                                         dummy_maxhp += m_list[k].maxhp;
3490                                                         if (m_list[k].r_idx != m_ptr->r_idx)
3491                                                         {
3492                                                                 dummy_y = m_list[k].fy;
3493                                                                 dummy_x = m_list[k].fx;
3494                                                         }
3495                                                         delete_monster_idx(k);
3496                                                 }
3497                                         }
3498                                         summon_named_creature(0, dummy_y, dummy_x, MON_BANORLUPART, mode);
3499                                         m_list[hack_m_idx_ii].hp = dummy_hp;
3500                                         m_list[hack_m_idx_ii].maxhp = dummy_maxhp;
3501
3502 #ifdef JP
3503                                         msg_print("¡Ø¥Ð¡¼¥Î¡¼¥ë¡Ù¤È¡Ø¥ë¥Ñ¡¼¥È¡Ù¤¬¹çÂΤ·¤¿¡ª");
3504 #else
3505                                         msg_print("Banor and Rupart combine into one!");
3506 #endif
3507
3508                                         break;
3509                                 }
3510
3511                         default:
3512                                 if (r_ptr->d_char == 'B')
3513                                 {
3514                                         if (!direct) break;
3515                                         disturb(1, 0);
3516                                         if (one_in_(3) || x!=px || y!=py)
3517                                         {
3518 #ifdef JP
3519                                                 msg_format("%^s¤ÏÆÍÁ³»ë³¦¤«¤é¾Ã¤¨¤¿!", m_name);
3520 #else
3521                                                 msg_format("%^s suddenly go out of your sight!", m_name);
3522 #endif
3523                                                 teleport_away(m_idx, 10, FALSE);
3524                                                 p_ptr->update |= (PU_MONSTERS | PU_MON_LITE);
3525                                         }
3526                                         else
3527                                         {
3528                                                 int dam = damroll(4, 8);
3529                                                 int get_damage = 0;
3530 #ifdef JP
3531                                                 msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
3532 #else
3533                                                 msg_format("%^s holds you, and drops from the sky.", m_name);
3534 #endif
3535                                                 teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE);
3536
3537                                                 sound(SOUND_FALL);
3538
3539                                                 if (p_ptr->ffall)
3540                                                 {
3541 #ifdef JP
3542                                                         msg_print("¤¢¤Ê¤¿¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£");
3543 #else
3544                                                         msg_print("You float gently down to the ground.");
3545 #endif
3546                                                 }
3547                                                 else
3548                                                 {
3549 #ifdef JP
3550                                                         msg_print("¤¢¤Ê¤¿¤ÏÃÏÌ̤Ë᤭¤Ä¤±¤é¤ì¤¿¡£");
3551 #else
3552                                                         msg_print("You crashed into the ground.");
3553 #endif
3554                                                         dam += damroll(6, 8);
3555                                                 }
3556
3557                                                 /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
3558                                                    -- henkma
3559                                                  */
3560                                                 get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1);
3561                                                 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
3562                                                 {
3563 #ifdef JP
3564                                                         msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
3565 #else
3566                                                         char m_name_self[80];
3567
3568                                                         /* hisself */
3569                                                         monster_desc(m_name_self, m_ptr, 0x23);
3570
3571                                                         msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
3572 #endif
3573                                                         project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
3574                                                         set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
3575                                                 }
3576                                         }
3577                                         break;
3578                                 }
3579
3580                                 /* Something is wrong */
3581                                 else return FALSE;
3582                         }
3583                         break;
3584                 }
3585
3586                 /* RF6_TELE_TO */
3587                 case 160+8:
3588                 {
3589                         if (x!=px || y!=py) return (FALSE);
3590                         if (!direct) break;
3591                         disturb(1, 0);
3592 #ifdef JP
3593 msg_format("%^s¤¬¤¢¤Ê¤¿¤ò°ú¤­Ìᤷ¤¿¡£", m_name);
3594 #else
3595                         msg_format("%^s commands you to return.", m_name);
3596 #endif
3597
3598                         teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE);
3599                         learn_spell(MS_TELE_TO);
3600                         break;
3601                 }
3602
3603                 /* RF6_TELE_AWAY */
3604                 case 160+9:
3605                 {
3606                         if (x!=px || y!=py) return (FALSE);
3607                         if (!direct) break;
3608                         disturb(1, 0);
3609 #ifdef JP
3610 msg_format("%^s¤Ë¥Æ¥ì¥Ý¡¼¥È¤µ¤»¤é¤ì¤¿¡£", m_name);
3611                         if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
3612                                 msg_print("¤¯¤Ã¤½¡Á");
3613 #else
3614                         msg_format("%^s teleports you away.", m_name);
3615 #endif
3616
3617                         learn_spell(MS_TELE_AWAY);
3618                         teleport_player(100);
3619                         break;
3620                 }
3621
3622                 /* RF6_TELE_LEVEL */
3623                 case 160+10:
3624                 {
3625                         if (x!=px || y!=py) return (FALSE);
3626                         if (!direct) break;
3627                         disturb(1, 0);
3628 #ifdef JP
3629 if (blind) msg_format("%^s¤¬²¿¤«´ñ̯¤Ê¸ÀÍÕ¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3630 #else
3631                         if (blind) msg_format("%^s mumbles strangely.", m_name);
3632 #endif
3633
3634 #ifdef JP
3635 else msg_format("%^s¤¬¤¢¤Ê¤¿¤Î­¤ò»Ø¤µ¤·¤¿¡£", m_name);
3636 #else
3637                         else msg_format("%^s gestures at your feet.", m_name);
3638 #endif
3639
3640                         if (p_ptr->resist_nexus)
3641                         {
3642 #ifdef JP
3643 msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
3644 #else
3645                                 msg_print("You are unaffected!");
3646 #endif
3647
3648                         }
3649                         else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3650                         {
3651 #ifdef JP
3652 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3653 #else
3654                                 msg_print("You resist the effects!");
3655 #endif
3656
3657                         }
3658                         else
3659                         {
3660                                 teleport_player_level();
3661                         }
3662                         learn_spell(MS_TELE_LEVEL);
3663                         update_smart_learn(m_idx, DRS_NEXUS);
3664                         break;
3665                 }
3666
3667                 /* RF6_PSY_SPEAR */
3668                 case 160+11:
3669                 {
3670                         if (x!=px || y!=py) return (FALSE);
3671                         disturb(1, 0);
3672 #ifdef JP
3673 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3674 #else
3675                         if (blind) msg_format("%^s mumbles.", m_name);
3676 #endif
3677
3678 #ifdef JP
3679 else msg_format("%^s¤¬¸÷¤Î·õ¤òÊü¤Ã¤¿¡£", m_name);
3680 #else
3681                         else msg_format("%^s throw a Psycho-Spear.", m_name);
3682 #endif
3683
3684                         dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 150) : (randint1(rlev * 3 / 2) + 100);
3685                         beam(m_idx, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, learnable);
3686                         break;
3687                 }
3688
3689                 /* RF6_DARKNESS */
3690                 case 160+12:
3691                 {
3692                         if (x!=px || y!=py) return (FALSE);
3693                         if (!direct) break;
3694                         disturb(1, 0);
3695 #ifdef JP
3696 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3697 #else
3698                         if (blind) msg_format("%^s mumbles.", m_name);
3699 #endif
3700
3701 #ifdef JP
3702 else if (p_ptr->pclass == CLASS_NINJA) msg_format("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", m_name);
3703 else msg_format("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", m_name);
3704 #else
3705                         else if (p_ptr->pclass == CLASS_NINJA)
3706                                 msg_format("%^s cast a spell to light up.", m_name);
3707                         else msg_format("%^s gestures in shadow.", m_name);
3708 #endif
3709
3710                         learn_spell(MS_DARKNESS);
3711                         if (p_ptr->pclass == CLASS_NINJA)
3712                                 (void)lite_area(0, 3);
3713                         else
3714                                 (void)unlite_area(0, 3);
3715                         break;
3716                 }
3717
3718                 /* RF6_TRAPS */
3719                 case 160+13:
3720                 {
3721                         if (!direct) break;
3722                         disturb(1, 0);
3723 #ifdef JP
3724 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3725 #else
3726                         if (blind) msg_format("%^s mumbles, and then cackles evilly.", m_name);
3727 #endif
3728
3729 #ifdef JP
3730 else msg_format("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¼Ù°­¤ËÈù¾Ð¤ó¤À¡£", m_name);
3731 #else
3732                         else msg_format("%^s casts a spell and cackles evilly.", m_name);
3733 #endif
3734
3735                         learn_spell(MS_MAKE_TRAP);
3736                         (void)trap_creation(y, x);
3737                         break;
3738                 }
3739
3740                 /* RF6_FORGET */
3741                 case 160+14:
3742                 {
3743                         if (x!=px || y!=py) return (FALSE);
3744                         if (!direct) break;
3745                         disturb(1, 0);
3746 #ifdef JP
3747 msg_format("%^s¤¬¤¢¤Ê¤¿¤Îµ­²±¤ò¾Ãµî¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", m_name);
3748 #else
3749                         msg_format("%^s tries to blank your mind.", m_name);
3750 #endif
3751
3752
3753                         if (randint0(100 + rlev/2) < p_ptr->skill_sav)
3754                         {
3755 #ifdef JP
3756 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3757 #else
3758                                 msg_print("You resist the effects!");
3759 #endif
3760
3761                         }
3762                         else if (lose_all_info())
3763                         {
3764 #ifdef JP
3765 msg_print("µ­²±¤¬Çö¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
3766 #else
3767                                 msg_print("Your memories fade away.");
3768 #endif
3769
3770                         }
3771                         learn_spell(MS_FORGET);
3772                         break;
3773                 }
3774
3775                 /* RF6_RAISE_DEAD */
3776                 case 160+15:
3777                 {
3778                         disturb(1, 0);
3779 #ifdef JP
3780 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3781 #else
3782                         if (blind) msg_format("%^s mumbles.", m_name);
3783 #endif
3784
3785 #ifdef JP
3786 else msg_format("%^s¤¬»à¼ÔÉü³è¤Î¼öʸ¤ò¾§¤¨¤¿¡£", m_name);
3787 #else
3788                         else msg_format("%^s casts a spell to revive corpses.", m_name);
3789 #endif
3790                         animate_dead(m_idx, m_ptr->fy, m_ptr->fx);
3791                         break;
3792                 }
3793
3794                 /* RF6_SUMMON_KIN */
3795                 case 160+16:
3796                 {
3797                         disturb(1, 0);
3798                         if (m_ptr->r_idx == MON_ROLENTO)
3799                         {
3800 #ifdef JP
3801                                 if (blind)
3802                                         msg_format("%^s¤¬²¿¤«ÂçÎ̤ËÅꤲ¤¿¡£", m_name);
3803                                 else 
3804                                         msg_format("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", m_name);
3805 #else
3806                                 if (blind)
3807                                         msg_format("%^s spreads something.", m_name);
3808                                 else
3809                                         msg_format("%^s throws some hand grenades.", m_name);
3810 #endif
3811                         }
3812                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3813                         {
3814 #ifdef JP
3815                                 if (blind)
3816                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3817                                 else
3818                                         msg_format("%^s¤¬¥À¥ó¥¸¥ç¥ó¤Î¼ç¤ò¾¤´­¤·¤¿¡£", m_name);
3819 #else
3820                                 if (blind)
3821                                         msg_format("%^s mumbles.", m_name);
3822                                 else
3823                                         msg_format("%^s magically summons guardians of dungeons.", m_name);
3824 #endif
3825                         }
3826                         else
3827                         {
3828 #ifdef JP
3829                                 if (blind)
3830                                         msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3831                                 else
3832                                         msg_format("%^s¤ÏËâË¡¤Ç%s¤ò¾¤´­¤·¤¿¡£",
3833                                         m_name,
3834                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3835                                         "¼ê²¼" : "Ãç´Ö"));
3836 #else
3837                                 if (blind)
3838                                         msg_format("%^s mumbles.", m_name);
3839                                 else
3840                                         msg_format("%^s magically summons %s %s.",
3841                                         m_name, m_poss,
3842                                         ((r_ptr->flags1) & RF1_UNIQUE ?
3843                                         "minions" : "kin"));
3844 #endif
3845                         }
3846
3847                         if(m_ptr->r_idx == MON_ROLENTO)
3848                         {
3849                                 int num = 1 + randint1(3);
3850
3851                                 for (k = 0; k < num; k++)
3852                                 {
3853                                         count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, mode);
3854                                 }
3855                         }
3856                         else if(m_ptr->r_idx == MON_THORONDOR ||
3857                                 m_ptr->r_idx == MON_GWAIHIR ||
3858                                 m_ptr->r_idx == MON_MENELDOR)
3859                         {
3860                                 int num = 4 + randint1(3);
3861                                 for (k = 0; k < num; k++)
3862                                 {
3863                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3864                                 }
3865                         }
3866                         else if(m_ptr->r_idx == MON_LOUSY)
3867                         {
3868                                 int num = 2 + randint1(3);
3869                                 for (k = 0; k < num; k++)
3870                                 {
3871                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
3872                                 }
3873                         }
3874                         else if(m_ptr->r_idx == MON_BULLGATES)
3875                         {
3876                                 int num = 2 + randint1(3);
3877                                 for (k = 0; k < num; k++)
3878                                 {
3879                                         count += summon_named_creature(m_idx, y, x, 921, mode);
3880                                 }
3881                         }
3882                         else if (m_ptr->r_idx == MON_CALDARM)
3883                         {
3884                                 int num = randint1(3);
3885                                 for (k = 0; k < num; k++)
3886                                 {
3887                                         count += summon_named_creature(m_idx, y, x, 930, mode);
3888                                 }
3889                         }
3890                         else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
3891                         {
3892                                 int num = 2 + randint1(3);
3893
3894                                 if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
3895                                 {
3896 #ifdef JP
3897                                         msg_print("ÃÏÌ̤«¤é¿å¤¬¿á¤­½Ð¤·¤¿¡ª");
3898 #else
3899                                         msg_print("Water blew off from the ground!");
3900 #endif
3901                                         fire_ball_hide(GF_WATER_FLOW, 0, 3, 8);
3902                                 }
3903
3904                                 for (k = 0; k < num; k++)
3905                                 {
3906                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3907                                 }
3908                         }
3909                         else
3910                         {
3911
3912                                 summon_kin_type = r_ptr->d_char; /* Big hack */
3913
3914                                 for (k = 0; k < 4; k++)
3915                                 {
3916                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, PM_ALLOW_GROUP);
3917                                 }
3918                         }
3919 #ifdef JP
3920 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
3921 #else
3922                         if (blind && count) msg_print("You hear many things appear nearby.");
3923 #endif
3924
3925
3926                         break;
3927                 }
3928
3929                 /* RF6_S_CYBER */
3930                 case 160+17:
3931                 {
3932                         disturb(1, 0);
3933 #ifdef JP
3934 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3935 #else
3936                         if (blind) msg_format("%^s mumbles.", m_name);
3937 #endif
3938
3939 #ifdef JP
3940 else msg_format("%^s¤¬¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
3941 #else
3942                         else msg_format("%^s magically summons Cyberdemons!", m_name);
3943 #endif
3944
3945 #ifdef JP
3946 if (blind && count) msg_print("½Å¸ü¤Ê­²»¤¬¶á¤¯¤Çʹ¤³¤¨¤ë¡£");
3947 #else
3948                         if (blind && count) msg_print("You hear heavy steps nearby.");
3949 #endif
3950
3951                         summon_cyber(m_idx, y, x);
3952                         break;
3953                 }
3954
3955                 /* RF6_S_MONSTER */
3956                 case 160+18:
3957                 {
3958                         disturb(1, 0);
3959 #ifdef JP
3960 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3961 #else
3962                         if (blind) msg_format("%^s mumbles.", m_name);
3963 #endif
3964
3965 #ifdef JP
3966 else msg_format("%^s¤¬ËâË¡¤ÇÃç´Ö¤ò¾¤´­¤·¤¿¡ª", m_name);
3967 #else
3968                         else msg_format("%^s magically summons help!", m_name);
3969 #endif
3970
3971                         for (k = 0; k < 1; k++)
3972                         {
3973                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
3974                         }
3975 #ifdef JP
3976 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
3977 #else
3978                         if (blind && count) msg_print("You hear something appear nearby.");
3979 #endif
3980
3981                         break;
3982                 }
3983
3984                 /* RF6_S_MONSTERS */
3985                 case 160+19:
3986                 {
3987                         disturb(1, 0);
3988 #ifdef JP
3989 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
3990 #else
3991                         if (blind) msg_format("%^s mumbles.", m_name);
3992 #endif
3993
3994 #ifdef JP
3995 else msg_format("%^s¤¬ËâË¡¤Ç¥â¥ó¥¹¥¿¡¼¤ò¾¤´­¤·¤¿¡ª", m_name);
3996 #else
3997                         else msg_format("%^s magically summons monsters!", m_name);
3998 #endif
3999
4000                         for (k = 0; k < s_num_6; k++)
4001                         {
4002                                 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4003                         }
4004 #ifdef JP
4005 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4006 #else
4007                         if (blind && count) msg_print("You hear many things appear nearby.");
4008 #endif
4009
4010                         break;
4011                 }
4012
4013                 /* RF6_S_ANT */
4014                 case 160+20:
4015                 {
4016                         disturb(1, 0);
4017 #ifdef JP
4018 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4019 #else
4020                         if (blind) msg_format("%^s mumbles.", m_name);
4021 #endif
4022
4023 #ifdef JP
4024 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ê¤ò¾¤´­¤·¤¿¡£", m_name);
4025 #else
4026                         else msg_format("%^s magically summons ants.", m_name);
4027 #endif
4028
4029                         for (k = 0; k < s_num_6; k++)
4030                         {
4031                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, PM_ALLOW_GROUP);
4032                         }
4033 #ifdef JP
4034 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4035 #else
4036                         if (blind && count) msg_print("You hear many things appear nearby.");
4037 #endif
4038
4039                         break;
4040                 }
4041
4042                 /* RF6_S_SPIDER */
4043                 case 160+21:
4044                 {
4045                         disturb(1, 0);
4046 #ifdef JP
4047 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4048 #else
4049                         if (blind) msg_format("%^s mumbles.", m_name);
4050 #endif
4051
4052 #ifdef JP
4053 else msg_format("%^s¤¬ËâË¡¤Ç¥¯¥â¤ò¾¤´­¤·¤¿¡£", m_name);
4054 #else
4055                         else msg_format("%^s magically summons spiders.", m_name);
4056 #endif
4057
4058                         for (k = 0; k < s_num_6; k++)
4059                         {
4060                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, PM_ALLOW_GROUP);
4061                         }
4062 #ifdef JP
4063 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4064 #else
4065                         if (blind && count) msg_print("You hear many things appear nearby.");
4066 #endif
4067
4068                         break;
4069                 }
4070
4071                 /* RF6_S_HOUND */
4072                 case 160+22:
4073                 {
4074                         disturb(1, 0);
4075 #ifdef JP
4076 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4077 #else
4078                         if (blind) msg_format("%^s mumbles.", m_name);
4079 #endif
4080
4081 #ifdef JP
4082 else msg_format("%^s¤¬ËâË¡¤Ç¥Ï¥¦¥ó¥É¤ò¾¤´­¤·¤¿¡£", m_name);
4083 #else
4084                         else msg_format("%^s magically summons hounds.", m_name);
4085 #endif
4086
4087                         for (k = 0; k < s_num_4; k++)
4088                         {
4089                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, PM_ALLOW_GROUP);
4090                         }
4091 #ifdef JP
4092 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4093 #else
4094                         if (blind && count) msg_print("You hear many things appear nearby.");
4095 #endif
4096
4097                         break;
4098                 }
4099
4100                 /* RF6_S_HYDRA */
4101                 case 160+23:
4102                 {
4103                         disturb(1, 0);
4104 #ifdef JP
4105 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4106 #else
4107                         if (blind) msg_format("%^s mumbles.", m_name);
4108 #endif
4109
4110 #ifdef JP
4111 else msg_format("%^s¤¬ËâË¡¤Ç¥Ò¥É¥é¤ò¾¤´­¤·¤¿¡£", m_name);
4112 #else
4113                         else msg_format("%^s magically summons hydras.", m_name);
4114 #endif
4115
4116                         for (k = 0; k < s_num_4; k++)
4117                         {
4118                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, PM_ALLOW_GROUP);
4119                         }
4120 #ifdef JP
4121 if (blind && count) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4122 #else
4123                         if (blind && count) msg_print("You hear many things appear nearby.");
4124 #endif
4125
4126                         break;
4127                 }
4128
4129                 /* RF6_S_ANGEL */
4130                 case 160+24:
4131                 {
4132                         int num = 1;
4133
4134                         disturb(1, 0);
4135 #ifdef JP
4136 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4137 #else
4138                         if (blind) msg_format("%^s mumbles.", m_name);
4139 #endif
4140
4141 #ifdef JP
4142 else msg_format("%^s¤¬ËâË¡¤ÇÅ·»È¤ò¾¤´­¤·¤¿¡ª", m_name);
4143 #else
4144                         else msg_format("%^s magically summons an angel!", m_name);
4145 #endif
4146
4147                         if ((r_ptr->flags1 & RF1_UNIQUE) && !easy_band)
4148                         {
4149                                 num += r_ptr->level/40;
4150                         }
4151
4152                         for (k = 0; k < num; k++)
4153                         {
4154                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, PM_ALLOW_GROUP);
4155                         }
4156
4157                         if (count < 2)
4158                         {
4159 #ifdef JP
4160 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4161 #else
4162                                 if (blind && count) msg_print("You hear something appear nearby.");
4163 #endif
4164                         }
4165                         else
4166                         {
4167 #ifdef JP
4168 if (blind) msg_print("¿¤¯¤Î¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4169 #else
4170                                 if (blind) msg_print("You hear many things appear nearby.");
4171 #endif
4172                         }
4173
4174                         break;
4175                 }
4176
4177                 /* RF6_S_DEMON */
4178                 case 160+25:
4179                 {
4180                         disturb(1, 0);
4181 #ifdef JP
4182 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4183 #else
4184                         if (blind) msg_format("%^s mumbles.", m_name);
4185 #endif
4186
4187 #ifdef JP
4188 else msg_format("%^s¤ÏËâË¡¤Çº®Æ٤εÜÄ¤é°­Ëâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4189 #else
4190                         else msg_format("%^s magically summons a demon from the Courts of Chaos!", m_name);
4191 #endif
4192
4193                         for (k = 0; k < 1; k++)
4194                         {
4195                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, PM_ALLOW_GROUP);
4196                         }
4197 #ifdef JP
4198 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4199 #else
4200                         if (blind && count) msg_print("You hear something appear nearby.");
4201 #endif
4202
4203                         break;
4204                 }
4205
4206                 /* RF6_S_UNDEAD */
4207                 case 160+26:
4208                 {
4209                         disturb(1, 0);
4210 #ifdef JP
4211 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4212 #else
4213                         if (blind) msg_format("%^s mumbles.", m_name);
4214 #endif
4215
4216 #ifdef JP
4217 else msg_format("%^s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤Î¶¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4218 #else
4219                         else msg_format("%^s magically summons an undead adversary!", m_name);
4220 #endif
4221
4222                         for (k = 0; k < 1; k++)
4223                         {
4224                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, PM_ALLOW_GROUP);
4225                         }
4226 #ifdef JP
4227 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4228 #else
4229                         if (blind && count) msg_print("You hear something appear nearby.");
4230 #endif
4231
4232                         break;
4233                 }
4234
4235                 /* RF6_S_DRAGON */
4236                 case 160+27:
4237                 {
4238                         disturb(1, 0);
4239 #ifdef JP
4240 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4241 #else
4242                         if (blind) msg_format("%^s mumbles.", m_name);
4243 #endif
4244
4245 #ifdef JP
4246 else msg_format("%^s¤¬ËâË¡¤Ç¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4247 #else
4248                         else msg_format("%^s magically summons a dragon!", m_name);
4249 #endif
4250
4251                         for (k = 0; k < 1; k++)
4252                         {
4253                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, PM_ALLOW_GROUP);
4254                         }
4255 #ifdef JP
4256 if (blind && count) msg_print("²¿¤«¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬¤¹¤ë¡£");
4257 #else
4258                         if (blind && count) msg_print("You hear something appear nearby.");
4259 #endif
4260
4261                         break;
4262                 }
4263
4264                 /* RF6_S_HI_UNDEAD */
4265                 case 160+28:
4266                 {
4267                         disturb(1, 0);
4268
4269                         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))
4270                         {
4271                                 int cy = y;
4272                                 int cx = x;
4273
4274 #ifdef JP
4275 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4276 #else
4277                                 if (blind) msg_format("%^s mumbles.", m_name);
4278 #endif
4279
4280 #ifdef JP
4281 else msg_format("%^s¤¬ËâË¡¤ÇÍ©µ´ÀïÂâ¤ò¾¤´­¤·¤¿¡ª", m_name);
4282 #else
4283                                 else msg_format("%^s magically summons rangers of Nazgul!", m_name);
4284 #endif
4285                                 msg_print(NULL);
4286
4287                                 for (k = 0; k < 30; k++)
4288                                 {
4289                                         if (!summon_possible(cy, cx) || !cave_floor_bold(cy, cx))
4290                                         {
4291                                                 int j;
4292                                                 for (j = 100; j > 0; j--)
4293                                                 {
4294                                                         scatter(&cy, &cx, y, x, 2, 0);
4295                                                         if (cave_floor_bold(cy, cx)) break;
4296                                                 }
4297                                                 if (!j) break;
4298                                         }
4299                                         if (!cave_floor_bold(cy, cx)) continue;
4300
4301                                         if (summon_named_creature(m_idx, cy, cx, MON_NAZGUL, mode))
4302                                         {
4303                                                 y = cy;
4304                                                 x = cx;
4305                                                 count++;
4306                                                 if (count == 1)
4307 #ifdef JP
4308 msg_format("¡ÖÍ©µ´ÀïÂâ%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4309 #else
4310                                                         msg_format("A Nazgul says 'Nazgul-Rangers Number %d, Nazgul-Black!'",count);
4311 #endif
4312                                                 else
4313 #ifdef JP
4314 msg_format("¡ÖƱ¤¸¤¯%d¹æ¡¢¥Ê¥º¥°¥ë¡¦¥Ö¥é¥Ã¥¯¡ª¡×", count);
4315 #else
4316                                                         msg_format("Another one says 'Number %d, Nazgul-Black!'",count);
4317 #endif
4318                                                 msg_print(NULL);
4319                                         }
4320                                 }
4321 #ifdef JP
4322 msg_format("¡Ö%dɤ¤½¤í¤Ã¤Æ¡¢¥ê¥ó¥°¥ì¥ó¥¸¥ã¡¼¡ª¡×", count);
4323 #else
4324 msg_format("They say 'The %d meets! We are the Ring-Ranger!'.", count);
4325 #endif
4326                                 msg_print(NULL);
4327                         }
4328                         else
4329                         {
4330 #ifdef JP
4331 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4332 #else
4333                                 if (blind) msg_format("%^s mumbles.", m_name);
4334 #endif
4335
4336 #ifdef JP
4337 else msg_format("%^s¤¬ËâË¡¤Ç¶¯ÎϤʥ¢¥ó¥Ç¥Ã¥É¤ò¾¤´­¤·¤¿¡ª", m_name);
4338 #else
4339                                 else msg_format("%^s magically summons greater undead!", m_name);
4340 #endif
4341
4342                                 for (k = 0; k < s_num_6; k++)
4343                                 {
4344                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4345                                 }
4346                         }
4347                         if (blind && count)
4348                         {
4349 #ifdef JP
4350 msg_print("´Ö¶á¤Ç²¿¤«Â¿¤¯¤Î¤â¤Î¤¬Ç礤²ó¤ë²»¤¬Ê¹¤³¤¨¤ë¡£");
4351 #else
4352                                 msg_print("You hear many creepy things appear nearby.");
4353 #endif
4354
4355                         }
4356                         break;
4357                 }
4358
4359                 /* RF6_S_HI_DRAGON */
4360                 case 160+29:
4361                 {
4362                         disturb(1, 0);
4363 #ifdef JP
4364 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4365 #else
4366                         if (blind) msg_format("%^s mumbles.", m_name);
4367 #endif
4368
4369 #ifdef JP
4370 else msg_format("%^s¤¬ËâË¡¤Ç¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´­¤·¤¿¡ª", m_name);
4371 #else
4372                         else msg_format("%^s magically summons ancient dragons!", m_name);
4373 #endif
4374
4375                         for (k = 0; k < s_num_4; k++)
4376                         {
4377                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4378                         }
4379                         if (blind && count)
4380                         {
4381 #ifdef JP
4382 msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
4383 #else
4384                                 msg_print("You hear many powerful things appear nearby.");
4385 #endif
4386
4387                         }
4388                         break;
4389                 }
4390
4391                 /* RF6_S_AMBERITES */
4392                 case 160+30:
4393                 {
4394                         disturb(1, 0);
4395 #ifdef JP
4396 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4397 #else
4398                         if (blind) msg_format("%^s mumbles.", m_name);
4399 #endif
4400
4401 #ifdef JP
4402 else msg_format("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ò¾¤´­¤·¤¿¡ª", m_name);
4403 #else
4404                         else msg_format("%^s magically summons Lords of Amber!", m_name);
4405 #endif
4406
4407
4408
4409                         for (k = 0; k < s_num_4; k++)
4410                         {
4411                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4412                         }
4413                         if (blind && count)
4414                         {
4415 #ifdef JP
4416 msg_print("ÉÔ»à¤Î¼Ô¤¬¶á¤¯¤Ë¸½¤ì¤ë¤Î¤¬Ê¹¤³¤¨¤¿¡£");
4417 #else
4418                                 msg_print("You hear immortal beings appear nearby.");
4419 #endif
4420
4421                         }
4422                         break;
4423                 }
4424
4425                 /* RF6_S_UNIQUE */
4426                 case 160+31:
4427                 {
4428                         disturb(1, 0);
4429 #ifdef JP
4430 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
4431 #else
4432                         if (blind) msg_format("%^s mumbles.", m_name);
4433 #endif
4434
4435 #ifdef JP
4436 else msg_format("%^s¤¬ËâË¡¤ÇÆÃÊ̤ʶ¯Å¨¤ò¾¤´­¤·¤¿¡ª", m_name);
4437 #else
4438                         else msg_format("%^s magically summons special opponents!", m_name);
4439 #endif
4440
4441                         for (k = 0; k < s_num_4; k++)
4442                         {
4443                                 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4444                         }
4445                         if (r_ptr->flags3 & RF3_GOOD)
4446                         {
4447                                 for (k = count; k < s_num_4; k++)
4448                                 {
4449                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4450                                 }
4451                         }
4452                         else
4453                         {
4454                                 for (k = count; k < s_num_4; k++)
4455                                 {
4456                                         count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
4457                                 }
4458                         }
4459                         if (blind && count)
4460                         {
4461 #ifdef JP
4462 msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
4463 #else
4464                                 msg_print("You hear many powerful things appear nearby.");
4465 #endif
4466
4467                         }
4468                         break;
4469                 }
4470         }
4471
4472         if ((p_ptr->action == ACTION_LEARN) && thrown_spell > 175)
4473         {
4474                 learn_spell(thrown_spell - 96);
4475         }
4476
4477         if (seen && maneable && !world_monster && (p_ptr->pclass == CLASS_IMITATOR))
4478         {
4479                 if (thrown_spell != 167)
4480                 {
4481                         if (p_ptr->mane_num == MAX_MANE)
4482                         {
4483                                 int i;
4484                                 p_ptr->mane_num--;
4485                                 for (i = 0;i < p_ptr->mane_num;i++)
4486                                 {
4487                                         p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
4488                                         p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
4489                                 }
4490                         }
4491                         p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
4492                         p_ptr->mane_dam[p_ptr->mane_num] = dam;
4493                         p_ptr->mane_num++;
4494                         new_mane = TRUE;
4495
4496                         p_ptr->redraw |= (PR_MANE);
4497                 }
4498         }
4499
4500         /* Remember what the monster did to us */
4501         if (seen)
4502         {
4503                 /* Inate spell */
4504                 if (thrown_spell < 32 * 4)
4505                 {
4506                         r_ptr->r_flags4 |= (1L << (thrown_spell - 32 * 3));
4507                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4508                 }
4509
4510                 /* Bolt or Ball */
4511                 else if (thrown_spell < 32 * 5)
4512                 {
4513                         r_ptr->r_flags5 |= (1L << (thrown_spell - 32 * 4));
4514                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4515                 }
4516
4517                 /* Special spell */
4518                 else if (thrown_spell < 32 * 6)
4519                 {
4520                         r_ptr->r_flags6 |= (1L << (thrown_spell - 32 * 5));
4521                         if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
4522                 }
4523         }
4524
4525
4526         /* Always take note of monsters that kill you */
4527         if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
4528         {
4529                 r_ptr->r_deaths++;
4530         }
4531
4532         /* A spell was cast */
4533         return (TRUE);
4534 }