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);
865 /* Destroy Doors (and traps) */
868 /* Destroy all doors and traps */
869 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
871 /* Check line of sight */
874 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
878 /* Destroy the feature */
879 cave_alter_feat(y, x, FF_TUNNEL);
882 /* Remove "unsafe" flag if player is not blind */
883 if (!p_ptr->blind && player_has_los_bold(y, x))
885 c_ptr->info &= ~(CAVE_UNSAFE);
895 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
897 if (have_flag(f_ptr->flags, FF_SPIKE))
899 s16b old_mimic = c_ptr->mimic;
900 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
902 cave_alter_feat(y, x, FF_SPIKE);
904 c_ptr->mimic = old_mimic;
910 /* Check line of sight */
911 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
913 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
920 /* Destroy walls (and doors) */
923 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
925 if (known && (c_ptr->info & (CAVE_MARK)))
927 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
931 /* Destroy the wall */
932 cave_alter_feat(y, x, FF_HURT_ROCK);
934 /* Update some things */
935 p_ptr->update |= (PU_FLOW);
944 /* Require a "naked" floor grid */
945 if (!cave_naked_bold(y, x)) break;
947 /* Not on the player */
948 if (player_bold(y, x)) break;
950 /* Create a closed door */
951 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
954 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
971 /* Require a "naked" floor grid */
972 if (!cave_naked_bold(y, x)) break;
974 /* Not on the player */
975 if (player_bold(y, x)) break;
977 /* Create a closed door */
978 cave_set_feat(y, x, feat_tree);
981 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
989 /* Require a "naked" floor grid */
990 if (!cave_naked_bold(y, x)) break;
993 c_ptr->info |= CAVE_OBJECT;
994 c_ptr->mimic = feat_glyph;
1005 /* Require a "naked" floor grid */
1006 if (!cave_naked_bold(y, x)) break;
1008 /* Not on the player */
1009 if (player_bold(y, x)) break;
1012 cave_set_feat(y, x, feat_granite);
1020 /* Ignore permanent grid */
1021 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1026 /* Ignore grid without enough space */
1027 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1029 /* Place a shallow lava */
1030 cave_set_feat(y, x, feat_shallow_lava);
1035 /* Place a deep lava */
1036 cave_set_feat(y, x, feat_deep_lava);
1043 /* Ignore permanent grid */
1044 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1049 /* Ignore grid without enough space */
1050 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1052 /* Place a shallow water */
1053 cave_set_feat(y, x, feat_shallow_water);
1058 /* Place a deep water */
1059 cave_set_feat(y, x, feat_deep_water);
1064 /* Lite up the grid */
1068 /* Turn on the light */
1069 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1071 c_ptr->info |= (CAVE_GLOW);
1077 update_local_illumination(y, x);
1080 if (player_can_see_bold(y, x)) obvious = TRUE;
1082 /* Mega-Hack -- Update the monster in the affected grid */
1083 /* This allows "spear of light" (etc) to work "correctly" */
1084 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1086 if (p_ptr->special_defense & NINJA_S_STEALTH)
1088 if (player_bold(y, x)) set_superstealth(FALSE);
1095 /* Darken the grid */
1099 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1102 /* Turn off the light. */
1105 if (dun_level || !is_daytime())
1107 for (j = 0; j < 9; j++)
1109 int by = y + ddy_ddd[j];
1110 int bx = x + ddx_ddd[j];
1112 if (in_bounds2(by, bx))
1114 cave_type *cc_ptr = &cave[by][bx];
1116 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1124 if (!do_dark) break;
1127 c_ptr->info &= ~(CAVE_GLOW);
1129 /* Hack -- Forget "boring" grids */
1130 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1133 c_ptr->info &= ~(CAVE_MARK);
1140 update_local_illumination(y, x);
1142 if (player_can_see_bold(y, x)) obvious = TRUE;
1144 /* Mega-Hack -- Update the monster in the affected grid */
1145 /* This allows "spear of light" (etc) to work "correctly" */
1146 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1156 if (is_mirror_grid(c_ptr))
1158 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1160 remove_mirror(y, x);
1161 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1164 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1166 if (known && (c_ptr->info & CAVE_MARK))
1168 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1172 /* Destroy the wall */
1173 cave_alter_feat(y, x, FF_HURT_ROCK);
1175 /* Update some things */
1176 p_ptr->update |= (PU_FLOW);
1183 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1185 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1187 remove_mirror(y, x);
1188 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1191 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1193 if (known && (c_ptr->info & CAVE_MARK))
1195 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1199 /* Destroy the wall */
1200 cave_alter_feat(y, x, FF_HURT_ROCK);
1202 /* Update some things */
1203 p_ptr->update |= (PU_FLOW);
1208 case GF_DISINTEGRATE:
1210 /* Destroy mirror/glyph */
1211 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1212 remove_mirror(y, x);
1214 /* Permanent features don't get effect */
1215 /* But not protect monsters and other objects */
1216 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1218 cave_alter_feat(y, x, FF_HURT_DISI);
1220 /* Update some things -- similar to GF_KILL_WALL */
1221 p_ptr->update |= (PU_FLOW);
1228 /* Return "Anything seen?" */
1235 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1236 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1237 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1238 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1239 * @param x 目標X座標 / Target x location (or location to travel "towards")
1240 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1241 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1242 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1245 * We are called from "project()" to "damage" objects
1247 * We are called both for "beam" effects and "ball" effects.
1249 * Perhaps we should only SOMETIMES damage things on the ground.
1251 * The "r" parameter is the "distance from ground zero".
1253 * Note that we determine if the player can "see" anything that happens
1254 * by taking into account: blindness, line-of-sight, and illumination.
1256 * We also "see" grids which are "memorized", probably a hack
1258 * We return "TRUE" if the effect of the projection is "obvious".
1261 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1263 cave_type *c_ptr = &cave[y][x];
1265 OBJECT_IDX this_o_idx, next_o_idx = 0;
1267 bool obvious = FALSE;
1268 bool known = player_has_los_bold(y, x);
1270 BIT_FLAGS flgs[TR_FLAG_SIZE];
1272 char o_name[MAX_NLEN];
1274 KIND_OBJECT_IDX k_idx = 0;
1275 bool is_potion = FALSE;
1278 who = who ? who : 0;
1280 /* Reduce damage by distance */
1281 dam = (dam + r) / (r + 1);
1284 /* Scan all objects in the grid */
1285 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1287 object_type *o_ptr = &o_list[this_o_idx];
1289 bool is_art = FALSE;
1290 bool ignore = FALSE;
1291 bool do_kill = FALSE;
1293 cptr note_kill = NULL;
1296 /* Get the "plural"-ness */
1297 bool plural = (o_ptr->number > 1);
1300 /* Acquire next object */
1301 next_o_idx = o_ptr->next_o_idx;
1303 /* Extract the flags */
1304 object_flags(o_ptr, flgs);
1306 /* Check for artifact */
1307 if (object_is_artifact(o_ptr)) is_art = TRUE;
1309 /* Analyze the type */
1312 /* Acid -- Lots of things */
1315 if (hates_acid(o_ptr))
1318 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1319 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1324 /* Elec -- Rings and Wands */
1327 if (hates_elec(o_ptr))
1330 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1331 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1336 /* Fire -- Flammable objects */
1339 if (hates_fire(o_ptr))
1342 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1343 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1348 /* Cold -- potions and flasks */
1351 if (hates_cold(o_ptr))
1353 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1355 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1363 if (hates_fire(o_ptr))
1366 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1367 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1369 if (hates_elec(o_ptr))
1373 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1374 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1382 if (hates_fire(o_ptr))
1385 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1386 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1388 if (hates_cold(o_ptr))
1392 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1393 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1398 /* Hack -- break potions and such */
1404 if (hates_cold(o_ptr))
1406 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1412 /* Mana and Chaos -- destroy everything */
1418 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1422 case GF_DISINTEGRATE:
1425 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1432 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1433 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1434 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1438 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1442 if (object_is_cursed(o_ptr))
1445 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1452 identify_item(o_ptr);
1454 /* Auto-inscription */
1455 autopick_alter_item((-this_o_idx), FALSE);
1463 /* Chests are noticed only if trapped or locked */
1464 if (o_ptr->tval == TV_CHEST)
1466 /* Disarm/Unlock traps */
1467 if (o_ptr->pval > 0)
1469 /* Disarm or Unlock */
1470 o_ptr->pval = (0 - o_ptr->pval);
1473 object_known(o_ptr);
1475 if (known && (o_ptr->marked & OM_FOUND))
1477 msg_print(_("カチッと音がした!", "Click!"));
1487 if (o_ptr->tval == TV_CORPSE)
1490 BIT_FLAGS mode = 0L;
1492 if (!who || is_pet(&m_list[who]))
1493 mode |= PM_FORCE_PET;
1495 for (i = 0; i < o_ptr->number ; i++)
1497 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1498 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1502 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1506 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1508 note_kill = _("生き返った。", " revived.");
1510 else if (!note_kill)
1512 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1523 /* Attempt to destroy the object */
1526 /* Effect "observed" */
1527 if (known && (o_ptr->marked & OM_FOUND))
1530 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1533 /* Artifacts, and other objects, get to resist */
1534 if (is_art || ignore)
1536 /* Observe the resist */
1537 if (known && (o_ptr->marked & OM_FOUND))
1539 msg_format(_("%sは影響を受けない!",
1540 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1547 /* Describe if needed */
1548 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1550 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1553 k_idx = o_ptr->k_idx;
1554 is_potion = object_is_potion(o_ptr);
1555 delete_object_idx(this_o_idx);
1557 /* Potions produce effects when 'shattered' */
1560 (void)potion_smash_effect(who, y, x, k_idx);
1568 /* Return "Anything seen?" */
1574 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1575 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1576 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1577 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1578 * @param x 目標X座標 / Target x location (or location to travel "towards")
1579 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1580 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1582 * @param see_s_msg TRUEならばメッセージを表示する
1583 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1586 * This routine takes a "source monster" (by index) which is mostly used to
1587 * determine if the player is causing the damage, and a "radius" (see below),
1588 * which is used to decrease the power of explosions with distance, and a
1589 * location, via integers which are modified by certain types of attacks
1590 * (polymorph and teleport being the obvious ones), a default damage, which
1591 * is modified as needed based on various properties, and finally a "damage
1592 * type" (see below).
1595 * Note that this routine can handle "no damage" attacks (like teleport) by
1596 * taking a "zero" damage, and can even take "parameters" to attacks (like
1597 * confuse) by accepting a "damage", using it to calculate the effect, and
1598 * then setting the damage to zero. Note that the "damage" parameter is
1599 * divided by the radius, so monsters not at the "epicenter" will not take
1600 * as much damage (or whatever)...
1603 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1604 * may result in a dereference of an invalid pointer.
1607 * Various messages are produced, and damage is applied.
1610 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1611 * actually be "made" of that substance, or "breathe" big balls of it.
1612 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1614 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1615 * and hurts evil less. If can breath nether, then it resists it as well.
1618 * Damage reductions use the following formulas:
1619 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1620 * gives avg damage of .655, ranging from .858 to .500
1621 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1622 * gives avg damage of .544, ranging from .714 to .417
1623 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1624 * gives avg damage of .444, ranging from .556 to .333
1625 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1626 * gives avg damage of .327, ranging from .427 to .250
1627 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1628 * gives something simple.
1631 * In this function, "result" messages are postponed until the end, where
1632 * the "note" string is appended to the monster name, if not NULL. So,
1633 * to make a spell have "no effect" just set "note" to NULL. You should
1634 * also set "notice" to FALSE, or the player will learn what the spell does.
1637 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1641 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)
1645 cave_type *c_ptr = &cave[y][x];
1647 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1648 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1650 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1654 /* Is the monster "seen"? */
1655 bool seen = m_ptr->ml;
1656 bool seen_msg = is_seen(m_ptr);
1658 bool slept = (bool)MON_CSLEEP(m_ptr);
1660 /* Were the effects "obvious" (if seen)? */
1661 bool obvious = FALSE;
1663 /* Can the player know about this effect? */
1664 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1666 /* Were the effects "irrelevant"? */
1667 bool skipped = FALSE;
1669 /* Gets the monster angry at the source of the effect? */
1670 bool get_angry = FALSE;
1672 /* Polymorph setting (true or false) */
1673 bool do_poly = FALSE;
1675 /* Teleport setting (max distance) */
1678 /* Confusion setting (amount to confuse) */
1681 /* Stunning setting (amount to stun) */
1684 /* Sleep amount (amount to sleep) */
1687 /* Fear amount (amount to fear) */
1690 /* Time amount (amount to time) */
1693 bool heal_leper = FALSE;
1695 /* Hold the monster name */
1699 PARAMETER_VALUE photo = 0;
1701 /* Assume no note */
1704 /* Assume a default death */
1705 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1710 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1713 if (!c_ptr->m_idx) return (FALSE);
1715 /* Never affect projector */
1716 if (who && (c_ptr->m_idx == who)) return (FALSE);
1717 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1718 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1720 /* Don't affect already death monsters */
1721 /* Prevents problems with chain reactions of exploding monsters */
1722 if (m_ptr->hp < 0) return (FALSE);
1724 /* Reduce damage by distance */
1725 dam = (dam + r) / (r + 1);
1728 /* Get the monster name (BEFORE polymorphing) */
1729 monster_desc(m_name, m_ptr, 0);
1731 /* Get the monster possessive ("his"/"her"/"its") */
1732 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1734 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1736 /* Analyze the damage type */
1739 /* Magic Missile -- pure damage */
1742 if (seen) obvious = TRUE;
1744 if (r_ptr->flagsr & RFR_RES_ALL)
1746 note = _("には完全な耐性がある!", " is immune.");
1748 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1757 if (seen) obvious = TRUE;
1759 if (r_ptr->flagsr & RFR_RES_ALL)
1761 note = _("には完全な耐性がある!", " is immune.");
1763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1766 if (r_ptr->flagsr & RFR_IM_ACID)
1768 note = _("にはかなり耐性がある!", " resists a lot.");
1770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1778 if (seen) obvious = TRUE;
1780 if (r_ptr->flagsr & RFR_RES_ALL)
1782 note = _("には完全な耐性がある!", " is immune.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1787 if (r_ptr->flagsr & RFR_IM_ELEC)
1789 note = _("にはかなり耐性がある!", " resists a lot.");
1791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1799 if (seen) obvious = TRUE;
1801 if (r_ptr->flagsr & RFR_RES_ALL)
1803 note = _("には完全な耐性がある!", " is immune.");
1805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1808 if (r_ptr->flagsr & RFR_IM_FIRE)
1810 note = _("にはかなり耐性がある!", " resists a lot.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1814 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1816 note = _("はひどい痛手をうけた。", " is hit hard.");
1818 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1826 if (seen) obvious = TRUE;
1828 if (r_ptr->flagsr & RFR_RES_ALL)
1830 note = _("には完全な耐性がある!", " is immune.");
1832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1835 if (r_ptr->flagsr & RFR_IM_COLD)
1837 note = _("にはかなり耐性がある!", " resists a lot.");
1839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1841 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1843 note = _("はひどい痛手をうけた。", " is hit hard.");
1845 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1853 if (seen) obvious = TRUE;
1855 if (r_ptr->flagsr & RFR_RES_ALL)
1857 note = _("には完全な耐性がある!", " is immune.");
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1862 if (r_ptr->flagsr & RFR_IM_POIS)
1864 note = _("にはかなり耐性がある!", " resists a lot.");
1866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1874 if (seen) obvious = TRUE;
1876 if (r_ptr->flagsr & RFR_RES_ALL)
1878 note = _("には完全な耐性がある!", " is immune.");
1880 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1883 if (r_ptr->flagsr & RFR_IM_POIS)
1885 note = _("には耐性がある。", " resists.");
1886 dam *= 3; dam /= randint1(6) + 6;
1887 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1889 else if (one_in_(3)) do_poly = TRUE;
1893 /* Hellfire -- hurts Evil */
1896 if (seen) obvious = TRUE;
1898 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = _("には完全な耐性がある!", " is immune.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1905 if (r_ptr->flags3 & RF3_GOOD)
1907 note = _("はひどい痛手をうけた。", " is hit hard.");
1909 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1914 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1917 if (seen) obvious = TRUE;
1919 if (r_ptr->flagsr & RFR_RES_ALL)
1921 note = _("には完全な耐性がある!", " is immune.");
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1926 if (r_ptr->flags3 & RF3_GOOD)
1928 note = _("には完全な耐性がある!", " is immune.");
1930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1932 else if (r_ptr->flags3 & RF3_EVIL)
1935 note = _("はひどい痛手をうけた。", " is hit hard.");
1936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1940 note = _("には耐性がある。", " resists.");
1941 dam *= 3; dam /= randint1(6) + 6;
1946 /* Arrow -- XXX no defense */
1949 if (seen) obvious = TRUE;
1951 if (r_ptr->flagsr & RFR_RES_ALL)
1953 note = _("には完全な耐性がある!", " is immune.");
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1961 /* Plasma -- XXX perhaps check ELEC or FIRE */
1964 if (seen) obvious = TRUE;
1966 if (r_ptr->flagsr & RFR_RES_ALL)
1968 note = _("には完全な耐性がある!", " is immune.");
1970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1973 if (r_ptr->flagsr & RFR_RES_PLAS)
1975 note = _("には耐性がある。", " resists.");
1976 dam *= 3; dam /= randint1(6) + 6;
1977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1982 /* Nether -- see above */
1985 if (seen) obvious = TRUE;
1987 if (r_ptr->flagsr & RFR_RES_ALL)
1989 note = _("には完全な耐性がある!", " is immune.");
1991 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1994 if (r_ptr->flagsr & RFR_RES_NETH)
1996 if (r_ptr->flags3 & RF3_UNDEAD)
1998 note = _("には完全な耐性がある!", " is immune.");
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2004 note = _("には耐性がある。", " resists.");
2005 dam *= 3; dam /= randint1(6) + 6;
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2009 else if (r_ptr->flags3 & RF3_EVIL)
2011 note = _("はいくらか耐性を示した。", " resists somewhat.");
2013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2018 /* Water (acid) damage -- Water spirits/elementals are immune */
2021 if (seen) obvious = TRUE;
2023 if (r_ptr->flagsr & RFR_RES_ALL)
2025 note = _("には完全な耐性がある!", " is immune.");
2027 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2030 if (r_ptr->flagsr & RFR_RES_WATE)
2032 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2034 note = _("には完全な耐性がある!", " is immune.");
2039 note = _("には耐性がある。", " resists.");
2040 dam *= 3; dam /= randint1(6) + 6;
2042 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2047 /* Chaos -- Chaos breathers resist */
2050 if (seen) obvious = TRUE;
2052 if (r_ptr->flagsr & RFR_RES_ALL)
2054 note = _("には完全な耐性がある!", " is immune.");
2056 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2059 if (r_ptr->flagsr & RFR_RES_CHAO)
2061 note = _("には耐性がある。", " resists.");
2062 dam *= 3; dam /= randint1(6) + 6;
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2065 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2067 note = _("はいくらか耐性を示した。", " resists somewhat.");
2068 dam *= 3; dam /= randint1(6) + 6;
2069 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2074 do_conf = (5 + randint1(11) + r) / (r + 1);
2079 /* Shards -- Shard breathers resist */
2082 if (seen) obvious = TRUE;
2084 if (r_ptr->flagsr & RFR_RES_ALL)
2086 note = _("には完全な耐性がある!", " is immune.");
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2091 if (r_ptr->flagsr & RFR_RES_SHAR)
2093 note = _("には耐性がある。", " resists.");
2094 dam *= 3; dam /= randint1(6) + 6;
2095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2100 /* Rocket: Shard resistance helps */
2103 if (seen) obvious = TRUE;
2105 if (r_ptr->flagsr & RFR_RES_ALL)
2107 note = _("には完全な耐性がある!", " is immune.");
2109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2112 if (r_ptr->flagsr & RFR_RES_SHAR)
2114 note = _("はいくらか耐性を示した。", " resists somewhat.");
2116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2122 /* Sound -- Sound breathers resist */
2125 if (seen) obvious = TRUE;
2127 if (r_ptr->flagsr & RFR_RES_ALL)
2129 note = _("には完全な耐性がある!", " is immune.");
2131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2134 if (r_ptr->flagsr & RFR_RES_SOUN)
2136 note = _("には耐性がある。", " resists.");
2137 dam *= 2; dam /= randint1(6) + 6;
2138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2140 else do_stun = (10 + randint1(15) + r) / (r + 1);
2147 if (seen) obvious = TRUE;
2149 if (r_ptr->flagsr & RFR_RES_ALL)
2151 note = _("には完全な耐性がある!", " is immune.");
2153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2156 if (r_ptr->flags3 & RF3_NO_CONF)
2158 note = _("には耐性がある。", " resists.");
2159 dam *= 3; dam /= randint1(6) + 6;
2160 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2162 else do_conf = (10 + randint1(15) + r) / (r + 1);
2166 /* Disenchantment -- Breathers and Disenchanters resist */
2169 if (seen) obvious = TRUE;
2171 if (r_ptr->flagsr & RFR_RES_ALL)
2173 note = _("には完全な耐性がある!", " is immune.");
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2178 if (r_ptr->flagsr & RFR_RES_DISE)
2180 note = _("には耐性がある。", " resists.");
2181 dam *= 3; dam /= randint1(6) + 6;
2182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2187 /* Nexus -- Breathers and Existers resist */
2190 if (seen) obvious = TRUE;
2192 if (r_ptr->flagsr & RFR_RES_ALL)
2194 note = _("には完全な耐性がある!", " is immune.");
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2199 if (r_ptr->flagsr & RFR_RES_NEXU)
2201 note = _("には耐性がある。", " resists.");
2202 dam *= 3; dam /= randint1(6) + 6;
2203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2211 if (seen) obvious = TRUE;
2213 if (r_ptr->flagsr & RFR_RES_ALL)
2215 note = _("には完全な耐性がある!", " is immune.");
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2220 if (r_ptr->flagsr & RFR_RES_WALL)
2222 note = _("には耐性がある。", " resists.");
2223 dam *= 3; dam /= randint1(6) + 6;
2224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2226 else do_stun = (randint1(15) + r) / (r + 1);
2230 /* Inertia -- breathers resist */
2233 if (seen) obvious = TRUE;
2235 if (r_ptr->flagsr & RFR_RES_ALL)
2237 note = _("には完全な耐性がある!", " is immune.");
2239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2242 if (r_ptr->flagsr & RFR_RES_INER)
2244 note = _("には耐性がある。", " resists.");
2245 dam *= 3; dam /= randint1(6) + 6;
2246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2250 /* Powerful monsters can resist */
2251 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2252 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2256 /* Normal monsters slow down */
2259 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2261 note = _("の動きが遅くなった。", " starts moving slower.");
2268 /* Time -- breathers resist */
2271 if (seen) obvious = TRUE;
2273 if (r_ptr->flagsr & RFR_RES_ALL)
2275 note = _("には完全な耐性がある!", " is immune.");
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2280 if (r_ptr->flagsr & RFR_RES_TIME)
2282 note = _("には耐性がある。", " resists.");
2283 dam *= 3; dam /= randint1(6) + 6;
2284 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2286 else do_time = (dam + 1) / 2;
2290 /* Gravity -- breathers resist */
2293 bool resist_tele = FALSE;
2295 if (seen) obvious = TRUE;
2297 if (r_ptr->flagsr & RFR_RES_ALL)
2299 note = _("には完全な耐性がある!", " is immune.");
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2304 if (r_ptr->flagsr & RFR_RES_TELE)
2306 if (r_ptr->flags1 & (RF1_UNIQUE))
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2309 note = _("には効果がなかった。", " is unaffected!");
2312 else if (r_ptr->level > randint1(100))
2314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2315 note = _("には耐性がある!", " resists!");
2320 if (!resist_tele) do_dist = 10;
2322 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2324 if (r_ptr->flagsr & RFR_RES_GRAV)
2326 note = _("には耐性がある!", " resists!");
2327 dam *= 3; dam /= randint1(6) + 6;
2329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2334 /* Powerful monsters can resist */
2335 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2336 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2340 /* Normal monsters slow down */
2343 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2345 note = _("の動きが遅くなった。", " starts moving slower.");
2350 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2352 /* Attempt a saving throw */
2353 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2354 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2358 /* No obvious effect */
2359 note = _("には効果がなかった。", " is unaffected!");
2371 if (seen) obvious = TRUE;
2373 if (r_ptr->flagsr & RFR_RES_ALL)
2375 note = _("には完全な耐性がある!", " is immune.");
2377 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2385 case GF_DISINTEGRATE:
2387 if (seen) obvious = TRUE;
2389 if (r_ptr->flagsr & RFR_RES_ALL)
2391 note = _("には完全な耐性がある!", " is immune.");
2393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2396 if (r_ptr->flags3 & RF3_HURT_ROCK)
2398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2399 note = _("の皮膚がただれた!", " loses some skin!");
2400 note_dies = _("は蒸発した!", " evaporates!");
2408 if (seen) obvious = TRUE;
2410 /* PSI only works if the monster can see you! -- RG */
2411 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2414 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2419 if (r_ptr->flagsr & RFR_RES_ALL)
2421 note = _("には完全な耐性がある!", " is immune.");
2423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2426 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2429 note = _("には完全な耐性がある!", " is immune.");
2430 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2433 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2434 (r_ptr->flags3 & RF3_ANIMAL) ||
2435 (r_ptr->level > randint1(3 * dam)))
2437 note = _("には耐性がある!", " resists!");
2441 * Powerful demons & undead can turn a mindcrafter's
2442 * attacks back on them
2444 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2445 (r_ptr->level > p_ptr->lev / 2) &&
2449 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2450 (seen ? "%^s's corrupted mind backlashes your attack!" :
2451 "%^ss corrupted mind backlashes your attack!")), m_name);
2454 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2456 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2460 /* Injure +/- confusion */
2461 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2462 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2463 if (one_in_(4) && !CHECK_MULTISHADOW())
2465 switch (randint1(4))
2468 set_confused(p_ptr->confused + 3 + randint1(dam));
2471 set_stun(p_ptr->stun + randint1(dam));
2475 if (r_ptr->flags3 & RF3_NO_FEAR)
2476 note = _("には効果がなかった。", " is unaffected.");
2478 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2482 if (!p_ptr->free_act)
2483 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2492 if ((dam > 0) && one_in_(4))
2494 switch (randint1(4))
2497 do_conf = 3 + randint1(dam);
2500 do_stun = 3 + randint1(dam);
2503 do_fear = 3 + randint1(dam);
2506 note = _("は眠り込んでしまった!", " falls asleep!");
2507 do_sleep = 3 + randint1(dam);
2512 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2518 if (seen) obvious = TRUE;
2520 if (r_ptr->flagsr & RFR_RES_ALL)
2522 note = _("には完全な耐性がある!", " is immune.");
2524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2527 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2530 note = _("には完全な耐性がある!", " is immune.");
2532 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2533 (r_ptr->flags3 & RF3_ANIMAL) ||
2534 (r_ptr->level > randint1(3 * dam)))
2536 note = _("には耐性がある!", " resists!");
2540 * Powerful demons & undead can turn a mindcrafter's
2541 * attacks back on them
2543 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2544 (r_ptr->level > p_ptr->lev / 2) &&
2548 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2549 (seen ? "%^s's corrupted mind backlashes your attack!" :
2550 "%^ss corrupted mind backlashes your attack!")), m_name);
2552 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2554 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2558 /* Injure + mana drain */
2559 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2560 if (!CHECK_MULTISHADOW())
2562 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2563 p_ptr->csp -= damroll(5, dam) / 2;
2564 if (p_ptr->csp < 0) p_ptr->csp = 0;
2565 p_ptr->redraw |= PR_MANA;
2566 p_ptr->window |= (PW_SPELL);
2568 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2575 int b = damroll(5, dam) / 4;
2576 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2577 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2578 (seen ? "You convert %s's pain into %s!" :
2579 "You convert %ss pain into %s!"));
2580 msg_format(msg, m_name, str);
2582 b = MIN(p_ptr->msp, p_ptr->csp + b);
2584 p_ptr->redraw |= PR_MANA;
2585 p_ptr->window |= (PW_SPELL);
2587 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2591 case GF_TELEKINESIS:
2593 if (seen) obvious = TRUE;
2595 if (r_ptr->flagsr & RFR_RES_ALL)
2597 note = _("には完全な耐性がある!", " is immune.");
2599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2604 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2609 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2611 /* Attempt a saving throw */
2612 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2613 (r_ptr->level > 5 + randint1(dam)))
2617 /* No obvious effect */
2623 /* Psycho-spear -- powerful magic missile */
2626 if (seen) obvious = TRUE;
2628 if (r_ptr->flagsr & RFR_RES_ALL)
2630 note = _("には完全な耐性がある!", " is immune.");
2632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2638 /* Meteor -- powerful magic missile */
2641 if (seen) obvious = TRUE;
2643 if (r_ptr->flagsr & RFR_RES_ALL)
2645 note = _("には完全な耐性がある!", " is immune.");
2647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2655 if (!is_hostile(m_ptr)) break;
2657 if (seen) obvious = TRUE;
2659 if (r_ptr->flagsr & RFR_RES_ALL)
2661 note = _("には効果がなかった!", " is immune.");
2663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2666 /* Attempt a saving throw */
2667 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2668 (r_ptr->flags3 & RF3_NO_CONF) ||
2669 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2671 /* Memorize a flag */
2672 if (r_ptr->flags3 & RF3_NO_CONF)
2674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2681 * Powerful demons & undead can turn a mindcrafter's
2682 * attacks back on them
2684 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2685 (r_ptr->level > p_ptr->lev / 2) &&
2689 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2690 (seen ? "%^s's corrupted mind backlashes your attack!" :
2691 "%^ss corrupted mind backlashes your attack!")), m_name);
2694 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2696 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2700 /* Confuse, stun, terrify */
2701 switch (randint1(4))
2704 set_stun(p_ptr->stun + dam / 2);
2707 set_confused(p_ptr->confused + dam / 2);
2711 if (r_ptr->flags3 & RF3_NO_FEAR)
2712 note = _("には効果がなかった。", " is unaffected.");
2714 set_afraid(p_ptr->afraid + dam);
2721 /* No obvious effect */
2722 note = _("には効果がなかった。", " is unaffected.");
2728 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2730 note = _("があなたに隷属した。", " is in your thrall!");
2735 switch (randint1(4))
2749 /* No "real" damage */
2756 /* Ice -- Cold + Cuts + Stun */
2759 if (seen) obvious = TRUE;
2761 if (r_ptr->flagsr & RFR_RES_ALL)
2763 note = _("には完全な耐性がある!", " is immune.");
2765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2768 do_stun = (randint1(15) + 1) / (r + 1);
2769 if (r_ptr->flagsr & RFR_IM_COLD)
2771 note = _("にはかなり耐性がある!", " resists a lot.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2775 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2777 note = _("はひどい痛手をうけた。", " is hit hard.");
2779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2786 case GF_HYPODYNAMIA:
2788 if (seen) obvious = TRUE;
2790 if (r_ptr->flagsr & RFR_RES_ALL)
2792 note = _("には完全な耐性がある!", " is immune.");
2794 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2797 if (!monster_living(r_ptr))
2799 if (is_original_ap_and_seen(m_ptr))
2801 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2802 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2803 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2805 note = _("には効果がなかった。", " is unaffected.");
2809 else do_time = (dam+7)/8;
2817 if (seen) obvious = TRUE;
2819 if (r_ptr->flagsr & RFR_RES_ALL)
2821 note = _("には完全な耐性がある!", " is immune.");
2823 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2826 if (!monster_living(r_ptr))
2828 if (is_original_ap_and_seen(m_ptr))
2830 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2831 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2832 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2834 note = _("には完全な耐性がある!", " is immune.");
2838 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2839 (randint1(888) != 666)) ||
2840 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2841 randint1(100) != 66))
2843 note = _("には耐性がある!", " resists!");
2851 /* Polymorph monster (Use "dam" as "power") */
2854 if (seen) obvious = TRUE;
2856 if (r_ptr->flagsr & RFR_RES_ALL)
2858 note = _("には効果がなかった。", " is unaffected.");
2860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2863 /* Attempt to polymorph (see below) */
2866 /* Powerful monsters can resist */
2867 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2868 (r_ptr->flags1 & RF1_QUESTOR) ||
2869 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2871 note = _("には効果がなかった。", " is unaffected.");
2876 /* No "real" damage */
2883 /* Clone monsters (Ignore "dam") */
2886 if (seen) obvious = TRUE;
2888 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2890 note = _("には効果がなかった。", " is unaffected.");
2895 m_ptr->hp = m_ptr->maxhp;
2897 /* Attempt to clone. */
2898 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2900 note = _("が分裂した!", " spawns!");
2904 /* No "real" damage */
2911 /* Heal Monster (use "dam" as amount of healing) */
2914 if (seen) obvious = TRUE;
2917 (void)set_monster_csleep(c_ptr->m_idx, 0);
2919 if (m_ptr->maxhp < m_ptr->max_maxhp)
2921 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2922 m_ptr->maxhp = m_ptr->max_maxhp;
2927 /* Redraw (later) if needed */
2928 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2929 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2937 if (seen) obvious = TRUE;
2940 (void)set_monster_csleep(c_ptr->m_idx, 0);
2941 if (MON_STUNNED(m_ptr))
2943 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2944 (void)set_monster_stunned(c_ptr->m_idx, 0);
2946 if (MON_CONFUSED(m_ptr))
2948 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2949 (void)set_monster_confused(c_ptr->m_idx, 0);
2951 if (MON_MONFEAR(m_ptr))
2953 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2954 (void)set_monster_monfear(c_ptr->m_idx, 0);
2958 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2961 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2965 chg_virtue(V_VITALITY, 1);
2967 if (r_ptr->flags1 & RF1_UNIQUE)
2968 chg_virtue(V_INDIVIDUALISM, 1);
2970 if (is_friendly(m_ptr))
2971 chg_virtue(V_HONOUR, 1);
2972 else if (!(r_ptr->flags3 & RF3_EVIL))
2974 if (r_ptr->flags3 & RF3_GOOD)
2975 chg_virtue(V_COMPASSION, 2);
2977 chg_virtue(V_COMPASSION, 1);
2980 if (r_ptr->flags3 & RF3_ANIMAL)
2981 chg_virtue(V_NATURE, 1);
2984 if (m_ptr->r_idx == MON_LEPER)
2987 if (!who) chg_virtue(V_COMPASSION, 5);
2990 /* Redraw (later) if needed */
2991 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2992 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2994 note = _("は体力を回復したようだ。", " looks healthier.");
2996 /* No "real" damage */
3002 /* Speed Monster (Ignore "dam") */
3005 if (seen) obvious = TRUE;
3008 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3010 note = _("の動きが速くなった。", " starts moving faster.");
3015 if (r_ptr->flags1 & RF1_UNIQUE)
3016 chg_virtue(V_INDIVIDUALISM, 1);
3017 if (is_friendly(m_ptr))
3018 chg_virtue(V_HONOUR, 1);
3021 /* No "real" damage */
3027 /* Slow Monster (Use "dam" as "power") */
3030 if (seen) obvious = TRUE;
3032 if (r_ptr->flagsr & RFR_RES_ALL)
3034 note = _("には効果がなかった。", " is unaffected.");
3036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3039 /* Powerful monsters can resist */
3040 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3041 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3043 note = _("には効果がなかった。", " is unaffected.");
3047 /* Normal monsters slow down */
3050 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3052 note = _("の動きが遅くなった。", " starts moving slower.");
3056 /* No "real" damage */
3062 /* Sleep (Use "dam" as "power") */
3065 if (seen) obvious = TRUE;
3067 if (r_ptr->flagsr & RFR_RES_ALL)
3069 note = _("には効果がなかった。", " is unaffected.");
3071 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3074 /* Attempt a saving throw */
3075 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3076 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3077 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3079 /* Memorize a flag */
3080 if (r_ptr->flags3 & RF3_NO_SLEEP)
3082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3084 /* No obvious effect */
3085 note = _("には効果がなかった。", " is unaffected.");
3090 /* Go to sleep (much) later */
3091 note = _("は眠り込んでしまった!", " falls asleep!");
3095 /* No "real" damage */
3101 /* Sleep (Use "dam" as "power") */
3102 case GF_STASIS_EVIL:
3104 if (seen) obvious = TRUE;
3106 if (r_ptr->flagsr & RFR_RES_ALL)
3108 note = _("には効果がなかった!", " is immune.");
3110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3113 /* Attempt a saving throw */
3114 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3115 !(r_ptr->flags3 & RF3_EVIL) ||
3116 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3118 note = _("には効果がなかった。", " is unaffected.");
3123 /* Go to sleep (much) later */
3124 note = _("は動けなくなった!", " is suspended!");
3128 /* No "real" damage */
3133 /* Sleep (Use "dam" as "power") */
3136 if (seen) obvious = TRUE;
3138 if (r_ptr->flagsr & RFR_RES_ALL)
3140 note = _("には効果がなかった。", " is unaffected.");
3142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3145 /* Attempt a saving throw */
3146 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3147 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3149 note = _("には効果がなかった。", " is unaffected.");
3154 /* Go to sleep (much) later */
3155 note = _("は動けなくなった!", " is suspended!");
3159 /* No "real" damage */
3168 vir = virtue_number(V_HARMONY);
3171 dam += p_ptr->virtues[vir-1]/10;
3174 vir = virtue_number(V_INDIVIDUALISM);
3177 dam -= p_ptr->virtues[vir-1]/20;
3180 if (seen) obvious = TRUE;
3182 /* Attempt a saving throw */
3183 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3187 /* No obvious effect */
3188 note = _("には効果がなかった。", " is unaffected.");
3191 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3193 else if (p_ptr->cursed & TRC_AGGRAVATE)
3195 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3196 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3200 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3203 chg_virtue(V_INDIVIDUALISM, -1);
3204 if (r_ptr->flags3 & RF3_ANIMAL)
3205 chg_virtue(V_NATURE, 1);
3208 /* No "real" damage */
3213 /* Control undead */
3214 case GF_CONTROL_UNDEAD:
3217 if (seen) obvious = TRUE;
3219 vir = virtue_number(V_UNLIFE);
3222 dam += p_ptr->virtues[vir-1]/10;
3225 vir = virtue_number(V_INDIVIDUALISM);
3228 dam -= p_ptr->virtues[vir-1]/20;
3231 /* Attempt a saving throw */
3232 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3233 !(r_ptr->flags3 & RF3_UNDEAD))
3235 /* No obvious effect */
3236 note = _("には効果がなかった。", " is unaffected.");
3238 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3240 else if (p_ptr->cursed & TRC_AGGRAVATE)
3242 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3243 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3247 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3251 /* No "real" damage */
3257 case GF_CONTROL_DEMON:
3260 if (seen) obvious = TRUE;
3262 vir = virtue_number(V_UNLIFE);
3265 dam += p_ptr->virtues[vir-1]/10;
3268 vir = virtue_number(V_INDIVIDUALISM);
3271 dam -= p_ptr->virtues[vir-1]/20;
3274 /* Attempt a saving throw */
3275 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3276 !(r_ptr->flags3 & RF3_DEMON))
3278 /* No obvious effect */
3279 note = _("には効果がなかった。", " is unaffected.");
3281 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3283 else if (p_ptr->cursed & TRC_AGGRAVATE)
3285 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3286 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3290 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3294 /* No "real" damage */
3300 case GF_CONTROL_ANIMAL:
3303 if (seen) obvious = TRUE;
3305 vir = virtue_number(V_NATURE);
3308 dam += p_ptr->virtues[vir-1]/10;
3311 vir = virtue_number(V_INDIVIDUALISM);
3314 dam -= p_ptr->virtues[vir-1]/20;
3317 /* Attempt a saving throw */
3318 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3319 !(r_ptr->flags3 & RF3_ANIMAL))
3322 /* No obvious effect */
3323 note = _("には効果がなかった。", " is unaffected.");
3325 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3327 else if (p_ptr->cursed & TRC_AGGRAVATE)
3329 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3330 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3334 note = _("はなついた。", " is tamed!");
3336 if (r_ptr->flags3 & RF3_ANIMAL)
3337 chg_virtue(V_NATURE, 1);
3340 /* No "real" damage */
3346 case GF_CHARM_LIVING:
3350 vir = virtue_number(V_UNLIFE);
3351 if (seen) obvious = TRUE;
3353 vir = virtue_number(V_UNLIFE);
3356 dam -= p_ptr->virtues[vir-1]/10;
3359 vir = virtue_number(V_INDIVIDUALISM);
3362 dam -= p_ptr->virtues[vir-1]/20;
3365 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3367 /* Attempt a saving throw */
3368 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3369 !monster_living(r_ptr))
3372 /* No obvious effect */
3373 note = _("には効果がなかった。", " is unaffected.");
3375 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3377 else if (p_ptr->cursed & TRC_AGGRAVATE)
3379 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3380 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3384 note = _("を支配した。", " is tamed!");
3386 if (r_ptr->flags3 & RF3_ANIMAL)
3387 chg_virtue(V_NATURE, 1);
3390 /* No "real" damage */
3395 /* Confusion (Use "dam" as "power") */
3398 if (seen) obvious = TRUE;
3400 if (r_ptr->flagsr & RFR_RES_ALL)
3402 note = _("には効果がなかった。", " is unaffected.");
3404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3407 /* Get confused later */
3408 do_conf = damroll(3, (dam / 2)) + 1;
3410 /* Attempt a saving throw */
3411 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3412 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3413 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3415 /* Memorize a flag */
3416 if (r_ptr->flags3 & (RF3_NO_CONF))
3418 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3424 /* No obvious effect */
3425 note = _("には効果がなかった。", " is unaffected.");
3429 /* No "real" damage */
3436 if (seen) obvious = TRUE;
3438 if (r_ptr->flagsr & RFR_RES_ALL)
3440 note = _("には効果がなかった。", " is unaffected.");
3442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3445 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3447 /* Attempt a saving throw */
3448 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3449 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3454 /* No obvious effect */
3455 note = _("には効果がなかった。", " is unaffected.");
3459 /* No "real" damage */
3467 /* Lite, but only hurts susceptible creatures */
3475 if (r_ptr->flagsr & RFR_RES_ALL)
3481 if (r_ptr->flags3 & (RF3_HURT_LITE))
3483 /* Obvious effect */
3484 if (seen) obvious = TRUE;
3486 /* Memorize the effects */
3487 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3489 /* Special effect */
3490 note = _("は光に身をすくめた!", " cringes from the light!");
3491 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3494 /* Normally no damage */
3506 /* Lite -- opposite of Dark */
3509 if (seen) obvious = TRUE;
3511 if (r_ptr->flagsr & RFR_RES_ALL)
3513 note = _("には完全な耐性がある!", " is immune.");
3515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3518 if (r_ptr->flagsr & RFR_RES_LITE)
3520 note = _("には耐性がある!", " resists!");
3521 dam *= 2; dam /= (randint1(6)+6);
3522 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3524 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3527 note = _("は光に身をすくめた!", " cringes from the light!");
3528 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3535 /* Dark -- opposite of Lite */
3538 if (seen) obvious = TRUE;
3540 if (r_ptr->flagsr & RFR_RES_ALL)
3542 note = _("には完全な耐性がある!", " is immune.");
3544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3547 if (r_ptr->flagsr & RFR_RES_DARK)
3549 note = _("には耐性がある!", " resists!");
3550 dam *= 2; dam /= (randint1(6)+6);
3551 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3560 if (r_ptr->flagsr & RFR_RES_ALL)
3565 /* Hurt by rock remover */
3566 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3569 if (seen) obvious = TRUE;
3571 /* Memorize the effects */
3572 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3574 /* Cute little message */
3575 note = _("の皮膚がただれた!", " loses some skin!");
3576 note_dies = _("はドロドロに溶けた!", " dissolves!");
3579 /* Usually, ignore the effects */
3590 /* Teleport undead (Use "dam" as "power") */
3591 case GF_AWAY_UNDEAD:
3593 /* Only affect undead */
3594 if (r_ptr->flags3 & (RF3_UNDEAD))
3596 bool resists_tele = FALSE;
3598 if (r_ptr->flagsr & RFR_RES_TELE)
3600 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3603 note = _("には効果がなかった。", " is unaffected.");
3604 resists_tele = TRUE;
3606 else if (r_ptr->level > randint1(100))
3608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3609 note = _("には耐性がある!", " resists!");
3610 resists_tele = TRUE;
3616 if (seen) obvious = TRUE;
3617 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3629 /* No "real" damage */
3635 /* Teleport evil (Use "dam" as "power") */
3638 /* Only affect evil */
3639 if (r_ptr->flags3 & (RF3_EVIL))
3641 bool resists_tele = FALSE;
3643 if (r_ptr->flagsr & RFR_RES_TELE)
3645 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3648 note = _("には効果がなかった。", " is unaffected.");
3649 resists_tele = TRUE;
3651 else if (r_ptr->level > randint1(100))
3653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3654 note = _("には耐性がある!", " resists!");
3655 resists_tele = TRUE;
3661 if (seen) obvious = TRUE;
3662 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3674 /* No "real" damage */
3680 /* Teleport monster (Use "dam" as "power") */
3683 bool resists_tele = FALSE;
3684 if (r_ptr->flagsr & RFR_RES_TELE)
3686 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3689 note = _("には効果がなかった。", " is unaffected.");
3690 resists_tele = TRUE;
3692 else if (r_ptr->level > randint1(100))
3694 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3695 note = _("には耐性がある!", " resists!");
3696 resists_tele = TRUE;
3702 if (seen) obvious = TRUE;
3704 /* Prepare to teleport */
3708 /* No "real" damage */
3714 /* Turn undead (Use "dam" as "power") */
3715 case GF_TURN_UNDEAD:
3717 if (r_ptr->flagsr & RFR_RES_ALL)
3722 /* Only affect undead */
3723 if (r_ptr->flags3 & (RF3_UNDEAD))
3725 if (seen) obvious = TRUE;
3727 /* Learn about type */
3728 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3730 /* Apply some fear */
3731 do_fear = damroll(3, (dam / 2)) + 1;
3733 /* Attempt a saving throw */
3734 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3736 /* No obvious effect */
3737 note = _("には効果がなかった。", " is unaffected.");
3750 /* No "real" damage */
3756 /* Turn evil (Use "dam" as "power") */
3759 if (r_ptr->flagsr & RFR_RES_ALL)
3764 /* Only affect evil */
3765 if (r_ptr->flags3 & (RF3_EVIL))
3767 if (seen) obvious = TRUE;
3769 /* Learn about type */
3770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3772 /* Apply some fear */
3773 do_fear = damroll(3, (dam / 2)) + 1;
3775 /* Attempt a saving throw */
3776 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3778 /* No obvious effect */
3779 note = _("には効果がなかった。", " is unaffected.");
3792 /* No "real" damage */
3798 /* Turn monster (Use "dam" as "power") */
3801 if (r_ptr->flagsr & RFR_RES_ALL)
3806 if (seen) obvious = TRUE;
3808 /* Apply some fear */
3809 do_fear = damroll(3, (dam / 2)) + 1;
3811 /* Attempt a saving throw */
3812 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3813 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3814 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3816 /* No obvious effect */
3817 note = _("には効果がなかった。", " is unaffected.");
3822 /* No "real" damage */
3829 case GF_DISP_UNDEAD:
3831 if (r_ptr->flagsr & RFR_RES_ALL)
3837 /* Only affect undead */
3838 if (r_ptr->flags3 & (RF3_UNDEAD))
3840 if (seen) obvious = TRUE;
3842 /* Learn about type */
3843 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3845 note = _("は身震いした。", " shudders.");
3846 note_dies = _("はドロドロに溶けた!", " dissolves!");
3866 if (r_ptr->flagsr & RFR_RES_ALL)
3872 /* Only affect evil */
3873 if (r_ptr->flags3 & (RF3_EVIL))
3875 if (seen) obvious = TRUE;
3877 /* Learn about type */
3878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3880 note = _("は身震いした。", " shudders.");
3881 note_dies = _("はドロドロに溶けた!", " dissolves!");
3900 if (r_ptr->flagsr & RFR_RES_ALL)
3906 /* Only affect good */
3907 if (r_ptr->flags3 & (RF3_GOOD))
3909 if (seen) obvious = TRUE;
3911 /* Learn about type */
3912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3914 note = _("は身震いした。", " shudders.");
3915 note_dies = _("はドロドロに溶けた!", " dissolves!");
3932 case GF_DISP_LIVING:
3934 if (r_ptr->flagsr & RFR_RES_ALL)
3940 /* Only affect non-undead */
3941 if (monster_living(r_ptr))
3943 if (seen) obvious = TRUE;
3945 note = _("は身震いした。", " shudders.");
3946 note_dies = _("はドロドロに溶けた!", " dissolves!");
3965 if (r_ptr->flagsr & RFR_RES_ALL)
3971 /* Only affect demons */
3972 if (r_ptr->flags3 & (RF3_DEMON))
3974 if (seen) obvious = TRUE;
3976 /* Learn about type */
3977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3979 note = _("は身震いした。", " shudders.");
3980 note_dies = _("はドロドロに溶けた!", " dissolves!");
3996 /* Dispel monster */
3999 if (r_ptr->flagsr & RFR_RES_ALL)
4005 if (seen) obvious = TRUE;
4007 note = _("は身震いした。", " shudders.");
4008 note_dies = _("はドロドロに溶けた!", " dissolves!");
4015 if (seen) obvious = TRUE;
4017 if (r_ptr->flagsr & RFR_RES_ALL)
4019 note = _("には完全な耐性がある!", " is immune.");
4021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4025 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4029 /* Heal the monster */
4030 if (caster_ptr->hp < caster_ptr->maxhp)
4033 caster_ptr->hp += dam;
4034 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4036 /* Redraw (later) if needed */
4037 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4038 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4040 /* Special message */
4043 /* Get the monster name */
4044 monster_desc(killer, caster_ptr, 0);
4045 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4051 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4052 (void)hp_player(dam);
4057 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4066 if (seen) obvious = TRUE;
4067 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4069 if (r_ptr->flagsr & RFR_RES_ALL)
4071 note = _("には完全な耐性がある!", " is immune.");
4073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4077 /* Attempt a saving throw */
4078 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4079 (r_ptr->flags3 & RF3_NO_CONF) ||
4080 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4082 /* Memorize a flag */
4083 if (r_ptr->flags3 & (RF3_NO_CONF))
4085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4087 note = _("には効果がなかった。", " is unaffected.");
4090 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4092 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4093 note = _("には完全な耐性がある!", " is immune.");
4096 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4098 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4099 note = _("には耐性がある。", " resists.");
4104 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4105 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4107 if (who > 0) do_conf = randint0(4) + 4;
4108 else do_conf = randint0(8) + 8;
4114 case GF_BRAIN_SMASH:
4116 if (seen) obvious = TRUE;
4117 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4119 if (r_ptr->flagsr & RFR_RES_ALL)
4121 note = _("には完全な耐性がある!", " is immune.");
4123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4127 /* Attempt a saving throw */
4128 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4129 (r_ptr->flags3 & RF3_NO_CONF) ||
4130 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4132 /* Memorize a flag */
4133 if (r_ptr->flags3 & (RF3_NO_CONF))
4135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4137 note = _("には効果がなかった。", " is unaffected.");
4140 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4143 note = _("には完全な耐性がある!", " is immune.");
4146 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4148 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4149 note = _("には耐性がある!", " resists!");
4154 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4155 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4159 do_conf = randint0(4) + 4;
4160 do_stun = randint0(4) + 4;
4164 do_conf = randint0(8) + 8;
4165 do_stun = randint0(8) + 8;
4167 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4175 if (seen) obvious = TRUE;
4176 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4178 if (r_ptr->flagsr & RFR_RES_ALL)
4180 note = _("には完全な耐性がある!", " is immune.");
4182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4186 /* Attempt a saving throw */
4187 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4189 note = _("には効果がなかった。", " is unaffected.");
4198 if (seen) obvious = TRUE;
4199 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4201 if (r_ptr->flagsr & RFR_RES_ALL)
4203 note = _("には完全な耐性がある!", " is immune.");
4205 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4209 /* Attempt a saving throw */
4210 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4212 note = _("には効果がなかった。", " is unaffected.");
4221 if (seen) obvious = TRUE;
4222 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4224 if (r_ptr->flagsr & RFR_RES_ALL)
4226 note = _("には完全な耐性がある!", " is immune.");
4228 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4232 /* Attempt a saving throw */
4233 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4235 note = _("には効果がなかった。", " is unaffected.");
4244 if (seen) obvious = TRUE;
4246 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4247 "You point at %s, screaming the word, 'DIE!'."), m_name);
4249 if (r_ptr->flagsr & RFR_RES_ALL)
4251 note = _("には完全な耐性がある!", " is immune.");
4253 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4257 /* Attempt a saving throw */
4258 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4260 note = _("には効果がなかった。", " is unaffected.");
4269 if (seen) obvious = TRUE;
4271 if (r_ptr->flagsr & RFR_RES_ALL)
4273 note = _("には完全な耐性がある!", " is immune.");
4275 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4279 if (r_ptr->flags1 & RF1_UNIQUE)
4281 note = _("には効果がなかった。", " is unaffected.");
4286 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4287 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4289 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4291 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4295 note = _("は耐性を持っている!", "resists!");
4302 /* Capture monster */
4306 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4307 (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)
4309 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4314 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4315 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4316 nokori_hp = m_ptr->maxhp * 3 / 10;
4318 nokori_hp = m_ptr->maxhp * 3 / 20;
4320 if (m_ptr->hp >= nokori_hp)
4322 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4325 else if (m_ptr->hp < randint0(nokori_hp))
4327 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4328 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4329 cap_mon = m_ptr->r_idx;
4330 cap_mspeed = m_ptr->mspeed;
4332 cap_maxhp = m_ptr->max_maxhp;
4333 cap_nickname = m_ptr->nickname; /* Quark transfer */
4334 if (c_ptr->m_idx == p_ptr->riding)
4336 if (rakuba(-1, FALSE))
4338 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4342 delete_monster_idx(c_ptr->m_idx);
4348 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4354 /* Attack (Use "dam" as attack type) */
4357 /* Return this monster's death */
4358 return py_attack(y, x, dam);
4361 /* Sleep (Use "dam" as "power") */
4367 if (seen) obvious = TRUE;
4369 if (r_ptr->flagsr & RFR_RES_ALL)
4371 note = _("には効果がなかった。", " is unaffected.");
4373 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4376 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4378 note = _("には効果がなかった。", " is unaffected.");
4381 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4384 if (MON_CSLEEP(m_ptr))
4386 note = _("には効果がなかった。", " is unaffected.");
4392 if (one_in_(5)) effect = 1;
4393 else if (one_in_(4)) effect = 2;
4394 else if (one_in_(3)) effect = 3;
4399 /* Powerful monsters can resist */
4400 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4401 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4403 note = _("には効果がなかった。", " is unaffected.");
4407 /* Normal monsters slow down */
4410 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4412 note = _("の動きが遅くなった。", " starts moving slower.");
4417 else if (effect == 2)
4419 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4421 /* Attempt a saving throw */
4422 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4423 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4428 /* No obvious effect */
4429 note = _("には効果がなかった。", " is unaffected.");
4434 else if (effect == 3)
4436 /* Attempt a saving throw */
4437 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4438 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4439 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4441 /* Memorize a flag */
4442 if (r_ptr->flags3 & RF3_NO_SLEEP)
4444 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4447 /* No obvious effect */
4448 note = _("には効果がなかった。", " is unaffected.");
4453 /* Go to sleep (much) later */
4454 note = _("は眠り込んでしまった!", " falls asleep!");
4461 note = _("には効果がなかった。", " is unaffected.");
4464 /* No "real" damage */
4472 if (seen) obvious = TRUE;
4474 if (r_ptr->flagsr & RFR_RES_ALL)
4476 note = _("には効果がなかった。", " is unaffected.");
4478 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4482 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4484 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4485 chg_virtue(V_VITALITY, -1);
4495 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4497 if (r_ptr->flags3 & (RF3_HURT_LITE))
4499 /* Obvious effect */
4500 if (seen) obvious = TRUE;
4502 /* Memorize the effects */
4503 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4505 /* Special effect */
4506 note = _("は光に身をすくめた!", " cringes from the light!");
4507 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4510 /* Normally no damage */
4517 photo = m_ptr->r_idx;
4524 case GF_BLOOD_CURSE:
4526 if (seen) obvious = TRUE;
4528 if (r_ptr->flagsr & RFR_RES_ALL)
4530 note = _("には完全な耐性がある!", " is immune.");
4532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4540 bool success = FALSE;
4541 if (seen) obvious = TRUE;
4543 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4545 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4546 if (dam < 1) dam = 1;
4548 /* No need to tame your pet */
4551 note = _("の動きが速くなった。", " starts moving faster.");
4552 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4556 /* Attempt a saving throw */
4557 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4558 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4559 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4560 (p_ptr->cursed & TRC_AGGRAVATE) ||
4561 ((r_ptr->level+10) > randint1(dam)))
4564 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4568 note = _("を支配した。", " is tamed!");
4570 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4572 /* Learn about type */
4573 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4580 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4582 do_fear = randint1(90)+10;
4584 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4587 /* No "real" damage */
4594 if (seen) obvious = TRUE;
4596 if (r_ptr->flagsr & RFR_RES_ALL)
4598 note = _("には完全な耐性がある!", " is immune.");
4600 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4604 /* Attempt a saving throw */
4605 if (randint0(100 + dam) < (r_ptr->level + 50))
4607 note = _("には効果がなかった。", " is unaffected.");
4627 /* Absolutely no effect */
4628 if (skipped) return (FALSE);
4630 /* "Unique" monsters cannot be polymorphed */
4631 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4633 /* Quest monsters cannot be polymorphed */
4634 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4636 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4638 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4639 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4641 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4646 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4647 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4650 /* Modify the damage */
4652 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4653 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4655 /* Check for death */
4656 if (dam > m_ptr->hp)
4658 /* Extract method of death */
4663 /* Sound and Impact resisters never stun */
4665 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4666 !(r_ptr->flags3 & RF3_NO_STUN))
4668 if (seen) obvious = TRUE;
4671 if (MON_STUNNED(m_ptr))
4673 note = _("はひどくもうろうとした。", " is more dazed.");
4674 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4678 note = _("はもうろうとした。", " is dazed.");
4683 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4689 /* Confusion and Chaos resisters (and sleepers) never confuse */
4691 !(r_ptr->flags3 & RF3_NO_CONF) &&
4692 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4694 if (seen) obvious = TRUE;
4696 /* Already partially confused */
4697 if (MON_CONFUSED(m_ptr))
4699 note = _("はさらに混乱したようだ。", " looks more confused.");
4700 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4703 /* Was not confused */
4706 note = _("は混乱したようだ。", " looks confused.");
4710 /* Apply confusion */
4711 (void)set_monster_confused(c_ptr->m_idx, tmp);
4719 if (seen) obvious = TRUE;
4721 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4725 note = _("は弱くなったようだ。", " seems weakened.");
4726 m_ptr->maxhp -= do_time;
4727 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4732 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4733 if (do_poly && (randint1(90) > r_ptr->level))
4735 if (polymorph_monster(y, x))
4737 if (seen) obvious = TRUE;
4739 /* Monster polymorphs */
4740 note = _("が変身した!", " changes!");
4742 /* Turn off the damage */
4748 note = _("には効果がなかった。", " is unaffected.");
4751 /* Hack -- Get new monster */
4752 m_ptr = &m_list[c_ptr->m_idx];
4754 /* Hack -- Get new race */
4755 r_ptr = &r_info[m_ptr->r_idx];
4758 /* Handle "teleport" */
4761 if (seen) obvious = TRUE;
4763 note = _("が消え去った!", " disappears!");
4765 if (!who) chg_virtue(V_VALOUR, -1);
4768 teleport_away(c_ptr->m_idx, do_dist,
4769 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4771 /* Hack -- get new location */
4775 /* Hack -- get new grid */
4776 c_ptr = &cave[y][x];
4783 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4790 if (typ == GF_DRAIN_MANA)
4792 /* Drain mana does nothing */
4795 /* If another monster did the damage, hurt the monster by hand */
4798 /* Redraw (later) if needed */
4799 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4800 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4802 /* Wake the monster up */
4803 (void)set_monster_csleep(c_ptr->m_idx, 0);
4805 /* Hurt the monster */
4813 if (is_pet(m_ptr) && !(m_ptr->ml))
4816 /* Give detailed messages if destroyed */
4819 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4822 msg_format("%^s%s", m_name, note);
4830 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4832 /* Generate treasure, etc */
4833 monster_death(c_ptr->m_idx, FALSE);
4836 delete_monster_idx(c_ptr->m_idx);
4840 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4844 /* Damaged monster */
4847 /* Give detailed messages if visible or destroyed */
4848 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4850 /* Hack -- Pain message */
4853 message_pain(c_ptr->m_idx, dam);
4860 /* Hack -- handle sleep */
4861 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4865 else if (heal_leper)
4867 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4869 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4873 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4874 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4877 delete_monster_idx(c_ptr->m_idx);
4880 /* If the player did it, give him experience, check fear */
4885 /* Hurt the monster, check for fear and death */
4886 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4891 /* Damaged monster */
4894 /* HACK - anger the monster before showing the sleep message */
4895 if (do_sleep) anger_monster(m_ptr);
4897 /* Give detailed messages if visible or destroyed */
4898 if (note && seen_msg)
4899 msg_format(_("%s%s", "%^s%s"), m_name, note);
4901 /* Hack -- Pain message */
4902 else if (known && (dam || !do_fear))
4904 message_pain(c_ptr->m_idx, dam);
4907 /* Anger monsters */
4908 if (((dam > 0) || get_angry) && !do_sleep)
4909 anger_monster(m_ptr);
4912 if ((fear || do_fear) && seen)
4916 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4919 /* Hack -- handle sleep */
4920 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4924 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4926 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4930 switch (randint1(28))
4935 msg_print(_("地面が揺れた...", "The ground trembles..."));
4936 earthquake(ty, tx, 4 + randint0(4));
4937 if (!one_in_(6)) break;
4939 case 3: case 4: case 5: case 6:
4942 int extra_dam = damroll(10, 10);
4943 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4945 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4946 if (!one_in_(6)) break;
4951 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4953 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4954 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4955 if (!one_in_(6)) break;
4957 case 9: case 10: case 11:
4958 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4959 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4960 if (!one_in_(6)) break;
4961 case 12: case 13: case 14: case 15: case 16:
4962 aggravate_monsters(0);
4963 if (!one_in_(6)) break;
4965 count += activate_hi_summon(ty, tx, TRUE);
4966 if (!one_in_(6)) break;
4967 case 19: case 20: case 21: case 22:
4969 bool pet = !one_in_(3);
4970 BIT_FLAGS mode = PM_ALLOW_GROUP;
4972 if (pet) mode |= PM_FORCE_PET;
4973 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4975 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);
4976 if (!one_in_(6)) break;
4978 case 23: case 24: case 25:
4979 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4980 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4982 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4983 else lose_exp(p_ptr->exp / 16);
4984 if (!one_in_(6)) break;
4985 case 26: case 27: case 28:
4994 (void)do_dec_stat(i);
5003 (void)do_dec_stat(randint0(6));
5012 if (p_ptr->inside_battle)
5014 p_ptr->health_who = c_ptr->m_idx;
5015 p_ptr->redraw |= (PR_HEALTH);
5019 /* Verify this code */
5020 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5022 /* Redraw the monster grid */
5026 /* Update monster recall window */
5027 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5029 p_ptr->window |= (PW_MONSTER);
5032 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5036 if (!(flg & PROJECT_NO_HANGEKI))
5038 set_target(m_ptr, monster_target_y, monster_target_x);
5041 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5043 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5047 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5049 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5050 rakubadam_m = (dam > 200) ? 200 : dam;
5060 /* Prepare to make a Blade of Chaos */
5061 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5063 q_ptr->pval = photo;
5065 /* Mark the item as fully known */
5066 q_ptr->ident |= (IDENT_MENTAL);
5068 /* Drop it in the dungeon */
5069 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5077 /* Return "Anything seen?" */
5082 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5083 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5084 * @param who_name 効果を起こしたモンスターの名前
5085 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5086 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5087 * @param x 目標X座標 / Target x location (or location to travel "towards")
5088 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5089 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5091 * @param monspell 効果元のモンスター魔法ID
5092 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5094 * Handle a beam/bolt/ball causing damage to the player.
5095 * This routine takes a "source monster" (by index), a "distance", a default
5096 * "damage", and a "damage type". See "project_m()" above.
5097 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5098 * is reduced (see "project_m()" above). This can happen if a monster breathes
5099 * at the player and hits a wall instead.
5100 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5101 * to know if this is actually a ball or a bolt spell
5102 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5103 * we just assume that the effects were obvious, for historical reasons.
5105 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)
5110 /* Hack -- assume obvious */
5111 bool obvious = TRUE;
5113 /* Player blind-ness */
5114 bool blind = (p_ptr->blind ? TRUE : FALSE);
5116 /* Player needs a "description" (he is blind) */
5119 /* Source monster */
5120 monster_type *m_ptr = NULL;
5122 /* Monster name (for attacks) */
5125 /* Monster name (for damage) */
5128 /* Hack -- messages */
5134 /* Player is not here */
5135 if (!player_bold(y, x)) return (FALSE);
5137 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5139 if (kawarimi(TRUE)) return FALSE;
5142 /* Player cannot hurt himself */
5143 if (!who) return (FALSE);
5144 if (who == p_ptr->riding) return (FALSE);
5146 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5149 int max_attempts = 10;
5150 sound(SOUND_REFLECT);
5153 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5154 else if (p_ptr->special_defense & KATA_FUUJIN)
5155 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5157 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5160 /* Choose 'new' target */
5165 t_y = m_list[who].fy - 1 + randint1(3);
5166 t_x = m_list[who].fx - 1 + randint1(3);
5169 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5171 if (max_attempts < 1)
5173 t_y = m_list[who].fy;
5174 t_x = m_list[who].fx;
5179 t_y = p_ptr->y - 1 + randint1(3);
5180 t_x = p_ptr->x - 1 + randint1(3);
5183 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5185 disturb(TRUE, TRUE);
5189 /* Limit maximum damage */
5190 if (dam > 1600) dam = 1600;
5192 /* Reduce damage by distance */
5193 dam = (dam + r) / (r + 1);
5196 /* If the player is blind, be more descriptive */
5197 if (blind) fuzzy = TRUE;
5202 /* Get the source monster */
5203 m_ptr = &m_list[who];
5204 /* Extract the monster level */
5205 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5207 /* Get the monster name */
5208 monster_desc(m_name, m_ptr, 0);
5210 /* Get the monster's real name (gotten before polymorph!) */
5211 strcpy(killer, who_name);
5217 case PROJECT_WHO_UNCTRL_POWER:
5218 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5221 case PROJECT_WHO_GLASS_SHARDS:
5222 strcpy(killer, _("ガラスの破片", "shards of glass"));
5226 strcpy(killer, _("罠", "a trap"));
5231 strcpy(m_name, killer);
5234 /* Analyze the damage */
5237 /* Standard damage -- hurts inventory too */
5240 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5241 get_damage = acid_dam(dam, killer, monspell, FALSE);
5245 /* Standard damage -- hurts inventory too */
5248 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5249 get_damage = fire_dam(dam, killer, monspell, FALSE);
5253 /* Standard damage -- hurts inventory too */
5256 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5257 get_damage = cold_dam(dam, killer, monspell, FALSE);
5261 /* Standard damage -- hurts inventory too */
5264 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5265 get_damage = elec_dam(dam, killer, monspell, FALSE);
5269 /* Standard damage -- also poisons player */
5272 bool double_resist = IS_OPPOSE_POIS();
5273 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5275 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5276 if (double_resist) dam = (dam + 2) / 3;
5278 if ((!(double_resist || p_ptr->resist_pois)) &&
5279 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5284 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5286 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5288 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5293 /* Standard damage -- also poisons / mutates player */
5296 bool double_resist = IS_OPPOSE_POIS();
5297 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5299 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5300 if (double_resist) dam = (2 * dam + 2) / 5;
5301 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5302 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5304 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5306 if (one_in_(5)) /* 6 */
5308 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5309 if (one_in_(4)) /* 4 */
5317 inven_damage(set_acid_destroy, 2);
5323 /* Standard damage */
5326 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5327 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5331 /* Holy Orb -- Player only takes partial damage */
5334 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5335 if (p_ptr->align > 10)
5337 else if (p_ptr->align < -10)
5339 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5345 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5346 if (p_ptr->align > 10)
5348 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5352 /* Arrow -- XXX no dodging */
5357 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5359 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5361 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5364 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5368 /* Plasma -- XXX No resist */
5371 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5372 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5374 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5376 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5377 (void)set_stun(p_ptr->stun + plus_stun);
5380 if (!(p_ptr->resist_fire ||
5382 p_ptr->immune_fire))
5384 inven_damage(set_acid_destroy, 3);
5390 /* Nether -- drain experience */
5393 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5394 if (p_ptr->resist_neth)
5396 if (!prace_is_(RACE_SPECTRE))
5398 dam *= 6; dam /= (randint1(4) + 7);
5401 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5403 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5405 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5407 learn_spell(monspell);
5411 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5417 /* Water -- stun/confuse */
5420 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5421 if (!CHECK_MULTISHADOW())
5423 if (!p_ptr->resist_sound)
5425 set_stun(p_ptr->stun + randint1(40));
5427 if (!p_ptr->resist_conf)
5429 set_confused(p_ptr->confused + randint1(5) + 5);
5434 inven_damage(set_cold_destroy, 3);
5438 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5442 /* Chaos -- many effects */
5445 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5446 if (p_ptr->resist_chaos)
5448 dam *= 6; dam /= (randint1(4) + 7);
5451 if (!CHECK_MULTISHADOW())
5453 if (!p_ptr->resist_conf)
5455 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5457 if (!p_ptr->resist_chaos)
5459 (void)set_image(p_ptr->image + randint1(10));
5462 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5463 (void)gain_random_mutation(0);
5466 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5468 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5471 if (!p_ptr->resist_chaos || one_in_(9))
5473 inven_damage(set_elec_destroy, 2);
5474 inven_damage(set_fire_destroy, 2);
5478 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5482 /* Shards -- mostly cutting */
5485 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5486 if (p_ptr->resist_shard)
5488 dam *= 6; dam /= (randint1(4) + 7);
5490 else if (!CHECK_MULTISHADOW())
5492 (void)set_cut(p_ptr->cut + dam);
5495 if (!p_ptr->resist_shard || one_in_(13))
5497 inven_damage(set_cold_destroy, 2);
5500 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5504 /* Sound -- mostly stunning */
5507 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5508 if (p_ptr->resist_sound)
5510 dam *= 5; dam /= (randint1(4) + 7);
5512 else if (!CHECK_MULTISHADOW())
5514 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5515 (void)set_stun(p_ptr->stun + plus_stun);
5518 if (!p_ptr->resist_sound || one_in_(13))
5520 inven_damage(set_cold_destroy, 2);
5523 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5527 /* Pure confusion */
5530 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5531 if (p_ptr->resist_conf)
5533 dam *= 5; dam /= (randint1(4) + 7);
5535 else if (!CHECK_MULTISHADOW())
5537 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5539 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5543 /* Disenchantment -- see above */
5546 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5547 if (p_ptr->resist_disen)
5549 dam *= 6; dam /= (randint1(4) + 7);
5551 else if (!CHECK_MULTISHADOW())
5553 (void)apply_disenchant(0);
5555 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5559 /* Nexus -- see above */
5562 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5563 if (p_ptr->resist_nexus)
5565 dam *= 6; dam /= (randint1(4) + 7);
5567 else if (!CHECK_MULTISHADOW())
5571 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5575 /* Force -- mostly stun */
5578 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5579 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5581 (void)set_stun(p_ptr->stun + randint1(20));
5583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5588 /* Rocket -- stun, cut */
5591 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5592 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5594 (void)set_stun(p_ptr->stun + randint1(20));
5597 if (p_ptr->resist_shard)
5601 else if (!CHECK_MULTISHADOW())
5603 (void)set_cut(p_ptr->cut + (dam / 2));
5606 if (!p_ptr->resist_shard || one_in_(12))
5608 inven_damage(set_cold_destroy, 3);
5611 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5615 /* Inertia -- slowness */
5618 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5619 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5620 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5624 /* Lite -- blinding */
5627 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5628 if (p_ptr->resist_lite)
5630 dam *= 4; dam /= (randint1(4) + 7);
5632 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5634 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5637 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5639 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5642 else if (prace_is_(RACE_S_FAIRY))
5647 if (p_ptr->wraith_form) dam *= 2;
5648 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5650 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5652 p_ptr->wraith_form = 0;
5653 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5654 "The light forces you out of your incorporeal shadow form."));
5656 p_ptr->redraw |= PR_MAP;
5657 /* Update monsters */
5658 p_ptr->update |= (PU_MONSTERS);
5659 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5661 /* Redraw status bar */
5662 p_ptr->redraw |= (PR_STATUS);
5669 /* Dark -- blinding */
5672 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5673 if (p_ptr->resist_dark)
5675 dam *= 4; dam /= (randint1(4) + 7);
5677 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5679 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5681 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5683 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5687 /* Time -- bolt fewer effects XXX */
5690 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5691 if (p_ptr->resist_time)
5694 dam /= (randint1(4) + 7);
5695 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5697 else if (!CHECK_MULTISHADOW())
5699 switch (randint1(10))
5701 case 1: case 2: case 3: case 4: case 5:
5703 if (p_ptr->prace == RACE_ANDROID) break;
5704 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5705 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5709 case 6: case 7: case 8: case 9:
5711 switch (randint1(6))
5713 case 1: k = A_STR; act = _("強く", "strong"); break;
5714 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5715 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5716 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5717 case 5: k = A_CON; act = _("健康で", "hale"); break;
5718 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5721 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5722 "You're not as %s as you used to be..."), act);
5724 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5725 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5726 p_ptr->update |= (PU_BONUS);
5732 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5733 "You're not as powerful as you used to be..."));
5735 for (k = 0; k < 6; k++)
5737 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5738 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5740 p_ptr->update |= (PU_BONUS);
5746 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5750 /* Gravity -- stun plus slowness plus teleport */
5753 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5754 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5756 if (!CHECK_MULTISHADOW())
5758 teleport_player(5, TELEPORT_PASSIVE);
5759 if (!p_ptr->levitation)
5760 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5761 if (!(p_ptr->resist_sound || p_ptr->levitation))
5763 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5764 (void)set_stun(p_ptr->stun + plus_stun);
5767 if (p_ptr->levitation)
5769 dam = (dam * 2) / 3;
5772 if (!p_ptr->levitation || one_in_(13))
5774 inven_damage(set_cold_destroy, 2);
5777 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5781 /* Standard damage */
5782 case GF_DISINTEGRATE:
5784 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5786 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5792 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5794 (void)hp_player(dam);
5801 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5802 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5809 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5810 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5816 if (p_ptr->free_act) break;
5817 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5819 if (ironman_nightmare)
5821 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5822 /* Have some nightmares */
5823 sanity_blast(NULL, FALSE);
5826 set_paralyzed(p_ptr->paralyzed + dam);
5836 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5837 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5844 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5845 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5852 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5854 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5855 if (!p_ptr->resist_shard || one_in_(13))
5857 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5858 inven_damage(set_cold_destroy, 2);
5864 /* Ice -- cold plus stun plus cuts */
5867 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5868 get_damage = cold_dam(dam, killer, monspell, FALSE);
5869 if (!CHECK_MULTISHADOW())
5871 if (!p_ptr->resist_shard)
5873 (void)set_cut(p_ptr->cut + damroll(5, 8));
5875 if (!p_ptr->resist_sound)
5877 (void)set_stun(p_ptr->stun + randint1(15));
5880 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5882 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5892 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5894 if (p_ptr->mimic_form)
5896 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5897 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5902 switch (p_ptr->prace)
5904 /* Some races are immune */
5918 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5930 if (CHECK_MULTISHADOW())
5932 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5934 else if (p_ptr->csp)
5938 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5940 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5943 if (dam >= p_ptr->csp)
5947 p_ptr->csp_frac = 0;
5956 learn_spell(monspell);
5959 p_ptr->redraw |= (PR_MANA);
5961 p_ptr->window |= (PW_PLAYER);
5962 p_ptr->window |= (PW_SPELL);
5966 /* Heal the monster */
5967 if (m_ptr->hp < m_ptr->maxhp)
5971 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5973 /* Redraw (later) if needed */
5974 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5975 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5977 /* Special message */
5980 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5993 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5995 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5996 learn_spell(monspell);
6000 if (!CHECK_MULTISHADOW())
6002 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6004 if (!p_ptr->resist_conf)
6006 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6009 if (!p_ptr->resist_chaos && one_in_(3))
6011 (void)set_image(p_ptr->image + randint0(250) + 150);
6018 p_ptr->csp_frac = 0;
6020 p_ptr->redraw |= PR_MANA;
6023 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6029 case GF_BRAIN_SMASH:
6031 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6033 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6034 learn_spell(monspell);
6038 if (!CHECK_MULTISHADOW())
6040 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6046 p_ptr->csp_frac = 0;
6048 p_ptr->redraw |= PR_MANA;
6051 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6052 if (!CHECK_MULTISHADOW())
6054 if (!p_ptr->resist_blind)
6056 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6058 if (!p_ptr->resist_conf)
6060 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6062 if (!p_ptr->free_act)
6064 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6066 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6068 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6069 (void)do_dec_stat(A_INT);
6070 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6071 (void)do_dec_stat(A_WIS);
6073 if (!p_ptr->resist_chaos)
6075 (void)set_image(p_ptr->image + randint0(250) + 150);
6085 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6087 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6088 learn_spell(monspell);
6092 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6093 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6101 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6103 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6104 learn_spell(monspell);
6108 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6109 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6117 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6119 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6120 learn_spell(monspell);
6124 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6125 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6133 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6135 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6136 learn_spell(monspell);
6140 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6141 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6149 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6151 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6152 learn_spell(monspell);
6156 if (!CHECK_MULTISHADOW())
6158 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6159 curse_equipment(40, 20);
6162 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6164 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6179 /* Hex - revenge damage stored */
6180 revenge_store(get_damage);
6182 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6183 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6185 char m_name_self[80];
6188 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6190 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6191 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6192 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6195 if (p_ptr->riding && dam > 0)
6197 rakubadam_p = (dam > 200) ? 200 : dam;
6201 disturb(TRUE, TRUE);
6204 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6206 (void)kawarimi(FALSE);
6209 /* Return "Anything seen?" */
6215 * Find the distance from (x, y) to a line.
6217 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6219 /* Vector from (x, y) to (x1, y1) */
6220 POSITION py = y1 - y;
6221 POSITION px = x1 - x;
6224 POSITION ny = x2 - x1;
6225 POSITION nx = y1 - y2;
6228 POSITION pd = distance(y1, x1, y, x);
6229 POSITION nd = distance(y1, x1, y2, x2);
6231 if (pd > nd) return distance(y, x, y2, x2);
6233 /* Component of P on N */
6234 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6236 /* Absolute value */
6237 return((nd >= 0) ? nd : 0 - nd);
6244 * Modified version of los() for calculation of disintegration balls.
6245 * Disintegration effects are stopped by permanent walls.
6247 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6267 /* Slope, or 1/Slope, of LOS */
6271 /* Extract the offset */
6275 /* Extract the absolute offset */
6280 /* Handle adjacent (or identical) grids */
6281 if ((ax < 2) && (ay < 2)) return (TRUE);
6284 /* Paranoia -- require "safe" origin */
6285 /* if (!in_bounds(y1, x1)) return (FALSE); */
6288 /* Directly South/North */
6291 /* South -- check for walls */
6294 for (ty = y1 + 1; ty < y2; ty++)
6296 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6300 /* North -- check for walls */
6303 for (ty = y1 - 1; ty > y2; ty--)
6305 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6313 /* Directly East/West */
6316 /* East -- check for walls */
6319 for (tx = x1 + 1; tx < x2; tx++)
6321 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6325 /* West -- check for walls */
6328 for (tx = x1 - 1; tx > x2; tx--)
6330 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6339 /* Extract some signs */
6340 sx = (dx < 0) ? -1 : 1;
6341 sy = (dy < 0) ? -1 : 1;
6344 /* Vertical "knights" */
6349 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6353 /* Horizontal "knights" */
6358 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6363 /* Calculate scale factor div 2 */
6366 /* Calculate scale factor */
6370 /* Travel horizontally */
6373 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6379 /* Consider the special case where slope == 1. */
6390 /* Note (below) the case (qy == f2), where */
6391 /* the LOS exactly meets the corner of a tile. */
6394 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6405 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6418 /* Travel vertically */
6421 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6437 /* Note (below) the case (qx == f2), where */
6438 /* the LOS exactly meets the corner of a tile. */
6441 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6452 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6473 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)
6478 int brev = rad * rad / dist;
6482 int mdis = distance(y1, x1, y2, x2) + rad;
6484 while (bdis <= mdis)
6488 if ((0 < dist) && (path_n < dist))
6490 POSITION ny = GRID_Y(path_g[path_n]);
6491 POSITION nx = GRID_X(path_g[path_n]);
6492 POSITION nd = distance(ny, nx, y1, x1);
6494 /* Get next base point */
6503 /* Travel from center outward */
6504 for (cdis = 0; cdis <= brad; cdis++)
6506 /* Scan the maximal blast area of radius "cdis" */
6507 for (y = by - cdis; y <= by + cdis; y++)
6509 for (x = bx - cdis; x <= bx + cdis; x++)
6511 /* Ignore "illegal" locations */
6512 if (!in_bounds(y, x)) continue;
6514 /* Enforce a circular "ripple" */
6515 if (distance(y1, x1, y, x) != bdis) continue;
6517 /* Enforce an arc */
6518 if (distance(by, bx, y, x) != cdis) continue;
6524 /* Lights are stopped by opaque terrains */
6525 if (!los(by, bx, y, x)) continue;
6527 case GF_DISINTEGRATE:
6528 /* Disintegration are stopped only by perma-walls */
6529 if (!in_disintegration_range(by, bx, y, x)) continue;
6532 /* Ball explosions are stopped by walls */
6533 if (!projectable(by, bx, y, x)) continue;
6537 /* Save this grid */
6545 /* Encode some more "radius" info */
6546 gm[bdis + 1] = *pgrids;
6548 /* Increase the size */
6549 brad = rad * (path_n + brev) / (dist + brev);
6551 /* Find the next ripple */
6555 /* Store the effect size */
6561 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6562 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6563 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6564 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6565 * @param x 目標X座標 / Target x location (or location to travel "towards")
6566 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6567 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6568 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6569 * @param monspell 効果元のモンスター魔法ID
6570 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6573 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6574 * towards a given location (optionally passing over the heads of interposing
6575 * monsters), and have it do a given amount of damage to the monsters (and
6576 * optionally objects) within the given radius of the final location.
6578 * A "bolt" travels from source to target and affects only the target grid.
6579 * A "beam" travels from source to target, affecting all grids passed through.
6580 * A "ball" travels from source to the target, exploding at the target, and
6581 * affecting everything within the given radius of the target location.
6583 * Traditionally, a "bolt" does not affect anything on the ground, and does
6584 * not pass over the heads of interposing monsters, much like a traditional
6585 * missile, and will "stop" abruptly at the "target" even if no monster is
6586 * positioned there, while a "ball", on the other hand, passes over the heads
6587 * of monsters between the source and target, and affects everything except
6588 * the source monster which lies within the final radius, while a "beam"
6589 * affects every monster between the source and target, except for the casting
6590 * monster (or player), and rarely affects things on the ground.
6592 * Two special flags allow us to use this function in special ways, the
6593 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6594 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6595 * actually projecting from the source monster (or player).
6597 * The player will only get "experience" for monsters killed by himself
6598 * Unique monsters can only be destroyed by attacks from the player
6600 * Only 256 grids can be affected per projection, limiting the effective
6601 * "radius" of standard ball attacks to nine units (diameter nineteen).
6603 * One can project in a given "direction" by combining PROJECT_THRU with small
6604 * offsets to the initial location (see "line_spell()"), or by calculating
6605 * "virtual targets" far away from the player.
6607 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6608 * continuing until it actually hits somethings (useful for "stone to mud").
6610 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6612 * Balls must explode BEFORE hitting walls, or they would affect monsters
6613 * on both sides of a wall. Some bug reports indicate that this is still
6614 * happening in 2.7.8 for Windows, though it appears to be impossible.
6616 * We "pre-calculate" the blast area only in part for efficiency.
6617 * More importantly, this lets us do "explosions" from the "inside" out.
6618 * This results in a more logical distribution of "blast" treasure.
6619 * It also produces a better (in my opinion) animation of the explosion.
6620 * It could be (but is not) used to have the treasure dropped by monsters
6621 * in the middle of the explosion fall "outwards", and then be damaged by
6622 * the blast as it spreads outwards towards the treasure drop location.
6624 * Walls and doors are included in the blast area, so that they can be
6625 * "burned" or "melted" in later versions.
6627 * This algorithm is intended to maximize simplicity, not necessarily
6628 * efficiency, since this function is not a bottleneck in the code.
6630 * We apply the blast effect from ground zero outwards, in several passes,
6631 * first affecting features, then objects, then monsters, then the player.
6632 * This allows walls to be removed before checking the object or monster
6633 * in the wall, and protects objects which are dropped by monsters killed
6634 * in the blast, and allows the player to see all affects before he is
6635 * killed or teleported away. The semantics of this method are open to
6636 * various interpretations, but they seem to work well in practice.
6638 * We process the blast area from ground-zero outwards to allow for better
6639 * distribution of treasure dropped by monsters, and because it provides a
6640 * pleasing visual effect at low cost.
6642 * Note that the damage done by "ball" explosions decreases with distance.
6643 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6645 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6646 * the target, and then the damage "flows" along this beam of destruction.
6647 * The damage at every grid is the same as at the "center" of a "ball"
6648 * explosion, since the "beam" grids are treated as if they ARE at the
6649 * center of a "ball" explosion.
6651 * Currently, specifying "beam" plus "ball" means that locations which are
6652 * covered by the initial "beam", and also covered by the final "ball", except
6653 * for the final grid (the epicenter of the ball), will be "hit twice", once
6654 * by the initial beam, and once by the exploding ball. For the grid right
6655 * next to the epicenter, this results in 150% damage being done. The center
6656 * does not have this problem, for the same reason the final grid in a "beam"
6657 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6658 * grids which are covered by the "ball" will NOT work, as then they will
6659 * receive LESS damage than they should. Do not combine "beam" with "ball".
6661 * The array "gy[],gx[]" with current size "grids" is used to hold the
6662 * collected locations of all grids in the "blast area" plus "beam path".
6664 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6665 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6666 * first blast grid (see above) with radius "N" from the blast center. Note
6667 * that only the first gm[1] grids in the blast area thus take full damage.
6668 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6669 * number of blast grids.
6671 * Note that once the projection is complete, (y2,x2) holds the final location
6672 * of bolts/beams, and the "epicenter" of balls.
6674 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6675 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6676 * implementation of the "distance" function. Also, a bolt can be properly
6677 * viewed as a "ball" with a "rad" of "zero".
6679 * Note that if no "target" is reached before the beam/bolt/ball travels the
6680 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6681 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6683 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6684 * to move from point A to point B, even if the player cannot see part of the
6685 * projection path. Note that in general, the player will *always* see part
6686 * of the path, since it either starts at the player or ends on the player.
6688 * Hack -- we assume that every "projection" is "self-illuminating".
6690 * Hack -- when only a single monster is affected, we automatically track
6691 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6693 * Note that all projections now "explode" at their final destination, even
6694 * if they were being projected at a more distant destination. This means
6695 * that "ball" spells will *always* explode.
6697 * Note that we must call "handle_stuff()" after affecting terrain features
6698 * in the blast radius, in case the "illumination" of the grid was changed,
6699 * and "update_view()" and "update_monsters()" need to be called.
6702 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6712 POSITION y_saver, x_saver; /* For reflecting monsters */
6714 int msec = delay_factor * delay_factor * delay_factor;
6716 /* Assume the player sees nothing */
6717 bool notice = FALSE;
6719 /* Assume the player has seen nothing */
6720 bool visual = FALSE;
6722 /* Assume the player has seen no blast grids */
6725 /* Assume to be a normal ball spell */
6726 bool breath = FALSE;
6728 /* Is the player blind? */
6729 bool blind = (p_ptr->blind ? TRUE : FALSE);
6731 bool old_hide = FALSE;
6733 /* Number of grids in the "path" */
6736 /* Actual grids in the "path" */
6739 /* Number of grids in the "blast area" (including the "beam" path) */
6742 /* Coordinates of the affected grids */
6743 POSITION gx[1024], gy[1024];
6745 /* Encoded "radius" info (see above) */
6748 /* Actual radius encoded in gm[] */
6749 POSITION gm_rad = rad;
6753 /* Attacker's name (prepared before polymorph)*/
6756 /* Can the player see the source of this effect? */
6757 bool see_s_msg = TRUE;
6759 /* Initialize by null string */
6765 /* Default target of monsterspell is player */
6766 monster_target_y = p_ptr->y;
6767 monster_target_x = p_ptr->x;
6769 /* Hack -- Jump to target */
6770 if (flg & (PROJECT_JUMP))
6775 /* Clear the flag */
6776 flg &= ~(PROJECT_JUMP);
6781 /* Start at player */
6788 /* Start at monster */
6791 x1 = m_list[who].fx;
6792 y1 = m_list[who].fy;
6793 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6805 /* Default "destination" */
6810 /* Hack -- verify stuff */
6811 if (flg & (PROJECT_THRU))
6813 if ((x1 == x2) && (y1 == y2))
6815 flg &= ~(PROJECT_THRU);
6819 /* Handle a breath attack */
6824 if (flg & PROJECT_HIDE) old_hide = TRUE;
6825 flg |= PROJECT_HIDE;
6829 /* Hack -- Assume there will be no blast (max radius 32) */
6830 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6838 /* Collect beam grids */
6839 if (flg & (PROJECT_BEAM))
6850 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6852 case GF_DISINTEGRATE:
6853 flg |= (PROJECT_GRID);
6854 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6858 /* Calculate the projection path */
6860 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6863 /* Giga-Hack SEEKER & SUPER_RAY */
6865 if( typ == GF_SEEKER )
6875 for (i = 0; i < path_n; ++i)
6880 int ny = GRID_Y(path_g[i]);
6881 int nx = GRID_X(path_g[i]);
6892 /* Only do visuals if requested */
6893 if (!blind && !(flg & (PROJECT_HIDE)))
6895 /* Only do visuals if the player can "see" the bolt */
6896 if (panel_contains(y, x) && player_has_los_bold(y, x))
6903 /* Obtain the bolt pict */
6904 p = bolt_pict(oy, ox, y, x, typ);
6906 /* Extract attr/char */
6910 /* Visual effects */
6911 print_rel(c, a, y, x);
6912 move_cursor_relative(y, x);
6913 /*if (fresh_before)*/ Term_fresh();
6914 Term_xtra(TERM_XTRA_DELAY, msec);
6916 /*if (fresh_before)*/ Term_fresh();
6918 /* Display "beam" grids */
6919 if (flg & (PROJECT_BEAM))
6921 /* Obtain the explosion pict */
6922 p = bolt_pict(y, x, y, x, typ);
6924 /* Extract attr/char */
6928 /* Visual effects */
6929 print_rel(c, a, y, x);
6932 /* Hack -- Activate delay */
6936 /* Hack -- delay anyway for consistency */
6939 /* Delay for consistency */
6940 Term_xtra(TERM_XTRA_DELAY, msec);
6943 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6944 if( is_mirror_grid(&cave[y][x]))
6946 /* The target of monsterspell becomes tha mirror(broken) */
6947 monster_target_y=(s16b)y;
6948 monster_target_x=(s16b)x;
6950 remove_mirror(y, x);
6951 next_mirror(&oy, &ox, y, x);
6953 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6954 for(j = last_i; j <= i; j++)
6956 y = GRID_Y(path_g[j]);
6957 x = GRID_X(path_g[j]);
6958 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6959 if(!who && (project_m_n==1) && !jump ){
6960 if(cave[project_m_y][project_m_x].m_idx >0 ){
6961 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6965 /* Hack -- auto-recall */
6966 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6968 /* Hack - auto-track */
6969 health_track(cave[project_m_y][project_m_x].m_idx);
6973 (void)project_f(0,0,y,x,dam,GF_SEEKER);
6978 for(i = last_i ; i < path_n ; i++)
6981 py = GRID_Y(path_g[i]);
6982 px = GRID_X(path_g[i]);
6983 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6985 if(!who && (project_m_n==1) && !jump ){
6986 if(cave[project_m_y][project_m_x].m_idx > 0)
6988 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6992 /* Hack -- auto-recall */
6993 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6995 /* Hack - auto-track */
6996 health_track(cave[project_m_y][project_m_x].m_idx);
7000 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7004 else if(typ == GF_SUPER_RAY){
7006 int second_step = 0;
7013 for (i = 0; i < path_n; ++i)
7018 int ny = GRID_Y(path_g[i]);
7019 int nx = GRID_X(path_g[i]);
7030 /* Only do visuals if requested */
7031 if (!blind && !(flg & (PROJECT_HIDE)))
7033 /* Only do visuals if the player can "see" the bolt */
7034 if (panel_contains(y, x) && player_has_los_bold(y, x))
7041 /* Obtain the bolt pict */
7042 p = bolt_pict(oy, ox, y, x, typ);
7044 /* Extract attr/char */
7048 /* Visual effects */
7049 print_rel(c, a, y, x);
7050 move_cursor_relative(y, x);
7051 /*if (fresh_before)*/ Term_fresh();
7052 Term_xtra(TERM_XTRA_DELAY, msec);
7054 /*if (fresh_before)*/ Term_fresh();
7056 /* Display "beam" grids */
7057 if (flg & (PROJECT_BEAM))
7059 /* Obtain the explosion pict */
7060 p = bolt_pict(y, x, y, x, typ);
7062 /* Extract attr/char */
7066 /* Visual effects */
7067 print_rel(c, a, y, x);
7070 /* Hack -- Activate delay */
7074 /* Hack -- delay anyway for consistency */
7077 /* Delay for consistency */
7078 Term_xtra(TERM_XTRA_DELAY, msec);
7081 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7082 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7084 if( second_step )continue;
7087 if( is_mirror_grid(&cave[y][x]) && !second_step )
7089 /* The target of monsterspell becomes tha mirror(broken) */
7090 monster_target_y=(s16b)y;
7091 monster_target_x=(s16b)x;
7094 for( j = 0; j <=i ; j++ )
7096 y = GRID_Y(path_g[j]);
7097 x = GRID_X(path_g[j]);
7098 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7102 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7103 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7104 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7105 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7106 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7107 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7108 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7109 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7112 for( i = 0; i < path_n ; i++ )
7115 py = GRID_Y(path_g[i]);
7116 px = GRID_X(path_g[i]);
7117 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7118 if(!who && (project_m_n == 1) && !jump){
7119 if(cave[project_m_y][project_m_x].m_idx >0 ){
7120 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7124 /* Hack -- auto-recall */
7125 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7127 /* Hack - auto-track */
7128 health_track(cave[project_m_y][project_m_x].m_idx);
7132 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7137 /* Project along the path */
7138 for (i = 0; i < path_n; ++i)
7143 int ny = GRID_Y(path_g[i]);
7144 int nx = GRID_X(path_g[i]);
7146 if (flg & PROJECT_DISI)
7148 /* Hack -- Balls explode before reaching walls */
7149 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7151 else if (flg & PROJECT_LOS)
7153 /* Hack -- Balls explode before reaching walls */
7154 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7158 /* Hack -- Balls explode before reaching walls */
7159 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7166 /* Collect beam grids */
7167 if (flg & (PROJECT_BEAM))
7174 /* Only do visuals if requested */
7175 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7177 /* Only do visuals if the player can "see" the bolt */
7178 if (panel_contains(y, x) && player_has_los_bold(y, x))
7185 /* Obtain the bolt pict */
7186 p = bolt_pict(oy, ox, y, x, typ);
7188 /* Extract attr/char */
7192 /* Visual effects */
7193 print_rel(c, a, y, x);
7194 move_cursor_relative(y, x);
7195 /*if (fresh_before)*/ Term_fresh();
7196 Term_xtra(TERM_XTRA_DELAY, msec);
7198 /*if (fresh_before)*/ Term_fresh();
7200 /* Display "beam" grids */
7201 if (flg & (PROJECT_BEAM))
7203 /* Obtain the explosion pict */
7204 p = bolt_pict(y, x, y, x, typ);
7206 /* Extract attr/char */
7210 /* Visual effects */
7211 print_rel(c, a, y, x);
7214 /* Hack -- Activate delay */
7218 /* Hack -- delay anyway for consistency */
7221 /* Delay for consistency */
7222 Term_xtra(TERM_XTRA_DELAY, msec);
7229 /* Save the "blast epicenter" */
7233 if (breath && !path_n)
7239 flg &= ~(PROJECT_HIDE);
7243 /* Start the "explosion" */
7246 /* Hack -- make sure beams get to "explode" */
7254 /* If we found a "target", explode there */
7255 if (dist <= MAX_RANGE)
7257 /* Mega-Hack -- remove the final "beam" grid */
7258 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7261 * Create a conical breath attack
7272 flg &= ~(PROJECT_HIDE);
7274 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7278 /* Determine the blast area, work from the inside out */
7279 for (dist = 0; dist <= rad; dist++)
7281 /* Scan the maximal blast area of radius "dist" */
7282 for (y = by - dist; y <= by + dist; y++)
7284 for (x = bx - dist; x <= bx + dist; x++)
7286 /* Ignore "illegal" locations */
7287 if (!in_bounds2(y, x)) continue;
7289 /* Enforce a "circular" explosion */
7290 if (distance(by, bx, y, x) != dist) continue;
7296 /* Lights are stopped by opaque terrains */
7297 if (!los(by, bx, y, x)) continue;
7299 case GF_DISINTEGRATE:
7300 /* Disintegration are stopped only by perma-walls */
7301 if (!in_disintegration_range(by, bx, y, x)) continue;
7304 /* Ball explosions are stopped by walls */
7305 if (!projectable(by, bx, y, x)) continue;
7309 /* Save this grid */
7316 /* Encode some more "radius" info */
7322 /* Speed -- ignore "non-explosions" */
7323 if (!grids) return (FALSE);
7326 /* Display the "blast area" if requested */
7327 if (!blind && !(flg & (PROJECT_HIDE)))
7329 /* Then do the "blast", from inside out */
7330 for (t = 0; t <= gm_rad; t++)
7332 /* Dump everything with this radius */
7333 for (i = gm[t]; i < gm[t+1]; i++)
7335 /* Extract the location */
7339 /* Only do visuals if the player can "see" the blast */
7340 if (panel_contains(y, x) && player_has_los_bold(y, x))
7349 /* Obtain the explosion pict */
7350 p = bolt_pict(y, x, y, x, typ);
7352 /* Extract attr/char */
7356 /* Visual effects -- Display */
7357 print_rel(c, a, y, x);
7361 /* Hack -- center the cursor */
7362 move_cursor_relative(by, bx);
7364 /* Flush each "radius" seperately */
7365 /*if (fresh_before)*/ Term_fresh();
7367 /* Delay (efficiently) */
7368 if (visual || drawn)
7370 Term_xtra(TERM_XTRA_DELAY, msec);
7374 /* Flush the erasing */
7377 /* Erase the explosion drawn above */
7378 for (i = 0; i < grids; i++)
7380 /* Extract the location */
7384 /* Hack -- Erase if needed */
7385 if (panel_contains(y, x) && player_has_los_bold(y, x))
7391 /* Hack -- center the cursor */
7392 move_cursor_relative(by, bx);
7394 /* Flush the explosion */
7395 /*if (fresh_before)*/ Term_fresh();
7400 /* Update stuff if needed */
7401 if (p_ptr->update) update_stuff();
7404 if (flg & PROJECT_KILL)
7406 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7407 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7411 /* Check features */
7412 if (flg & (PROJECT_GRID))
7414 /* Start with "dist" of zero */
7417 /* Scan for features */
7418 for (i = 0; i < grids; i++)
7420 /* Hack -- Notice new "dist" values */
7421 if (gm[dist+1] == i) dist++;
7423 /* Get the grid location */
7427 /* Find the closest point in the blast */
7430 int d = dist_to_line(y, x, y1, x1, by, bx);
7432 /* Affect the grid */
7433 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7437 /* Affect the grid */
7438 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7443 /* Update stuff if needed */
7444 if (p_ptr->update) update_stuff();
7447 if (flg & (PROJECT_ITEM))
7449 /* Start with "dist" of zero */
7452 /* Scan for objects */
7453 for (i = 0; i < grids; i++)
7455 /* Hack -- Notice new "dist" values */
7456 if (gm[dist+1] == i) dist++;
7458 /* Get the grid location */
7462 /* Find the closest point in the blast */
7465 int d = dist_to_line(y, x, y1, x1, by, bx);
7467 /* Affect the object in the grid */
7468 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7472 /* Affect the object in the grid */
7473 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7479 /* Check monsters */
7480 if (flg & (PROJECT_KILL))
7487 /* Start with "dist" of zero */
7490 /* Scan for monsters */
7491 for (i = 0; i < grids; i++)
7495 /* Hack -- Notice new "dist" values */
7496 if (gm[dist + 1] == i) dist++;
7498 /* Get the grid location */
7502 /* A single bolt may be reflected */
7505 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7506 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7508 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7509 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7510 (!who || dist_hack > 1) && !one_in_(10))
7513 int max_attempts = 10;
7515 /* Choose 'new' target */
7518 t_y = y_saver - 1 + randint1(3);
7519 t_x = x_saver - 1 + randint1(3);
7522 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7524 if (max_attempts < 1)
7530 sound(SOUND_REFLECT);
7533 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7534 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7535 else if (m_ptr->r_idx == MON_DIO)
7536 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7538 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7540 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7542 /* Reflected bolts randomly target either one */
7543 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7544 else flg |= PROJECT_PLAYER;
7546 /* The bolt is reflected */
7547 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7549 /* Don't affect the monster any longer */
7555 /* Find the closest point in the blast */
7558 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7562 effective_dist = dist;
7566 /* There is the riding player on this monster */
7567 if (p_ptr->riding && player_bold(y, x))
7569 /* Aimed on the player */
7570 if (flg & PROJECT_PLAYER)
7572 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7575 * A beam or bolt is well aimed
7577 * So don't affects the mount.
7584 * The spell is not well aimed,
7585 * So partly affect the mount too.
7592 * This grid is the original target.
7593 * Or aimed on your horse.
7595 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7597 /* Hit the mount with full damage */
7601 * Otherwise this grid is not the
7602 * original target, it means that line
7603 * of fire is obstructed by this
7607 * A beam or bolt will hit either
7608 * player or mount. Choose randomly.
7610 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7614 /* Hit the mount with full damage */
7618 /* Hit the player later */
7619 flg |= PROJECT_PLAYER;
7621 /* Don't affect the mount */
7627 * The spell is not well aimed, so
7628 * partly affect both player and
7637 /* Affect the monster in the grid */
7638 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7642 /* Player affected one monster (without "jumping") */
7643 if (!who && (project_m_n == 1) && !jump)
7648 /* Track if possible */
7649 if (cave[y][x].m_idx > 0)
7651 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7655 /* Hack -- auto-recall */
7656 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7658 /* Hack - auto-track */
7659 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7667 if (flg & (PROJECT_KILL))
7669 /* Start with "dist" of zero */
7672 /* Scan for player */
7673 for (i = 0; i < grids; i++)
7677 /* Hack -- Notice new "dist" values */
7678 if (gm[dist+1] == i) dist++;
7680 /* Get the grid location */
7684 /* Affect the player? */
7685 if (!player_bold(y, x)) continue;
7687 /* Find the closest point in the blast */
7690 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7694 effective_dist = dist;
7697 /* Target may be your horse */
7700 /* Aimed on the player */
7701 if (flg & PROJECT_PLAYER)
7703 /* Hit the player with full damage */
7707 * Hack -- When this grid was not the
7708 * original target, a beam or bolt
7709 * would hit either player or mount,
7710 * and should be choosen randomly.
7712 * But already choosen to hit the
7713 * mount at this point.
7715 * Or aimed on your horse.
7717 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7720 * A beam or bolt is well aimed
7722 * So don't affects the player.
7729 * The spell is not well aimed,
7730 * So partly affect the player too.
7736 /* Affect the player */
7737 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7745 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7747 if (rakubadam_m > 0)
7749 if (rakuba(rakubadam_m, FALSE))
7751 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7754 if (p_ptr->riding && rakubadam_p > 0)
7756 if(rakuba(rakubadam_p, FALSE))
7758 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7763 /* Return "something was noticed" */
7768 * @brief 鏡魔法「封魔結界」の効果処理
7770 * @return 効果があったらTRUEを返す
7772 bool binding_field(HIT_POINT dam)
7774 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7775 int mirror_num = 0; /* 鏡の数 */
7777 POSITION centersign;
7778 POSITION x1, x2, y1, y2;
7780 int msec = delay_factor*delay_factor*delay_factor;
7783 POSITION point_x[3];
7784 POSITION point_y[3];
7786 /* Default target of monsterspell is player */
7787 monster_target_y = p_ptr->y;
7788 monster_target_x = p_ptr->x;
7790 for (x = 0; x < cur_wid; x++)
7792 for (y = 0; y < cur_hgt; y++)
7794 if (is_mirror_grid(&cave[y][x]) &&
7795 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7796 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7797 player_has_los_bold(y, x) &&
7798 projectable(p_ptr->y, p_ptr->x, y, x)
7800 mirror_y[mirror_num] = y;
7801 mirror_x[mirror_num] = x;
7807 if (mirror_num < 2)return FALSE;
7809 point_x[0] = randint0(mirror_num);
7811 point_x[1] = randint0(mirror_num);
7812 } while (point_x[0] == point_x[1]);
7814 point_y[0] = mirror_y[point_x[0]];
7815 point_x[0] = mirror_x[point_x[0]];
7816 point_y[1] = mirror_y[point_x[1]];
7817 point_x[1] = mirror_x[point_x[1]];
7818 point_y[2] = p_ptr->y;
7819 point_x[2] = p_ptr->x;
7821 x = point_x[0] + point_x[1] + point_x[2];
7822 y = point_y[0] + point_y[1] + point_y[2];
7824 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7825 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7826 if (centersign == 0)return FALSE;
7828 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7829 x1 = x1 < point_x[2] ? x1 : point_x[2];
7830 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7831 y1 = y1 < point_y[2] ? y1 : point_y[2];
7833 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7834 x2 = x2 > point_x[2] ? x2 : point_x[2];
7835 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7836 y2 = y2 > point_y[2] ? y2 : point_y[2];
7838 for (y = y1; y <= y2; y++) {
7839 for (x = x1; x <= x2; x++) {
7840 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7841 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7842 centersign*((point_x[1] - x)*(point_y[2] - y)
7843 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7844 centersign*((point_x[2] - x)*(point_y[0] - y)
7845 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7847 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7848 /* Visual effects */
7850 && panel_contains(y, x)) {
7851 p = bolt_pict(y, x, y, x, GF_MANA);
7852 print_rel(PICT_C(p), PICT_A(p), y, x);
7853 move_cursor_relative(y, x);
7854 /*if (fresh_before)*/ Term_fresh();
7855 Term_xtra(TERM_XTRA_DELAY, msec);
7861 for (y = y1; y <= y2; y++) {
7862 for (x = x1; x <= x2; x++) {
7863 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7864 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7865 centersign*((point_x[1] - x)*(point_y[2] - y)
7866 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7867 centersign*((point_x[2] - x)*(point_y[0] - y)
7868 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7870 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7871 (void)project_f(0, 0, y, x, dam, GF_MANA);
7876 for (y = y1; y <= y2; y++) {
7877 for (x = x1; x <= x2; x++) {
7878 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7879 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7880 centersign*((point_x[1] - x)*(point_y[2] - y)
7881 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7882 centersign*((point_x[2] - x)*(point_y[0] - y)
7883 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7885 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7886 (void)project_o(0, 0, y, x, dam, GF_MANA);
7891 for (y = y1; y <= y2; y++) {
7892 for (x = x1; x <= x2; x++) {
7893 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7894 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7895 centersign*((point_x[1] - x)*(point_y[2] - y)
7896 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7897 centersign*((point_x[2] - x)*(point_y[0] - y)
7898 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7900 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7901 (void)project_m(0, 0, y, x, dam, GF_MANA,
7902 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7908 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7909 remove_mirror(point_y[0], point_x[0]);
7916 * @brief 鏡魔法「鏡の封印」の効果処理
7918 * @return 効果があったらTRUEを返す
7920 void seal_of_mirror(HIT_POINT dam)
7924 for (x = 0; x < cur_wid; x++)
7926 for (y = 0; y < cur_hgt; y++)
7928 if (is_mirror_grid(&cave[y][x]))
7930 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7931 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7933 if (!cave[y][x].m_idx)
7935 remove_mirror(y, x);