3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
18 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
19 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
21 int project_length = 0; /*!< 投射の射程距離 */
25 * @brief モンスター魅了用セービングスロー共通部(汎用系)
27 * @param m_ptr 対象モンスター
28 * @return 魅了に抵抗したらTRUE
30 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
32 monster_race *r_ptr = &r_info[m_ptr->r_idx];
34 if(p_ptr->inside_arena) return TRUE;
37 if (r_ptr->flagsr & RFR_RES_ALL)
39 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
43 if (r_ptr->flags3 & RF3_NO_CONF)
45 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
49 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
51 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
52 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
53 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
57 * @brief モンスター服従用セービングスロー共通部(部族依存系)
59 * @param m_ptr 対象モンスター
60 * @return 服従に抵抗したらTRUE
62 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
64 monster_race *r_ptr = &r_info[m_ptr->r_idx];
66 if (p_ptr->inside_arena) return TRUE;
69 if (r_ptr->flagsr & RFR_RES_ALL)
71 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
75 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
77 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
78 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
79 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
83 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
86 * ハードコーティングによる実装が行われている。
87 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
91 if (p_ptr->pclass == CLASS_MAGE)
93 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
94 return p_ptr->lev + 10;
96 return p_ptr->lev / 2;
101 * @brief 配置した鏡リストの次を取得する /
102 * Get another mirror. for SEEKER
103 * @param next_y 次の鏡のy座標を返す参照ポインタ
104 * @param next_x 次の鏡のx座標を返す参照ポインタ
105 * @param cury 現在の鏡のy座標
106 * @param curx 現在の鏡のx座標
108 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
110 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
111 int mirror_num = 0; /* 鏡の数 */
115 for (x = 0; x < cur_wid; x++)
117 for (y = 0; y < cur_hgt; y++)
119 if (is_mirror_grid(&cave[y][x])) {
120 mirror_y[mirror_num] = y;
121 mirror_x[mirror_num] = x;
128 num = randint0(mirror_num);
129 *next_y = mirror_y[num];
130 *next_x = mirror_x[num];
133 *next_y = cury + randint0(5) - 2;
134 *next_x = curx + randint0(5) - 2;
139 * @brief 万色表現用にランダムな色を選択する関数 /
140 * Get a legal "multi-hued" color for drawing "spells"
144 static byte mh_attr(int max)
146 switch (randint1(max))
148 case 1: return (TERM_RED);
149 case 2: return (TERM_GREEN);
150 case 3: return (TERM_BLUE);
151 case 4: return (TERM_YELLOW);
152 case 5: return (TERM_ORANGE);
153 case 6: return (TERM_VIOLET);
154 case 7: return (TERM_L_RED);
155 case 8: return (TERM_L_GREEN);
156 case 9: return (TERM_L_BLUE);
157 case 10: return (TERM_UMBER);
158 case 11: return (TERM_L_UMBER);
159 case 12: return (TERM_SLATE);
160 case 13: return (TERM_WHITE);
161 case 14: return (TERM_L_WHITE);
162 case 15: return (TERM_L_DARK);
170 * @brief 魔法属性に応じたエフェクトの色を返す /
171 * Return a color to use for the bolt/ball spells
175 static byte spell_color(int type)
177 /* Check if A.B.'s new graphics should be used (rr9) */
178 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
183 case GF_PSY_SPEAR: return (0x06);
184 case GF_MISSILE: return (0x0F);
185 case GF_ACID: return (0x04);
186 case GF_ELEC: return (0x02);
187 case GF_FIRE: return (0x00);
188 case GF_COLD: return (0x01);
189 case GF_POIS: return (0x03);
190 case GF_HOLY_FIRE: return (0x00);
191 case GF_HELL_FIRE: return (0x00);
192 case GF_MANA: return (0x0E);
194 case GF_SEEKER: return (0x0E);
195 case GF_SUPER_RAY: return (0x0E);
197 case GF_ARROW: return (0x0F);
198 case GF_WATER: return (0x04);
199 case GF_NETHER: return (0x07);
200 case GF_CHAOS: return (mh_attr(15));
201 case GF_DISENCHANT: return (0x05);
202 case GF_NEXUS: return (0x0C);
203 case GF_CONFUSION: return (mh_attr(4));
204 case GF_SOUND: return (0x09);
205 case GF_SHARDS: return (0x08);
206 case GF_FORCE: return (0x09);
207 case GF_INERTIAL: return (0x09);
208 case GF_GRAVITY: return (0x09);
209 case GF_TIME: return (0x09);
210 case GF_LITE_WEAK: return (0x06);
211 case GF_LITE: return (0x06);
212 case GF_DARK_WEAK: return (0x07);
213 case GF_DARK: return (0x07);
214 case GF_PLASMA: return (0x0B);
215 case GF_METEOR: return (0x00);
216 case GF_ICE: return (0x01);
217 case GF_ROCKET: return (0x0F);
218 case GF_DEATH_RAY: return (0x07);
219 case GF_NUKE: return (mh_attr(2));
220 case GF_DISINTEGRATE: return (0x05);
232 case GF_CAUSE_4: return (0x0E);
233 case GF_HAND_DOOM: return (0x07);
234 case GF_CAPTURE : return (0x0E);
235 case GF_IDENTIFY: return (0x01);
236 case GF_ATTACK: return (0x0F);
237 case GF_PHOTO : return (0x06);
240 /* Normal tiles or ASCII */
246 /* Lookup the default colors for this type */
247 cptr s = quark_str(gf_color[type]);
250 if (!s) return (TERM_WHITE);
252 /* Pick a random color */
253 c = s[randint0(strlen(s))];
255 /* Lookup this color */
256 a = my_strchr(color_char, c) - color_char;
258 /* Invalid color (note check for < 0 removed, gave a silly
259 * warning because bytes are always >= 0 -- RG) */
260 if (a > 15) return (TERM_WHITE);
266 /* Standard "color" */
272 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
273 * Find the attr/char pair to use for a spell effect
282 * It is moving (or has moved) from (x,y) to (nx,ny).
283 * If the distance is not "one", we (may) return "*".
286 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
296 if ((ny == y) && (nx == x)) base = 0x30;
299 else if (nx == x) base = 0x40;
302 else if (ny == y) base = 0x50;
305 else if ((ny - y) == (x - nx)) base = 0x60;
308 else if ((ny - y) == (nx - x)) base = 0x70;
313 /* Basic spell color */
314 k = spell_color(typ);
316 /* Obtain attr/char */
317 a = misc_to_attr[base + k];
318 c = misc_to_char[base + k];
326 * @brief 始点から終点への経路を返す /
327 * Determine the path taken by a projection.
328 * @param gp 経路座標リストを返す参照ポインタ
338 * The projection will always start from the grid (y1,x1), and will travel
339 * towards the grid (y2,x2), touching one grid per unit of distance along
340 * the major axis, and stopping when it enters the destination grid or a
341 * wall grid, or has travelled the maximum legal distance of "range".
343 * Note that "distance" in this function (as in the "update_view()" code)
344 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
345 * actually has an "octagon of projection" not a "circle of projection".
347 * The path grids are saved into the grid array pointed to by "gp", and
348 * there should be room for at least "range" grids in "gp". Note that
349 * due to the way in which distance is calculated, this function normally
350 * uses fewer than "range" grids for the projection path, so the result
351 * of this function should never be compared directly to "range". Note
352 * that the initial grid (y1,x1) is never saved into the grid array, not
353 * even if the initial grid is also the final grid. XXX XXX XXX
355 * The "flg" flags can be used to modify the behavior of this function.
357 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
358 * semantics as they do for the "project" function, namely, that the path
359 * will stop as soon as it hits a monster, or that the path will continue
360 * through the destination grid, respectively.
362 * The "PROJECT_JUMP" flag, which for the "project()" function means to
363 * start at a special grid (which makes no sense in this function), means
364 * that the path should be "angled" slightly if needed to avoid any wall
365 * grids, allowing the player to "target" any grid which is in "view".
366 * This flag is non-trivial and has not yet been implemented, but could
367 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
369 * This function returns the number of grids (if any) in the path. This
370 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
372 * This algorithm is similar to, but slightly different from, the one used
373 * by "update_view_los()", and very different from the one used by "los()".
376 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
398 /* No path necessary (or allowed) */
399 if ((x1 == x2) && (y1 == y2)) return (0);
427 /* Number of "units" in one "half" grid */
430 /* Number of "units" in one "full" grid */
436 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
447 /* Advance (X) part 2 */
450 /* Advance (X) part 3 */
457 /* Create the projection path */
461 gp[n++] = GRID(y, x);
463 /* Hack -- Check maximum range */
464 if ((n + (k >> 1)) >= range) break;
466 /* Sometimes stop at destination grid */
467 if (!(flg & (PROJECT_THRU)))
469 if ((x == x2) && (y == y2)) break;
472 if (flg & (PROJECT_DISI))
474 if ((n > 0) && cave_stop_disintegration(y, x)) break;
476 else if (flg & (PROJECT_LOS))
478 if ((n > 0) && !cave_los_bold(y, x)) break;
480 else if (!(flg & (PROJECT_PATH)))
482 /* Always stop at non-initial wall grids */
483 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
486 /* Sometimes stop at non-initial monsters/players */
487 if (flg & (PROJECT_STOP))
490 (player_bold(y, x) || cave[y][x].m_idx != 0))
494 if (!in_bounds(y, x)) break;
499 /* Advance (X) part 1 */
502 /* Horizontal change */
505 /* Advance (X) part 2 */
508 /* Advance (X) part 3 */
524 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
533 /* Vertical change */
536 /* Advance (Y) part 2 */
539 /* Advance (Y) part 3 */
546 /* Create the projection path */
550 gp[n++] = GRID(y, x);
552 /* Hack -- Check maximum range */
553 if ((n + (k >> 1)) >= range) break;
555 /* Sometimes stop at destination grid */
556 if (!(flg & (PROJECT_THRU)))
558 if ((x == x2) && (y == y2)) break;
561 if (flg & (PROJECT_DISI))
563 if ((n > 0) && cave_stop_disintegration(y, x)) break;
565 else if (flg & (PROJECT_LOS))
567 if ((n > 0) && !cave_los_bold(y, x)) break;
569 else if (!(flg & (PROJECT_PATH)))
571 /* Always stop at non-initial wall grids */
572 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
575 /* Sometimes stop at non-initial monsters/players */
576 if (flg & (PROJECT_STOP))
579 (player_bold(y, x) || cave[y][x].m_idx != 0))
583 if (!in_bounds(y, x)) break;
588 /* Advance (Y) part 1 */
591 /* Vertical change */
594 /* Advance (Y) part 2 */
597 /* Advance (Y) part 3 */
617 /* Create the projection path */
621 gp[n++] = GRID(y, x);
623 /* Hack -- Check maximum range */
624 if ((n + (n >> 1)) >= range) break;
626 /* Sometimes stop at destination grid */
627 if (!(flg & (PROJECT_THRU)))
629 if ((x == x2) && (y == y2)) break;
632 if (flg & (PROJECT_DISI))
634 if ((n > 0) && cave_stop_disintegration(y, x)) break;
636 else if (flg & (PROJECT_LOS))
638 if ((n > 0) && !cave_los_bold(y, x)) break;
640 else if (!(flg & (PROJECT_PATH)))
642 /* Always stop at non-initial wall grids */
643 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
646 /* Sometimes stop at non-initial monsters/players */
647 if (flg & (PROJECT_STOP))
650 (player_bold(y, x) || cave[y][x].m_idx != 0))
654 if (!in_bounds(y, x)) break;
671 * Mega-Hack -- track "affected" monsters (see "project()" comments)
673 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
674 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
675 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
676 /* Mega-Hack -- monsters target */
677 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
678 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
682 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
683 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
684 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
685 * @param y 目標Y座標 / Target y location (or location to travel "towards")
686 * @param x 目標X座標 / Target x location (or location to travel "towards")
687 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
688 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
689 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
692 * We are called both for "beam" effects and "ball" effects.
694 * The "r" parameter is the "distance from ground zero".
696 * Note that we determine if the player can "see" anything that happens
697 * by taking into account: blindness, line-of-sight, and illumination.
699 * We return "TRUE" if the effect of the projection is "obvious".
701 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
703 * XXX XXX XXX Perhaps we should affect doors?
706 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
708 cave_type *c_ptr = &cave[y][x];
709 feature_type *f_ptr = &f_info[c_ptr->feat];
711 bool obvious = FALSE;
712 bool known = player_has_los_bold(y, x);
718 /* Reduce damage by distance */
719 dam = (dam + r) / (r + 1);
722 if (have_flag(f_ptr->flags, FF_TREE))
730 message = _("枯れた", "was blasted."); break;
732 message = _("縮んだ", "shrank."); break;
734 message = _("溶けた", "melted."); break;
737 message = _("凍り、砕け散った", "was frozen and smashed."); break;
741 message = _("燃えた", "burns up!"); break;
753 message = _("粉砕された", "was crushed."); break;
755 message = NULL;break;
759 msg_format(_("木は%s。", "A tree %s"), message);
760 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
763 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
767 /* Analyze the type */
770 /* Ignore most effects */
805 /* Destroy Traps (and Locks) */
808 /* Reveal secret doors */
809 if (is_hidden_door(c_ptr))
814 /* Check line of sight */
822 if (is_trap(c_ptr->feat))
824 /* Check line of sight */
827 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
831 /* Destroy the trap */
832 cave_alter_feat(y, x, FF_DISARM);
835 /* Locked doors are unlocked */
836 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
838 s16b old_feat = c_ptr->feat;
840 /* Unlock the door */
841 cave_alter_feat(y, x, FF_DISARM);
843 /* Check line of sound */
844 if (known && (old_feat != c_ptr->feat))
846 msg_print(_("カチッと音がした!", "Click!"));
851 /* Remove "unsafe" flag if player is not blind */
852 if (!p_ptr->blind && player_has_los_bold(y, x))
854 c_ptr->info &= ~(CAVE_UNSAFE);
865 /* Destroy Doors (and traps) */
868 /* Destroy all doors and traps */
869 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
871 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
897 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
899 if (have_flag(f_ptr->flags, FF_SPIKE))
901 s16b old_mimic = c_ptr->mimic;
902 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
904 cave_alter_feat(y, x, FF_SPIKE);
906 c_ptr->mimic = old_mimic;
914 /* Check line of sight */
915 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
918 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
925 /* Destroy walls (and doors) */
928 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
931 if (known && (c_ptr->info & (CAVE_MARK)))
933 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
937 /* Destroy the wall */
938 cave_alter_feat(y, x, FF_HURT_ROCK);
940 /* Update some things */
941 p_ptr->update |= (PU_FLOW);
950 /* Require a "naked" floor grid */
951 if (!cave_naked_bold(y, x)) break;
953 /* Not on the player */
954 if (player_bold(y, x)) break;
956 /* Create a closed door */
957 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
960 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
977 /* Require a "naked" floor grid */
978 if (!cave_naked_bold(y, x)) break;
980 /* Not on the player */
981 if (player_bold(y, x)) break;
983 /* Create a closed door */
984 cave_set_feat(y, x, feat_tree);
987 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
995 /* Require a "naked" floor grid */
996 if (!cave_naked_bold(y, x)) break;
999 c_ptr->info |= CAVE_OBJECT;
1000 c_ptr->mimic = feat_glyph;
1013 /* Require a "naked" floor grid */
1014 if (!cave_naked_bold(y, x)) break;
1016 /* Not on the player */
1017 if (player_bold(y, x)) break;
1020 cave_set_feat(y, x, feat_granite);
1028 /* Ignore permanent grid */
1029 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1034 /* Ignore grid without enough space */
1035 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1037 /* Place a shallow lava */
1038 cave_set_feat(y, x, feat_shallow_lava);
1043 /* Place a deep lava */
1044 cave_set_feat(y, x, feat_deep_lava);
1051 /* Ignore permanent grid */
1052 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1057 /* Ignore grid without enough space */
1058 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1060 /* Place a shallow water */
1061 cave_set_feat(y, x, feat_shallow_water);
1066 /* Place a deep water */
1067 cave_set_feat(y, x, feat_deep_water);
1072 /* Lite up the grid */
1076 /* Turn on the light */
1077 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1079 c_ptr->info |= (CAVE_GLOW);
1087 update_local_illumination(y, x);
1090 if (player_can_see_bold(y, x)) obvious = TRUE;
1092 /* Mega-Hack -- Update the monster in the affected grid */
1093 /* This allows "spear of light" (etc) to work "correctly" */
1094 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1096 if (p_ptr->special_defense & NINJA_S_STEALTH)
1098 if (player_bold(y, x)) set_superstealth(FALSE);
1105 /* Darken the grid */
1109 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1112 /* Turn off the light. */
1115 if (dun_level || !is_daytime())
1117 for (j = 0; j < 9; j++)
1119 int by = y + ddy_ddd[j];
1120 int bx = x + ddx_ddd[j];
1122 if (in_bounds2(by, bx))
1124 cave_type *cc_ptr = &cave[by][bx];
1126 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1134 if (!do_dark) break;
1137 c_ptr->info &= ~(CAVE_GLOW);
1139 /* Hack -- Forget "boring" grids */
1140 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1143 c_ptr->info &= ~(CAVE_MARK);
1152 update_local_illumination(y, x);
1155 if (player_can_see_bold(y, x)) obvious = TRUE;
1157 /* Mega-Hack -- Update the monster in the affected grid */
1158 /* This allows "spear of light" (etc) to work "correctly" */
1159 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1169 if (is_mirror_grid(c_ptr))
1171 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1173 remove_mirror(y, x);
1174 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1177 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1180 if (known && (c_ptr->info & CAVE_MARK))
1182 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1186 /* Destroy the wall */
1187 cave_alter_feat(y, x, FF_HURT_ROCK);
1189 /* Update some things */
1190 p_ptr->update |= (PU_FLOW);
1197 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1199 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1201 remove_mirror(y, x);
1202 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1205 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1208 if (known && (c_ptr->info & CAVE_MARK))
1210 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1214 /* Destroy the wall */
1215 cave_alter_feat(y, x, FF_HURT_ROCK);
1217 /* Update some things */
1218 p_ptr->update |= (PU_FLOW);
1223 case GF_DISINTEGRATE:
1225 /* Destroy mirror/glyph */
1226 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1227 remove_mirror(y, x);
1229 /* Permanent features don't get effect */
1230 /* But not protect monsters and other objects */
1231 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1233 cave_alter_feat(y, x, FF_HURT_DISI);
1235 /* Update some things -- similar to GF_KILL_WALL */
1236 p_ptr->update |= (PU_FLOW);
1243 /* Return "Anything seen?" */
1250 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1251 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1252 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1253 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1254 * @param x 目標X座標 / Target x location (or location to travel "towards")
1255 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1256 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1257 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1260 * We are called from "project()" to "damage" objects
1262 * We are called both for "beam" effects and "ball" effects.
1264 * Perhaps we should only SOMETIMES damage things on the ground.
1266 * The "r" parameter is the "distance from ground zero".
1268 * Note that we determine if the player can "see" anything that happens
1269 * by taking into account: blindness, line-of-sight, and illumination.
1271 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1273 * We return "TRUE" if the effect of the projection is "obvious".
1276 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1278 cave_type *c_ptr = &cave[y][x];
1280 OBJECT_IDX this_o_idx, next_o_idx = 0;
1282 bool obvious = FALSE;
1283 bool known = player_has_los_bold(y, x);
1285 BIT_FLAGS flgs[TR_FLAG_SIZE];
1287 char o_name[MAX_NLEN];
1289 KIND_OBJECT_IDX k_idx = 0;
1290 bool is_potion = FALSE;
1294 who = who ? who : 0;
1296 /* Reduce damage by distance */
1297 dam = (dam + r) / (r + 1);
1300 /* Scan all objects in the grid */
1301 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1303 /* Acquire object */
1304 object_type *o_ptr = &o_list[this_o_idx];
1306 bool is_art = FALSE;
1307 bool ignore = FALSE;
1308 bool do_kill = FALSE;
1310 cptr note_kill = NULL;
1313 /* Get the "plural"-ness */
1314 bool plural = (o_ptr->number > 1);
1317 /* Acquire next object */
1318 next_o_idx = o_ptr->next_o_idx;
1320 /* Extract the flags */
1321 object_flags(o_ptr, flgs);
1323 /* Check for artifact */
1324 if (object_is_artifact(o_ptr)) is_art = TRUE;
1326 /* Analyze the type */
1329 /* Acid -- Lots of things */
1332 if (hates_acid(o_ptr))
1335 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1336 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1341 /* Elec -- Rings and Wands */
1344 if (hates_elec(o_ptr))
1347 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1348 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1353 /* Fire -- Flammable objects */
1356 if (hates_fire(o_ptr))
1359 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1360 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1365 /* Cold -- potions and flasks */
1368 if (hates_cold(o_ptr))
1370 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1372 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1380 if (hates_fire(o_ptr))
1383 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1384 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1386 if (hates_elec(o_ptr))
1390 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1391 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1399 if (hates_fire(o_ptr))
1402 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1403 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1405 if (hates_cold(o_ptr))
1409 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1410 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1415 /* Hack -- break potions and such */
1421 if (hates_cold(o_ptr))
1423 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1429 /* Mana and Chaos -- destroy everything */
1435 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1439 case GF_DISINTEGRATE:
1442 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1449 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1450 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1451 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1455 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1459 if (object_is_cursed(o_ptr))
1462 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1469 identify_item(o_ptr);
1471 /* Auto-inscription */
1472 autopick_alter_item((-this_o_idx), FALSE);
1480 /* Chests are noticed only if trapped or locked */
1481 if (o_ptr->tval == TV_CHEST)
1483 /* Disarm/Unlock traps */
1484 if (o_ptr->pval > 0)
1486 /* Disarm or Unlock */
1487 o_ptr->pval = (0 - o_ptr->pval);
1490 object_known(o_ptr);
1493 if (known && (o_ptr->marked & OM_FOUND))
1495 msg_print(_("カチッと音がした!", "Click!"));
1505 if (o_ptr->tval == TV_CORPSE)
1508 BIT_FLAGS mode = 0L;
1510 if (!who || is_pet(&m_list[who]))
1511 mode |= PM_FORCE_PET;
1513 for (i = 0; i < o_ptr->number ; i++)
1515 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1516 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1520 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1524 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1526 note_kill = _("生き返った。", " revived.");
1528 else if (!note_kill)
1530 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1541 /* Attempt to destroy the object */
1544 /* Effect "observed" */
1545 if (known && (o_ptr->marked & OM_FOUND))
1548 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1551 /* Artifacts, and other objects, get to resist */
1552 if (is_art || ignore)
1554 /* Observe the resist */
1555 if (known && (o_ptr->marked & OM_FOUND))
1557 msg_format(_("%sは影響を受けない!",
1558 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1565 /* Describe if needed */
1566 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1568 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1571 k_idx = o_ptr->k_idx;
1572 is_potion = object_is_potion(o_ptr);
1575 /* Delete the object */
1576 delete_object_idx(this_o_idx);
1578 /* Potions produce effects when 'shattered' */
1581 (void)potion_smash_effect(who, y, x, k_idx);
1590 /* Return "Anything seen?" */
1596 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1597 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1598 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1599 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1600 * @param x 目標X座標 / Target x location (or location to travel "towards")
1601 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1602 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1604 * @param see_s_msg TRUEならばメッセージを表示する
1605 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1608 * This routine takes a "source monster" (by index) which is mostly used to
1609 * determine if the player is causing the damage, and a "radius" (see below),
1610 * which is used to decrease the power of explosions with distance, and a
1611 * location, via integers which are modified by certain types of attacks
1612 * (polymorph and teleport being the obvious ones), a default damage, which
1613 * is modified as needed based on various properties, and finally a "damage
1614 * type" (see below).
1617 * Note that this routine can handle "no damage" attacks (like teleport) by
1618 * taking a "zero" damage, and can even take "parameters" to attacks (like
1619 * confuse) by accepting a "damage", using it to calculate the effect, and
1620 * then setting the damage to zero. Note that the "damage" parameter is
1621 * divided by the radius, so monsters not at the "epicenter" will not take
1622 * as much damage (or whatever)...
1625 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1626 * may result in a dereference of an invalid pointer. XXX XXX XXX
1629 * Various messages are produced, and damage is applied.
1632 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1633 * actually be "made" of that substance, or "breathe" big balls of it.
1634 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1636 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1637 * and hurts evil less. If can breath nether, then it resists it as well.
1640 * Damage reductions use the following formulas:
1641 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1642 * gives avg damage of .655, ranging from .858 to .500
1643 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1644 * gives avg damage of .544, ranging from .714 to .417
1645 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1646 * gives avg damage of .444, ranging from .556 to .333
1647 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1648 * gives avg damage of .327, ranging from .427 to .250
1649 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1650 * gives something simple.
1653 * In this function, "result" messages are postponed until the end, where
1654 * the "note" string is appended to the monster name, if not NULL. So,
1655 * to make a spell have "no effect" just set "note" to NULL. You should
1656 * also set "notice" to FALSE, or the player will learn what the spell does.
1659 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1663 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, bool see_s_msg)
1667 cave_type *c_ptr = &cave[y][x];
1669 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1670 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1672 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1676 /* Is the monster "seen"? */
1677 bool seen = m_ptr->ml;
1678 bool seen_msg = is_seen(m_ptr);
1680 bool slept = (bool)MON_CSLEEP(m_ptr);
1682 /* Were the effects "obvious" (if seen)? */
1683 bool obvious = FALSE;
1685 /* Can the player know about this effect? */
1686 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1688 /* Were the effects "irrelevant"? */
1689 bool skipped = FALSE;
1691 /* Gets the monster angry at the source of the effect? */
1692 bool get_angry = FALSE;
1694 /* Polymorph setting (true or false) */
1695 bool do_poly = FALSE;
1697 /* Teleport setting (max distance) */
1700 /* Confusion setting (amount to confuse) */
1703 /* Stunning setting (amount to stun) */
1706 /* Sleep amount (amount to sleep) */
1709 /* Fear amount (amount to fear) */
1712 /* Time amount (amount to time) */
1715 bool heal_leper = FALSE;
1717 /* Hold the monster name */
1721 PARAMETER_VALUE photo = 0;
1723 /* Assume no note */
1726 /* Assume a default death */
1727 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1732 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1735 if (!c_ptr->m_idx) return (FALSE);
1737 /* Never affect projector */
1738 if (who && (c_ptr->m_idx == who)) return (FALSE);
1739 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1740 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1742 /* Don't affect already death monsters */
1743 /* Prevents problems with chain reactions of exploding monsters */
1744 if (m_ptr->hp < 0) return (FALSE);
1746 /* Reduce damage by distance */
1747 dam = (dam + r) / (r + 1);
1750 /* Get the monster name (BEFORE polymorphing) */
1751 monster_desc(m_name, m_ptr, 0);
1753 /* Get the monster possessive ("his"/"her"/"its") */
1754 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1756 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1758 /* Analyze the damage type */
1761 /* Magic Missile -- pure damage */
1764 if (seen) obvious = TRUE;
1766 if (r_ptr->flagsr & RFR_RES_ALL)
1768 note = _("には完全な耐性がある!", " is immune.");
1770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1779 if (seen) obvious = TRUE;
1781 if (r_ptr->flagsr & RFR_RES_ALL)
1783 note = _("には完全な耐性がある!", " is immune.");
1785 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1788 if (r_ptr->flagsr & RFR_IM_ACID)
1790 note = _("にはかなり耐性がある!", " resists a lot.");
1792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1800 if (seen) obvious = TRUE;
1802 if (r_ptr->flagsr & RFR_RES_ALL)
1804 note = _("には完全な耐性がある!", " is immune.");
1806 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1809 if (r_ptr->flagsr & RFR_IM_ELEC)
1811 note = _("にはかなり耐性がある!", " resists a lot.");
1813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1821 if (seen) obvious = TRUE;
1823 if (r_ptr->flagsr & RFR_RES_ALL)
1825 note = _("には完全な耐性がある!", " is immune.");
1827 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1830 if (r_ptr->flagsr & RFR_IM_FIRE)
1832 note = _("にはかなり耐性がある!", " resists a lot.");
1834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1836 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1838 note = _("はひどい痛手をうけた。", " is hit hard.");
1840 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1848 if (seen) obvious = TRUE;
1850 if (r_ptr->flagsr & RFR_RES_ALL)
1852 note = _("には完全な耐性がある!", " is immune.");
1854 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1857 if (r_ptr->flagsr & RFR_IM_COLD)
1859 note = _("にはかなり耐性がある!", " resists a lot.");
1861 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1863 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1865 note = _("はひどい痛手をうけた。", " is hit hard.");
1867 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1875 if (seen) obvious = TRUE;
1877 if (r_ptr->flagsr & RFR_RES_ALL)
1879 note = _("には完全な耐性がある!", " is immune.");
1881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1884 if (r_ptr->flagsr & RFR_IM_POIS)
1886 note = _("にはかなり耐性がある!", " resists a lot.");
1888 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1896 if (seen) obvious = TRUE;
1898 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = _("には完全な耐性がある!", " is immune.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1905 if (r_ptr->flagsr & RFR_IM_POIS)
1907 note = _("には耐性がある。", " resists.");
1908 dam *= 3; dam /= randint1(6) + 6;
1909 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1911 else if (one_in_(3)) do_poly = TRUE;
1915 /* Hellfire -- hurts Evil */
1918 if (seen) obvious = TRUE;
1920 if (r_ptr->flagsr & RFR_RES_ALL)
1922 note = _("には完全な耐性がある!", " is immune.");
1924 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1927 if (r_ptr->flags3 & RF3_GOOD)
1929 note = _("はひどい痛手をうけた。", " is hit hard.");
1931 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1936 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1939 if (seen) obvious = TRUE;
1941 if (r_ptr->flagsr & RFR_RES_ALL)
1943 note = _("には完全な耐性がある!", " is immune.");
1945 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1948 if (r_ptr->flags3 & RF3_GOOD)
1950 note = _("には完全な耐性がある!", " is immune.");
1952 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1954 else if (r_ptr->flags3 & RF3_EVIL)
1957 note = _("はひどい痛手をうけた。", " is hit hard.");
1958 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1962 note = _("には耐性がある。", " resists.");
1963 dam *= 3; dam /= randint1(6) + 6;
1968 /* Arrow -- XXX no defense */
1971 if (seen) obvious = TRUE;
1973 if (r_ptr->flagsr & RFR_RES_ALL)
1975 note = _("には完全な耐性がある!", " is immune.");
1977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1983 /* Plasma -- XXX perhaps check ELEC or FIRE */
1986 if (seen) obvious = TRUE;
1988 if (r_ptr->flagsr & RFR_RES_ALL)
1990 note = _("には完全な耐性がある!", " is immune.");
1992 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1995 if (r_ptr->flagsr & RFR_RES_PLAS)
1997 note = _("には耐性がある。", " resists.");
1998 dam *= 3; dam /= randint1(6) + 6;
1999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2004 /* Nether -- see above */
2007 if (seen) obvious = TRUE;
2009 if (r_ptr->flagsr & RFR_RES_ALL)
2011 note = _("には完全な耐性がある!", " is immune.");
2013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2016 if (r_ptr->flagsr & RFR_RES_NETH)
2018 if (r_ptr->flags3 & RF3_UNDEAD)
2020 note = _("には完全な耐性がある!", " is immune.");
2022 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2026 note = _("には耐性がある。", " resists.");
2027 dam *= 3; dam /= randint1(6) + 6;
2029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2031 else if (r_ptr->flags3 & RF3_EVIL)
2033 note = _("はいくらか耐性を示した。", " resists somewhat.");
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2040 /* Water (acid) damage -- Water spirits/elementals are immune */
2043 if (seen) obvious = TRUE;
2045 if (r_ptr->flagsr & RFR_RES_ALL)
2047 note = _("には完全な耐性がある!", " is immune.");
2049 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2052 if (r_ptr->flagsr & RFR_RES_WATE)
2054 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2056 note = _("には完全な耐性がある!", " is immune.");
2061 note = _("には耐性がある。", " resists.");
2062 dam *= 3; dam /= randint1(6) + 6;
2064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2069 /* Chaos -- Chaos breathers resist */
2072 if (seen) obvious = TRUE;
2074 if (r_ptr->flagsr & RFR_RES_ALL)
2076 note = _("には完全な耐性がある!", " is immune.");
2078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2081 if (r_ptr->flagsr & RFR_RES_CHAO)
2083 note = _("には耐性がある。", " resists.");
2084 dam *= 3; dam /= randint1(6) + 6;
2085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2087 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2089 note = _("はいくらか耐性を示した。", " resists somewhat.");
2090 dam *= 3; dam /= randint1(6) + 6;
2091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2096 do_conf = (5 + randint1(11) + r) / (r + 1);
2101 /* Shards -- Shard breathers resist */
2104 if (seen) obvious = TRUE;
2106 if (r_ptr->flagsr & RFR_RES_ALL)
2108 note = _("には完全な耐性がある!", " is immune.");
2110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2113 if (r_ptr->flagsr & RFR_RES_SHAR)
2115 note = _("には耐性がある。", " resists.");
2116 dam *= 3; dam /= randint1(6) + 6;
2117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2122 /* Rocket: Shard resistance helps */
2125 if (seen) obvious = TRUE;
2127 if (r_ptr->flagsr & RFR_RES_ALL)
2129 note = _("には完全な耐性がある!", " is immune.");
2131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2134 if (r_ptr->flagsr & RFR_RES_SHAR)
2136 note = _("はいくらか耐性を示した。", " resists somewhat.");
2138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2144 /* Sound -- Sound breathers resist */
2147 if (seen) obvious = TRUE;
2149 if (r_ptr->flagsr & RFR_RES_ALL)
2151 note = _("には完全な耐性がある!", " is immune.");
2153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2156 if (r_ptr->flagsr & RFR_RES_SOUN)
2158 note = _("には耐性がある。", " resists.");
2159 dam *= 2; dam /= randint1(6) + 6;
2160 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2162 else do_stun = (10 + randint1(15) + r) / (r + 1);
2169 if (seen) obvious = TRUE;
2171 if (r_ptr->flagsr & RFR_RES_ALL)
2173 note = _("には完全な耐性がある!", " is immune.");
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2178 if (r_ptr->flags3 & RF3_NO_CONF)
2180 note = _("には耐性がある。", " resists.");
2181 dam *= 3; dam /= randint1(6) + 6;
2182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2184 else do_conf = (10 + randint1(15) + r) / (r + 1);
2188 /* Disenchantment -- Breathers and Disenchanters resist */
2191 if (seen) obvious = TRUE;
2193 if (r_ptr->flagsr & RFR_RES_ALL)
2195 note = _("には完全な耐性がある!", " is immune.");
2197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2200 if (r_ptr->flagsr & RFR_RES_DISE)
2202 note = _("には耐性がある。", " resists.");
2203 dam *= 3; dam /= randint1(6) + 6;
2204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2209 /* Nexus -- Breathers and Existers resist */
2212 if (seen) obvious = TRUE;
2214 if (r_ptr->flagsr & RFR_RES_ALL)
2216 note = _("には完全な耐性がある!", " is immune.");
2218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2221 if (r_ptr->flagsr & RFR_RES_NEXU)
2223 note = _("には耐性がある。", " resists.");
2224 dam *= 3; dam /= randint1(6) + 6;
2225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2233 if (seen) obvious = TRUE;
2235 if (r_ptr->flagsr & RFR_RES_ALL)
2237 note = _("には完全な耐性がある!", " is immune.");
2239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2242 if (r_ptr->flagsr & RFR_RES_WALL)
2244 note = _("には耐性がある。", " resists.");
2245 dam *= 3; dam /= randint1(6) + 6;
2246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2248 else do_stun = (randint1(15) + r) / (r + 1);
2252 /* Inertia -- breathers resist */
2255 if (seen) obvious = TRUE;
2257 if (r_ptr->flagsr & RFR_RES_ALL)
2259 note = _("には完全な耐性がある!", " is immune.");
2261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2264 if (r_ptr->flagsr & RFR_RES_INER)
2266 note = _("には耐性がある。", " resists.");
2267 dam *= 3; dam /= randint1(6) + 6;
2268 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2272 /* Powerful monsters can resist */
2273 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2274 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2278 /* Normal monsters slow down */
2281 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2283 note = _("の動きが遅くなった。", " starts moving slower.");
2290 /* Time -- breathers resist */
2293 if (seen) obvious = TRUE;
2295 if (r_ptr->flagsr & RFR_RES_ALL)
2297 note = _("には完全な耐性がある!", " is immune.");
2299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2302 if (r_ptr->flagsr & RFR_RES_TIME)
2304 note = _("には耐性がある。", " resists.");
2305 dam *= 3; dam /= randint1(6) + 6;
2306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2308 else do_time = (dam + 1) / 2;
2312 /* Gravity -- breathers resist */
2315 bool resist_tele = FALSE;
2317 if (seen) obvious = TRUE;
2319 if (r_ptr->flagsr & RFR_RES_ALL)
2321 note = _("には完全な耐性がある!", " is immune.");
2323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2326 if (r_ptr->flagsr & RFR_RES_TELE)
2328 if (r_ptr->flags1 & (RF1_UNIQUE))
2330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2331 note = _("には効果がなかった。", " is unaffected!");
2334 else if (r_ptr->level > randint1(100))
2336 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2337 note = _("には耐性がある!", " resists!");
2342 if (!resist_tele) do_dist = 10;
2344 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2346 if (r_ptr->flagsr & RFR_RES_GRAV)
2348 note = _("には耐性がある!", " resists!");
2349 dam *= 3; dam /= randint1(6) + 6;
2351 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2356 /* Powerful monsters can resist */
2357 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2358 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2362 /* Normal monsters slow down */
2365 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2367 note = _("の動きが遅くなった。", " starts moving slower.");
2372 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2374 /* Attempt a saving throw */
2375 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2376 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2380 /* No obvious effect */
2381 note = _("には効果がなかった。", " is unaffected!");
2393 if (seen) obvious = TRUE;
2395 if (r_ptr->flagsr & RFR_RES_ALL)
2397 note = _("には完全な耐性がある!", " is immune.");
2399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2407 case GF_DISINTEGRATE:
2409 if (seen) obvious = TRUE;
2411 if (r_ptr->flagsr & RFR_RES_ALL)
2413 note = _("には完全な耐性がある!", " is immune.");
2415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2418 if (r_ptr->flags3 & RF3_HURT_ROCK)
2420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2421 note = _("の皮膚がただれた!", " loses some skin!");
2422 note_dies = _("は蒸発した!", " evaporates!");
2430 if (seen) obvious = TRUE;
2432 /* PSI only works if the monster can see you! -- RG */
2433 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2436 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2441 if (r_ptr->flagsr & RFR_RES_ALL)
2443 note = _("には完全な耐性がある!", " is immune.");
2445 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2448 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2451 note = _("には完全な耐性がある!", " is immune.");
2452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2455 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2456 (r_ptr->flags3 & RF3_ANIMAL) ||
2457 (r_ptr->level > randint1(3 * dam)))
2459 note = _("には耐性がある!", " resists!");
2463 * Powerful demons & undead can turn a mindcrafter's
2464 * attacks back on them
2466 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2467 (r_ptr->level > p_ptr->lev / 2) &&
2471 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2472 (seen ? "%^s's corrupted mind backlashes your attack!" :
2473 "%^ss corrupted mind backlashes your attack!")), m_name);
2476 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2478 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2482 /* Injure +/- confusion */
2483 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2484 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2485 if (one_in_(4) && !CHECK_MULTISHADOW())
2487 switch (randint1(4))
2490 set_confused(p_ptr->confused + 3 + randint1(dam));
2493 set_stun(p_ptr->stun + randint1(dam));
2497 if (r_ptr->flags3 & RF3_NO_FEAR)
2498 note = _("には効果がなかった。", " is unaffected.");
2500 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2504 if (!p_ptr->free_act)
2505 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2514 if ((dam > 0) && one_in_(4))
2516 switch (randint1(4))
2519 do_conf = 3 + randint1(dam);
2522 do_stun = 3 + randint1(dam);
2525 do_fear = 3 + randint1(dam);
2528 note = _("は眠り込んでしまった!", " falls asleep!");
2529 do_sleep = 3 + randint1(dam);
2534 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2540 if (seen) obvious = TRUE;
2542 if (r_ptr->flagsr & RFR_RES_ALL)
2544 note = _("には完全な耐性がある!", " is immune.");
2546 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2549 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2552 note = _("には完全な耐性がある!", " is immune.");
2554 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2555 (r_ptr->flags3 & RF3_ANIMAL) ||
2556 (r_ptr->level > randint1(3 * dam)))
2558 note = _("には耐性がある!", " resists!");
2562 * Powerful demons & undead can turn a mindcrafter's
2563 * attacks back on them
2565 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2566 (r_ptr->level > p_ptr->lev / 2) &&
2570 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2571 (seen ? "%^s's corrupted mind backlashes your attack!" :
2572 "%^ss corrupted mind backlashes your attack!")), m_name);
2574 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2576 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2580 /* Injure + mana drain */
2581 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2582 if (!CHECK_MULTISHADOW())
2584 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2585 p_ptr->csp -= damroll(5, dam) / 2;
2586 if (p_ptr->csp < 0) p_ptr->csp = 0;
2587 p_ptr->redraw |= PR_MANA;
2588 p_ptr->window |= (PW_SPELL);
2590 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2597 int b = damroll(5, dam) / 4;
2598 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2599 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2600 (seen ? "You convert %s's pain into %s!" :
2601 "You convert %ss pain into %s!"));
2602 msg_format(msg, m_name, str);
2604 b = MIN(p_ptr->msp, p_ptr->csp + b);
2606 p_ptr->redraw |= PR_MANA;
2607 p_ptr->window |= (PW_SPELL);
2609 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2613 case GF_TELEKINESIS:
2615 if (seen) obvious = TRUE;
2617 if (r_ptr->flagsr & RFR_RES_ALL)
2619 note = _("には完全な耐性がある!", " is immune.");
2621 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2626 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2631 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2633 /* Attempt a saving throw */
2634 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2635 (r_ptr->level > 5 + randint1(dam)))
2639 /* No obvious effect */
2645 /* Psycho-spear -- powerful magic missile */
2648 if (seen) obvious = TRUE;
2650 if (r_ptr->flagsr & RFR_RES_ALL)
2652 note = _("には完全な耐性がある!", " is immune.");
2654 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2660 /* Meteor -- powerful magic missile */
2663 if (seen) obvious = TRUE;
2665 if (r_ptr->flagsr & RFR_RES_ALL)
2667 note = _("には完全な耐性がある!", " is immune.");
2669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2677 if (!is_hostile(m_ptr)) break;
2679 if (seen) obvious = TRUE;
2681 if (r_ptr->flagsr & RFR_RES_ALL)
2683 note = _("には効果がなかった!", " is immune.");
2685 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2688 /* Attempt a saving throw */
2689 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2690 (r_ptr->flags3 & RF3_NO_CONF) ||
2691 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2693 /* Memorize a flag */
2694 if (r_ptr->flags3 & RF3_NO_CONF)
2696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2703 * Powerful demons & undead can turn a mindcrafter's
2704 * attacks back on them
2706 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2707 (r_ptr->level > p_ptr->lev / 2) &&
2711 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2712 (seen ? "%^s's corrupted mind backlashes your attack!" :
2713 "%^ss corrupted mind backlashes your attack!")), m_name);
2716 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2718 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2722 /* Confuse, stun, terrify */
2723 switch (randint1(4))
2726 set_stun(p_ptr->stun + dam / 2);
2729 set_confused(p_ptr->confused + dam / 2);
2733 if (r_ptr->flags3 & RF3_NO_FEAR)
2734 note = _("には効果がなかった。", " is unaffected.");
2736 set_afraid(p_ptr->afraid + dam);
2743 /* No obvious effect */
2744 note = _("には効果がなかった。", " is unaffected.");
2750 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2752 note = _("があなたに隷属した。", " is in your thrall!");
2757 switch (randint1(4))
2771 /* No "real" damage */
2778 /* Ice -- Cold + Cuts + Stun */
2781 if (seen) obvious = TRUE;
2783 if (r_ptr->flagsr & RFR_RES_ALL)
2785 note = _("には完全な耐性がある!", " is immune.");
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2790 do_stun = (randint1(15) + 1) / (r + 1);
2791 if (r_ptr->flagsr & RFR_IM_COLD)
2793 note = _("にはかなり耐性がある!", " resists a lot.");
2795 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2797 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2799 note = _("はひどい痛手をうけた。", " is hit hard.");
2801 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2808 case GF_HYPODYNAMIA:
2810 if (seen) obvious = TRUE;
2812 if (r_ptr->flagsr & RFR_RES_ALL)
2814 note = _("には完全な耐性がある!", " is immune.");
2816 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2819 if (!monster_living(r_ptr))
2821 if (is_original_ap_and_seen(m_ptr))
2823 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2824 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2825 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2827 note = _("には効果がなかった。", " is unaffected.");
2831 else do_time = (dam+7)/8;
2839 if (seen) obvious = TRUE;
2841 if (r_ptr->flagsr & RFR_RES_ALL)
2843 note = _("には完全な耐性がある!", " is immune.");
2845 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2848 if (!monster_living(r_ptr))
2850 if (is_original_ap_and_seen(m_ptr))
2852 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2853 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2854 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2856 note = _("には完全な耐性がある!", " is immune.");
2860 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2861 (randint1(888) != 666)) ||
2862 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2863 randint1(100) != 66))
2865 note = _("には耐性がある!", " resists!");
2873 /* Polymorph monster (Use "dam" as "power") */
2876 if (seen) obvious = TRUE;
2878 if (r_ptr->flagsr & RFR_RES_ALL)
2880 note = _("には効果がなかった。", " is unaffected.");
2882 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2885 /* Attempt to polymorph (see below) */
2888 /* Powerful monsters can resist */
2889 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2890 (r_ptr->flags1 & RF1_QUESTOR) ||
2891 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2893 note = _("には効果がなかった。", " is unaffected.");
2898 /* No "real" damage */
2905 /* Clone monsters (Ignore "dam") */
2908 if (seen) obvious = TRUE;
2910 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2912 note = _("には効果がなかった。", " is unaffected.");
2917 m_ptr->hp = m_ptr->maxhp;
2919 /* Attempt to clone. */
2920 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2922 note = _("が分裂した!", " spawns!");
2926 /* No "real" damage */
2933 /* Heal Monster (use "dam" as amount of healing) */
2936 if (seen) obvious = TRUE;
2939 (void)set_monster_csleep(c_ptr->m_idx, 0);
2941 if (m_ptr->maxhp < m_ptr->max_maxhp)
2943 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2944 m_ptr->maxhp = m_ptr->max_maxhp;
2949 /* Redraw (later) if needed */
2950 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2951 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2959 if (seen) obvious = TRUE;
2962 (void)set_monster_csleep(c_ptr->m_idx, 0);
2963 if (MON_STUNNED(m_ptr))
2965 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2966 (void)set_monster_stunned(c_ptr->m_idx, 0);
2968 if (MON_CONFUSED(m_ptr))
2970 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2971 (void)set_monster_confused(c_ptr->m_idx, 0);
2973 if (MON_MONFEAR(m_ptr))
2975 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2976 (void)set_monster_monfear(c_ptr->m_idx, 0);
2980 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2983 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2987 chg_virtue(V_VITALITY, 1);
2989 if (r_ptr->flags1 & RF1_UNIQUE)
2990 chg_virtue(V_INDIVIDUALISM, 1);
2992 if (is_friendly(m_ptr))
2993 chg_virtue(V_HONOUR, 1);
2994 else if (!(r_ptr->flags3 & RF3_EVIL))
2996 if (r_ptr->flags3 & RF3_GOOD)
2997 chg_virtue(V_COMPASSION, 2);
2999 chg_virtue(V_COMPASSION, 1);
3002 if (r_ptr->flags3 & RF3_ANIMAL)
3003 chg_virtue(V_NATURE, 1);
3006 if (m_ptr->r_idx == MON_LEPER)
3009 if (!who) chg_virtue(V_COMPASSION, 5);
3012 /* Redraw (later) if needed */
3013 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3014 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3017 note = _("は体力を回復したようだ。", " looks healthier.");
3019 /* No "real" damage */
3025 /* Speed Monster (Ignore "dam") */
3028 if (seen) obvious = TRUE;
3031 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3033 note = _("の動きが速くなった。", " starts moving faster.");
3038 if (r_ptr->flags1 & RF1_UNIQUE)
3039 chg_virtue(V_INDIVIDUALISM, 1);
3040 if (is_friendly(m_ptr))
3041 chg_virtue(V_HONOUR, 1);
3044 /* No "real" damage */
3050 /* Slow Monster (Use "dam" as "power") */
3053 if (seen) obvious = TRUE;
3055 if (r_ptr->flagsr & RFR_RES_ALL)
3057 note = _("には効果がなかった。", " is unaffected.");
3059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3062 /* Powerful monsters can resist */
3063 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3064 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3066 note = _("には効果がなかった。", " is unaffected.");
3070 /* Normal monsters slow down */
3073 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3075 note = _("の動きが遅くなった。", " starts moving slower.");
3079 /* No "real" damage */
3085 /* Sleep (Use "dam" as "power") */
3088 if (seen) obvious = TRUE;
3090 if (r_ptr->flagsr & RFR_RES_ALL)
3092 note = _("には効果がなかった。", " is unaffected.");
3094 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3097 /* Attempt a saving throw */
3098 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3099 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3100 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3102 /* Memorize a flag */
3103 if (r_ptr->flags3 & RF3_NO_SLEEP)
3105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3107 /* No obvious effect */
3108 note = _("には効果がなかった。", " is unaffected.");
3113 /* Go to sleep (much) later */
3114 note = _("は眠り込んでしまった!", " falls asleep!");
3118 /* No "real" damage */
3124 /* Sleep (Use "dam" as "power") */
3125 case GF_STASIS_EVIL:
3127 if (seen) obvious = TRUE;
3129 if (r_ptr->flagsr & RFR_RES_ALL)
3131 note = _("には効果がなかった!", " is immune.");
3133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3136 /* Attempt a saving throw */
3137 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3138 !(r_ptr->flags3 & RF3_EVIL) ||
3139 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3141 note = _("には効果がなかった。", " is unaffected.");
3146 /* Go to sleep (much) later */
3147 note = _("は動けなくなった!", " is suspended!");
3151 /* No "real" damage */
3156 /* Sleep (Use "dam" as "power") */
3159 if (seen) obvious = TRUE;
3161 if (r_ptr->flagsr & RFR_RES_ALL)
3163 note = _("には効果がなかった。", " is unaffected.");
3165 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3168 /* Attempt a saving throw */
3169 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3170 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3172 note = _("には効果がなかった。", " is unaffected.");
3177 /* Go to sleep (much) later */
3178 note = _("は動けなくなった!", " is suspended!");
3182 /* No "real" damage */
3191 vir = virtue_number(V_HARMONY);
3194 dam += p_ptr->virtues[vir-1]/10;
3197 vir = virtue_number(V_INDIVIDUALISM);
3200 dam -= p_ptr->virtues[vir-1]/20;
3203 if (seen) obvious = TRUE;
3205 /* Attempt a saving throw */
3206 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3210 /* No obvious effect */
3211 note = _("には効果がなかった。", " is unaffected.");
3214 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3216 else if (p_ptr->cursed & TRC_AGGRAVATE)
3218 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3219 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3223 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3226 chg_virtue(V_INDIVIDUALISM, -1);
3227 if (r_ptr->flags3 & RF3_ANIMAL)
3228 chg_virtue(V_NATURE, 1);
3231 /* No "real" damage */
3236 /* Control undead */
3237 case GF_CONTROL_UNDEAD:
3240 if (seen) obvious = TRUE;
3242 vir = virtue_number(V_UNLIFE);
3245 dam += p_ptr->virtues[vir-1]/10;
3248 vir = virtue_number(V_INDIVIDUALISM);
3251 dam -= p_ptr->virtues[vir-1]/20;
3254 /* Attempt a saving throw */
3255 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3256 !(r_ptr->flags3 & RF3_UNDEAD))
3258 /* No obvious effect */
3259 note = _("には効果がなかった。", " is unaffected.");
3261 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3263 else if (p_ptr->cursed & TRC_AGGRAVATE)
3265 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3266 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3270 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3274 /* No "real" damage */
3280 case GF_CONTROL_DEMON:
3283 if (seen) obvious = TRUE;
3285 vir = virtue_number(V_UNLIFE);
3288 dam += p_ptr->virtues[vir-1]/10;
3291 vir = virtue_number(V_INDIVIDUALISM);
3294 dam -= p_ptr->virtues[vir-1]/20;
3297 /* Attempt a saving throw */
3298 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3299 !(r_ptr->flags3 & RF3_DEMON))
3301 /* No obvious effect */
3302 note = _("には効果がなかった。", " is unaffected.");
3304 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3306 else if (p_ptr->cursed & TRC_AGGRAVATE)
3308 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3309 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3313 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3317 /* No "real" damage */
3323 case GF_CONTROL_ANIMAL:
3326 if (seen) obvious = TRUE;
3328 vir = virtue_number(V_NATURE);
3331 dam += p_ptr->virtues[vir-1]/10;
3334 vir = virtue_number(V_INDIVIDUALISM);
3337 dam -= p_ptr->virtues[vir-1]/20;
3340 /* Attempt a saving throw */
3341 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3342 !(r_ptr->flags3 & RF3_ANIMAL))
3345 /* No obvious effect */
3346 note = _("には効果がなかった。", " is unaffected.");
3348 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3350 else if (p_ptr->cursed & TRC_AGGRAVATE)
3352 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3353 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3357 note = _("はなついた。", " is tamed!");
3359 if (r_ptr->flags3 & RF3_ANIMAL)
3360 chg_virtue(V_NATURE, 1);
3363 /* No "real" damage */
3369 case GF_CHARM_LIVING:
3373 vir = virtue_number(V_UNLIFE);
3374 if (seen) obvious = TRUE;
3376 vir = virtue_number(V_UNLIFE);
3379 dam -= p_ptr->virtues[vir-1]/10;
3382 vir = virtue_number(V_INDIVIDUALISM);
3385 dam -= p_ptr->virtues[vir-1]/20;
3388 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3390 /* Attempt a saving throw */
3391 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3392 !monster_living(r_ptr))
3395 /* No obvious effect */
3396 note = _("には効果がなかった。", " is unaffected.");
3398 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3400 else if (p_ptr->cursed & TRC_AGGRAVATE)
3402 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3403 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3407 note = _("を支配した。", " is tamed!");
3409 if (r_ptr->flags3 & RF3_ANIMAL)
3410 chg_virtue(V_NATURE, 1);
3413 /* No "real" damage */
3418 /* Confusion (Use "dam" as "power") */
3421 if (seen) obvious = TRUE;
3423 if (r_ptr->flagsr & RFR_RES_ALL)
3425 note = _("には効果がなかった。", " is unaffected.");
3427 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3430 /* Get confused later */
3431 do_conf = damroll(3, (dam / 2)) + 1;
3433 /* Attempt a saving throw */
3434 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3435 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3436 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3438 /* Memorize a flag */
3439 if (r_ptr->flags3 & (RF3_NO_CONF))
3441 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3447 /* No obvious effect */
3448 note = _("には効果がなかった。", " is unaffected.");
3452 /* No "real" damage */
3459 if (seen) obvious = TRUE;
3461 if (r_ptr->flagsr & RFR_RES_ALL)
3463 note = _("には効果がなかった。", " is unaffected.");
3465 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3468 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3470 /* Attempt a saving throw */
3471 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3472 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3477 /* No obvious effect */
3478 note = _("には効果がなかった。", " is unaffected.");
3482 /* No "real" damage */
3490 /* Lite, but only hurts susceptible creatures */
3498 if (r_ptr->flagsr & RFR_RES_ALL)
3504 if (r_ptr->flags3 & (RF3_HURT_LITE))
3506 /* Obvious effect */
3507 if (seen) obvious = TRUE;
3509 /* Memorize the effects */
3510 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3512 /* Special effect */
3513 note = _("は光に身をすくめた!", " cringes from the light!");
3514 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3517 /* Normally no damage */
3529 /* Lite -- opposite of Dark */
3532 if (seen) obvious = TRUE;
3534 if (r_ptr->flagsr & RFR_RES_ALL)
3536 note = _("には完全な耐性がある!", " is immune.");
3538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3541 if (r_ptr->flagsr & RFR_RES_LITE)
3543 note = _("には耐性がある!", " resists!");
3544 dam *= 2; dam /= (randint1(6)+6);
3545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3547 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3549 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3550 note = _("は光に身をすくめた!", " cringes from the light!");
3551 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3558 /* Dark -- opposite of Lite */
3561 if (seen) obvious = TRUE;
3563 if (r_ptr->flagsr & RFR_RES_ALL)
3565 note = _("には完全な耐性がある!", " is immune.");
3567 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3570 if (r_ptr->flagsr & RFR_RES_DARK)
3572 note = _("には耐性がある!", " resists!");
3573 dam *= 2; dam /= (randint1(6)+6);
3574 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3583 if (r_ptr->flagsr & RFR_RES_ALL)
3588 /* Hurt by rock remover */
3589 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3592 if (seen) obvious = TRUE;
3594 /* Memorize the effects */
3595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3597 /* Cute little message */
3598 note = _("の皮膚がただれた!", " loses some skin!");
3599 note_dies = _("はドロドロに溶けた!", " dissolves!");
3602 /* Usually, ignore the effects */
3613 /* Teleport undead (Use "dam" as "power") */
3614 case GF_AWAY_UNDEAD:
3616 /* Only affect undead */
3617 if (r_ptr->flags3 & (RF3_UNDEAD))
3619 bool resists_tele = FALSE;
3621 if (r_ptr->flagsr & RFR_RES_TELE)
3623 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3626 note = _("には効果がなかった。", " is unaffected.");
3627 resists_tele = TRUE;
3629 else if (r_ptr->level > randint1(100))
3631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3632 note = _("には耐性がある!", " resists!");
3633 resists_tele = TRUE;
3639 if (seen) obvious = TRUE;
3640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3652 /* No "real" damage */
3658 /* Teleport evil (Use "dam" as "power") */
3661 /* Only affect evil */
3662 if (r_ptr->flags3 & (RF3_EVIL))
3664 bool resists_tele = FALSE;
3666 if (r_ptr->flagsr & RFR_RES_TELE)
3668 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3671 note = _("には効果がなかった。", " is unaffected.");
3672 resists_tele = TRUE;
3674 else if (r_ptr->level > randint1(100))
3676 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3677 note = _("には耐性がある!", " resists!");
3678 resists_tele = TRUE;
3684 if (seen) obvious = TRUE;
3685 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3697 /* No "real" damage */
3703 /* Teleport monster (Use "dam" as "power") */
3706 bool resists_tele = FALSE;
3707 if (r_ptr->flagsr & RFR_RES_TELE)
3709 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3711 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3712 note = _("には効果がなかった。", " is unaffected.");
3713 resists_tele = TRUE;
3715 else if (r_ptr->level > randint1(100))
3717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3718 note = _("には耐性がある!", " resists!");
3719 resists_tele = TRUE;
3726 if (seen) obvious = TRUE;
3728 /* Prepare to teleport */
3732 /* No "real" damage */
3738 /* Turn undead (Use "dam" as "power") */
3739 case GF_TURN_UNDEAD:
3741 if (r_ptr->flagsr & RFR_RES_ALL)
3746 /* Only affect undead */
3747 if (r_ptr->flags3 & (RF3_UNDEAD))
3750 if (seen) obvious = TRUE;
3752 /* Learn about type */
3753 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3755 /* Apply some fear */
3756 do_fear = damroll(3, (dam / 2)) + 1;
3758 /* Attempt a saving throw */
3759 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3761 /* No obvious effect */
3762 note = _("には効果がなかった。", " is unaffected.");
3775 /* No "real" damage */
3781 /* Turn evil (Use "dam" as "power") */
3784 if (r_ptr->flagsr & RFR_RES_ALL)
3789 /* Only affect evil */
3790 if (r_ptr->flags3 & (RF3_EVIL))
3793 if (seen) obvious = TRUE;
3795 /* Learn about type */
3796 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3798 /* Apply some fear */
3799 do_fear = damroll(3, (dam / 2)) + 1;
3801 /* Attempt a saving throw */
3802 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3804 /* No obvious effect */
3805 note = _("には効果がなかった。", " is unaffected.");
3818 /* No "real" damage */
3824 /* Turn monster (Use "dam" as "power") */
3827 if (r_ptr->flagsr & RFR_RES_ALL)
3833 if (seen) obvious = TRUE;
3835 /* Apply some fear */
3836 do_fear = damroll(3, (dam / 2)) + 1;
3838 /* Attempt a saving throw */
3839 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3840 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3841 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3843 /* No obvious effect */
3844 note = _("には効果がなかった。", " is unaffected.");
3849 /* No "real" damage */
3856 case GF_DISP_UNDEAD:
3858 if (r_ptr->flagsr & RFR_RES_ALL)
3864 /* Only affect undead */
3865 if (r_ptr->flags3 & (RF3_UNDEAD))
3868 if (seen) obvious = TRUE;
3870 /* Learn about type */
3871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3874 note = _("は身震いした。", " shudders.");
3875 note_dies = _("はドロドロに溶けた!", " dissolves!");
3895 if (r_ptr->flagsr & RFR_RES_ALL)
3901 /* Only affect evil */
3902 if (r_ptr->flags3 & (RF3_EVIL))
3905 if (seen) obvious = TRUE;
3907 /* Learn about type */
3908 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3911 note = _("は身震いした。", " shudders.");
3912 note_dies = _("はドロドロに溶けた!", " dissolves!");
3931 if (r_ptr->flagsr & RFR_RES_ALL)
3937 /* Only affect good */
3938 if (r_ptr->flags3 & (RF3_GOOD))
3941 if (seen) obvious = TRUE;
3943 /* Learn about type */
3944 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3947 note = _("は身震いした。", " shudders.");
3948 note_dies = _("はドロドロに溶けた!", " dissolves!");
3965 case GF_DISP_LIVING:
3967 if (r_ptr->flagsr & RFR_RES_ALL)
3973 /* Only affect non-undead */
3974 if (monster_living(r_ptr))
3977 if (seen) obvious = TRUE;
3980 note = _("は身震いした。", " shudders.");
3981 note_dies = _("はドロドロに溶けた!", " dissolves!");
4000 if (r_ptr->flagsr & RFR_RES_ALL)
4006 /* Only affect demons */
4007 if (r_ptr->flags3 & (RF3_DEMON))
4010 if (seen) obvious = TRUE;
4012 /* Learn about type */
4013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4016 note = _("は身震いした。", " shudders.");
4017 note_dies = _("はドロドロに溶けた!", " dissolves!");
4033 /* Dispel monster */
4036 if (r_ptr->flagsr & RFR_RES_ALL)
4043 if (seen) obvious = TRUE;
4046 note = _("は身震いした。", " shudders.");
4047 note_dies = _("はドロドロに溶けた!", " dissolves!");
4054 if (seen) obvious = TRUE;
4056 if (r_ptr->flagsr & RFR_RES_ALL)
4058 note = _("には完全な耐性がある!", " is immune.");
4060 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4064 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4068 /* Heal the monster */
4069 if (caster_ptr->hp < caster_ptr->maxhp)
4072 caster_ptr->hp += dam;
4073 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4075 /* Redraw (later) if needed */
4076 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4077 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4079 /* Special message */
4082 /* Get the monster name */
4083 monster_desc(killer, caster_ptr, 0);
4084 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4091 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4092 (void)hp_player(dam);
4097 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4106 if (seen) obvious = TRUE;
4108 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4110 if (r_ptr->flagsr & RFR_RES_ALL)
4112 note = _("には完全な耐性がある!", " is immune.");
4114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4118 /* Attempt a saving throw */
4119 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4120 (r_ptr->flags3 & RF3_NO_CONF) ||
4121 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4123 /* Memorize a flag */
4124 if (r_ptr->flags3 & (RF3_NO_CONF))
4126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4128 note = _("には効果がなかった。", " is unaffected.");
4131 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4134 note = _("には完全な耐性がある!", " is immune.");
4137 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4140 note = _("には耐性がある。", " resists.");
4145 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4146 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4148 if (who > 0) do_conf = randint0(4) + 4;
4149 else do_conf = randint0(8) + 8;
4155 case GF_BRAIN_SMASH:
4157 if (seen) obvious = TRUE;
4159 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4161 if (r_ptr->flagsr & RFR_RES_ALL)
4163 note = _("には完全な耐性がある!", " is immune.");
4165 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4169 /* Attempt a saving throw */
4170 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4171 (r_ptr->flags3 & RF3_NO_CONF) ||
4172 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4174 /* Memorize a flag */
4175 if (r_ptr->flags3 & (RF3_NO_CONF))
4177 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4179 note = _("には効果がなかった。", " is unaffected.");
4182 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4184 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4185 note = _("には完全な耐性がある!", " is immune.");
4188 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4191 note = _("には耐性がある!", " resists!");
4196 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4197 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4201 do_conf = randint0(4) + 4;
4202 do_stun = randint0(4) + 4;
4206 do_conf = randint0(8) + 8;
4207 do_stun = randint0(8) + 8;
4209 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4217 if (seen) obvious = TRUE;
4219 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4221 if (r_ptr->flagsr & RFR_RES_ALL)
4223 note = _("には完全な耐性がある!", " is immune.");
4225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4229 /* Attempt a saving throw */
4230 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4232 note = _("には効果がなかった。", " is unaffected.");
4241 if (seen) obvious = TRUE;
4243 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4245 if (r_ptr->flagsr & RFR_RES_ALL)
4247 note = _("には完全な耐性がある!", " is immune.");
4249 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4253 /* Attempt a saving throw */
4254 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4256 note = _("には効果がなかった。", " is unaffected.");
4265 if (seen) obvious = TRUE;
4267 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4269 if (r_ptr->flagsr & RFR_RES_ALL)
4271 note = _("には完全な耐性がある!", " is immune.");
4273 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4277 /* Attempt a saving throw */
4278 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4280 note = _("には効果がなかった。", " is unaffected.");
4289 if (seen) obvious = TRUE;
4292 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4293 "You point at %s, screaming the word, 'DIE!'."), m_name);
4295 if (r_ptr->flagsr & RFR_RES_ALL)
4297 note = _("には完全な耐性がある!", " is immune.");
4299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4303 /* Attempt a saving throw */
4304 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4306 note = _("には効果がなかった。", " is unaffected.");
4315 if (seen) obvious = TRUE;
4317 if (r_ptr->flagsr & RFR_RES_ALL)
4319 note = _("には完全な耐性がある!", " is immune.");
4321 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4325 if (r_ptr->flags1 & RF1_UNIQUE)
4327 note = _("には効果がなかった。", " is unaffected.");
4332 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4333 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4335 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4337 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4341 note = _("は耐性を持っている!", "resists!");
4348 /* Capture monster */
4352 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4353 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
4355 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4360 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4361 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4362 nokori_hp = m_ptr->maxhp * 3 / 10;
4364 nokori_hp = m_ptr->maxhp * 3 / 20;
4366 if (m_ptr->hp >= nokori_hp)
4368 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4371 else if (m_ptr->hp < randint0(nokori_hp))
4373 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4374 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4375 cap_mon = m_ptr->r_idx;
4376 cap_mspeed = m_ptr->mspeed;
4378 cap_maxhp = m_ptr->max_maxhp;
4379 cap_nickname = m_ptr->nickname; /* Quark transfer */
4380 if (c_ptr->m_idx == p_ptr->riding)
4382 if (rakuba(-1, FALSE))
4384 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4388 delete_monster_idx(c_ptr->m_idx);
4394 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4400 /* Attack (Use "dam" as attack type) */
4403 /* Return this monster's death */
4404 return py_attack(y, x, dam);
4407 /* Sleep (Use "dam" as "power") */
4413 if (seen) obvious = TRUE;
4415 if (r_ptr->flagsr & RFR_RES_ALL)
4417 note = _("には効果がなかった。", " is unaffected.");
4419 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4422 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4424 note = _("には効果がなかった。", " is unaffected.");
4427 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4430 if (MON_CSLEEP(m_ptr))
4432 note = _("には効果がなかった。", " is unaffected.");
4438 if (one_in_(5)) effect = 1;
4439 else if (one_in_(4)) effect = 2;
4440 else if (one_in_(3)) effect = 3;
4445 /* Powerful monsters can resist */
4446 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4447 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4449 note = _("には効果がなかった。", " is unaffected.");
4453 /* Normal monsters slow down */
4456 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4458 note = _("の動きが遅くなった。", " starts moving slower.");
4463 else if (effect == 2)
4465 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4467 /* Attempt a saving throw */
4468 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4469 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4474 /* No obvious effect */
4475 note = _("には効果がなかった。", " is unaffected.");
4480 else if (effect == 3)
4482 /* Attempt a saving throw */
4483 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4484 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4485 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4487 /* Memorize a flag */
4488 if (r_ptr->flags3 & RF3_NO_SLEEP)
4490 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4493 /* No obvious effect */
4494 note = _("には効果がなかった。", " is unaffected.");
4499 /* Go to sleep (much) later */
4500 note = _("は眠り込んでしまった!", " falls asleep!");
4507 note = _("には効果がなかった。", " is unaffected.");
4510 /* No "real" damage */
4518 if (seen) obvious = TRUE;
4520 if (r_ptr->flagsr & RFR_RES_ALL)
4522 note = _("には効果がなかった。", " is unaffected.");
4524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4528 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4530 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4531 chg_virtue(V_VITALITY, -1);
4541 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4543 if (r_ptr->flags3 & (RF3_HURT_LITE))
4545 /* Obvious effect */
4546 if (seen) obvious = TRUE;
4548 /* Memorize the effects */
4549 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4551 /* Special effect */
4552 note = _("は光に身をすくめた!", " cringes from the light!");
4553 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4556 /* Normally no damage */
4563 photo = m_ptr->r_idx;
4570 case GF_BLOOD_CURSE:
4572 if (seen) obvious = TRUE;
4574 if (r_ptr->flagsr & RFR_RES_ALL)
4576 note = _("には完全な耐性がある!", " is immune.");
4578 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4586 bool success = FALSE;
4587 if (seen) obvious = TRUE;
4589 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4591 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4592 if (dam < 1) dam = 1;
4594 /* No need to tame your pet */
4597 note = _("の動きが速くなった。", " starts moving faster.");
4598 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4602 /* Attempt a saving throw */
4603 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4604 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4605 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4606 (p_ptr->cursed & TRC_AGGRAVATE) ||
4607 ((r_ptr->level+10) > randint1(dam)))
4610 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4614 note = _("を支配した。", " is tamed!");
4616 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4618 /* Learn about type */
4619 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4626 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4628 do_fear = randint1(90)+10;
4630 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4633 /* No "real" damage */
4640 if (seen) obvious = TRUE;
4642 if (r_ptr->flagsr & RFR_RES_ALL)
4644 note = _("には完全な耐性がある!", " is immune.");
4646 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4650 /* Attempt a saving throw */
4651 if (randint0(100 + dam) < (r_ptr->level + 50))
4653 note = _("には効果がなかった。", " is unaffected.");
4673 /* Absolutely no effect */
4674 if (skipped) return (FALSE);
4676 /* "Unique" monsters cannot be polymorphed */
4677 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4679 /* Quest monsters cannot be polymorphed */
4680 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4682 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4684 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4685 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4687 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4692 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4693 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4696 /* Modify the damage */
4698 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4699 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4701 /* Check for death */
4702 if (dam > m_ptr->hp)
4704 /* Extract method of death */
4709 /* Sound and Impact resisters never stun */
4711 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4712 !(r_ptr->flags3 & RF3_NO_STUN))
4715 if (seen) obvious = TRUE;
4718 if (MON_STUNNED(m_ptr))
4720 note = _("はひどくもうろうとした。", " is more dazed.");
4721 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4725 note = _("はもうろうとした。", " is dazed.");
4730 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4736 /* Confusion and Chaos resisters (and sleepers) never confuse */
4738 !(r_ptr->flags3 & RF3_NO_CONF) &&
4739 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4742 if (seen) obvious = TRUE;
4744 /* Already partially confused */
4745 if (MON_CONFUSED(m_ptr))
4747 note = _("はさらに混乱したようだ。", " looks more confused.");
4748 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4751 /* Was not confused */
4754 note = _("は混乱したようだ。", " looks confused.");
4758 /* Apply confusion */
4759 (void)set_monster_confused(c_ptr->m_idx, tmp);
4768 if (seen) obvious = TRUE;
4770 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4774 note = _("は弱くなったようだ。", " seems weakened.");
4775 m_ptr->maxhp -= do_time;
4776 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4781 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4782 if (do_poly && (randint1(90) > r_ptr->level))
4784 if (polymorph_monster(y, x))
4787 if (seen) obvious = TRUE;
4789 /* Monster polymorphs */
4790 note = _("が変身した!", " changes!");
4792 /* Turn off the damage */
4798 note = _("には効果がなかった。", " is unaffected.");
4801 /* Hack -- Get new monster */
4802 m_ptr = &m_list[c_ptr->m_idx];
4804 /* Hack -- Get new race */
4805 r_ptr = &r_info[m_ptr->r_idx];
4808 /* Handle "teleport" */
4812 if (seen) obvious = TRUE;
4815 note = _("が消え去った!", " disappears!");
4817 if (!who) chg_virtue(V_VALOUR, -1);
4820 teleport_away(c_ptr->m_idx, do_dist,
4821 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4823 /* Hack -- get new location */
4827 /* Hack -- get new grid */
4828 c_ptr = &cave[y][x];
4835 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4842 if (typ == GF_DRAIN_MANA)
4844 /* Drain mana does nothing */
4847 /* If another monster did the damage, hurt the monster by hand */
4850 /* Redraw (later) if needed */
4851 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4852 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4854 /* Wake the monster up */
4855 (void)set_monster_csleep(c_ptr->m_idx, 0);
4857 /* Hurt the monster */
4865 if (is_pet(m_ptr) && !(m_ptr->ml))
4868 /* Give detailed messages if destroyed */
4871 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4874 msg_format("%^s%s", m_name, note);
4882 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4884 /* Generate treasure, etc */
4885 monster_death(c_ptr->m_idx, FALSE);
4887 /* Delete the monster */
4888 delete_monster_idx(c_ptr->m_idx);
4892 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4896 /* Damaged monster */
4899 /* Give detailed messages if visible or destroyed */
4900 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4902 /* Hack -- Pain message */
4905 message_pain(c_ptr->m_idx, dam);
4912 /* Hack -- handle sleep */
4913 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4917 else if (heal_leper)
4919 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4921 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4925 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4926 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4929 delete_monster_idx(c_ptr->m_idx);
4932 /* If the player did it, give him experience, check fear */
4937 /* Hurt the monster, check for fear and death */
4938 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4943 /* Damaged monster */
4946 /* HACK - anger the monster before showing the sleep message */
4947 if (do_sleep) anger_monster(m_ptr);
4949 /* Give detailed messages if visible or destroyed */
4950 if (note && seen_msg)
4951 msg_format(_("%s%s", "%^s%s"), m_name, note);
4953 /* Hack -- Pain message */
4954 else if (known && (dam || !do_fear))
4956 message_pain(c_ptr->m_idx, dam);
4959 /* Anger monsters */
4960 if (((dam > 0) || get_angry) && !do_sleep)
4961 anger_monster(m_ptr);
4964 if ((fear || do_fear) && seen)
4970 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4973 /* Hack -- handle sleep */
4974 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4978 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4980 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4984 switch (randint1(28))
4989 msg_print(_("地面が揺れた...", "The ground trembles..."));
4990 earthquake(ty, tx, 4 + randint0(4));
4991 if (!one_in_(6)) break;
4993 case 3: case 4: case 5: case 6:
4996 int extra_dam = damroll(10, 10);
4997 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4999 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
5000 if (!one_in_(6)) break;
5005 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5007 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5008 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5009 if (!one_in_(6)) break;
5011 case 9: case 10: case 11:
5012 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5013 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5014 if (!one_in_(6)) break;
5015 case 12: case 13: case 14: case 15: case 16:
5016 aggravate_monsters(0);
5017 if (!one_in_(6)) break;
5019 count += activate_hi_summon(ty, tx, TRUE);
5020 if (!one_in_(6)) break;
5021 case 19: case 20: case 21: case 22:
5023 bool pet = !one_in_(3);
5024 BIT_FLAGS mode = PM_ALLOW_GROUP;
5026 if (pet) mode |= PM_FORCE_PET;
5027 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5029 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
5030 if (!one_in_(6)) break;
5032 case 23: case 24: case 25:
5033 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5034 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5036 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5037 else lose_exp(p_ptr->exp / 16);
5038 if (!one_in_(6)) break;
5039 case 26: case 27: case 28:
5048 (void)do_dec_stat(i);
5057 (void)do_dec_stat(randint0(6));
5066 if (p_ptr->inside_battle)
5068 p_ptr->health_who = c_ptr->m_idx;
5069 p_ptr->redraw |= (PR_HEALTH);
5073 /* XXX XXX XXX Verify this code */
5075 /* Update the monster */
5076 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5078 /* Redraw the monster grid */
5082 /* Update monster recall window */
5083 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5086 p_ptr->window |= (PW_MONSTER);
5089 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5093 if (!(flg & PROJECT_NO_HANGEKI))
5095 set_target(m_ptr, monster_target_y, monster_target_x);
5098 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5100 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5104 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5106 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5107 rakubadam_m = (dam > 200) ? 200 : dam;
5116 /* Get local object */
5119 /* Prepare to make a Blade of Chaos */
5120 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5122 q_ptr->pval = photo;
5124 /* Mark the item as fully known */
5125 q_ptr->ident |= (IDENT_MENTAL);
5127 /* Drop it in the dungeon */
5128 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5136 /* Return "Anything seen?" */
5141 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5142 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5143 * @param who_name 効果を起こしたモンスターの名前
5144 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5145 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5146 * @param x 目標X座標 / Target x location (or location to travel "towards")
5147 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5148 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5150 * @param monspell 効果元のモンスター魔法ID
5151 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5153 * Handle a beam/bolt/ball causing damage to the player.
5154 * This routine takes a "source monster" (by index), a "distance", a default
5155 * "damage", and a "damage type". See "project_m()" above.
5156 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5157 * is reduced (see "project_m()" above). This can happen if a monster breathes
5158 * at the player and hits a wall instead.
5159 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5160 * to know if this is actually a ball or a bolt spell
5161 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5162 * we just assume that the effects were obvious, for historical reasons.
5164 static bool project_p(int who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
5169 /* Hack -- assume obvious */
5170 bool obvious = TRUE;
5172 /* Player blind-ness */
5173 bool blind = (p_ptr->blind ? TRUE : FALSE);
5175 /* Player needs a "description" (he is blind) */
5178 /* Source monster */
5179 monster_type *m_ptr = NULL;
5181 /* Monster name (for attacks) */
5184 /* Monster name (for damage) */
5187 /* Hack -- messages */
5193 /* Player is not here */
5194 if (!player_bold(y, x)) return (FALSE);
5196 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5198 if (kawarimi(TRUE)) return FALSE;
5201 /* Player cannot hurt himself */
5202 if (!who) return (FALSE);
5203 if (who == p_ptr->riding) return (FALSE);
5205 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5208 int max_attempts = 10;
5209 sound(SOUND_REFLECT);
5212 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5213 else if (p_ptr->special_defense & KATA_FUUJIN)
5214 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5216 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5219 /* Choose 'new' target */
5224 t_y = m_list[who].fy - 1 + randint1(3);
5225 t_x = m_list[who].fx - 1 + randint1(3);
5228 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5230 if (max_attempts < 1)
5232 t_y = m_list[who].fy;
5233 t_x = m_list[who].fx;
5238 t_y = p_ptr->y - 1 + randint1(3);
5239 t_x = p_ptr->x - 1 + randint1(3);
5242 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5249 /* Limit maximum damage */
5250 if (dam > 1600) dam = 1600;
5252 /* Reduce damage by distance */
5253 dam = (dam + r) / (r + 1);
5256 /* If the player is blind, be more descriptive */
5257 if (blind) fuzzy = TRUE;
5262 /* Get the source monster */
5263 m_ptr = &m_list[who];
5264 /* Extract the monster level */
5265 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5267 /* Get the monster name */
5268 monster_desc(m_name, m_ptr, 0);
5270 /* Get the monster's real name (gotten before polymorph!) */
5271 strcpy(killer, who_name);
5277 case PROJECT_WHO_UNCTRL_POWER:
5278 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5281 case PROJECT_WHO_GLASS_SHARDS:
5282 strcpy(killer, _("ガラスの破片", "shards of glass"));
5286 strcpy(killer, _("罠", "a trap"));
5291 strcpy(m_name, killer);
5294 /* Analyze the damage */
5297 /* Standard damage -- hurts inventory too */
5300 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5301 get_damage = acid_dam(dam, killer, monspell, FALSE);
5305 /* Standard damage -- hurts inventory too */
5308 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5309 get_damage = fire_dam(dam, killer, monspell, FALSE);
5313 /* Standard damage -- hurts inventory too */
5316 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5317 get_damage = cold_dam(dam, killer, monspell, FALSE);
5321 /* Standard damage -- hurts inventory too */
5324 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5325 get_damage = elec_dam(dam, killer, monspell, FALSE);
5329 /* Standard damage -- also poisons player */
5332 bool double_resist = IS_OPPOSE_POIS();
5333 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5335 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5336 if (double_resist) dam = (dam + 2) / 3;
5338 if ((!(double_resist || p_ptr->resist_pois)) &&
5339 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5344 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5346 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5348 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5353 /* Standard damage -- also poisons / mutates player */
5356 bool double_resist = IS_OPPOSE_POIS();
5357 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5359 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5360 if (double_resist) dam = (2 * dam + 2) / 5;
5361 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5362 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5364 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5366 if (one_in_(5)) /* 6 */
5368 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5369 if (one_in_(4)) /* 4 */
5377 inven_damage(set_acid_destroy, 2);
5383 /* Standard damage */
5386 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5387 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5391 /* Holy Orb -- Player only takes partial damage */
5394 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5395 if (p_ptr->align > 10)
5397 else if (p_ptr->align < -10)
5399 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5405 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5406 if (p_ptr->align > 10)
5408 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5412 /* Arrow -- XXX no dodging */
5417 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5419 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5421 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5424 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5428 /* Plasma -- XXX No resist */
5431 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5432 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5434 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5436 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5437 (void)set_stun(p_ptr->stun + plus_stun);
5440 if (!(p_ptr->resist_fire ||
5442 p_ptr->immune_fire))
5444 inven_damage(set_acid_destroy, 3);
5450 /* Nether -- drain experience */
5453 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5454 if (p_ptr->resist_neth)
5456 if (!prace_is_(RACE_SPECTRE))
5458 dam *= 6; dam /= (randint1(4) + 7);
5461 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5463 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5465 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5467 learn_spell(monspell);
5471 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5477 /* Water -- stun/confuse */
5480 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5481 if (!CHECK_MULTISHADOW())
5483 if (!p_ptr->resist_sound)
5485 set_stun(p_ptr->stun + randint1(40));
5487 if (!p_ptr->resist_conf)
5489 set_confused(p_ptr->confused + randint1(5) + 5);
5494 inven_damage(set_cold_destroy, 3);
5498 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5502 /* Chaos -- many effects */
5505 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5506 if (p_ptr->resist_chaos)
5508 dam *= 6; dam /= (randint1(4) + 7);
5511 if (!CHECK_MULTISHADOW())
5513 if (!p_ptr->resist_conf)
5515 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5517 if (!p_ptr->resist_chaos)
5519 (void)set_image(p_ptr->image + randint1(10));
5522 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5523 (void)gain_random_mutation(0);
5526 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5528 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5531 if (!p_ptr->resist_chaos || one_in_(9))
5533 inven_damage(set_elec_destroy, 2);
5534 inven_damage(set_fire_destroy, 2);
5538 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5542 /* Shards -- mostly cutting */
5545 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5546 if (p_ptr->resist_shard)
5548 dam *= 6; dam /= (randint1(4) + 7);
5550 else if (!CHECK_MULTISHADOW())
5552 (void)set_cut(p_ptr->cut + dam);
5555 if (!p_ptr->resist_shard || one_in_(13))
5557 inven_damage(set_cold_destroy, 2);
5560 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5564 /* Sound -- mostly stunning */
5567 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5568 if (p_ptr->resist_sound)
5570 dam *= 5; dam /= (randint1(4) + 7);
5572 else if (!CHECK_MULTISHADOW())
5574 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5575 (void)set_stun(p_ptr->stun + plus_stun);
5578 if (!p_ptr->resist_sound || one_in_(13))
5580 inven_damage(set_cold_destroy, 2);
5583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5587 /* Pure confusion */
5590 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5591 if (p_ptr->resist_conf)
5593 dam *= 5; dam /= (randint1(4) + 7);
5595 else if (!CHECK_MULTISHADOW())
5597 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5599 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5603 /* Disenchantment -- see above */
5606 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5607 if (p_ptr->resist_disen)
5609 dam *= 6; dam /= (randint1(4) + 7);
5611 else if (!CHECK_MULTISHADOW())
5613 (void)apply_disenchant(0);
5615 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5619 /* Nexus -- see above */
5622 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5623 if (p_ptr->resist_nexus)
5625 dam *= 6; dam /= (randint1(4) + 7);
5627 else if (!CHECK_MULTISHADOW())
5631 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5635 /* Force -- mostly stun */
5638 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5639 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5641 (void)set_stun(p_ptr->stun + randint1(20));
5643 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5648 /* Rocket -- stun, cut */
5651 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5652 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5654 (void)set_stun(p_ptr->stun + randint1(20));
5657 if (p_ptr->resist_shard)
5661 else if (!CHECK_MULTISHADOW())
5663 (void)set_cut(p_ptr->cut + (dam / 2));
5666 if (!p_ptr->resist_shard || one_in_(12))
5668 inven_damage(set_cold_destroy, 3);
5671 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5675 /* Inertia -- slowness */
5678 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5679 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5680 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5684 /* Lite -- blinding */
5687 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5688 if (p_ptr->resist_lite)
5690 dam *= 4; dam /= (randint1(4) + 7);
5692 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5694 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5697 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5699 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5702 else if (prace_is_(RACE_S_FAIRY))
5707 if (p_ptr->wraith_form) dam *= 2;
5708 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5710 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5712 p_ptr->wraith_form = 0;
5713 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5714 "The light forces you out of your incorporeal shadow form."));
5716 p_ptr->redraw |= PR_MAP;
5717 /* Update monsters */
5718 p_ptr->update |= (PU_MONSTERS);
5720 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5722 /* Redraw status bar */
5723 p_ptr->redraw |= (PR_STATUS);
5730 /* Dark -- blinding */
5733 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5734 if (p_ptr->resist_dark)
5736 dam *= 4; dam /= (randint1(4) + 7);
5738 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5740 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5742 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5744 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5748 /* Time -- bolt fewer effects XXX */
5751 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5752 if (p_ptr->resist_time)
5755 dam /= (randint1(4) + 7);
5756 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5758 else if (!CHECK_MULTISHADOW())
5760 switch (randint1(10))
5762 case 1: case 2: case 3: case 4: case 5:
5764 if (p_ptr->prace == RACE_ANDROID) break;
5765 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5766 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5770 case 6: case 7: case 8: case 9:
5772 switch (randint1(6))
5774 case 1: k = A_STR; act = _("強く", "strong"); break;
5775 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5776 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5777 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5778 case 5: k = A_CON; act = _("健康で", "hale"); break;
5779 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5782 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5783 "You're not as %s as you used to be..."), act);
5785 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5786 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5787 p_ptr->update |= (PU_BONUS);
5793 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5794 "You're not as powerful as you used to be..."));
5796 for (k = 0; k < 6; k++)
5798 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5799 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5801 p_ptr->update |= (PU_BONUS);
5807 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5811 /* Gravity -- stun plus slowness plus teleport */
5814 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5815 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5817 if (!CHECK_MULTISHADOW())
5819 teleport_player(5, TELEPORT_PASSIVE);
5820 if (!p_ptr->levitation)
5821 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5822 if (!(p_ptr->resist_sound || p_ptr->levitation))
5824 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5825 (void)set_stun(p_ptr->stun + plus_stun);
5828 if (p_ptr->levitation)
5830 dam = (dam * 2) / 3;
5833 if (!p_ptr->levitation || one_in_(13))
5835 inven_damage(set_cold_destroy, 2);
5838 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5842 /* Standard damage */
5843 case GF_DISINTEGRATE:
5845 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5847 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5853 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5855 (void)hp_player(dam);
5862 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5863 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5870 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5871 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5877 if (p_ptr->free_act) break;
5878 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5880 if (ironman_nightmare)
5882 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5883 /* Have some nightmares */
5884 sanity_blast(NULL, FALSE);
5887 set_paralyzed(p_ptr->paralyzed + dam);
5897 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5898 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5905 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5906 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5913 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5915 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5916 if (!p_ptr->resist_shard || one_in_(13))
5918 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5919 inven_damage(set_cold_destroy, 2);
5925 /* Ice -- cold plus stun plus cuts */
5928 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5929 get_damage = cold_dam(dam, killer, monspell, FALSE);
5930 if (!CHECK_MULTISHADOW())
5932 if (!p_ptr->resist_shard)
5934 (void)set_cut(p_ptr->cut + damroll(5, 8));
5936 if (!p_ptr->resist_sound)
5938 (void)set_stun(p_ptr->stun + randint1(15));
5941 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5943 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5953 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5955 if (p_ptr->mimic_form)
5957 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5958 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5963 switch (p_ptr->prace)
5965 /* Some races are immune */
5979 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5991 if (CHECK_MULTISHADOW())
5993 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5995 else if (p_ptr->csp)
5999 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6001 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6004 if (dam >= p_ptr->csp)
6008 p_ptr->csp_frac = 0;
6017 learn_spell(monspell);
6020 p_ptr->redraw |= (PR_MANA);
6023 p_ptr->window |= (PW_PLAYER);
6024 p_ptr->window |= (PW_SPELL);
6028 /* Heal the monster */
6029 if (m_ptr->hp < m_ptr->maxhp)
6033 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6035 /* Redraw (later) if needed */
6036 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6037 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6039 /* Special message */
6042 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6055 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6057 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6058 learn_spell(monspell);
6062 if (!CHECK_MULTISHADOW())
6064 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6066 if (!p_ptr->resist_conf)
6068 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6071 if (!p_ptr->resist_chaos && one_in_(3))
6073 (void)set_image(p_ptr->image + randint0(250) + 150);
6080 p_ptr->csp_frac = 0;
6082 p_ptr->redraw |= PR_MANA;
6085 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6091 case GF_BRAIN_SMASH:
6093 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6095 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6096 learn_spell(monspell);
6100 if (!CHECK_MULTISHADOW())
6102 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6108 p_ptr->csp_frac = 0;
6110 p_ptr->redraw |= PR_MANA;
6113 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6114 if (!CHECK_MULTISHADOW())
6116 if (!p_ptr->resist_blind)
6118 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6120 if (!p_ptr->resist_conf)
6122 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6124 if (!p_ptr->free_act)
6126 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6128 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6130 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6131 (void)do_dec_stat(A_INT);
6132 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6133 (void)do_dec_stat(A_WIS);
6135 if (!p_ptr->resist_chaos)
6137 (void)set_image(p_ptr->image + randint0(250) + 150);
6147 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6149 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6150 learn_spell(monspell);
6154 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6155 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6163 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6165 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6166 learn_spell(monspell);
6170 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6171 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6179 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6181 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6182 learn_spell(monspell);
6186 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6187 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6195 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6197 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6198 learn_spell(monspell);
6202 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6203 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6211 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6213 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6214 learn_spell(monspell);
6218 if (!CHECK_MULTISHADOW())
6220 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6221 curse_equipment(40, 20);
6224 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6226 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6241 /* Hex - revenge damage stored */
6242 revenge_store(get_damage);
6244 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6245 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6247 char m_name_self[80];
6250 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6252 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6253 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6254 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6257 if (p_ptr->riding && dam > 0)
6259 rakubadam_p = (dam > 200) ? 200 : dam;
6267 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6269 (void)kawarimi(FALSE);
6272 /* Return "Anything seen?" */
6278 * Find the distance from (x, y) to a line.
6280 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6282 /* Vector from (x, y) to (x1, y1) */
6283 POSITION py = y1 - y;
6284 POSITION px = x1 - x;
6287 POSITION ny = x2 - x1;
6288 POSITION nx = y1 - y2;
6291 POSITION pd = distance(y1, x1, y, x);
6292 POSITION nd = distance(y1, x1, y2, x2);
6294 if (pd > nd) return distance(y, x, y2, x2);
6296 /* Component of P on N */
6297 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6299 /* Absolute value */
6300 return((nd >= 0) ? nd : 0 - nd);
6307 * Modified version of los() for calculation of disintegration balls.
6308 * Disintegration effects are stopped by permanent walls.
6310 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6330 /* Slope, or 1/Slope, of LOS */
6334 /* Extract the offset */
6338 /* Extract the absolute offset */
6343 /* Handle adjacent (or identical) grids */
6344 if ((ax < 2) && (ay < 2)) return (TRUE);
6347 /* Paranoia -- require "safe" origin */
6348 /* if (!in_bounds(y1, x1)) return (FALSE); */
6351 /* Directly South/North */
6354 /* South -- check for walls */
6357 for (ty = y1 + 1; ty < y2; ty++)
6359 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6363 /* North -- check for walls */
6366 for (ty = y1 - 1; ty > y2; ty--)
6368 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6376 /* Directly East/West */
6379 /* East -- check for walls */
6382 for (tx = x1 + 1; tx < x2; tx++)
6384 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6388 /* West -- check for walls */
6391 for (tx = x1 - 1; tx > x2; tx--)
6393 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6402 /* Extract some signs */
6403 sx = (dx < 0) ? -1 : 1;
6404 sy = (dy < 0) ? -1 : 1;
6407 /* Vertical "knights" */
6412 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6416 /* Horizontal "knights" */
6421 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6426 /* Calculate scale factor div 2 */
6429 /* Calculate scale factor */
6433 /* Travel horizontally */
6436 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6442 /* Consider the special case where slope == 1. */
6453 /* Note (below) the case (qy == f2), where */
6454 /* the LOS exactly meets the corner of a tile. */
6457 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6468 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6481 /* Travel vertically */
6484 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6500 /* Note (below) the case (qx == f2), where */
6501 /* the LOS exactly meets the corner of a tile. */
6504 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6515 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6536 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, int typ)
6541 int brev = rad * rad / dist;
6545 int mdis = distance(y1, x1, y2, x2) + rad;
6547 while (bdis <= mdis)
6551 if ((0 < dist) && (path_n < dist))
6553 int ny = GRID_Y(path_g[path_n]);
6554 int nx = GRID_X(path_g[path_n]);
6555 int nd = distance(ny, nx, y1, x1);
6557 /* Get next base point */
6566 /* Travel from center outward */
6567 for (cdis = 0; cdis <= brad; cdis++)
6569 /* Scan the maximal blast area of radius "cdis" */
6570 for (y = by - cdis; y <= by + cdis; y++)
6572 for (x = bx - cdis; x <= bx + cdis; x++)
6574 /* Ignore "illegal" locations */
6575 if (!in_bounds(y, x)) continue;
6577 /* Enforce a circular "ripple" */
6578 if (distance(y1, x1, y, x) != bdis) continue;
6580 /* Enforce an arc */
6581 if (distance(by, bx, y, x) != cdis) continue;
6587 /* Lights are stopped by opaque terrains */
6588 if (!los(by, bx, y, x)) continue;
6590 case GF_DISINTEGRATE:
6591 /* Disintegration are stopped only by perma-walls */
6592 if (!in_disintegration_range(by, bx, y, x)) continue;
6595 /* Ball explosions are stopped by walls */
6596 if (!projectable(by, bx, y, x)) continue;
6600 /* Save this grid */
6608 /* Encode some more "radius" info */
6609 gm[bdis + 1] = *pgrids;
6611 /* Increase the size */
6612 brad = rad * (path_n + brev) / (dist + brev);
6614 /* Find the next ripple */
6618 /* Store the effect size */
6624 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6625 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6626 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6627 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6628 * @param x 目標X座標 / Target x location (or location to travel "towards")
6629 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6630 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6631 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6632 * @param monspell 効果元のモンスター魔法ID
6633 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6636 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6637 * towards a given location (optionally passing over the heads of interposing
6638 * monsters), and have it do a given amount of damage to the monsters (and
6639 * optionally objects) within the given radius of the final location.
6641 * A "bolt" travels from source to target and affects only the target grid.
6642 * A "beam" travels from source to target, affecting all grids passed through.
6643 * A "ball" travels from source to the target, exploding at the target, and
6644 * affecting everything within the given radius of the target location.
6646 * Traditionally, a "bolt" does not affect anything on the ground, and does
6647 * not pass over the heads of interposing monsters, much like a traditional
6648 * missile, and will "stop" abruptly at the "target" even if no monster is
6649 * positioned there, while a "ball", on the other hand, passes over the heads
6650 * of monsters between the source and target, and affects everything except
6651 * the source monster which lies within the final radius, while a "beam"
6652 * affects every monster between the source and target, except for the casting
6653 * monster (or player), and rarely affects things on the ground.
6655 * Two special flags allow us to use this function in special ways, the
6656 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6657 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6658 * actually projecting from the source monster (or player).
6660 * The player will only get "experience" for monsters killed by himself
6661 * Unique monsters can only be destroyed by attacks from the player
6663 * Only 256 grids can be affected per projection, limiting the effective
6664 * "radius" of standard ball attacks to nine units (diameter nineteen).
6666 * One can project in a given "direction" by combining PROJECT_THRU with small
6667 * offsets to the initial location (see "line_spell()"), or by calculating
6668 * "virtual targets" far away from the player.
6670 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6671 * continuing until it actually hits somethings (useful for "stone to mud").
6673 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6675 * Balls must explode BEFORE hitting walls, or they would affect monsters
6676 * on both sides of a wall. Some bug reports indicate that this is still
6677 * happening in 2.7.8 for Windows, though it appears to be impossible.
6679 * We "pre-calculate" the blast area only in part for efficiency.
6680 * More importantly, this lets us do "explosions" from the "inside" out.
6681 * This results in a more logical distribution of "blast" treasure.
6682 * It also produces a better (in my opinion) animation of the explosion.
6683 * It could be (but is not) used to have the treasure dropped by monsters
6684 * in the middle of the explosion fall "outwards", and then be damaged by
6685 * the blast as it spreads outwards towards the treasure drop location.
6687 * Walls and doors are included in the blast area, so that they can be
6688 * "burned" or "melted" in later versions.
6690 * This algorithm is intended to maximize simplicity, not necessarily
6691 * efficiency, since this function is not a bottleneck in the code.
6693 * We apply the blast effect from ground zero outwards, in several passes,
6694 * first affecting features, then objects, then monsters, then the player.
6695 * This allows walls to be removed before checking the object or monster
6696 * in the wall, and protects objects which are dropped by monsters killed
6697 * in the blast, and allows the player to see all affects before he is
6698 * killed or teleported away. The semantics of this method are open to
6699 * various interpretations, but they seem to work well in practice.
6701 * We process the blast area from ground-zero outwards to allow for better
6702 * distribution of treasure dropped by monsters, and because it provides a
6703 * pleasing visual effect at low cost.
6705 * Note that the damage done by "ball" explosions decreases with distance.
6706 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6708 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6709 * the target, and then the damage "flows" along this beam of destruction.
6710 * The damage at every grid is the same as at the "center" of a "ball"
6711 * explosion, since the "beam" grids are treated as if they ARE at the
6712 * center of a "ball" explosion.
6714 * Currently, specifying "beam" plus "ball" means that locations which are
6715 * covered by the initial "beam", and also covered by the final "ball", except
6716 * for the final grid (the epicenter of the ball), will be "hit twice", once
6717 * by the initial beam, and once by the exploding ball. For the grid right
6718 * next to the epicenter, this results in 150% damage being done. The center
6719 * does not have this problem, for the same reason the final grid in a "beam"
6720 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6721 * grids which are covered by the "ball" will NOT work, as then they will
6722 * receive LESS damage than they should. Do not combine "beam" with "ball".
6724 * The array "gy[],gx[]" with current size "grids" is used to hold the
6725 * collected locations of all grids in the "blast area" plus "beam path".
6727 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6728 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6729 * first blast grid (see above) with radius "N" from the blast center. Note
6730 * that only the first gm[1] grids in the blast area thus take full damage.
6731 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6732 * number of blast grids.
6734 * Note that once the projection is complete, (y2,x2) holds the final location
6735 * of bolts/beams, and the "epicenter" of balls.
6737 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6738 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6739 * implementation of the "distance" function. Also, a bolt can be properly
6740 * viewed as a "ball" with a "rad" of "zero".
6742 * Note that if no "target" is reached before the beam/bolt/ball travels the
6743 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6744 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6746 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6747 * to move from point A to point B, even if the player cannot see part of the
6748 * projection path. Note that in general, the player will *always* see part
6749 * of the path, since it either starts at the player or ends on the player.
6751 * Hack -- we assume that every "projection" is "self-illuminating".
6753 * Hack -- when only a single monster is affected, we automatically track
6754 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6756 * Note that all projections now "explode" at their final destination, even
6757 * if they were being projected at a more distant destination. This means
6758 * that "ball" spells will *always* explode.
6760 * Note that we must call "handle_stuff()" after affecting terrain features
6761 * in the blast radius, in case the "illumination" of the grid was changed,
6762 * and "update_view()" and "update_monsters()" need to be called.
6765 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6775 POSITION y_saver, x_saver; /* For reflecting monsters */
6777 int msec = delay_factor * delay_factor * delay_factor;
6779 /* Assume the player sees nothing */
6780 bool notice = FALSE;
6782 /* Assume the player has seen nothing */
6783 bool visual = FALSE;
6785 /* Assume the player has seen no blast grids */
6788 /* Assume to be a normal ball spell */
6789 bool breath = FALSE;
6791 /* Is the player blind? */
6792 bool blind = (p_ptr->blind ? TRUE : FALSE);
6794 bool old_hide = FALSE;
6796 /* Number of grids in the "path" */
6799 /* Actual grids in the "path" */
6802 /* Number of grids in the "blast area" (including the "beam" path) */
6805 /* Coordinates of the affected grids */
6806 POSITION gx[1024], gy[1024];
6808 /* Encoded "radius" info (see above) */
6811 /* Actual radius encoded in gm[] */
6812 POSITION gm_rad = rad;
6816 /* Attacker's name (prepared before polymorph)*/
6819 /* Can the player see the source of this effect? */
6820 bool see_s_msg = TRUE;
6822 /* Initialize by null string */
6828 /* Default target of monsterspell is player */
6829 monster_target_y=p_ptr->y;
6830 monster_target_x=p_ptr->x;
6832 /* Hack -- Jump to target */
6833 if (flg & (PROJECT_JUMP))
6838 /* Clear the flag */
6839 flg &= ~(PROJECT_JUMP);
6844 /* Start at player */
6851 /* Start at monster */
6854 x1 = m_list[who].fx;
6855 y1 = m_list[who].fy;
6856 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6869 /* Default "destination" */
6874 /* Hack -- verify stuff */
6875 if (flg & (PROJECT_THRU))
6877 if ((x1 == x2) && (y1 == y2))
6879 flg &= ~(PROJECT_THRU);
6883 /* Handle a breath attack */
6888 if (flg & PROJECT_HIDE) old_hide = TRUE;
6889 flg |= PROJECT_HIDE;
6893 /* Hack -- Assume there will be no blast (max radius 32) */
6894 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6902 /* Collect beam grids */
6903 if (flg & (PROJECT_BEAM))
6914 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6916 case GF_DISINTEGRATE:
6917 flg |= (PROJECT_GRID);
6918 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6922 /* Calculate the projection path */
6924 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6926 /* Hack -- Handle stuff */
6929 /* Giga-Hack SEEKER & SUPER_RAY */
6931 if( typ == GF_SEEKER )
6941 for (i = 0; i < path_n; ++i)
6946 int ny = GRID_Y(path_g[i]);
6947 int nx = GRID_X(path_g[i]);
6958 /* Only do visuals if requested */
6959 if (!blind && !(flg & (PROJECT_HIDE)))
6961 /* Only do visuals if the player can "see" the bolt */
6962 if (panel_contains(y, x) && player_has_los_bold(y, x))
6969 /* Obtain the bolt pict */
6970 p = bolt_pict(oy, ox, y, x, typ);
6972 /* Extract attr/char */
6976 /* Visual effects */
6977 print_rel(c, a, y, x);
6978 move_cursor_relative(y, x);
6979 /*if (fresh_before)*/ Term_fresh();
6980 Term_xtra(TERM_XTRA_DELAY, msec);
6982 /*if (fresh_before)*/ Term_fresh();
6984 /* Display "beam" grids */
6985 if (flg & (PROJECT_BEAM))
6987 /* Obtain the explosion pict */
6988 p = bolt_pict(y, x, y, x, typ);
6990 /* Extract attr/char */
6994 /* Visual effects */
6995 print_rel(c, a, y, x);
6998 /* Hack -- Activate delay */
7002 /* Hack -- delay anyway for consistency */
7005 /* Delay for consistency */
7006 Term_xtra(TERM_XTRA_DELAY, msec);
7009 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7010 if( is_mirror_grid(&cave[y][x]))
7012 /* The target of monsterspell becomes tha mirror(broken) */
7013 monster_target_y=(s16b)y;
7014 monster_target_x=(s16b)x;
7016 remove_mirror(y, x);
7017 next_mirror(&oy, &ox, y, x);
7019 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7020 for(j = last_i; j <= i; j++)
7022 y = GRID_Y(path_g[j]);
7023 x = GRID_X(path_g[j]);
7024 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7025 if(!who && (project_m_n==1) && !jump ){
7026 if(cave[project_m_y][project_m_x].m_idx >0 ){
7027 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7031 /* Hack -- auto-recall */
7032 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7034 /* Hack - auto-track */
7035 health_track(cave[project_m_y][project_m_x].m_idx);
7039 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7044 for(i = last_i ; i < path_n ; i++)
7047 py = GRID_Y(path_g[i]);
7048 px = GRID_X(path_g[i]);
7049 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7051 if(!who && (project_m_n==1) && !jump ){
7052 if(cave[project_m_y][project_m_x].m_idx > 0)
7054 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7058 /* Hack -- auto-recall */
7059 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7061 /* Hack - auto-track */
7062 health_track(cave[project_m_y][project_m_x].m_idx);
7066 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7070 else if(typ == GF_SUPER_RAY){
7072 int second_step = 0;
7079 for (i = 0; i < path_n; ++i)
7084 int ny = GRID_Y(path_g[i]);
7085 int nx = GRID_X(path_g[i]);
7096 /* Only do visuals if requested */
7097 if (!blind && !(flg & (PROJECT_HIDE)))
7099 /* Only do visuals if the player can "see" the bolt */
7100 if (panel_contains(y, x) && player_has_los_bold(y, x))
7107 /* Obtain the bolt pict */
7108 p = bolt_pict(oy, ox, y, x, typ);
7110 /* Extract attr/char */
7114 /* Visual effects */
7115 print_rel(c, a, y, x);
7116 move_cursor_relative(y, x);
7117 /*if (fresh_before)*/ Term_fresh();
7118 Term_xtra(TERM_XTRA_DELAY, msec);
7120 /*if (fresh_before)*/ Term_fresh();
7122 /* Display "beam" grids */
7123 if (flg & (PROJECT_BEAM))
7125 /* Obtain the explosion pict */
7126 p = bolt_pict(y, x, y, x, typ);
7128 /* Extract attr/char */
7132 /* Visual effects */
7133 print_rel(c, a, y, x);
7136 /* Hack -- Activate delay */
7140 /* Hack -- delay anyway for consistency */
7143 /* Delay for consistency */
7144 Term_xtra(TERM_XTRA_DELAY, msec);
7147 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7148 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7150 if( second_step )continue;
7153 if( is_mirror_grid(&cave[y][x]) && !second_step )
7155 /* The target of monsterspell becomes tha mirror(broken) */
7156 monster_target_y=(s16b)y;
7157 monster_target_x=(s16b)x;
7160 for( j = 0; j <=i ; j++ )
7162 y = GRID_Y(path_g[j]);
7163 x = GRID_X(path_g[j]);
7164 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7168 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7169 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7170 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7171 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7172 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7173 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7174 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7175 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7178 for( i = 0; i < path_n ; i++ )
7181 py = GRID_Y(path_g[i]);
7182 px = GRID_X(path_g[i]);
7183 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7184 if(!who && (project_m_n == 1) && !jump){
7185 if(cave[project_m_y][project_m_x].m_idx >0 ){
7186 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7190 /* Hack -- auto-recall */
7191 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7193 /* Hack - auto-track */
7194 health_track(cave[project_m_y][project_m_x].m_idx);
7198 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7203 /* Project along the path */
7204 for (i = 0; i < path_n; ++i)
7209 int ny = GRID_Y(path_g[i]);
7210 int nx = GRID_X(path_g[i]);
7212 if (flg & PROJECT_DISI)
7214 /* Hack -- Balls explode before reaching walls */
7215 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7217 else if (flg & PROJECT_LOS)
7219 /* Hack -- Balls explode before reaching walls */
7220 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7224 /* Hack -- Balls explode before reaching walls */
7225 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7232 /* Collect beam grids */
7233 if (flg & (PROJECT_BEAM))
7240 /* Only do visuals if requested */
7241 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7243 /* Only do visuals if the player can "see" the bolt */
7244 if (panel_contains(y, x) && player_has_los_bold(y, x))
7251 /* Obtain the bolt pict */
7252 p = bolt_pict(oy, ox, y, x, typ);
7254 /* Extract attr/char */
7258 /* Visual effects */
7259 print_rel(c, a, y, x);
7260 move_cursor_relative(y, x);
7261 /*if (fresh_before)*/ Term_fresh();
7262 Term_xtra(TERM_XTRA_DELAY, msec);
7264 /*if (fresh_before)*/ Term_fresh();
7266 /* Display "beam" grids */
7267 if (flg & (PROJECT_BEAM))
7269 /* Obtain the explosion pict */
7270 p = bolt_pict(y, x, y, x, typ);
7272 /* Extract attr/char */
7276 /* Visual effects */
7277 print_rel(c, a, y, x);
7280 /* Hack -- Activate delay */
7284 /* Hack -- delay anyway for consistency */
7287 /* Delay for consistency */
7288 Term_xtra(TERM_XTRA_DELAY, msec);
7295 /* Save the "blast epicenter" */
7299 if (breath && !path_n)
7305 flg &= ~(PROJECT_HIDE);
7309 /* Start the "explosion" */
7312 /* Hack -- make sure beams get to "explode" */
7320 /* If we found a "target", explode there */
7321 if (dist <= MAX_RANGE)
7323 /* Mega-Hack -- remove the final "beam" grid */
7324 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7327 * Create a conical breath attack
7338 flg &= ~(PROJECT_HIDE);
7340 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7344 /* Determine the blast area, work from the inside out */
7345 for (dist = 0; dist <= rad; dist++)
7347 /* Scan the maximal blast area of radius "dist" */
7348 for (y = by - dist; y <= by + dist; y++)
7350 for (x = bx - dist; x <= bx + dist; x++)
7352 /* Ignore "illegal" locations */
7353 if (!in_bounds2(y, x)) continue;
7355 /* Enforce a "circular" explosion */
7356 if (distance(by, bx, y, x) != dist) continue;
7362 /* Lights are stopped by opaque terrains */
7363 if (!los(by, bx, y, x)) continue;
7365 case GF_DISINTEGRATE:
7366 /* Disintegration are stopped only by perma-walls */
7367 if (!in_disintegration_range(by, bx, y, x)) continue;
7370 /* Ball explosions are stopped by walls */
7371 if (!projectable(by, bx, y, x)) continue;
7375 /* Save this grid */
7382 /* Encode some more "radius" info */
7388 /* Speed -- ignore "non-explosions" */
7389 if (!grids) return (FALSE);
7392 /* Display the "blast area" if requested */
7393 if (!blind && !(flg & (PROJECT_HIDE)))
7395 /* Then do the "blast", from inside out */
7396 for (t = 0; t <= gm_rad; t++)
7398 /* Dump everything with this radius */
7399 for (i = gm[t]; i < gm[t+1]; i++)
7401 /* Extract the location */
7405 /* Only do visuals if the player can "see" the blast */
7406 if (panel_contains(y, x) && player_has_los_bold(y, x))
7415 /* Obtain the explosion pict */
7416 p = bolt_pict(y, x, y, x, typ);
7418 /* Extract attr/char */
7422 /* Visual effects -- Display */
7423 print_rel(c, a, y, x);
7427 /* Hack -- center the cursor */
7428 move_cursor_relative(by, bx);
7430 /* Flush each "radius" seperately */
7431 /*if (fresh_before)*/ Term_fresh();
7433 /* Delay (efficiently) */
7434 if (visual || drawn)
7436 Term_xtra(TERM_XTRA_DELAY, msec);
7440 /* Flush the erasing */
7443 /* Erase the explosion drawn above */
7444 for (i = 0; i < grids; i++)
7446 /* Extract the location */
7450 /* Hack -- Erase if needed */
7451 if (panel_contains(y, x) && player_has_los_bold(y, x))
7457 /* Hack -- center the cursor */
7458 move_cursor_relative(by, bx);
7460 /* Flush the explosion */
7461 /*if (fresh_before)*/ Term_fresh();
7466 /* Update stuff if needed */
7467 if (p_ptr->update) update_stuff();
7470 if (flg & PROJECT_KILL)
7472 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7473 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7477 /* Check features */
7478 if (flg & (PROJECT_GRID))
7480 /* Start with "dist" of zero */
7483 /* Scan for features */
7484 for (i = 0; i < grids; i++)
7486 /* Hack -- Notice new "dist" values */
7487 if (gm[dist+1] == i) dist++;
7489 /* Get the grid location */
7493 /* Find the closest point in the blast */
7496 int d = dist_to_line(y, x, y1, x1, by, bx);
7498 /* Affect the grid */
7499 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7503 /* Affect the grid */
7504 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7509 /* Update stuff if needed */
7510 if (p_ptr->update) update_stuff();
7513 if (flg & (PROJECT_ITEM))
7515 /* Start with "dist" of zero */
7518 /* Scan for objects */
7519 for (i = 0; i < grids; i++)
7521 /* Hack -- Notice new "dist" values */
7522 if (gm[dist+1] == i) dist++;
7524 /* Get the grid location */
7528 /* Find the closest point in the blast */
7531 int d = dist_to_line(y, x, y1, x1, by, bx);
7533 /* Affect the object in the grid */
7534 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7538 /* Affect the object in the grid */
7539 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7545 /* Check monsters */
7546 if (flg & (PROJECT_KILL))
7553 /* Start with "dist" of zero */
7556 /* Scan for monsters */
7557 for (i = 0; i < grids; i++)
7561 /* Hack -- Notice new "dist" values */
7562 if (gm[dist + 1] == i) dist++;
7564 /* Get the grid location */
7568 /* A single bolt may be reflected */
7571 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7572 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7574 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7575 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7576 (!who || dist_hack > 1) && !one_in_(10))
7579 int max_attempts = 10;
7581 /* Choose 'new' target */
7584 t_y = y_saver - 1 + randint1(3);
7585 t_x = x_saver - 1 + randint1(3);
7588 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7590 if (max_attempts < 1)
7596 sound(SOUND_REFLECT);
7599 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7600 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7601 else if (m_ptr->r_idx == MON_DIO)
7602 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7604 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7606 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7608 /* Reflected bolts randomly target either one */
7609 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7610 else flg |= PROJECT_PLAYER;
7612 /* The bolt is reflected */
7613 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7615 /* Don't affect the monster any longer */
7621 /* Find the closest point in the blast */
7624 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7628 effective_dist = dist;
7632 /* There is the riding player on this monster */
7633 if (p_ptr->riding && player_bold(y, x))
7635 /* Aimed on the player */
7636 if (flg & PROJECT_PLAYER)
7638 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7641 * A beam or bolt is well aimed
7643 * So don't affects the mount.
7650 * The spell is not well aimed,
7651 * So partly affect the mount too.
7658 * This grid is the original target.
7659 * Or aimed on your horse.
7661 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7663 /* Hit the mount with full damage */
7667 * Otherwise this grid is not the
7668 * original target, it means that line
7669 * of fire is obstructed by this
7673 * A beam or bolt will hit either
7674 * player or mount. Choose randomly.
7676 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7680 /* Hit the mount with full damage */
7684 /* Hit the player later */
7685 flg |= PROJECT_PLAYER;
7687 /* Don't affect the mount */
7693 * The spell is not well aimed, so
7694 * partly affect both player and
7703 /* Affect the monster in the grid */
7704 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7708 /* Player affected one monster (without "jumping") */
7709 if (!who && (project_m_n == 1) && !jump)
7715 /* Track if possible */
7716 if (cave[y][x].m_idx > 0)
7718 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7722 /* Hack -- auto-recall */
7723 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7725 /* Hack - auto-track */
7726 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7734 if (flg & (PROJECT_KILL))
7736 /* Start with "dist" of zero */
7739 /* Scan for player */
7740 for (i = 0; i < grids; i++)
7744 /* Hack -- Notice new "dist" values */
7745 if (gm[dist+1] == i) dist++;
7747 /* Get the grid location */
7751 /* Affect the player? */
7752 if (!player_bold(y, x)) continue;
7754 /* Find the closest point in the blast */
7757 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7761 effective_dist = dist;
7764 /* Target may be your horse */
7767 /* Aimed on the player */
7768 if (flg & PROJECT_PLAYER)
7770 /* Hit the player with full damage */
7774 * Hack -- When this grid was not the
7775 * original target, a beam or bolt
7776 * would hit either player or mount,
7777 * and should be choosen randomly.
7779 * But already choosen to hit the
7780 * mount at this point.
7782 * Or aimed on your horse.
7784 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7787 * A beam or bolt is well aimed
7789 * So don't affects the player.
7796 * The spell is not well aimed,
7797 * So partly affect the player too.
7803 /* Affect the player */
7804 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7812 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7814 if (rakubadam_m > 0)
7816 if (rakuba(rakubadam_m, FALSE))
7818 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7821 if (p_ptr->riding && rakubadam_p > 0)
7823 if(rakuba(rakubadam_p, FALSE))
7825 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7830 /* Return "something was noticed" */
7835 * @brief 鏡魔法「封魔結界」の効果処理
7837 * @return 効果があったらTRUEを返す
7839 bool binding_field( HIT_POINT dam )
7841 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7842 int mirror_num=0; /* 鏡の数 */
7847 int msec= delay_factor*delay_factor*delay_factor;
7853 /* Default target of monsterspell is player */
7854 monster_target_y=p_ptr->y;
7855 monster_target_x=p_ptr->x;
7857 for( x=0 ; x < cur_wid ; x++ )
7859 for( y=0 ; y < cur_hgt ; y++ )
7861 if( is_mirror_grid(&cave[y][x]) &&
7862 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7863 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7864 player_has_los_bold(y,x) &&
7865 projectable(p_ptr->y, p_ptr->x, y, x)
7867 mirror_y[mirror_num]=y;
7868 mirror_x[mirror_num]=x;
7874 if( mirror_num < 2 )return FALSE;
7876 point_x[0] = randint0( mirror_num );
7878 point_x[1] = randint0( mirror_num );
7880 while( point_x[0] == point_x[1] );
7882 point_y[0]=mirror_y[point_x[0]];
7883 point_x[0]=mirror_x[point_x[0]];
7884 point_y[1]=mirror_y[point_x[1]];
7885 point_x[1]=mirror_x[point_x[1]];
7886 point_y[2]=p_ptr->y;
7887 point_x[2]=p_ptr->x;
7889 x=point_x[0]+point_x[1]+point_x[2];
7890 y=point_y[0]+point_y[1]+point_y[2];
7892 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7893 - (point_y[0]*3-y)*(point_x[1]*3-x);
7894 if( centersign == 0 )return FALSE;
7896 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7897 x1 = x1 < point_x[2] ? x1 : point_x[2];
7898 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7899 y1 = y1 < point_y[2] ? y1 : point_y[2];
7901 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7902 x2 = x2 > point_x[2] ? x2 : point_x[2];
7903 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7904 y2 = y2 > point_y[2] ? y2 : point_y[2];
7906 for( y=y1 ; y <=y2 ; y++ ){
7907 for( x=x1 ; x <=x2 ; x++ ){
7908 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7909 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7910 centersign*( (point_x[1]-x)*(point_y[2]-y)
7911 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7912 centersign*( (point_x[2]-x)*(point_y[0]-y)
7913 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7915 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7916 /* Visual effects */
7918 && panel_contains(y,x)){
7919 p = bolt_pict(y,x,y,x, GF_MANA );
7920 print_rel(PICT_C(p), PICT_A(p),y,x);
7921 move_cursor_relative(y, x);
7922 /*if (fresh_before)*/ Term_fresh();
7923 Term_xtra(TERM_XTRA_DELAY, msec);
7929 for( y=y1 ; y <=y2 ; y++ ){
7930 for( x=x1 ; x <=x2 ; x++ ){
7931 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7932 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7933 centersign*( (point_x[1]-x)*(point_y[2]-y)
7934 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7935 centersign*( (point_x[2]-x)*(point_y[0]-y)
7936 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7938 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7939 (void)project_f(0,0,y,x,dam,GF_MANA);
7944 for( y=y1 ; y <=y2 ; y++ ){
7945 for( x=x1 ; x <=x2 ; x++ ){
7946 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7947 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7948 centersign*( (point_x[1]-x)*(point_y[2]-y)
7949 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7950 centersign*( (point_x[2]-x)*(point_y[0]-y)
7951 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7953 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7954 (void)project_o(0,0,y,x,dam,GF_MANA);
7959 for( y=y1 ; y <=y2 ; y++ ){
7960 for( x=x1 ; x <=x2 ; x++ ){
7961 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7962 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7963 centersign*( (point_x[1]-x)*(point_y[2]-y)
7964 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7965 centersign*( (point_x[2]-x)*(point_y[0]-y)
7966 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7968 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7969 (void)project_m(0,0,y,x,dam,GF_MANA,
7970 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7976 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7977 remove_mirror(point_y[0],point_x[0]);
7984 * @brief 鏡魔法「鏡の封印」の効果処理
7986 * @return 効果があったらTRUEを返す
7988 void seal_of_mirror( HIT_POINT dam )
7992 for( x = 0 ; x < cur_wid ; x++ )
7994 for( y = 0 ; y < cur_hgt ; y++ )
7996 if( is_mirror_grid(&cave[y][x]))
7998 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
7999 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8001 if( !cave[y][x].m_idx )