3 * @brief ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¼ÂÁõ(ÂÐ¥â¥ó¥¹¥¿¡¼½èÍý) / Monster spells (attack monster)
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
17 * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨ÂÐ¥â¥ó¥¹¥¿¡¼¤Ë¥Ó¡¼¥à¤òÅö¤Æ¤ë¤³¤È²Äǽ¤«¤òȽÄꤹ¤ë /
18 * Determine if a beam spell will hit the target.
19 * @param y1 »ÏÅÀ¤ÎYºÂɸ
20 * @param x1 »ÏÅÀ¤ÎXºÂɸ
21 * @param y2 ÌÜɸ¤ÎYºÂɸ
22 * @param x2 ÌÜɸ¤ÎXºÂɸ
23 * @param m_ptr »ÈÍѤ¹¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
24 * @return ¥Ó¡¼¥à¤¬Åþã²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
26 static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
34 bool is_friend = is_pet(m_ptr);
36 /* Check the projection path */
37 grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_THRU);
39 /* No grid is ever projectable from itself */
40 if (!grid_n) return (FALSE);
42 for (i = 0; i < grid_n; i++)
44 y = GRID_Y(grid_g[i]);
45 x = GRID_X(grid_g[i]);
47 if (y == y2 && x == x2)
49 else if (is_friend && cave[y][x].m_idx > 0 &&
50 !are_enemies(m_ptr, &m_list[cave[y][x].m_idx]))
52 /* Friends don't shoot friends */
56 if (is_friend && player_bold(y, x))
65 * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨ÂÐ¥â¥ó¥¹¥¿¡¼¤ËľÀܥ֥쥹¤òÅö¤Æ¤ë¤³¤È¤¬²Äǽ¤«¤òȽÄꤹ¤ë /
66 * Determine if a breath will hit the target.
67 * @param y1 »ÏÅÀ¤ÎYºÂɸ
68 * @param x1 »ÏÅÀ¤ÎXºÂɸ
69 * @param y2 ÌÜɸ¤ÎYºÂɸ
70 * @param x2 ÌÜɸ¤ÎXºÂɸ
72 * @param typ ¸ú²Ì°ÀID
73 * @param is_friend TRUE¤Ê¤é¤Ð¡¢¥×¥ì¥¤¥ä¡¼¤ò´¬¤¹þ¤à»þ¤Ë¥Ö¥ì¥¹¤ÎȽÄê¤òFALSE¤Ë¤¹¤ë¡£
74 * @return ¥Ö¥ì¥¹¤òľÀÜÅö¤Æ¤é¤ì¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
76 static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool is_friend)
78 /* Must be the same as projectable() */
90 byte gx[1024], gy[1024];
105 case GF_DISINTEGRATE:
113 /* Check the projection path */
114 grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, flg);
116 /* Project along the path */
117 for (i = 0; i < grid_n; ++i)
119 int ny = GRID_Y(grid_g[i]);
120 int nx = GRID_X(grid_g[i]);
122 if (flg & PROJECT_DISI)
124 /* Hack -- Balls explode before reaching walls */
125 if (cave_stop_disintegration(ny, nx)) break;
127 else if (flg & PROJECT_LOS)
129 /* Hack -- Balls explode before reaching walls */
130 if (!cave_los_bold(ny, nx)) break;
134 /* Hack -- Balls explode before reaching walls */
135 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
138 /* Save the "blast epicenter" */
147 if (flg & PROJECT_DISI)
149 if (in_disintegration_range(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
150 if (in_disintegration_range(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
152 else if (flg & PROJECT_LOS)
154 if (los(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
155 if (los(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
159 if (projectable(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
160 if (projectable(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
165 breath_shape(grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y, x, typ);
167 for (i = 0; i < grids; i++)
169 /* Extract the location */
173 if ((y == y2) && (x == x2)) hit2 = TRUE;
174 if (player_bold(y, x)) hityou = TRUE;
178 if (!hit2) return FALSE;
179 if (is_friend && hityou) return FALSE;
185 * @brief ¥â¥ó¥¹¥¿¡¼¤¬ÆüìǽÎϤÎÌÜɸÃÏÅÀ¤ò·è¤á¤ë½èÍý /
186 * Get the actual center point of ball spells (rad > 1) (originally from TOband)
187 * @param sy »ÏÅÀ¤ÎYºÂɸ
188 * @param sx »ÏÅÀ¤ÎXºÂɸ
189 * @param ty ÌÜɸYºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
190 * @param tx ÌÜɸXºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
191 * @param flg ȽÄê¤Î¥Õ¥é¥°ÇÛÎó
194 void get_project_point(int sy, int sx, int *ty, int *tx, int flg)
199 path_n = project_path(path_g, MAX_RANGE, sy, sx, *ty, *tx, flg);
204 /* Project along the path */
205 for (i = 0; i < path_n; i++)
207 sy = GRID_Y(path_g[i]);
208 sx = GRID_X(path_g[i]);
210 /* Hack -- Balls explode before reaching walls */
211 if (!cave_have_flag_bold(sy, sx, FF_PROJECT)) break;
219 * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨¥â¥ó¥¹¥¿¡¼¤ËËâÎϾõî¤ò»È¤¦¤«¤É¤¦¤«¤òÊÖ¤¹ /
220 * Check should monster cast dispel spell at other monster.
221 * @param m_idx ½Ñ¼Ô¤Î¥â¥ó¥¹¥¿¡¼ID
222 * @param t_idx ÌÜɸ¤Î¥â¥ó¥¹¥¿¡¼ID
223 * @return ËâÎϾõî¤ò»È¤¦¤Ù¤¤Ê¤é¤ÐTRUE¤òÊѤ¨¤¹¡£
225 static bool dispel_check_monster(int m_idx, int t_idx)
227 monster_type *t_ptr = &m_list[t_idx];
230 if (MON_INVULNER(t_ptr)) return TRUE;
233 if (t_ptr->mspeed < 135)
235 if (MON_FAST(t_ptr)) return TRUE;
239 if (t_idx == p_ptr->riding)
241 if (dispel_check(m_idx)) return TRUE;
244 /* No need to cast dispel spell */
249 * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨¥â¥ó¥¹¥¿¡¼¤ËÆüìǽÎϤò»È¤¦½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
250 * Monster tries to 'cast a spell' (or breath, etc) at another monster.
251 * @param m_idx ½Ñ¼Ô¤Î¥â¥ó¥¹¥¿¡¼ID
252 * @return ¼ÂºÝ¤ËÆüìǽÎϤò»È¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹
254 * The player is only disturbed if able to be affected by the spell.
256 bool monst_spell_monst(int m_idx)
260 int thrown_spell, count = 0;
266 int s_num_6 = (easy_band ? 2 : 6);
267 int s_num_4 = (easy_band ? 1 : 4);
268 int rad = 0; //For elemental balls
270 byte spell[96], num = 0;
279 monster_type *m_ptr = &m_list[m_idx];
280 monster_type *t_ptr = NULL;
282 monster_race *r_ptr = &r_info[m_ptr->r_idx];
283 monster_race *tr_ptr = NULL;
287 bool wake_up = FALSE;
290 bool blind = (p_ptr->blind ? TRUE : FALSE);
292 bool see_m = is_seen(m_ptr);
293 bool maneable = player_has_los_bold(m_ptr->fy, m_ptr->fx);
298 bool pet = is_pet(m_ptr);
300 bool in_no_magic_dungeon = (d_info[dungeon_type].flags1 & DF1_NO_MAGIC) && dun_level
301 && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
303 bool can_use_lite_area = FALSE;
307 bool resists_tele = FALSE;
309 /* Prepare flags for summoning */
310 if (!pet) u_mode |= PM_ALLOW_UNIQUE;
312 /* Cannot cast spells when confused */
313 if (MON_CONFUSED(m_ptr)) return (FALSE);
315 /* Extract the racial spell flags */
320 /* Target is given for pet? */
321 if (pet_t_m_idx && pet)
324 t_ptr = &m_list[t_idx];
326 /* Cancel if not projectable (for now) */
327 if ((m_idx == t_idx) || !projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
333 /* Is there counter attack target? */
334 if (!t_idx && m_ptr->target_y)
336 t_idx = cave[m_ptr->target_y][m_ptr->target_x].m_idx;
340 t_ptr = &m_list[t_idx];
342 /* Cancel if neither enemy nor a given target */
343 if ((m_idx == t_idx) ||
344 ((t_idx != pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
349 /* Allow only summoning etc.. if not projectable */
350 else if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
352 f4 &= (RF4_INDIRECT_MASK);
353 f5 &= (RF5_INDIRECT_MASK);
354 f6 &= (RF6_INDIRECT_MASK);
359 /* Look for enemies normally */
362 bool success = FALSE;
364 if (p_ptr->inside_battle)
366 start = randint1(m_max-1) + m_max;
367 if (randint0(2)) plus = -1;
369 else start = m_max + 1;
371 /* Scan thru all monsters */
372 for (i = start; ((i < start + m_max) && (i > start - m_max)); i += plus)
374 int dummy = (i % m_max);
375 if (!dummy) continue;
378 t_ptr = &m_list[t_idx];
380 /* Skip dead monsters */
381 if (!t_ptr->r_idx) continue;
383 /* Monster must be 'an enemy' */
384 if ((m_idx == t_idx) || !are_enemies(m_ptr, t_ptr)) continue;
386 /* Monster must be projectable */
387 if (!projectable(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx)) continue;
395 if (!success) return FALSE;
399 /* OK -- we've got a target */
402 tr_ptr = &r_info[t_ptr->r_idx];
404 /* Forget old counter attack target */
407 /* Extract the monster level */
408 rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
410 /* Remove unimplemented spells */
411 f6 &= ~(RF6_WORLD | RF6_TRAPS | RF6_FORGET);
413 if (f4 & RF4_BR_LITE)
415 if (!los(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx))
416 f4 &= ~(RF4_BR_LITE);
419 /* Remove unimplemented special moves */
420 if (f6 & RF6_SPECIAL)
422 if ((m_ptr->r_idx != MON_ROLENTO) && (r_ptr->d_char != 'B'))
423 f6 &= ~(RF6_SPECIAL);
426 if (f6 & RF6_DARKNESS)
428 bool vs_ninja = (p_ptr->pclass == CLASS_NINJA) && !is_hostile(t_ptr);
431 !(r_ptr->flags3 & (RF3_UNDEAD | RF3_HURT_LITE)) &&
432 !(r_ptr->flags7 & RF7_DARK_MASK))
433 can_use_lite_area = TRUE;
435 if (!(r_ptr->flags2 & RF2_STUPID))
437 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) f6 &= ~(RF6_DARKNESS);
438 else if (vs_ninja && !can_use_lite_area) f6 &= ~(RF6_DARKNESS);
442 if (in_no_magic_dungeon && !(r_ptr->flags2 & RF2_STUPID))
444 f4 &= (RF4_NOMAGIC_MASK);
445 f5 &= (RF5_NOMAGIC_MASK);
446 f6 &= (RF6_NOMAGIC_MASK);
449 if (p_ptr->inside_arena || p_ptr->inside_battle)
451 f4 &= ~(RF4_SUMMON_MASK);
452 f5 &= ~(RF5_SUMMON_MASK);
453 f6 &= ~(RF6_SUMMON_MASK | RF6_TELE_LEVEL);
455 if (m_ptr->r_idx == MON_ROLENTO) f6 &= ~(RF6_SPECIAL);
458 if (p_ptr->inside_battle && !one_in_(3))
463 if (m_idx == p_ptr->riding)
465 f4 &= ~(RF4_RIDING_MASK);
466 f5 &= ~(RF5_RIDING_MASK);
467 f6 &= ~(RF6_RIDING_MASK);
473 f6 &= ~(RF6_DARKNESS | RF6_TRAPS);
475 if (!(p_ptr->pet_extra_flags & PF_TELEPORT))
477 f6 &= ~(RF6_BLINK | RF6_TPORT | RF6_TELE_TO | RF6_TELE_AWAY | RF6_TELE_LEVEL);
480 if (!(p_ptr->pet_extra_flags & PF_ATTACK_SPELL))
482 f4 &= ~(RF4_ATTACK_MASK);
483 f5 &= ~(RF5_ATTACK_MASK);
484 f6 &= ~(RF6_ATTACK_MASK);
487 if (!(p_ptr->pet_extra_flags & PF_SUMMON_SPELL))
489 f4 &= ~(RF4_SUMMON_MASK);
490 f5 &= ~(RF5_SUMMON_MASK);
491 f6 &= ~(RF6_SUMMON_MASK);
494 /* Prevent collateral damage */
495 if (!(p_ptr->pet_extra_flags & PF_BALL_SPELL) && (m_idx != p_ptr->riding))
497 if ((f4 & (RF4_BALL_MASK & ~(RF4_ROCKET))) ||
498 (f5 & RF5_BALL_MASK) ||
499 (f6 & RF6_BALL_MASK))
504 get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
506 if (projectable(real_y, real_x, py, px))
508 int dist = distance(real_y, real_x, py, px);
512 f4 &= ~(RF4_BALL_MASK & ~(RF4_ROCKET));
513 f5 &= ~(RF5_BALL_MASK);
514 f6 &= ~(RF6_BALL_MASK);
518 f4 &= ~(RF4_BIG_BALL_MASK);
519 f5 &= ~(RF5_BIG_BALL_MASK);
520 f6 &= ~(RF6_BIG_BALL_MASK);
523 else if (f5 & RF5_BA_LITE)
525 if ((distance(real_y, real_x, py, px) <= 4) && los(real_y, real_x, py, px))
526 f5 &= ~(RF5_BA_LITE);
535 get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
536 if (projectable(real_y, real_x, py, px) && (distance(real_y, real_x, py, px) <= 2))
540 if (((f4 & RF4_BEAM_MASK) ||
541 (f5 & RF5_BEAM_MASK) ||
542 (f6 & RF6_BEAM_MASK)) &&
543 !direct_beam(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, m_ptr))
545 f4 &= ~(RF4_BEAM_MASK);
546 f5 &= ~(RF5_BEAM_MASK);
547 f6 &= ~(RF6_BEAM_MASK);
550 if ((f4 & RF4_BREATH_MASK) ||
551 (f5 & RF5_BREATH_MASK) ||
552 (f6 & RF6_BREATH_MASK))
554 /* Expected breath radius */
555 int rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2;
557 if (!breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE))
559 f4 &= ~(RF4_BREATH_MASK);
560 f5 &= ~(RF5_BREATH_MASK);
561 f6 &= ~(RF6_BREATH_MASK);
563 else if ((f4 & RF4_BR_LITE) &&
564 !breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE))
566 f4 &= ~(RF4_BR_LITE);
568 else if ((f4 & RF4_BR_DISI) &&
569 !breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE))
571 f4 &= ~(RF4_BR_DISI);
576 /* Special moves restriction */
577 if (f6 & RF6_SPECIAL)
579 if (m_ptr->r_idx == MON_ROLENTO)
581 if ((p_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_SUMMON_SPELL)) != (PF_ATTACK_SPELL | PF_SUMMON_SPELL))
582 f6 &= ~(RF6_SPECIAL);
584 else if (r_ptr->d_char == 'B')
586 if ((p_ptr->pet_extra_flags & (PF_ATTACK_SPELL | PF_TELEPORT)) != (PF_ATTACK_SPELL | PF_TELEPORT))
587 f6 &= ~(RF6_SPECIAL);
589 else f6 &= ~(RF6_SPECIAL);
593 /* Remove some spells if necessary */
595 if (!(r_ptr->flags2 & RF2_STUPID))
597 /* Check for a clean bolt shot */
598 if (((f4 & RF4_BOLT_MASK) ||
599 (f5 & RF5_BOLT_MASK) ||
600 (f6 & RF6_BOLT_MASK)) &&
601 !clean_shot(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, pet))
603 f4 &= ~(RF4_BOLT_MASK);
604 f5 &= ~(RF5_BOLT_MASK);
605 f6 &= ~(RF6_BOLT_MASK);
608 /* Check for a possible summon */
609 if (((f4 & RF4_SUMMON_MASK) ||
610 (f5 & RF5_SUMMON_MASK) ||
611 (f6 & RF6_SUMMON_MASK)) &&
612 !(summon_possible(t_ptr->fy, t_ptr->fx)))
614 /* Remove summoning spells */
615 f4 &= ~(RF4_SUMMON_MASK);
616 f5 &= ~(RF5_SUMMON_MASK);
617 f6 &= ~(RF6_SUMMON_MASK);
621 if ((f4 & RF4_DISPEL) && !dispel_check_monster(m_idx, t_idx))
623 /* Remove dispel spell */
627 /* Check for a possible raise dead */
628 if ((f6 & RF6_RAISE_DEAD) && !raise_possible(m_ptr))
630 /* Remove raise dead spell */
631 f6 &= ~(RF6_RAISE_DEAD);
634 /* Special moves restriction */
635 if (f6 & RF6_SPECIAL)
637 if ((m_ptr->r_idx == MON_ROLENTO) && !summon_possible(t_ptr->fy, t_ptr->fx))
639 f6 &= ~(RF6_SPECIAL);
644 if (r_ptr->flags2 & RF2_SMART)
646 /* Hack -- allow "desperate" spells */
647 if ((m_ptr->hp < m_ptr->maxhp / 10) &&
648 (randint0(100) < 50))
650 /* Require intelligent spells */
651 f4 &= (RF4_INT_MASK);
652 f5 &= (RF5_INT_MASK);
653 f6 &= (RF6_INT_MASK);
656 /* Hack -- decline "teleport level" in some case */
657 if ((f6 & RF6_TELE_LEVEL) && TELE_LEVEL_IS_INEFF((t_idx == p_ptr->riding) ? 0 : t_idx))
659 f6 &= ~(RF6_TELE_LEVEL);
664 if (!f4 && !f5 && !f6) return FALSE;
666 /* Extract the "inate" spells */
667 for (k = 0; k < 32; k++)
669 if (f4 & (1L << k)) spell[num++] = k + 32 * 3;
672 /* Extract the "normal" spells */
673 for (k = 0; k < 32; k++)
675 if (f5 & (1L << k)) spell[num++] = k + 32 * 4;
678 /* Extract the "bizarre" spells */
679 for (k = 0; k < 32; k++)
681 if (f6 & (1L << k)) spell[num++] = k + 32 * 5;
685 if (!num) return (FALSE);
687 /* Stop if player is dead or gone */
688 if (!p_ptr->playing || p_ptr->is_dead) return (FALSE);
690 /* Handle "leaving" */
691 if (p_ptr->leaving) return (FALSE);
693 /* Get the monster name (or "it") */
694 monster_desc(m_name, m_ptr, 0x00);
697 /* Get the monster possessive ("his"/"her"/"its") */
698 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
701 /* Get the target's name (or "it") */
702 monster_desc(t_name, t_ptr, 0x00);
704 /* Choose a spell to cast */
705 thrown_spell = spell[randint0(num)];
707 see_t = is_seen(t_ptr);
708 see_either = (see_m || see_t);
710 /* Can the player be aware of this attack? */
711 known = (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT);
713 if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
715 /* Check for spell failure (inate attacks never fail) */
716 if (!spell_is_inate(thrown_spell) && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2))))
720 if (see_m) msg_format(_("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£",
721 "%^s tries to cast a spell, but fails."), m_name);
726 /* Hex: Anti Magic Barrier */
727 if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx))
729 if (see_m) msg_format(_("È¿ËâË¡¥Ð¥ê¥¢¤¬%^s¤Î¼öʸ¤ò¤«¤¾Ã¤·¤¿¡£",
730 "Anti magic barrier cancels the spell which %^s casts."), m_name);
734 can_remember = is_original_ap_and_seen(m_ptr);
736 dam = monspell_to_monster(thrown_spell, y, x, m_idx, t_idx);
737 if (dam < 0)return FALSE;
739 switch (thrown_spell)
744 switch (m_ptr->r_idx)
747 /* Moved to process_monster(), like multiplication */
757 msg_format(_("%^s¤Ï¼êÜØÃƤò¤Ð¤é¤Þ¤¤¤¿¡£", "%^s throws some hand grenades."), m_name);
766 int num = 1 + randint1(3);
767 for (k = 0; k < num; k++)
769 count += summon_named_creature(m_idx, y, x, MON_SHURYUUDAN, 0);
773 if (known && !see_t && count)
780 if (r_ptr->d_char == 'B')
786 msg_format(_("%^s¤ÏÆÍÁ³µÞ¾å¾º¤·¤Æ»ë³¦¤«¤é¾Ã¤¨¤¿!", "%^s suddenly go out of your sight!"), m_name);
788 teleport_away(m_idx, 10, TELEPORT_NONMAGICAL);
789 p_ptr->update |= (PU_MONSTERS);
797 msg_format(_("%^s¤¬%s¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍî¤È¤·¤¿¡£", "%^s holds %s, and drops from the sky."), m_name, t_name);
807 if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
808 else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
812 if (tr_ptr->flags7 & RF7_CAN_FLY)
814 if (see_t) msg_format(_("%^s¤ÏÀŤ«¤ËÃåÃϤ·¤¿¡£", "%^s floats gently down to the ground."), t_name);
818 if (see_t) msg_format(_("%^s¤ÏÃÏÌ̤ËᤤĤ±¤é¤ì¤¿¡£", "%^s crashed into the ground."), t_name);
820 dam += damroll(6, 8);
823 if (p_ptr->riding == t_idx)
827 /* Mega hack -- this special action deals damage to the player. Therefore the code of "eyeeye" is necessary.
830 get_damage = take_hit(DAMAGE_NOESCAPE, dam, m_name, -1);
831 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
833 char m_name_self[80];
836 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
838 _(msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name),
839 msg_format("The attack of %s has wounded %s!", m_name, m_name_self));
841 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
842 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
846 mon_take_hit_mon(t_idx, dam, &fear, extract_note_dies(real_r_ptr(t_ptr)), m_idx);
851 /* Something is wrong */
864 msg_format(_("%^s¤¬%s¤ò°ú¤Ìᤷ¤¿¡£", "%^s commands %s to return."), m_name, t_name);
872 if (tr_ptr->flagsr & RFR_RES_TELE)
874 if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
876 if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
879 msg_format(_("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", "%^s is unaffected!"), t_name);
884 else if (tr_ptr->level > randint1(100))
886 if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
889 msg_format(_("%^s¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", "%^s resists!"), t_name);
898 if (t_idx == p_ptr->riding) teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
899 else teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_PASSIVE);
911 msg_format(_("%^s¤Ï%s¤ò¥Æ¥ì¥Ý¡¼¥È¤µ¤»¤¿¡£", "%^s teleports %s away."), m_name, t_name);
919 if (tr_ptr->flagsr & RFR_RES_TELE)
921 if ((tr_ptr->flags1 & RF1_UNIQUE) || (tr_ptr->flagsr & RFR_RES_ALL))
923 if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
926 msg_format(_("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", "%^s is unaffected!"), t_name);
931 else if (tr_ptr->level > randint1(100))
933 if (is_original_ap_and_seen(t_ptr)) tr_ptr->r_flagsr |= RFR_RES_TELE;
936 msg_format(_("%^s¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª", "%^s resists!"), t_name);
945 if (t_idx == p_ptr->riding) teleport_player_away(m_idx, MAX_SIGHT * 2 + 5);
946 else teleport_away(t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
958 msg_format(_("%^s¤¬%s¤Î¤ò»Ø¤µ¤·¤¿¡£", "%^s gestures at %s's feet."), m_name, t_name);
966 if (tr_ptr->flagsr & (RFR_EFF_RES_NEXU_MASK | RFR_RES_TELE))
968 if (see_t) msg_format(_("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", "%^s is unaffected!"), t_name);
970 else if ((tr_ptr->flags1 & RF1_QUESTOR) ||
971 (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
973 if (see_t) msg_format(_("%^s¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª", "%^s resist the effects!"), t_name);
975 else teleport_level((t_idx == p_ptr->riding) ? 0 : t_idx);
986 msg_format(_("%^s¤¬%s¤Ë¸þ¤«¤Ã¤Æ¸÷¤Î·õ¤òÊü¤Ã¤¿¡£", "%^s throw a Psycho-spear at %s."), m_name, t_name);
994 dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 180) : (randint1(rlev * 3 / 2) + 120);
995 beam(m_idx, y, x, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, MONSTER_TO_MONSTER);
1004 if (can_use_lite_area)
1006 msg_format(_("%^s¤¬ÊÕ¤ê¤òÌÀ¤ë¤¯¾È¤é¤·¤¿¡£", "%^s cast a spell to light up."), m_name);
1010 msg_format(_("%^s¤¬°Å°Ç¤ÎÃæ¤Ç¼ê¤ò¿¶¤Ã¤¿¡£", "%^s gestures in shadow."), m_name);
1015 if (can_use_lite_area)
1017 msg_format(_("%^s¤ÏÇò¤¤¸÷¤ËÊñ¤Þ¤ì¤¿¡£", "%^s is surrounded by a white light."), t_name);
1021 msg_format(_("%^s¤Ï°Å°Ç¤ËÊñ¤Þ¤ì¤¿¡£", "%^s is surrounded by darkness."), t_name);
1031 if (can_use_lite_area)
1033 (void)project(m_idx, 3, y, x, 0, GF_LITE_WEAK, PROJECT_GRID | PROJECT_KILL, -1);
1038 (void)project(m_idx, 3, y, x, 0, GF_DARK_WEAK, PROJECT_GRID | PROJECT_KILL, MS_DARKNESS);
1051 msg_format(_("%^s¤¬¼öʸ¤ò¾§¤¨¤Æ¼Ù°¤ËÈù¾Ð¤ó¤À¡£", "%^s casts a spell and cackles evilly."), m_name);
1055 msg_format(_("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", "%^s mumbles."), m_name);
1059 trap_creation(y, x);
1063 /* Not implemented */
1069 /* Not implemented */
1072 /* RF6_RAISE_DEAD */
1081 msg_format(_("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", "%^s mumbles."), m_name);
1085 msg_format(_("%^s¤¬»à¼ÔÉü³è¤Î¼öʸ¤ò¾§¤¨¤¿¡£", "%^s casts a spell to revive corpses."), m_name);
1093 animate_dead(m_idx, m_ptr->fy, m_ptr->fx);
1104 if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
1106 msg_format(_("%^s¤¬¥À¥ó¥¸¥ç¥ó¤Î¼ç¤ò¾¤´¤·¤¿¡£", "%^s magically summons guardians of dungeons."), m_name);
1110 _(msg_format("%s¤¬ËâË¡¤Ç%s¤ò¾¤´¤·¤¿¡£", m_name, ((r_ptr->flags1 & RF1_UNIQUE) ? "¼ê²¼" : "Ãç´Ö")),
1111 msg_format("%^s magically summons %s %s.", m_name, m_poss, ((r_ptr->flags1 & RF1_UNIQUE) ? "minions" : "kin")));
1121 switch (m_ptr->r_idx)
1127 int num = 4 + randint1(3);
1128 for (k = 0; k < num; k++)
1130 count += summon_specific(m_idx, y, x, rlev, SUMMON_EAGLES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
1137 int num = 2 + randint1(3);
1138 for (k = 0; k < num; k++)
1140 count += summon_named_creature(m_idx, y, x, MON_IE, 0);
1146 case MON_ZOMBI_SERPENT:
1147 if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
1151 msg_print(_("ÃÏÌ̤«¤é¿å¤¬¿á¤½Ð¤·¤¿¡ª", "Water blew off from the ground!"));
1153 project(t_idx, 8, y, x, 3, GF_WATER_FLOW, PROJECT_GRID | PROJECT_HIDE, -1);
1157 int num = 2 + randint1(3);
1158 for (k = 0; k < num; k++)
1160 count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
1167 int num = randint1(3);
1168 for (k = 0; k < num; k++)
1170 count += summon_named_creature(m_idx, y, x, MON_LOCKE_CLONE, 0);
1177 int num = 2 + randint1(3);
1178 for (k = 0; k < num; k++)
1180 count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, (PM_ALLOW_GROUP));
1186 summon_kin_type = r_ptr->d_char;
1188 for (k = 0; k < 4; k++)
1190 count += summon_specific(m_idx, y, x, rlev, SUMMON_KIN, (PM_ALLOW_GROUP));
1195 if (known && !see_t && count)
1210 msg_format(_("%^s¤¬¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´¤·¤¿¡ª", "%^s magically summons Cyberdemons!"), m_name);
1218 if (is_friendly(m_ptr))
1220 count += summon_specific(m_idx, y, x, rlev, SUMMON_CYBER, (PM_ALLOW_GROUP));
1224 count += summon_cyber(m_idx, y, x);
1227 if (known && !see_t && count)
1242 msg_format(_("%^s¤¬ËâË¡¤ÇÃç´Ö¤ò¾¤´¤·¤¿¡ª", "%^s magically summons help!"), m_name);
1250 count += summon_specific(m_idx, y, x, rlev, 0, (u_mode));
1252 if (known && !see_t && count)
1259 /* RF6_S_MONSTERS */
1267 msg_format(_("%^s¤¬ËâË¡¤Ç¥â¥ó¥¹¥¿¡¼¤ò¾¤´¤·¤¿¡ª", "%^s magically summons monsters!"), m_name);
1275 for (k = 0; k < s_num_6; k++)
1277 count += summon_specific(m_idx, y, x, rlev, 0, (PM_ALLOW_GROUP | u_mode));
1280 if (known && !see_t && count)
1295 msg_format(_("%^s¤¬ËâË¡¤Ç¥¢¥ê¤ò¾¤´¤·¤¿¡£", "%^s magically summons ants."), m_name);
1303 for (k = 0; k < s_num_6; k++)
1305 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANT, (PM_ALLOW_GROUP));
1308 if (known && !see_t && count)
1323 msg_format(_("%^s¤¬ËâË¡¤Ç¥¯¥â¤ò¾¤´¤·¤¿¡£", "%^s magically summons spiders."), m_name);
1331 for (k = 0; k < s_num_6; k++)
1333 count += summon_specific(m_idx, y, x, rlev, SUMMON_SPIDER, (PM_ALLOW_GROUP));
1336 if (known && !see_t && count)
1351 msg_format(_("%^s¤¬ËâË¡¤Ç¥Ï¥¦¥ó¥É¤ò¾¤´¤·¤¿¡£", "%^s magically summons hounds."), m_name);
1359 for (k = 0; k < s_num_4; k++)
1361 count += summon_specific(m_idx, y, x, rlev, SUMMON_HOUND, (PM_ALLOW_GROUP));
1364 if (known && !see_t && count)
1379 msg_format(_("%^s¤¬ËâË¡¤Ç¥Ò¥É¥é¤ò¾¤´¤·¤¿¡£", "%^s magically summons hydras."), m_name);
1387 for (k = 0; k < s_num_4; k++)
1389 count += summon_specific(m_idx, y, x, rlev, SUMMON_HYDRA, (PM_ALLOW_GROUP));
1392 if (known && !see_t && count)
1407 msg_format(_("%^s¤¬ËâË¡¤ÇÅ·»È¤ò¾¤´¤·¤¿¡ª", "%^s magically summons an angel!"), m_name);
1418 if ((r_ptr->flags1 & RF1_UNIQUE) && !easy_band)
1420 num += r_ptr->level/40;
1423 for (k = 0; k < num; k++)
1425 count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP));
1429 if (known && !see_t && count)
1444 msg_format(_("%^s¤¬ËâË¡¤Çº®Æ٤εÜÄ¤é¥Ç¡¼¥â¥ó¤ò¾¤´¤·¤¿¡ª",
1445 "%^s magically summons a demon from the Courts of Chaos!"), m_name);
1453 for (k = 0; k < 1; k++)
1455 count += summon_specific(m_idx, y, x, rlev, SUMMON_DEMON, (PM_ALLOW_GROUP));
1458 if (known && !see_t && count)
1473 msg_format(_("%s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤ò¾¤´¤·¤¿¡£", "%^s magically summons undead."), m_name);
1481 for (k = 0; k < 1; k++)
1483 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNDEAD, (PM_ALLOW_GROUP));
1486 if (known && !see_t && count)
1501 msg_format(_("%^s¤¬ËâË¡¤Ç¥É¥é¥´¥ó¤ò¾¤´¤·¤¿¡ª", "%^s magically summons a dragon!"), m_name);
1509 for (k = 0; k < 1; k++)
1511 count += summon_specific(m_idx, y, x, rlev, SUMMON_DRAGON, (PM_ALLOW_GROUP));
1514 if (known && !see_t && count)
1521 /* RF6_S_HI_UNDEAD */
1529 msg_format(_("%s¤¬ËâË¡¤Ç¥¢¥ó¥Ç¥Ã¥É¤ò¾¤´¤·¤¿¡£", "%^s magically summons undead."), m_name);
1537 for (k = 0; k < s_num_6; k++)
1539 count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | u_mode));
1542 if (known && !see_t && count)
1549 /* RF6_S_HI_DRAGON */
1557 msg_format(_("%^s¤¬ËâË¡¤Ç¸ÅÂå¥É¥é¥´¥ó¤ò¾¤´¤·¤¿¡ª", "%^s magically summons ancient dragons!"), m_name);
1565 for (k = 0; k < s_num_4; k++)
1567 count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_DRAGON, (PM_ALLOW_GROUP | u_mode));
1570 if (known && !see_t && count)
1577 /* RF6_S_AMBERITES */
1585 msg_format(_("%^s¤¬¥¢¥ó¥Ð¡¼¤Î²¦Â²¤ò¾¤´¤·¤¿¡ª", "%^s magically summons Lords of Amber!"), m_name);
1593 for (k = 0; k < s_num_4; k++)
1595 count += summon_specific(m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
1598 if (known && !see_t && count)
1613 msg_format(_("%^s¤¬ËâË¡¤ÇÆÃÊ̤ʶ¯Å¨¤ò¾¤´¤·¤¿¡ª", "%^s magically summons special opponents!"), m_name);
1621 for (k = 0; k < s_num_4; k++)
1623 count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
1627 int non_unique_type = SUMMON_HI_UNDEAD;
1629 if ((m_ptr->sub_align & (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL)) == (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL))
1630 non_unique_type = 0;
1631 else if (m_ptr->sub_align & SUB_ALIGN_GOOD)
1632 non_unique_type = SUMMON_ANGEL;
1634 for (k = count; k < s_num_4; k++)
1636 count += summon_specific(m_idx, y, x, rlev, non_unique_type, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
1640 if (known && !see_t && count)
1648 if (wake_up) (void)set_monster_csleep(t_idx, 0);
1652 msg_format(_("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", "%^s flees in terror!"), t_name);
1655 if (m_ptr->ml && maneable && !world_monster && !p_ptr->blind && (p_ptr->pclass == CLASS_IMITATOR))
1657 if (thrown_spell != 167) /* Not RF6_SPECIAL */
1659 if (p_ptr->mane_num == MAX_MANE)
1662 for (i = 0; i < p_ptr->mane_num - 1; i++)
1664 p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
1665 p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
1668 p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
1669 p_ptr->mane_dam[p_ptr->mane_num] = dam;
1673 p_ptr->redraw |= (PR_IMITATION);
1677 /* Remember what the monster did, if we saw it */
1681 if (thrown_spell < 32*4)
1683 r_ptr->r_flags4 |= (1L << (thrown_spell - 32*3));
1684 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
1688 else if (thrown_spell < 32*5)
1690 r_ptr->r_flags5 |= (1L << (thrown_spell - 32*4));
1691 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
1695 else if (thrown_spell < 32*6)
1697 r_ptr->r_flags6 |= (1L << (thrown_spell - 32*5));
1698 if (r_ptr->r_cast_spell < MAX_UCHAR) r_ptr->r_cast_spell++;
1702 /* Always take note of monsters that kill you */
1703 if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
1705 r_ptr->r_deaths++; /* Ignore appearance difference */
1708 /* A spell was cast */