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 #include "object-curse.h"
18 #include "player-damage.h"
21 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
22 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
24 int project_length = 0; /*!< 投射の射程距離 */
28 * @brief モンスター魅了用セービングスロー共通部(汎用系)
30 * @param m_ptr 対象モンスター
31 * @return 魅了に抵抗したらTRUE
33 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
35 monster_race *r_ptr = &r_info[m_ptr->r_idx];
37 if(p_ptr->inside_arena) return TRUE;
40 if (r_ptr->flagsr & RFR_RES_ALL)
42 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
46 if (r_ptr->flags3 & RF3_NO_CONF)
48 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
52 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
54 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
55 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
56 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
60 * @brief モンスター服従用セービングスロー共通部(部族依存系)
62 * @param m_ptr 対象モンスター
63 * @return 服従に抵抗したらTRUE
65 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
67 monster_race *r_ptr = &r_info[m_ptr->r_idx];
69 if (p_ptr->inside_arena) return TRUE;
72 if (r_ptr->flagsr & RFR_RES_ALL)
74 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
78 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
80 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
81 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
82 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
86 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
89 * ハードコーティングによる実装が行われている。
90 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
92 PERCENTAGE beam_chance(void)
94 if (p_ptr->pclass == CLASS_MAGE)
95 return (PERCENTAGE)(p_ptr->lev);
96 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
97 return (PERCENTAGE)(p_ptr->lev + 10);
99 return (PERCENTAGE)(p_ptr->lev / 2);
104 * @brief 配置した鏡リストの次を取得する /
105 * Get another mirror. for SEEKER
106 * @param next_y 次の鏡のy座標を返す参照ポインタ
107 * @param next_x 次の鏡のx座標を返す参照ポインタ
108 * @param cury 現在の鏡のy座標
109 * @param curx 現在の鏡のx座標
111 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
113 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
114 int mirror_num = 0; /* 鏡の数 */
118 for (x = 0; x < cur_wid; x++)
120 for (y = 0; y < cur_hgt; y++)
122 if (is_mirror_grid(&cave[y][x])) {
123 mirror_y[mirror_num] = y;
124 mirror_x[mirror_num] = x;
131 num = randint0(mirror_num);
132 *next_y = mirror_y[num];
133 *next_x = mirror_x[num];
136 *next_y = cury + randint0(5) - 2;
137 *next_x = curx + randint0(5) - 2;
142 * @brief 万色表現用にランダムな色を選択する関数 /
143 * Get a legal "multi-hued" color for drawing "spells"
147 static byte mh_attr(int max)
149 switch (randint1(max))
151 case 1: return (TERM_RED);
152 case 2: return (TERM_GREEN);
153 case 3: return (TERM_BLUE);
154 case 4: return (TERM_YELLOW);
155 case 5: return (TERM_ORANGE);
156 case 6: return (TERM_VIOLET);
157 case 7: return (TERM_L_RED);
158 case 8: return (TERM_L_GREEN);
159 case 9: return (TERM_L_BLUE);
160 case 10: return (TERM_UMBER);
161 case 11: return (TERM_L_UMBER);
162 case 12: return (TERM_SLATE);
163 case 13: return (TERM_WHITE);
164 case 14: return (TERM_L_WHITE);
165 case 15: return (TERM_L_DARK);
173 * @brief 魔法属性に応じたエフェクトの色を返す /
174 * Return a color to use for the bolt/ball spells
178 static byte spell_color(int type)
180 /* Check if A.B.'s new graphics should be used (rr9) */
181 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
186 case GF_PSY_SPEAR: return (0x06);
187 case GF_MISSILE: return (0x0F);
188 case GF_ACID: return (0x04);
189 case GF_ELEC: return (0x02);
190 case GF_FIRE: return (0x00);
191 case GF_COLD: return (0x01);
192 case GF_POIS: return (0x03);
193 case GF_HOLY_FIRE: return (0x00);
194 case GF_HELL_FIRE: return (0x00);
195 case GF_MANA: return (0x0E);
197 case GF_SEEKER: return (0x0E);
198 case GF_SUPER_RAY: return (0x0E);
200 case GF_ARROW: return (0x0F);
201 case GF_WATER: return (0x04);
202 case GF_NETHER: return (0x07);
203 case GF_CHAOS: return (mh_attr(15));
204 case GF_DISENCHANT: return (0x05);
205 case GF_NEXUS: return (0x0C);
206 case GF_CONFUSION: return (mh_attr(4));
207 case GF_SOUND: return (0x09);
208 case GF_SHARDS: return (0x08);
209 case GF_FORCE: return (0x09);
210 case GF_INERTIAL: return (0x09);
211 case GF_GRAVITY: return (0x09);
212 case GF_TIME: return (0x09);
213 case GF_LITE_WEAK: return (0x06);
214 case GF_LITE: return (0x06);
215 case GF_DARK_WEAK: return (0x07);
216 case GF_DARK: return (0x07);
217 case GF_PLASMA: return (0x0B);
218 case GF_METEOR: return (0x00);
219 case GF_ICE: return (0x01);
220 case GF_ROCKET: return (0x0F);
221 case GF_DEATH_RAY: return (0x07);
222 case GF_NUKE: return (mh_attr(2));
223 case GF_DISINTEGRATE: return (0x05);
235 case GF_CAUSE_4: return (0x0E);
236 case GF_HAND_DOOM: return (0x07);
237 case GF_CAPTURE : return (0x0E);
238 case GF_IDENTIFY: return (0x01);
239 case GF_ATTACK: return (0x0F);
240 case GF_PHOTO : return (0x06);
243 /* Normal tiles or ASCII */
249 /* Lookup the default colors for this type */
250 cptr s = quark_str(gf_color[type]);
252 if (!s) return (TERM_WHITE);
254 /* Pick a random color */
255 c = s[randint0(strlen(s))];
257 /* Lookup this color */
258 a = my_strchr(color_char, c) - color_char;
260 /* Invalid color (note check for < 0 removed, gave a silly
261 * warning because bytes are always >= 0 -- RG) */
262 if (a > 15) return (TERM_WHITE);
268 /* Standard "color" */
274 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
275 * Find the attr/char pair to use for a spell effect
284 * It is moving (or has moved) from (x,y) to (nx,ny).
285 * If the distance is not "one", we (may) return "*".
288 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
298 if ((ny == y) && (nx == x)) base = 0x30;
301 else if (nx == x) base = 0x40;
304 else if (ny == y) base = 0x50;
307 else if ((ny - y) == (x - nx)) base = 0x60;
310 else if ((ny - y) == (nx - x)) base = 0x70;
315 /* Basic spell color */
316 k = spell_color(typ);
318 /* Obtain attr/char */
319 a = misc_to_attr[base + k];
320 c = misc_to_char[base + k];
328 * @brief 始点から終点への経路を返す /
329 * Determine the path taken by a projection.
330 * @param gp 経路座標リストを返す参照ポインタ
340 * The projection will always start from the grid (y1,x1), and will travel
341 * towards the grid (y2,x2), touching one grid per unit of distance along
342 * the major axis, and stopping when it enters the destination grid or a
343 * wall grid, or has travelled the maximum legal distance of "range".
345 * Note that "distance" in this function (as in the "update_view()" code)
346 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
347 * actually has an "octagon of projection" not a "circle of projection".
349 * The path grids are saved into the grid array pointed to by "gp", and
350 * there should be room for at least "range" grids in "gp". Note that
351 * due to the way in which distance is calculated, this function normally
352 * uses fewer than "range" grids for the projection path, so the result
353 * of this function should never be compared directly to "range". Note
354 * that the initial grid (y1,x1) is never saved into the grid array, not
355 * even if the initial grid is also the final grid.
357 * The "flg" flags can be used to modify the behavior of this function.
359 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
360 * semantics as they do for the "project" function, namely, that the path
361 * will stop as soon as it hits a monster, or that the path will continue
362 * through the destination grid, respectively.
364 * The "PROJECT_JUMP" flag, which for the "project()" function means to
365 * start at a special grid (which makes no sense in this function), means
366 * that the path should be "angled" slightly if needed to avoid any wall
367 * grids, allowing the player to "target" any grid which is in "view".
368 * This flag is non-trivial and has not yet been implemented, but could
369 * perhaps make use of the "vinfo" array (above).
371 * This function returns the number of grids (if any) in the path. This
372 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
374 * This algorithm is similar to, but slightly different from, the one used
375 * by "update_view_los()", and very different from the one used by "los()".
378 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
400 /* No path necessary (or allowed) */
401 if ((x1 == x2) && (y1 == y2)) return (0);
429 /* Number of "units" in one "half" grid */
432 /* Number of "units" in one "full" grid */
438 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
449 /* Advance (X) part 2 */
452 /* Advance (X) part 3 */
459 /* Create the projection path */
463 gp[n++] = GRID(y, x);
465 /* Hack -- Check maximum range */
466 if ((n + (k >> 1)) >= range) break;
468 /* Sometimes stop at destination grid */
469 if (!(flg & (PROJECT_THRU)))
471 if ((x == x2) && (y == y2)) break;
474 if (flg & (PROJECT_DISI))
476 if ((n > 0) && cave_stop_disintegration(y, x)) break;
478 else if (flg & (PROJECT_LOS))
480 if ((n > 0) && !cave_los_bold(y, x)) break;
482 else if (!(flg & (PROJECT_PATH)))
484 /* Always stop at non-initial wall grids */
485 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
488 /* Sometimes stop at non-initial monsters/players */
489 if (flg & (PROJECT_STOP))
492 (player_bold(y, x) || cave[y][x].m_idx != 0))
496 if (!in_bounds(y, x)) break;
501 /* Advance (X) part 1 */
504 /* Horizontal change */
507 /* Advance (X) part 2 */
510 /* Advance (X) part 3 */
526 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
535 /* Vertical change */
538 /* Advance (Y) part 2 */
541 /* Advance (Y) part 3 */
548 /* Create the projection path */
552 gp[n++] = GRID(y, x);
554 /* Hack -- Check maximum range */
555 if ((n + (k >> 1)) >= range) break;
557 /* Sometimes stop at destination grid */
558 if (!(flg & (PROJECT_THRU)))
560 if ((x == x2) && (y == y2)) break;
563 if (flg & (PROJECT_DISI))
565 if ((n > 0) && cave_stop_disintegration(y, x)) break;
567 else if (flg & (PROJECT_LOS))
569 if ((n > 0) && !cave_los_bold(y, x)) break;
571 else if (!(flg & (PROJECT_PATH)))
573 /* Always stop at non-initial wall grids */
574 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
577 /* Sometimes stop at non-initial monsters/players */
578 if (flg & (PROJECT_STOP))
581 (player_bold(y, x) || cave[y][x].m_idx != 0))
585 if (!in_bounds(y, x)) break;
590 /* Advance (Y) part 1 */
593 /* Vertical change */
596 /* Advance (Y) part 2 */
599 /* Advance (Y) part 3 */
619 /* Create the projection path */
623 gp[n++] = GRID(y, x);
625 /* Hack -- Check maximum range */
626 if ((n + (n >> 1)) >= range) break;
628 /* Sometimes stop at destination grid */
629 if (!(flg & (PROJECT_THRU)))
631 if ((x == x2) && (y == y2)) break;
634 if (flg & (PROJECT_DISI))
636 if ((n > 0) && cave_stop_disintegration(y, x)) break;
638 else if (flg & (PROJECT_LOS))
640 if ((n > 0) && !cave_los_bold(y, x)) break;
642 else if (!(flg & (PROJECT_PATH)))
644 /* Always stop at non-initial wall grids */
645 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
648 /* Sometimes stop at non-initial monsters/players */
649 if (flg & (PROJECT_STOP))
652 (player_bold(y, x) || cave[y][x].m_idx != 0))
656 if (!in_bounds(y, x)) break;
673 * Mega-Hack -- track "affected" monsters (see "project()" comments)
675 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
676 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
677 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
678 /* Mega-Hack -- monsters target */
679 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
680 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
684 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
685 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
686 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
687 * @param y 目標Y座標 / Target y location (or location to travel "towards")
688 * @param x 目標X座標 / Target x location (or location to travel "towards")
689 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
690 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
691 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
694 * We are called both for "beam" effects and "ball" effects.
696 * The "r" parameter is the "distance from ground zero".
698 * Note that we determine if the player can "see" anything that happens
699 * by taking into account: blindness, line-of-sight, and illumination.
701 * We return "TRUE" if the effect of the projection is "obvious".
703 * We also "see" grids which are "memorized", probably a hack
705 * Perhaps we should affect doors?
708 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
710 cave_type *c_ptr = &cave[y][x];
711 feature_type *f_ptr = &f_info[c_ptr->feat];
713 bool obvious = FALSE;
714 bool known = player_has_los_bold(y, x);
719 /* Reduce damage by distance */
720 dam = (dam + r) / (r + 1);
723 if (have_flag(f_ptr->flags, FF_TREE))
731 message = _("枯れた", "was blasted."); break;
733 message = _("縮んだ", "shrank."); break;
735 message = _("溶けた", "melted."); break;
738 message = _("凍り、砕け散った", "was frozen and smashed."); break;
742 message = _("燃えた", "burns up!"); break;
754 message = _("粉砕された", "was crushed."); break;
756 message = NULL; break;
760 msg_format(_("木は%s。", "A tree %s"), message);
761 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
764 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
768 /* Analyze the type */
771 /* Ignore most effects */
806 /* Destroy Traps (and Locks) */
809 /* Reveal secret doors */
810 if (is_hidden_door(c_ptr))
815 /* Check line of sight */
823 if (is_trap(c_ptr->feat))
825 /* Check line of sight */
828 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
832 /* Destroy the trap */
833 cave_alter_feat(y, x, FF_DISARM);
836 /* Locked doors are unlocked */
837 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
839 s16b old_feat = c_ptr->feat;
841 /* Unlock the door */
842 cave_alter_feat(y, x, FF_DISARM);
844 /* Check line of sound */
845 if (known && (old_feat != c_ptr->feat))
847 msg_print(_("カチッと音がした!", "Click!"));
852 /* Remove "unsafe" flag if player is not blind */
853 if (!p_ptr->blind && player_has_los_bold(y, x))
855 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
897 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
899 if (have_flag(f_ptr->flags, FF_SPIKE))
901 s16b old_mimic = c_ptr->mimic;
902 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
904 cave_alter_feat(y, x, FF_SPIKE);
906 c_ptr->mimic = old_mimic;
913 /* Check line of sight */
914 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
916 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
923 /* Destroy walls (and doors) */
926 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
928 if (known && (c_ptr->info & (CAVE_MARK)))
930 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
934 /* Destroy the wall */
935 cave_alter_feat(y, x, FF_HURT_ROCK);
937 /* Update some things */
938 p_ptr->update |= (PU_FLOW);
947 /* Require a "naked" floor grid */
948 if (!cave_naked_bold(y, x)) break;
950 /* Not on the player */
951 if (player_bold(y, x)) break;
953 /* Create a closed door */
954 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
957 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
974 /* Require a "naked" floor grid */
975 if (!cave_naked_bold(y, x)) break;
977 /* Not on the player */
978 if (player_bold(y, x)) break;
980 /* Create a closed door */
981 cave_set_feat(y, x, feat_tree);
984 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
992 /* Require a "naked" floor grid */
993 if (!cave_naked_bold(y, x)) break;
996 c_ptr->info |= CAVE_OBJECT;
997 c_ptr->mimic = feat_glyph;
1009 /* Require a "naked" floor grid */
1010 if (!cave_naked_bold(y, x)) break;
1012 /* Not on the player */
1013 if (player_bold(y, x)) break;
1016 cave_set_feat(y, x, feat_granite);
1024 /* Ignore permanent grid */
1025 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1030 /* Ignore grid without enough space */
1031 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1033 /* Place a shallow lava */
1034 cave_set_feat(y, x, feat_shallow_lava);
1039 /* Place a deep lava */
1040 cave_set_feat(y, x, feat_deep_lava);
1047 /* Ignore permanent grid */
1048 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1053 /* Ignore grid without enough space */
1054 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1056 /* Place a shallow water */
1057 cave_set_feat(y, x, feat_shallow_water);
1062 /* Place a deep water */
1063 cave_set_feat(y, x, feat_deep_water);
1068 /* Lite up the grid */
1072 /* Turn on the light */
1073 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1075 c_ptr->info |= (CAVE_GLOW);
1082 update_local_illumination(y, x);
1085 if (player_can_see_bold(y, x)) obvious = TRUE;
1087 /* Mega-Hack -- Update the monster in the affected grid */
1088 /* This allows "spear of light" (etc) to work "correctly" */
1089 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1091 if (p_ptr->special_defense & NINJA_S_STEALTH)
1093 if (player_bold(y, x)) set_superstealth(FALSE);
1100 /* Darken the grid */
1104 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1107 /* Turn off the light. */
1110 if (dun_level || !is_daytime())
1112 for (j = 0; j < 9; j++)
1114 int by = y + ddy_ddd[j];
1115 int bx = x + ddx_ddd[j];
1117 if (in_bounds2(by, bx))
1119 cave_type *cc_ptr = &cave[by][bx];
1121 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1129 if (!do_dark) break;
1132 c_ptr->info &= ~(CAVE_GLOW);
1134 /* Hack -- Forget "boring" grids */
1135 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1138 c_ptr->info &= ~(CAVE_MARK);
1146 update_local_illumination(y, x);
1148 if (player_can_see_bold(y, x)) obvious = TRUE;
1150 /* Mega-Hack -- Update the monster in the affected grid */
1151 /* This allows "spear of light" (etc) to work "correctly" */
1152 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1162 if (is_mirror_grid(c_ptr))
1164 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1166 remove_mirror(y, x);
1167 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1170 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1172 if (known && (c_ptr->info & CAVE_MARK))
1174 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1178 /* Destroy the wall */
1179 cave_alter_feat(y, x, FF_HURT_ROCK);
1181 /* Update some things */
1182 p_ptr->update |= (PU_FLOW);
1189 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1191 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1193 remove_mirror(y, x);
1194 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1197 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1199 if (known && (c_ptr->info & CAVE_MARK))
1201 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1205 /* Destroy the wall */
1206 cave_alter_feat(y, x, FF_HURT_ROCK);
1208 /* Update some things */
1209 p_ptr->update |= (PU_FLOW);
1214 case GF_DISINTEGRATE:
1216 /* Destroy mirror/glyph */
1217 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1218 remove_mirror(y, x);
1220 /* Permanent features don't get effect */
1221 /* But not protect monsters and other objects */
1222 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1224 cave_alter_feat(y, x, FF_HURT_DISI);
1226 /* Update some things -- similar to GF_KILL_WALL */
1227 p_ptr->update |= (PU_FLOW);
1234 /* Return "Anything seen?" */
1241 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1242 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1243 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1244 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1245 * @param x 目標X座標 / Target x location (or location to travel "towards")
1246 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1247 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1248 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1251 * We are called from "project()" to "damage" objects
1253 * We are called both for "beam" effects and "ball" effects.
1255 * Perhaps we should only SOMETIMES damage things on the ground.
1257 * The "r" parameter is the "distance from ground zero".
1259 * Note that we determine if the player can "see" anything that happens
1260 * by taking into account: blindness, line-of-sight, and illumination.
1262 * We also "see" grids which are "memorized", probably a hack
1264 * We return "TRUE" if the effect of the projection is "obvious".
1267 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1269 cave_type *c_ptr = &cave[y][x];
1271 OBJECT_IDX this_o_idx, next_o_idx = 0;
1273 bool obvious = FALSE;
1274 bool known = player_has_los_bold(y, x);
1276 BIT_FLAGS flgs[TR_FLAG_SIZE];
1278 char o_name[MAX_NLEN];
1280 KIND_OBJECT_IDX k_idx = 0;
1281 bool is_potion = FALSE;
1284 who = who ? who : 0;
1286 /* Reduce damage by distance */
1287 dam = (dam + r) / (r + 1);
1290 /* Scan all objects in the grid */
1291 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1293 /* Acquire object */
1294 object_type *o_ptr = &o_list[this_o_idx];
1296 bool is_art = FALSE;
1297 bool ignore = FALSE;
1298 bool do_kill = FALSE;
1300 cptr note_kill = NULL;
1303 /* Get the "plural"-ness */
1304 bool plural = (o_ptr->number > 1);
1307 /* Acquire next object */
1308 next_o_idx = o_ptr->next_o_idx;
1310 /* Extract the flags */
1311 object_flags(o_ptr, flgs);
1313 /* Check for artifact */
1314 if (object_is_artifact(o_ptr)) is_art = TRUE;
1316 /* Analyze the type */
1319 /* Acid -- Lots of things */
1322 if (hates_acid(o_ptr))
1325 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1326 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1331 /* Elec -- Rings and Wands */
1334 if (hates_elec(o_ptr))
1337 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1338 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1343 /* Fire -- Flammable objects */
1346 if (hates_fire(o_ptr))
1349 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1350 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1355 /* Cold -- potions and flasks */
1358 if (hates_cold(o_ptr))
1360 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1362 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1370 if (hates_fire(o_ptr))
1373 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1374 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1376 if (hates_elec(o_ptr))
1380 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1381 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1389 if (hates_fire(o_ptr))
1392 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1393 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1395 if (hates_cold(o_ptr))
1399 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1400 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1405 /* Hack -- break potions and such */
1411 if (hates_cold(o_ptr))
1413 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1419 /* Mana and Chaos -- destroy everything */
1425 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1429 case GF_DISINTEGRATE:
1432 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1439 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1440 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1441 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1445 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1449 if (object_is_cursed(o_ptr))
1452 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1459 identify_item(o_ptr);
1461 /* Auto-inscription */
1462 autopick_alter_item((-this_o_idx), FALSE);
1470 /* Chests are noticed only if trapped or locked */
1471 if (o_ptr->tval == TV_CHEST)
1473 /* Disarm/Unlock traps */
1474 if (o_ptr->pval > 0)
1476 /* Disarm or Unlock */
1477 o_ptr->pval = (0 - o_ptr->pval);
1480 object_known(o_ptr);
1482 if (known && (o_ptr->marked & OM_FOUND))
1484 msg_print(_("カチッと音がした!", "Click!"));
1494 if (o_ptr->tval == TV_CORPSE)
1497 BIT_FLAGS mode = 0L;
1499 if (!who || is_pet(&m_list[who]))
1500 mode |= PM_FORCE_PET;
1502 for (i = 0; i < o_ptr->number ; i++)
1504 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1505 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1509 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1513 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1515 note_kill = _("生き返った。", " revived.");
1517 else if (!note_kill)
1519 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1530 /* Attempt to destroy the object */
1533 /* Effect "observed" */
1534 if (known && (o_ptr->marked & OM_FOUND))
1537 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1540 /* Artifacts, and other objects, get to resist */
1541 if (is_art || ignore)
1543 /* Observe the resist */
1544 if (known && (o_ptr->marked & OM_FOUND))
1546 msg_format(_("%sは影響を受けない!",
1547 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1554 /* Describe if needed */
1555 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1557 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1560 k_idx = o_ptr->k_idx;
1561 is_potion = object_is_potion(o_ptr);
1562 delete_object_idx(this_o_idx);
1564 /* Potions produce effects when 'shattered' */
1567 (void)potion_smash_effect(who, y, x, k_idx);
1576 /* Return "Anything seen?" */
1582 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1583 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1584 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1585 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1586 * @param x 目標X座標 / Target x location (or location to travel "towards")
1587 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1588 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1590 * @param see_s_msg TRUEならばメッセージを表示する
1591 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1594 * This routine takes a "source monster" (by index) which is mostly used to
1595 * determine if the player is causing the damage, and a "radius" (see below),
1596 * which is used to decrease the power of explosions with distance, and a
1597 * location, via integers which are modified by certain types of attacks
1598 * (polymorph and teleport being the obvious ones), a default damage, which
1599 * is modified as needed based on various properties, and finally a "damage
1600 * type" (see below).
1603 * Note that this routine can handle "no damage" attacks (like teleport) by
1604 * taking a "zero" damage, and can even take "parameters" to attacks (like
1605 * confuse) by accepting a "damage", using it to calculate the effect, and
1606 * then setting the damage to zero. Note that the "damage" parameter is
1607 * divided by the radius, so monsters not at the "epicenter" will not take
1608 * as much damage (or whatever)...
1611 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1612 * may result in a dereference of an invalid pointer.
1615 * Various messages are produced, and damage is applied.
1618 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1619 * actually be "made" of that substance, or "breathe" big balls of it.
1620 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1622 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1623 * and hurts evil less. If can breath nether, then it resists it as well.
1626 * Damage reductions use the following formulas:
1627 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1628 * gives avg damage of .655, ranging from .858 to .500
1629 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1630 * gives avg damage of .544, ranging from .714 to .417
1631 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1632 * gives avg damage of .444, ranging from .556 to .333
1633 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1634 * gives avg damage of .327, ranging from .427 to .250
1635 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1636 * gives something simple.
1639 * In this function, "result" messages are postponed until the end, where
1640 * the "note" string is appended to the monster name, if not NULL. So,
1641 * to make a spell have "no effect" just set "note" to NULL. You should
1642 * also set "notice" to FALSE, or the player will learn what the spell does.
1645 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1649 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1653 cave_type *c_ptr = &cave[y][x];
1655 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1656 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1658 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1662 /* Is the monster "seen"? */
1663 bool seen = m_ptr->ml;
1664 bool seen_msg = is_seen(m_ptr);
1666 bool slept = (bool)MON_CSLEEP(m_ptr);
1668 /* Were the effects "obvious" (if seen)? */
1669 bool obvious = FALSE;
1671 /* Can the player know about this effect? */
1672 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1674 /* Were the effects "irrelevant"? */
1675 bool skipped = FALSE;
1677 /* Gets the monster angry at the source of the effect? */
1678 bool get_angry = FALSE;
1680 /* Polymorph setting (true or false) */
1681 bool do_poly = FALSE;
1683 /* Teleport setting (max distance) */
1686 /* Confusion setting (amount to confuse) */
1689 /* Stunning setting (amount to stun) */
1692 /* Sleep amount (amount to sleep) */
1695 /* Fear amount (amount to fear) */
1698 /* Time amount (amount to time) */
1701 bool heal_leper = FALSE;
1703 /* Hold the monster name */
1707 PARAMETER_VALUE photo = 0;
1709 /* Assume no note */
1712 /* Assume a default death */
1713 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1718 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1721 if (!c_ptr->m_idx) return (FALSE);
1723 /* Never affect projector */
1724 if (who && (c_ptr->m_idx == who)) return (FALSE);
1725 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1726 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1728 /* Don't affect already death monsters */
1729 /* Prevents problems with chain reactions of exploding monsters */
1730 if (m_ptr->hp < 0) return (FALSE);
1732 /* Reduce damage by distance */
1733 dam = (dam + r) / (r + 1);
1736 /* Get the monster name (BEFORE polymorphing) */
1737 monster_desc(m_name, m_ptr, 0);
1739 /* Get the monster possessive ("his"/"her"/"its") */
1740 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1742 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1744 /* Analyze the damage type */
1747 /* Magic Missile -- pure damage */
1750 if (seen) obvious = TRUE;
1752 if (r_ptr->flagsr & RFR_RES_ALL)
1754 note = _("には完全な耐性がある!", " is immune.");
1756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1765 if (seen) obvious = TRUE;
1767 if (r_ptr->flagsr & RFR_RES_ALL)
1769 note = _("には完全な耐性がある!", " is immune.");
1771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1774 if (r_ptr->flagsr & RFR_IM_ACID)
1776 note = _("にはかなり耐性がある!", " resists a lot.");
1778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1786 if (seen) obvious = TRUE;
1788 if (r_ptr->flagsr & RFR_RES_ALL)
1790 note = _("には完全な耐性がある!", " is immune.");
1792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1795 if (r_ptr->flagsr & RFR_IM_ELEC)
1797 note = _("にはかなり耐性がある!", " resists a lot.");
1799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1807 if (seen) obvious = TRUE;
1809 if (r_ptr->flagsr & RFR_RES_ALL)
1811 note = _("には完全な耐性がある!", " is immune.");
1813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1816 if (r_ptr->flagsr & RFR_IM_FIRE)
1818 note = _("にはかなり耐性がある!", " resists a lot.");
1820 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1822 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1824 note = _("はひどい痛手をうけた。", " is hit hard.");
1826 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1834 if (seen) obvious = TRUE;
1836 if (r_ptr->flagsr & RFR_RES_ALL)
1838 note = _("には完全な耐性がある!", " is immune.");
1840 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1843 if (r_ptr->flagsr & RFR_IM_COLD)
1845 note = _("にはかなり耐性がある!", " resists a lot.");
1847 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1849 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1851 note = _("はひどい痛手をうけた。", " is hit hard.");
1853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1861 if (seen) obvious = TRUE;
1863 if (r_ptr->flagsr & RFR_RES_ALL)
1865 note = _("には完全な耐性がある!", " is immune.");
1867 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1870 if (r_ptr->flagsr & RFR_IM_POIS)
1872 note = _("にはかなり耐性がある!", " resists a lot.");
1874 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1882 if (seen) obvious = TRUE;
1884 if (r_ptr->flagsr & RFR_RES_ALL)
1886 note = _("には完全な耐性がある!", " is immune.");
1888 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1891 if (r_ptr->flagsr & RFR_IM_POIS)
1893 note = _("には耐性がある。", " resists.");
1894 dam *= 3; dam /= randint1(6) + 6;
1895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1897 else if (one_in_(3)) do_poly = TRUE;
1901 /* Hellfire -- hurts Evil */
1904 if (seen) obvious = TRUE;
1906 if (r_ptr->flagsr & RFR_RES_ALL)
1908 note = _("には完全な耐性がある!", " is immune.");
1910 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1913 if (r_ptr->flags3 & RF3_GOOD)
1915 note = _("はひどい痛手をうけた。", " is hit hard.");
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1922 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1925 if (seen) obvious = TRUE;
1927 if (r_ptr->flagsr & RFR_RES_ALL)
1929 note = _("には完全な耐性がある!", " is immune.");
1931 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1934 if (r_ptr->flags3 & RF3_GOOD)
1936 note = _("には完全な耐性がある!", " is immune.");
1938 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1940 else if (r_ptr->flags3 & RF3_EVIL)
1943 note = _("はひどい痛手をうけた。", " is hit hard.");
1944 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1948 note = _("には耐性がある。", " resists.");
1949 dam *= 3; dam /= randint1(6) + 6;
1954 /* Arrow -- XXX no defense */
1957 if (seen) obvious = TRUE;
1959 if (r_ptr->flagsr & RFR_RES_ALL)
1961 note = _("には完全な耐性がある!", " is immune.");
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1969 /* Plasma -- XXX perhaps check ELEC or FIRE */
1972 if (seen) obvious = TRUE;
1974 if (r_ptr->flagsr & RFR_RES_ALL)
1976 note = _("には完全な耐性がある!", " is immune.");
1978 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1981 if (r_ptr->flagsr & RFR_RES_PLAS)
1983 note = _("には耐性がある。", " resists.");
1984 dam *= 3; dam /= randint1(6) + 6;
1985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1990 /* Nether -- see above */
1993 if (seen) obvious = TRUE;
1995 if (r_ptr->flagsr & RFR_RES_ALL)
1997 note = _("には完全な耐性がある!", " is immune.");
1999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2002 if (r_ptr->flagsr & RFR_RES_NETH)
2004 if (r_ptr->flags3 & RF3_UNDEAD)
2006 note = _("には完全な耐性がある!", " is immune.");
2008 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2012 note = _("には耐性がある。", " resists.");
2013 dam *= 3; dam /= randint1(6) + 6;
2015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2017 else if (r_ptr->flags3 & RF3_EVIL)
2019 note = _("はいくらか耐性を示した。", " resists somewhat.");
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2026 /* Water (acid) damage -- Water spirits/elementals are immune */
2029 if (seen) obvious = TRUE;
2031 if (r_ptr->flagsr & RFR_RES_ALL)
2033 note = _("には完全な耐性がある!", " is immune.");
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2038 if (r_ptr->flagsr & RFR_RES_WATE)
2040 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2042 note = _("には完全な耐性がある!", " is immune.");
2047 note = _("には耐性がある。", " resists.");
2048 dam *= 3; dam /= randint1(6) + 6;
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2055 /* Chaos -- Chaos breathers resist */
2058 if (seen) obvious = TRUE;
2060 if (r_ptr->flagsr & RFR_RES_ALL)
2062 note = _("には完全な耐性がある!", " is immune.");
2064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2067 if (r_ptr->flagsr & RFR_RES_CHAO)
2069 note = _("には耐性がある。", " resists.");
2070 dam *= 3; dam /= randint1(6) + 6;
2071 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2073 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2075 note = _("はいくらか耐性を示した。", " resists somewhat.");
2076 dam *= 3; dam /= randint1(6) + 6;
2077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2082 do_conf = (5 + randint1(11) + r) / (r + 1);
2087 /* Shards -- Shard breathers resist */
2090 if (seen) obvious = TRUE;
2092 if (r_ptr->flagsr & RFR_RES_ALL)
2094 note = _("には完全な耐性がある!", " is immune.");
2096 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2099 if (r_ptr->flagsr & RFR_RES_SHAR)
2101 note = _("には耐性がある。", " resists.");
2102 dam *= 3; dam /= randint1(6) + 6;
2103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2108 /* Rocket: Shard resistance helps */
2111 if (seen) obvious = TRUE;
2113 if (r_ptr->flagsr & RFR_RES_ALL)
2115 note = _("には完全な耐性がある!", " is immune.");
2117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2120 if (r_ptr->flagsr & RFR_RES_SHAR)
2122 note = _("はいくらか耐性を示した。", " resists somewhat.");
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2130 /* Sound -- Sound breathers resist */
2133 if (seen) obvious = TRUE;
2135 if (r_ptr->flagsr & RFR_RES_ALL)
2137 note = _("には完全な耐性がある!", " is immune.");
2139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2142 if (r_ptr->flagsr & RFR_RES_SOUN)
2144 note = _("には耐性がある。", " resists.");
2145 dam *= 2; dam /= randint1(6) + 6;
2146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2148 else do_stun = (10 + randint1(15) + r) / (r + 1);
2155 if (seen) obvious = TRUE;
2157 if (r_ptr->flagsr & RFR_RES_ALL)
2159 note = _("には完全な耐性がある!", " is immune.");
2161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2164 if (r_ptr->flags3 & RF3_NO_CONF)
2166 note = _("には耐性がある。", " resists.");
2167 dam *= 3; dam /= randint1(6) + 6;
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2170 else do_conf = (10 + randint1(15) + r) / (r + 1);
2174 /* Disenchantment -- Breathers and Disenchanters resist */
2177 if (seen) obvious = TRUE;
2179 if (r_ptr->flagsr & RFR_RES_ALL)
2181 note = _("には完全な耐性がある!", " is immune.");
2183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2186 if (r_ptr->flagsr & RFR_RES_DISE)
2188 note = _("には耐性がある。", " resists.");
2189 dam *= 3; dam /= randint1(6) + 6;
2190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2195 /* Nexus -- Breathers and Existers resist */
2198 if (seen) obvious = TRUE;
2200 if (r_ptr->flagsr & RFR_RES_ALL)
2202 note = _("には完全な耐性がある!", " is immune.");
2204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2207 if (r_ptr->flagsr & RFR_RES_NEXU)
2209 note = _("には耐性がある。", " resists.");
2210 dam *= 3; dam /= randint1(6) + 6;
2211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2219 if (seen) obvious = TRUE;
2221 if (r_ptr->flagsr & RFR_RES_ALL)
2223 note = _("には完全な耐性がある!", " is immune.");
2225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2228 if (r_ptr->flagsr & RFR_RES_WALL)
2230 note = _("には耐性がある。", " resists.");
2231 dam *= 3; dam /= randint1(6) + 6;
2232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2234 else do_stun = (randint1(15) + r) / (r + 1);
2238 /* Inertia -- breathers resist */
2241 if (seen) obvious = TRUE;
2243 if (r_ptr->flagsr & RFR_RES_ALL)
2245 note = _("には完全な耐性がある!", " is immune.");
2247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2250 if (r_ptr->flagsr & RFR_RES_INER)
2252 note = _("には耐性がある。", " resists.");
2253 dam *= 3; dam /= randint1(6) + 6;
2254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2258 /* Powerful monsters can resist */
2259 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2260 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2264 /* Normal monsters slow down */
2267 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2269 note = _("の動きが遅くなった。", " starts moving slower.");
2276 /* Time -- breathers resist */
2279 if (seen) obvious = TRUE;
2281 if (r_ptr->flagsr & RFR_RES_ALL)
2283 note = _("には完全な耐性がある!", " is immune.");
2285 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2288 if (r_ptr->flagsr & RFR_RES_TIME)
2290 note = _("には耐性がある。", " resists.");
2291 dam *= 3; dam /= randint1(6) + 6;
2292 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2294 else do_time = (dam + 1) / 2;
2298 /* Gravity -- breathers resist */
2301 bool resist_tele = FALSE;
2303 if (seen) obvious = TRUE;
2305 if (r_ptr->flagsr & RFR_RES_ALL)
2307 note = _("には完全な耐性がある!", " is immune.");
2309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2312 if (r_ptr->flagsr & RFR_RES_TELE)
2314 if (r_ptr->flags1 & (RF1_UNIQUE))
2316 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2317 note = _("には効果がなかった。", " is unaffected!");
2320 else if (r_ptr->level > randint1(100))
2322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2323 note = _("には耐性がある!", " resists!");
2328 if (!resist_tele) do_dist = 10;
2330 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2332 if (r_ptr->flagsr & RFR_RES_GRAV)
2334 note = _("には耐性がある!", " resists!");
2335 dam *= 3; dam /= randint1(6) + 6;
2337 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2342 /* Powerful monsters can resist */
2343 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2344 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2348 /* Normal monsters slow down */
2351 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2353 note = _("の動きが遅くなった。", " starts moving slower.");
2358 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2360 /* Attempt a saving throw */
2361 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2362 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2366 /* No obvious effect */
2367 note = _("には効果がなかった。", " is unaffected!");
2379 if (seen) obvious = TRUE;
2381 if (r_ptr->flagsr & RFR_RES_ALL)
2383 note = _("には完全な耐性がある!", " is immune.");
2385 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2393 case GF_DISINTEGRATE:
2395 if (seen) obvious = TRUE;
2397 if (r_ptr->flagsr & RFR_RES_ALL)
2399 note = _("には完全な耐性がある!", " is immune.");
2401 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2404 if (r_ptr->flags3 & RF3_HURT_ROCK)
2406 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2407 note = _("の皮膚がただれた!", " loses some skin!");
2408 note_dies = _("は蒸発した!", " evaporates!");
2416 if (seen) obvious = TRUE;
2418 /* PSI only works if the monster can see you! -- RG */
2419 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2422 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2427 if (r_ptr->flagsr & RFR_RES_ALL)
2429 note = _("には完全な耐性がある!", " is immune.");
2431 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2434 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2437 note = _("には完全な耐性がある!", " is immune.");
2438 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2441 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2442 (r_ptr->flags3 & RF3_ANIMAL) ||
2443 (r_ptr->level > randint1(3 * dam)))
2445 note = _("には耐性がある!", " resists!");
2449 * Powerful demons & undead can turn a mindcrafter's
2450 * attacks back on them
2452 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2453 (r_ptr->level > p_ptr->lev / 2) &&
2457 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2458 (seen ? "%^s's corrupted mind backlashes your attack!" :
2459 "%^ss corrupted mind backlashes your attack!")), m_name);
2462 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2464 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2468 /* Injure +/- confusion */
2469 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2470 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2471 if (one_in_(4) && !CHECK_MULTISHADOW())
2473 switch (randint1(4))
2476 set_confused(p_ptr->confused + 3 + randint1(dam));
2479 set_stun(p_ptr->stun + randint1(dam));
2483 if (r_ptr->flags3 & RF3_NO_FEAR)
2484 note = _("には効果がなかった。", " is unaffected.");
2486 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2490 if (!p_ptr->free_act)
2491 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2500 if ((dam > 0) && one_in_(4))
2502 switch (randint1(4))
2505 do_conf = 3 + randint1(dam);
2508 do_stun = 3 + randint1(dam);
2511 do_fear = 3 + randint1(dam);
2514 note = _("は眠り込んでしまった!", " falls asleep!");
2515 do_sleep = 3 + randint1(dam);
2520 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2526 if (seen) obvious = TRUE;
2528 if (r_ptr->flagsr & RFR_RES_ALL)
2530 note = _("には完全な耐性がある!", " is immune.");
2532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2535 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2538 note = _("には完全な耐性がある!", " is immune.");
2540 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2541 (r_ptr->flags3 & RF3_ANIMAL) ||
2542 (r_ptr->level > randint1(3 * dam)))
2544 note = _("には耐性がある!", " resists!");
2548 * Powerful demons & undead can turn a mindcrafter's
2549 * attacks back on them
2551 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2552 (r_ptr->level > p_ptr->lev / 2) &&
2556 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2557 (seen ? "%^s's corrupted mind backlashes your attack!" :
2558 "%^ss corrupted mind backlashes your attack!")), m_name);
2560 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2562 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2566 /* Injure + mana drain */
2567 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2568 if (!CHECK_MULTISHADOW())
2570 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2571 p_ptr->csp -= damroll(5, dam) / 2;
2572 if (p_ptr->csp < 0) p_ptr->csp = 0;
2573 p_ptr->redraw |= PR_MANA;
2574 p_ptr->window |= (PW_SPELL);
2576 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2583 int b = damroll(5, dam) / 4;
2584 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2585 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2586 (seen ? "You convert %s's pain into %s!" :
2587 "You convert %ss pain into %s!"));
2588 msg_format(msg, m_name, str);
2590 b = MIN(p_ptr->msp, p_ptr->csp + b);
2592 p_ptr->redraw |= PR_MANA;
2593 p_ptr->window |= (PW_SPELL);
2595 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2599 case GF_TELEKINESIS:
2601 if (seen) obvious = TRUE;
2603 if (r_ptr->flagsr & RFR_RES_ALL)
2605 note = _("には完全な耐性がある!", " is immune.");
2607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2612 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2617 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2619 /* Attempt a saving throw */
2620 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2621 (r_ptr->level > 5 + randint1(dam)))
2625 /* No obvious effect */
2631 /* Psycho-spear -- powerful magic missile */
2634 if (seen) obvious = TRUE;
2636 if (r_ptr->flagsr & RFR_RES_ALL)
2638 note = _("には完全な耐性がある!", " is immune.");
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2646 /* Meteor -- powerful magic missile */
2649 if (seen) obvious = TRUE;
2651 if (r_ptr->flagsr & RFR_RES_ALL)
2653 note = _("には完全な耐性がある!", " is immune.");
2655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2663 if (!is_hostile(m_ptr)) break;
2665 if (seen) obvious = TRUE;
2667 if (r_ptr->flagsr & RFR_RES_ALL)
2669 note = _("には効果がなかった!", " is immune.");
2671 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2674 /* Attempt a saving throw */
2675 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2676 (r_ptr->flags3 & RF3_NO_CONF) ||
2677 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2679 /* Memorize a flag */
2680 if (r_ptr->flags3 & RF3_NO_CONF)
2682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2689 * Powerful demons & undead can turn a mindcrafter's
2690 * attacks back on them
2692 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2693 (r_ptr->level > p_ptr->lev / 2) &&
2697 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2698 (seen ? "%^s's corrupted mind backlashes your attack!" :
2699 "%^ss corrupted mind backlashes your attack!")), m_name);
2702 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2704 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2708 /* Confuse, stun, terrify */
2709 switch (randint1(4))
2712 set_stun(p_ptr->stun + dam / 2);
2715 set_confused(p_ptr->confused + dam / 2);
2719 if (r_ptr->flags3 & RF3_NO_FEAR)
2720 note = _("には効果がなかった。", " is unaffected.");
2722 set_afraid(p_ptr->afraid + dam);
2729 /* No obvious effect */
2730 note = _("には効果がなかった。", " is unaffected.");
2736 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2738 note = _("があなたに隷属した。", " is in your thrall!");
2743 switch (randint1(4))
2757 /* No "real" damage */
2764 /* Ice -- Cold + Cuts + Stun */
2767 if (seen) obvious = TRUE;
2769 if (r_ptr->flagsr & RFR_RES_ALL)
2771 note = _("には完全な耐性がある!", " is immune.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2776 do_stun = (randint1(15) + 1) / (r + 1);
2777 if (r_ptr->flagsr & RFR_IM_COLD)
2779 note = _("にはかなり耐性がある!", " resists a lot.");
2781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2783 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2785 note = _("はひどい痛手をうけた。", " is hit hard.");
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2794 case GF_HYPODYNAMIA:
2796 if (seen) obvious = TRUE;
2798 if (r_ptr->flagsr & RFR_RES_ALL)
2800 note = _("には完全な耐性がある!", " is immune.");
2802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2805 if (!monster_living(r_ptr))
2807 if (is_original_ap_and_seen(m_ptr))
2809 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2810 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2811 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2813 note = _("には効果がなかった。", " is unaffected.");
2817 else do_time = (dam+7)/8;
2825 if (seen) obvious = TRUE;
2827 if (r_ptr->flagsr & RFR_RES_ALL)
2829 note = _("には完全な耐性がある!", " is immune.");
2831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2834 if (!monster_living(r_ptr))
2836 if (is_original_ap_and_seen(m_ptr))
2838 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2839 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2840 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2842 note = _("には完全な耐性がある!", " is immune.");
2846 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2847 (randint1(888) != 666)) ||
2848 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2849 randint1(100) != 66))
2851 note = _("には耐性がある!", " resists!");
2859 /* Polymorph monster (Use "dam" as "power") */
2862 if (seen) obvious = TRUE;
2864 if (r_ptr->flagsr & RFR_RES_ALL)
2866 note = _("には効果がなかった。", " is unaffected.");
2868 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2871 /* Attempt to polymorph (see below) */
2874 /* Powerful monsters can resist */
2875 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2876 (r_ptr->flags1 & RF1_QUESTOR) ||
2877 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2879 note = _("には効果がなかった。", " is unaffected.");
2884 /* No "real" damage */
2891 /* Clone monsters (Ignore "dam") */
2894 if (seen) obvious = TRUE;
2896 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2898 note = _("には効果がなかった。", " is unaffected.");
2903 m_ptr->hp = m_ptr->maxhp;
2905 /* Attempt to clone. */
2906 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2908 note = _("が分裂した!", " spawns!");
2912 /* No "real" damage */
2919 /* Heal Monster (use "dam" as amount of healing) */
2922 if (seen) obvious = TRUE;
2925 (void)set_monster_csleep(c_ptr->m_idx, 0);
2927 if (m_ptr->maxhp < m_ptr->max_maxhp)
2929 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2930 m_ptr->maxhp = m_ptr->max_maxhp;
2935 /* Redraw (later) if needed */
2936 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2937 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2945 if (seen) obvious = TRUE;
2948 (void)set_monster_csleep(c_ptr->m_idx, 0);
2949 if (MON_STUNNED(m_ptr))
2951 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2952 (void)set_monster_stunned(c_ptr->m_idx, 0);
2954 if (MON_CONFUSED(m_ptr))
2956 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2957 (void)set_monster_confused(c_ptr->m_idx, 0);
2959 if (MON_MONFEAR(m_ptr))
2961 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2962 (void)set_monster_monfear(c_ptr->m_idx, 0);
2966 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2969 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2973 chg_virtue(V_VITALITY, 1);
2975 if (r_ptr->flags1 & RF1_UNIQUE)
2976 chg_virtue(V_INDIVIDUALISM, 1);
2978 if (is_friendly(m_ptr))
2979 chg_virtue(V_HONOUR, 1);
2980 else if (!(r_ptr->flags3 & RF3_EVIL))
2982 if (r_ptr->flags3 & RF3_GOOD)
2983 chg_virtue(V_COMPASSION, 2);
2985 chg_virtue(V_COMPASSION, 1);
2988 if (r_ptr->flags3 & RF3_ANIMAL)
2989 chg_virtue(V_NATURE, 1);
2992 if (m_ptr->r_idx == MON_LEPER)
2995 if (!who) chg_virtue(V_COMPASSION, 5);
2998 /* Redraw (later) if needed */
2999 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3000 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3002 note = _("は体力を回復したようだ。", " looks healthier.");
3004 /* No "real" damage */
3010 /* Speed Monster (Ignore "dam") */
3013 if (seen) obvious = TRUE;
3016 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3018 note = _("の動きが速くなった。", " starts moving faster.");
3023 if (r_ptr->flags1 & RF1_UNIQUE)
3024 chg_virtue(V_INDIVIDUALISM, 1);
3025 if (is_friendly(m_ptr))
3026 chg_virtue(V_HONOUR, 1);
3029 /* No "real" damage */
3035 /* Slow Monster (Use "dam" as "power") */
3038 if (seen) obvious = TRUE;
3040 if (r_ptr->flagsr & RFR_RES_ALL)
3042 note = _("には効果がなかった。", " is unaffected.");
3044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3047 /* Powerful monsters can resist */
3048 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3049 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3051 note = _("には効果がなかった。", " is unaffected.");
3055 /* Normal monsters slow down */
3058 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3060 note = _("の動きが遅くなった。", " starts moving slower.");
3064 /* No "real" damage */
3070 /* Sleep (Use "dam" as "power") */
3073 if (seen) obvious = TRUE;
3075 if (r_ptr->flagsr & RFR_RES_ALL)
3077 note = _("には効果がなかった。", " is unaffected.");
3079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3082 /* Attempt a saving throw */
3083 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3084 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3085 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3087 /* Memorize a flag */
3088 if (r_ptr->flags3 & RF3_NO_SLEEP)
3090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3092 /* No obvious effect */
3093 note = _("には効果がなかった。", " is unaffected.");
3098 /* Go to sleep (much) later */
3099 note = _("は眠り込んでしまった!", " falls asleep!");
3103 /* No "real" damage */
3109 /* Sleep (Use "dam" as "power") */
3110 case GF_STASIS_EVIL:
3112 if (seen) obvious = TRUE;
3114 if (r_ptr->flagsr & RFR_RES_ALL)
3116 note = _("には効果がなかった!", " is immune.");
3118 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3121 /* Attempt a saving throw */
3122 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3123 !(r_ptr->flags3 & RF3_EVIL) ||
3124 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3126 note = _("には効果がなかった。", " is unaffected.");
3131 /* Go to sleep (much) later */
3132 note = _("は動けなくなった!", " is suspended!");
3136 /* No "real" damage */
3141 /* Sleep (Use "dam" as "power") */
3144 if (seen) obvious = TRUE;
3146 if (r_ptr->flagsr & RFR_RES_ALL)
3148 note = _("には効果がなかった。", " is unaffected.");
3150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3153 /* Attempt a saving throw */
3154 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3155 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3157 note = _("には効果がなかった。", " is unaffected.");
3162 /* Go to sleep (much) later */
3163 note = _("は動けなくなった!", " is suspended!");
3167 /* No "real" damage */
3176 vir = virtue_number(V_HARMONY);
3179 dam += p_ptr->virtues[vir-1]/10;
3182 vir = virtue_number(V_INDIVIDUALISM);
3185 dam -= p_ptr->virtues[vir-1]/20;
3188 if (seen) obvious = TRUE;
3190 /* Attempt a saving throw */
3191 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3195 /* No obvious effect */
3196 note = _("には効果がなかった。", " is unaffected.");
3199 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3201 else if (p_ptr->cursed & TRC_AGGRAVATE)
3203 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3204 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3208 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3211 chg_virtue(V_INDIVIDUALISM, -1);
3212 if (r_ptr->flags3 & RF3_ANIMAL)
3213 chg_virtue(V_NATURE, 1);
3216 /* No "real" damage */
3221 /* Control undead */
3222 case GF_CONTROL_UNDEAD:
3225 if (seen) obvious = TRUE;
3227 vir = virtue_number(V_UNLIFE);
3230 dam += p_ptr->virtues[vir-1]/10;
3233 vir = virtue_number(V_INDIVIDUALISM);
3236 dam -= p_ptr->virtues[vir-1]/20;
3239 /* Attempt a saving throw */
3240 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3241 !(r_ptr->flags3 & RF3_UNDEAD))
3243 /* No obvious effect */
3244 note = _("には効果がなかった。", " is unaffected.");
3246 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3248 else if (p_ptr->cursed & TRC_AGGRAVATE)
3250 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3251 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3255 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3259 /* No "real" damage */
3265 case GF_CONTROL_DEMON:
3268 if (seen) obvious = TRUE;
3270 vir = virtue_number(V_UNLIFE);
3273 dam += p_ptr->virtues[vir-1]/10;
3276 vir = virtue_number(V_INDIVIDUALISM);
3279 dam -= p_ptr->virtues[vir-1]/20;
3282 /* Attempt a saving throw */
3283 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3284 !(r_ptr->flags3 & RF3_DEMON))
3286 /* No obvious effect */
3287 note = _("には効果がなかった。", " is unaffected.");
3289 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3291 else if (p_ptr->cursed & TRC_AGGRAVATE)
3293 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3294 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3298 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3302 /* No "real" damage */
3308 case GF_CONTROL_ANIMAL:
3311 if (seen) obvious = TRUE;
3313 vir = virtue_number(V_NATURE);
3316 dam += p_ptr->virtues[vir-1]/10;
3319 vir = virtue_number(V_INDIVIDUALISM);
3322 dam -= p_ptr->virtues[vir-1]/20;
3325 /* Attempt a saving throw */
3326 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3327 !(r_ptr->flags3 & RF3_ANIMAL))
3330 /* No obvious effect */
3331 note = _("には効果がなかった。", " is unaffected.");
3333 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3335 else if (p_ptr->cursed & TRC_AGGRAVATE)
3337 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3338 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3342 note = _("はなついた。", " is tamed!");
3344 if (r_ptr->flags3 & RF3_ANIMAL)
3345 chg_virtue(V_NATURE, 1);
3348 /* No "real" damage */
3354 case GF_CHARM_LIVING:
3358 vir = virtue_number(V_UNLIFE);
3359 if (seen) obvious = TRUE;
3361 vir = virtue_number(V_UNLIFE);
3364 dam -= p_ptr->virtues[vir-1]/10;
3367 vir = virtue_number(V_INDIVIDUALISM);
3370 dam -= p_ptr->virtues[vir-1]/20;
3373 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3375 /* Attempt a saving throw */
3376 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3377 !monster_living(r_ptr))
3380 /* No obvious effect */
3381 note = _("には効果がなかった。", " is unaffected.");
3383 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3385 else if (p_ptr->cursed & TRC_AGGRAVATE)
3387 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3388 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3392 note = _("を支配した。", " is tamed!");
3394 if (r_ptr->flags3 & RF3_ANIMAL)
3395 chg_virtue(V_NATURE, 1);
3398 /* No "real" damage */
3403 /* Confusion (Use "dam" as "power") */
3406 if (seen) obvious = TRUE;
3408 if (r_ptr->flagsr & RFR_RES_ALL)
3410 note = _("には効果がなかった。", " is unaffected.");
3412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3415 /* Get confused later */
3416 do_conf = damroll(3, (dam / 2)) + 1;
3418 /* Attempt a saving throw */
3419 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3420 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3421 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3423 /* Memorize a flag */
3424 if (r_ptr->flags3 & (RF3_NO_CONF))
3426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3432 /* No obvious effect */
3433 note = _("には効果がなかった。", " is unaffected.");
3437 /* No "real" damage */
3444 if (seen) obvious = TRUE;
3446 if (r_ptr->flagsr & RFR_RES_ALL)
3448 note = _("には効果がなかった。", " is unaffected.");
3450 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3453 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3455 /* Attempt a saving throw */
3456 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3457 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3462 /* No obvious effect */
3463 note = _("には効果がなかった。", " is unaffected.");
3467 /* No "real" damage */
3475 /* Lite, but only hurts susceptible creatures */
3483 if (r_ptr->flagsr & RFR_RES_ALL)
3489 if (r_ptr->flags3 & (RF3_HURT_LITE))
3491 /* Obvious effect */
3492 if (seen) obvious = TRUE;
3494 /* Memorize the effects */
3495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3497 /* Special effect */
3498 note = _("は光に身をすくめた!", " cringes from the light!");
3499 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3502 /* Normally no damage */
3514 /* Lite -- opposite of Dark */
3517 if (seen) obvious = TRUE;
3519 if (r_ptr->flagsr & RFR_RES_ALL)
3521 note = _("には完全な耐性がある!", " is immune.");
3523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3526 if (r_ptr->flagsr & RFR_RES_LITE)
3528 note = _("には耐性がある!", " resists!");
3529 dam *= 2; dam /= (randint1(6)+6);
3530 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3532 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3535 note = _("は光に身をすくめた!", " cringes from the light!");
3536 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3543 /* Dark -- opposite of Lite */
3546 if (seen) obvious = TRUE;
3548 if (r_ptr->flagsr & RFR_RES_ALL)
3550 note = _("には完全な耐性がある!", " is immune.");
3552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3555 if (r_ptr->flagsr & RFR_RES_DARK)
3557 note = _("には耐性がある!", " resists!");
3558 dam *= 2; dam /= (randint1(6)+6);
3559 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3568 if (r_ptr->flagsr & RFR_RES_ALL)
3573 /* Hurt by rock remover */
3574 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3577 if (seen) obvious = TRUE;
3579 /* Memorize the effects */
3580 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3582 /* Cute little message */
3583 note = _("の皮膚がただれた!", " loses some skin!");
3584 note_dies = _("はドロドロに溶けた!", " dissolves!");
3587 /* Usually, ignore the effects */
3598 /* Teleport undead (Use "dam" as "power") */
3599 case GF_AWAY_UNDEAD:
3601 /* Only affect undead */
3602 if (r_ptr->flags3 & (RF3_UNDEAD))
3604 bool resists_tele = FALSE;
3606 if (r_ptr->flagsr & RFR_RES_TELE)
3608 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3611 note = _("には効果がなかった。", " is unaffected.");
3612 resists_tele = TRUE;
3614 else if (r_ptr->level > randint1(100))
3616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3617 note = _("には耐性がある!", " resists!");
3618 resists_tele = TRUE;
3624 if (seen) obvious = TRUE;
3625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3637 /* No "real" damage */
3643 /* Teleport evil (Use "dam" as "power") */
3646 /* Only affect evil */
3647 if (r_ptr->flags3 & (RF3_EVIL))
3649 bool resists_tele = FALSE;
3651 if (r_ptr->flagsr & RFR_RES_TELE)
3653 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3656 note = _("には効果がなかった。", " is unaffected.");
3657 resists_tele = TRUE;
3659 else if (r_ptr->level > randint1(100))
3661 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3662 note = _("には耐性がある!", " resists!");
3663 resists_tele = TRUE;
3669 if (seen) obvious = TRUE;
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3682 /* No "real" damage */
3688 /* Teleport monster (Use "dam" as "power") */
3691 bool resists_tele = FALSE;
3692 if (r_ptr->flagsr & RFR_RES_TELE)
3694 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3697 note = _("には効果がなかった。", " is unaffected.");
3698 resists_tele = TRUE;
3700 else if (r_ptr->level > randint1(100))
3702 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3703 note = _("には耐性がある!", " resists!");
3704 resists_tele = TRUE;
3710 if (seen) obvious = TRUE;
3712 /* Prepare to teleport */
3716 /* No "real" damage */
3722 /* Turn undead (Use "dam" as "power") */
3723 case GF_TURN_UNDEAD:
3725 if (r_ptr->flagsr & RFR_RES_ALL)
3730 /* Only affect undead */
3731 if (r_ptr->flags3 & (RF3_UNDEAD))
3733 if (seen) obvious = TRUE;
3735 /* Learn about type */
3736 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3738 /* Apply some fear */
3739 do_fear = damroll(3, (dam / 2)) + 1;
3741 /* Attempt a saving throw */
3742 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3744 /* No obvious effect */
3745 note = _("には効果がなかった。", " is unaffected.");
3758 /* No "real" damage */
3764 /* Turn evil (Use "dam" as "power") */
3767 if (r_ptr->flagsr & RFR_RES_ALL)
3772 /* Only affect evil */
3773 if (r_ptr->flags3 & (RF3_EVIL))
3775 if (seen) obvious = TRUE;
3777 /* Learn about type */
3778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3780 /* Apply some fear */
3781 do_fear = damroll(3, (dam / 2)) + 1;
3783 /* Attempt a saving throw */
3784 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3786 /* No obvious effect */
3787 note = _("には効果がなかった。", " is unaffected.");
3800 /* No "real" damage */
3806 /* Turn monster (Use "dam" as "power") */
3809 if (r_ptr->flagsr & RFR_RES_ALL)
3814 if (seen) obvious = TRUE;
3816 /* Apply some fear */
3817 do_fear = damroll(3, (dam / 2)) + 1;
3819 /* Attempt a saving throw */
3820 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3821 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3822 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3824 /* No obvious effect */
3825 note = _("には効果がなかった。", " is unaffected.");
3830 /* No "real" damage */
3837 case GF_DISP_UNDEAD:
3839 if (r_ptr->flagsr & RFR_RES_ALL)
3845 /* Only affect undead */
3846 if (r_ptr->flags3 & (RF3_UNDEAD))
3848 if (seen) obvious = TRUE;
3850 /* Learn about type */
3851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3853 note = _("は身震いした。", " shudders.");
3854 note_dies = _("はドロドロに溶けた!", " dissolves!");
3874 if (r_ptr->flagsr & RFR_RES_ALL)
3880 /* Only affect evil */
3881 if (r_ptr->flags3 & (RF3_EVIL))
3883 if (seen) obvious = TRUE;
3885 /* Learn about type */
3886 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3888 note = _("は身震いした。", " shudders.");
3889 note_dies = _("はドロドロに溶けた!", " dissolves!");
3908 if (r_ptr->flagsr & RFR_RES_ALL)
3914 /* Only affect good */
3915 if (r_ptr->flags3 & (RF3_GOOD))
3917 if (seen) obvious = TRUE;
3919 /* Learn about type */
3920 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3922 note = _("は身震いした。", " shudders.");
3923 note_dies = _("はドロドロに溶けた!", " dissolves!");
3940 case GF_DISP_LIVING:
3942 if (r_ptr->flagsr & RFR_RES_ALL)
3948 /* Only affect non-undead */
3949 if (monster_living(r_ptr))
3951 if (seen) obvious = TRUE;
3953 note = _("は身震いした。", " shudders.");
3954 note_dies = _("はドロドロに溶けた!", " dissolves!");
3973 if (r_ptr->flagsr & RFR_RES_ALL)
3979 /* Only affect demons */
3980 if (r_ptr->flags3 & (RF3_DEMON))
3982 if (seen) obvious = TRUE;
3984 /* Learn about type */
3985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3987 note = _("は身震いした。", " shudders.");
3988 note_dies = _("はドロドロに溶けた!", " dissolves!");
4004 /* Dispel monster */
4007 if (r_ptr->flagsr & RFR_RES_ALL)
4013 if (seen) obvious = TRUE;
4015 note = _("は身震いした。", " shudders.");
4016 note_dies = _("はドロドロに溶けた!", " dissolves!");
4023 if (seen) obvious = TRUE;
4025 if (r_ptr->flagsr & RFR_RES_ALL)
4027 note = _("には完全な耐性がある!", " is immune.");
4029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4033 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4037 /* Heal the monster */
4038 if (caster_ptr->hp < caster_ptr->maxhp)
4041 caster_ptr->hp += dam;
4042 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4044 /* Redraw (later) if needed */
4045 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4046 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4048 /* Special message */
4051 /* Get the monster name */
4052 monster_desc(killer, caster_ptr, 0);
4053 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4059 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4060 (void)hp_player(dam);
4065 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4074 if (seen) obvious = TRUE;
4075 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4077 if (r_ptr->flagsr & RFR_RES_ALL)
4079 note = _("には完全な耐性がある!", " is immune.");
4081 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4085 /* Attempt a saving throw */
4086 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4087 (r_ptr->flags3 & RF3_NO_CONF) ||
4088 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4090 /* Memorize a flag */
4091 if (r_ptr->flags3 & (RF3_NO_CONF))
4093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4095 note = _("には効果がなかった。", " is unaffected.");
4098 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4101 note = _("には完全な耐性がある!", " is immune.");
4104 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4107 note = _("には耐性がある。", " resists.");
4112 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4113 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4115 if (who > 0) do_conf = randint0(4) + 4;
4116 else do_conf = randint0(8) + 8;
4122 case GF_BRAIN_SMASH:
4124 if (seen) obvious = TRUE;
4125 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4127 if (r_ptr->flagsr & RFR_RES_ALL)
4129 note = _("には完全な耐性がある!", " is immune.");
4131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4135 /* Attempt a saving throw */
4136 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4137 (r_ptr->flags3 & RF3_NO_CONF) ||
4138 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4140 /* Memorize a flag */
4141 if (r_ptr->flags3 & (RF3_NO_CONF))
4143 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4145 note = _("には効果がなかった。", " is unaffected.");
4148 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4151 note = _("には完全な耐性がある!", " is immune.");
4154 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4156 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4157 note = _("には耐性がある!", " resists!");
4162 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4163 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4167 do_conf = randint0(4) + 4;
4168 do_stun = randint0(4) + 4;
4172 do_conf = randint0(8) + 8;
4173 do_stun = randint0(8) + 8;
4175 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4183 if (seen) obvious = TRUE;
4184 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4186 if (r_ptr->flagsr & RFR_RES_ALL)
4188 note = _("には完全な耐性がある!", " is immune.");
4190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4194 /* Attempt a saving throw */
4195 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4197 note = _("には効果がなかった。", " is unaffected.");
4206 if (seen) obvious = TRUE;
4207 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4209 if (r_ptr->flagsr & RFR_RES_ALL)
4211 note = _("には完全な耐性がある!", " is immune.");
4213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4217 /* Attempt a saving throw */
4218 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4220 note = _("には効果がなかった。", " is unaffected.");
4229 if (seen) obvious = TRUE;
4230 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4232 if (r_ptr->flagsr & RFR_RES_ALL)
4234 note = _("には完全な耐性がある!", " is immune.");
4236 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4240 /* Attempt a saving throw */
4241 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4243 note = _("には効果がなかった。", " is unaffected.");
4252 if (seen) obvious = TRUE;
4254 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4255 "You point at %s, screaming the word, 'DIE!'."), m_name);
4257 if (r_ptr->flagsr & RFR_RES_ALL)
4259 note = _("には完全な耐性がある!", " is immune.");
4261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4265 /* Attempt a saving throw */
4266 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4268 note = _("には効果がなかった。", " is unaffected.");
4277 if (seen) obvious = TRUE;
4279 if (r_ptr->flagsr & RFR_RES_ALL)
4281 note = _("には完全な耐性がある!", " is immune.");
4283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4287 if (r_ptr->flags1 & RF1_UNIQUE)
4289 note = _("には効果がなかった。", " is unaffected.");
4294 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4295 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4297 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4299 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4303 note = _("は耐性を持っている!", "resists!");
4310 /* Capture monster */
4314 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4315 (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)
4317 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4322 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4323 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4324 nokori_hp = m_ptr->maxhp * 3 / 10;
4326 nokori_hp = m_ptr->maxhp * 3 / 20;
4328 if (m_ptr->hp >= nokori_hp)
4330 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4333 else if (m_ptr->hp < randint0(nokori_hp))
4335 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4336 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4337 cap_mon = m_ptr->r_idx;
4338 cap_mspeed = m_ptr->mspeed;
4340 cap_maxhp = m_ptr->max_maxhp;
4341 cap_nickname = m_ptr->nickname; /* Quark transfer */
4342 if (c_ptr->m_idx == p_ptr->riding)
4344 if (rakuba(-1, FALSE))
4346 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4350 delete_monster_idx(c_ptr->m_idx);
4356 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4362 /* Attack (Use "dam" as attack type) */
4365 /* Return this monster's death */
4366 return py_attack(y, x, dam);
4369 /* Sleep (Use "dam" as "power") */
4375 if (seen) obvious = TRUE;
4377 if (r_ptr->flagsr & RFR_RES_ALL)
4379 note = _("には効果がなかった。", " is unaffected.");
4381 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4384 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4386 note = _("には効果がなかった。", " is unaffected.");
4389 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4392 if (MON_CSLEEP(m_ptr))
4394 note = _("には効果がなかった。", " is unaffected.");
4400 if (one_in_(5)) effect = 1;
4401 else if (one_in_(4)) effect = 2;
4402 else if (one_in_(3)) effect = 3;
4407 /* Powerful monsters can resist */
4408 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4409 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4411 note = _("には効果がなかった。", " is unaffected.");
4415 /* Normal monsters slow down */
4418 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4420 note = _("の動きが遅くなった。", " starts moving slower.");
4425 else if (effect == 2)
4427 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4429 /* Attempt a saving throw */
4430 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4431 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4436 /* No obvious effect */
4437 note = _("には効果がなかった。", " is unaffected.");
4442 else if (effect == 3)
4444 /* Attempt a saving throw */
4445 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4446 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4447 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4449 /* Memorize a flag */
4450 if (r_ptr->flags3 & RF3_NO_SLEEP)
4452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4455 /* No obvious effect */
4456 note = _("には効果がなかった。", " is unaffected.");
4461 /* Go to sleep (much) later */
4462 note = _("は眠り込んでしまった!", " falls asleep!");
4469 note = _("には効果がなかった。", " is unaffected.");
4472 /* No "real" damage */
4480 if (seen) obvious = TRUE;
4482 if (r_ptr->flagsr & RFR_RES_ALL)
4484 note = _("には効果がなかった。", " is unaffected.");
4486 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4490 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4492 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4493 chg_virtue(V_VITALITY, -1);
4503 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4505 if (r_ptr->flags3 & (RF3_HURT_LITE))
4507 /* Obvious effect */
4508 if (seen) obvious = TRUE;
4510 /* Memorize the effects */
4511 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4513 /* Special effect */
4514 note = _("は光に身をすくめた!", " cringes from the light!");
4515 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4518 /* Normally no damage */
4525 photo = m_ptr->r_idx;
4532 case GF_BLOOD_CURSE:
4534 if (seen) obvious = TRUE;
4536 if (r_ptr->flagsr & RFR_RES_ALL)
4538 note = _("には完全な耐性がある!", " is immune.");
4540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4548 bool success = FALSE;
4549 if (seen) obvious = TRUE;
4551 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4553 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4554 if (dam < 1) dam = 1;
4556 /* No need to tame your pet */
4559 note = _("の動きが速くなった。", " starts moving faster.");
4560 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4564 /* Attempt a saving throw */
4565 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4566 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4567 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4568 (p_ptr->cursed & TRC_AGGRAVATE) ||
4569 ((r_ptr->level+10) > randint1(dam)))
4572 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4576 note = _("を支配した。", " is tamed!");
4578 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4580 /* Learn about type */
4581 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4588 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4590 do_fear = randint1(90)+10;
4592 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4595 /* No "real" damage */
4602 if (seen) obvious = TRUE;
4604 if (r_ptr->flagsr & RFR_RES_ALL)
4606 note = _("には完全な耐性がある!", " is immune.");
4608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4612 /* Attempt a saving throw */
4613 if (randint0(100 + dam) < (r_ptr->level + 50))
4615 note = _("には効果がなかった。", " is unaffected.");
4635 /* Absolutely no effect */
4636 if (skipped) return (FALSE);
4638 /* "Unique" monsters cannot be polymorphed */
4639 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4641 /* Quest monsters cannot be polymorphed */
4642 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4644 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4646 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4647 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4649 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4654 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4655 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4658 /* Modify the damage */
4660 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4661 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4663 /* Check for death */
4664 if (dam > m_ptr->hp)
4666 /* Extract method of death */
4671 /* Sound and Impact resisters never stun */
4673 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4674 !(r_ptr->flags3 & RF3_NO_STUN))
4676 if (seen) obvious = TRUE;
4679 if (MON_STUNNED(m_ptr))
4681 note = _("はひどくもうろうとした。", " is more dazed.");
4682 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4686 note = _("はもうろうとした。", " is dazed.");
4691 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4697 /* Confusion and Chaos resisters (and sleepers) never confuse */
4699 !(r_ptr->flags3 & RF3_NO_CONF) &&
4700 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4702 if (seen) obvious = TRUE;
4704 /* Already partially confused */
4705 if (MON_CONFUSED(m_ptr))
4707 note = _("はさらに混乱したようだ。", " looks more confused.");
4708 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4711 /* Was not confused */
4714 note = _("は混乱したようだ。", " looks confused.");
4718 /* Apply confusion */
4719 (void)set_monster_confused(c_ptr->m_idx, tmp);
4727 if (seen) obvious = TRUE;
4729 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4733 note = _("は弱くなったようだ。", " seems weakened.");
4734 m_ptr->maxhp -= do_time;
4735 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4740 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4741 if (do_poly && (randint1(90) > r_ptr->level))
4743 if (polymorph_monster(y, x))
4745 if (seen) obvious = TRUE;
4747 /* Monster polymorphs */
4748 note = _("が変身した!", " changes!");
4750 /* Turn off the damage */
4756 note = _("には効果がなかった。", " is unaffected.");
4759 /* Hack -- Get new monster */
4760 m_ptr = &m_list[c_ptr->m_idx];
4762 /* Hack -- Get new race */
4763 r_ptr = &r_info[m_ptr->r_idx];
4766 /* Handle "teleport" */
4769 if (seen) obvious = TRUE;
4771 note = _("が消え去った!", " disappears!");
4773 if (!who) chg_virtue(V_VALOUR, -1);
4776 teleport_away(c_ptr->m_idx, do_dist,
4777 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4779 /* Hack -- get new location */
4783 /* Hack -- get new grid */
4784 c_ptr = &cave[y][x];
4791 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4798 if (typ == GF_DRAIN_MANA)
4800 /* Drain mana does nothing */
4803 /* If another monster did the damage, hurt the monster by hand */
4806 /* Redraw (later) if needed */
4807 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4808 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4810 /* Wake the monster up */
4811 (void)set_monster_csleep(c_ptr->m_idx, 0);
4813 /* Hurt the monster */
4821 if (is_pet(m_ptr) && !(m_ptr->ml))
4824 /* Give detailed messages if destroyed */
4827 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4830 msg_format("%^s%s", m_name, note);
4838 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4840 /* Generate treasure, etc */
4841 monster_death(c_ptr->m_idx, FALSE);
4844 delete_monster_idx(c_ptr->m_idx);
4848 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4852 /* Damaged monster */
4855 /* Give detailed messages if visible or destroyed */
4856 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4858 /* Hack -- Pain message */
4861 message_pain(c_ptr->m_idx, dam);
4868 /* Hack -- handle sleep */
4869 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4873 else if (heal_leper)
4875 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4877 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4881 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4882 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4885 delete_monster_idx(c_ptr->m_idx);
4888 /* If the player did it, give him experience, check fear */
4893 /* Hurt the monster, check for fear and death */
4894 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4899 /* Damaged monster */
4902 /* HACK - anger the monster before showing the sleep message */
4903 if (do_sleep) anger_monster(m_ptr);
4905 /* Give detailed messages if visible or destroyed */
4906 if (note && seen_msg)
4907 msg_format(_("%s%s", "%^s%s"), m_name, note);
4909 /* Hack -- Pain message */
4910 else if (known && (dam || !do_fear))
4912 message_pain(c_ptr->m_idx, dam);
4915 /* Anger monsters */
4916 if (((dam > 0) || get_angry) && !do_sleep)
4917 anger_monster(m_ptr);
4920 if ((fear || do_fear) && seen)
4924 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4927 /* Hack -- handle sleep */
4928 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4932 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4934 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4938 switch (randint1(28))
4943 msg_print(_("地面が揺れた...", "The ground trembles..."));
4944 earthquake(ty, tx, 4 + randint0(4));
4945 if (!one_in_(6)) break;
4947 case 3: case 4: case 5: case 6:
4950 int extra_dam = damroll(10, 10);
4951 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4953 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4954 if (!one_in_(6)) break;
4959 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4961 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4962 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4963 if (!one_in_(6)) break;
4965 case 9: case 10: case 11:
4966 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4967 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4968 if (!one_in_(6)) break;
4969 case 12: case 13: case 14: case 15: case 16:
4970 aggravate_monsters(0);
4971 if (!one_in_(6)) break;
4973 count += activate_hi_summon(ty, tx, TRUE);
4974 if (!one_in_(6)) break;
4975 case 19: case 20: case 21: case 22:
4977 bool pet = !one_in_(3);
4978 BIT_FLAGS mode = PM_ALLOW_GROUP;
4980 if (pet) mode |= PM_FORCE_PET;
4981 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4983 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);
4984 if (!one_in_(6)) break;
4986 case 23: case 24: case 25:
4987 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4988 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4990 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4991 else lose_exp(p_ptr->exp / 16);
4992 if (!one_in_(6)) break;
4993 case 26: case 27: case 28:
5002 (void)do_dec_stat(i);
5011 (void)do_dec_stat(randint0(6));
5020 if (p_ptr->inside_battle)
5022 p_ptr->health_who = c_ptr->m_idx;
5023 p_ptr->redraw |= (PR_HEALTH);
5027 /* Verify this code */
5029 /* Update the monster */
5030 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5032 /* Redraw the monster grid */
5036 /* Update monster recall window */
5037 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5039 p_ptr->window |= (PW_MONSTER);
5042 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5046 if (!(flg & PROJECT_NO_HANGEKI))
5048 set_target(m_ptr, monster_target_y, monster_target_x);
5051 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5053 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5057 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5059 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5060 rakubadam_m = (dam > 200) ? 200 : dam;
5069 /* Get local object */
5072 /* Prepare to make a Blade of Chaos */
5073 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5075 q_ptr->pval = photo;
5077 /* Mark the item as fully known */
5078 q_ptr->ident |= (IDENT_MENTAL);
5080 /* Drop it in the dungeon */
5081 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5089 /* Return "Anything seen?" */
5094 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5095 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5096 * @param who_name 効果を起こしたモンスターの名前
5097 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5098 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5099 * @param x 目標X座標 / Target x location (or location to travel "towards")
5100 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5101 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5103 * @param monspell 効果元のモンスター魔法ID
5104 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5106 * Handle a beam/bolt/ball causing damage to the player.
5107 * This routine takes a "source monster" (by index), a "distance", a default
5108 * "damage", and a "damage type". See "project_m()" above.
5109 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5110 * is reduced (see "project_m()" above). This can happen if a monster breathes
5111 * at the player and hits a wall instead.
5112 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5113 * to know if this is actually a ball or a bolt spell
5114 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5115 * we just assume that the effects were obvious, for historical reasons.
5117 static bool project_p(MONSTER_IDX who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5122 /* Hack -- assume obvious */
5123 bool obvious = TRUE;
5125 /* Player blind-ness */
5126 bool blind = (p_ptr->blind ? TRUE : FALSE);
5128 /* Player needs a "description" (he is blind) */
5131 /* Source monster */
5132 monster_type *m_ptr = NULL;
5134 /* Monster name (for attacks) */
5137 /* Monster name (for damage) */
5140 /* Hack -- messages */
5146 /* Player is not here */
5147 if (!player_bold(y, x)) return (FALSE);
5149 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5151 if (kawarimi(TRUE)) return FALSE;
5154 /* Player cannot hurt himself */
5155 if (!who) return (FALSE);
5156 if (who == p_ptr->riding) return (FALSE);
5158 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5161 int max_attempts = 10;
5162 sound(SOUND_REFLECT);
5165 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5166 else if (p_ptr->special_defense & KATA_FUUJIN)
5167 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5169 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5172 /* Choose 'new' target */
5177 t_y = m_list[who].fy - 1 + randint1(3);
5178 t_x = m_list[who].fx - 1 + randint1(3);
5181 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5183 if (max_attempts < 1)
5185 t_y = m_list[who].fy;
5186 t_x = m_list[who].fx;
5191 t_y = p_ptr->y - 1 + randint1(3);
5192 t_x = p_ptr->x - 1 + randint1(3);
5195 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5197 disturb(TRUE, TRUE);
5201 /* Limit maximum damage */
5202 if (dam > 1600) dam = 1600;
5204 /* Reduce damage by distance */
5205 dam = (dam + r) / (r + 1);
5208 /* If the player is blind, be more descriptive */
5209 if (blind) fuzzy = TRUE;
5214 /* Get the source monster */
5215 m_ptr = &m_list[who];
5216 /* Extract the monster level */
5217 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5219 /* Get the monster name */
5220 monster_desc(m_name, m_ptr, 0);
5222 /* Get the monster's real name (gotten before polymorph!) */
5223 strcpy(killer, who_name);
5229 case PROJECT_WHO_UNCTRL_POWER:
5230 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5233 case PROJECT_WHO_GLASS_SHARDS:
5234 strcpy(killer, _("ガラスの破片", "shards of glass"));
5238 strcpy(killer, _("罠", "a trap"));
5243 strcpy(m_name, killer);
5246 /* Analyze the damage */
5249 /* Standard damage -- hurts inventory too */
5252 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5253 get_damage = acid_dam(dam, killer, monspell, FALSE);
5257 /* Standard damage -- hurts inventory too */
5260 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5261 get_damage = fire_dam(dam, killer, monspell, FALSE);
5265 /* Standard damage -- hurts inventory too */
5268 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5269 get_damage = cold_dam(dam, killer, monspell, FALSE);
5273 /* Standard damage -- hurts inventory too */
5276 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5277 get_damage = elec_dam(dam, killer, monspell, FALSE);
5281 /* Standard damage -- also poisons player */
5284 bool double_resist = IS_OPPOSE_POIS();
5285 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5287 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5288 if (double_resist) dam = (dam + 2) / 3;
5290 if ((!(double_resist || p_ptr->resist_pois)) &&
5291 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5296 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5298 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5300 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5305 /* Standard damage -- also poisons / mutates player */
5308 bool double_resist = IS_OPPOSE_POIS();
5309 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5311 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5312 if (double_resist) dam = (2 * dam + 2) / 5;
5313 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5314 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5316 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5318 if (one_in_(5)) /* 6 */
5320 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5321 if (one_in_(4)) /* 4 */
5329 inven_damage(set_acid_destroy, 2);
5335 /* Standard damage */
5338 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5339 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5343 /* Holy Orb -- Player only takes partial damage */
5346 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5347 if (p_ptr->align > 10)
5349 else if (p_ptr->align < -10)
5351 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5357 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5358 if (p_ptr->align > 10)
5360 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5364 /* Arrow -- XXX no dodging */
5369 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5371 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5373 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5376 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5380 /* Plasma -- XXX No resist */
5383 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5384 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5386 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5388 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5389 (void)set_stun(p_ptr->stun + plus_stun);
5392 if (!(p_ptr->resist_fire ||
5394 p_ptr->immune_fire))
5396 inven_damage(set_acid_destroy, 3);
5402 /* Nether -- drain experience */
5405 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5406 if (p_ptr->resist_neth)
5408 if (!prace_is_(RACE_SPECTRE))
5410 dam *= 6; dam /= (randint1(4) + 7);
5413 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5415 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5417 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5419 learn_spell(monspell);
5423 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5429 /* Water -- stun/confuse */
5432 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5433 if (!CHECK_MULTISHADOW())
5435 if (!p_ptr->resist_sound)
5437 set_stun(p_ptr->stun + randint1(40));
5439 if (!p_ptr->resist_conf)
5441 set_confused(p_ptr->confused + randint1(5) + 5);
5446 inven_damage(set_cold_destroy, 3);
5450 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5454 /* Chaos -- many effects */
5457 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5458 if (p_ptr->resist_chaos)
5460 dam *= 6; dam /= (randint1(4) + 7);
5463 if (!CHECK_MULTISHADOW())
5465 if (!p_ptr->resist_conf)
5467 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5469 if (!p_ptr->resist_chaos)
5471 (void)set_image(p_ptr->image + randint1(10));
5474 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5475 (void)gain_random_mutation(0);
5478 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5480 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5483 if (!p_ptr->resist_chaos || one_in_(9))
5485 inven_damage(set_elec_destroy, 2);
5486 inven_damage(set_fire_destroy, 2);
5490 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5494 /* Shards -- mostly cutting */
5497 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5498 if (p_ptr->resist_shard)
5500 dam *= 6; dam /= (randint1(4) + 7);
5502 else if (!CHECK_MULTISHADOW())
5504 (void)set_cut(p_ptr->cut + dam);
5507 if (!p_ptr->resist_shard || one_in_(13))
5509 inven_damage(set_cold_destroy, 2);
5512 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5516 /* Sound -- mostly stunning */
5519 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5520 if (p_ptr->resist_sound)
5522 dam *= 5; dam /= (randint1(4) + 7);
5524 else if (!CHECK_MULTISHADOW())
5526 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5527 (void)set_stun(p_ptr->stun + plus_stun);
5530 if (!p_ptr->resist_sound || one_in_(13))
5532 inven_damage(set_cold_destroy, 2);
5535 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5539 /* Pure confusion */
5542 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5543 if (p_ptr->resist_conf)
5545 dam *= 5; dam /= (randint1(4) + 7);
5547 else if (!CHECK_MULTISHADOW())
5549 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5551 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5555 /* Disenchantment -- see above */
5558 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5559 if (p_ptr->resist_disen)
5561 dam *= 6; dam /= (randint1(4) + 7);
5563 else if (!CHECK_MULTISHADOW())
5565 (void)apply_disenchant(0);
5567 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5571 /* Nexus -- see above */
5574 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5575 if (p_ptr->resist_nexus)
5577 dam *= 6; dam /= (randint1(4) + 7);
5579 else if (!CHECK_MULTISHADOW())
5583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5587 /* Force -- mostly stun */
5590 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5591 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5593 (void)set_stun(p_ptr->stun + randint1(20));
5595 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5600 /* Rocket -- stun, cut */
5603 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5604 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5606 (void)set_stun(p_ptr->stun + randint1(20));
5609 if (p_ptr->resist_shard)
5613 else if (!CHECK_MULTISHADOW())
5615 (void)set_cut(p_ptr->cut + (dam / 2));
5618 if (!p_ptr->resist_shard || one_in_(12))
5620 inven_damage(set_cold_destroy, 3);
5623 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5627 /* Inertia -- slowness */
5630 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5631 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5632 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5636 /* Lite -- blinding */
5639 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5640 if (p_ptr->resist_lite)
5642 dam *= 4; dam /= (randint1(4) + 7);
5644 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5646 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5649 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5651 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5654 else if (prace_is_(RACE_S_FAIRY))
5659 if (p_ptr->wraith_form) dam *= 2;
5660 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5662 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5664 p_ptr->wraith_form = 0;
5665 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5666 "The light forces you out of your incorporeal shadow form."));
5668 p_ptr->redraw |= PR_MAP;
5669 /* Update monsters */
5670 p_ptr->update |= (PU_MONSTERS);
5671 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5673 /* Redraw status bar */
5674 p_ptr->redraw |= (PR_STATUS);
5681 /* Dark -- blinding */
5684 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5685 if (p_ptr->resist_dark)
5687 dam *= 4; dam /= (randint1(4) + 7);
5689 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5691 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5693 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5695 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5699 /* Time -- bolt fewer effects XXX */
5702 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5703 if (p_ptr->resist_time)
5706 dam /= (randint1(4) + 7);
5707 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5709 else if (!CHECK_MULTISHADOW())
5711 switch (randint1(10))
5713 case 1: case 2: case 3: case 4: case 5:
5715 if (p_ptr->prace == RACE_ANDROID) break;
5716 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5717 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5721 case 6: case 7: case 8: case 9:
5723 switch (randint1(6))
5725 case 1: k = A_STR; act = _("強く", "strong"); break;
5726 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5727 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5728 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5729 case 5: k = A_CON; act = _("健康で", "hale"); break;
5730 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5733 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5734 "You're not as %s as you used to be..."), act);
5736 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5737 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5738 p_ptr->update |= (PU_BONUS);
5744 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5745 "You're not as powerful as you used to be..."));
5747 for (k = 0; k < 6; k++)
5749 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5750 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5752 p_ptr->update |= (PU_BONUS);
5758 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5762 /* Gravity -- stun plus slowness plus teleport */
5765 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5766 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5768 if (!CHECK_MULTISHADOW())
5770 teleport_player(5, TELEPORT_PASSIVE);
5771 if (!p_ptr->levitation)
5772 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5773 if (!(p_ptr->resist_sound || p_ptr->levitation))
5775 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5776 (void)set_stun(p_ptr->stun + plus_stun);
5779 if (p_ptr->levitation)
5781 dam = (dam * 2) / 3;
5784 if (!p_ptr->levitation || one_in_(13))
5786 inven_damage(set_cold_destroy, 2);
5789 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5793 /* Standard damage */
5794 case GF_DISINTEGRATE:
5796 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5798 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5804 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5806 (void)hp_player(dam);
5813 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5814 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5821 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5822 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5828 if (p_ptr->free_act) break;
5829 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5831 if (ironman_nightmare)
5833 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5834 /* Have some nightmares */
5835 sanity_blast(NULL, FALSE);
5838 set_paralyzed(p_ptr->paralyzed + dam);
5848 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5849 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5856 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5857 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5864 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5866 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5867 if (!p_ptr->resist_shard || one_in_(13))
5869 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5870 inven_damage(set_cold_destroy, 2);
5876 /* Ice -- cold plus stun plus cuts */
5879 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5880 get_damage = cold_dam(dam, killer, monspell, FALSE);
5881 if (!CHECK_MULTISHADOW())
5883 if (!p_ptr->resist_shard)
5885 (void)set_cut(p_ptr->cut + damroll(5, 8));
5887 if (!p_ptr->resist_sound)
5889 (void)set_stun(p_ptr->stun + randint1(15));
5892 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5894 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5904 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5906 if (p_ptr->mimic_form)
5908 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5909 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5914 switch (p_ptr->prace)
5916 /* Some races are immune */
5930 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5942 if (CHECK_MULTISHADOW())
5944 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5946 else if (p_ptr->csp)
5950 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5952 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5955 if (dam >= p_ptr->csp)
5959 p_ptr->csp_frac = 0;
5968 learn_spell(monspell);
5971 p_ptr->redraw |= (PR_MANA);
5973 p_ptr->window |= (PW_PLAYER);
5974 p_ptr->window |= (PW_SPELL);
5978 /* Heal the monster */
5979 if (m_ptr->hp < m_ptr->maxhp)
5983 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5985 /* Redraw (later) if needed */
5986 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5987 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5989 /* Special message */
5992 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6005 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6007 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6008 learn_spell(monspell);
6012 if (!CHECK_MULTISHADOW())
6014 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6016 if (!p_ptr->resist_conf)
6018 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6021 if (!p_ptr->resist_chaos && one_in_(3))
6023 (void)set_image(p_ptr->image + randint0(250) + 150);
6030 p_ptr->csp_frac = 0;
6032 p_ptr->redraw |= PR_MANA;
6035 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6041 case GF_BRAIN_SMASH:
6043 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6045 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6046 learn_spell(monspell);
6050 if (!CHECK_MULTISHADOW())
6052 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6058 p_ptr->csp_frac = 0;
6060 p_ptr->redraw |= PR_MANA;
6063 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6064 if (!CHECK_MULTISHADOW())
6066 if (!p_ptr->resist_blind)
6068 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6070 if (!p_ptr->resist_conf)
6072 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6074 if (!p_ptr->free_act)
6076 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6078 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6080 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6081 (void)do_dec_stat(A_INT);
6082 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6083 (void)do_dec_stat(A_WIS);
6085 if (!p_ptr->resist_chaos)
6087 (void)set_image(p_ptr->image + randint0(250) + 150);
6097 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6099 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6100 learn_spell(monspell);
6104 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6105 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6113 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6115 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6116 learn_spell(monspell);
6120 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6121 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6129 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6131 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6132 learn_spell(monspell);
6136 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6137 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6145 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6147 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6148 learn_spell(monspell);
6152 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6153 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6161 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6163 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6164 learn_spell(monspell);
6168 if (!CHECK_MULTISHADOW())
6170 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6171 curse_equipment(40, 20);
6174 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6176 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6191 /* Hex - revenge damage stored */
6192 revenge_store(get_damage);
6194 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6195 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6197 char m_name_self[80];
6200 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6202 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6203 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6204 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6207 if (p_ptr->riding && dam > 0)
6209 rakubadam_p = (dam > 200) ? 200 : dam;
6213 disturb(TRUE, TRUE);
6216 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6218 (void)kawarimi(FALSE);
6221 /* Return "Anything seen?" */
6227 * Find the distance from (x, y) to a line.
6229 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6231 /* Vector from (x, y) to (x1, y1) */
6232 POSITION py = y1 - y;
6233 POSITION px = x1 - x;
6236 POSITION ny = x2 - x1;
6237 POSITION nx = y1 - y2;
6240 POSITION pd = distance(y1, x1, y, x);
6241 POSITION nd = distance(y1, x1, y2, x2);
6243 if (pd > nd) return distance(y, x, y2, x2);
6245 /* Component of P on N */
6246 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6248 /* Absolute value */
6249 return((nd >= 0) ? nd : 0 - nd);
6256 * Modified version of los() for calculation of disintegration balls.
6257 * Disintegration effects are stopped by permanent walls.
6259 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6279 /* Slope, or 1/Slope, of LOS */
6283 /* Extract the offset */
6287 /* Extract the absolute offset */
6292 /* Handle adjacent (or identical) grids */
6293 if ((ax < 2) && (ay < 2)) return (TRUE);
6296 /* Paranoia -- require "safe" origin */
6297 /* if (!in_bounds(y1, x1)) return (FALSE); */
6300 /* Directly South/North */
6303 /* South -- check for walls */
6306 for (ty = y1 + 1; ty < y2; ty++)
6308 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6312 /* North -- check for walls */
6315 for (ty = y1 - 1; ty > y2; ty--)
6317 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6325 /* Directly East/West */
6328 /* East -- check for walls */
6331 for (tx = x1 + 1; tx < x2; tx++)
6333 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6337 /* West -- check for walls */
6340 for (tx = x1 - 1; tx > x2; tx--)
6342 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6351 /* Extract some signs */
6352 sx = (dx < 0) ? -1 : 1;
6353 sy = (dy < 0) ? -1 : 1;
6356 /* Vertical "knights" */
6361 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6365 /* Horizontal "knights" */
6370 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6375 /* Calculate scale factor div 2 */
6378 /* Calculate scale factor */
6382 /* Travel horizontally */
6385 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6391 /* Consider the special case where slope == 1. */
6402 /* Note (below) the case (qy == f2), where */
6403 /* the LOS exactly meets the corner of a tile. */
6406 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6417 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6430 /* Travel vertically */
6433 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6449 /* Note (below) the case (qx == f2), where */
6450 /* the LOS exactly meets the corner of a tile. */
6453 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6464 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6485 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, EFFECT_ID typ)
6490 int brev = rad * rad / dist;
6494 int mdis = distance(y1, x1, y2, x2) + rad;
6496 while (bdis <= mdis)
6500 if ((0 < dist) && (path_n < dist))
6502 POSITION ny = GRID_Y(path_g[path_n]);
6503 POSITION nx = GRID_X(path_g[path_n]);
6504 POSITION nd = distance(ny, nx, y1, x1);
6506 /* Get next base point */
6515 /* Travel from center outward */
6516 for (cdis = 0; cdis <= brad; cdis++)
6518 /* Scan the maximal blast area of radius "cdis" */
6519 for (y = by - cdis; y <= by + cdis; y++)
6521 for (x = bx - cdis; x <= bx + cdis; x++)
6523 /* Ignore "illegal" locations */
6524 if (!in_bounds(y, x)) continue;
6526 /* Enforce a circular "ripple" */
6527 if (distance(y1, x1, y, x) != bdis) continue;
6529 /* Enforce an arc */
6530 if (distance(by, bx, y, x) != cdis) continue;
6536 /* Lights are stopped by opaque terrains */
6537 if (!los(by, bx, y, x)) continue;
6539 case GF_DISINTEGRATE:
6540 /* Disintegration are stopped only by perma-walls */
6541 if (!in_disintegration_range(by, bx, y, x)) continue;
6544 /* Ball explosions are stopped by walls */
6545 if (!projectable(by, bx, y, x)) continue;
6549 /* Save this grid */
6557 /* Encode some more "radius" info */
6558 gm[bdis + 1] = *pgrids;
6560 /* Increase the size */
6561 brad = rad * (path_n + brev) / (dist + brev);
6563 /* Find the next ripple */
6567 /* Store the effect size */
6573 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6574 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6575 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6576 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6577 * @param x 目標X座標 / Target x location (or location to travel "towards")
6578 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6579 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6580 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6581 * @param monspell 効果元のモンスター魔法ID
6582 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6585 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6586 * towards a given location (optionally passing over the heads of interposing
6587 * monsters), and have it do a given amount of damage to the monsters (and
6588 * optionally objects) within the given radius of the final location.
6590 * A "bolt" travels from source to target and affects only the target grid.
6591 * A "beam" travels from source to target, affecting all grids passed through.
6592 * A "ball" travels from source to the target, exploding at the target, and
6593 * affecting everything within the given radius of the target location.
6595 * Traditionally, a "bolt" does not affect anything on the ground, and does
6596 * not pass over the heads of interposing monsters, much like a traditional
6597 * missile, and will "stop" abruptly at the "target" even if no monster is
6598 * positioned there, while a "ball", on the other hand, passes over the heads
6599 * of monsters between the source and target, and affects everything except
6600 * the source monster which lies within the final radius, while a "beam"
6601 * affects every monster between the source and target, except for the casting
6602 * monster (or player), and rarely affects things on the ground.
6604 * Two special flags allow us to use this function in special ways, the
6605 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6606 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6607 * actually projecting from the source monster (or player).
6609 * The player will only get "experience" for monsters killed by himself
6610 * Unique monsters can only be destroyed by attacks from the player
6612 * Only 256 grids can be affected per projection, limiting the effective
6613 * "radius" of standard ball attacks to nine units (diameter nineteen).
6615 * One can project in a given "direction" by combining PROJECT_THRU with small
6616 * offsets to the initial location (see "line_spell()"), or by calculating
6617 * "virtual targets" far away from the player.
6619 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6620 * continuing until it actually hits somethings (useful for "stone to mud").
6622 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6624 * Balls must explode BEFORE hitting walls, or they would affect monsters
6625 * on both sides of a wall. Some bug reports indicate that this is still
6626 * happening in 2.7.8 for Windows, though it appears to be impossible.
6628 * We "pre-calculate" the blast area only in part for efficiency.
6629 * More importantly, this lets us do "explosions" from the "inside" out.
6630 * This results in a more logical distribution of "blast" treasure.
6631 * It also produces a better (in my opinion) animation of the explosion.
6632 * It could be (but is not) used to have the treasure dropped by monsters
6633 * in the middle of the explosion fall "outwards", and then be damaged by
6634 * the blast as it spreads outwards towards the treasure drop location.
6636 * Walls and doors are included in the blast area, so that they can be
6637 * "burned" or "melted" in later versions.
6639 * This algorithm is intended to maximize simplicity, not necessarily
6640 * efficiency, since this function is not a bottleneck in the code.
6642 * We apply the blast effect from ground zero outwards, in several passes,
6643 * first affecting features, then objects, then monsters, then the player.
6644 * This allows walls to be removed before checking the object or monster
6645 * in the wall, and protects objects which are dropped by monsters killed
6646 * in the blast, and allows the player to see all affects before he is
6647 * killed or teleported away. The semantics of this method are open to
6648 * various interpretations, but they seem to work well in practice.
6650 * We process the blast area from ground-zero outwards to allow for better
6651 * distribution of treasure dropped by monsters, and because it provides a
6652 * pleasing visual effect at low cost.
6654 * Note that the damage done by "ball" explosions decreases with distance.
6655 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6657 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6658 * the target, and then the damage "flows" along this beam of destruction.
6659 * The damage at every grid is the same as at the "center" of a "ball"
6660 * explosion, since the "beam" grids are treated as if they ARE at the
6661 * center of a "ball" explosion.
6663 * Currently, specifying "beam" plus "ball" means that locations which are
6664 * covered by the initial "beam", and also covered by the final "ball", except
6665 * for the final grid (the epicenter of the ball), will be "hit twice", once
6666 * by the initial beam, and once by the exploding ball. For the grid right
6667 * next to the epicenter, this results in 150% damage being done. The center
6668 * does not have this problem, for the same reason the final grid in a "beam"
6669 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6670 * grids which are covered by the "ball" will NOT work, as then they will
6671 * receive LESS damage than they should. Do not combine "beam" with "ball".
6673 * The array "gy[],gx[]" with current size "grids" is used to hold the
6674 * collected locations of all grids in the "blast area" plus "beam path".
6676 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6677 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6678 * first blast grid (see above) with radius "N" from the blast center. Note
6679 * that only the first gm[1] grids in the blast area thus take full damage.
6680 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6681 * number of blast grids.
6683 * Note that once the projection is complete, (y2,x2) holds the final location
6684 * of bolts/beams, and the "epicenter" of balls.
6686 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6687 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6688 * implementation of the "distance" function. Also, a bolt can be properly
6689 * viewed as a "ball" with a "rad" of "zero".
6691 * Note that if no "target" is reached before the beam/bolt/ball travels the
6692 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6693 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6695 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6696 * to move from point A to point B, even if the player cannot see part of the
6697 * projection path. Note that in general, the player will *always* see part
6698 * of the path, since it either starts at the player or ends on the player.
6700 * Hack -- we assume that every "projection" is "self-illuminating".
6702 * Hack -- when only a single monster is affected, we automatically track
6703 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6705 * Note that all projections now "explode" at their final destination, even
6706 * if they were being projected at a more distant destination. This means
6707 * that "ball" spells will *always* explode.
6709 * Note that we must call "handle_stuff()" after affecting terrain features
6710 * in the blast radius, in case the "illumination" of the grid was changed,
6711 * and "update_view()" and "update_monsters()" need to be called.
6714 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6724 POSITION y_saver, x_saver; /* For reflecting monsters */
6726 int msec = delay_factor * delay_factor * delay_factor;
6728 /* Assume the player sees nothing */
6729 bool notice = FALSE;
6731 /* Assume the player has seen nothing */
6732 bool visual = FALSE;
6734 /* Assume the player has seen no blast grids */
6737 /* Assume to be a normal ball spell */
6738 bool breath = FALSE;
6740 /* Is the player blind? */
6741 bool blind = (p_ptr->blind ? TRUE : FALSE);
6743 bool old_hide = FALSE;
6745 /* Number of grids in the "path" */
6748 /* Actual grids in the "path" */
6751 /* Number of grids in the "blast area" (including the "beam" path) */
6754 /* Coordinates of the affected grids */
6755 POSITION gx[1024], gy[1024];
6757 /* Encoded "radius" info (see above) */
6760 /* Actual radius encoded in gm[] */
6761 POSITION gm_rad = rad;
6765 /* Attacker's name (prepared before polymorph)*/
6768 /* Can the player see the source of this effect? */
6769 bool see_s_msg = TRUE;
6771 /* Initialize by null string */
6777 /* Default target of monsterspell is player */
6778 monster_target_y = p_ptr->y;
6779 monster_target_x = p_ptr->x;
6781 /* Hack -- Jump to target */
6782 if (flg & (PROJECT_JUMP))
6787 /* Clear the flag */
6788 flg &= ~(PROJECT_JUMP);
6793 /* Start at player */
6800 /* Start at monster */
6803 x1 = m_list[who].fx;
6804 y1 = m_list[who].fy;
6805 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6817 /* Default "destination" */
6822 /* Hack -- verify stuff */
6823 if (flg & (PROJECT_THRU))
6825 if ((x1 == x2) && (y1 == y2))
6827 flg &= ~(PROJECT_THRU);
6831 /* Handle a breath attack */
6836 if (flg & PROJECT_HIDE) old_hide = TRUE;
6837 flg |= PROJECT_HIDE;
6841 /* Hack -- Assume there will be no blast (max radius 32) */
6842 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6850 /* Collect beam grids */
6851 if (flg & (PROJECT_BEAM))
6862 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6864 case GF_DISINTEGRATE:
6865 flg |= (PROJECT_GRID);
6866 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6870 /* Calculate the projection path */
6872 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6874 /* Hack -- Handle stuff */
6877 /* Giga-Hack SEEKER & SUPER_RAY */
6879 if( typ == GF_SEEKER )
6889 for (i = 0; i < path_n; ++i)
6894 int ny = GRID_Y(path_g[i]);
6895 int nx = GRID_X(path_g[i]);
6906 /* Only do visuals if requested */
6907 if (!blind && !(flg & (PROJECT_HIDE)))
6909 /* Only do visuals if the player can "see" the bolt */
6910 if (panel_contains(y, x) && player_has_los_bold(y, x))
6917 /* Obtain the bolt pict */
6918 p = bolt_pict(oy, ox, y, x, typ);
6920 /* Extract attr/char */
6924 /* Visual effects */
6925 print_rel(c, a, y, x);
6926 move_cursor_relative(y, x);
6927 /*if (fresh_before)*/ Term_fresh();
6928 Term_xtra(TERM_XTRA_DELAY, msec);
6930 /*if (fresh_before)*/ Term_fresh();
6932 /* Display "beam" grids */
6933 if (flg & (PROJECT_BEAM))
6935 /* Obtain the explosion pict */
6936 p = bolt_pict(y, x, y, x, typ);
6938 /* Extract attr/char */
6942 /* Visual effects */
6943 print_rel(c, a, y, x);
6946 /* Hack -- Activate delay */
6950 /* Hack -- delay anyway for consistency */
6953 /* Delay for consistency */
6954 Term_xtra(TERM_XTRA_DELAY, msec);
6957 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6958 if( is_mirror_grid(&cave[y][x]))
6960 /* The target of monsterspell becomes tha mirror(broken) */
6961 monster_target_y=(s16b)y;
6962 monster_target_x=(s16b)x;
6964 remove_mirror(y, x);
6965 next_mirror(&oy, &ox, y, x);
6967 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6968 for(j = last_i; j <= i; j++)
6970 y = GRID_Y(path_g[j]);
6971 x = GRID_X(path_g[j]);
6972 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6973 if(!who && (project_m_n==1) && !jump ){
6974 if(cave[project_m_y][project_m_x].m_idx >0 ){
6975 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6979 /* Hack -- auto-recall */
6980 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6982 /* Hack - auto-track */
6983 health_track(cave[project_m_y][project_m_x].m_idx);
6987 (void)project_f(0,0,y,x,dam,GF_SEEKER);
6992 for(i = last_i ; i < path_n ; i++)
6995 py = GRID_Y(path_g[i]);
6996 px = GRID_X(path_g[i]);
6997 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6999 if(!who && (project_m_n==1) && !jump ){
7000 if(cave[project_m_y][project_m_x].m_idx > 0)
7002 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7006 /* Hack -- auto-recall */
7007 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7009 /* Hack - auto-track */
7010 health_track(cave[project_m_y][project_m_x].m_idx);
7014 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7018 else if(typ == GF_SUPER_RAY){
7020 int second_step = 0;
7027 for (i = 0; i < path_n; ++i)
7032 int ny = GRID_Y(path_g[i]);
7033 int nx = GRID_X(path_g[i]);
7044 /* Only do visuals if requested */
7045 if (!blind && !(flg & (PROJECT_HIDE)))
7047 /* Only do visuals if the player can "see" the bolt */
7048 if (panel_contains(y, x) && player_has_los_bold(y, x))
7055 /* Obtain the bolt pict */
7056 p = bolt_pict(oy, ox, y, x, typ);
7058 /* Extract attr/char */
7062 /* Visual effects */
7063 print_rel(c, a, y, x);
7064 move_cursor_relative(y, x);
7065 /*if (fresh_before)*/ Term_fresh();
7066 Term_xtra(TERM_XTRA_DELAY, msec);
7068 /*if (fresh_before)*/ Term_fresh();
7070 /* Display "beam" grids */
7071 if (flg & (PROJECT_BEAM))
7073 /* Obtain the explosion pict */
7074 p = bolt_pict(y, x, y, x, typ);
7076 /* Extract attr/char */
7080 /* Visual effects */
7081 print_rel(c, a, y, x);
7084 /* Hack -- Activate delay */
7088 /* Hack -- delay anyway for consistency */
7091 /* Delay for consistency */
7092 Term_xtra(TERM_XTRA_DELAY, msec);
7095 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7096 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7098 if( second_step )continue;
7101 if( is_mirror_grid(&cave[y][x]) && !second_step )
7103 /* The target of monsterspell becomes tha mirror(broken) */
7104 monster_target_y=(s16b)y;
7105 monster_target_x=(s16b)x;
7108 for( j = 0; j <=i ; j++ )
7110 y = GRID_Y(path_g[j]);
7111 x = GRID_X(path_g[j]);
7112 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7116 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7117 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7118 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7119 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7120 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7121 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7122 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7123 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7126 for( i = 0; i < path_n ; i++ )
7129 py = GRID_Y(path_g[i]);
7130 px = GRID_X(path_g[i]);
7131 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7132 if(!who && (project_m_n == 1) && !jump){
7133 if(cave[project_m_y][project_m_x].m_idx >0 ){
7134 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7138 /* Hack -- auto-recall */
7139 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7141 /* Hack - auto-track */
7142 health_track(cave[project_m_y][project_m_x].m_idx);
7146 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7151 /* Project along the path */
7152 for (i = 0; i < path_n; ++i)
7157 int ny = GRID_Y(path_g[i]);
7158 int nx = GRID_X(path_g[i]);
7160 if (flg & PROJECT_DISI)
7162 /* Hack -- Balls explode before reaching walls */
7163 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7165 else if (flg & PROJECT_LOS)
7167 /* Hack -- Balls explode before reaching walls */
7168 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7172 /* Hack -- Balls explode before reaching walls */
7173 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7180 /* Collect beam grids */
7181 if (flg & (PROJECT_BEAM))
7188 /* Only do visuals if requested */
7189 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7191 /* Only do visuals if the player can "see" the bolt */
7192 if (panel_contains(y, x) && player_has_los_bold(y, x))
7199 /* Obtain the bolt pict */
7200 p = bolt_pict(oy, ox, y, x, typ);
7202 /* Extract attr/char */
7206 /* Visual effects */
7207 print_rel(c, a, y, x);
7208 move_cursor_relative(y, x);
7209 /*if (fresh_before)*/ Term_fresh();
7210 Term_xtra(TERM_XTRA_DELAY, msec);
7212 /*if (fresh_before)*/ Term_fresh();
7214 /* Display "beam" grids */
7215 if (flg & (PROJECT_BEAM))
7217 /* Obtain the explosion pict */
7218 p = bolt_pict(y, x, y, x, typ);
7220 /* Extract attr/char */
7224 /* Visual effects */
7225 print_rel(c, a, y, x);
7228 /* Hack -- Activate delay */
7232 /* Hack -- delay anyway for consistency */
7235 /* Delay for consistency */
7236 Term_xtra(TERM_XTRA_DELAY, msec);
7243 /* Save the "blast epicenter" */
7247 if (breath && !path_n)
7253 flg &= ~(PROJECT_HIDE);
7257 /* Start the "explosion" */
7260 /* Hack -- make sure beams get to "explode" */
7268 /* If we found a "target", explode there */
7269 if (dist <= MAX_RANGE)
7271 /* Mega-Hack -- remove the final "beam" grid */
7272 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7275 * Create a conical breath attack
7286 flg &= ~(PROJECT_HIDE);
7288 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7292 /* Determine the blast area, work from the inside out */
7293 for (dist = 0; dist <= rad; dist++)
7295 /* Scan the maximal blast area of radius "dist" */
7296 for (y = by - dist; y <= by + dist; y++)
7298 for (x = bx - dist; x <= bx + dist; x++)
7300 /* Ignore "illegal" locations */
7301 if (!in_bounds2(y, x)) continue;
7303 /* Enforce a "circular" explosion */
7304 if (distance(by, bx, y, x) != dist) continue;
7310 /* Lights are stopped by opaque terrains */
7311 if (!los(by, bx, y, x)) continue;
7313 case GF_DISINTEGRATE:
7314 /* Disintegration are stopped only by perma-walls */
7315 if (!in_disintegration_range(by, bx, y, x)) continue;
7318 /* Ball explosions are stopped by walls */
7319 if (!projectable(by, bx, y, x)) continue;
7323 /* Save this grid */
7330 /* Encode some more "radius" info */
7336 /* Speed -- ignore "non-explosions" */
7337 if (!grids) return (FALSE);
7340 /* Display the "blast area" if requested */
7341 if (!blind && !(flg & (PROJECT_HIDE)))
7343 /* Then do the "blast", from inside out */
7344 for (t = 0; t <= gm_rad; t++)
7346 /* Dump everything with this radius */
7347 for (i = gm[t]; i < gm[t+1]; i++)
7349 /* Extract the location */
7353 /* Only do visuals if the player can "see" the blast */
7354 if (panel_contains(y, x) && player_has_los_bold(y, x))
7363 /* Obtain the explosion pict */
7364 p = bolt_pict(y, x, y, x, typ);
7366 /* Extract attr/char */
7370 /* Visual effects -- Display */
7371 print_rel(c, a, y, x);
7375 /* Hack -- center the cursor */
7376 move_cursor_relative(by, bx);
7378 /* Flush each "radius" seperately */
7379 /*if (fresh_before)*/ Term_fresh();
7381 /* Delay (efficiently) */
7382 if (visual || drawn)
7384 Term_xtra(TERM_XTRA_DELAY, msec);
7388 /* Flush the erasing */
7391 /* Erase the explosion drawn above */
7392 for (i = 0; i < grids; i++)
7394 /* Extract the location */
7398 /* Hack -- Erase if needed */
7399 if (panel_contains(y, x) && player_has_los_bold(y, x))
7405 /* Hack -- center the cursor */
7406 move_cursor_relative(by, bx);
7408 /* Flush the explosion */
7409 /*if (fresh_before)*/ Term_fresh();
7414 /* Update stuff if needed */
7415 if (p_ptr->update) update_stuff();
7418 if (flg & PROJECT_KILL)
7420 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7421 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7425 /* Check features */
7426 if (flg & (PROJECT_GRID))
7428 /* Start with "dist" of zero */
7431 /* Scan for features */
7432 for (i = 0; i < grids; i++)
7434 /* Hack -- Notice new "dist" values */
7435 if (gm[dist+1] == i) dist++;
7437 /* Get the grid location */
7441 /* Find the closest point in the blast */
7444 int d = dist_to_line(y, x, y1, x1, by, bx);
7446 /* Affect the grid */
7447 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7451 /* Affect the grid */
7452 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7457 /* Update stuff if needed */
7458 if (p_ptr->update) update_stuff();
7461 if (flg & (PROJECT_ITEM))
7463 /* Start with "dist" of zero */
7466 /* Scan for objects */
7467 for (i = 0; i < grids; i++)
7469 /* Hack -- Notice new "dist" values */
7470 if (gm[dist+1] == i) dist++;
7472 /* Get the grid location */
7476 /* Find the closest point in the blast */
7479 int d = dist_to_line(y, x, y1, x1, by, bx);
7481 /* Affect the object in the grid */
7482 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7486 /* Affect the object in the grid */
7487 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7493 /* Check monsters */
7494 if (flg & (PROJECT_KILL))
7501 /* Start with "dist" of zero */
7504 /* Scan for monsters */
7505 for (i = 0; i < grids; i++)
7509 /* Hack -- Notice new "dist" values */
7510 if (gm[dist + 1] == i) dist++;
7512 /* Get the grid location */
7516 /* A single bolt may be reflected */
7519 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7520 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7522 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7523 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7524 (!who || dist_hack > 1) && !one_in_(10))
7527 int max_attempts = 10;
7529 /* Choose 'new' target */
7532 t_y = y_saver - 1 + randint1(3);
7533 t_x = x_saver - 1 + randint1(3);
7536 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7538 if (max_attempts < 1)
7544 sound(SOUND_REFLECT);
7547 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7548 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7549 else if (m_ptr->r_idx == MON_DIO)
7550 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7552 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7554 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7556 /* Reflected bolts randomly target either one */
7557 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7558 else flg |= PROJECT_PLAYER;
7560 /* The bolt is reflected */
7561 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7563 /* Don't affect the monster any longer */
7569 /* Find the closest point in the blast */
7572 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7576 effective_dist = dist;
7580 /* There is the riding player on this monster */
7581 if (p_ptr->riding && player_bold(y, x))
7583 /* Aimed on the player */
7584 if (flg & PROJECT_PLAYER)
7586 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7589 * A beam or bolt is well aimed
7591 * So don't affects the mount.
7598 * The spell is not well aimed,
7599 * So partly affect the mount too.
7606 * This grid is the original target.
7607 * Or aimed on your horse.
7609 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7611 /* Hit the mount with full damage */
7615 * Otherwise this grid is not the
7616 * original target, it means that line
7617 * of fire is obstructed by this
7621 * A beam or bolt will hit either
7622 * player or mount. Choose randomly.
7624 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7628 /* Hit the mount with full damage */
7632 /* Hit the player later */
7633 flg |= PROJECT_PLAYER;
7635 /* Don't affect the mount */
7641 * The spell is not well aimed, so
7642 * partly affect both player and
7651 /* Affect the monster in the grid */
7652 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7656 /* Player affected one monster (without "jumping") */
7657 if (!who && (project_m_n == 1) && !jump)
7662 /* Track if possible */
7663 if (cave[y][x].m_idx > 0)
7665 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7669 /* Hack -- auto-recall */
7670 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7672 /* Hack - auto-track */
7673 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7681 if (flg & (PROJECT_KILL))
7683 /* Start with "dist" of zero */
7686 /* Scan for player */
7687 for (i = 0; i < grids; i++)
7691 /* Hack -- Notice new "dist" values */
7692 if (gm[dist+1] == i) dist++;
7694 /* Get the grid location */
7698 /* Affect the player? */
7699 if (!player_bold(y, x)) continue;
7701 /* Find the closest point in the blast */
7704 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7708 effective_dist = dist;
7711 /* Target may be your horse */
7714 /* Aimed on the player */
7715 if (flg & PROJECT_PLAYER)
7717 /* Hit the player with full damage */
7721 * Hack -- When this grid was not the
7722 * original target, a beam or bolt
7723 * would hit either player or mount,
7724 * and should be choosen randomly.
7726 * But already choosen to hit the
7727 * mount at this point.
7729 * Or aimed on your horse.
7731 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7734 * A beam or bolt is well aimed
7736 * So don't affects the player.
7743 * The spell is not well aimed,
7744 * So partly affect the player too.
7750 /* Affect the player */
7751 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7759 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7761 if (rakubadam_m > 0)
7763 if (rakuba(rakubadam_m, FALSE))
7765 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7768 if (p_ptr->riding && rakubadam_p > 0)
7770 if(rakuba(rakubadam_p, FALSE))
7772 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7777 /* Return "something was noticed" */
7782 * @brief 鏡魔法「封魔結界」の効果処理
7784 * @return 効果があったらTRUEを返す
7786 bool binding_field(HIT_POINT dam)
7788 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7789 int mirror_num = 0; /* 鏡の数 */
7791 POSITION centersign;
7792 POSITION x1, x2, y1, y2;
7794 int msec = delay_factor*delay_factor*delay_factor;
7797 POSITION point_x[3];
7798 POSITION point_y[3];
7800 /* Default target of monsterspell is player */
7801 monster_target_y = p_ptr->y;
7802 monster_target_x = p_ptr->x;
7804 for (x = 0; x < cur_wid; x++)
7806 for (y = 0; y < cur_hgt; y++)
7808 if (is_mirror_grid(&cave[y][x]) &&
7809 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7810 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7811 player_has_los_bold(y, x) &&
7812 projectable(p_ptr->y, p_ptr->x, y, x)
7814 mirror_y[mirror_num] = y;
7815 mirror_x[mirror_num] = x;
7821 if (mirror_num < 2)return FALSE;
7823 point_x[0] = randint0(mirror_num);
7825 point_x[1] = randint0(mirror_num);
7826 } while (point_x[0] == point_x[1]);
7828 point_y[0] = mirror_y[point_x[0]];
7829 point_x[0] = mirror_x[point_x[0]];
7830 point_y[1] = mirror_y[point_x[1]];
7831 point_x[1] = mirror_x[point_x[1]];
7832 point_y[2] = p_ptr->y;
7833 point_x[2] = p_ptr->x;
7835 x = point_x[0] + point_x[1] + point_x[2];
7836 y = point_y[0] + point_y[1] + point_y[2];
7838 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7839 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7840 if (centersign == 0)return FALSE;
7842 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7843 x1 = x1 < point_x[2] ? x1 : point_x[2];
7844 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7845 y1 = y1 < point_y[2] ? y1 : point_y[2];
7847 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7848 x2 = x2 > point_x[2] ? x2 : point_x[2];
7849 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7850 y2 = y2 > point_y[2] ? y2 : point_y[2];
7852 for (y = y1; y <= y2; y++) {
7853 for (x = x1; x <= x2; x++) {
7854 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7855 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7856 centersign*((point_x[1] - x)*(point_y[2] - y)
7857 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7858 centersign*((point_x[2] - x)*(point_y[0] - y)
7859 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7861 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7862 /* Visual effects */
7864 && panel_contains(y, x)) {
7865 p = bolt_pict(y, x, y, x, GF_MANA);
7866 print_rel(PICT_C(p), PICT_A(p), y, x);
7867 move_cursor_relative(y, x);
7868 /*if (fresh_before)*/ Term_fresh();
7869 Term_xtra(TERM_XTRA_DELAY, msec);
7875 for (y = y1; y <= y2; y++) {
7876 for (x = x1; x <= x2; x++) {
7877 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7878 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7879 centersign*((point_x[1] - x)*(point_y[2] - y)
7880 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7881 centersign*((point_x[2] - x)*(point_y[0] - y)
7882 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7884 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7885 (void)project_f(0, 0, y, x, dam, GF_MANA);
7890 for (y = y1; y <= y2; y++) {
7891 for (x = x1; x <= x2; x++) {
7892 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7893 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7894 centersign*((point_x[1] - x)*(point_y[2] - y)
7895 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7896 centersign*((point_x[2] - x)*(point_y[0] - y)
7897 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7899 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7900 (void)project_o(0, 0, y, x, dam, GF_MANA);
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 (void)project_m(0, 0, y, x, dam, GF_MANA,
7916 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7922 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7923 remove_mirror(point_y[0], point_x[0]);
7930 * @brief 鏡魔法「鏡の封印」の効果処理
7932 * @return 効果があったらTRUEを返す
7934 void seal_of_mirror(HIT_POINT dam)
7938 for (x = 0; x < cur_wid; x++)
7940 for (y = 0; y < cur_hgt; y++)
7942 if (is_mirror_grid(&cave[y][x]))
7944 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7945 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7947 if (!cave[y][x].m_idx)
7949 remove_mirror(y, x);