3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
21 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
22 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
24 int project_length = 0; /*!< 投射の射程距離 */
28 * @brief モンスター魅了用セービングスロー共通部(汎用系)
30 * @param m_ptr 対象モンスター
31 * @return 魅了に抵抗したらTRUE
33 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
35 monster_race *r_ptr = &r_info[m_ptr->r_idx];
37 if(p_ptr->inside_arena) return TRUE;
40 if (r_ptr->flagsr & RFR_RES_ALL)
42 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
46 if (r_ptr->flags3 & RF3_NO_CONF)
48 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
52 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
54 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
55 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
56 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
60 * @brief モンスター服従用セービングスロー共通部(部族依存系)
62 * @param m_ptr 対象モンスター
63 * @return 服従に抵抗したらTRUE
65 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
67 monster_race *r_ptr = &r_info[m_ptr->r_idx];
69 if (p_ptr->inside_arena) return TRUE;
72 if (r_ptr->flagsr & RFR_RES_ALL)
74 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
78 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
80 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
81 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
82 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
86 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
89 * ハードコーティングによる実装が行われている。
90 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
92 PERCENTAGE beam_chance(void)
94 if (p_ptr->pclass == CLASS_MAGE)
95 return (PERCENTAGE)(p_ptr->lev);
96 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
97 return (PERCENTAGE)(p_ptr->lev + 10);
99 return (PERCENTAGE)(p_ptr->lev / 2);
104 * @brief 配置した鏡リストの次を取得する /
105 * Get another mirror. for SEEKER
106 * @param next_y 次の鏡のy座標を返す参照ポインタ
107 * @param next_x 次の鏡のx座標を返す参照ポインタ
108 * @param cury 現在の鏡のy座標
109 * @param curx 現在の鏡のx座標
111 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
113 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
114 int mirror_num = 0; /* 鏡の数 */
118 for (x = 0; x < cur_wid; x++)
120 for (y = 0; y < cur_hgt; y++)
122 if (is_mirror_grid(&cave[y][x])) {
123 mirror_y[mirror_num] = y;
124 mirror_x[mirror_num] = x;
131 num = randint0(mirror_num);
132 *next_y = mirror_y[num];
133 *next_x = mirror_x[num];
136 *next_y = cury + randint0(5) - 2;
137 *next_x = curx + randint0(5) - 2;
142 * @brief 万色表現用にランダムな色を選択する関数 /
143 * Get a legal "multi-hued" color for drawing "spells"
147 static byte mh_attr(int max)
149 switch (randint1(max))
151 case 1: return (TERM_RED);
152 case 2: return (TERM_GREEN);
153 case 3: return (TERM_BLUE);
154 case 4: return (TERM_YELLOW);
155 case 5: return (TERM_ORANGE);
156 case 6: return (TERM_VIOLET);
157 case 7: return (TERM_L_RED);
158 case 8: return (TERM_L_GREEN);
159 case 9: return (TERM_L_BLUE);
160 case 10: return (TERM_UMBER);
161 case 11: return (TERM_L_UMBER);
162 case 12: return (TERM_SLATE);
163 case 13: return (TERM_WHITE);
164 case 14: return (TERM_L_WHITE);
165 case 15: return (TERM_L_DARK);
173 * @brief 魔法属性に応じたエフェクトの色を返す /
174 * Return a color to use for the bolt/ball spells
178 static byte spell_color(int type)
180 /* Check if A.B.'s new graphics should be used (rr9) */
181 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
186 case GF_PSY_SPEAR: return (0x06);
187 case GF_MISSILE: return (0x0F);
188 case GF_ACID: return (0x04);
189 case GF_ELEC: return (0x02);
190 case GF_FIRE: return (0x00);
191 case GF_COLD: return (0x01);
192 case GF_POIS: return (0x03);
193 case GF_HOLY_FIRE: return (0x00);
194 case GF_HELL_FIRE: return (0x00);
195 case GF_MANA: return (0x0E);
197 case GF_SEEKER: return (0x0E);
198 case GF_SUPER_RAY: return (0x0E);
200 case GF_ARROW: return (0x0F);
201 case GF_WATER: return (0x04);
202 case GF_NETHER: return (0x07);
203 case GF_CHAOS: return (mh_attr(15));
204 case GF_DISENCHANT: return (0x05);
205 case GF_NEXUS: return (0x0C);
206 case GF_CONFUSION: return (mh_attr(4));
207 case GF_SOUND: return (0x09);
208 case GF_SHARDS: return (0x08);
209 case GF_FORCE: return (0x09);
210 case GF_INERTIAL: return (0x09);
211 case GF_GRAVITY: return (0x09);
212 case GF_TIME: return (0x09);
213 case GF_LITE_WEAK: return (0x06);
214 case GF_LITE: return (0x06);
215 case GF_DARK_WEAK: return (0x07);
216 case GF_DARK: return (0x07);
217 case GF_PLASMA: return (0x0B);
218 case GF_METEOR: return (0x00);
219 case GF_ICE: return (0x01);
220 case GF_ROCKET: return (0x0F);
221 case GF_DEATH_RAY: return (0x07);
222 case GF_NUKE: return (mh_attr(2));
223 case GF_DISINTEGRATE: return (0x05);
235 case GF_CAUSE_4: return (0x0E);
236 case GF_HAND_DOOM: return (0x07);
237 case GF_CAPTURE : return (0x0E);
238 case GF_IDENTIFY: return (0x01);
239 case GF_ATTACK: return (0x0F);
240 case GF_PHOTO : return (0x06);
243 /* Normal tiles or ASCII */
249 /* Lookup the default colors for this type */
250 cptr s = quark_str(gf_color[type]);
252 if (!s) return (TERM_WHITE);
254 /* Pick a random color */
255 c = s[randint0(strlen(s))];
257 /* Lookup this color */
258 a = my_strchr(color_char, c) - color_char;
260 /* Invalid color (note check for < 0 removed, gave a silly
261 * warning because bytes are always >= 0 -- RG) */
262 if (a > 15) return (TERM_WHITE);
268 /* Standard "color" */
274 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
275 * Find the attr/char pair to use for a spell effect
284 * It is moving (or has moved) from (x,y) to (nx,ny).
285 * If the distance is not "one", we (may) return "*".
288 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
298 if ((ny == y) && (nx == x)) base = 0x30;
301 else if (nx == x) base = 0x40;
304 else if (ny == y) base = 0x50;
307 else if ((ny - y) == (x - nx)) base = 0x60;
310 else if ((ny - y) == (nx - x)) base = 0x70;
315 /* Basic spell color */
316 k = spell_color(typ);
318 /* Obtain attr/char */
319 a = misc_to_attr[base + k];
320 c = misc_to_char[base + k];
328 * @brief 始点から終点への経路を返す /
329 * Determine the path taken by a projection.
330 * @param gp 経路座標リストを返す参照ポインタ
340 * The projection will always start from the grid (y1,x1), and will travel
341 * towards the grid (y2,x2), touching one grid per unit of distance along
342 * the major axis, and stopping when it enters the destination grid or a
343 * wall grid, or has travelled the maximum legal distance of "range".
345 * Note that "distance" in this function (as in the "update_view()" code)
346 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
347 * actually has an "octagon of projection" not a "circle of projection".
349 * The path grids are saved into the grid array pointed to by "gp", and
350 * there should be room for at least "range" grids in "gp". Note that
351 * due to the way in which distance is calculated, this function normally
352 * uses fewer than "range" grids for the projection path, so the result
353 * of this function should never be compared directly to "range". Note
354 * that the initial grid (y1,x1) is never saved into the grid array, not
355 * even if the initial grid is also the final grid.
357 * The "flg" flags can be used to modify the behavior of this function.
359 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
360 * semantics as they do for the "project" function, namely, that the path
361 * will stop as soon as it hits a monster, or that the path will continue
362 * through the destination grid, respectively.
364 * The "PROJECT_JUMP" flag, which for the "project()" function means to
365 * start at a special grid (which makes no sense in this function), means
366 * that the path should be "angled" slightly if needed to avoid any wall
367 * grids, allowing the player to "target" any grid which is in "view".
368 * This flag is non-trivial and has not yet been implemented, but could
369 * perhaps make use of the "vinfo" array (above).
371 * This function returns the number of grids (if any) in the path. This
372 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
374 * This algorithm is similar to, but slightly different from, the one used
375 * by "update_view_los()", and very different from the one used by "los()".
378 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
400 /* No path necessary (or allowed) */
401 if ((x1 == x2) && (y1 == y2)) return (0);
429 /* Number of "units" in one "half" grid */
432 /* Number of "units" in one "full" grid */
438 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
449 /* Advance (X) part 2 */
452 /* Advance (X) part 3 */
459 /* Create the projection path */
463 gp[n++] = GRID(y, x);
465 /* Hack -- Check maximum range */
466 if ((n + (k >> 1)) >= range) break;
468 /* Sometimes stop at destination grid */
469 if (!(flg & (PROJECT_THRU)))
471 if ((x == x2) && (y == y2)) break;
474 if (flg & (PROJECT_DISI))
476 if ((n > 0) && cave_stop_disintegration(y, x)) break;
478 else if (flg & (PROJECT_LOS))
480 if ((n > 0) && !cave_los_bold(y, x)) break;
482 else if (!(flg & (PROJECT_PATH)))
484 /* Always stop at non-initial wall grids */
485 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
488 /* Sometimes stop at non-initial monsters/players */
489 if (flg & (PROJECT_STOP))
492 (player_bold(y, x) || cave[y][x].m_idx != 0))
496 if (!in_bounds(y, x)) break;
501 /* Advance (X) part 1 */
504 /* Horizontal change */
507 /* Advance (X) part 2 */
510 /* Advance (X) part 3 */
526 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
535 /* Vertical change */
538 /* Advance (Y) part 2 */
541 /* Advance (Y) part 3 */
548 /* Create the projection path */
552 gp[n++] = GRID(y, x);
554 /* Hack -- Check maximum range */
555 if ((n + (k >> 1)) >= range) break;
557 /* Sometimes stop at destination grid */
558 if (!(flg & (PROJECT_THRU)))
560 if ((x == x2) && (y == y2)) break;
563 if (flg & (PROJECT_DISI))
565 if ((n > 0) && cave_stop_disintegration(y, x)) break;
567 else if (flg & (PROJECT_LOS))
569 if ((n > 0) && !cave_los_bold(y, x)) break;
571 else if (!(flg & (PROJECT_PATH)))
573 /* Always stop at non-initial wall grids */
574 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
577 /* Sometimes stop at non-initial monsters/players */
578 if (flg & (PROJECT_STOP))
581 (player_bold(y, x) || cave[y][x].m_idx != 0))
585 if (!in_bounds(y, x)) break;
590 /* Advance (Y) part 1 */
593 /* Vertical change */
596 /* Advance (Y) part 2 */
599 /* Advance (Y) part 3 */
619 /* Create the projection path */
623 gp[n++] = GRID(y, x);
625 /* Hack -- Check maximum range */
626 if ((n + (n >> 1)) >= range) break;
628 /* Sometimes stop at destination grid */
629 if (!(flg & (PROJECT_THRU)))
631 if ((x == x2) && (y == y2)) break;
634 if (flg & (PROJECT_DISI))
636 if ((n > 0) && cave_stop_disintegration(y, x)) break;
638 else if (flg & (PROJECT_LOS))
640 if ((n > 0) && !cave_los_bold(y, x)) break;
642 else if (!(flg & (PROJECT_PATH)))
644 /* Always stop at non-initial wall grids */
645 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
648 /* Sometimes stop at non-initial monsters/players */
649 if (flg & (PROJECT_STOP))
652 (player_bold(y, x) || cave[y][x].m_idx != 0))
656 if (!in_bounds(y, x)) break;
673 * Mega-Hack -- track "affected" monsters (see "project()" comments)
675 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
676 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
677 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
678 /* Mega-Hack -- monsters target */
679 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
680 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
684 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
685 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
686 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
687 * @param y 目標Y座標 / Target y location (or location to travel "towards")
688 * @param x 目標X座標 / Target x location (or location to travel "towards")
689 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
690 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
691 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
694 * We are called both for "beam" effects and "ball" effects.
696 * The "r" parameter is the "distance from ground zero".
698 * Note that we determine if the player can "see" anything that happens
699 * by taking into account: blindness, line-of-sight, and illumination.
701 * We return "TRUE" if the effect of the projection is "obvious".
703 * We also "see" grids which are "memorized", probably a hack
705 * Perhaps we should affect doors?
708 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
710 cave_type *c_ptr = &cave[y][x];
711 feature_type *f_ptr = &f_info[c_ptr->feat];
713 bool obvious = FALSE;
714 bool known = player_has_los_bold(y, x);
719 /* Reduce damage by distance */
720 dam = (dam + r) / (r + 1);
723 if (have_flag(f_ptr->flags, FF_TREE))
731 message = _("枯れた", "was blasted."); break;
733 message = _("縮んだ", "shrank."); break;
735 message = _("溶けた", "melted."); break;
738 message = _("凍り、砕け散った", "was frozen and smashed."); break;
742 message = _("燃えた", "burns up!"); break;
754 message = _("粉砕された", "was crushed."); break;
756 message = NULL; break;
760 msg_format(_("木は%s。", "A tree %s"), message);
761 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
764 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
768 /* Analyze the type */
771 /* Ignore most effects */
806 /* Destroy Traps (and Locks) */
809 /* Reveal secret doors */
810 if (is_hidden_door(c_ptr))
815 /* Check line of sight */
823 if (is_trap(c_ptr->feat))
825 /* Check line of sight */
828 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
832 /* Destroy the trap */
833 cave_alter_feat(y, x, FF_DISARM);
836 /* Locked doors are unlocked */
837 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
839 s16b old_feat = c_ptr->feat;
841 /* Unlock the door */
842 cave_alter_feat(y, x, FF_DISARM);
844 /* Check line of sound */
845 if (known && (old_feat != c_ptr->feat))
847 msg_print(_("カチッと音がした!", "Click!"));
852 /* Remove "unsafe" flag if player is not blind */
853 if (!p_ptr->blind && player_has_los_bold(y, x))
855 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
897 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
899 if (have_flag(f_ptr->flags, FF_SPIKE))
901 s16b old_mimic = c_ptr->mimic;
902 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
904 cave_alter_feat(y, x, FF_SPIKE);
906 c_ptr->mimic = old_mimic;
913 /* Check line of sight */
914 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
916 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
923 /* Destroy walls (and doors) */
926 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
928 if (known && (c_ptr->info & (CAVE_MARK)))
930 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
934 /* Destroy the wall */
935 cave_alter_feat(y, x, FF_HURT_ROCK);
937 /* Update some things */
938 p_ptr->update |= (PU_FLOW);
947 /* Require a "naked" floor grid */
948 if (!cave_naked_bold(y, x)) break;
950 /* Not on the player */
951 if (player_bold(y, x)) break;
953 /* Create a closed door */
954 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
957 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
974 /* Require a "naked" floor grid */
975 if (!cave_naked_bold(y, x)) break;
977 /* Not on the player */
978 if (player_bold(y, x)) break;
980 /* Create a closed door */
981 cave_set_feat(y, x, feat_tree);
984 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
992 /* Require a "naked" floor grid */
993 if (!cave_naked_bold(y, x)) break;
996 c_ptr->info |= CAVE_OBJECT;
997 c_ptr->mimic = feat_glyph;
1009 /* Require a "naked" floor grid */
1010 if (!cave_naked_bold(y, x)) break;
1012 /* Not on the player */
1013 if (player_bold(y, x)) break;
1016 cave_set_feat(y, x, feat_granite);
1024 /* Ignore permanent grid */
1025 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1030 /* Ignore grid without enough space */
1031 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1033 /* Place a shallow lava */
1034 cave_set_feat(y, x, feat_shallow_lava);
1039 /* Place a deep lava */
1040 cave_set_feat(y, x, feat_deep_lava);
1047 /* Ignore permanent grid */
1048 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1053 /* Ignore grid without enough space */
1054 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1056 /* Place a shallow water */
1057 cave_set_feat(y, x, feat_shallow_water);
1062 /* Place a deep water */
1063 cave_set_feat(y, x, feat_deep_water);
1068 /* Lite up the grid */
1072 /* Turn on the light */
1073 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1075 c_ptr->info |= (CAVE_GLOW);
1082 update_local_illumination(y, x);
1085 if (player_can_see_bold(y, x)) obvious = TRUE;
1087 /* Mega-Hack -- Update the monster in the affected grid */
1088 /* This allows "spear of light" (etc) to work "correctly" */
1089 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1091 if (p_ptr->special_defense & NINJA_S_STEALTH)
1093 if (player_bold(y, x)) set_superstealth(FALSE);
1100 /* Darken the grid */
1104 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1107 /* Turn off the light. */
1110 if (dun_level || !is_daytime())
1112 for (j = 0; j < 9; j++)
1114 int by = y + ddy_ddd[j];
1115 int bx = x + ddx_ddd[j];
1117 if (in_bounds2(by, bx))
1119 cave_type *cc_ptr = &cave[by][bx];
1121 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1129 if (!do_dark) break;
1132 c_ptr->info &= ~(CAVE_GLOW);
1134 /* Hack -- Forget "boring" grids */
1135 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1138 c_ptr->info &= ~(CAVE_MARK);
1146 update_local_illumination(y, x);
1148 if (player_can_see_bold(y, x)) obvious = TRUE;
1150 /* Mega-Hack -- Update the monster in the affected grid */
1151 /* This allows "spear of light" (etc) to work "correctly" */
1152 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1162 if (is_mirror_grid(c_ptr))
1164 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1166 remove_mirror(y, x);
1167 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1170 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1172 if (known && (c_ptr->info & CAVE_MARK))
1174 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1178 /* Destroy the wall */
1179 cave_alter_feat(y, x, FF_HURT_ROCK);
1181 /* Update some things */
1182 p_ptr->update |= (PU_FLOW);
1189 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1191 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1193 remove_mirror(y, x);
1194 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1197 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1199 if (known && (c_ptr->info & CAVE_MARK))
1201 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1205 /* Destroy the wall */
1206 cave_alter_feat(y, x, FF_HURT_ROCK);
1208 /* Update some things */
1209 p_ptr->update |= (PU_FLOW);
1214 case GF_DISINTEGRATE:
1216 /* Destroy mirror/glyph */
1217 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1218 remove_mirror(y, x);
1220 /* Permanent features don't get effect */
1221 /* But not protect monsters and other objects */
1222 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1224 cave_alter_feat(y, x, FF_HURT_DISI);
1226 /* Update some things -- similar to GF_KILL_WALL */
1227 p_ptr->update |= (PU_FLOW);
1234 /* Return "Anything seen?" */
1241 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1242 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1243 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1244 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1245 * @param x 目標X座標 / Target x location (or location to travel "towards")
1246 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1247 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1248 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1251 * We are called from "project()" to "damage" objects
1253 * We are called both for "beam" effects and "ball" effects.
1255 * Perhaps we should only SOMETIMES damage things on the ground.
1257 * The "r" parameter is the "distance from ground zero".
1259 * Note that we determine if the player can "see" anything that happens
1260 * by taking into account: blindness, line-of-sight, and illumination.
1262 * We also "see" grids which are "memorized", probably a hack
1264 * We return "TRUE" if the effect of the projection is "obvious".
1267 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1269 cave_type *c_ptr = &cave[y][x];
1271 OBJECT_IDX this_o_idx, next_o_idx = 0;
1273 bool obvious = FALSE;
1274 bool known = player_has_los_bold(y, x);
1276 BIT_FLAGS flgs[TR_FLAG_SIZE];
1278 char o_name[MAX_NLEN];
1280 KIND_OBJECT_IDX k_idx = 0;
1281 bool is_potion = FALSE;
1284 who = who ? who : 0;
1286 /* Reduce damage by distance */
1287 dam = (dam + r) / (r + 1);
1290 /* Scan all objects in the grid */
1291 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1293 /* Acquire object */
1294 object_type *o_ptr = &o_list[this_o_idx];
1296 bool is_art = FALSE;
1297 bool ignore = FALSE;
1298 bool do_kill = FALSE;
1300 cptr note_kill = NULL;
1303 /* Get the "plural"-ness */
1304 bool plural = (o_ptr->number > 1);
1307 /* Acquire next object */
1308 next_o_idx = o_ptr->next_o_idx;
1310 /* Extract the flags */
1311 object_flags(o_ptr, flgs);
1313 /* Check for artifact */
1314 if (object_is_artifact(o_ptr)) is_art = TRUE;
1316 /* Analyze the type */
1319 /* Acid -- Lots of things */
1322 if (hates_acid(o_ptr))
1325 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1326 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1331 /* Elec -- Rings and Wands */
1334 if (hates_elec(o_ptr))
1337 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1338 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1343 /* Fire -- Flammable objects */
1346 if (hates_fire(o_ptr))
1349 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1350 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1355 /* Cold -- potions and flasks */
1358 if (hates_cold(o_ptr))
1360 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1362 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1370 if (hates_fire(o_ptr))
1373 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1374 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1376 if (hates_elec(o_ptr))
1380 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1381 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1389 if (hates_fire(o_ptr))
1392 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1393 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1395 if (hates_cold(o_ptr))
1399 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1400 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1405 /* Hack -- break potions and such */
1411 if (hates_cold(o_ptr))
1413 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1419 /* Mana and Chaos -- destroy everything */
1425 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1429 case GF_DISINTEGRATE:
1432 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1439 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1440 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1441 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1445 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1449 if (object_is_cursed(o_ptr))
1452 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1459 identify_item(o_ptr);
1461 /* Auto-inscription */
1462 autopick_alter_item((-this_o_idx), FALSE);
1470 /* Chests are noticed only if trapped or locked */
1471 if (o_ptr->tval == TV_CHEST)
1473 /* Disarm/Unlock traps */
1474 if (o_ptr->pval > 0)
1476 /* Disarm or Unlock */
1477 o_ptr->pval = (0 - o_ptr->pval);
1480 object_known(o_ptr);
1482 if (known && (o_ptr->marked & OM_FOUND))
1484 msg_print(_("カチッと音がした!", "Click!"));
1494 if (o_ptr->tval == TV_CORPSE)
1497 BIT_FLAGS mode = 0L;
1499 if (!who || is_pet(&m_list[who]))
1500 mode |= PM_FORCE_PET;
1502 for (i = 0; i < o_ptr->number ; i++)
1504 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1505 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1509 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1513 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1515 note_kill = _("生き返った。", " revived.");
1517 else if (!note_kill)
1519 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1530 /* Attempt to destroy the object */
1533 /* Effect "observed" */
1534 if (known && (o_ptr->marked & OM_FOUND))
1537 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1540 /* Artifacts, and other objects, get to resist */
1541 if (is_art || ignore)
1543 /* Observe the resist */
1544 if (known && (o_ptr->marked & OM_FOUND))
1546 msg_format(_("%sは影響を受けない!",
1547 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1554 /* Describe if needed */
1555 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1557 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1560 k_idx = o_ptr->k_idx;
1561 is_potion = object_is_potion(o_ptr);
1562 delete_object_idx(this_o_idx);
1564 /* Potions produce effects when 'shattered' */
1567 (void)potion_smash_effect(who, y, x, k_idx);
1576 /* Return "Anything seen?" */
1582 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1583 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1584 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1585 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1586 * @param x 目標X座標 / Target x location (or location to travel "towards")
1587 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1588 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1590 * @param see_s_msg TRUEならばメッセージを表示する
1591 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1594 * This routine takes a "source monster" (by index) which is mostly used to
1595 * determine if the player is causing the damage, and a "radius" (see below),
1596 * which is used to decrease the power of explosions with distance, and a
1597 * location, via integers which are modified by certain types of attacks
1598 * (polymorph and teleport being the obvious ones), a default damage, which
1599 * is modified as needed based on various properties, and finally a "damage
1600 * type" (see below).
1603 * Note that this routine can handle "no damage" attacks (like teleport) by
1604 * taking a "zero" damage, and can even take "parameters" to attacks (like
1605 * confuse) by accepting a "damage", using it to calculate the effect, and
1606 * then setting the damage to zero. Note that the "damage" parameter is
1607 * divided by the radius, so monsters not at the "epicenter" will not take
1608 * as much damage (or whatever)...
1611 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1612 * may result in a dereference of an invalid pointer.
1615 * Various messages are produced, and damage is applied.
1618 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1619 * actually be "made" of that substance, or "breathe" big balls of it.
1620 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1622 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1623 * and hurts evil less. If can breath nether, then it resists it as well.
1626 * Damage reductions use the following formulas:
1627 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1628 * gives avg damage of .655, ranging from .858 to .500
1629 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1630 * gives avg damage of .544, ranging from .714 to .417
1631 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1632 * gives avg damage of .444, ranging from .556 to .333
1633 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1634 * gives avg damage of .327, ranging from .427 to .250
1635 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1636 * gives something simple.
1639 * In this function, "result" messages are postponed until the end, where
1640 * the "note" string is appended to the monster name, if not NULL. So,
1641 * to make a spell have "no effect" just set "note" to NULL. You should
1642 * also set "notice" to FALSE, or the player will learn what the spell does.
1645 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1649 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1653 cave_type *c_ptr = &cave[y][x];
1655 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1656 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1658 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1662 /* Is the monster "seen"? */
1663 bool seen = m_ptr->ml;
1664 bool seen_msg = is_seen(m_ptr);
1666 bool slept = (bool)MON_CSLEEP(m_ptr);
1668 /* Were the effects "obvious" (if seen)? */
1669 bool obvious = FALSE;
1671 /* Can the player know about this effect? */
1672 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1674 /* Were the effects "irrelevant"? */
1675 bool skipped = FALSE;
1677 /* Gets the monster angry at the source of the effect? */
1678 bool get_angry = FALSE;
1680 /* Polymorph setting (true or false) */
1681 bool do_poly = FALSE;
1683 /* Teleport setting (max distance) */
1686 /* Confusion setting (amount to confuse) */
1689 /* Stunning setting (amount to stun) */
1692 /* Sleep amount (amount to sleep) */
1695 /* Fear amount (amount to fear) */
1698 /* Time amount (amount to time) */
1701 bool heal_leper = FALSE;
1703 /* Hold the monster name */
1707 PARAMETER_VALUE photo = 0;
1709 /* Assume no note */
1712 /* Assume a default death */
1713 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1718 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1721 if (!c_ptr->m_idx) return (FALSE);
1723 /* Never affect projector */
1724 if (who && (c_ptr->m_idx == who)) return (FALSE);
1725 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1726 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1728 /* Don't affect already death monsters */
1729 /* Prevents problems with chain reactions of exploding monsters */
1730 if (m_ptr->hp < 0) return (FALSE);
1732 /* Reduce damage by distance */
1733 dam = (dam + r) / (r + 1);
1736 /* Get the monster name (BEFORE polymorphing) */
1737 monster_desc(m_name, m_ptr, 0);
1739 /* Get the monster possessive ("his"/"her"/"its") */
1740 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1742 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1744 /* Analyze the damage type */
1747 /* Magic Missile -- pure damage */
1750 if (seen) obvious = TRUE;
1752 if (r_ptr->flagsr & RFR_RES_ALL)
1754 note = _("には完全な耐性がある!", " is immune.");
1756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1765 if (seen) obvious = TRUE;
1767 if (r_ptr->flagsr & RFR_RES_ALL)
1769 note = _("には完全な耐性がある!", " is immune.");
1771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1774 if (r_ptr->flagsr & RFR_IM_ACID)
1776 note = _("にはかなり耐性がある!", " resists a lot.");
1778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1786 if (seen) obvious = TRUE;
1788 if (r_ptr->flagsr & RFR_RES_ALL)
1790 note = _("には完全な耐性がある!", " is immune.");
1792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1795 if (r_ptr->flagsr & RFR_IM_ELEC)
1797 note = _("にはかなり耐性がある!", " resists a lot.");
1799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1807 if (seen) obvious = TRUE;
1809 if (r_ptr->flagsr & RFR_RES_ALL)
1811 note = _("には完全な耐性がある!", " is immune.");
1813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1816 if (r_ptr->flagsr & RFR_IM_FIRE)
1818 note = _("にはかなり耐性がある!", " resists a lot.");
1820 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1822 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1824 note = _("はひどい痛手をうけた。", " is hit hard.");
1826 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1834 if (seen) obvious = TRUE;
1836 if (r_ptr->flagsr & RFR_RES_ALL)
1838 note = _("には完全な耐性がある!", " is immune.");
1840 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1843 if (r_ptr->flagsr & RFR_IM_COLD)
1845 note = _("にはかなり耐性がある!", " resists a lot.");
1847 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1849 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1851 note = _("はひどい痛手をうけた。", " is hit hard.");
1853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1861 if (seen) obvious = TRUE;
1863 if (r_ptr->flagsr & RFR_RES_ALL)
1865 note = _("には完全な耐性がある!", " is immune.");
1867 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1870 if (r_ptr->flagsr & RFR_IM_POIS)
1872 note = _("にはかなり耐性がある!", " resists a lot.");
1874 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1882 if (seen) obvious = TRUE;
1884 if (r_ptr->flagsr & RFR_RES_ALL)
1886 note = _("には完全な耐性がある!", " is immune.");
1888 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1891 if (r_ptr->flagsr & RFR_IM_POIS)
1893 note = _("には耐性がある。", " resists.");
1894 dam *= 3; dam /= randint1(6) + 6;
1895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1897 else if (one_in_(3)) do_poly = TRUE;
1901 /* Hellfire -- hurts Evil */
1904 if (seen) obvious = TRUE;
1906 if (r_ptr->flagsr & RFR_RES_ALL)
1908 note = _("には完全な耐性がある!", " is immune.");
1910 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1913 if (r_ptr->flags3 & RF3_GOOD)
1915 note = _("はひどい痛手をうけた。", " is hit hard.");
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1922 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1925 if (seen) obvious = TRUE;
1927 if (r_ptr->flagsr & RFR_RES_ALL)
1929 note = _("には完全な耐性がある!", " is immune.");
1931 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1934 if (r_ptr->flags3 & RF3_GOOD)
1936 note = _("には完全な耐性がある!", " is immune.");
1938 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1940 else if (r_ptr->flags3 & RF3_EVIL)
1943 note = _("はひどい痛手をうけた。", " is hit hard.");
1944 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1948 note = _("には耐性がある。", " resists.");
1949 dam *= 3; dam /= randint1(6) + 6;
1954 /* Arrow -- XXX no defense */
1957 if (seen) obvious = TRUE;
1959 if (r_ptr->flagsr & RFR_RES_ALL)
1961 note = _("には完全な耐性がある!", " is immune.");
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1969 /* Plasma -- XXX perhaps check ELEC or FIRE */
1972 if (seen) obvious = TRUE;
1974 if (r_ptr->flagsr & RFR_RES_ALL)
1976 note = _("には完全な耐性がある!", " is immune.");
1978 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1981 if (r_ptr->flagsr & RFR_RES_PLAS)
1983 note = _("には耐性がある。", " resists.");
1984 dam *= 3; dam /= randint1(6) + 6;
1985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1990 /* Nether -- see above */
1993 if (seen) obvious = TRUE;
1995 if (r_ptr->flagsr & RFR_RES_ALL)
1997 note = _("には完全な耐性がある!", " is immune.");
1999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2002 if (r_ptr->flagsr & RFR_RES_NETH)
2004 if (r_ptr->flags3 & RF3_UNDEAD)
2006 note = _("には完全な耐性がある!", " is immune.");
2008 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2012 note = _("には耐性がある。", " resists.");
2013 dam *= 3; dam /= randint1(6) + 6;
2015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2017 else if (r_ptr->flags3 & RF3_EVIL)
2019 note = _("はいくらか耐性を示した。", " resists somewhat.");
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2026 /* Water (acid) damage -- Water spirits/elementals are immune */
2029 if (seen) obvious = TRUE;
2031 if (r_ptr->flagsr & RFR_RES_ALL)
2033 note = _("には完全な耐性がある!", " is immune.");
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2038 if (r_ptr->flagsr & RFR_RES_WATE)
2040 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2042 note = _("には完全な耐性がある!", " is immune.");
2047 note = _("には耐性がある。", " resists.");
2048 dam *= 3; dam /= randint1(6) + 6;
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2055 /* Chaos -- Chaos breathers resist */
2058 if (seen) obvious = TRUE;
2060 if (r_ptr->flagsr & RFR_RES_ALL)
2062 note = _("には完全な耐性がある!", " is immune.");
2064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2067 if (r_ptr->flagsr & RFR_RES_CHAO)
2069 note = _("には耐性がある。", " resists.");
2070 dam *= 3; dam /= randint1(6) + 6;
2071 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2073 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2075 note = _("はいくらか耐性を示した。", " resists somewhat.");
2076 dam *= 3; dam /= randint1(6) + 6;
2077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2082 do_conf = (5 + randint1(11) + r) / (r + 1);
2087 /* Shards -- Shard breathers resist */
2090 if (seen) obvious = TRUE;
2092 if (r_ptr->flagsr & RFR_RES_ALL)
2094 note = _("には完全な耐性がある!", " is immune.");
2096 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2099 if (r_ptr->flagsr & RFR_RES_SHAR)
2101 note = _("には耐性がある。", " resists.");
2102 dam *= 3; dam /= randint1(6) + 6;
2103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2108 /* Rocket: Shard resistance helps */
2111 if (seen) obvious = TRUE;
2113 if (r_ptr->flagsr & RFR_RES_ALL)
2115 note = _("には完全な耐性がある!", " is immune.");
2117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2120 if (r_ptr->flagsr & RFR_RES_SHAR)
2122 note = _("はいくらか耐性を示した。", " resists somewhat.");
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2130 /* Sound -- Sound breathers resist */
2133 if (seen) obvious = TRUE;
2135 if (r_ptr->flagsr & RFR_RES_ALL)
2137 note = _("には完全な耐性がある!", " is immune.");
2139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2142 if (r_ptr->flagsr & RFR_RES_SOUN)
2144 note = _("には耐性がある。", " resists.");
2145 dam *= 2; dam /= randint1(6) + 6;
2146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2148 else do_stun = (10 + randint1(15) + r) / (r + 1);
2155 if (seen) obvious = TRUE;
2157 if (r_ptr->flagsr & RFR_RES_ALL)
2159 note = _("には完全な耐性がある!", " is immune.");
2161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2164 if (r_ptr->flags3 & RF3_NO_CONF)
2166 note = _("には耐性がある。", " resists.");
2167 dam *= 3; dam /= randint1(6) + 6;
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2170 else do_conf = (10 + randint1(15) + r) / (r + 1);
2174 /* Disenchantment -- Breathers and Disenchanters resist */
2177 if (seen) obvious = TRUE;
2179 if (r_ptr->flagsr & RFR_RES_ALL)
2181 note = _("には完全な耐性がある!", " is immune.");
2183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2186 if (r_ptr->flagsr & RFR_RES_DISE)
2188 note = _("には耐性がある。", " resists.");
2189 dam *= 3; dam /= randint1(6) + 6;
2190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2195 /* Nexus -- Breathers and Existers resist */
2198 if (seen) obvious = TRUE;
2200 if (r_ptr->flagsr & RFR_RES_ALL)
2202 note = _("には完全な耐性がある!", " is immune.");
2204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2207 if (r_ptr->flagsr & RFR_RES_NEXU)
2209 note = _("には耐性がある。", " resists.");
2210 dam *= 3; dam /= randint1(6) + 6;
2211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2219 if (seen) obvious = TRUE;
2221 if (r_ptr->flagsr & RFR_RES_ALL)
2223 note = _("には完全な耐性がある!", " is immune.");
2225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2228 if (r_ptr->flagsr & RFR_RES_WALL)
2230 note = _("には耐性がある。", " resists.");
2231 dam *= 3; dam /= randint1(6) + 6;
2232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2234 else do_stun = (randint1(15) + r) / (r + 1);
2238 /* Inertia -- breathers resist */
2241 if (seen) obvious = TRUE;
2243 if (r_ptr->flagsr & RFR_RES_ALL)
2245 note = _("には完全な耐性がある!", " is immune.");
2247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2250 if (r_ptr->flagsr & RFR_RES_INER)
2252 note = _("には耐性がある。", " resists.");
2253 dam *= 3; dam /= randint1(6) + 6;
2254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2258 /* Powerful monsters can resist */
2259 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2260 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2264 /* Normal monsters slow down */
2267 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2269 note = _("の動きが遅くなった。", " starts moving slower.");
2276 /* Time -- breathers resist */
2279 if (seen) obvious = TRUE;
2281 if (r_ptr->flagsr & RFR_RES_ALL)
2283 note = _("には完全な耐性がある!", " is immune.");
2285 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2288 if (r_ptr->flagsr & RFR_RES_TIME)
2290 note = _("には耐性がある。", " resists.");
2291 dam *= 3; dam /= randint1(6) + 6;
2292 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2294 else do_time = (dam + 1) / 2;
2298 /* Gravity -- breathers resist */
2301 bool resist_tele = FALSE;
2303 if (seen) obvious = TRUE;
2305 if (r_ptr->flagsr & RFR_RES_ALL)
2307 note = _("には完全な耐性がある!", " is immune.");
2309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2312 if (r_ptr->flagsr & RFR_RES_TELE)
2314 if (r_ptr->flags1 & (RF1_UNIQUE))
2316 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2317 note = _("には効果がなかった。", " is unaffected!");
2320 else if (r_ptr->level > randint1(100))
2322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2323 note = _("には耐性がある!", " resists!");
2328 if (!resist_tele) do_dist = 10;
2330 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2332 if (r_ptr->flagsr & RFR_RES_GRAV)
2334 note = _("には耐性がある!", " resists!");
2335 dam *= 3; dam /= randint1(6) + 6;
2337 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2342 /* Powerful monsters can resist */
2343 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2344 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2348 /* Normal monsters slow down */
2351 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2353 note = _("の動きが遅くなった。", " starts moving slower.");
2358 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2360 /* Attempt a saving throw */
2361 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2362 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2366 /* No obvious effect */
2367 note = _("には効果がなかった。", " is unaffected!");
2379 if (seen) obvious = TRUE;
2381 if (r_ptr->flagsr & RFR_RES_ALL)
2383 note = _("には完全な耐性がある!", " is immune.");
2385 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2393 case GF_DISINTEGRATE:
2395 if (seen) obvious = TRUE;
2397 if (r_ptr->flagsr & RFR_RES_ALL)
2399 note = _("には完全な耐性がある!", " is immune.");
2401 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2404 if (r_ptr->flags3 & RF3_HURT_ROCK)
2406 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2407 note = _("の皮膚がただれた!", " loses some skin!");
2408 note_dies = _("は蒸発した!", " evaporates!");
2416 if (seen) obvious = TRUE;
2418 /* PSI only works if the monster can see you! -- RG */
2419 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2422 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2427 if (r_ptr->flagsr & RFR_RES_ALL)
2429 note = _("には完全な耐性がある!", " is immune.");
2431 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2434 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2437 note = _("には完全な耐性がある!", " is immune.");
2438 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2441 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2442 (r_ptr->flags3 & RF3_ANIMAL) ||
2443 (r_ptr->level > randint1(3 * dam)))
2445 note = _("には耐性がある!", " resists!");
2449 * Powerful demons & undead can turn a mindcrafter's
2450 * attacks back on them
2452 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2453 (r_ptr->level > p_ptr->lev / 2) &&
2457 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2458 (seen ? "%^s's corrupted mind backlashes your attack!" :
2459 "%^ss corrupted mind backlashes your attack!")), m_name);
2462 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2464 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2468 /* Injure +/- confusion */
2469 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2470 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2471 if (one_in_(4) && !CHECK_MULTISHADOW())
2473 switch (randint1(4))
2476 set_confused(p_ptr->confused + 3 + randint1(dam));
2479 set_stun(p_ptr->stun + randint1(dam));
2483 if (r_ptr->flags3 & RF3_NO_FEAR)
2484 note = _("には効果がなかった。", " is unaffected.");
2486 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2490 if (!p_ptr->free_act)
2491 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2500 if ((dam > 0) && one_in_(4))
2502 switch (randint1(4))
2505 do_conf = 3 + randint1(dam);
2508 do_stun = 3 + randint1(dam);
2511 do_fear = 3 + randint1(dam);
2514 note = _("は眠り込んでしまった!", " falls asleep!");
2515 do_sleep = 3 + randint1(dam);
2520 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2526 if (seen) obvious = TRUE;
2528 if (r_ptr->flagsr & RFR_RES_ALL)
2530 note = _("には完全な耐性がある!", " is immune.");
2532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2535 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2538 note = _("には完全な耐性がある!", " is immune.");
2540 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2541 (r_ptr->flags3 & RF3_ANIMAL) ||
2542 (r_ptr->level > randint1(3 * dam)))
2544 note = _("には耐性がある!", " resists!");
2548 * Powerful demons & undead can turn a mindcrafter's
2549 * attacks back on them
2551 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2552 (r_ptr->level > p_ptr->lev / 2) &&
2556 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2557 (seen ? "%^s's corrupted mind backlashes your attack!" :
2558 "%^ss corrupted mind backlashes your attack!")), m_name);
2560 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2562 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2566 /* Injure + mana drain */
2567 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2568 if (!CHECK_MULTISHADOW())
2570 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2571 p_ptr->csp -= damroll(5, dam) / 2;
2572 if (p_ptr->csp < 0) p_ptr->csp = 0;
2573 p_ptr->redraw |= PR_MANA;
2574 p_ptr->window |= (PW_SPELL);
2576 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2583 int b = damroll(5, dam) / 4;
2584 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2585 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2586 (seen ? "You convert %s's pain into %s!" :
2587 "You convert %ss pain into %s!"));
2588 msg_format(msg, m_name, str);
2590 b = MIN(p_ptr->msp, p_ptr->csp + b);
2592 p_ptr->redraw |= PR_MANA;
2593 p_ptr->window |= (PW_SPELL);
2595 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2599 case GF_TELEKINESIS:
2601 if (seen) obvious = TRUE;
2603 if (r_ptr->flagsr & RFR_RES_ALL)
2605 note = _("には完全な耐性がある!", " is immune.");
2607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2612 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2617 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2619 /* Attempt a saving throw */
2620 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2621 (r_ptr->level > 5 + randint1(dam)))
2625 /* No obvious effect */
2631 /* Psycho-spear -- powerful magic missile */
2634 if (seen) obvious = TRUE;
2636 if (r_ptr->flagsr & RFR_RES_ALL)
2638 note = _("には完全な耐性がある!", " is immune.");
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2646 /* Meteor -- powerful magic missile */
2649 if (seen) obvious = TRUE;
2651 if (r_ptr->flagsr & RFR_RES_ALL)
2653 note = _("には完全な耐性がある!", " is immune.");
2655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2663 if (!is_hostile(m_ptr)) break;
2665 if (seen) obvious = TRUE;
2667 if (r_ptr->flagsr & RFR_RES_ALL)
2669 note = _("には効果がなかった!", " is immune.");
2671 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2674 /* Attempt a saving throw */
2675 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2676 (r_ptr->flags3 & RF3_NO_CONF) ||
2677 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2679 /* Memorize a flag */
2680 if (r_ptr->flags3 & RF3_NO_CONF)
2682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2689 * Powerful demons & undead can turn a mindcrafter's
2690 * attacks back on them
2692 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2693 (r_ptr->level > p_ptr->lev / 2) &&
2697 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2698 (seen ? "%^s's corrupted mind backlashes your attack!" :
2699 "%^ss corrupted mind backlashes your attack!")), m_name);
2702 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2704 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2708 /* Confuse, stun, terrify */
2709 switch (randint1(4))
2712 set_stun(p_ptr->stun + dam / 2);
2715 set_confused(p_ptr->confused + dam / 2);
2719 if (r_ptr->flags3 & RF3_NO_FEAR)
2720 note = _("には効果がなかった。", " is unaffected.");
2722 set_afraid(p_ptr->afraid + dam);
2729 /* No obvious effect */
2730 note = _("には効果がなかった。", " is unaffected.");
2736 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2738 note = _("があなたに隷属した。", " is in your thrall!");
2743 switch (randint1(4))
2757 /* No "real" damage */
2764 /* Ice -- Cold + Cuts + Stun */
2767 if (seen) obvious = TRUE;
2769 if (r_ptr->flagsr & RFR_RES_ALL)
2771 note = _("には完全な耐性がある!", " is immune.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2776 do_stun = (randint1(15) + 1) / (r + 1);
2777 if (r_ptr->flagsr & RFR_IM_COLD)
2779 note = _("にはかなり耐性がある!", " resists a lot.");
2781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2783 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2785 note = _("はひどい痛手をうけた。", " is hit hard.");
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2794 case GF_HYPODYNAMIA:
2796 if (seen) obvious = TRUE;
2798 if (r_ptr->flagsr & RFR_RES_ALL)
2800 note = _("には完全な耐性がある!", " is immune.");
2802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2805 if (!monster_living(r_ptr))
2807 if (is_original_ap_and_seen(m_ptr))
2809 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2810 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2811 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2813 note = _("には効果がなかった。", " is unaffected.");
2817 else do_time = (dam+7)/8;
2825 if (seen) obvious = TRUE;
2827 if (r_ptr->flagsr & RFR_RES_ALL)
2829 note = _("には完全な耐性がある!", " is immune.");
2831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2834 if (!monster_living(r_ptr))
2836 if (is_original_ap_and_seen(m_ptr))
2838 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2839 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2840 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2842 note = _("には完全な耐性がある!", " is immune.");
2846 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2847 (randint1(888) != 666)) ||
2848 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2849 randint1(100) != 66))
2851 note = _("には耐性がある!", " resists!");
2859 /* Polymorph monster (Use "dam" as "power") */
2862 if (seen) obvious = TRUE;
2864 if (r_ptr->flagsr & RFR_RES_ALL)
2866 note = _("には効果がなかった。", " is unaffected.");
2868 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2871 /* Attempt to polymorph (see below) */
2874 /* Powerful monsters can resist */
2875 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2876 (r_ptr->flags1 & RF1_QUESTOR) ||
2877 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2879 note = _("には効果がなかった。", " is unaffected.");
2884 /* No "real" damage */
2891 /* Clone monsters (Ignore "dam") */
2894 if (seen) obvious = TRUE;
2896 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2898 note = _("には効果がなかった。", " is unaffected.");
2903 m_ptr->hp = m_ptr->maxhp;
2905 /* Attempt to clone. */
2906 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2908 note = _("が分裂した!", " spawns!");
2912 /* No "real" damage */
2919 /* Heal Monster (use "dam" as amount of healing) */
2922 if (seen) obvious = TRUE;
2925 (void)set_monster_csleep(c_ptr->m_idx, 0);
2927 if (m_ptr->maxhp < m_ptr->max_maxhp)
2929 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2930 m_ptr->maxhp = m_ptr->max_maxhp;
2935 /* Redraw (later) if needed */
2936 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2937 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2945 if (seen) obvious = TRUE;
2948 (void)set_monster_csleep(c_ptr->m_idx, 0);
2949 if (MON_STUNNED(m_ptr))
2951 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2952 (void)set_monster_stunned(c_ptr->m_idx, 0);
2954 if (MON_CONFUSED(m_ptr))
2956 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2957 (void)set_monster_confused(c_ptr->m_idx, 0);
2959 if (MON_MONFEAR(m_ptr))
2961 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2962 (void)set_monster_monfear(c_ptr->m_idx, 0);
2966 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2969 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2973 chg_virtue(V_VITALITY, 1);
2975 if (r_ptr->flags1 & RF1_UNIQUE)
2976 chg_virtue(V_INDIVIDUALISM, 1);
2978 if (is_friendly(m_ptr))
2979 chg_virtue(V_HONOUR, 1);
2980 else if (!(r_ptr->flags3 & RF3_EVIL))
2982 if (r_ptr->flags3 & RF3_GOOD)
2983 chg_virtue(V_COMPASSION, 2);
2985 chg_virtue(V_COMPASSION, 1);
2988 if (r_ptr->flags3 & RF3_ANIMAL)
2989 chg_virtue(V_NATURE, 1);
2992 if (m_ptr->r_idx == MON_LEPER)
2995 if (!who) chg_virtue(V_COMPASSION, 5);
2998 /* Redraw (later) if needed */
2999 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3000 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3002 note = _("は体力を回復したようだ。", " looks healthier.");
3004 /* No "real" damage */
3010 /* Speed Monster (Ignore "dam") */
3013 if (seen) obvious = TRUE;
3016 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3018 note = _("の動きが速くなった。", " starts moving faster.");
3023 if (r_ptr->flags1 & RF1_UNIQUE)
3024 chg_virtue(V_INDIVIDUALISM, 1);
3025 if (is_friendly(m_ptr))
3026 chg_virtue(V_HONOUR, 1);
3029 /* No "real" damage */
3035 /* Slow Monster (Use "dam" as "power") */
3038 if (seen) obvious = TRUE;
3040 if (r_ptr->flagsr & RFR_RES_ALL)
3042 note = _("には効果がなかった。", " is unaffected.");
3044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3047 /* Powerful monsters can resist */
3048 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3049 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3051 note = _("には効果がなかった。", " is unaffected.");
3055 /* Normal monsters slow down */
3058 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3060 note = _("の動きが遅くなった。", " starts moving slower.");
3064 /* No "real" damage */
3070 /* Sleep (Use "dam" as "power") */
3073 if (seen) obvious = TRUE;
3075 if (r_ptr->flagsr & RFR_RES_ALL)
3077 note = _("には効果がなかった。", " is unaffected.");
3079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3082 /* Attempt a saving throw */
3083 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3084 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3085 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3087 /* Memorize a flag */
3088 if (r_ptr->flags3 & RF3_NO_SLEEP)
3090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3092 /* No obvious effect */
3093 note = _("には効果がなかった。", " is unaffected.");
3098 /* Go to sleep (much) later */
3099 note = _("は眠り込んでしまった!", " falls asleep!");
3103 /* No "real" damage */
3109 /* Sleep (Use "dam" as "power") */
3110 case GF_STASIS_EVIL:
3112 if (seen) obvious = TRUE;
3114 if (r_ptr->flagsr & RFR_RES_ALL)
3116 note = _("には効果がなかった!", " is immune.");
3118 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3121 /* Attempt a saving throw */
3122 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3123 !(r_ptr->flags3 & RF3_EVIL) ||
3124 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3126 note = _("には効果がなかった。", " is unaffected.");
3131 /* Go to sleep (much) later */
3132 note = _("は動けなくなった!", " is suspended!");
3136 /* No "real" damage */
3141 /* Sleep (Use "dam" as "power") */
3144 if (seen) obvious = TRUE;
3146 if (r_ptr->flagsr & RFR_RES_ALL)
3148 note = _("には効果がなかった。", " is unaffected.");
3150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3153 /* Attempt a saving throw */
3154 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3155 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3157 note = _("には効果がなかった。", " is unaffected.");
3162 /* Go to sleep (much) later */
3163 note = _("は動けなくなった!", " is suspended!");
3167 /* No "real" damage */
3176 vir = virtue_number(V_HARMONY);
3179 dam += p_ptr->virtues[vir-1]/10;
3182 vir = virtue_number(V_INDIVIDUALISM);
3185 dam -= p_ptr->virtues[vir-1]/20;
3188 if (seen) obvious = TRUE;
3190 /* Attempt a saving throw */
3191 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3195 /* No obvious effect */
3196 note = _("には効果がなかった。", " is unaffected.");
3199 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3201 else if (p_ptr->cursed & TRC_AGGRAVATE)
3203 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3204 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3208 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3211 chg_virtue(V_INDIVIDUALISM, -1);
3212 if (r_ptr->flags3 & RF3_ANIMAL)
3213 chg_virtue(V_NATURE, 1);
3216 /* No "real" damage */
3221 /* Control undead */
3222 case GF_CONTROL_UNDEAD:
3225 if (seen) obvious = TRUE;
3227 vir = virtue_number(V_UNLIFE);
3230 dam += p_ptr->virtues[vir-1]/10;
3233 vir = virtue_number(V_INDIVIDUALISM);
3236 dam -= p_ptr->virtues[vir-1]/20;
3239 /* Attempt a saving throw */
3240 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3241 !(r_ptr->flags3 & RF3_UNDEAD))
3243 /* No obvious effect */
3244 note = _("には効果がなかった。", " is unaffected.");
3246 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3248 else if (p_ptr->cursed & TRC_AGGRAVATE)
3250 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3251 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3255 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3259 /* No "real" damage */
3265 case GF_CONTROL_DEMON:
3268 if (seen) obvious = TRUE;
3270 vir = virtue_number(V_UNLIFE);
3273 dam += p_ptr->virtues[vir-1]/10;
3276 vir = virtue_number(V_INDIVIDUALISM);
3279 dam -= p_ptr->virtues[vir-1]/20;
3282 /* Attempt a saving throw */
3283 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3284 !(r_ptr->flags3 & RF3_DEMON))
3286 /* No obvious effect */
3287 note = _("には効果がなかった。", " is unaffected.");
3289 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3291 else if (p_ptr->cursed & TRC_AGGRAVATE)
3293 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3294 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3298 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3302 /* No "real" damage */
3308 case GF_CONTROL_ANIMAL:
3311 if (seen) obvious = TRUE;
3313 vir = virtue_number(V_NATURE);
3316 dam += p_ptr->virtues[vir-1]/10;
3319 vir = virtue_number(V_INDIVIDUALISM);
3322 dam -= p_ptr->virtues[vir-1]/20;
3325 /* Attempt a saving throw */
3326 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3327 !(r_ptr->flags3 & RF3_ANIMAL))
3330 /* No obvious effect */
3331 note = _("には効果がなかった。", " is unaffected.");
3333 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3335 else if (p_ptr->cursed & TRC_AGGRAVATE)
3337 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3338 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3342 note = _("はなついた。", " is tamed!");
3344 if (r_ptr->flags3 & RF3_ANIMAL)
3345 chg_virtue(V_NATURE, 1);
3348 /* No "real" damage */
3354 case GF_CHARM_LIVING:
3358 vir = virtue_number(V_UNLIFE);
3359 if (seen) obvious = TRUE;
3361 vir = virtue_number(V_UNLIFE);
3364 dam -= p_ptr->virtues[vir-1]/10;
3367 vir = virtue_number(V_INDIVIDUALISM);
3370 dam -= p_ptr->virtues[vir-1]/20;
3373 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3375 /* Attempt a saving throw */
3376 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3377 !monster_living(r_ptr))
3380 /* No obvious effect */
3381 note = _("には効果がなかった。", " is unaffected.");
3383 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3385 else if (p_ptr->cursed & TRC_AGGRAVATE)
3387 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3388 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3392 note = _("を支配した。", " is tamed!");
3394 if (r_ptr->flags3 & RF3_ANIMAL)
3395 chg_virtue(V_NATURE, 1);
3398 /* No "real" damage */
3403 /* Confusion (Use "dam" as "power") */
3406 if (seen) obvious = TRUE;
3408 if (r_ptr->flagsr & RFR_RES_ALL)
3410 note = _("には効果がなかった。", " is unaffected.");
3412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3415 /* Get confused later */
3416 do_conf = damroll(3, (dam / 2)) + 1;
3418 /* Attempt a saving throw */
3419 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3420 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3421 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3423 /* Memorize a flag */
3424 if (r_ptr->flags3 & (RF3_NO_CONF))
3426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3432 /* No obvious effect */
3433 note = _("には効果がなかった。", " is unaffected.");
3437 /* No "real" damage */
3444 if (seen) obvious = TRUE;
3446 if (r_ptr->flagsr & RFR_RES_ALL)
3448 note = _("には効果がなかった。", " is unaffected.");
3450 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3453 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3455 /* Attempt a saving throw */
3456 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3457 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3462 /* No obvious effect */
3463 note = _("には効果がなかった。", " is unaffected.");
3467 /* No "real" damage */
3475 /* Lite, but only hurts susceptible creatures */
3483 if (r_ptr->flagsr & RFR_RES_ALL)
3489 if (r_ptr->flags3 & (RF3_HURT_LITE))
3491 /* Obvious effect */
3492 if (seen) obvious = TRUE;
3494 /* Memorize the effects */
3495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3497 /* Special effect */
3498 note = _("は光に身をすくめた!", " cringes from the light!");
3499 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3502 /* Normally no damage */
3514 /* Lite -- opposite of Dark */
3517 if (seen) obvious = TRUE;
3519 if (r_ptr->flagsr & RFR_RES_ALL)
3521 note = _("には完全な耐性がある!", " is immune.");
3523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3526 if (r_ptr->flagsr & RFR_RES_LITE)
3528 note = _("には耐性がある!", " resists!");
3529 dam *= 2; dam /= (randint1(6)+6);
3530 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3532 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3535 note = _("は光に身をすくめた!", " cringes from the light!");
3536 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3543 /* Dark -- opposite of Lite */
3546 if (seen) obvious = TRUE;
3548 if (r_ptr->flagsr & RFR_RES_ALL)
3550 note = _("には完全な耐性がある!", " is immune.");
3552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3555 if (r_ptr->flagsr & RFR_RES_DARK)
3557 note = _("には耐性がある!", " resists!");
3558 dam *= 2; dam /= (randint1(6)+6);
3559 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3568 if (r_ptr->flagsr & RFR_RES_ALL)
3573 /* Hurt by rock remover */
3574 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3577 if (seen) obvious = TRUE;
3579 /* Memorize the effects */
3580 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3582 /* Cute little message */
3583 note = _("の皮膚がただれた!", " loses some skin!");
3584 note_dies = _("はドロドロに溶けた!", " dissolves!");
3587 /* Usually, ignore the effects */
3598 /* Teleport undead (Use "dam" as "power") */
3599 case GF_AWAY_UNDEAD:
3601 /* Only affect undead */
3602 if (r_ptr->flags3 & (RF3_UNDEAD))
3604 bool resists_tele = FALSE;
3606 if (r_ptr->flagsr & RFR_RES_TELE)
3608 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3611 note = _("には効果がなかった。", " is unaffected.");
3612 resists_tele = TRUE;
3614 else if (r_ptr->level > randint1(100))
3616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3617 note = _("には耐性がある!", " resists!");
3618 resists_tele = TRUE;
3624 if (seen) obvious = TRUE;
3625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3637 /* No "real" damage */
3643 /* Teleport evil (Use "dam" as "power") */
3646 /* Only affect evil */
3647 if (r_ptr->flags3 & (RF3_EVIL))
3649 bool resists_tele = FALSE;
3651 if (r_ptr->flagsr & RFR_RES_TELE)
3653 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3656 note = _("には効果がなかった。", " is unaffected.");
3657 resists_tele = TRUE;
3659 else if (r_ptr->level > randint1(100))
3661 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3662 note = _("には耐性がある!", " resists!");
3663 resists_tele = TRUE;
3669 if (seen) obvious = TRUE;
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3682 /* No "real" damage */
3688 /* Teleport monster (Use "dam" as "power") */
3691 bool resists_tele = FALSE;
3692 if (r_ptr->flagsr & RFR_RES_TELE)
3694 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3697 note = _("には効果がなかった。", " is unaffected.");
3698 resists_tele = TRUE;
3700 else if (r_ptr->level > randint1(100))
3702 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3703 note = _("には耐性がある!", " resists!");
3704 resists_tele = TRUE;
3710 if (seen) obvious = TRUE;
3712 /* Prepare to teleport */
3716 /* No "real" damage */
3722 /* Turn undead (Use "dam" as "power") */
3723 case GF_TURN_UNDEAD:
3725 if (r_ptr->flagsr & RFR_RES_ALL)
3730 /* Only affect undead */
3731 if (r_ptr->flags3 & (RF3_UNDEAD))
3733 if (seen) obvious = TRUE;
3735 /* Learn about type */
3736 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3738 /* Apply some fear */
3739 do_fear = damroll(3, (dam / 2)) + 1;
3741 /* Attempt a saving throw */
3742 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3744 /* No obvious effect */
3745 note = _("には効果がなかった。", " is unaffected.");
3758 /* No "real" damage */
3764 /* Turn evil (Use "dam" as "power") */
3767 if (r_ptr->flagsr & RFR_RES_ALL)
3772 /* Only affect evil */
3773 if (r_ptr->flags3 & (RF3_EVIL))
3775 if (seen) obvious = TRUE;
3777 /* Learn about type */
3778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3780 /* Apply some fear */
3781 do_fear = damroll(3, (dam / 2)) + 1;
3783 /* Attempt a saving throw */
3784 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3786 /* No obvious effect */
3787 note = _("には効果がなかった。", " is unaffected.");
3800 /* No "real" damage */
3806 /* Turn monster (Use "dam" as "power") */
3809 if (r_ptr->flagsr & RFR_RES_ALL)
3814 if (seen) obvious = TRUE;
3816 /* Apply some fear */
3817 do_fear = damroll(3, (dam / 2)) + 1;
3819 /* Attempt a saving throw */
3820 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3821 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3822 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3824 /* No obvious effect */
3825 note = _("には効果がなかった。", " is unaffected.");
3830 /* No "real" damage */
3837 case GF_DISP_UNDEAD:
3839 if (r_ptr->flagsr & RFR_RES_ALL)
3845 /* Only affect undead */
3846 if (r_ptr->flags3 & (RF3_UNDEAD))
3848 if (seen) obvious = TRUE;
3850 /* Learn about type */
3851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3853 note = _("は身震いした。", " shudders.");
3854 note_dies = _("はドロドロに溶けた!", " dissolves!");
3874 if (r_ptr->flagsr & RFR_RES_ALL)
3880 /* Only affect evil */
3881 if (r_ptr->flags3 & (RF3_EVIL))
3883 if (seen) obvious = TRUE;
3885 /* Learn about type */
3886 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3888 note = _("は身震いした。", " shudders.");
3889 note_dies = _("はドロドロに溶けた!", " dissolves!");
3908 if (r_ptr->flagsr & RFR_RES_ALL)
3914 /* Only affect good */
3915 if (r_ptr->flags3 & (RF3_GOOD))
3917 if (seen) obvious = TRUE;
3919 /* Learn about type */
3920 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3922 note = _("は身震いした。", " shudders.");
3923 note_dies = _("はドロドロに溶けた!", " dissolves!");
3940 case GF_DISP_LIVING:
3942 if (r_ptr->flagsr & RFR_RES_ALL)
3948 /* Only affect non-undead */
3949 if (monster_living(r_ptr))
3951 if (seen) obvious = TRUE;
3953 note = _("は身震いした。", " shudders.");
3954 note_dies = _("はドロドロに溶けた!", " dissolves!");
3973 if (r_ptr->flagsr & RFR_RES_ALL)
3979 /* Only affect demons */
3980 if (r_ptr->flags3 & (RF3_DEMON))
3982 if (seen) obvious = TRUE;
3984 /* Learn about type */
3985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3987 note = _("は身震いした。", " shudders.");
3988 note_dies = _("はドロドロに溶けた!", " dissolves!");
4004 /* Dispel monster */
4007 if (r_ptr->flagsr & RFR_RES_ALL)
4013 if (seen) obvious = TRUE;
4015 note = _("は身震いした。", " shudders.");
4016 note_dies = _("はドロドロに溶けた!", " dissolves!");
4023 if (seen) obvious = TRUE;
4025 if (r_ptr->flagsr & RFR_RES_ALL)
4027 note = _("には完全な耐性がある!", " is immune.");
4029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4033 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4037 /* Heal the monster */
4038 if (caster_ptr->hp < caster_ptr->maxhp)
4041 caster_ptr->hp += dam;
4042 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4044 /* Redraw (later) if needed */
4045 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4046 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4048 /* Special message */
4051 /* Get the monster name */
4052 monster_desc(killer, caster_ptr, 0);
4053 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4059 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4060 (void)hp_player(dam);
4065 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4074 if (seen) obvious = TRUE;
4075 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4077 if (r_ptr->flagsr & RFR_RES_ALL)
4079 note = _("には完全な耐性がある!", " is immune.");
4081 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4085 /* Attempt a saving throw */
4086 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4087 (r_ptr->flags3 & RF3_NO_CONF) ||
4088 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4090 /* Memorize a flag */
4091 if (r_ptr->flags3 & (RF3_NO_CONF))
4093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4095 note = _("には効果がなかった。", " is unaffected.");
4098 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4101 note = _("には完全な耐性がある!", " is immune.");
4104 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4107 note = _("には耐性がある。", " resists.");
4112 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4113 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4115 if (who > 0) do_conf = randint0(4) + 4;
4116 else do_conf = randint0(8) + 8;
4122 case GF_BRAIN_SMASH:
4124 if (seen) obvious = TRUE;
4125 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4127 if (r_ptr->flagsr & RFR_RES_ALL)
4129 note = _("には完全な耐性がある!", " is immune.");
4131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4135 /* Attempt a saving throw */
4136 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4137 (r_ptr->flags3 & RF3_NO_CONF) ||
4138 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4140 /* Memorize a flag */
4141 if (r_ptr->flags3 & (RF3_NO_CONF))
4143 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4145 note = _("には効果がなかった。", " is unaffected.");
4148 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4151 note = _("には完全な耐性がある!", " is immune.");
4154 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4156 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4157 note = _("には耐性がある!", " resists!");
4162 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4163 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4167 do_conf = randint0(4) + 4;
4168 do_stun = randint0(4) + 4;
4172 do_conf = randint0(8) + 8;
4173 do_stun = randint0(8) + 8;
4175 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4183 if (seen) obvious = TRUE;
4184 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4186 if (r_ptr->flagsr & RFR_RES_ALL)
4188 note = _("には完全な耐性がある!", " is immune.");
4190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4194 /* Attempt a saving throw */
4195 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4197 note = _("には効果がなかった。", " is unaffected.");
4206 if (seen) obvious = TRUE;
4207 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4209 if (r_ptr->flagsr & RFR_RES_ALL)
4211 note = _("には完全な耐性がある!", " is immune.");
4213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4217 /* Attempt a saving throw */
4218 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4220 note = _("には効果がなかった。", " is unaffected.");
4229 if (seen) obvious = TRUE;
4230 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4232 if (r_ptr->flagsr & RFR_RES_ALL)
4234 note = _("には完全な耐性がある!", " is immune.");
4236 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4240 /* Attempt a saving throw */
4241 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4243 note = _("には効果がなかった。", " is unaffected.");
4252 if (seen) obvious = TRUE;
4254 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4255 "You point at %s, screaming the word, 'DIE!'."), m_name);
4257 if (r_ptr->flagsr & RFR_RES_ALL)
4259 note = _("には完全な耐性がある!", " is immune.");
4261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4265 /* Attempt a saving throw */
4266 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4268 note = _("には効果がなかった。", " is unaffected.");
4277 if (seen) obvious = TRUE;
4279 if (r_ptr->flagsr & RFR_RES_ALL)
4281 note = _("には完全な耐性がある!", " is immune.");
4283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4287 if (r_ptr->flags1 & RF1_UNIQUE)
4289 note = _("には効果がなかった。", " is unaffected.");
4294 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4295 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4297 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4299 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4303 note = _("は耐性を持っている!", "resists!");
4310 /* Capture monster */
4314 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4315 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
4317 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4322 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4323 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4324 nokori_hp = m_ptr->maxhp * 3 / 10;
4326 nokori_hp = m_ptr->maxhp * 3 / 20;
4328 if (m_ptr->hp >= nokori_hp)
4330 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4333 else if (m_ptr->hp < randint0(nokori_hp))
4335 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4336 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4337 cap_mon = m_ptr->r_idx;
4338 cap_mspeed = m_ptr->mspeed;
4340 cap_maxhp = m_ptr->max_maxhp;
4341 cap_nickname = m_ptr->nickname; /* Quark transfer */
4342 if (c_ptr->m_idx == p_ptr->riding)
4344 if (rakuba(-1, FALSE))
4346 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4350 delete_monster_idx(c_ptr->m_idx);
4356 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4362 /* Attack (Use "dam" as attack type) */
4365 /* Return this monster's death */
4366 return py_attack(y, x, dam);
4369 /* Sleep (Use "dam" as "power") */
4375 if (seen) obvious = TRUE;
4377 if (r_ptr->flagsr & RFR_RES_ALL)
4379 note = _("には効果がなかった。", " is unaffected.");
4381 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4384 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4386 note = _("には効果がなかった。", " is unaffected.");
4389 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4392 if (MON_CSLEEP(m_ptr))
4394 note = _("には効果がなかった。", " is unaffected.");
4400 if (one_in_(5)) effect = 1;
4401 else if (one_in_(4)) effect = 2;
4402 else if (one_in_(3)) effect = 3;
4407 /* Powerful monsters can resist */
4408 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4409 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4411 note = _("には効果がなかった。", " is unaffected.");
4415 /* Normal monsters slow down */
4418 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4420 note = _("の動きが遅くなった。", " starts moving slower.");
4425 else if (effect == 2)
4427 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4429 /* Attempt a saving throw */
4430 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4431 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4436 /* No obvious effect */
4437 note = _("には効果がなかった。", " is unaffected.");
4442 else if (effect == 3)
4444 /* Attempt a saving throw */
4445 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4446 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4447 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4449 /* Memorize a flag */
4450 if (r_ptr->flags3 & RF3_NO_SLEEP)
4452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4455 /* No obvious effect */
4456 note = _("には効果がなかった。", " is unaffected.");
4461 /* Go to sleep (much) later */
4462 note = _("は眠り込んでしまった!", " falls asleep!");
4469 note = _("には効果がなかった。", " is unaffected.");
4472 /* No "real" damage */
4480 if (seen) obvious = TRUE;
4482 if (r_ptr->flagsr & RFR_RES_ALL)
4484 note = _("には効果がなかった。", " is unaffected.");
4486 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4490 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4492 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4493 chg_virtue(V_VITALITY, -1);
4503 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4505 if (r_ptr->flags3 & (RF3_HURT_LITE))
4507 /* Obvious effect */
4508 if (seen) obvious = TRUE;
4510 /* Memorize the effects */
4511 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4513 /* Special effect */
4514 note = _("は光に身をすくめた!", " cringes from the light!");
4515 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4518 /* Normally no damage */
4525 photo = m_ptr->r_idx;
4532 case GF_BLOOD_CURSE:
4534 if (seen) obvious = TRUE;
4536 if (r_ptr->flagsr & RFR_RES_ALL)
4538 note = _("には完全な耐性がある!", " is immune.");
4540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4548 bool success = FALSE;
4549 if (seen) obvious = TRUE;
4551 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4553 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4554 if (dam < 1) dam = 1;
4556 /* No need to tame your pet */
4559 note = _("の動きが速くなった。", " starts moving faster.");
4560 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4564 /* Attempt a saving throw */
4565 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4566 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4567 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4568 (p_ptr->cursed & TRC_AGGRAVATE) ||
4569 ((r_ptr->level+10) > randint1(dam)))
4572 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4576 note = _("を支配した。", " is tamed!");
4578 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4580 /* Learn about type */
4581 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4588 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4590 do_fear = randint1(90)+10;
4592 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4595 /* No "real" damage */
4602 if (seen) obvious = TRUE;
4604 if (r_ptr->flagsr & RFR_RES_ALL)
4606 note = _("には完全な耐性がある!", " is immune.");
4608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4612 /* Attempt a saving throw */
4613 if (randint0(100 + dam) < (r_ptr->level + 50))
4615 note = _("には効果がなかった。", " is unaffected.");
4635 /* Absolutely no effect */
4636 if (skipped) return (FALSE);
4638 /* "Unique" monsters cannot be polymorphed */
4639 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4641 /* Quest monsters cannot be polymorphed */
4642 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4644 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4646 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4647 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4649 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4654 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4655 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4658 /* Modify the damage */
4660 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4661 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4663 /* Check for death */
4664 if (dam > m_ptr->hp)
4666 /* Extract method of death */
4671 /* Sound and Impact resisters never stun */
4673 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4674 !(r_ptr->flags3 & RF3_NO_STUN))
4676 if (seen) obvious = TRUE;
4679 if (MON_STUNNED(m_ptr))
4681 note = _("はひどくもうろうとした。", " is more dazed.");
4682 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4686 note = _("はもうろうとした。", " is dazed.");
4691 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4697 /* Confusion and Chaos resisters (and sleepers) never confuse */
4699 !(r_ptr->flags3 & RF3_NO_CONF) &&
4700 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4702 if (seen) obvious = TRUE;
4704 /* Already partially confused */
4705 if (MON_CONFUSED(m_ptr))
4707 note = _("はさらに混乱したようだ。", " looks more confused.");
4708 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4711 /* Was not confused */
4714 note = _("は混乱したようだ。", " looks confused.");
4718 /* Apply confusion */
4719 (void)set_monster_confused(c_ptr->m_idx, tmp);
4727 if (seen) obvious = TRUE;
4729 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4733 note = _("は弱くなったようだ。", " seems weakened.");
4734 m_ptr->maxhp -= do_time;
4735 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4740 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4741 if (do_poly && (randint1(90) > r_ptr->level))
4743 if (polymorph_monster(y, x))
4745 if (seen) obvious = TRUE;
4747 /* Monster polymorphs */
4748 note = _("が変身した!", " changes!");
4750 /* Turn off the damage */
4756 note = _("には効果がなかった。", " is unaffected.");
4759 /* Hack -- Get new monster */
4760 m_ptr = &m_list[c_ptr->m_idx];
4762 /* Hack -- Get new race */
4763 r_ptr = &r_info[m_ptr->r_idx];
4766 /* Handle "teleport" */
4769 if (seen) obvious = TRUE;
4771 note = _("が消え去った!", " disappears!");
4773 if (!who) chg_virtue(V_VALOUR, -1);
4776 teleport_away(c_ptr->m_idx, do_dist,
4777 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4779 /* Hack -- get new location */
4783 /* Hack -- get new grid */
4784 c_ptr = &cave[y][x];
4791 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4798 if (typ == GF_DRAIN_MANA)
4800 /* Drain mana does nothing */
4803 /* If another monster did the damage, hurt the monster by hand */
4806 /* Redraw (later) if needed */
4807 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4808 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4810 /* Wake the monster up */
4811 (void)set_monster_csleep(c_ptr->m_idx, 0);
4813 /* Hurt the monster */
4821 if (is_pet(m_ptr) && !(m_ptr->ml))
4824 /* Give detailed messages if destroyed */
4827 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4830 msg_format("%^s%s", m_name, note);
4838 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4840 /* Generate treasure, etc */
4841 monster_death(c_ptr->m_idx, FALSE);
4844 delete_monster_idx(c_ptr->m_idx);
4848 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4852 /* Damaged monster */
4855 /* Give detailed messages if visible or destroyed */
4856 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4858 /* Hack -- Pain message */
4861 message_pain(c_ptr->m_idx, dam);
4868 /* Hack -- handle sleep */
4869 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4873 else if (heal_leper)
4875 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4877 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4881 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4882 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4885 delete_monster_idx(c_ptr->m_idx);
4888 /* If the player did it, give him experience, check fear */
4893 /* Hurt the monster, check for fear and death */
4894 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4899 /* Damaged monster */
4902 /* HACK - anger the monster before showing the sleep message */
4903 if (do_sleep) anger_monster(m_ptr);
4905 /* Give detailed messages if visible or destroyed */
4906 if (note && seen_msg)
4907 msg_format(_("%s%s", "%^s%s"), m_name, note);
4909 /* Hack -- Pain message */
4910 else if (known && (dam || !do_fear))
4912 message_pain(c_ptr->m_idx, dam);
4915 /* Anger monsters */
4916 if (((dam > 0) || get_angry) && !do_sleep)
4917 anger_monster(m_ptr);
4920 if ((fear || do_fear) && seen)
4924 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4927 /* Hack -- handle sleep */
4928 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4932 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4934 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4938 switch (randint1(28))
4943 msg_print(_("地面が揺れた...", "The ground trembles..."));
4944 earthquake(ty, tx, 4 + randint0(4));
4945 if (!one_in_(6)) break;
4947 case 3: case 4: case 5: case 6:
4950 int extra_dam = damroll(10, 10);
4951 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4953 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4954 if (!one_in_(6)) break;
4959 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4961 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4962 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4963 if (!one_in_(6)) break;
4965 case 9: case 10: case 11:
4966 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4967 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4968 if (!one_in_(6)) break;
4969 case 12: case 13: case 14: case 15: case 16:
4970 aggravate_monsters(0);
4971 if (!one_in_(6)) break;
4973 count += activate_hi_summon(ty, tx, TRUE);
4974 if (!one_in_(6)) break;
4975 case 19: case 20: case 21: case 22:
4977 bool pet = !one_in_(3);
4978 BIT_FLAGS mode = PM_ALLOW_GROUP;
4980 if (pet) mode |= PM_FORCE_PET;
4981 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4983 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
4984 if (!one_in_(6)) break;
4986 case 23: case 24: case 25:
4987 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4988 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4990 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4991 else lose_exp(p_ptr->exp / 16);
4992 if (!one_in_(6)) break;
4993 case 26: case 27: case 28:
5002 (void)do_dec_stat(i);
5011 (void)do_dec_stat(randint0(6));
5020 if (p_ptr->inside_battle)
5022 p_ptr->health_who = c_ptr->m_idx;
5023 p_ptr->redraw |= (PR_HEALTH);
5027 /* Verify this code */
5028 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5030 /* Redraw the monster grid */
5034 /* Update monster recall window */
5035 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5037 p_ptr->window |= (PW_MONSTER);
5040 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5044 if (!(flg & PROJECT_NO_HANGEKI))
5046 set_target(m_ptr, monster_target_y, monster_target_x);
5049 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5051 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5055 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5057 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5058 rakubadam_m = (dam > 200) ? 200 : dam;
5067 /* Get local object */
5070 /* Prepare to make a Blade of Chaos */
5071 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5073 q_ptr->pval = photo;
5075 /* Mark the item as fully known */
5076 q_ptr->ident |= (IDENT_MENTAL);
5078 /* Drop it in the dungeon */
5079 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5087 /* Return "Anything seen?" */
5092 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5093 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5094 * @param who_name 効果を起こしたモンスターの名前
5095 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5096 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5097 * @param x 目標X座標 / Target x location (or location to travel "towards")
5098 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5099 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5101 * @param monspell 効果元のモンスター魔法ID
5102 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5104 * Handle a beam/bolt/ball causing damage to the player.
5105 * This routine takes a "source monster" (by index), a "distance", a default
5106 * "damage", and a "damage type". See "project_m()" above.
5107 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5108 * is reduced (see "project_m()" above). This can happen if a monster breathes
5109 * at the player and hits a wall instead.
5110 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5111 * to know if this is actually a ball or a bolt spell
5112 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5113 * we just assume that the effects were obvious, for historical reasons.
5115 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)
5120 /* Hack -- assume obvious */
5121 bool obvious = TRUE;
5123 /* Player blind-ness */
5124 bool blind = (p_ptr->blind ? TRUE : FALSE);
5126 /* Player needs a "description" (he is blind) */
5129 /* Source monster */
5130 monster_type *m_ptr = NULL;
5132 /* Monster name (for attacks) */
5135 /* Monster name (for damage) */
5138 /* Hack -- messages */
5144 /* Player is not here */
5145 if (!player_bold(y, x)) return (FALSE);
5147 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5149 if (kawarimi(TRUE)) return FALSE;
5152 /* Player cannot hurt himself */
5153 if (!who) return (FALSE);
5154 if (who == p_ptr->riding) return (FALSE);
5156 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5159 int max_attempts = 10;
5160 sound(SOUND_REFLECT);
5163 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5164 else if (p_ptr->special_defense & KATA_FUUJIN)
5165 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5167 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5170 /* Choose 'new' target */
5175 t_y = m_list[who].fy - 1 + randint1(3);
5176 t_x = m_list[who].fx - 1 + randint1(3);
5179 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5181 if (max_attempts < 1)
5183 t_y = m_list[who].fy;
5184 t_x = m_list[who].fx;
5189 t_y = p_ptr->y - 1 + randint1(3);
5190 t_x = p_ptr->x - 1 + randint1(3);
5193 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5195 disturb(TRUE, TRUE);
5199 /* Limit maximum damage */
5200 if (dam > 1600) dam = 1600;
5202 /* Reduce damage by distance */
5203 dam = (dam + r) / (r + 1);
5206 /* If the player is blind, be more descriptive */
5207 if (blind) fuzzy = TRUE;
5212 /* Get the source monster */
5213 m_ptr = &m_list[who];
5214 /* Extract the monster level */
5215 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5217 /* Get the monster name */
5218 monster_desc(m_name, m_ptr, 0);
5220 /* Get the monster's real name (gotten before polymorph!) */
5221 strcpy(killer, who_name);
5227 case PROJECT_WHO_UNCTRL_POWER:
5228 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5231 case PROJECT_WHO_GLASS_SHARDS:
5232 strcpy(killer, _("ガラスの破片", "shards of glass"));
5236 strcpy(killer, _("罠", "a trap"));
5241 strcpy(m_name, killer);
5244 /* Analyze the damage */
5247 /* Standard damage -- hurts inventory too */
5250 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5251 get_damage = acid_dam(dam, killer, monspell, FALSE);
5255 /* Standard damage -- hurts inventory too */
5258 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5259 get_damage = fire_dam(dam, killer, monspell, FALSE);
5263 /* Standard damage -- hurts inventory too */
5266 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5267 get_damage = cold_dam(dam, killer, monspell, FALSE);
5271 /* Standard damage -- hurts inventory too */
5274 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5275 get_damage = elec_dam(dam, killer, monspell, FALSE);
5279 /* Standard damage -- also poisons player */
5282 bool double_resist = IS_OPPOSE_POIS();
5283 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5285 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5286 if (double_resist) dam = (dam + 2) / 3;
5288 if ((!(double_resist || p_ptr->resist_pois)) &&
5289 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5294 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5296 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5298 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5303 /* Standard damage -- also poisons / mutates player */
5306 bool double_resist = IS_OPPOSE_POIS();
5307 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5309 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5310 if (double_resist) dam = (2 * dam + 2) / 5;
5311 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5312 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5314 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5316 if (one_in_(5)) /* 6 */
5318 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5319 if (one_in_(4)) /* 4 */
5327 inven_damage(set_acid_destroy, 2);
5333 /* Standard damage */
5336 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5337 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5341 /* Holy Orb -- Player only takes partial damage */
5344 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5345 if (p_ptr->align > 10)
5347 else if (p_ptr->align < -10)
5349 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5355 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5356 if (p_ptr->align > 10)
5358 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5362 /* Arrow -- XXX no dodging */
5367 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5369 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5371 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5374 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5378 /* Plasma -- XXX No resist */
5381 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5382 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5384 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5386 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5387 (void)set_stun(p_ptr->stun + plus_stun);
5390 if (!(p_ptr->resist_fire ||
5392 p_ptr->immune_fire))
5394 inven_damage(set_acid_destroy, 3);
5400 /* Nether -- drain experience */
5403 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5404 if (p_ptr->resist_neth)
5406 if (!prace_is_(RACE_SPECTRE))
5408 dam *= 6; dam /= (randint1(4) + 7);
5411 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5413 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5415 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5417 learn_spell(monspell);
5421 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5427 /* Water -- stun/confuse */
5430 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5431 if (!CHECK_MULTISHADOW())
5433 if (!p_ptr->resist_sound)
5435 set_stun(p_ptr->stun + randint1(40));
5437 if (!p_ptr->resist_conf)
5439 set_confused(p_ptr->confused + randint1(5) + 5);
5444 inven_damage(set_cold_destroy, 3);
5448 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5452 /* Chaos -- many effects */
5455 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5456 if (p_ptr->resist_chaos)
5458 dam *= 6; dam /= (randint1(4) + 7);
5461 if (!CHECK_MULTISHADOW())
5463 if (!p_ptr->resist_conf)
5465 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5467 if (!p_ptr->resist_chaos)
5469 (void)set_image(p_ptr->image + randint1(10));
5472 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5473 (void)gain_random_mutation(0);
5476 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5478 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5481 if (!p_ptr->resist_chaos || one_in_(9))
5483 inven_damage(set_elec_destroy, 2);
5484 inven_damage(set_fire_destroy, 2);
5488 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5492 /* Shards -- mostly cutting */
5495 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5496 if (p_ptr->resist_shard)
5498 dam *= 6; dam /= (randint1(4) + 7);
5500 else if (!CHECK_MULTISHADOW())
5502 (void)set_cut(p_ptr->cut + dam);
5505 if (!p_ptr->resist_shard || one_in_(13))
5507 inven_damage(set_cold_destroy, 2);
5510 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5514 /* Sound -- mostly stunning */
5517 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5518 if (p_ptr->resist_sound)
5520 dam *= 5; dam /= (randint1(4) + 7);
5522 else if (!CHECK_MULTISHADOW())
5524 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5525 (void)set_stun(p_ptr->stun + plus_stun);
5528 if (!p_ptr->resist_sound || one_in_(13))
5530 inven_damage(set_cold_destroy, 2);
5533 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5537 /* Pure confusion */
5540 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5541 if (p_ptr->resist_conf)
5543 dam *= 5; dam /= (randint1(4) + 7);
5545 else if (!CHECK_MULTISHADOW())
5547 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5549 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5553 /* Disenchantment -- see above */
5556 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5557 if (p_ptr->resist_disen)
5559 dam *= 6; dam /= (randint1(4) + 7);
5561 else if (!CHECK_MULTISHADOW())
5563 (void)apply_disenchant(0);
5565 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5569 /* Nexus -- see above */
5572 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5573 if (p_ptr->resist_nexus)
5575 dam *= 6; dam /= (randint1(4) + 7);
5577 else if (!CHECK_MULTISHADOW())
5581 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5585 /* Force -- mostly stun */
5588 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5589 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5591 (void)set_stun(p_ptr->stun + randint1(20));
5593 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5598 /* Rocket -- stun, cut */
5601 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5602 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5604 (void)set_stun(p_ptr->stun + randint1(20));
5607 if (p_ptr->resist_shard)
5611 else if (!CHECK_MULTISHADOW())
5613 (void)set_cut(p_ptr->cut + (dam / 2));
5616 if (!p_ptr->resist_shard || one_in_(12))
5618 inven_damage(set_cold_destroy, 3);
5621 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5625 /* Inertia -- slowness */
5628 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5629 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5630 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5634 /* Lite -- blinding */
5637 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5638 if (p_ptr->resist_lite)
5640 dam *= 4; dam /= (randint1(4) + 7);
5642 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5644 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5647 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5649 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5652 else if (prace_is_(RACE_S_FAIRY))
5657 if (p_ptr->wraith_form) dam *= 2;
5658 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5660 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5662 p_ptr->wraith_form = 0;
5663 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5664 "The light forces you out of your incorporeal shadow form."));
5666 p_ptr->redraw |= PR_MAP;
5667 /* Update monsters */
5668 p_ptr->update |= (PU_MONSTERS);
5669 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5671 /* Redraw status bar */
5672 p_ptr->redraw |= (PR_STATUS);
5679 /* Dark -- blinding */
5682 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5683 if (p_ptr->resist_dark)
5685 dam *= 4; dam /= (randint1(4) + 7);
5687 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5689 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5691 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5693 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5697 /* Time -- bolt fewer effects XXX */
5700 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5701 if (p_ptr->resist_time)
5704 dam /= (randint1(4) + 7);
5705 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5707 else if (!CHECK_MULTISHADOW())
5709 switch (randint1(10))
5711 case 1: case 2: case 3: case 4: case 5:
5713 if (p_ptr->prace == RACE_ANDROID) break;
5714 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5715 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5719 case 6: case 7: case 8: case 9:
5721 switch (randint1(6))
5723 case 1: k = A_STR; act = _("強く", "strong"); break;
5724 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5725 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5726 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5727 case 5: k = A_CON; act = _("健康で", "hale"); break;
5728 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5731 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5732 "You're not as %s as you used to be..."), act);
5734 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5735 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5736 p_ptr->update |= (PU_BONUS);
5742 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5743 "You're not as powerful as you used to be..."));
5745 for (k = 0; k < 6; k++)
5747 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5748 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5750 p_ptr->update |= (PU_BONUS);
5756 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5760 /* Gravity -- stun plus slowness plus teleport */
5763 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5764 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5766 if (!CHECK_MULTISHADOW())
5768 teleport_player(5, TELEPORT_PASSIVE);
5769 if (!p_ptr->levitation)
5770 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5771 if (!(p_ptr->resist_sound || p_ptr->levitation))
5773 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5774 (void)set_stun(p_ptr->stun + plus_stun);
5777 if (p_ptr->levitation)
5779 dam = (dam * 2) / 3;
5782 if (!p_ptr->levitation || one_in_(13))
5784 inven_damage(set_cold_destroy, 2);
5787 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5791 /* Standard damage */
5792 case GF_DISINTEGRATE:
5794 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5796 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5802 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5804 (void)hp_player(dam);
5811 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5812 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5819 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5820 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5826 if (p_ptr->free_act) break;
5827 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5829 if (ironman_nightmare)
5831 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5832 /* Have some nightmares */
5833 sanity_blast(NULL, FALSE);
5836 set_paralyzed(p_ptr->paralyzed + dam);
5846 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5847 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5854 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5855 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5862 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5864 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5865 if (!p_ptr->resist_shard || one_in_(13))
5867 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5868 inven_damage(set_cold_destroy, 2);
5874 /* Ice -- cold plus stun plus cuts */
5877 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5878 get_damage = cold_dam(dam, killer, monspell, FALSE);
5879 if (!CHECK_MULTISHADOW())
5881 if (!p_ptr->resist_shard)
5883 (void)set_cut(p_ptr->cut + damroll(5, 8));
5885 if (!p_ptr->resist_sound)
5887 (void)set_stun(p_ptr->stun + randint1(15));
5890 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5892 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5902 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5904 if (p_ptr->mimic_form)
5906 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5907 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5912 switch (p_ptr->prace)
5914 /* Some races are immune */
5928 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5940 if (CHECK_MULTISHADOW())
5942 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5944 else if (p_ptr->csp)
5948 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5950 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5953 if (dam >= p_ptr->csp)
5957 p_ptr->csp_frac = 0;
5966 learn_spell(monspell);
5969 p_ptr->redraw |= (PR_MANA);
5971 p_ptr->window |= (PW_PLAYER);
5972 p_ptr->window |= (PW_SPELL);
5976 /* Heal the monster */
5977 if (m_ptr->hp < m_ptr->maxhp)
5981 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5983 /* Redraw (later) if needed */
5984 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5985 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5987 /* Special message */
5990 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6003 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6005 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6006 learn_spell(monspell);
6010 if (!CHECK_MULTISHADOW())
6012 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6014 if (!p_ptr->resist_conf)
6016 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6019 if (!p_ptr->resist_chaos && one_in_(3))
6021 (void)set_image(p_ptr->image + randint0(250) + 150);
6028 p_ptr->csp_frac = 0;
6030 p_ptr->redraw |= PR_MANA;
6033 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6039 case GF_BRAIN_SMASH:
6041 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6043 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6044 learn_spell(monspell);
6048 if (!CHECK_MULTISHADOW())
6050 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6056 p_ptr->csp_frac = 0;
6058 p_ptr->redraw |= PR_MANA;
6061 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6062 if (!CHECK_MULTISHADOW())
6064 if (!p_ptr->resist_blind)
6066 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6068 if (!p_ptr->resist_conf)
6070 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6072 if (!p_ptr->free_act)
6074 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6076 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6078 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6079 (void)do_dec_stat(A_INT);
6080 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6081 (void)do_dec_stat(A_WIS);
6083 if (!p_ptr->resist_chaos)
6085 (void)set_image(p_ptr->image + randint0(250) + 150);
6095 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6097 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6098 learn_spell(monspell);
6102 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6103 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6111 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6113 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6114 learn_spell(monspell);
6118 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6119 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6127 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6129 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6130 learn_spell(monspell);
6134 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6135 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6143 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6145 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6146 learn_spell(monspell);
6150 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6151 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6159 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6161 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6162 learn_spell(monspell);
6166 if (!CHECK_MULTISHADOW())
6168 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6169 curse_equipment(40, 20);
6172 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6174 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6189 /* Hex - revenge damage stored */
6190 revenge_store(get_damage);
6192 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6193 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6195 char m_name_self[80];
6198 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6200 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6201 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6202 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6205 if (p_ptr->riding && dam > 0)
6207 rakubadam_p = (dam > 200) ? 200 : dam;
6211 disturb(TRUE, TRUE);
6214 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6216 (void)kawarimi(FALSE);
6219 /* Return "Anything seen?" */
6225 * Find the distance from (x, y) to a line.
6227 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6229 /* Vector from (x, y) to (x1, y1) */
6230 POSITION py = y1 - y;
6231 POSITION px = x1 - x;
6234 POSITION ny = x2 - x1;
6235 POSITION nx = y1 - y2;
6238 POSITION pd = distance(y1, x1, y, x);
6239 POSITION nd = distance(y1, x1, y2, x2);
6241 if (pd > nd) return distance(y, x, y2, x2);
6243 /* Component of P on N */
6244 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6246 /* Absolute value */
6247 return((nd >= 0) ? nd : 0 - nd);
6254 * Modified version of los() for calculation of disintegration balls.
6255 * Disintegration effects are stopped by permanent walls.
6257 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6277 /* Slope, or 1/Slope, of LOS */
6281 /* Extract the offset */
6285 /* Extract the absolute offset */
6290 /* Handle adjacent (or identical) grids */
6291 if ((ax < 2) && (ay < 2)) return (TRUE);
6294 /* Paranoia -- require "safe" origin */
6295 /* if (!in_bounds(y1, x1)) return (FALSE); */
6298 /* Directly South/North */
6301 /* South -- check for walls */
6304 for (ty = y1 + 1; ty < y2; ty++)
6306 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6310 /* North -- check for walls */
6313 for (ty = y1 - 1; ty > y2; ty--)
6315 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6323 /* Directly East/West */
6326 /* East -- check for walls */
6329 for (tx = x1 + 1; tx < x2; tx++)
6331 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6335 /* West -- check for walls */
6338 for (tx = x1 - 1; tx > x2; tx--)
6340 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6349 /* Extract some signs */
6350 sx = (dx < 0) ? -1 : 1;
6351 sy = (dy < 0) ? -1 : 1;
6354 /* Vertical "knights" */
6359 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6363 /* Horizontal "knights" */
6368 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6373 /* Calculate scale factor div 2 */
6376 /* Calculate scale factor */
6380 /* Travel horizontally */
6383 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6389 /* Consider the special case where slope == 1. */
6400 /* Note (below) the case (qy == f2), where */
6401 /* the LOS exactly meets the corner of a tile. */
6404 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6415 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6428 /* Travel vertically */
6431 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6447 /* Note (below) the case (qx == f2), where */
6448 /* the LOS exactly meets the corner of a tile. */
6451 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6462 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6483 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)
6488 int brev = rad * rad / dist;
6492 int mdis = distance(y1, x1, y2, x2) + rad;
6494 while (bdis <= mdis)
6498 if ((0 < dist) && (path_n < dist))
6500 POSITION ny = GRID_Y(path_g[path_n]);
6501 POSITION nx = GRID_X(path_g[path_n]);
6502 POSITION nd = distance(ny, nx, y1, x1);
6504 /* Get next base point */
6513 /* Travel from center outward */
6514 for (cdis = 0; cdis <= brad; cdis++)
6516 /* Scan the maximal blast area of radius "cdis" */
6517 for (y = by - cdis; y <= by + cdis; y++)
6519 for (x = bx - cdis; x <= bx + cdis; x++)
6521 /* Ignore "illegal" locations */
6522 if (!in_bounds(y, x)) continue;
6524 /* Enforce a circular "ripple" */
6525 if (distance(y1, x1, y, x) != bdis) continue;
6527 /* Enforce an arc */
6528 if (distance(by, bx, y, x) != cdis) continue;
6534 /* Lights are stopped by opaque terrains */
6535 if (!los(by, bx, y, x)) continue;
6537 case GF_DISINTEGRATE:
6538 /* Disintegration are stopped only by perma-walls */
6539 if (!in_disintegration_range(by, bx, y, x)) continue;
6542 /* Ball explosions are stopped by walls */
6543 if (!projectable(by, bx, y, x)) continue;
6547 /* Save this grid */
6555 /* Encode some more "radius" info */
6556 gm[bdis + 1] = *pgrids;
6558 /* Increase the size */
6559 brad = rad * (path_n + brev) / (dist + brev);
6561 /* Find the next ripple */
6565 /* Store the effect size */
6571 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6572 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6573 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6574 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6575 * @param x 目標X座標 / Target x location (or location to travel "towards")
6576 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6577 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6578 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6579 * @param monspell 効果元のモンスター魔法ID
6580 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6583 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6584 * towards a given location (optionally passing over the heads of interposing
6585 * monsters), and have it do a given amount of damage to the monsters (and
6586 * optionally objects) within the given radius of the final location.
6588 * A "bolt" travels from source to target and affects only the target grid.
6589 * A "beam" travels from source to target, affecting all grids passed through.
6590 * A "ball" travels from source to the target, exploding at the target, and
6591 * affecting everything within the given radius of the target location.
6593 * Traditionally, a "bolt" does not affect anything on the ground, and does
6594 * not pass over the heads of interposing monsters, much like a traditional
6595 * missile, and will "stop" abruptly at the "target" even if no monster is
6596 * positioned there, while a "ball", on the other hand, passes over the heads
6597 * of monsters between the source and target, and affects everything except
6598 * the source monster which lies within the final radius, while a "beam"
6599 * affects every monster between the source and target, except for the casting
6600 * monster (or player), and rarely affects things on the ground.
6602 * Two special flags allow us to use this function in special ways, the
6603 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6604 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6605 * actually projecting from the source monster (or player).
6607 * The player will only get "experience" for monsters killed by himself
6608 * Unique monsters can only be destroyed by attacks from the player
6610 * Only 256 grids can be affected per projection, limiting the effective
6611 * "radius" of standard ball attacks to nine units (diameter nineteen).
6613 * One can project in a given "direction" by combining PROJECT_THRU with small
6614 * offsets to the initial location (see "line_spell()"), or by calculating
6615 * "virtual targets" far away from the player.
6617 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6618 * continuing until it actually hits somethings (useful for "stone to mud").
6620 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6622 * Balls must explode BEFORE hitting walls, or they would affect monsters
6623 * on both sides of a wall. Some bug reports indicate that this is still
6624 * happening in 2.7.8 for Windows, though it appears to be impossible.
6626 * We "pre-calculate" the blast area only in part for efficiency.
6627 * More importantly, this lets us do "explosions" from the "inside" out.
6628 * This results in a more logical distribution of "blast" treasure.
6629 * It also produces a better (in my opinion) animation of the explosion.
6630 * It could be (but is not) used to have the treasure dropped by monsters
6631 * in the middle of the explosion fall "outwards", and then be damaged by
6632 * the blast as it spreads outwards towards the treasure drop location.
6634 * Walls and doors are included in the blast area, so that they can be
6635 * "burned" or "melted" in later versions.
6637 * This algorithm is intended to maximize simplicity, not necessarily
6638 * efficiency, since this function is not a bottleneck in the code.
6640 * We apply the blast effect from ground zero outwards, in several passes,
6641 * first affecting features, then objects, then monsters, then the player.
6642 * This allows walls to be removed before checking the object or monster
6643 * in the wall, and protects objects which are dropped by monsters killed
6644 * in the blast, and allows the player to see all affects before he is
6645 * killed or teleported away. The semantics of this method are open to
6646 * various interpretations, but they seem to work well in practice.
6648 * We process the blast area from ground-zero outwards to allow for better
6649 * distribution of treasure dropped by monsters, and because it provides a
6650 * pleasing visual effect at low cost.
6652 * Note that the damage done by "ball" explosions decreases with distance.
6653 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6655 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6656 * the target, and then the damage "flows" along this beam of destruction.
6657 * The damage at every grid is the same as at the "center" of a "ball"
6658 * explosion, since the "beam" grids are treated as if they ARE at the
6659 * center of a "ball" explosion.
6661 * Currently, specifying "beam" plus "ball" means that locations which are
6662 * covered by the initial "beam", and also covered by the final "ball", except
6663 * for the final grid (the epicenter of the ball), will be "hit twice", once
6664 * by the initial beam, and once by the exploding ball. For the grid right
6665 * next to the epicenter, this results in 150% damage being done. The center
6666 * does not have this problem, for the same reason the final grid in a "beam"
6667 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6668 * grids which are covered by the "ball" will NOT work, as then they will
6669 * receive LESS damage than they should. Do not combine "beam" with "ball".
6671 * The array "gy[],gx[]" with current size "grids" is used to hold the
6672 * collected locations of all grids in the "blast area" plus "beam path".
6674 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6675 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6676 * first blast grid (see above) with radius "N" from the blast center. Note
6677 * that only the first gm[1] grids in the blast area thus take full damage.
6678 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6679 * number of blast grids.
6681 * Note that once the projection is complete, (y2,x2) holds the final location
6682 * of bolts/beams, and the "epicenter" of balls.
6684 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6685 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6686 * implementation of the "distance" function. Also, a bolt can be properly
6687 * viewed as a "ball" with a "rad" of "zero".
6689 * Note that if no "target" is reached before the beam/bolt/ball travels the
6690 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6691 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6693 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6694 * to move from point A to point B, even if the player cannot see part of the
6695 * projection path. Note that in general, the player will *always* see part
6696 * of the path, since it either starts at the player or ends on the player.
6698 * Hack -- we assume that every "projection" is "self-illuminating".
6700 * Hack -- when only a single monster is affected, we automatically track
6701 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6703 * Note that all projections now "explode" at their final destination, even
6704 * if they were being projected at a more distant destination. This means
6705 * that "ball" spells will *always* explode.
6707 * Note that we must call "handle_stuff()" after affecting terrain features
6708 * in the blast radius, in case the "illumination" of the grid was changed,
6709 * and "update_view()" and "update_monsters()" need to be called.
6712 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6722 POSITION y_saver, x_saver; /* For reflecting monsters */
6724 int msec = delay_factor * delay_factor * delay_factor;
6726 /* Assume the player sees nothing */
6727 bool notice = FALSE;
6729 /* Assume the player has seen nothing */
6730 bool visual = FALSE;
6732 /* Assume the player has seen no blast grids */
6735 /* Assume to be a normal ball spell */
6736 bool breath = FALSE;
6738 /* Is the player blind? */
6739 bool blind = (p_ptr->blind ? TRUE : FALSE);
6741 bool old_hide = FALSE;
6743 /* Number of grids in the "path" */
6746 /* Actual grids in the "path" */
6749 /* Number of grids in the "blast area" (including the "beam" path) */
6752 /* Coordinates of the affected grids */
6753 POSITION gx[1024], gy[1024];
6755 /* Encoded "radius" info (see above) */
6758 /* Actual radius encoded in gm[] */
6759 POSITION gm_rad = rad;
6763 /* Attacker's name (prepared before polymorph)*/
6766 /* Can the player see the source of this effect? */
6767 bool see_s_msg = TRUE;
6769 /* Initialize by null string */
6775 /* Default target of monsterspell is player */
6776 monster_target_y = p_ptr->y;
6777 monster_target_x = p_ptr->x;
6779 /* Hack -- Jump to target */
6780 if (flg & (PROJECT_JUMP))
6785 /* Clear the flag */
6786 flg &= ~(PROJECT_JUMP);
6791 /* Start at player */
6798 /* Start at monster */
6801 x1 = m_list[who].fx;
6802 y1 = m_list[who].fy;
6803 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6815 /* Default "destination" */
6820 /* Hack -- verify stuff */
6821 if (flg & (PROJECT_THRU))
6823 if ((x1 == x2) && (y1 == y2))
6825 flg &= ~(PROJECT_THRU);
6829 /* Handle a breath attack */
6834 if (flg & PROJECT_HIDE) old_hide = TRUE;
6835 flg |= PROJECT_HIDE;
6839 /* Hack -- Assume there will be no blast (max radius 32) */
6840 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6848 /* Collect beam grids */
6849 if (flg & (PROJECT_BEAM))
6860 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6862 case GF_DISINTEGRATE:
6863 flg |= (PROJECT_GRID);
6864 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6868 /* Calculate the projection path */
6870 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6872 /* Hack -- Handle stuff */
6875 /* Giga-Hack SEEKER & SUPER_RAY */
6877 if( typ == GF_SEEKER )
6887 for (i = 0; i < path_n; ++i)
6892 int ny = GRID_Y(path_g[i]);
6893 int nx = GRID_X(path_g[i]);
6904 /* Only do visuals if requested */
6905 if (!blind && !(flg & (PROJECT_HIDE)))
6907 /* Only do visuals if the player can "see" the bolt */
6908 if (panel_contains(y, x) && player_has_los_bold(y, x))
6915 /* Obtain the bolt pict */
6916 p = bolt_pict(oy, ox, y, x, typ);
6918 /* Extract attr/char */
6922 /* Visual effects */
6923 print_rel(c, a, y, x);
6924 move_cursor_relative(y, x);
6925 /*if (fresh_before)*/ Term_fresh();
6926 Term_xtra(TERM_XTRA_DELAY, msec);
6928 /*if (fresh_before)*/ Term_fresh();
6930 /* Display "beam" grids */
6931 if (flg & (PROJECT_BEAM))
6933 /* Obtain the explosion pict */
6934 p = bolt_pict(y, x, y, x, typ);
6936 /* Extract attr/char */
6940 /* Visual effects */
6941 print_rel(c, a, y, x);
6944 /* Hack -- Activate delay */
6948 /* Hack -- delay anyway for consistency */
6951 /* Delay for consistency */
6952 Term_xtra(TERM_XTRA_DELAY, msec);
6955 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6956 if( is_mirror_grid(&cave[y][x]))
6958 /* The target of monsterspell becomes tha mirror(broken) */
6959 monster_target_y=(s16b)y;
6960 monster_target_x=(s16b)x;
6962 remove_mirror(y, x);
6963 next_mirror(&oy, &ox, y, x);
6965 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6966 for(j = last_i; j <= i; j++)
6968 y = GRID_Y(path_g[j]);
6969 x = GRID_X(path_g[j]);
6970 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6971 if(!who && (project_m_n==1) && !jump ){
6972 if(cave[project_m_y][project_m_x].m_idx >0 ){
6973 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6977 /* Hack -- auto-recall */
6978 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6980 /* Hack - auto-track */
6981 health_track(cave[project_m_y][project_m_x].m_idx);
6985 (void)project_f(0,0,y,x,dam,GF_SEEKER);
6990 for(i = last_i ; i < path_n ; i++)
6993 py = GRID_Y(path_g[i]);
6994 px = GRID_X(path_g[i]);
6995 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6997 if(!who && (project_m_n==1) && !jump ){
6998 if(cave[project_m_y][project_m_x].m_idx > 0)
7000 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7004 /* Hack -- auto-recall */
7005 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7007 /* Hack - auto-track */
7008 health_track(cave[project_m_y][project_m_x].m_idx);
7012 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7016 else if(typ == GF_SUPER_RAY){
7018 int second_step = 0;
7025 for (i = 0; i < path_n; ++i)
7030 int ny = GRID_Y(path_g[i]);
7031 int nx = GRID_X(path_g[i]);
7042 /* Only do visuals if requested */
7043 if (!blind && !(flg & (PROJECT_HIDE)))
7045 /* Only do visuals if the player can "see" the bolt */
7046 if (panel_contains(y, x) && player_has_los_bold(y, x))
7053 /* Obtain the bolt pict */
7054 p = bolt_pict(oy, ox, y, x, typ);
7056 /* Extract attr/char */
7060 /* Visual effects */
7061 print_rel(c, a, y, x);
7062 move_cursor_relative(y, x);
7063 /*if (fresh_before)*/ Term_fresh();
7064 Term_xtra(TERM_XTRA_DELAY, msec);
7066 /*if (fresh_before)*/ Term_fresh();
7068 /* Display "beam" grids */
7069 if (flg & (PROJECT_BEAM))
7071 /* Obtain the explosion pict */
7072 p = bolt_pict(y, x, y, x, typ);
7074 /* Extract attr/char */
7078 /* Visual effects */
7079 print_rel(c, a, y, x);
7082 /* Hack -- Activate delay */
7086 /* Hack -- delay anyway for consistency */
7089 /* Delay for consistency */
7090 Term_xtra(TERM_XTRA_DELAY, msec);
7093 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7094 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7096 if( second_step )continue;
7099 if( is_mirror_grid(&cave[y][x]) && !second_step )
7101 /* The target of monsterspell becomes tha mirror(broken) */
7102 monster_target_y=(s16b)y;
7103 monster_target_x=(s16b)x;
7106 for( j = 0; j <=i ; j++ )
7108 y = GRID_Y(path_g[j]);
7109 x = GRID_X(path_g[j]);
7110 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7114 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7115 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7116 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7117 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7118 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7119 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7120 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7121 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7124 for( i = 0; i < path_n ; i++ )
7127 py = GRID_Y(path_g[i]);
7128 px = GRID_X(path_g[i]);
7129 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7130 if(!who && (project_m_n == 1) && !jump){
7131 if(cave[project_m_y][project_m_x].m_idx >0 ){
7132 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7136 /* Hack -- auto-recall */
7137 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7139 /* Hack - auto-track */
7140 health_track(cave[project_m_y][project_m_x].m_idx);
7144 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7149 /* Project along the path */
7150 for (i = 0; i < path_n; ++i)
7155 int ny = GRID_Y(path_g[i]);
7156 int nx = GRID_X(path_g[i]);
7158 if (flg & PROJECT_DISI)
7160 /* Hack -- Balls explode before reaching walls */
7161 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7163 else if (flg & PROJECT_LOS)
7165 /* Hack -- Balls explode before reaching walls */
7166 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7170 /* Hack -- Balls explode before reaching walls */
7171 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7178 /* Collect beam grids */
7179 if (flg & (PROJECT_BEAM))
7186 /* Only do visuals if requested */
7187 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7189 /* Only do visuals if the player can "see" the bolt */
7190 if (panel_contains(y, x) && player_has_los_bold(y, x))
7197 /* Obtain the bolt pict */
7198 p = bolt_pict(oy, ox, y, x, typ);
7200 /* Extract attr/char */
7204 /* Visual effects */
7205 print_rel(c, a, y, x);
7206 move_cursor_relative(y, x);
7207 /*if (fresh_before)*/ Term_fresh();
7208 Term_xtra(TERM_XTRA_DELAY, msec);
7210 /*if (fresh_before)*/ Term_fresh();
7212 /* Display "beam" grids */
7213 if (flg & (PROJECT_BEAM))
7215 /* Obtain the explosion pict */
7216 p = bolt_pict(y, x, y, x, typ);
7218 /* Extract attr/char */
7222 /* Visual effects */
7223 print_rel(c, a, y, x);
7226 /* Hack -- Activate delay */
7230 /* Hack -- delay anyway for consistency */
7233 /* Delay for consistency */
7234 Term_xtra(TERM_XTRA_DELAY, msec);
7241 /* Save the "blast epicenter" */
7245 if (breath && !path_n)
7251 flg &= ~(PROJECT_HIDE);
7255 /* Start the "explosion" */
7258 /* Hack -- make sure beams get to "explode" */
7266 /* If we found a "target", explode there */
7267 if (dist <= MAX_RANGE)
7269 /* Mega-Hack -- remove the final "beam" grid */
7270 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7273 * Create a conical breath attack
7284 flg &= ~(PROJECT_HIDE);
7286 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7290 /* Determine the blast area, work from the inside out */
7291 for (dist = 0; dist <= rad; dist++)
7293 /* Scan the maximal blast area of radius "dist" */
7294 for (y = by - dist; y <= by + dist; y++)
7296 for (x = bx - dist; x <= bx + dist; x++)
7298 /* Ignore "illegal" locations */
7299 if (!in_bounds2(y, x)) continue;
7301 /* Enforce a "circular" explosion */
7302 if (distance(by, bx, y, x) != dist) continue;
7308 /* Lights are stopped by opaque terrains */
7309 if (!los(by, bx, y, x)) continue;
7311 case GF_DISINTEGRATE:
7312 /* Disintegration are stopped only by perma-walls */
7313 if (!in_disintegration_range(by, bx, y, x)) continue;
7316 /* Ball explosions are stopped by walls */
7317 if (!projectable(by, bx, y, x)) continue;
7321 /* Save this grid */
7328 /* Encode some more "radius" info */
7334 /* Speed -- ignore "non-explosions" */
7335 if (!grids) return (FALSE);
7338 /* Display the "blast area" if requested */
7339 if (!blind && !(flg & (PROJECT_HIDE)))
7341 /* Then do the "blast", from inside out */
7342 for (t = 0; t <= gm_rad; t++)
7344 /* Dump everything with this radius */
7345 for (i = gm[t]; i < gm[t+1]; i++)
7347 /* Extract the location */
7351 /* Only do visuals if the player can "see" the blast */
7352 if (panel_contains(y, x) && player_has_los_bold(y, x))
7361 /* Obtain the explosion pict */
7362 p = bolt_pict(y, x, y, x, typ);
7364 /* Extract attr/char */
7368 /* Visual effects -- Display */
7369 print_rel(c, a, y, x);
7373 /* Hack -- center the cursor */
7374 move_cursor_relative(by, bx);
7376 /* Flush each "radius" seperately */
7377 /*if (fresh_before)*/ Term_fresh();
7379 /* Delay (efficiently) */
7380 if (visual || drawn)
7382 Term_xtra(TERM_XTRA_DELAY, msec);
7386 /* Flush the erasing */
7389 /* Erase the explosion drawn above */
7390 for (i = 0; i < grids; i++)
7392 /* Extract the location */
7396 /* Hack -- Erase if needed */
7397 if (panel_contains(y, x) && player_has_los_bold(y, x))
7403 /* Hack -- center the cursor */
7404 move_cursor_relative(by, bx);
7406 /* Flush the explosion */
7407 /*if (fresh_before)*/ Term_fresh();
7412 /* Update stuff if needed */
7413 if (p_ptr->update) update_stuff();
7416 if (flg & PROJECT_KILL)
7418 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7419 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7423 /* Check features */
7424 if (flg & (PROJECT_GRID))
7426 /* Start with "dist" of zero */
7429 /* Scan for features */
7430 for (i = 0; i < grids; i++)
7432 /* Hack -- Notice new "dist" values */
7433 if (gm[dist+1] == i) dist++;
7435 /* Get the grid location */
7439 /* Find the closest point in the blast */
7442 int d = dist_to_line(y, x, y1, x1, by, bx);
7444 /* Affect the grid */
7445 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7449 /* Affect the grid */
7450 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7455 /* Update stuff if needed */
7456 if (p_ptr->update) update_stuff();
7459 if (flg & (PROJECT_ITEM))
7461 /* Start with "dist" of zero */
7464 /* Scan for objects */
7465 for (i = 0; i < grids; i++)
7467 /* Hack -- Notice new "dist" values */
7468 if (gm[dist+1] == i) dist++;
7470 /* Get the grid location */
7474 /* Find the closest point in the blast */
7477 int d = dist_to_line(y, x, y1, x1, by, bx);
7479 /* Affect the object in the grid */
7480 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7484 /* Affect the object in the grid */
7485 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7491 /* Check monsters */
7492 if (flg & (PROJECT_KILL))
7499 /* Start with "dist" of zero */
7502 /* Scan for monsters */
7503 for (i = 0; i < grids; i++)
7507 /* Hack -- Notice new "dist" values */
7508 if (gm[dist + 1] == i) dist++;
7510 /* Get the grid location */
7514 /* A single bolt may be reflected */
7517 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7518 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7520 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7521 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7522 (!who || dist_hack > 1) && !one_in_(10))
7525 int max_attempts = 10;
7527 /* Choose 'new' target */
7530 t_y = y_saver - 1 + randint1(3);
7531 t_x = x_saver - 1 + randint1(3);
7534 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7536 if (max_attempts < 1)
7542 sound(SOUND_REFLECT);
7545 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7546 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7547 else if (m_ptr->r_idx == MON_DIO)
7548 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7550 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7552 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7554 /* Reflected bolts randomly target either one */
7555 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7556 else flg |= PROJECT_PLAYER;
7558 /* The bolt is reflected */
7559 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7561 /* Don't affect the monster any longer */
7567 /* Find the closest point in the blast */
7570 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7574 effective_dist = dist;
7578 /* There is the riding player on this monster */
7579 if (p_ptr->riding && player_bold(y, x))
7581 /* Aimed on the player */
7582 if (flg & PROJECT_PLAYER)
7584 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7587 * A beam or bolt is well aimed
7589 * So don't affects the mount.
7596 * The spell is not well aimed,
7597 * So partly affect the mount too.
7604 * This grid is the original target.
7605 * Or aimed on your horse.
7607 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7609 /* Hit the mount with full damage */
7613 * Otherwise this grid is not the
7614 * original target, it means that line
7615 * of fire is obstructed by this
7619 * A beam or bolt will hit either
7620 * player or mount. Choose randomly.
7622 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7626 /* Hit the mount with full damage */
7630 /* Hit the player later */
7631 flg |= PROJECT_PLAYER;
7633 /* Don't affect the mount */
7639 * The spell is not well aimed, so
7640 * partly affect both player and
7649 /* Affect the monster in the grid */
7650 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7654 /* Player affected one monster (without "jumping") */
7655 if (!who && (project_m_n == 1) && !jump)
7660 /* Track if possible */
7661 if (cave[y][x].m_idx > 0)
7663 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7667 /* Hack -- auto-recall */
7668 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7670 /* Hack - auto-track */
7671 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7679 if (flg & (PROJECT_KILL))
7681 /* Start with "dist" of zero */
7684 /* Scan for player */
7685 for (i = 0; i < grids; i++)
7689 /* Hack -- Notice new "dist" values */
7690 if (gm[dist+1] == i) dist++;
7692 /* Get the grid location */
7696 /* Affect the player? */
7697 if (!player_bold(y, x)) continue;
7699 /* Find the closest point in the blast */
7702 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7706 effective_dist = dist;
7709 /* Target may be your horse */
7712 /* Aimed on the player */
7713 if (flg & PROJECT_PLAYER)
7715 /* Hit the player with full damage */
7719 * Hack -- When this grid was not the
7720 * original target, a beam or bolt
7721 * would hit either player or mount,
7722 * and should be choosen randomly.
7724 * But already choosen to hit the
7725 * mount at this point.
7727 * Or aimed on your horse.
7729 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7732 * A beam or bolt is well aimed
7734 * So don't affects the player.
7741 * The spell is not well aimed,
7742 * So partly affect the player too.
7748 /* Affect the player */
7749 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7757 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7759 if (rakubadam_m > 0)
7761 if (rakuba(rakubadam_m, FALSE))
7763 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7766 if (p_ptr->riding && rakubadam_p > 0)
7768 if(rakuba(rakubadam_p, FALSE))
7770 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7775 /* Return "something was noticed" */
7780 * @brief 鏡魔法「封魔結界」の効果処理
7782 * @return 効果があったらTRUEを返す
7784 bool binding_field(HIT_POINT dam)
7786 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7787 int mirror_num = 0; /* 鏡の数 */
7789 POSITION centersign;
7790 POSITION x1, x2, y1, y2;
7792 int msec = delay_factor*delay_factor*delay_factor;
7795 POSITION point_x[3];
7796 POSITION point_y[3];
7798 /* Default target of monsterspell is player */
7799 monster_target_y = p_ptr->y;
7800 monster_target_x = p_ptr->x;
7802 for (x = 0; x < cur_wid; x++)
7804 for (y = 0; y < cur_hgt; y++)
7806 if (is_mirror_grid(&cave[y][x]) &&
7807 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7808 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7809 player_has_los_bold(y, x) &&
7810 projectable(p_ptr->y, p_ptr->x, y, x)
7812 mirror_y[mirror_num] = y;
7813 mirror_x[mirror_num] = x;
7819 if (mirror_num < 2)return FALSE;
7821 point_x[0] = randint0(mirror_num);
7823 point_x[1] = randint0(mirror_num);
7824 } while (point_x[0] == point_x[1]);
7826 point_y[0] = mirror_y[point_x[0]];
7827 point_x[0] = mirror_x[point_x[0]];
7828 point_y[1] = mirror_y[point_x[1]];
7829 point_x[1] = mirror_x[point_x[1]];
7830 point_y[2] = p_ptr->y;
7831 point_x[2] = p_ptr->x;
7833 x = point_x[0] + point_x[1] + point_x[2];
7834 y = point_y[0] + point_y[1] + point_y[2];
7836 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7837 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7838 if (centersign == 0)return FALSE;
7840 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7841 x1 = x1 < point_x[2] ? x1 : point_x[2];
7842 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7843 y1 = y1 < point_y[2] ? y1 : point_y[2];
7845 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7846 x2 = x2 > point_x[2] ? x2 : point_x[2];
7847 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7848 y2 = y2 > point_y[2] ? y2 : point_y[2];
7850 for (y = y1; y <= y2; y++) {
7851 for (x = x1; x <= x2; x++) {
7852 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7853 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7854 centersign*((point_x[1] - x)*(point_y[2] - y)
7855 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7856 centersign*((point_x[2] - x)*(point_y[0] - y)
7857 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7859 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7860 /* Visual effects */
7862 && panel_contains(y, x)) {
7863 p = bolt_pict(y, x, y, x, GF_MANA);
7864 print_rel(PICT_C(p), PICT_A(p), y, x);
7865 move_cursor_relative(y, x);
7866 /*if (fresh_before)*/ Term_fresh();
7867 Term_xtra(TERM_XTRA_DELAY, msec);
7873 for (y = y1; y <= y2; y++) {
7874 for (x = x1; x <= x2; x++) {
7875 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7876 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7877 centersign*((point_x[1] - x)*(point_y[2] - y)
7878 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7879 centersign*((point_x[2] - x)*(point_y[0] - y)
7880 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7882 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7883 (void)project_f(0, 0, y, x, dam, GF_MANA);
7888 for (y = y1; y <= y2; y++) {
7889 for (x = x1; x <= x2; x++) {
7890 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7891 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7892 centersign*((point_x[1] - x)*(point_y[2] - y)
7893 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7894 centersign*((point_x[2] - x)*(point_y[0] - y)
7895 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7897 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7898 (void)project_o(0, 0, y, x, dam, GF_MANA);
7903 for (y = y1; y <= y2; y++) {
7904 for (x = x1; x <= x2; x++) {
7905 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7906 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7907 centersign*((point_x[1] - x)*(point_y[2] - y)
7908 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7909 centersign*((point_x[2] - x)*(point_y[0] - y)
7910 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7912 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7913 (void)project_m(0, 0, y, x, dam, GF_MANA,
7914 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7920 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7921 remove_mirror(point_y[0], point_x[0]);
7928 * @brief 鏡魔法「鏡の封印」の効果処理
7930 * @return 効果があったらTRUEを返す
7932 void seal_of_mirror(HIT_POINT dam)
7936 for (x = 0; x < cur_wid; x++)
7938 for (y = 0; y < cur_hgt; y++)
7940 if (is_mirror_grid(&cave[y][x]))
7942 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7943 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7945 if (!cave[y][x].m_idx)
7947 remove_mirror(y, x);