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.
17 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
18 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
20 int project_length = 0; /*!< 投射の射程距離 */
24 * @brief モンスター魅了用セービングスロー共通部(汎用系)
26 * @param m_ptr 対象モンスター
27 * @return 魅了に抵抗したらTRUE
29 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
31 monster_race *r_ptr = &r_info[m_ptr->r_idx];
33 if(p_ptr->inside_arena) return TRUE;
36 if (r_ptr->flagsr & RFR_RES_ALL)
38 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
42 if (r_ptr->flags3 & RF3_NO_CONF)
44 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
48 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
50 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
51 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
52 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
56 * @brief モンスター服従用セービングスロー共通部(部族依存系)
58 * @param m_ptr 対象モンスター
59 * @return 服従に抵抗したらTRUE
61 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
63 monster_race *r_ptr = &r_info[m_ptr->r_idx];
65 if (p_ptr->inside_arena) return TRUE;
68 if (r_ptr->flagsr & RFR_RES_ALL)
70 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
74 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
76 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
77 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
78 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
82 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
85 * ハードコーティングによる実装が行われている。
86 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
90 if (p_ptr->pclass == CLASS_MAGE)
92 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
93 return p_ptr->lev + 10;
95 return p_ptr->lev / 2;
100 * @brief 配置した鏡リストの次を取得する /
101 * Get another mirror. for SEEKER
102 * @param next_y 次の鏡のy座標を返す参照ポインタ
103 * @param next_x 次の鏡のx座標を返す参照ポインタ
104 * @param cury 現在の鏡のy座標
105 * @param curx 現在の鏡のx座標
107 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
109 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
110 int mirror_num = 0; /* 鏡の数 */
114 for (x = 0; x < cur_wid; x++)
116 for (y = 0; y < cur_hgt; y++)
118 if (is_mirror_grid(&cave[y][x])) {
119 mirror_y[mirror_num] = y;
120 mirror_x[mirror_num] = x;
127 num = randint0(mirror_num);
128 *next_y = mirror_y[num];
129 *next_x = mirror_x[num];
132 *next_y = cury + randint0(5) - 2;
133 *next_x = curx + randint0(5) - 2;
138 * @brief 万色表現用にランダムな色を選択する関数 /
139 * Get a legal "multi-hued" color for drawing "spells"
143 static byte mh_attr(int max)
145 switch (randint1(max))
147 case 1: return (TERM_RED);
148 case 2: return (TERM_GREEN);
149 case 3: return (TERM_BLUE);
150 case 4: return (TERM_YELLOW);
151 case 5: return (TERM_ORANGE);
152 case 6: return (TERM_VIOLET);
153 case 7: return (TERM_L_RED);
154 case 8: return (TERM_L_GREEN);
155 case 9: return (TERM_L_BLUE);
156 case 10: return (TERM_UMBER);
157 case 11: return (TERM_L_UMBER);
158 case 12: return (TERM_SLATE);
159 case 13: return (TERM_WHITE);
160 case 14: return (TERM_L_WHITE);
161 case 15: return (TERM_L_DARK);
169 * @brief 魔法属性に応じたエフェクトの色を返す /
170 * Return a color to use for the bolt/ball spells
174 static byte spell_color(int type)
176 /* Check if A.B.'s new graphics should be used (rr9) */
177 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
182 case GF_PSY_SPEAR: return (0x06);
183 case GF_MISSILE: return (0x0F);
184 case GF_ACID: return (0x04);
185 case GF_ELEC: return (0x02);
186 case GF_FIRE: return (0x00);
187 case GF_COLD: return (0x01);
188 case GF_POIS: return (0x03);
189 case GF_HOLY_FIRE: return (0x00);
190 case GF_HELL_FIRE: return (0x00);
191 case GF_MANA: return (0x0E);
193 case GF_SEEKER: return (0x0E);
194 case GF_SUPER_RAY: return (0x0E);
196 case GF_ARROW: return (0x0F);
197 case GF_WATER: return (0x04);
198 case GF_NETHER: return (0x07);
199 case GF_CHAOS: return (mh_attr(15));
200 case GF_DISENCHANT: return (0x05);
201 case GF_NEXUS: return (0x0C);
202 case GF_CONFUSION: return (mh_attr(4));
203 case GF_SOUND: return (0x09);
204 case GF_SHARDS: return (0x08);
205 case GF_FORCE: return (0x09);
206 case GF_INERTIAL: return (0x09);
207 case GF_GRAVITY: return (0x09);
208 case GF_TIME: return (0x09);
209 case GF_LITE_WEAK: return (0x06);
210 case GF_LITE: return (0x06);
211 case GF_DARK_WEAK: return (0x07);
212 case GF_DARK: return (0x07);
213 case GF_PLASMA: return (0x0B);
214 case GF_METEOR: return (0x00);
215 case GF_ICE: return (0x01);
216 case GF_ROCKET: return (0x0F);
217 case GF_DEATH_RAY: return (0x07);
218 case GF_NUKE: return (mh_attr(2));
219 case GF_DISINTEGRATE: return (0x05);
231 case GF_CAUSE_4: return (0x0E);
232 case GF_HAND_DOOM: return (0x07);
233 case GF_CAPTURE : return (0x0E);
234 case GF_IDENTIFY: return (0x01);
235 case GF_ATTACK: return (0x0F);
236 case GF_PHOTO : return (0x06);
239 /* Normal tiles or ASCII */
245 /* Lookup the default colors for this type */
246 cptr s = quark_str(gf_color[type]);
249 if (!s) return (TERM_WHITE);
251 /* Pick a random color */
252 c = s[randint0(strlen(s))];
254 /* Lookup this color */
255 a = my_strchr(color_char, c) - color_char;
257 /* Invalid color (note check for < 0 removed, gave a silly
258 * warning because bytes are always >= 0 -- RG) */
259 if (a > 15) return (TERM_WHITE);
265 /* Standard "color" */
271 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
272 * Find the attr/char pair to use for a spell effect
281 * It is moving (or has moved) from (x,y) to (nx,ny).
282 * If the distance is not "one", we (may) return "*".
285 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
295 if ((ny == y) && (nx == x)) base = 0x30;
298 else if (nx == x) base = 0x40;
301 else if (ny == y) base = 0x50;
304 else if ((ny - y) == (x - nx)) base = 0x60;
307 else if ((ny - y) == (nx - x)) base = 0x70;
312 /* Basic spell color */
313 k = spell_color(typ);
315 /* Obtain attr/char */
316 a = misc_to_attr[base + k];
317 c = misc_to_char[base + k];
325 * @brief 始点から終点への経路を返す /
326 * Determine the path taken by a projection.
327 * @param gp 経路座標リストを返す参照ポインタ
337 * The projection will always start from the grid (y1,x1), and will travel
338 * towards the grid (y2,x2), touching one grid per unit of distance along
339 * the major axis, and stopping when it enters the destination grid or a
340 * wall grid, or has travelled the maximum legal distance of "range".
342 * Note that "distance" in this function (as in the "update_view()" code)
343 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
344 * actually has an "octagon of projection" not a "circle of projection".
346 * The path grids are saved into the grid array pointed to by "gp", and
347 * there should be room for at least "range" grids in "gp". Note that
348 * due to the way in which distance is calculated, this function normally
349 * uses fewer than "range" grids for the projection path, so the result
350 * of this function should never be compared directly to "range". Note
351 * that the initial grid (y1,x1) is never saved into the grid array, not
352 * even if the initial grid is also the final grid. XXX XXX XXX
354 * The "flg" flags can be used to modify the behavior of this function.
356 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
357 * semantics as they do for the "project" function, namely, that the path
358 * will stop as soon as it hits a monster, or that the path will continue
359 * through the destination grid, respectively.
361 * The "PROJECT_JUMP" flag, which for the "project()" function means to
362 * start at a special grid (which makes no sense in this function), means
363 * that the path should be "angled" slightly if needed to avoid any wall
364 * grids, allowing the player to "target" any grid which is in "view".
365 * This flag is non-trivial and has not yet been implemented, but could
366 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
368 * This function returns the number of grids (if any) in the path. This
369 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
371 * This algorithm is similar to, but slightly different from, the one used
372 * by "update_view_los()", and very different from the one used by "los()".
375 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
397 /* No path necessary (or allowed) */
398 if ((x1 == x2) && (y1 == y2)) return (0);
426 /* Number of "units" in one "half" grid */
429 /* Number of "units" in one "full" grid */
435 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
446 /* Advance (X) part 2 */
449 /* Advance (X) part 3 */
456 /* Create the projection path */
460 gp[n++] = GRID(y, x);
462 /* Hack -- Check maximum range */
463 if ((n + (k >> 1)) >= range) break;
465 /* Sometimes stop at destination grid */
466 if (!(flg & (PROJECT_THRU)))
468 if ((x == x2) && (y == y2)) break;
471 if (flg & (PROJECT_DISI))
473 if ((n > 0) && cave_stop_disintegration(y, x)) break;
475 else if (flg & (PROJECT_LOS))
477 if ((n > 0) && !cave_los_bold(y, x)) break;
479 else if (!(flg & (PROJECT_PATH)))
481 /* Always stop at non-initial wall grids */
482 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
485 /* Sometimes stop at non-initial monsters/players */
486 if (flg & (PROJECT_STOP))
489 (player_bold(y, x) || cave[y][x].m_idx != 0))
493 if (!in_bounds(y, x)) break;
498 /* Advance (X) part 1 */
501 /* Horizontal change */
504 /* Advance (X) part 2 */
507 /* Advance (X) part 3 */
523 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
532 /* Vertical change */
535 /* Advance (Y) part 2 */
538 /* Advance (Y) part 3 */
545 /* Create the projection path */
549 gp[n++] = GRID(y, x);
551 /* Hack -- Check maximum range */
552 if ((n + (k >> 1)) >= range) break;
554 /* Sometimes stop at destination grid */
555 if (!(flg & (PROJECT_THRU)))
557 if ((x == x2) && (y == y2)) break;
560 if (flg & (PROJECT_DISI))
562 if ((n > 0) && cave_stop_disintegration(y, x)) break;
564 else if (flg & (PROJECT_LOS))
566 if ((n > 0) && !cave_los_bold(y, x)) break;
568 else if (!(flg & (PROJECT_PATH)))
570 /* Always stop at non-initial wall grids */
571 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
574 /* Sometimes stop at non-initial monsters/players */
575 if (flg & (PROJECT_STOP))
578 (player_bold(y, x) || cave[y][x].m_idx != 0))
582 if (!in_bounds(y, x)) break;
587 /* Advance (Y) part 1 */
590 /* Vertical change */
593 /* Advance (Y) part 2 */
596 /* Advance (Y) part 3 */
616 /* Create the projection path */
620 gp[n++] = GRID(y, x);
622 /* Hack -- Check maximum range */
623 if ((n + (n >> 1)) >= range) break;
625 /* Sometimes stop at destination grid */
626 if (!(flg & (PROJECT_THRU)))
628 if ((x == x2) && (y == y2)) break;
631 if (flg & (PROJECT_DISI))
633 if ((n > 0) && cave_stop_disintegration(y, x)) break;
635 else if (flg & (PROJECT_LOS))
637 if ((n > 0) && !cave_los_bold(y, x)) break;
639 else if (!(flg & (PROJECT_PATH)))
641 /* Always stop at non-initial wall grids */
642 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
645 /* Sometimes stop at non-initial monsters/players */
646 if (flg & (PROJECT_STOP))
649 (player_bold(y, x) || cave[y][x].m_idx != 0))
653 if (!in_bounds(y, x)) break;
670 * Mega-Hack -- track "affected" monsters (see "project()" comments)
672 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
673 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
674 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
675 /* Mega-Hack -- monsters target */
676 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
677 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
681 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
682 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
683 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
684 * @param y 目標Y座標 / Target y location (or location to travel "towards")
685 * @param x 目標X座標 / Target x location (or location to travel "towards")
686 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
687 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
688 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
691 * We are called both for "beam" effects and "ball" effects.
693 * The "r" parameter is the "distance from ground zero".
695 * Note that we determine if the player can "see" anything that happens
696 * by taking into account: blindness, line-of-sight, and illumination.
698 * We return "TRUE" if the effect of the projection is "obvious".
700 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
702 * XXX XXX XXX Perhaps we should affect doors?
705 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
707 cave_type *c_ptr = &cave[y][x];
708 feature_type *f_ptr = &f_info[c_ptr->feat];
710 bool obvious = FALSE;
711 bool known = player_has_los_bold(y, x);
717 /* Reduce damage by distance */
718 dam = (dam + r) / (r + 1);
721 if (have_flag(f_ptr->flags, FF_TREE))
729 message = _("枯れた", "was blasted."); break;
731 message = _("縮んだ", "shrank."); break;
733 message = _("溶けた", "melted."); break;
736 message = _("凍り、砕け散った", "was frozen and smashed."); break;
740 message = _("燃えた", "burns up!"); break;
752 message = _("粉砕された", "was crushed."); break;
754 message = NULL;break;
758 msg_format(_("木は%s。", "A tree %s"), message);
759 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
762 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
766 /* Analyze the type */
769 /* Ignore most effects */
804 /* Destroy Traps (and Locks) */
807 /* Reveal secret doors */
808 if (is_hidden_door(c_ptr))
813 /* Check line of sight */
821 if (is_trap(c_ptr->feat))
823 /* Check line of sight */
826 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
830 /* Destroy the trap */
831 cave_alter_feat(y, x, FF_DISARM);
834 /* Locked doors are unlocked */
835 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
837 s16b old_feat = c_ptr->feat;
839 /* Unlock the door */
840 cave_alter_feat(y, x, FF_DISARM);
842 /* Check line of sound */
843 if (known && (old_feat != c_ptr->feat))
845 msg_print(_("カチッと音がした!", "Click!"));
850 /* Remove "unsafe" flag if player is not blind */
851 if (!p_ptr->blind && player_has_los_bold(y, x))
853 c_ptr->info &= ~(CAVE_UNSAFE);
864 /* Destroy Doors (and traps) */
867 /* Destroy all doors and traps */
868 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
870 /* Check line of sight */
874 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
878 /* Destroy the feature */
879 cave_alter_feat(y, x, FF_TUNNEL);
882 /* Remove "unsafe" flag if player is not blind */
883 if (!p_ptr->blind && player_has_los_bold(y, x))
885 c_ptr->info &= ~(CAVE_UNSAFE);
896 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
898 if (have_flag(f_ptr->flags, FF_SPIKE))
900 s16b old_mimic = c_ptr->mimic;
901 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
903 cave_alter_feat(y, x, FF_SPIKE);
905 c_ptr->mimic = old_mimic;
913 /* Check line of sight */
914 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
917 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
924 /* Destroy walls (and doors) */
927 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
930 if (known && (c_ptr->info & (CAVE_MARK)))
932 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
936 /* Destroy the wall */
937 cave_alter_feat(y, x, FF_HURT_ROCK);
939 /* Update some things */
940 p_ptr->update |= (PU_FLOW);
949 /* Require a "naked" floor grid */
950 if (!cave_naked_bold(y, x)) break;
952 /* Not on the player */
953 if (player_bold(y, x)) break;
955 /* Create a closed door */
956 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
959 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
976 /* Require a "naked" floor grid */
977 if (!cave_naked_bold(y, x)) break;
979 /* Not on the player */
980 if (player_bold(y, x)) break;
982 /* Create a closed door */
983 cave_set_feat(y, x, feat_tree);
986 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
994 /* Require a "naked" floor grid */
995 if (!cave_naked_bold(y, x)) break;
998 c_ptr->info |= CAVE_OBJECT;
999 c_ptr->mimic = feat_glyph;
1012 /* Require a "naked" floor grid */
1013 if (!cave_naked_bold(y, x)) break;
1015 /* Not on the player */
1016 if (player_bold(y, x)) break;
1019 cave_set_feat(y, x, feat_granite);
1027 /* Ignore permanent grid */
1028 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1033 /* Ignore grid without enough space */
1034 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1036 /* Place a shallow lava */
1037 cave_set_feat(y, x, feat_shallow_lava);
1042 /* Place a deep lava */
1043 cave_set_feat(y, x, feat_deep_lava);
1050 /* Ignore permanent grid */
1051 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1056 /* Ignore grid without enough space */
1057 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1059 /* Place a shallow water */
1060 cave_set_feat(y, x, feat_shallow_water);
1065 /* Place a deep water */
1066 cave_set_feat(y, x, feat_deep_water);
1071 /* Lite up the grid */
1075 /* Turn on the light */
1076 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1078 c_ptr->info |= (CAVE_GLOW);
1086 update_local_illumination(y, x);
1089 if (player_can_see_bold(y, x)) obvious = TRUE;
1091 /* Mega-Hack -- Update the monster in the affected grid */
1092 /* This allows "spear of light" (etc) to work "correctly" */
1093 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1095 if (p_ptr->special_defense & NINJA_S_STEALTH)
1097 if (player_bold(y, x)) set_superstealth(FALSE);
1104 /* Darken the grid */
1108 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1111 /* Turn off the light. */
1114 if (dun_level || !is_daytime())
1116 for (j = 0; j < 9; j++)
1118 int by = y + ddy_ddd[j];
1119 int bx = x + ddx_ddd[j];
1121 if (in_bounds2(by, bx))
1123 cave_type *cc_ptr = &cave[by][bx];
1125 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1133 if (!do_dark) break;
1136 c_ptr->info &= ~(CAVE_GLOW);
1138 /* Hack -- Forget "boring" grids */
1139 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1142 c_ptr->info &= ~(CAVE_MARK);
1151 update_local_illumination(y, x);
1154 if (player_can_see_bold(y, x)) obvious = TRUE;
1156 /* Mega-Hack -- Update the monster in the affected grid */
1157 /* This allows "spear of light" (etc) to work "correctly" */
1158 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1168 if (is_mirror_grid(c_ptr))
1170 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1172 remove_mirror(y, x);
1173 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1176 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1179 if (known && (c_ptr->info & CAVE_MARK))
1181 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1185 /* Destroy the wall */
1186 cave_alter_feat(y, x, FF_HURT_ROCK);
1188 /* Update some things */
1189 p_ptr->update |= (PU_FLOW);
1196 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1198 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1200 remove_mirror(y, x);
1201 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1204 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1207 if (known && (c_ptr->info & CAVE_MARK))
1209 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1213 /* Destroy the wall */
1214 cave_alter_feat(y, x, FF_HURT_ROCK);
1216 /* Update some things */
1217 p_ptr->update |= (PU_FLOW);
1222 case GF_DISINTEGRATE:
1224 /* Destroy mirror/glyph */
1225 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1226 remove_mirror(y, x);
1228 /* Permanent features don't get effect */
1229 /* But not protect monsters and other objects */
1230 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1232 cave_alter_feat(y, x, FF_HURT_DISI);
1234 /* Update some things -- similar to GF_KILL_WALL */
1235 p_ptr->update |= (PU_FLOW);
1242 /* Return "Anything seen?" */
1249 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1250 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1251 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1252 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1253 * @param x 目標X座標 / Target x location (or location to travel "towards")
1254 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1255 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1256 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1259 * We are called from "project()" to "damage" objects
1261 * We are called both for "beam" effects and "ball" effects.
1263 * Perhaps we should only SOMETIMES damage things on the ground.
1265 * The "r" parameter is the "distance from ground zero".
1267 * Note that we determine if the player can "see" anything that happens
1268 * by taking into account: blindness, line-of-sight, and illumination.
1270 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1272 * We return "TRUE" if the effect of the projection is "obvious".
1275 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1277 cave_type *c_ptr = &cave[y][x];
1279 OBJECT_IDX this_o_idx, next_o_idx = 0;
1281 bool obvious = FALSE;
1282 bool known = player_has_los_bold(y, x);
1284 BIT_FLAGS flgs[TR_FLAG_SIZE];
1286 char o_name[MAX_NLEN];
1288 KIND_OBJECT_IDX k_idx = 0;
1289 bool is_potion = FALSE;
1293 who = who ? who : 0;
1295 /* Reduce damage by distance */
1296 dam = (dam + r) / (r + 1);
1299 /* Scan all objects in the grid */
1300 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1302 /* Acquire object */
1303 object_type *o_ptr = &o_list[this_o_idx];
1305 bool is_art = FALSE;
1306 bool ignore = FALSE;
1307 bool do_kill = FALSE;
1309 cptr note_kill = NULL;
1312 /* Get the "plural"-ness */
1313 bool plural = (o_ptr->number > 1);
1316 /* Acquire next object */
1317 next_o_idx = o_ptr->next_o_idx;
1319 /* Extract the flags */
1320 object_flags(o_ptr, flgs);
1322 /* Check for artifact */
1323 if (object_is_artifact(o_ptr)) is_art = TRUE;
1325 /* Analyze the type */
1328 /* Acid -- Lots of things */
1331 if (hates_acid(o_ptr))
1334 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1335 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1340 /* Elec -- Rings and Wands */
1343 if (hates_elec(o_ptr))
1346 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1347 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1352 /* Fire -- Flammable objects */
1355 if (hates_fire(o_ptr))
1358 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1359 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1364 /* Cold -- potions and flasks */
1367 if (hates_cold(o_ptr))
1369 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1371 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1379 if (hates_fire(o_ptr))
1382 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1383 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1385 if (hates_elec(o_ptr))
1389 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1390 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1398 if (hates_fire(o_ptr))
1401 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1402 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1404 if (hates_cold(o_ptr))
1408 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1409 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1414 /* Hack -- break potions and such */
1420 if (hates_cold(o_ptr))
1422 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1428 /* Mana and Chaos -- destroy everything */
1434 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1438 case GF_DISINTEGRATE:
1441 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1448 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1449 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1450 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1454 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1458 if (object_is_cursed(o_ptr))
1461 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1468 identify_item(o_ptr);
1470 /* Auto-inscription */
1471 autopick_alter_item((-this_o_idx), FALSE);
1479 /* Chests are noticed only if trapped or locked */
1480 if (o_ptr->tval == TV_CHEST)
1482 /* Disarm/Unlock traps */
1483 if (o_ptr->pval > 0)
1485 /* Disarm or Unlock */
1486 o_ptr->pval = (0 - o_ptr->pval);
1489 object_known(o_ptr);
1492 if (known && (o_ptr->marked & OM_FOUND))
1494 msg_print(_("カチッと音がした!", "Click!"));
1504 if (o_ptr->tval == TV_CORPSE)
1507 BIT_FLAGS mode = 0L;
1509 if (!who || is_pet(&m_list[who]))
1510 mode |= PM_FORCE_PET;
1512 for (i = 0; i < o_ptr->number ; i++)
1514 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1515 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1519 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1523 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1525 note_kill = _("生き返った。", " revived.");
1527 else if (!note_kill)
1529 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1540 /* Attempt to destroy the object */
1543 /* Effect "observed" */
1544 if (known && (o_ptr->marked & OM_FOUND))
1547 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1550 /* Artifacts, and other objects, get to resist */
1551 if (is_art || ignore)
1553 /* Observe the resist */
1554 if (known && (o_ptr->marked & OM_FOUND))
1556 msg_format(_("%sは影響を受けない!",
1557 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1564 /* Describe if needed */
1565 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1567 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1570 k_idx = o_ptr->k_idx;
1571 is_potion = object_is_potion(o_ptr);
1574 /* Delete the object */
1575 delete_object_idx(this_o_idx);
1577 /* Potions produce effects when 'shattered' */
1580 (void)potion_smash_effect(who, y, x, k_idx);
1589 /* Return "Anything seen?" */
1595 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1596 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1597 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1598 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1599 * @param x 目標X座標 / Target x location (or location to travel "towards")
1600 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1601 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1603 * @param see_s_msg TRUEならばメッセージを表示する
1604 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1607 * This routine takes a "source monster" (by index) which is mostly used to
1608 * determine if the player is causing the damage, and a "radius" (see below),
1609 * which is used to decrease the power of explosions with distance, and a
1610 * location, via integers which are modified by certain types of attacks
1611 * (polymorph and teleport being the obvious ones), a default damage, which
1612 * is modified as needed based on various properties, and finally a "damage
1613 * type" (see below).
1616 * Note that this routine can handle "no damage" attacks (like teleport) by
1617 * taking a "zero" damage, and can even take "parameters" to attacks (like
1618 * confuse) by accepting a "damage", using it to calculate the effect, and
1619 * then setting the damage to zero. Note that the "damage" parameter is
1620 * divided by the radius, so monsters not at the "epicenter" will not take
1621 * as much damage (or whatever)...
1624 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1625 * may result in a dereference of an invalid pointer. XXX XXX XXX
1628 * Various messages are produced, and damage is applied.
1631 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1632 * actually be "made" of that substance, or "breathe" big balls of it.
1633 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1635 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1636 * and hurts evil less. If can breath nether, then it resists it as well.
1639 * Damage reductions use the following formulas:
1640 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1641 * gives avg damage of .655, ranging from .858 to .500
1642 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1643 * gives avg damage of .544, ranging from .714 to .417
1644 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1645 * gives avg damage of .444, ranging from .556 to .333
1646 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1647 * gives avg damage of .327, ranging from .427 to .250
1648 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1649 * gives something simple.
1652 * In this function, "result" messages are postponed until the end, where
1653 * the "note" string is appended to the monster name, if not NULL. So,
1654 * to make a spell have "no effect" just set "note" to NULL. You should
1655 * also set "notice" to FALSE, or the player will learn what the spell does.
1658 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1662 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)
1666 cave_type *c_ptr = &cave[y][x];
1668 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1669 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1671 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1675 /* Is the monster "seen"? */
1676 bool seen = m_ptr->ml;
1677 bool seen_msg = is_seen(m_ptr);
1679 bool slept = (bool)MON_CSLEEP(m_ptr);
1681 /* Were the effects "obvious" (if seen)? */
1682 bool obvious = FALSE;
1684 /* Can the player know about this effect? */
1685 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1687 /* Were the effects "irrelevant"? */
1688 bool skipped = FALSE;
1690 /* Gets the monster angry at the source of the effect? */
1691 bool get_angry = FALSE;
1693 /* Polymorph setting (true or false) */
1694 bool do_poly = FALSE;
1696 /* Teleport setting (max distance) */
1699 /* Confusion setting (amount to confuse) */
1702 /* Stunning setting (amount to stun) */
1705 /* Sleep amount (amount to sleep) */
1708 /* Fear amount (amount to fear) */
1711 /* Time amount (amount to time) */
1714 bool heal_leper = FALSE;
1716 /* Hold the monster name */
1720 PARAMETER_VALUE photo = 0;
1722 /* Assume no note */
1725 /* Assume a default death */
1726 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1731 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1734 if (!c_ptr->m_idx) return (FALSE);
1736 /* Never affect projector */
1737 if (who && (c_ptr->m_idx == who)) return (FALSE);
1738 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1739 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1741 /* Don't affect already death monsters */
1742 /* Prevents problems with chain reactions of exploding monsters */
1743 if (m_ptr->hp < 0) return (FALSE);
1745 /* Reduce damage by distance */
1746 dam = (dam + r) / (r + 1);
1749 /* Get the monster name (BEFORE polymorphing) */
1750 monster_desc(m_name, m_ptr, 0);
1752 /* Get the monster possessive ("his"/"her"/"its") */
1753 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1755 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1757 /* Analyze the damage type */
1760 /* Magic Missile -- pure damage */
1763 if (seen) obvious = TRUE;
1765 if (r_ptr->flagsr & RFR_RES_ALL)
1767 note = _("には完全な耐性がある!", " is immune.");
1769 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1778 if (seen) obvious = TRUE;
1780 if (r_ptr->flagsr & RFR_RES_ALL)
1782 note = _("には完全な耐性がある!", " is immune.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1787 if (r_ptr->flagsr & RFR_IM_ACID)
1789 note = _("にはかなり耐性がある!", " resists a lot.");
1791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1799 if (seen) obvious = TRUE;
1801 if (r_ptr->flagsr & RFR_RES_ALL)
1803 note = _("には完全な耐性がある!", " is immune.");
1805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1808 if (r_ptr->flagsr & RFR_IM_ELEC)
1810 note = _("にはかなり耐性がある!", " resists a lot.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1820 if (seen) obvious = TRUE;
1822 if (r_ptr->flagsr & RFR_RES_ALL)
1824 note = _("には完全な耐性がある!", " is immune.");
1826 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1829 if (r_ptr->flagsr & RFR_IM_FIRE)
1831 note = _("にはかなり耐性がある!", " resists a lot.");
1833 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1835 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1837 note = _("はひどい痛手をうけた。", " is hit hard.");
1839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1847 if (seen) obvious = TRUE;
1849 if (r_ptr->flagsr & RFR_RES_ALL)
1851 note = _("には完全な耐性がある!", " is immune.");
1853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1856 if (r_ptr->flagsr & RFR_IM_COLD)
1858 note = _("にはかなり耐性がある!", " resists a lot.");
1860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1862 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1864 note = _("はひどい痛手をうけた。", " is hit hard.");
1866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1874 if (seen) obvious = TRUE;
1876 if (r_ptr->flagsr & RFR_RES_ALL)
1878 note = _("には完全な耐性がある!", " is immune.");
1880 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1883 if (r_ptr->flagsr & RFR_IM_POIS)
1885 note = _("にはかなり耐性がある!", " resists a lot.");
1887 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1895 if (seen) obvious = TRUE;
1897 if (r_ptr->flagsr & RFR_RES_ALL)
1899 note = _("には完全な耐性がある!", " is immune.");
1901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1904 if (r_ptr->flagsr & RFR_IM_POIS)
1906 note = _("には耐性がある。", " resists.");
1907 dam *= 3; dam /= randint1(6) + 6;
1908 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1910 else if (one_in_(3)) do_poly = TRUE;
1914 /* Hellfire -- hurts Evil */
1917 if (seen) obvious = TRUE;
1919 if (r_ptr->flagsr & RFR_RES_ALL)
1921 note = _("には完全な耐性がある!", " is immune.");
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1926 if (r_ptr->flags3 & RF3_GOOD)
1928 note = _("はひどい痛手をうけた。", " is hit hard.");
1930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1935 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1938 if (seen) obvious = TRUE;
1940 if (r_ptr->flagsr & RFR_RES_ALL)
1942 note = _("には完全な耐性がある!", " is immune.");
1944 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1947 if (r_ptr->flags3 & RF3_GOOD)
1949 note = _("には完全な耐性がある!", " is immune.");
1951 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1953 else if (r_ptr->flags3 & RF3_EVIL)
1956 note = _("はひどい痛手をうけた。", " is hit hard.");
1957 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1961 note = _("には耐性がある。", " resists.");
1962 dam *= 3; dam /= randint1(6) + 6;
1967 /* Arrow -- XXX no defense */
1970 if (seen) obvious = TRUE;
1972 if (r_ptr->flagsr & RFR_RES_ALL)
1974 note = _("には完全な耐性がある!", " is immune.");
1976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1982 /* Plasma -- XXX perhaps check ELEC or FIRE */
1985 if (seen) obvious = TRUE;
1987 if (r_ptr->flagsr & RFR_RES_ALL)
1989 note = _("には完全な耐性がある!", " is immune.");
1991 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1994 if (r_ptr->flagsr & RFR_RES_PLAS)
1996 note = _("には耐性がある。", " resists.");
1997 dam *= 3; dam /= randint1(6) + 6;
1998 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2003 /* Nether -- see above */
2006 if (seen) obvious = TRUE;
2008 if (r_ptr->flagsr & RFR_RES_ALL)
2010 note = _("には完全な耐性がある!", " is immune.");
2012 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2015 if (r_ptr->flagsr & RFR_RES_NETH)
2017 if (r_ptr->flags3 & RF3_UNDEAD)
2019 note = _("には完全な耐性がある!", " is immune.");
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2025 note = _("には耐性がある。", " resists.");
2026 dam *= 3; dam /= randint1(6) + 6;
2028 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2030 else if (r_ptr->flags3 & RF3_EVIL)
2032 note = _("はいくらか耐性を示した。", " resists somewhat.");
2034 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2039 /* Water (acid) damage -- Water spirits/elementals are immune */
2042 if (seen) obvious = TRUE;
2044 if (r_ptr->flagsr & RFR_RES_ALL)
2046 note = _("には完全な耐性がある!", " is immune.");
2048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2051 if (r_ptr->flagsr & RFR_RES_WATE)
2053 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2055 note = _("には完全な耐性がある!", " is immune.");
2060 note = _("には耐性がある。", " resists.");
2061 dam *= 3; dam /= randint1(6) + 6;
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2068 /* Chaos -- Chaos breathers resist */
2071 if (seen) obvious = TRUE;
2073 if (r_ptr->flagsr & RFR_RES_ALL)
2075 note = _("には完全な耐性がある!", " is immune.");
2077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2080 if (r_ptr->flagsr & RFR_RES_CHAO)
2082 note = _("には耐性がある。", " resists.");
2083 dam *= 3; dam /= randint1(6) + 6;
2084 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2086 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2088 note = _("はいくらか耐性を示した。", " resists somewhat.");
2089 dam *= 3; dam /= randint1(6) + 6;
2090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2095 do_conf = (5 + randint1(11) + r) / (r + 1);
2100 /* Shards -- Shard breathers resist */
2103 if (seen) obvious = TRUE;
2105 if (r_ptr->flagsr & RFR_RES_ALL)
2107 note = _("には完全な耐性がある!", " is immune.");
2109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2112 if (r_ptr->flagsr & RFR_RES_SHAR)
2114 note = _("には耐性がある。", " resists.");
2115 dam *= 3; dam /= randint1(6) + 6;
2116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2121 /* Rocket: Shard resistance helps */
2124 if (seen) obvious = TRUE;
2126 if (r_ptr->flagsr & RFR_RES_ALL)
2128 note = _("には完全な耐性がある!", " is immune.");
2130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2133 if (r_ptr->flagsr & RFR_RES_SHAR)
2135 note = _("はいくらか耐性を示した。", " resists somewhat.");
2137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2143 /* Sound -- Sound breathers resist */
2146 if (seen) obvious = TRUE;
2148 if (r_ptr->flagsr & RFR_RES_ALL)
2150 note = _("には完全な耐性がある!", " is immune.");
2152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2155 if (r_ptr->flagsr & RFR_RES_SOUN)
2157 note = _("には耐性がある。", " resists.");
2158 dam *= 2; dam /= randint1(6) + 6;
2159 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2161 else do_stun = (10 + randint1(15) + r) / (r + 1);
2168 if (seen) obvious = TRUE;
2170 if (r_ptr->flagsr & RFR_RES_ALL)
2172 note = _("には完全な耐性がある!", " is immune.");
2174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2177 if (r_ptr->flags3 & RF3_NO_CONF)
2179 note = _("には耐性がある。", " resists.");
2180 dam *= 3; dam /= randint1(6) + 6;
2181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2183 else do_conf = (10 + randint1(15) + r) / (r + 1);
2187 /* Disenchantment -- Breathers and Disenchanters resist */
2190 if (seen) obvious = TRUE;
2192 if (r_ptr->flagsr & RFR_RES_ALL)
2194 note = _("には完全な耐性がある!", " is immune.");
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2199 if (r_ptr->flagsr & RFR_RES_DISE)
2201 note = _("には耐性がある。", " resists.");
2202 dam *= 3; dam /= randint1(6) + 6;
2203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2208 /* Nexus -- Breathers and Existers resist */
2211 if (seen) obvious = TRUE;
2213 if (r_ptr->flagsr & RFR_RES_ALL)
2215 note = _("には完全な耐性がある!", " is immune.");
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2220 if (r_ptr->flagsr & RFR_RES_NEXU)
2222 note = _("には耐性がある。", " resists.");
2223 dam *= 3; dam /= randint1(6) + 6;
2224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2232 if (seen) obvious = TRUE;
2234 if (r_ptr->flagsr & RFR_RES_ALL)
2236 note = _("には完全な耐性がある!", " is immune.");
2238 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2241 if (r_ptr->flagsr & RFR_RES_WALL)
2243 note = _("には耐性がある。", " resists.");
2244 dam *= 3; dam /= randint1(6) + 6;
2245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2247 else do_stun = (randint1(15) + r) / (r + 1);
2251 /* Inertia -- breathers resist */
2254 if (seen) obvious = TRUE;
2256 if (r_ptr->flagsr & RFR_RES_ALL)
2258 note = _("には完全な耐性がある!", " is immune.");
2260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2263 if (r_ptr->flagsr & RFR_RES_INER)
2265 note = _("には耐性がある。", " resists.");
2266 dam *= 3; dam /= randint1(6) + 6;
2267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2271 /* Powerful monsters can resist */
2272 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2273 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2277 /* Normal monsters slow down */
2280 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2282 note = _("の動きが遅くなった。", " starts moving slower.");
2289 /* Time -- breathers resist */
2292 if (seen) obvious = TRUE;
2294 if (r_ptr->flagsr & RFR_RES_ALL)
2296 note = _("には完全な耐性がある!", " is immune.");
2298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2301 if (r_ptr->flagsr & RFR_RES_TIME)
2303 note = _("には耐性がある。", " resists.");
2304 dam *= 3; dam /= randint1(6) + 6;
2305 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2307 else do_time = (dam + 1) / 2;
2311 /* Gravity -- breathers resist */
2314 bool resist_tele = FALSE;
2316 if (seen) obvious = TRUE;
2318 if (r_ptr->flagsr & RFR_RES_ALL)
2320 note = _("には完全な耐性がある!", " is immune.");
2322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2325 if (r_ptr->flagsr & RFR_RES_TELE)
2327 if (r_ptr->flags1 & (RF1_UNIQUE))
2329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2330 note = _("には効果がなかった。", " is unaffected!");
2333 else if (r_ptr->level > randint1(100))
2335 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2336 note = _("には耐性がある!", " resists!");
2341 if (!resist_tele) do_dist = 10;
2343 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2345 if (r_ptr->flagsr & RFR_RES_GRAV)
2347 note = _("には耐性がある!", " resists!");
2348 dam *= 3; dam /= randint1(6) + 6;
2350 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2355 /* Powerful monsters can resist */
2356 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2357 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2361 /* Normal monsters slow down */
2364 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2366 note = _("の動きが遅くなった。", " starts moving slower.");
2371 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2373 /* Attempt a saving throw */
2374 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2375 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2379 /* No obvious effect */
2380 note = _("には効果がなかった。", " is unaffected!");
2392 if (seen) obvious = TRUE;
2394 if (r_ptr->flagsr & RFR_RES_ALL)
2396 note = _("には完全な耐性がある!", " is immune.");
2398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2406 case GF_DISINTEGRATE:
2408 if (seen) obvious = TRUE;
2410 if (r_ptr->flagsr & RFR_RES_ALL)
2412 note = _("には完全な耐性がある!", " is immune.");
2414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2417 if (r_ptr->flags3 & RF3_HURT_ROCK)
2419 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2420 note = _("の皮膚がただれた!", " loses some skin!");
2421 note_dies = _("は蒸発した!", " evaporates!");
2429 if (seen) obvious = TRUE;
2431 /* PSI only works if the monster can see you! -- RG */
2432 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2435 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2440 if (r_ptr->flagsr & RFR_RES_ALL)
2442 note = _("には完全な耐性がある!", " is immune.");
2444 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2447 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2450 note = _("には完全な耐性がある!", " is immune.");
2451 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2454 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2455 (r_ptr->flags3 & RF3_ANIMAL) ||
2456 (r_ptr->level > randint1(3 * dam)))
2458 note = _("には耐性がある!", " resists!");
2462 * Powerful demons & undead can turn a mindcrafter's
2463 * attacks back on them
2465 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2466 (r_ptr->level > p_ptr->lev / 2) &&
2470 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2471 (seen ? "%^s's corrupted mind backlashes your attack!" :
2472 "%^ss corrupted mind backlashes your attack!")), m_name);
2475 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2477 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2481 /* Injure +/- confusion */
2482 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2483 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2484 if (one_in_(4) && !CHECK_MULTISHADOW())
2486 switch (randint1(4))
2489 set_confused(p_ptr->confused + 3 + randint1(dam));
2492 set_stun(p_ptr->stun + randint1(dam));
2496 if (r_ptr->flags3 & RF3_NO_FEAR)
2497 note = _("には効果がなかった。", " is unaffected.");
2499 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2503 if (!p_ptr->free_act)
2504 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2513 if ((dam > 0) && one_in_(4))
2515 switch (randint1(4))
2518 do_conf = 3 + randint1(dam);
2521 do_stun = 3 + randint1(dam);
2524 do_fear = 3 + randint1(dam);
2527 note = _("は眠り込んでしまった!", " falls asleep!");
2528 do_sleep = 3 + randint1(dam);
2533 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2539 if (seen) obvious = TRUE;
2541 if (r_ptr->flagsr & RFR_RES_ALL)
2543 note = _("には完全な耐性がある!", " is immune.");
2545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2548 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2551 note = _("には完全な耐性がある!", " is immune.");
2553 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2554 (r_ptr->flags3 & RF3_ANIMAL) ||
2555 (r_ptr->level > randint1(3 * dam)))
2557 note = _("には耐性がある!", " resists!");
2561 * Powerful demons & undead can turn a mindcrafter's
2562 * attacks back on them
2564 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2565 (r_ptr->level > p_ptr->lev / 2) &&
2569 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2570 (seen ? "%^s's corrupted mind backlashes your attack!" :
2571 "%^ss corrupted mind backlashes your attack!")), m_name);
2573 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2575 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2579 /* Injure + mana drain */
2580 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2581 if (!CHECK_MULTISHADOW())
2583 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2584 p_ptr->csp -= damroll(5, dam) / 2;
2585 if (p_ptr->csp < 0) p_ptr->csp = 0;
2586 p_ptr->redraw |= PR_MANA;
2587 p_ptr->window |= (PW_SPELL);
2589 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2596 int b = damroll(5, dam) / 4;
2597 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2598 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2599 (seen ? "You convert %s's pain into %s!" :
2600 "You convert %ss pain into %s!"));
2601 msg_format(msg, m_name, str);
2603 b = MIN(p_ptr->msp, p_ptr->csp + b);
2605 p_ptr->redraw |= PR_MANA;
2606 p_ptr->window |= (PW_SPELL);
2608 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2612 case GF_TELEKINESIS:
2614 if (seen) obvious = TRUE;
2616 if (r_ptr->flagsr & RFR_RES_ALL)
2618 note = _("には完全な耐性がある!", " is immune.");
2620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2625 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2630 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2632 /* Attempt a saving throw */
2633 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2634 (r_ptr->level > 5 + randint1(dam)))
2638 /* No obvious effect */
2644 /* Psycho-spear -- powerful magic missile */
2647 if (seen) obvious = TRUE;
2649 if (r_ptr->flagsr & RFR_RES_ALL)
2651 note = _("には完全な耐性がある!", " is immune.");
2653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2659 /* Meteor -- powerful magic missile */
2662 if (seen) obvious = TRUE;
2664 if (r_ptr->flagsr & RFR_RES_ALL)
2666 note = _("には完全な耐性がある!", " is immune.");
2668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2676 if (!is_hostile(m_ptr)) break;
2678 if (seen) obvious = TRUE;
2680 if (r_ptr->flagsr & RFR_RES_ALL)
2682 note = _("には効果がなかった!", " is immune.");
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2687 /* Attempt a saving throw */
2688 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2689 (r_ptr->flags3 & RF3_NO_CONF) ||
2690 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2692 /* Memorize a flag */
2693 if (r_ptr->flags3 & RF3_NO_CONF)
2695 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2702 * Powerful demons & undead can turn a mindcrafter's
2703 * attacks back on them
2705 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2706 (r_ptr->level > p_ptr->lev / 2) &&
2710 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2711 (seen ? "%^s's corrupted mind backlashes your attack!" :
2712 "%^ss corrupted mind backlashes your attack!")), m_name);
2715 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2717 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2721 /* Confuse, stun, terrify */
2722 switch (randint1(4))
2725 set_stun(p_ptr->stun + dam / 2);
2728 set_confused(p_ptr->confused + dam / 2);
2732 if (r_ptr->flags3 & RF3_NO_FEAR)
2733 note = _("には効果がなかった。", " is unaffected.");
2735 set_afraid(p_ptr->afraid + dam);
2742 /* No obvious effect */
2743 note = _("には効果がなかった。", " is unaffected.");
2749 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2751 note = _("があなたに隷属した。", " is in your thrall!");
2756 switch (randint1(4))
2770 /* No "real" damage */
2777 /* Ice -- Cold + Cuts + Stun */
2780 if (seen) obvious = TRUE;
2782 if (r_ptr->flagsr & RFR_RES_ALL)
2784 note = _("には完全な耐性がある!", " is immune.");
2786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2789 do_stun = (randint1(15) + 1) / (r + 1);
2790 if (r_ptr->flagsr & RFR_IM_COLD)
2792 note = _("にはかなり耐性がある!", " resists a lot.");
2794 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2796 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2798 note = _("はひどい痛手をうけた。", " is hit hard.");
2800 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2807 case GF_HYPODYNAMIA:
2809 if (seen) obvious = TRUE;
2811 if (r_ptr->flagsr & RFR_RES_ALL)
2813 note = _("には完全な耐性がある!", " is immune.");
2815 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2818 if (!monster_living(r_ptr))
2820 if (is_original_ap_and_seen(m_ptr))
2822 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2823 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2824 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2826 note = _("には効果がなかった。", " is unaffected.");
2830 else do_time = (dam+7)/8;
2838 if (seen) obvious = TRUE;
2840 if (r_ptr->flagsr & RFR_RES_ALL)
2842 note = _("には完全な耐性がある!", " is immune.");
2844 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2847 if (!monster_living(r_ptr))
2849 if (is_original_ap_and_seen(m_ptr))
2851 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2852 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2853 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2855 note = _("には完全な耐性がある!", " is immune.");
2859 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2860 (randint1(888) != 666)) ||
2861 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2862 randint1(100) != 66))
2864 note = _("には耐性がある!", " resists!");
2872 /* Polymorph monster (Use "dam" as "power") */
2875 if (seen) obvious = TRUE;
2877 if (r_ptr->flagsr & RFR_RES_ALL)
2879 note = _("には効果がなかった。", " is unaffected.");
2881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2884 /* Attempt to polymorph (see below) */
2887 /* Powerful monsters can resist */
2888 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2889 (r_ptr->flags1 & RF1_QUESTOR) ||
2890 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2892 note = _("には効果がなかった。", " is unaffected.");
2897 /* No "real" damage */
2904 /* Clone monsters (Ignore "dam") */
2907 if (seen) obvious = TRUE;
2909 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2911 note = _("には効果がなかった。", " is unaffected.");
2916 m_ptr->hp = m_ptr->maxhp;
2918 /* Attempt to clone. */
2919 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2921 note = _("が分裂した!", " spawns!");
2925 /* No "real" damage */
2932 /* Heal Monster (use "dam" as amount of healing) */
2935 if (seen) obvious = TRUE;
2938 (void)set_monster_csleep(c_ptr->m_idx, 0);
2940 if (m_ptr->maxhp < m_ptr->max_maxhp)
2942 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2943 m_ptr->maxhp = m_ptr->max_maxhp;
2948 /* Redraw (later) if needed */
2949 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2950 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2958 if (seen) obvious = TRUE;
2961 (void)set_monster_csleep(c_ptr->m_idx, 0);
2962 if (MON_STUNNED(m_ptr))
2964 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2965 (void)set_monster_stunned(c_ptr->m_idx, 0);
2967 if (MON_CONFUSED(m_ptr))
2969 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2970 (void)set_monster_confused(c_ptr->m_idx, 0);
2972 if (MON_MONFEAR(m_ptr))
2974 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2975 (void)set_monster_monfear(c_ptr->m_idx, 0);
2979 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2982 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2986 chg_virtue(V_VITALITY, 1);
2988 if (r_ptr->flags1 & RF1_UNIQUE)
2989 chg_virtue(V_INDIVIDUALISM, 1);
2991 if (is_friendly(m_ptr))
2992 chg_virtue(V_HONOUR, 1);
2993 else if (!(r_ptr->flags3 & RF3_EVIL))
2995 if (r_ptr->flags3 & RF3_GOOD)
2996 chg_virtue(V_COMPASSION, 2);
2998 chg_virtue(V_COMPASSION, 1);
3001 if (r_ptr->flags3 & RF3_ANIMAL)
3002 chg_virtue(V_NATURE, 1);
3005 if (m_ptr->r_idx == MON_LEPER)
3008 if (!who) chg_virtue(V_COMPASSION, 5);
3011 /* Redraw (later) if needed */
3012 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3013 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3016 note = _("は体力を回復したようだ。", " looks healthier.");
3018 /* No "real" damage */
3024 /* Speed Monster (Ignore "dam") */
3027 if (seen) obvious = TRUE;
3030 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3032 note = _("の動きが速くなった。", " starts moving faster.");
3037 if (r_ptr->flags1 & RF1_UNIQUE)
3038 chg_virtue(V_INDIVIDUALISM, 1);
3039 if (is_friendly(m_ptr))
3040 chg_virtue(V_HONOUR, 1);
3043 /* No "real" damage */
3049 /* Slow Monster (Use "dam" as "power") */
3052 if (seen) obvious = TRUE;
3054 if (r_ptr->flagsr & RFR_RES_ALL)
3056 note = _("には効果がなかった。", " is unaffected.");
3058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3061 /* Powerful monsters can resist */
3062 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3063 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3065 note = _("には効果がなかった。", " is unaffected.");
3069 /* Normal monsters slow down */
3072 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3074 note = _("の動きが遅くなった。", " starts moving slower.");
3078 /* No "real" damage */
3084 /* Sleep (Use "dam" as "power") */
3087 if (seen) obvious = TRUE;
3089 if (r_ptr->flagsr & RFR_RES_ALL)
3091 note = _("には効果がなかった。", " is unaffected.");
3093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3096 /* Attempt a saving throw */
3097 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3098 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3099 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3101 /* Memorize a flag */
3102 if (r_ptr->flags3 & RF3_NO_SLEEP)
3104 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3106 /* No obvious effect */
3107 note = _("には効果がなかった。", " is unaffected.");
3112 /* Go to sleep (much) later */
3113 note = _("は眠り込んでしまった!", " falls asleep!");
3117 /* No "real" damage */
3123 /* Sleep (Use "dam" as "power") */
3124 case GF_STASIS_EVIL:
3126 if (seen) obvious = TRUE;
3128 if (r_ptr->flagsr & RFR_RES_ALL)
3130 note = _("には効果がなかった!", " is immune.");
3132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3135 /* Attempt a saving throw */
3136 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3137 !(r_ptr->flags3 & RF3_EVIL) ||
3138 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3140 note = _("には効果がなかった。", " is unaffected.");
3145 /* Go to sleep (much) later */
3146 note = _("は動けなくなった!", " is suspended!");
3150 /* No "real" damage */
3155 /* Sleep (Use "dam" as "power") */
3158 if (seen) obvious = TRUE;
3160 if (r_ptr->flagsr & RFR_RES_ALL)
3162 note = _("には効果がなかった。", " is unaffected.");
3164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3167 /* Attempt a saving throw */
3168 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3169 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3171 note = _("には効果がなかった。", " is unaffected.");
3176 /* Go to sleep (much) later */
3177 note = _("は動けなくなった!", " is suspended!");
3181 /* No "real" damage */
3190 vir = virtue_number(V_HARMONY);
3193 dam += p_ptr->virtues[vir-1]/10;
3196 vir = virtue_number(V_INDIVIDUALISM);
3199 dam -= p_ptr->virtues[vir-1]/20;
3202 if (seen) obvious = TRUE;
3204 /* Attempt a saving throw */
3205 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3209 /* No obvious effect */
3210 note = _("には効果がなかった。", " is unaffected.");
3213 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3215 else if (p_ptr->cursed & TRC_AGGRAVATE)
3217 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3218 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3222 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3225 chg_virtue(V_INDIVIDUALISM, -1);
3226 if (r_ptr->flags3 & RF3_ANIMAL)
3227 chg_virtue(V_NATURE, 1);
3230 /* No "real" damage */
3235 /* Control undead */
3236 case GF_CONTROL_UNDEAD:
3239 if (seen) obvious = TRUE;
3241 vir = virtue_number(V_UNLIFE);
3244 dam += p_ptr->virtues[vir-1]/10;
3247 vir = virtue_number(V_INDIVIDUALISM);
3250 dam -= p_ptr->virtues[vir-1]/20;
3253 /* Attempt a saving throw */
3254 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3255 !(r_ptr->flags3 & RF3_UNDEAD))
3257 /* No obvious effect */
3258 note = _("には効果がなかった。", " is unaffected.");
3260 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3262 else if (p_ptr->cursed & TRC_AGGRAVATE)
3264 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3265 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3269 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3273 /* No "real" damage */
3279 case GF_CONTROL_DEMON:
3282 if (seen) obvious = TRUE;
3284 vir = virtue_number(V_UNLIFE);
3287 dam += p_ptr->virtues[vir-1]/10;
3290 vir = virtue_number(V_INDIVIDUALISM);
3293 dam -= p_ptr->virtues[vir-1]/20;
3296 /* Attempt a saving throw */
3297 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3298 !(r_ptr->flags3 & RF3_DEMON))
3300 /* No obvious effect */
3301 note = _("には効果がなかった。", " is unaffected.");
3303 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3305 else if (p_ptr->cursed & TRC_AGGRAVATE)
3307 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3308 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3312 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3316 /* No "real" damage */
3322 case GF_CONTROL_ANIMAL:
3325 if (seen) obvious = TRUE;
3327 vir = virtue_number(V_NATURE);
3330 dam += p_ptr->virtues[vir-1]/10;
3333 vir = virtue_number(V_INDIVIDUALISM);
3336 dam -= p_ptr->virtues[vir-1]/20;
3339 /* Attempt a saving throw */
3340 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3341 !(r_ptr->flags3 & RF3_ANIMAL))
3344 /* No obvious effect */
3345 note = _("には効果がなかった。", " is unaffected.");
3347 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3349 else if (p_ptr->cursed & TRC_AGGRAVATE)
3351 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3352 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3356 note = _("はなついた。", " is tamed!");
3358 if (r_ptr->flags3 & RF3_ANIMAL)
3359 chg_virtue(V_NATURE, 1);
3362 /* No "real" damage */
3368 case GF_CHARM_LIVING:
3372 vir = virtue_number(V_UNLIFE);
3373 if (seen) obvious = TRUE;
3375 vir = virtue_number(V_UNLIFE);
3378 dam -= p_ptr->virtues[vir-1]/10;
3381 vir = virtue_number(V_INDIVIDUALISM);
3384 dam -= p_ptr->virtues[vir-1]/20;
3387 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3389 /* Attempt a saving throw */
3390 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3391 !monster_living(r_ptr))
3394 /* No obvious effect */
3395 note = _("には効果がなかった。", " is unaffected.");
3397 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3399 else if (p_ptr->cursed & TRC_AGGRAVATE)
3401 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3402 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3406 note = _("を支配した。", " is tamed!");
3408 if (r_ptr->flags3 & RF3_ANIMAL)
3409 chg_virtue(V_NATURE, 1);
3412 /* No "real" damage */
3417 /* Confusion (Use "dam" as "power") */
3420 if (seen) obvious = TRUE;
3422 if (r_ptr->flagsr & RFR_RES_ALL)
3424 note = _("には効果がなかった。", " is unaffected.");
3426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3429 /* Get confused later */
3430 do_conf = damroll(3, (dam / 2)) + 1;
3432 /* Attempt a saving throw */
3433 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3434 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3435 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3437 /* Memorize a flag */
3438 if (r_ptr->flags3 & (RF3_NO_CONF))
3440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3446 /* No obvious effect */
3447 note = _("には効果がなかった。", " is unaffected.");
3451 /* No "real" damage */
3458 if (seen) obvious = TRUE;
3460 if (r_ptr->flagsr & RFR_RES_ALL)
3462 note = _("には効果がなかった。", " is unaffected.");
3464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3467 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3469 /* Attempt a saving throw */
3470 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3471 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3476 /* No obvious effect */
3477 note = _("には効果がなかった。", " is unaffected.");
3481 /* No "real" damage */
3489 /* Lite, but only hurts susceptible creatures */
3497 if (r_ptr->flagsr & RFR_RES_ALL)
3503 if (r_ptr->flags3 & (RF3_HURT_LITE))
3505 /* Obvious effect */
3506 if (seen) obvious = TRUE;
3508 /* Memorize the effects */
3509 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3511 /* Special effect */
3512 note = _("は光に身をすくめた!", " cringes from the light!");
3513 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3516 /* Normally no damage */
3528 /* Lite -- opposite of Dark */
3531 if (seen) obvious = TRUE;
3533 if (r_ptr->flagsr & RFR_RES_ALL)
3535 note = _("には完全な耐性がある!", " is immune.");
3537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3540 if (r_ptr->flagsr & RFR_RES_LITE)
3542 note = _("には耐性がある!", " resists!");
3543 dam *= 2; dam /= (randint1(6)+6);
3544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3546 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3548 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3549 note = _("は光に身をすくめた!", " cringes from the light!");
3550 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3557 /* Dark -- opposite of Lite */
3560 if (seen) obvious = TRUE;
3562 if (r_ptr->flagsr & RFR_RES_ALL)
3564 note = _("には完全な耐性がある!", " is immune.");
3566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3569 if (r_ptr->flagsr & RFR_RES_DARK)
3571 note = _("には耐性がある!", " resists!");
3572 dam *= 2; dam /= (randint1(6)+6);
3573 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3582 if (r_ptr->flagsr & RFR_RES_ALL)
3587 /* Hurt by rock remover */
3588 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3591 if (seen) obvious = TRUE;
3593 /* Memorize the effects */
3594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3596 /* Cute little message */
3597 note = _("の皮膚がただれた!", " loses some skin!");
3598 note_dies = _("はドロドロに溶けた!", " dissolves!");
3601 /* Usually, ignore the effects */
3612 /* Teleport undead (Use "dam" as "power") */
3613 case GF_AWAY_UNDEAD:
3615 /* Only affect undead */
3616 if (r_ptr->flags3 & (RF3_UNDEAD))
3618 bool resists_tele = FALSE;
3620 if (r_ptr->flagsr & RFR_RES_TELE)
3622 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3625 note = _("には効果がなかった。", " is unaffected.");
3626 resists_tele = TRUE;
3628 else if (r_ptr->level > randint1(100))
3630 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3631 note = _("には耐性がある!", " resists!");
3632 resists_tele = TRUE;
3638 if (seen) obvious = TRUE;
3639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3651 /* No "real" damage */
3657 /* Teleport evil (Use "dam" as "power") */
3660 /* Only affect evil */
3661 if (r_ptr->flags3 & (RF3_EVIL))
3663 bool resists_tele = FALSE;
3665 if (r_ptr->flagsr & RFR_RES_TELE)
3667 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3670 note = _("には効果がなかった。", " is unaffected.");
3671 resists_tele = TRUE;
3673 else if (r_ptr->level > randint1(100))
3675 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3676 note = _("には耐性がある!", " resists!");
3677 resists_tele = TRUE;
3683 if (seen) obvious = TRUE;
3684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3696 /* No "real" damage */
3702 /* Teleport monster (Use "dam" as "power") */
3705 bool resists_tele = FALSE;
3706 if (r_ptr->flagsr & RFR_RES_TELE)
3708 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3710 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3711 note = _("には効果がなかった。", " is unaffected.");
3712 resists_tele = TRUE;
3714 else if (r_ptr->level > randint1(100))
3716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3717 note = _("には耐性がある!", " resists!");
3718 resists_tele = TRUE;
3725 if (seen) obvious = TRUE;
3727 /* Prepare to teleport */
3731 /* No "real" damage */
3737 /* Turn undead (Use "dam" as "power") */
3738 case GF_TURN_UNDEAD:
3740 if (r_ptr->flagsr & RFR_RES_ALL)
3745 /* Only affect undead */
3746 if (r_ptr->flags3 & (RF3_UNDEAD))
3749 if (seen) obvious = TRUE;
3751 /* Learn about type */
3752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3754 /* Apply some fear */
3755 do_fear = damroll(3, (dam / 2)) + 1;
3757 /* Attempt a saving throw */
3758 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3760 /* No obvious effect */
3761 note = _("には効果がなかった。", " is unaffected.");
3774 /* No "real" damage */
3780 /* Turn evil (Use "dam" as "power") */
3783 if (r_ptr->flagsr & RFR_RES_ALL)
3788 /* Only affect evil */
3789 if (r_ptr->flags3 & (RF3_EVIL))
3792 if (seen) obvious = TRUE;
3794 /* Learn about type */
3795 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3797 /* Apply some fear */
3798 do_fear = damroll(3, (dam / 2)) + 1;
3800 /* Attempt a saving throw */
3801 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3803 /* No obvious effect */
3804 note = _("には効果がなかった。", " is unaffected.");
3817 /* No "real" damage */
3823 /* Turn monster (Use "dam" as "power") */
3826 if (r_ptr->flagsr & RFR_RES_ALL)
3832 if (seen) obvious = TRUE;
3834 /* Apply some fear */
3835 do_fear = damroll(3, (dam / 2)) + 1;
3837 /* Attempt a saving throw */
3838 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3839 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3840 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3842 /* No obvious effect */
3843 note = _("には効果がなかった。", " is unaffected.");
3848 /* No "real" damage */
3855 case GF_DISP_UNDEAD:
3857 if (r_ptr->flagsr & RFR_RES_ALL)
3863 /* Only affect undead */
3864 if (r_ptr->flags3 & (RF3_UNDEAD))
3867 if (seen) obvious = TRUE;
3869 /* Learn about type */
3870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3873 note = _("は身震いした。", " shudders.");
3874 note_dies = _("はドロドロに溶けた!", " dissolves!");
3894 if (r_ptr->flagsr & RFR_RES_ALL)
3900 /* Only affect evil */
3901 if (r_ptr->flags3 & (RF3_EVIL))
3904 if (seen) obvious = TRUE;
3906 /* Learn about type */
3907 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3910 note = _("は身震いした。", " shudders.");
3911 note_dies = _("はドロドロに溶けた!", " dissolves!");
3930 if (r_ptr->flagsr & RFR_RES_ALL)
3936 /* Only affect good */
3937 if (r_ptr->flags3 & (RF3_GOOD))
3940 if (seen) obvious = TRUE;
3942 /* Learn about type */
3943 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3946 note = _("は身震いした。", " shudders.");
3947 note_dies = _("はドロドロに溶けた!", " dissolves!");
3964 case GF_DISP_LIVING:
3966 if (r_ptr->flagsr & RFR_RES_ALL)
3972 /* Only affect non-undead */
3973 if (monster_living(r_ptr))
3976 if (seen) obvious = TRUE;
3979 note = _("は身震いした。", " shudders.");
3980 note_dies = _("はドロドロに溶けた!", " dissolves!");
3999 if (r_ptr->flagsr & RFR_RES_ALL)
4005 /* Only affect demons */
4006 if (r_ptr->flags3 & (RF3_DEMON))
4009 if (seen) obvious = TRUE;
4011 /* Learn about type */
4012 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4015 note = _("は身震いした。", " shudders.");
4016 note_dies = _("はドロドロに溶けた!", " dissolves!");
4032 /* Dispel monster */
4035 if (r_ptr->flagsr & RFR_RES_ALL)
4042 if (seen) obvious = TRUE;
4045 note = _("は身震いした。", " shudders.");
4046 note_dies = _("はドロドロに溶けた!", " dissolves!");
4053 if (seen) obvious = TRUE;
4055 if (r_ptr->flagsr & RFR_RES_ALL)
4057 note = _("には完全な耐性がある!", " is immune.");
4059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4063 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4067 /* Heal the monster */
4068 if (caster_ptr->hp < caster_ptr->maxhp)
4071 caster_ptr->hp += dam;
4072 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4074 /* Redraw (later) if needed */
4075 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4076 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4078 /* Special message */
4081 /* Get the monster name */
4082 monster_desc(killer, caster_ptr, 0);
4083 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4090 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4091 (void)hp_player(dam);
4096 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4105 if (seen) obvious = TRUE;
4107 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4109 if (r_ptr->flagsr & RFR_RES_ALL)
4111 note = _("には完全な耐性がある!", " is immune.");
4113 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4117 /* Attempt a saving throw */
4118 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4119 (r_ptr->flags3 & RF3_NO_CONF) ||
4120 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4122 /* Memorize a flag */
4123 if (r_ptr->flags3 & (RF3_NO_CONF))
4125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4127 note = _("には効果がなかった。", " is unaffected.");
4130 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4133 note = _("には完全な耐性がある!", " is immune.");
4136 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4139 note = _("には耐性がある。", " resists.");
4144 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4145 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4147 if (who > 0) do_conf = randint0(4) + 4;
4148 else do_conf = randint0(8) + 8;
4154 case GF_BRAIN_SMASH:
4156 if (seen) obvious = TRUE;
4158 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4160 if (r_ptr->flagsr & RFR_RES_ALL)
4162 note = _("には完全な耐性がある!", " is immune.");
4164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4168 /* Attempt a saving throw */
4169 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4170 (r_ptr->flags3 & RF3_NO_CONF) ||
4171 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4173 /* Memorize a flag */
4174 if (r_ptr->flags3 & (RF3_NO_CONF))
4176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4178 note = _("には効果がなかった。", " is unaffected.");
4181 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4184 note = _("には完全な耐性がある!", " is immune.");
4187 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4190 note = _("には耐性がある!", " resists!");
4195 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4196 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4200 do_conf = randint0(4) + 4;
4201 do_stun = randint0(4) + 4;
4205 do_conf = randint0(8) + 8;
4206 do_stun = randint0(8) + 8;
4208 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4216 if (seen) obvious = TRUE;
4218 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4220 if (r_ptr->flagsr & RFR_RES_ALL)
4222 note = _("には完全な耐性がある!", " is immune.");
4224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4228 /* Attempt a saving throw */
4229 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4231 note = _("には効果がなかった。", " is unaffected.");
4240 if (seen) obvious = TRUE;
4242 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4244 if (r_ptr->flagsr & RFR_RES_ALL)
4246 note = _("には完全な耐性がある!", " is immune.");
4248 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4252 /* Attempt a saving throw */
4253 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4255 note = _("には効果がなかった。", " is unaffected.");
4264 if (seen) obvious = TRUE;
4266 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4268 if (r_ptr->flagsr & RFR_RES_ALL)
4270 note = _("には完全な耐性がある!", " is immune.");
4272 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4276 /* Attempt a saving throw */
4277 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4279 note = _("には効果がなかった。", " is unaffected.");
4288 if (seen) obvious = TRUE;
4291 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4292 "You point at %s, screaming the word, 'DIE!'."), m_name);
4294 if (r_ptr->flagsr & RFR_RES_ALL)
4296 note = _("には完全な耐性がある!", " is immune.");
4298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4302 /* Attempt a saving throw */
4303 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4305 note = _("には効果がなかった。", " is unaffected.");
4314 if (seen) obvious = TRUE;
4316 if (r_ptr->flagsr & RFR_RES_ALL)
4318 note = _("には完全な耐性がある!", " is immune.");
4320 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4324 if (r_ptr->flags1 & RF1_UNIQUE)
4326 note = _("には効果がなかった。", " is unaffected.");
4331 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4332 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4334 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4336 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4340 note = _("は耐性を持っている!", "resists!");
4347 /* Capture monster */
4351 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4352 (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)
4354 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4359 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4360 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4361 nokori_hp = m_ptr->maxhp * 3 / 10;
4363 nokori_hp = m_ptr->maxhp * 3 / 20;
4365 if (m_ptr->hp >= nokori_hp)
4367 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4370 else if (m_ptr->hp < randint0(nokori_hp))
4372 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4373 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4374 cap_mon = m_ptr->r_idx;
4375 cap_mspeed = m_ptr->mspeed;
4377 cap_maxhp = m_ptr->max_maxhp;
4378 cap_nickname = m_ptr->nickname; /* Quark transfer */
4379 if (c_ptr->m_idx == p_ptr->riding)
4381 if (rakuba(-1, FALSE))
4383 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4387 delete_monster_idx(c_ptr->m_idx);
4393 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4399 /* Attack (Use "dam" as attack type) */
4402 /* Return this monster's death */
4403 return py_attack(y, x, dam);
4406 /* Sleep (Use "dam" as "power") */
4412 if (seen) obvious = TRUE;
4414 if (r_ptr->flagsr & RFR_RES_ALL)
4416 note = _("には効果がなかった。", " is unaffected.");
4418 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4421 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4423 note = _("には効果がなかった。", " is unaffected.");
4426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4429 if (MON_CSLEEP(m_ptr))
4431 note = _("には効果がなかった。", " is unaffected.");
4437 if (one_in_(5)) effect = 1;
4438 else if (one_in_(4)) effect = 2;
4439 else if (one_in_(3)) effect = 3;
4444 /* Powerful monsters can resist */
4445 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4446 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4448 note = _("には効果がなかった。", " is unaffected.");
4452 /* Normal monsters slow down */
4455 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4457 note = _("の動きが遅くなった。", " starts moving slower.");
4462 else if (effect == 2)
4464 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4466 /* Attempt a saving throw */
4467 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4468 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4473 /* No obvious effect */
4474 note = _("には効果がなかった。", " is unaffected.");
4479 else if (effect == 3)
4481 /* Attempt a saving throw */
4482 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4483 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4484 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4486 /* Memorize a flag */
4487 if (r_ptr->flags3 & RF3_NO_SLEEP)
4489 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4492 /* No obvious effect */
4493 note = _("には効果がなかった。", " is unaffected.");
4498 /* Go to sleep (much) later */
4499 note = _("は眠り込んでしまった!", " falls asleep!");
4506 note = _("には効果がなかった。", " is unaffected.");
4509 /* No "real" damage */
4517 if (seen) obvious = TRUE;
4519 if (r_ptr->flagsr & RFR_RES_ALL)
4521 note = _("には効果がなかった。", " is unaffected.");
4523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4527 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4529 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4530 chg_virtue(V_VITALITY, -1);
4540 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4542 if (r_ptr->flags3 & (RF3_HURT_LITE))
4544 /* Obvious effect */
4545 if (seen) obvious = TRUE;
4547 /* Memorize the effects */
4548 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4550 /* Special effect */
4551 note = _("は光に身をすくめた!", " cringes from the light!");
4552 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4555 /* Normally no damage */
4562 photo = m_ptr->r_idx;
4569 case GF_BLOOD_CURSE:
4571 if (seen) obvious = TRUE;
4573 if (r_ptr->flagsr & RFR_RES_ALL)
4575 note = _("には完全な耐性がある!", " is immune.");
4577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4585 bool success = FALSE;
4586 if (seen) obvious = TRUE;
4588 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4590 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4591 if (dam < 1) dam = 1;
4593 /* No need to tame your pet */
4596 note = _("の動きが速くなった。", " starts moving faster.");
4597 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4601 /* Attempt a saving throw */
4602 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4603 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4604 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4605 (p_ptr->cursed & TRC_AGGRAVATE) ||
4606 ((r_ptr->level+10) > randint1(dam)))
4609 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4613 note = _("を支配した。", " is tamed!");
4615 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4617 /* Learn about type */
4618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4625 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4627 do_fear = randint1(90)+10;
4629 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4632 /* No "real" damage */
4639 if (seen) obvious = TRUE;
4641 if (r_ptr->flagsr & RFR_RES_ALL)
4643 note = _("には完全な耐性がある!", " is immune.");
4645 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4649 /* Attempt a saving throw */
4650 if (randint0(100 + dam) < (r_ptr->level + 50))
4652 note = _("には効果がなかった。", " is unaffected.");
4672 /* Absolutely no effect */
4673 if (skipped) return (FALSE);
4675 /* "Unique" monsters cannot be polymorphed */
4676 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4678 /* Quest monsters cannot be polymorphed */
4679 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4681 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4683 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4684 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4686 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4691 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4692 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4695 /* Modify the damage */
4697 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4698 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4700 /* Check for death */
4701 if (dam > m_ptr->hp)
4703 /* Extract method of death */
4708 /* Sound and Impact resisters never stun */
4710 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4711 !(r_ptr->flags3 & RF3_NO_STUN))
4714 if (seen) obvious = TRUE;
4717 if (MON_STUNNED(m_ptr))
4719 note = _("はひどくもうろうとした。", " is more dazed.");
4720 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4724 note = _("はもうろうとした。", " is dazed.");
4729 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4735 /* Confusion and Chaos resisters (and sleepers) never confuse */
4737 !(r_ptr->flags3 & RF3_NO_CONF) &&
4738 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4741 if (seen) obvious = TRUE;
4743 /* Already partially confused */
4744 if (MON_CONFUSED(m_ptr))
4746 note = _("はさらに混乱したようだ。", " looks more confused.");
4747 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4750 /* Was not confused */
4753 note = _("は混乱したようだ。", " looks confused.");
4757 /* Apply confusion */
4758 (void)set_monster_confused(c_ptr->m_idx, tmp);
4767 if (seen) obvious = TRUE;
4769 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4773 note = _("は弱くなったようだ。", " seems weakened.");
4774 m_ptr->maxhp -= do_time;
4775 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4780 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4781 if (do_poly && (randint1(90) > r_ptr->level))
4783 if (polymorph_monster(y, x))
4786 if (seen) obvious = TRUE;
4788 /* Monster polymorphs */
4789 note = _("が変身した!", " changes!");
4791 /* Turn off the damage */
4797 note = _("には効果がなかった。", " is unaffected.");
4800 /* Hack -- Get new monster */
4801 m_ptr = &m_list[c_ptr->m_idx];
4803 /* Hack -- Get new race */
4804 r_ptr = &r_info[m_ptr->r_idx];
4807 /* Handle "teleport" */
4811 if (seen) obvious = TRUE;
4814 note = _("が消え去った!", " disappears!");
4816 if (!who) chg_virtue(V_VALOUR, -1);
4819 teleport_away(c_ptr->m_idx, do_dist,
4820 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4822 /* Hack -- get new location */
4826 /* Hack -- get new grid */
4827 c_ptr = &cave[y][x];
4834 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4841 if (typ == GF_DRAIN_MANA)
4843 /* Drain mana does nothing */
4846 /* If another monster did the damage, hurt the monster by hand */
4849 /* Redraw (later) if needed */
4850 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4851 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4853 /* Wake the monster up */
4854 (void)set_monster_csleep(c_ptr->m_idx, 0);
4856 /* Hurt the monster */
4864 if (is_pet(m_ptr) && !(m_ptr->ml))
4867 /* Give detailed messages if destroyed */
4870 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4873 msg_format("%^s%s", m_name, note);
4881 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4883 /* Generate treasure, etc */
4884 monster_death(c_ptr->m_idx, FALSE);
4886 /* Delete the monster */
4887 delete_monster_idx(c_ptr->m_idx);
4891 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4895 /* Damaged monster */
4898 /* Give detailed messages if visible or destroyed */
4899 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4901 /* Hack -- Pain message */
4904 message_pain(c_ptr->m_idx, dam);
4911 /* Hack -- handle sleep */
4912 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4916 else if (heal_leper)
4918 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4920 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4924 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4925 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4928 delete_monster_idx(c_ptr->m_idx);
4931 /* If the player did it, give him experience, check fear */
4936 /* Hurt the monster, check for fear and death */
4937 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4942 /* Damaged monster */
4945 /* HACK - anger the monster before showing the sleep message */
4946 if (do_sleep) anger_monster(m_ptr);
4948 /* Give detailed messages if visible or destroyed */
4949 if (note && seen_msg)
4950 msg_format(_("%s%s", "%^s%s"), m_name, note);
4952 /* Hack -- Pain message */
4953 else if (known && (dam || !do_fear))
4955 message_pain(c_ptr->m_idx, dam);
4958 /* Anger monsters */
4959 if (((dam > 0) || get_angry) && !do_sleep)
4960 anger_monster(m_ptr);
4963 if ((fear || do_fear) && seen)
4969 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4972 /* Hack -- handle sleep */
4973 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4977 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4979 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4983 switch (randint1(28))
4988 msg_print(_("地面が揺れた...", "The ground trembles..."));
4989 earthquake(ty, tx, 4 + randint0(4));
4990 if (!one_in_(6)) break;
4992 case 3: case 4: case 5: case 6:
4995 int extra_dam = damroll(10, 10);
4996 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4998 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4999 if (!one_in_(6)) break;
5004 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5006 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5007 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5008 if (!one_in_(6)) break;
5010 case 9: case 10: case 11:
5011 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5012 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5013 if (!one_in_(6)) break;
5014 case 12: case 13: case 14: case 15: case 16:
5015 aggravate_monsters(0);
5016 if (!one_in_(6)) break;
5018 count += activate_hi_summon(ty, tx, TRUE);
5019 if (!one_in_(6)) break;
5020 case 19: case 20: case 21: case 22:
5022 bool pet = !one_in_(3);
5023 BIT_FLAGS mode = PM_ALLOW_GROUP;
5025 if (pet) mode |= PM_FORCE_PET;
5026 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5028 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);
5029 if (!one_in_(6)) break;
5031 case 23: case 24: case 25:
5032 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5033 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5035 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5036 else lose_exp(p_ptr->exp / 16);
5037 if (!one_in_(6)) break;
5038 case 26: case 27: case 28:
5047 (void)do_dec_stat(i);
5056 (void)do_dec_stat(randint0(6));
5065 if (p_ptr->inside_battle)
5067 p_ptr->health_who = c_ptr->m_idx;
5068 p_ptr->redraw |= (PR_HEALTH);
5072 /* XXX XXX XXX Verify this code */
5074 /* Update the monster */
5075 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5077 /* Redraw the monster grid */
5081 /* Update monster recall window */
5082 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5085 p_ptr->window |= (PW_MONSTER);
5088 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5092 if (!(flg & PROJECT_NO_HANGEKI))
5094 set_target(m_ptr, monster_target_y, monster_target_x);
5097 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5099 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5103 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5105 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5106 rakubadam_m = (dam > 200) ? 200 : dam;
5115 /* Get local object */
5118 /* Prepare to make a Blade of Chaos */
5119 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5121 q_ptr->pval = photo;
5123 /* Mark the item as fully known */
5124 q_ptr->ident |= (IDENT_MENTAL);
5126 /* Drop it in the dungeon */
5127 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5135 /* Return "Anything seen?" */
5140 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5141 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5142 * @param who_name 効果を起こしたモンスターの名前
5143 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5144 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5145 * @param x 目標X座標 / Target x location (or location to travel "towards")
5146 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5147 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5149 * @param monspell 効果元のモンスター魔法ID
5150 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5152 * Handle a beam/bolt/ball causing damage to the player.
5153 * This routine takes a "source monster" (by index), a "distance", a default
5154 * "damage", and a "damage type". See "project_m()" above.
5155 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5156 * is reduced (see "project_m()" above). This can happen if a monster breathes
5157 * at the player and hits a wall instead.
5158 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5159 * to know if this is actually a ball or a bolt spell
5160 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5161 * we just assume that the effects were obvious, for historical reasons.
5163 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)
5168 /* Hack -- assume obvious */
5169 bool obvious = TRUE;
5171 /* Player blind-ness */
5172 bool blind = (p_ptr->blind ? TRUE : FALSE);
5174 /* Player needs a "description" (he is blind) */
5177 /* Source monster */
5178 monster_type *m_ptr = NULL;
5180 /* Monster name (for attacks) */
5183 /* Monster name (for damage) */
5186 /* Hack -- messages */
5192 /* Player is not here */
5193 if (!player_bold(y, x)) return (FALSE);
5195 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5197 if (kawarimi(TRUE)) return FALSE;
5200 /* Player cannot hurt himself */
5201 if (!who) return (FALSE);
5202 if (who == p_ptr->riding) return (FALSE);
5204 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5207 int max_attempts = 10;
5208 sound(SOUND_REFLECT);
5211 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5212 else if (p_ptr->special_defense & KATA_FUUJIN)
5213 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5215 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5218 /* Choose 'new' target */
5223 t_y = m_list[who].fy - 1 + randint1(3);
5224 t_x = m_list[who].fx - 1 + randint1(3);
5227 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5229 if (max_attempts < 1)
5231 t_y = m_list[who].fy;
5232 t_x = m_list[who].fx;
5237 t_y = p_ptr->y - 1 + randint1(3);
5238 t_x = p_ptr->x - 1 + randint1(3);
5241 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5248 /* Limit maximum damage */
5249 if (dam > 1600) dam = 1600;
5251 /* Reduce damage by distance */
5252 dam = (dam + r) / (r + 1);
5255 /* If the player is blind, be more descriptive */
5256 if (blind) fuzzy = TRUE;
5261 /* Get the source monster */
5262 m_ptr = &m_list[who];
5263 /* Extract the monster level */
5264 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5266 /* Get the monster name */
5267 monster_desc(m_name, m_ptr, 0);
5269 /* Get the monster's real name (gotten before polymorph!) */
5270 strcpy(killer, who_name);
5276 case PROJECT_WHO_UNCTRL_POWER:
5277 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5280 case PROJECT_WHO_GLASS_SHARDS:
5281 strcpy(killer, _("ガラスの破片", "shards of glass"));
5285 strcpy(killer, _("罠", "a trap"));
5290 strcpy(m_name, killer);
5293 /* Analyze the damage */
5296 /* Standard damage -- hurts inventory too */
5299 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5300 get_damage = acid_dam(dam, killer, monspell, FALSE);
5304 /* Standard damage -- hurts inventory too */
5307 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5308 get_damage = fire_dam(dam, killer, monspell, FALSE);
5312 /* Standard damage -- hurts inventory too */
5315 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5316 get_damage = cold_dam(dam, killer, monspell, FALSE);
5320 /* Standard damage -- hurts inventory too */
5323 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5324 get_damage = elec_dam(dam, killer, monspell, FALSE);
5328 /* Standard damage -- also poisons player */
5331 bool double_resist = IS_OPPOSE_POIS();
5332 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5334 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5335 if (double_resist) dam = (dam + 2) / 3;
5337 if ((!(double_resist || p_ptr->resist_pois)) &&
5338 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5343 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5345 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5347 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5352 /* Standard damage -- also poisons / mutates player */
5355 bool double_resist = IS_OPPOSE_POIS();
5356 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5358 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5359 if (double_resist) dam = (2 * dam + 2) / 5;
5360 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5361 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5363 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5365 if (one_in_(5)) /* 6 */
5367 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5368 if (one_in_(4)) /* 4 */
5376 inven_damage(set_acid_destroy, 2);
5382 /* Standard damage */
5385 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5386 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5390 /* Holy Orb -- Player only takes partial damage */
5393 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5394 if (p_ptr->align > 10)
5396 else if (p_ptr->align < -10)
5398 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5404 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5405 if (p_ptr->align > 10)
5407 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5411 /* Arrow -- XXX no dodging */
5416 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5418 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5420 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5423 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5427 /* Plasma -- XXX No resist */
5430 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5431 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5433 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5435 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5436 (void)set_stun(p_ptr->stun + plus_stun);
5439 if (!(p_ptr->resist_fire ||
5441 p_ptr->immune_fire))
5443 inven_damage(set_acid_destroy, 3);
5449 /* Nether -- drain experience */
5452 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5453 if (p_ptr->resist_neth)
5455 if (!prace_is_(RACE_SPECTRE))
5457 dam *= 6; dam /= (randint1(4) + 7);
5460 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5462 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5464 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5466 learn_spell(monspell);
5470 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5476 /* Water -- stun/confuse */
5479 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5480 if (!CHECK_MULTISHADOW())
5482 if (!p_ptr->resist_sound)
5484 set_stun(p_ptr->stun + randint1(40));
5486 if (!p_ptr->resist_conf)
5488 set_confused(p_ptr->confused + randint1(5) + 5);
5493 inven_damage(set_cold_destroy, 3);
5497 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5501 /* Chaos -- many effects */
5504 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5505 if (p_ptr->resist_chaos)
5507 dam *= 6; dam /= (randint1(4) + 7);
5510 if (!CHECK_MULTISHADOW())
5512 if (!p_ptr->resist_conf)
5514 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5516 if (!p_ptr->resist_chaos)
5518 (void)set_image(p_ptr->image + randint1(10));
5521 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5522 (void)gain_random_mutation(0);
5525 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5527 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5530 if (!p_ptr->resist_chaos || one_in_(9))
5532 inven_damage(set_elec_destroy, 2);
5533 inven_damage(set_fire_destroy, 2);
5537 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5541 /* Shards -- mostly cutting */
5544 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5545 if (p_ptr->resist_shard)
5547 dam *= 6; dam /= (randint1(4) + 7);
5549 else if (!CHECK_MULTISHADOW())
5551 (void)set_cut(p_ptr->cut + dam);
5554 if (!p_ptr->resist_shard || one_in_(13))
5556 inven_damage(set_cold_destroy, 2);
5559 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5563 /* Sound -- mostly stunning */
5566 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5567 if (p_ptr->resist_sound)
5569 dam *= 5; dam /= (randint1(4) + 7);
5571 else if (!CHECK_MULTISHADOW())
5573 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5574 (void)set_stun(p_ptr->stun + plus_stun);
5577 if (!p_ptr->resist_sound || one_in_(13))
5579 inven_damage(set_cold_destroy, 2);
5582 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5586 /* Pure confusion */
5589 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5590 if (p_ptr->resist_conf)
5592 dam *= 5; dam /= (randint1(4) + 7);
5594 else if (!CHECK_MULTISHADOW())
5596 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5598 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5602 /* Disenchantment -- see above */
5605 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5606 if (p_ptr->resist_disen)
5608 dam *= 6; dam /= (randint1(4) + 7);
5610 else if (!CHECK_MULTISHADOW())
5612 (void)apply_disenchant(0);
5614 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5618 /* Nexus -- see above */
5621 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5622 if (p_ptr->resist_nexus)
5624 dam *= 6; dam /= (randint1(4) + 7);
5626 else if (!CHECK_MULTISHADOW())
5630 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5634 /* Force -- mostly stun */
5637 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5638 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5640 (void)set_stun(p_ptr->stun + randint1(20));
5642 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5647 /* Rocket -- stun, cut */
5650 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5651 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5653 (void)set_stun(p_ptr->stun + randint1(20));
5656 if (p_ptr->resist_shard)
5660 else if (!CHECK_MULTISHADOW())
5662 (void)set_cut(p_ptr->cut + (dam / 2));
5665 if (!p_ptr->resist_shard || one_in_(12))
5667 inven_damage(set_cold_destroy, 3);
5670 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5674 /* Inertia -- slowness */
5677 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5678 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5679 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5683 /* Lite -- blinding */
5686 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5687 if (p_ptr->resist_lite)
5689 dam *= 4; dam /= (randint1(4) + 7);
5691 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5693 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5696 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5698 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5701 else if (prace_is_(RACE_S_FAIRY))
5706 if (p_ptr->wraith_form) dam *= 2;
5707 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5709 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5711 p_ptr->wraith_form = 0;
5712 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5713 "The light forces you out of your incorporeal shadow form."));
5715 p_ptr->redraw |= PR_MAP;
5716 /* Update monsters */
5717 p_ptr->update |= (PU_MONSTERS);
5719 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5721 /* Redraw status bar */
5722 p_ptr->redraw |= (PR_STATUS);
5729 /* Dark -- blinding */
5732 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5733 if (p_ptr->resist_dark)
5735 dam *= 4; dam /= (randint1(4) + 7);
5737 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5739 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5741 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5743 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5747 /* Time -- bolt fewer effects XXX */
5750 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5751 if (p_ptr->resist_time)
5754 dam /= (randint1(4) + 7);
5755 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5757 else if (!CHECK_MULTISHADOW())
5759 switch (randint1(10))
5761 case 1: case 2: case 3: case 4: case 5:
5763 if (p_ptr->prace == RACE_ANDROID) break;
5764 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5765 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5769 case 6: case 7: case 8: case 9:
5771 switch (randint1(6))
5773 case 1: k = A_STR; act = _("強く", "strong"); break;
5774 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5775 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5776 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5777 case 5: k = A_CON; act = _("健康で", "hale"); break;
5778 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5781 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5782 "You're not as %s as you used to be..."), act);
5784 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5785 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5786 p_ptr->update |= (PU_BONUS);
5792 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5793 "You're not as powerful as you used to be..."));
5795 for (k = 0; k < 6; k++)
5797 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5798 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5800 p_ptr->update |= (PU_BONUS);
5806 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5810 /* Gravity -- stun plus slowness plus teleport */
5813 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5814 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5816 if (!CHECK_MULTISHADOW())
5818 teleport_player(5, TELEPORT_PASSIVE);
5819 if (!p_ptr->levitation)
5820 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5821 if (!(p_ptr->resist_sound || p_ptr->levitation))
5823 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5824 (void)set_stun(p_ptr->stun + plus_stun);
5827 if (p_ptr->levitation)
5829 dam = (dam * 2) / 3;
5832 if (!p_ptr->levitation || one_in_(13))
5834 inven_damage(set_cold_destroy, 2);
5837 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5841 /* Standard damage */
5842 case GF_DISINTEGRATE:
5844 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5846 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5852 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5854 (void)hp_player(dam);
5861 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5862 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5869 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5870 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5876 if (p_ptr->free_act) break;
5877 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5879 if (ironman_nightmare)
5881 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5882 /* Have some nightmares */
5883 sanity_blast(NULL, FALSE);
5886 set_paralyzed(p_ptr->paralyzed + dam);
5896 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5897 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5904 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5905 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5912 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5914 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5915 if (!p_ptr->resist_shard || one_in_(13))
5917 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5918 inven_damage(set_cold_destroy, 2);
5924 /* Ice -- cold plus stun plus cuts */
5927 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5928 get_damage = cold_dam(dam, killer, monspell, FALSE);
5929 if (!CHECK_MULTISHADOW())
5931 if (!p_ptr->resist_shard)
5933 (void)set_cut(p_ptr->cut + damroll(5, 8));
5935 if (!p_ptr->resist_sound)
5937 (void)set_stun(p_ptr->stun + randint1(15));
5940 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5942 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5952 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5954 if (p_ptr->mimic_form)
5956 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5957 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5962 switch (p_ptr->prace)
5964 /* Some races are immune */
5978 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5990 if (CHECK_MULTISHADOW())
5992 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5994 else if (p_ptr->csp)
5998 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6000 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6003 if (dam >= p_ptr->csp)
6007 p_ptr->csp_frac = 0;
6016 learn_spell(monspell);
6019 p_ptr->redraw |= (PR_MANA);
6022 p_ptr->window |= (PW_PLAYER);
6023 p_ptr->window |= (PW_SPELL);
6027 /* Heal the monster */
6028 if (m_ptr->hp < m_ptr->maxhp)
6032 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6034 /* Redraw (later) if needed */
6035 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6036 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6038 /* Special message */
6041 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6054 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6056 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6057 learn_spell(monspell);
6061 if (!CHECK_MULTISHADOW())
6063 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6065 if (!p_ptr->resist_conf)
6067 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6070 if (!p_ptr->resist_chaos && one_in_(3))
6072 (void)set_image(p_ptr->image + randint0(250) + 150);
6079 p_ptr->csp_frac = 0;
6081 p_ptr->redraw |= PR_MANA;
6084 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6090 case GF_BRAIN_SMASH:
6092 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6094 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6095 learn_spell(monspell);
6099 if (!CHECK_MULTISHADOW())
6101 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6107 p_ptr->csp_frac = 0;
6109 p_ptr->redraw |= PR_MANA;
6112 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6113 if (!CHECK_MULTISHADOW())
6115 if (!p_ptr->resist_blind)
6117 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6119 if (!p_ptr->resist_conf)
6121 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6123 if (!p_ptr->free_act)
6125 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6127 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6129 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6130 (void)do_dec_stat(A_INT);
6131 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6132 (void)do_dec_stat(A_WIS);
6134 if (!p_ptr->resist_chaos)
6136 (void)set_image(p_ptr->image + randint0(250) + 150);
6146 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6148 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6149 learn_spell(monspell);
6153 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6154 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6162 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6164 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6165 learn_spell(monspell);
6169 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6170 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6178 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6180 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6181 learn_spell(monspell);
6185 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6186 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6194 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6196 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6197 learn_spell(monspell);
6201 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6202 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6210 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6212 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6213 learn_spell(monspell);
6217 if (!CHECK_MULTISHADOW())
6219 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6220 curse_equipment(40, 20);
6223 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6225 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6240 /* Hex - revenge damage stored */
6241 revenge_store(get_damage);
6243 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6244 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6246 char m_name_self[80];
6249 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6251 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6252 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6253 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6256 if (p_ptr->riding && dam > 0)
6258 rakubadam_p = (dam > 200) ? 200 : dam;
6266 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6268 (void)kawarimi(FALSE);
6271 /* Return "Anything seen?" */
6277 * Find the distance from (x, y) to a line.
6279 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6281 /* Vector from (x, y) to (x1, y1) */
6282 POSITION py = y1 - y;
6283 POSITION px = x1 - x;
6286 POSITION ny = x2 - x1;
6287 POSITION nx = y1 - y2;
6290 POSITION pd = distance(y1, x1, y, x);
6291 POSITION nd = distance(y1, x1, y2, x2);
6293 if (pd > nd) return distance(y, x, y2, x2);
6295 /* Component of P on N */
6296 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6298 /* Absolute value */
6299 return((nd >= 0) ? nd : 0 - nd);
6306 * Modified version of los() for calculation of disintegration balls.
6307 * Disintegration effects are stopped by permanent walls.
6309 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6329 /* Slope, or 1/Slope, of LOS */
6333 /* Extract the offset */
6337 /* Extract the absolute offset */
6342 /* Handle adjacent (or identical) grids */
6343 if ((ax < 2) && (ay < 2)) return (TRUE);
6346 /* Paranoia -- require "safe" origin */
6347 /* if (!in_bounds(y1, x1)) return (FALSE); */
6350 /* Directly South/North */
6353 /* South -- check for walls */
6356 for (ty = y1 + 1; ty < y2; ty++)
6358 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6362 /* North -- check for walls */
6365 for (ty = y1 - 1; ty > y2; ty--)
6367 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6375 /* Directly East/West */
6378 /* East -- check for walls */
6381 for (tx = x1 + 1; tx < x2; tx++)
6383 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6387 /* West -- check for walls */
6390 for (tx = x1 - 1; tx > x2; tx--)
6392 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6401 /* Extract some signs */
6402 sx = (dx < 0) ? -1 : 1;
6403 sy = (dy < 0) ? -1 : 1;
6406 /* Vertical "knights" */
6411 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6415 /* Horizontal "knights" */
6420 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6425 /* Calculate scale factor div 2 */
6428 /* Calculate scale factor */
6432 /* Travel horizontally */
6435 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6441 /* Consider the special case where slope == 1. */
6452 /* Note (below) the case (qy == f2), where */
6453 /* the LOS exactly meets the corner of a tile. */
6456 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6467 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6480 /* Travel vertically */
6483 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6499 /* Note (below) the case (qx == f2), where */
6500 /* the LOS exactly meets the corner of a tile. */
6503 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6514 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6535 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)
6540 int brev = rad * rad / dist;
6544 int mdis = distance(y1, x1, y2, x2) + rad;
6546 while (bdis <= mdis)
6550 if ((0 < dist) && (path_n < dist))
6552 int ny = GRID_Y(path_g[path_n]);
6553 int nx = GRID_X(path_g[path_n]);
6554 int nd = distance(ny, nx, y1, x1);
6556 /* Get next base point */
6565 /* Travel from center outward */
6566 for (cdis = 0; cdis <= brad; cdis++)
6568 /* Scan the maximal blast area of radius "cdis" */
6569 for (y = by - cdis; y <= by + cdis; y++)
6571 for (x = bx - cdis; x <= bx + cdis; x++)
6573 /* Ignore "illegal" locations */
6574 if (!in_bounds(y, x)) continue;
6576 /* Enforce a circular "ripple" */
6577 if (distance(y1, x1, y, x) != bdis) continue;
6579 /* Enforce an arc */
6580 if (distance(by, bx, y, x) != cdis) continue;
6586 /* Lights are stopped by opaque terrains */
6587 if (!los(by, bx, y, x)) continue;
6589 case GF_DISINTEGRATE:
6590 /* Disintegration are stopped only by perma-walls */
6591 if (!in_disintegration_range(by, bx, y, x)) continue;
6594 /* Ball explosions are stopped by walls */
6595 if (!projectable(by, bx, y, x)) continue;
6599 /* Save this grid */
6607 /* Encode some more "radius" info */
6608 gm[bdis + 1] = *pgrids;
6610 /* Increase the size */
6611 brad = rad * (path_n + brev) / (dist + brev);
6613 /* Find the next ripple */
6617 /* Store the effect size */
6623 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6624 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6625 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6626 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6627 * @param x 目標X座標 / Target x location (or location to travel "towards")
6628 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6629 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6630 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6631 * @param monspell 効果元のモンスター魔法ID
6632 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6635 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6636 * towards a given location (optionally passing over the heads of interposing
6637 * monsters), and have it do a given amount of damage to the monsters (and
6638 * optionally objects) within the given radius of the final location.
6640 * A "bolt" travels from source to target and affects only the target grid.
6641 * A "beam" travels from source to target, affecting all grids passed through.
6642 * A "ball" travels from source to the target, exploding at the target, and
6643 * affecting everything within the given radius of the target location.
6645 * Traditionally, a "bolt" does not affect anything on the ground, and does
6646 * not pass over the heads of interposing monsters, much like a traditional
6647 * missile, and will "stop" abruptly at the "target" even if no monster is
6648 * positioned there, while a "ball", on the other hand, passes over the heads
6649 * of monsters between the source and target, and affects everything except
6650 * the source monster which lies within the final radius, while a "beam"
6651 * affects every monster between the source and target, except for the casting
6652 * monster (or player), and rarely affects things on the ground.
6654 * Two special flags allow us to use this function in special ways, the
6655 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6656 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6657 * actually projecting from the source monster (or player).
6659 * The player will only get "experience" for monsters killed by himself
6660 * Unique monsters can only be destroyed by attacks from the player
6662 * Only 256 grids can be affected per projection, limiting the effective
6663 * "radius" of standard ball attacks to nine units (diameter nineteen).
6665 * One can project in a given "direction" by combining PROJECT_THRU with small
6666 * offsets to the initial location (see "line_spell()"), or by calculating
6667 * "virtual targets" far away from the player.
6669 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6670 * continuing until it actually hits somethings (useful for "stone to mud").
6672 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6674 * Balls must explode BEFORE hitting walls, or they would affect monsters
6675 * on both sides of a wall. Some bug reports indicate that this is still
6676 * happening in 2.7.8 for Windows, though it appears to be impossible.
6678 * We "pre-calculate" the blast area only in part for efficiency.
6679 * More importantly, this lets us do "explosions" from the "inside" out.
6680 * This results in a more logical distribution of "blast" treasure.
6681 * It also produces a better (in my opinion) animation of the explosion.
6682 * It could be (but is not) used to have the treasure dropped by monsters
6683 * in the middle of the explosion fall "outwards", and then be damaged by
6684 * the blast as it spreads outwards towards the treasure drop location.
6686 * Walls and doors are included in the blast area, so that they can be
6687 * "burned" or "melted" in later versions.
6689 * This algorithm is intended to maximize simplicity, not necessarily
6690 * efficiency, since this function is not a bottleneck in the code.
6692 * We apply the blast effect from ground zero outwards, in several passes,
6693 * first affecting features, then objects, then monsters, then the player.
6694 * This allows walls to be removed before checking the object or monster
6695 * in the wall, and protects objects which are dropped by monsters killed
6696 * in the blast, and allows the player to see all affects before he is
6697 * killed or teleported away. The semantics of this method are open to
6698 * various interpretations, but they seem to work well in practice.
6700 * We process the blast area from ground-zero outwards to allow for better
6701 * distribution of treasure dropped by monsters, and because it provides a
6702 * pleasing visual effect at low cost.
6704 * Note that the damage done by "ball" explosions decreases with distance.
6705 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6707 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6708 * the target, and then the damage "flows" along this beam of destruction.
6709 * The damage at every grid is the same as at the "center" of a "ball"
6710 * explosion, since the "beam" grids are treated as if they ARE at the
6711 * center of a "ball" explosion.
6713 * Currently, specifying "beam" plus "ball" means that locations which are
6714 * covered by the initial "beam", and also covered by the final "ball", except
6715 * for the final grid (the epicenter of the ball), will be "hit twice", once
6716 * by the initial beam, and once by the exploding ball. For the grid right
6717 * next to the epicenter, this results in 150% damage being done. The center
6718 * does not have this problem, for the same reason the final grid in a "beam"
6719 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6720 * grids which are covered by the "ball" will NOT work, as then they will
6721 * receive LESS damage than they should. Do not combine "beam" with "ball".
6723 * The array "gy[],gx[]" with current size "grids" is used to hold the
6724 * collected locations of all grids in the "blast area" plus "beam path".
6726 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6727 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6728 * first blast grid (see above) with radius "N" from the blast center. Note
6729 * that only the first gm[1] grids in the blast area thus take full damage.
6730 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6731 * number of blast grids.
6733 * Note that once the projection is complete, (y2,x2) holds the final location
6734 * of bolts/beams, and the "epicenter" of balls.
6736 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6737 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6738 * implementation of the "distance" function. Also, a bolt can be properly
6739 * viewed as a "ball" with a "rad" of "zero".
6741 * Note that if no "target" is reached before the beam/bolt/ball travels the
6742 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6743 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6745 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6746 * to move from point A to point B, even if the player cannot see part of the
6747 * projection path. Note that in general, the player will *always* see part
6748 * of the path, since it either starts at the player or ends on the player.
6750 * Hack -- we assume that every "projection" is "self-illuminating".
6752 * Hack -- when only a single monster is affected, we automatically track
6753 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6755 * Note that all projections now "explode" at their final destination, even
6756 * if they were being projected at a more distant destination. This means
6757 * that "ball" spells will *always* explode.
6759 * Note that we must call "handle_stuff()" after affecting terrain features
6760 * in the blast radius, in case the "illumination" of the grid was changed,
6761 * and "update_view()" and "update_monsters()" need to be called.
6764 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6774 POSITION y_saver, x_saver; /* For reflecting monsters */
6776 int msec = delay_factor * delay_factor * delay_factor;
6778 /* Assume the player sees nothing */
6779 bool notice = FALSE;
6781 /* Assume the player has seen nothing */
6782 bool visual = FALSE;
6784 /* Assume the player has seen no blast grids */
6787 /* Assume to be a normal ball spell */
6788 bool breath = FALSE;
6790 /* Is the player blind? */
6791 bool blind = (p_ptr->blind ? TRUE : FALSE);
6793 bool old_hide = FALSE;
6795 /* Number of grids in the "path" */
6798 /* Actual grids in the "path" */
6801 /* Number of grids in the "blast area" (including the "beam" path) */
6804 /* Coordinates of the affected grids */
6805 POSITION gx[1024], gy[1024];
6807 /* Encoded "radius" info (see above) */
6810 /* Actual radius encoded in gm[] */
6811 POSITION gm_rad = rad;
6815 /* Attacker's name (prepared before polymorph)*/
6818 /* Can the player see the source of this effect? */
6819 bool see_s_msg = TRUE;
6821 /* Initialize by null string */
6827 /* Default target of monsterspell is player */
6828 monster_target_y=p_ptr->y;
6829 monster_target_x=p_ptr->x;
6831 /* Hack -- Jump to target */
6832 if (flg & (PROJECT_JUMP))
6837 /* Clear the flag */
6838 flg &= ~(PROJECT_JUMP);
6843 /* Start at player */
6850 /* Start at monster */
6853 x1 = m_list[who].fx;
6854 y1 = m_list[who].fy;
6855 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6868 /* Default "destination" */
6873 /* Hack -- verify stuff */
6874 if (flg & (PROJECT_THRU))
6876 if ((x1 == x2) && (y1 == y2))
6878 flg &= ~(PROJECT_THRU);
6882 /* Handle a breath attack */
6887 if (flg & PROJECT_HIDE) old_hide = TRUE;
6888 flg |= PROJECT_HIDE;
6892 /* Hack -- Assume there will be no blast (max radius 32) */
6893 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6901 /* Collect beam grids */
6902 if (flg & (PROJECT_BEAM))
6913 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6915 case GF_DISINTEGRATE:
6916 flg |= (PROJECT_GRID);
6917 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6921 /* Calculate the projection path */
6923 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6925 /* Hack -- Handle stuff */
6928 /* Giga-Hack SEEKER & SUPER_RAY */
6930 if( typ == GF_SEEKER )
6940 for (i = 0; i < path_n; ++i)
6945 int ny = GRID_Y(path_g[i]);
6946 int nx = GRID_X(path_g[i]);
6957 /* Only do visuals if requested */
6958 if (!blind && !(flg & (PROJECT_HIDE)))
6960 /* Only do visuals if the player can "see" the bolt */
6961 if (panel_contains(y, x) && player_has_los_bold(y, x))
6968 /* Obtain the bolt pict */
6969 p = bolt_pict(oy, ox, y, x, typ);
6971 /* Extract attr/char */
6975 /* Visual effects */
6976 print_rel(c, a, y, x);
6977 move_cursor_relative(y, x);
6978 /*if (fresh_before)*/ Term_fresh();
6979 Term_xtra(TERM_XTRA_DELAY, msec);
6981 /*if (fresh_before)*/ Term_fresh();
6983 /* Display "beam" grids */
6984 if (flg & (PROJECT_BEAM))
6986 /* Obtain the explosion pict */
6987 p = bolt_pict(y, x, y, x, typ);
6989 /* Extract attr/char */
6993 /* Visual effects */
6994 print_rel(c, a, y, x);
6997 /* Hack -- Activate delay */
7001 /* Hack -- delay anyway for consistency */
7004 /* Delay for consistency */
7005 Term_xtra(TERM_XTRA_DELAY, msec);
7008 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7009 if( is_mirror_grid(&cave[y][x]))
7011 /* The target of monsterspell becomes tha mirror(broken) */
7012 monster_target_y=(s16b)y;
7013 monster_target_x=(s16b)x;
7015 remove_mirror(y, x);
7016 next_mirror(&oy, &ox, y, x);
7018 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7019 for(j = last_i; j <= i; j++)
7021 y = GRID_Y(path_g[j]);
7022 x = GRID_X(path_g[j]);
7023 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7024 if(!who && (project_m_n==1) && !jump ){
7025 if(cave[project_m_y][project_m_x].m_idx >0 ){
7026 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7030 /* Hack -- auto-recall */
7031 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7033 /* Hack - auto-track */
7034 health_track(cave[project_m_y][project_m_x].m_idx);
7038 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7043 for(i = last_i ; i < path_n ; i++)
7046 py = GRID_Y(path_g[i]);
7047 px = GRID_X(path_g[i]);
7048 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7050 if(!who && (project_m_n==1) && !jump ){
7051 if(cave[project_m_y][project_m_x].m_idx > 0)
7053 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7057 /* Hack -- auto-recall */
7058 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7060 /* Hack - auto-track */
7061 health_track(cave[project_m_y][project_m_x].m_idx);
7065 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7069 else if(typ == GF_SUPER_RAY){
7071 int second_step = 0;
7078 for (i = 0; i < path_n; ++i)
7083 int ny = GRID_Y(path_g[i]);
7084 int nx = GRID_X(path_g[i]);
7095 /* Only do visuals if requested */
7096 if (!blind && !(flg & (PROJECT_HIDE)))
7098 /* Only do visuals if the player can "see" the bolt */
7099 if (panel_contains(y, x) && player_has_los_bold(y, x))
7106 /* Obtain the bolt pict */
7107 p = bolt_pict(oy, ox, y, x, typ);
7109 /* Extract attr/char */
7113 /* Visual effects */
7114 print_rel(c, a, y, x);
7115 move_cursor_relative(y, x);
7116 /*if (fresh_before)*/ Term_fresh();
7117 Term_xtra(TERM_XTRA_DELAY, msec);
7119 /*if (fresh_before)*/ Term_fresh();
7121 /* Display "beam" grids */
7122 if (flg & (PROJECT_BEAM))
7124 /* Obtain the explosion pict */
7125 p = bolt_pict(y, x, y, x, typ);
7127 /* Extract attr/char */
7131 /* Visual effects */
7132 print_rel(c, a, y, x);
7135 /* Hack -- Activate delay */
7139 /* Hack -- delay anyway for consistency */
7142 /* Delay for consistency */
7143 Term_xtra(TERM_XTRA_DELAY, msec);
7146 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7147 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7149 if( second_step )continue;
7152 if( is_mirror_grid(&cave[y][x]) && !second_step )
7154 /* The target of monsterspell becomes tha mirror(broken) */
7155 monster_target_y=(s16b)y;
7156 monster_target_x=(s16b)x;
7159 for( j = 0; j <=i ; j++ )
7161 y = GRID_Y(path_g[j]);
7162 x = GRID_X(path_g[j]);
7163 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7167 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7168 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7169 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7170 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , 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+1, x-1, flg);
7173 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7174 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7177 for( i = 0; i < path_n ; i++ )
7180 py = GRID_Y(path_g[i]);
7181 px = GRID_X(path_g[i]);
7182 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7183 if(!who && (project_m_n == 1) && !jump){
7184 if(cave[project_m_y][project_m_x].m_idx >0 ){
7185 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7189 /* Hack -- auto-recall */
7190 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7192 /* Hack - auto-track */
7193 health_track(cave[project_m_y][project_m_x].m_idx);
7197 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7202 /* Project along the path */
7203 for (i = 0; i < path_n; ++i)
7208 int ny = GRID_Y(path_g[i]);
7209 int nx = GRID_X(path_g[i]);
7211 if (flg & PROJECT_DISI)
7213 /* Hack -- Balls explode before reaching walls */
7214 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7216 else if (flg & PROJECT_LOS)
7218 /* Hack -- Balls explode before reaching walls */
7219 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7223 /* Hack -- Balls explode before reaching walls */
7224 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7231 /* Collect beam grids */
7232 if (flg & (PROJECT_BEAM))
7239 /* Only do visuals if requested */
7240 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7242 /* Only do visuals if the player can "see" the bolt */
7243 if (panel_contains(y, x) && player_has_los_bold(y, x))
7250 /* Obtain the bolt pict */
7251 p = bolt_pict(oy, ox, y, x, typ);
7253 /* Extract attr/char */
7257 /* Visual effects */
7258 print_rel(c, a, y, x);
7259 move_cursor_relative(y, x);
7260 /*if (fresh_before)*/ Term_fresh();
7261 Term_xtra(TERM_XTRA_DELAY, msec);
7263 /*if (fresh_before)*/ Term_fresh();
7265 /* Display "beam" grids */
7266 if (flg & (PROJECT_BEAM))
7268 /* Obtain the explosion pict */
7269 p = bolt_pict(y, x, y, x, typ);
7271 /* Extract attr/char */
7275 /* Visual effects */
7276 print_rel(c, a, y, x);
7279 /* Hack -- Activate delay */
7283 /* Hack -- delay anyway for consistency */
7286 /* Delay for consistency */
7287 Term_xtra(TERM_XTRA_DELAY, msec);
7294 /* Save the "blast epicenter" */
7298 if (breath && !path_n)
7304 flg &= ~(PROJECT_HIDE);
7308 /* Start the "explosion" */
7311 /* Hack -- make sure beams get to "explode" */
7319 /* If we found a "target", explode there */
7320 if (dist <= MAX_RANGE)
7322 /* Mega-Hack -- remove the final "beam" grid */
7323 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7326 * Create a conical breath attack
7337 flg &= ~(PROJECT_HIDE);
7339 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7343 /* Determine the blast area, work from the inside out */
7344 for (dist = 0; dist <= rad; dist++)
7346 /* Scan the maximal blast area of radius "dist" */
7347 for (y = by - dist; y <= by + dist; y++)
7349 for (x = bx - dist; x <= bx + dist; x++)
7351 /* Ignore "illegal" locations */
7352 if (!in_bounds2(y, x)) continue;
7354 /* Enforce a "circular" explosion */
7355 if (distance(by, bx, y, x) != dist) continue;
7361 /* Lights are stopped by opaque terrains */
7362 if (!los(by, bx, y, x)) continue;
7364 case GF_DISINTEGRATE:
7365 /* Disintegration are stopped only by perma-walls */
7366 if (!in_disintegration_range(by, bx, y, x)) continue;
7369 /* Ball explosions are stopped by walls */
7370 if (!projectable(by, bx, y, x)) continue;
7374 /* Save this grid */
7381 /* Encode some more "radius" info */
7387 /* Speed -- ignore "non-explosions" */
7388 if (!grids) return (FALSE);
7391 /* Display the "blast area" if requested */
7392 if (!blind && !(flg & (PROJECT_HIDE)))
7394 /* Then do the "blast", from inside out */
7395 for (t = 0; t <= gm_rad; t++)
7397 /* Dump everything with this radius */
7398 for (i = gm[t]; i < gm[t+1]; i++)
7400 /* Extract the location */
7404 /* Only do visuals if the player can "see" the blast */
7405 if (panel_contains(y, x) && player_has_los_bold(y, x))
7414 /* Obtain the explosion pict */
7415 p = bolt_pict(y, x, y, x, typ);
7417 /* Extract attr/char */
7421 /* Visual effects -- Display */
7422 print_rel(c, a, y, x);
7426 /* Hack -- center the cursor */
7427 move_cursor_relative(by, bx);
7429 /* Flush each "radius" seperately */
7430 /*if (fresh_before)*/ Term_fresh();
7432 /* Delay (efficiently) */
7433 if (visual || drawn)
7435 Term_xtra(TERM_XTRA_DELAY, msec);
7439 /* Flush the erasing */
7442 /* Erase the explosion drawn above */
7443 for (i = 0; i < grids; i++)
7445 /* Extract the location */
7449 /* Hack -- Erase if needed */
7450 if (panel_contains(y, x) && player_has_los_bold(y, x))
7456 /* Hack -- center the cursor */
7457 move_cursor_relative(by, bx);
7459 /* Flush the explosion */
7460 /*if (fresh_before)*/ Term_fresh();
7465 /* Update stuff if needed */
7466 if (p_ptr->update) update_stuff();
7469 if (flg & PROJECT_KILL)
7471 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7472 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7476 /* Check features */
7477 if (flg & (PROJECT_GRID))
7479 /* Start with "dist" of zero */
7482 /* Scan for features */
7483 for (i = 0; i < grids; i++)
7485 /* Hack -- Notice new "dist" values */
7486 if (gm[dist+1] == i) dist++;
7488 /* Get the grid location */
7492 /* Find the closest point in the blast */
7495 int d = dist_to_line(y, x, y1, x1, by, bx);
7497 /* Affect the grid */
7498 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7502 /* Affect the grid */
7503 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7508 /* Update stuff if needed */
7509 if (p_ptr->update) update_stuff();
7512 if (flg & (PROJECT_ITEM))
7514 /* Start with "dist" of zero */
7517 /* Scan for objects */
7518 for (i = 0; i < grids; i++)
7520 /* Hack -- Notice new "dist" values */
7521 if (gm[dist+1] == i) dist++;
7523 /* Get the grid location */
7527 /* Find the closest point in the blast */
7530 int d = dist_to_line(y, x, y1, x1, by, bx);
7532 /* Affect the object in the grid */
7533 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7537 /* Affect the object in the grid */
7538 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7544 /* Check monsters */
7545 if (flg & (PROJECT_KILL))
7552 /* Start with "dist" of zero */
7555 /* Scan for monsters */
7556 for (i = 0; i < grids; i++)
7560 /* Hack -- Notice new "dist" values */
7561 if (gm[dist + 1] == i) dist++;
7563 /* Get the grid location */
7567 /* A single bolt may be reflected */
7570 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7571 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7573 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7574 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7575 (!who || dist_hack > 1) && !one_in_(10))
7578 int max_attempts = 10;
7580 /* Choose 'new' target */
7583 t_y = y_saver - 1 + randint1(3);
7584 t_x = x_saver - 1 + randint1(3);
7587 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7589 if (max_attempts < 1)
7595 sound(SOUND_REFLECT);
7598 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7599 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7600 else if (m_ptr->r_idx == MON_DIO)
7601 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7603 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7605 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7607 /* Reflected bolts randomly target either one */
7608 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7609 else flg |= PROJECT_PLAYER;
7611 /* The bolt is reflected */
7612 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7614 /* Don't affect the monster any longer */
7620 /* Find the closest point in the blast */
7623 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7627 effective_dist = dist;
7631 /* There is the riding player on this monster */
7632 if (p_ptr->riding && player_bold(y, x))
7634 /* Aimed on the player */
7635 if (flg & PROJECT_PLAYER)
7637 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7640 * A beam or bolt is well aimed
7642 * So don't affects the mount.
7649 * The spell is not well aimed,
7650 * So partly affect the mount too.
7657 * This grid is the original target.
7658 * Or aimed on your horse.
7660 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7662 /* Hit the mount with full damage */
7666 * Otherwise this grid is not the
7667 * original target, it means that line
7668 * of fire is obstructed by this
7672 * A beam or bolt will hit either
7673 * player or mount. Choose randomly.
7675 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7679 /* Hit the mount with full damage */
7683 /* Hit the player later */
7684 flg |= PROJECT_PLAYER;
7686 /* Don't affect the mount */
7692 * The spell is not well aimed, so
7693 * partly affect both player and
7702 /* Affect the monster in the grid */
7703 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7707 /* Player affected one monster (without "jumping") */
7708 if (!who && (project_m_n == 1) && !jump)
7714 /* Track if possible */
7715 if (cave[y][x].m_idx > 0)
7717 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7721 /* Hack -- auto-recall */
7722 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7724 /* Hack - auto-track */
7725 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7733 if (flg & (PROJECT_KILL))
7735 /* Start with "dist" of zero */
7738 /* Scan for player */
7739 for (i = 0; i < grids; i++)
7743 /* Hack -- Notice new "dist" values */
7744 if (gm[dist+1] == i) dist++;
7746 /* Get the grid location */
7750 /* Affect the player? */
7751 if (!player_bold(y, x)) continue;
7753 /* Find the closest point in the blast */
7756 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7760 effective_dist = dist;
7763 /* Target may be your horse */
7766 /* Aimed on the player */
7767 if (flg & PROJECT_PLAYER)
7769 /* Hit the player with full damage */
7773 * Hack -- When this grid was not the
7774 * original target, a beam or bolt
7775 * would hit either player or mount,
7776 * and should be choosen randomly.
7778 * But already choosen to hit the
7779 * mount at this point.
7781 * Or aimed on your horse.
7783 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7786 * A beam or bolt is well aimed
7788 * So don't affects the player.
7795 * The spell is not well aimed,
7796 * So partly affect the player too.
7802 /* Affect the player */
7803 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7811 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7813 if (rakubadam_m > 0)
7815 if (rakuba(rakubadam_m, FALSE))
7817 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7820 if (p_ptr->riding && rakubadam_p > 0)
7822 if(rakuba(rakubadam_p, FALSE))
7824 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7829 /* Return "something was noticed" */
7834 * @brief 鏡魔法「封魔結界」の効果処理
7836 * @return 効果があったらTRUEを返す
7838 bool binding_field( HIT_POINT dam )
7840 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7841 int mirror_num=0; /* 鏡の数 */
7846 int msec= delay_factor*delay_factor*delay_factor;
7852 /* Default target of monsterspell is player */
7853 monster_target_y=p_ptr->y;
7854 monster_target_x=p_ptr->x;
7856 for( x=0 ; x < cur_wid ; x++ )
7858 for( y=0 ; y < cur_hgt ; y++ )
7860 if( is_mirror_grid(&cave[y][x]) &&
7861 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7862 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7863 player_has_los_bold(y,x) &&
7864 projectable(p_ptr->y, p_ptr->x, y, x)
7866 mirror_y[mirror_num]=y;
7867 mirror_x[mirror_num]=x;
7873 if( mirror_num < 2 )return FALSE;
7875 point_x[0] = randint0( mirror_num );
7877 point_x[1] = randint0( mirror_num );
7879 while( point_x[0] == point_x[1] );
7881 point_y[0]=mirror_y[point_x[0]];
7882 point_x[0]=mirror_x[point_x[0]];
7883 point_y[1]=mirror_y[point_x[1]];
7884 point_x[1]=mirror_x[point_x[1]];
7885 point_y[2]=p_ptr->y;
7886 point_x[2]=p_ptr->x;
7888 x=point_x[0]+point_x[1]+point_x[2];
7889 y=point_y[0]+point_y[1]+point_y[2];
7891 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7892 - (point_y[0]*3-y)*(point_x[1]*3-x);
7893 if( centersign == 0 )return FALSE;
7895 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7896 x1 = x1 < point_x[2] ? x1 : point_x[2];
7897 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7898 y1 = y1 < point_y[2] ? y1 : point_y[2];
7900 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7901 x2 = x2 > point_x[2] ? x2 : point_x[2];
7902 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7903 y2 = y2 > point_y[2] ? y2 : point_y[2];
7905 for( y=y1 ; y <=y2 ; y++ ){
7906 for( x=x1 ; x <=x2 ; x++ ){
7907 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7908 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7909 centersign*( (point_x[1]-x)*(point_y[2]-y)
7910 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7911 centersign*( (point_x[2]-x)*(point_y[0]-y)
7912 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7914 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7915 /* Visual effects */
7917 && panel_contains(y,x)){
7918 p = bolt_pict(y,x,y,x, GF_MANA );
7919 print_rel(PICT_C(p), PICT_A(p),y,x);
7920 move_cursor_relative(y, x);
7921 /*if (fresh_before)*/ Term_fresh();
7922 Term_xtra(TERM_XTRA_DELAY, msec);
7928 for( y=y1 ; y <=y2 ; y++ ){
7929 for( x=x1 ; x <=x2 ; x++ ){
7930 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7931 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7932 centersign*( (point_x[1]-x)*(point_y[2]-y)
7933 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7934 centersign*( (point_x[2]-x)*(point_y[0]-y)
7935 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7937 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7938 (void)project_f(0,0,y,x,dam,GF_MANA);
7943 for( y=y1 ; y <=y2 ; y++ ){
7944 for( x=x1 ; x <=x2 ; x++ ){
7945 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7946 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7947 centersign*( (point_x[1]-x)*(point_y[2]-y)
7948 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7949 centersign*( (point_x[2]-x)*(point_y[0]-y)
7950 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7952 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7953 (void)project_o(0,0,y,x,dam,GF_MANA);
7958 for( y=y1 ; y <=y2 ; y++ ){
7959 for( x=x1 ; x <=x2 ; x++ ){
7960 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7961 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7962 centersign*( (point_x[1]-x)*(point_y[2]-y)
7963 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7964 centersign*( (point_x[2]-x)*(point_y[0]-y)
7965 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7967 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7968 (void)project_m(0,0,y,x,dam,GF_MANA,
7969 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7975 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7976 remove_mirror(point_y[0],point_x[0]);
7983 * @brief 鏡魔法「鏡の封印」の効果処理
7985 * @return 効果があったらTRUEを返す
7987 void seal_of_mirror( HIT_POINT dam )
7991 for( x = 0 ; x < cur_wid ; x++ )
7993 for( y = 0 ; y < cur_hgt ; y++ )
7995 if( is_mirror_grid(&cave[y][x]))
7997 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
7998 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8000 if( !cave[y][x].m_idx )