OSDN Git Service

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