3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
21 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
22 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
24 int project_length = 0; /*!< 投射の射程距離 */
28 * @brief モンスター魅了用セービングスロー共通部(汎用系)
30 * @param m_ptr 対象モンスター
31 * @return 魅了に抵抗したらTRUE
33 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
35 monster_race *r_ptr = &r_info[m_ptr->r_idx];
37 if(p_ptr->inside_arena) return TRUE;
40 if (r_ptr->flagsr & RFR_RES_ALL)
42 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
46 if (r_ptr->flags3 & RF3_NO_CONF)
48 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
52 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
54 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
55 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
56 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
60 * @brief モンスター服従用セービングスロー共通部(部族依存系)
62 * @param m_ptr 対象モンスター
63 * @return 服従に抵抗したらTRUE
65 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
67 monster_race *r_ptr = &r_info[m_ptr->r_idx];
69 if (p_ptr->inside_arena) return TRUE;
72 if (r_ptr->flagsr & RFR_RES_ALL)
74 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
78 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
80 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
81 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
82 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
86 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
89 * ハードコーティングによる実装が行われている。
90 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
92 PERCENTAGE beam_chance(void)
94 if (p_ptr->pclass == CLASS_MAGE)
95 return (PERCENTAGE)(p_ptr->lev);
96 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
97 return (PERCENTAGE)(p_ptr->lev + 10);
99 return (PERCENTAGE)(p_ptr->lev / 2);
104 * @brief 配置した鏡リストの次を取得する /
105 * Get another mirror. for SEEKER
106 * @param next_y 次の鏡のy座標を返す参照ポインタ
107 * @param next_x 次の鏡のx座標を返す参照ポインタ
108 * @param cury 現在の鏡のy座標
109 * @param curx 現在の鏡のx座標
111 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
113 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
114 int mirror_num = 0; /* 鏡の数 */
118 for (x = 0; x < cur_wid; x++)
120 for (y = 0; y < cur_hgt; y++)
122 if (is_mirror_grid(&cave[y][x])) {
123 mirror_y[mirror_num] = y;
124 mirror_x[mirror_num] = x;
131 num = randint0(mirror_num);
132 *next_y = mirror_y[num];
133 *next_x = mirror_x[num];
136 *next_y = cury + randint0(5) - 2;
137 *next_x = curx + randint0(5) - 2;
142 * @brief 万色表現用にランダムな色を選択する関数 /
143 * Get a legal "multi-hued" color for drawing "spells"
147 static byte mh_attr(int max)
149 switch (randint1(max))
151 case 1: return (TERM_RED);
152 case 2: return (TERM_GREEN);
153 case 3: return (TERM_BLUE);
154 case 4: return (TERM_YELLOW);
155 case 5: return (TERM_ORANGE);
156 case 6: return (TERM_VIOLET);
157 case 7: return (TERM_L_RED);
158 case 8: return (TERM_L_GREEN);
159 case 9: return (TERM_L_BLUE);
160 case 10: return (TERM_UMBER);
161 case 11: return (TERM_L_UMBER);
162 case 12: return (TERM_SLATE);
163 case 13: return (TERM_WHITE);
164 case 14: return (TERM_L_WHITE);
165 case 15: return (TERM_L_DARK);
173 * @brief 魔法属性に応じたエフェクトの色を返す /
174 * Return a color to use for the bolt/ball spells
178 static byte spell_color(int type)
180 /* Check if A.B.'s new graphics should be used (rr9) */
181 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
186 case GF_PSY_SPEAR: return (0x06);
187 case GF_MISSILE: return (0x0F);
188 case GF_ACID: return (0x04);
189 case GF_ELEC: return (0x02);
190 case GF_FIRE: return (0x00);
191 case GF_COLD: return (0x01);
192 case GF_POIS: return (0x03);
193 case GF_HOLY_FIRE: return (0x00);
194 case GF_HELL_FIRE: return (0x00);
195 case GF_MANA: return (0x0E);
197 case GF_SEEKER: return (0x0E);
198 case GF_SUPER_RAY: return (0x0E);
200 case GF_ARROW: return (0x0F);
201 case GF_WATER: return (0x04);
202 case GF_NETHER: return (0x07);
203 case GF_CHAOS: return (mh_attr(15));
204 case GF_DISENCHANT: return (0x05);
205 case GF_NEXUS: return (0x0C);
206 case GF_CONFUSION: return (mh_attr(4));
207 case GF_SOUND: return (0x09);
208 case GF_SHARDS: return (0x08);
209 case GF_FORCE: return (0x09);
210 case GF_INERTIAL: return (0x09);
211 case GF_GRAVITY: return (0x09);
212 case GF_TIME: return (0x09);
213 case GF_LITE_WEAK: return (0x06);
214 case GF_LITE: return (0x06);
215 case GF_DARK_WEAK: return (0x07);
216 case GF_DARK: return (0x07);
217 case GF_PLASMA: return (0x0B);
218 case GF_METEOR: return (0x00);
219 case GF_ICE: return (0x01);
220 case GF_ROCKET: return (0x0F);
221 case GF_DEATH_RAY: return (0x07);
222 case GF_NUKE: return (mh_attr(2));
223 case GF_DISINTEGRATE: return (0x05);
235 case GF_CAUSE_4: return (0x0E);
236 case GF_HAND_DOOM: return (0x07);
237 case GF_CAPTURE : return (0x0E);
238 case GF_IDENTIFY: return (0x01);
239 case GF_ATTACK: return (0x0F);
240 case GF_PHOTO : return (0x06);
243 /* Normal tiles or ASCII */
249 /* Lookup the default colors for this type */
250 cptr s = quark_str(gf_color[type]);
252 if (!s) return (TERM_WHITE);
254 /* Pick a random color */
255 c = s[randint0(strlen(s))];
257 /* Lookup this color */
258 a = my_strchr(color_char, c) - color_char;
260 /* Invalid color (note check for < 0 removed, gave a silly
261 * warning because bytes are always >= 0 -- RG) */
262 if (a > 15) return (TERM_WHITE);
268 /* Standard "color" */
274 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
275 * Find the attr/char pair to use for a spell effect
284 * It is moving (or has moved) from (x,y) to (nx,ny).
285 * If the distance is not "one", we (may) return "*".
288 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
298 if ((ny == y) && (nx == x)) base = 0x30;
301 else if (nx == x) base = 0x40;
304 else if (ny == y) base = 0x50;
307 else if ((ny - y) == (x - nx)) base = 0x60;
310 else if ((ny - y) == (nx - x)) base = 0x70;
315 /* Basic spell color */
316 k = spell_color(typ);
318 /* Obtain attr/char */
319 a = misc_to_attr[base + k];
320 c = misc_to_char[base + k];
328 * @brief 始点から終点への経路を返す /
329 * Determine the path taken by a projection.
330 * @param gp 経路座標リストを返す参照ポインタ
340 * The projection will always start from the grid (y1,x1), and will travel
341 * towards the grid (y2,x2), touching one grid per unit of distance along
342 * the major axis, and stopping when it enters the destination grid or a
343 * wall grid, or has travelled the maximum legal distance of "range".
345 * Note that "distance" in this function (as in the "update_view()" code)
346 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
347 * actually has an "octagon of projection" not a "circle of projection".
349 * The path grids are saved into the grid array pointed to by "gp", and
350 * there should be room for at least "range" grids in "gp". Note that
351 * due to the way in which distance is calculated, this function normally
352 * uses fewer than "range" grids for the projection path, so the result
353 * of this function should never be compared directly to "range". Note
354 * that the initial grid (y1,x1) is never saved into the grid array, not
355 * even if the initial grid is also the final grid.
357 * The "flg" flags can be used to modify the behavior of this function.
359 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
360 * semantics as they do for the "project" function, namely, that the path
361 * will stop as soon as it hits a monster, or that the path will continue
362 * through the destination grid, respectively.
364 * The "PROJECT_JUMP" flag, which for the "project()" function means to
365 * start at a special grid (which makes no sense in this function), means
366 * that the path should be "angled" slightly if needed to avoid any wall
367 * grids, allowing the player to "target" any grid which is in "view".
368 * This flag is non-trivial and has not yet been implemented, but could
369 * perhaps make use of the "vinfo" array (above).
371 * This function returns the number of grids (if any) in the path. This
372 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
374 * This algorithm is similar to, but slightly different from, the one used
375 * by "update_view_los()", and very different from the one used by "los()".
378 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
400 /* No path necessary (or allowed) */
401 if ((x1 == x2) && (y1 == y2)) return (0);
429 /* Number of "units" in one "half" grid */
432 /* Number of "units" in one "full" grid */
438 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
449 /* Advance (X) part 2 */
452 /* Advance (X) part 3 */
459 /* Create the projection path */
463 gp[n++] = GRID(y, x);
465 /* Hack -- Check maximum range */
466 if ((n + (k >> 1)) >= range) break;
468 /* Sometimes stop at destination grid */
469 if (!(flg & (PROJECT_THRU)))
471 if ((x == x2) && (y == y2)) break;
474 if (flg & (PROJECT_DISI))
476 if ((n > 0) && cave_stop_disintegration(y, x)) break;
478 else if (flg & (PROJECT_LOS))
480 if ((n > 0) && !cave_los_bold(y, x)) break;
482 else if (!(flg & (PROJECT_PATH)))
484 /* Always stop at non-initial wall grids */
485 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
488 /* Sometimes stop at non-initial monsters/players */
489 if (flg & (PROJECT_STOP))
492 (player_bold(y, x) || cave[y][x].m_idx != 0))
496 if (!in_bounds(y, x)) break;
501 /* Advance (X) part 1 */
504 /* Horizontal change */
507 /* Advance (X) part 2 */
510 /* Advance (X) part 3 */
526 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
535 /* Vertical change */
538 /* Advance (Y) part 2 */
541 /* Advance (Y) part 3 */
548 /* Create the projection path */
552 gp[n++] = GRID(y, x);
554 /* Hack -- Check maximum range */
555 if ((n + (k >> 1)) >= range) break;
557 /* Sometimes stop at destination grid */
558 if (!(flg & (PROJECT_THRU)))
560 if ((x == x2) && (y == y2)) break;
563 if (flg & (PROJECT_DISI))
565 if ((n > 0) && cave_stop_disintegration(y, x)) break;
567 else if (flg & (PROJECT_LOS))
569 if ((n > 0) && !cave_los_bold(y, x)) break;
571 else if (!(flg & (PROJECT_PATH)))
573 /* Always stop at non-initial wall grids */
574 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
577 /* Sometimes stop at non-initial monsters/players */
578 if (flg & (PROJECT_STOP))
581 (player_bold(y, x) || cave[y][x].m_idx != 0))
585 if (!in_bounds(y, x)) break;
590 /* Advance (Y) part 1 */
593 /* Vertical change */
596 /* Advance (Y) part 2 */
599 /* Advance (Y) part 3 */
619 /* Create the projection path */
623 gp[n++] = GRID(y, x);
625 /* Hack -- Check maximum range */
626 if ((n + (n >> 1)) >= range) break;
628 /* Sometimes stop at destination grid */
629 if (!(flg & (PROJECT_THRU)))
631 if ((x == x2) && (y == y2)) break;
634 if (flg & (PROJECT_DISI))
636 if ((n > 0) && cave_stop_disintegration(y, x)) break;
638 else if (flg & (PROJECT_LOS))
640 if ((n > 0) && !cave_los_bold(y, x)) break;
642 else if (!(flg & (PROJECT_PATH)))
644 /* Always stop at non-initial wall grids */
645 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
648 /* Sometimes stop at non-initial monsters/players */
649 if (flg & (PROJECT_STOP))
652 (player_bold(y, x) || cave[y][x].m_idx != 0))
656 if (!in_bounds(y, x)) break;
673 * Mega-Hack -- track "affected" monsters (see "project()" comments)
675 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
676 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
677 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
678 /* Mega-Hack -- monsters target */
679 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
680 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
684 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
685 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
686 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
687 * @param y 目標Y座標 / Target y location (or location to travel "towards")
688 * @param x 目標X座標 / Target x location (or location to travel "towards")
689 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
690 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
691 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
694 * We are called both for "beam" effects and "ball" effects.
696 * The "r" parameter is the "distance from ground zero".
698 * Note that we determine if the player can "see" anything that happens
699 * by taking into account: blindness, line-of-sight, and illumination.
701 * We return "TRUE" if the effect of the projection is "obvious".
703 * We also "see" grids which are "memorized", probably a hack
705 * Perhaps we should affect doors?
708 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
710 cave_type *c_ptr = &cave[y][x];
711 feature_type *f_ptr = &f_info[c_ptr->feat];
713 bool obvious = FALSE;
714 bool known = player_has_los_bold(y, x);
719 /* Reduce damage by distance */
720 dam = (dam + r) / (r + 1);
723 if (have_flag(f_ptr->flags, FF_TREE))
731 message = _("枯れた", "was blasted."); break;
733 message = _("縮んだ", "shrank."); break;
735 message = _("溶けた", "melted."); break;
738 message = _("凍り、砕け散った", "was frozen and smashed."); break;
742 message = _("燃えた", "burns up!"); break;
754 message = _("粉砕された", "was crushed."); break;
756 message = NULL;break;
760 msg_format(_("木は%s。", "A tree %s"), message);
761 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
764 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
768 /* Analyze the type */
771 /* Ignore most effects */
806 /* Destroy Traps (and Locks) */
809 /* Reveal secret doors */
810 if (is_hidden_door(c_ptr))
815 /* Check line of sight */
823 if (is_trap(c_ptr->feat))
825 /* Check line of sight */
828 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
832 /* Destroy the trap */
833 cave_alter_feat(y, x, FF_DISARM);
836 /* Locked doors are unlocked */
837 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
839 s16b old_feat = c_ptr->feat;
841 /* Unlock the door */
842 cave_alter_feat(y, x, FF_DISARM);
844 /* Check line of sound */
845 if (known && (old_feat != c_ptr->feat))
847 msg_print(_("カチッと音がした!", "Click!"));
852 /* Remove "unsafe" flag if player is not blind */
853 if (!p_ptr->blind && player_has_los_bold(y, x))
855 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
897 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
899 if (have_flag(f_ptr->flags, FF_SPIKE))
901 s16b old_mimic = c_ptr->mimic;
902 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
904 cave_alter_feat(y, x, FF_SPIKE);
906 c_ptr->mimic = old_mimic;
913 /* Check line of sight */
914 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
916 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
923 /* Destroy walls (and doors) */
926 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
928 if (known && (c_ptr->info & (CAVE_MARK)))
930 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
934 /* Destroy the wall */
935 cave_alter_feat(y, x, FF_HURT_ROCK);
937 /* Update some things */
938 p_ptr->update |= (PU_FLOW);
947 /* Require a "naked" floor grid */
948 if (!cave_naked_bold(y, x)) break;
950 /* Not on the player */
951 if (player_bold(y, x)) break;
953 /* Create a closed door */
954 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
957 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
974 /* Require a "naked" floor grid */
975 if (!cave_naked_bold(y, x)) break;
977 /* Not on the player */
978 if (player_bold(y, x)) break;
980 /* Create a closed door */
981 cave_set_feat(y, x, feat_tree);
984 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
992 /* Require a "naked" floor grid */
993 if (!cave_naked_bold(y, x)) break;
996 c_ptr->info |= CAVE_OBJECT;
997 c_ptr->mimic = feat_glyph;
1009 /* Require a "naked" floor grid */
1010 if (!cave_naked_bold(y, x)) break;
1012 /* Not on the player */
1013 if (player_bold(y, x)) break;
1016 cave_set_feat(y, x, feat_granite);
1024 /* Ignore permanent grid */
1025 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1030 /* Ignore grid without enough space */
1031 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1033 /* Place a shallow lava */
1034 cave_set_feat(y, x, feat_shallow_lava);
1039 /* Place a deep lava */
1040 cave_set_feat(y, x, feat_deep_lava);
1047 /* Ignore permanent grid */
1048 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1053 /* Ignore grid without enough space */
1054 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1056 /* Place a shallow water */
1057 cave_set_feat(y, x, feat_shallow_water);
1062 /* Place a deep water */
1063 cave_set_feat(y, x, feat_deep_water);
1068 /* Lite up the grid */
1072 /* Turn on the light */
1073 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1075 c_ptr->info |= (CAVE_GLOW);
1082 update_local_illumination(y, x);
1085 if (player_can_see_bold(y, x)) obvious = TRUE;
1087 /* Mega-Hack -- Update the monster in the affected grid */
1088 /* This allows "spear of light" (etc) to work "correctly" */
1089 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1091 if (p_ptr->special_defense & NINJA_S_STEALTH)
1093 if (player_bold(y, x)) set_superstealth(FALSE);
1100 /* Darken the grid */
1104 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1107 /* Turn off the light. */
1110 if (dun_level || !is_daytime())
1112 for (j = 0; j < 9; j++)
1114 int by = y + ddy_ddd[j];
1115 int bx = x + ddx_ddd[j];
1117 if (in_bounds2(by, bx))
1119 cave_type *cc_ptr = &cave[by][bx];
1121 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1129 if (!do_dark) break;
1132 c_ptr->info &= ~(CAVE_GLOW);
1134 /* Hack -- Forget "boring" grids */
1135 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1138 c_ptr->info &= ~(CAVE_MARK);
1146 update_local_illumination(y, x);
1148 if (player_can_see_bold(y, x)) obvious = TRUE;
1150 /* Mega-Hack -- Update the monster in the affected grid */
1151 /* This allows "spear of light" (etc) to work "correctly" */
1152 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1162 if (is_mirror_grid(c_ptr))
1164 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1166 remove_mirror(y, x);
1167 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1170 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1172 if (known && (c_ptr->info & CAVE_MARK))
1174 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1178 /* Destroy the wall */
1179 cave_alter_feat(y, x, FF_HURT_ROCK);
1181 /* Update some things */
1182 p_ptr->update |= (PU_FLOW);
1189 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1191 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1193 remove_mirror(y, x);
1194 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1197 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1199 if (known && (c_ptr->info & CAVE_MARK))
1201 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1205 /* Destroy the wall */
1206 cave_alter_feat(y, x, FF_HURT_ROCK);
1208 /* Update some things */
1209 p_ptr->update |= (PU_FLOW);
1214 case GF_DISINTEGRATE:
1216 /* Destroy mirror/glyph */
1217 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1218 remove_mirror(y, x);
1220 /* Permanent features don't get effect */
1221 /* But not protect monsters and other objects */
1222 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1224 cave_alter_feat(y, x, FF_HURT_DISI);
1226 /* Update some things -- similar to GF_KILL_WALL */
1227 p_ptr->update |= (PU_FLOW);
1234 /* Return "Anything seen?" */
1241 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1242 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1243 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1244 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1245 * @param x 目標X座標 / Target x location (or location to travel "towards")
1246 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1247 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1248 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1251 * We are called from "project()" to "damage" objects
1253 * We are called both for "beam" effects and "ball" effects.
1255 * Perhaps we should only SOMETIMES damage things on the ground.
1257 * The "r" parameter is the "distance from ground zero".
1259 * Note that we determine if the player can "see" anything that happens
1260 * by taking into account: blindness, line-of-sight, and illumination.
1262 * We also "see" grids which are "memorized", probably a hack
1264 * We return "TRUE" if the effect of the projection is "obvious".
1267 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1269 cave_type *c_ptr = &cave[y][x];
1271 OBJECT_IDX this_o_idx, next_o_idx = 0;
1273 bool obvious = FALSE;
1274 bool known = player_has_los_bold(y, x);
1276 BIT_FLAGS flgs[TR_FLAG_SIZE];
1278 char o_name[MAX_NLEN];
1280 KIND_OBJECT_IDX k_idx = 0;
1281 bool is_potion = FALSE;
1284 who = who ? who : 0;
1286 /* Reduce damage by distance */
1287 dam = (dam + r) / (r + 1);
1290 /* Scan all objects in the grid */
1291 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1293 /* Acquire object */
1294 object_type *o_ptr = &o_list[this_o_idx];
1296 bool is_art = FALSE;
1297 bool ignore = FALSE;
1298 bool do_kill = FALSE;
1300 cptr note_kill = NULL;
1303 /* Get the "plural"-ness */
1304 bool plural = (o_ptr->number > 1);
1307 /* Acquire next object */
1308 next_o_idx = o_ptr->next_o_idx;
1310 /* Extract the flags */
1311 object_flags(o_ptr, flgs);
1313 /* Check for artifact */
1314 if (object_is_artifact(o_ptr)) is_art = TRUE;
1316 /* Analyze the type */
1319 /* Acid -- Lots of things */
1322 if (hates_acid(o_ptr))
1325 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1326 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1331 /* Elec -- Rings and Wands */
1334 if (hates_elec(o_ptr))
1337 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1338 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1343 /* Fire -- Flammable objects */
1346 if (hates_fire(o_ptr))
1349 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1350 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1355 /* Cold -- potions and flasks */
1358 if (hates_cold(o_ptr))
1360 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1362 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1370 if (hates_fire(o_ptr))
1373 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1374 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1376 if (hates_elec(o_ptr))
1380 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1381 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1389 if (hates_fire(o_ptr))
1392 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1393 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1395 if (hates_cold(o_ptr))
1399 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1400 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1405 /* Hack -- break potions and such */
1411 if (hates_cold(o_ptr))
1413 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1419 /* Mana and Chaos -- destroy everything */
1425 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1429 case GF_DISINTEGRATE:
1432 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1439 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1440 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1441 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1445 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1449 if (object_is_cursed(o_ptr))
1452 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1459 identify_item(o_ptr);
1461 /* Auto-inscription */
1462 autopick_alter_item((-this_o_idx), FALSE);
1470 /* Chests are noticed only if trapped or locked */
1471 if (o_ptr->tval == TV_CHEST)
1473 /* Disarm/Unlock traps */
1474 if (o_ptr->pval > 0)
1476 /* Disarm or Unlock */
1477 o_ptr->pval = (0 - o_ptr->pval);
1480 object_known(o_ptr);
1482 if (known && (o_ptr->marked & OM_FOUND))
1484 msg_print(_("カチッと音がした!", "Click!"));
1494 if (o_ptr->tval == TV_CORPSE)
1497 BIT_FLAGS mode = 0L;
1499 if (!who || is_pet(&m_list[who]))
1500 mode |= PM_FORCE_PET;
1502 for (i = 0; i < o_ptr->number ; i++)
1504 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1505 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1509 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1513 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1515 note_kill = _("生き返った。", " revived.");
1517 else if (!note_kill)
1519 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1530 /* Attempt to destroy the object */
1533 /* Effect "observed" */
1534 if (known && (o_ptr->marked & OM_FOUND))
1537 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1540 /* Artifacts, and other objects, get to resist */
1541 if (is_art || ignore)
1543 /* Observe the resist */
1544 if (known && (o_ptr->marked & OM_FOUND))
1546 msg_format(_("%sは影響を受けない!",
1547 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1554 /* Describe if needed */
1555 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1557 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1560 k_idx = o_ptr->k_idx;
1561 is_potion = object_is_potion(o_ptr);
1564 /* Delete the object */
1565 delete_object_idx(this_o_idx);
1567 /* Potions produce effects when 'shattered' */
1570 (void)potion_smash_effect(who, y, x, k_idx);
1579 /* Return "Anything seen?" */
1585 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1586 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1587 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1588 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1589 * @param x 目標X座標 / Target x location (or location to travel "towards")
1590 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1591 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1593 * @param see_s_msg TRUEならばメッセージを表示する
1594 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1597 * This routine takes a "source monster" (by index) which is mostly used to
1598 * determine if the player is causing the damage, and a "radius" (see below),
1599 * which is used to decrease the power of explosions with distance, and a
1600 * location, via integers which are modified by certain types of attacks
1601 * (polymorph and teleport being the obvious ones), a default damage, which
1602 * is modified as needed based on various properties, and finally a "damage
1603 * type" (see below).
1606 * Note that this routine can handle "no damage" attacks (like teleport) by
1607 * taking a "zero" damage, and can even take "parameters" to attacks (like
1608 * confuse) by accepting a "damage", using it to calculate the effect, and
1609 * then setting the damage to zero. Note that the "damage" parameter is
1610 * divided by the radius, so monsters not at the "epicenter" will not take
1611 * as much damage (or whatever)...
1614 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1615 * may result in a dereference of an invalid pointer.
1618 * Various messages are produced, and damage is applied.
1621 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1622 * actually be "made" of that substance, or "breathe" big balls of it.
1623 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1625 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1626 * and hurts evil less. If can breath nether, then it resists it as well.
1629 * Damage reductions use the following formulas:
1630 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1631 * gives avg damage of .655, ranging from .858 to .500
1632 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1633 * gives avg damage of .544, ranging from .714 to .417
1634 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1635 * gives avg damage of .444, ranging from .556 to .333
1636 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1637 * gives avg damage of .327, ranging from .427 to .250
1638 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1639 * gives something simple.
1642 * In this function, "result" messages are postponed until the end, where
1643 * the "note" string is appended to the monster name, if not NULL. So,
1644 * to make a spell have "no effect" just set "note" to NULL. You should
1645 * also set "notice" to FALSE, or the player will learn what the spell does.
1648 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1652 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)
1656 cave_type *c_ptr = &cave[y][x];
1658 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1659 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1661 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1665 /* Is the monster "seen"? */
1666 bool seen = m_ptr->ml;
1667 bool seen_msg = is_seen(m_ptr);
1669 bool slept = (bool)MON_CSLEEP(m_ptr);
1671 /* Were the effects "obvious" (if seen)? */
1672 bool obvious = FALSE;
1674 /* Can the player know about this effect? */
1675 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1677 /* Were the effects "irrelevant"? */
1678 bool skipped = FALSE;
1680 /* Gets the monster angry at the source of the effect? */
1681 bool get_angry = FALSE;
1683 /* Polymorph setting (true or false) */
1684 bool do_poly = FALSE;
1686 /* Teleport setting (max distance) */
1689 /* Confusion setting (amount to confuse) */
1692 /* Stunning setting (amount to stun) */
1695 /* Sleep amount (amount to sleep) */
1698 /* Fear amount (amount to fear) */
1701 /* Time amount (amount to time) */
1704 bool heal_leper = FALSE;
1706 /* Hold the monster name */
1710 PARAMETER_VALUE photo = 0;
1712 /* Assume no note */
1715 /* Assume a default death */
1716 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1721 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1724 if (!c_ptr->m_idx) return (FALSE);
1726 /* Never affect projector */
1727 if (who && (c_ptr->m_idx == who)) return (FALSE);
1728 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1729 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1731 /* Don't affect already death monsters */
1732 /* Prevents problems with chain reactions of exploding monsters */
1733 if (m_ptr->hp < 0) return (FALSE);
1735 /* Reduce damage by distance */
1736 dam = (dam + r) / (r + 1);
1739 /* Get the monster name (BEFORE polymorphing) */
1740 monster_desc(m_name, m_ptr, 0);
1742 /* Get the monster possessive ("his"/"her"/"its") */
1743 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1745 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1747 /* Analyze the damage type */
1750 /* Magic Missile -- pure damage */
1753 if (seen) obvious = TRUE;
1755 if (r_ptr->flagsr & RFR_RES_ALL)
1757 note = _("には完全な耐性がある!", " is immune.");
1759 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1768 if (seen) obvious = TRUE;
1770 if (r_ptr->flagsr & RFR_RES_ALL)
1772 note = _("には完全な耐性がある!", " is immune.");
1774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1777 if (r_ptr->flagsr & RFR_IM_ACID)
1779 note = _("にはかなり耐性がある!", " resists a lot.");
1781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1789 if (seen) obvious = TRUE;
1791 if (r_ptr->flagsr & RFR_RES_ALL)
1793 note = _("には完全な耐性がある!", " is immune.");
1795 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1798 if (r_ptr->flagsr & RFR_IM_ELEC)
1800 note = _("にはかなり耐性がある!", " resists a lot.");
1802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1810 if (seen) obvious = TRUE;
1812 if (r_ptr->flagsr & RFR_RES_ALL)
1814 note = _("には完全な耐性がある!", " is immune.");
1816 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1819 if (r_ptr->flagsr & RFR_IM_FIRE)
1821 note = _("にはかなり耐性がある!", " resists a lot.");
1823 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1825 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1827 note = _("はひどい痛手をうけた。", " is hit hard.");
1829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1837 if (seen) obvious = TRUE;
1839 if (r_ptr->flagsr & RFR_RES_ALL)
1841 note = _("には完全な耐性がある!", " is immune.");
1843 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1846 if (r_ptr->flagsr & RFR_IM_COLD)
1848 note = _("にはかなり耐性がある!", " resists a lot.");
1850 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1852 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1854 note = _("はひどい痛手をうけた。", " is hit hard.");
1856 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1864 if (seen) obvious = TRUE;
1866 if (r_ptr->flagsr & RFR_RES_ALL)
1868 note = _("には完全な耐性がある!", " is immune.");
1870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1873 if (r_ptr->flagsr & RFR_IM_POIS)
1875 note = _("にはかなり耐性がある!", " resists a lot.");
1877 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1885 if (seen) obvious = TRUE;
1887 if (r_ptr->flagsr & RFR_RES_ALL)
1889 note = _("には完全な耐性がある!", " is immune.");
1891 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1894 if (r_ptr->flagsr & RFR_IM_POIS)
1896 note = _("には耐性がある。", " resists.");
1897 dam *= 3; dam /= randint1(6) + 6;
1898 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1900 else if (one_in_(3)) do_poly = TRUE;
1904 /* Hellfire -- hurts Evil */
1907 if (seen) obvious = TRUE;
1909 if (r_ptr->flagsr & RFR_RES_ALL)
1911 note = _("には完全な耐性がある!", " is immune.");
1913 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1916 if (r_ptr->flags3 & RF3_GOOD)
1918 note = _("はひどい痛手をうけた。", " is hit hard.");
1920 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1925 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1928 if (seen) obvious = TRUE;
1930 if (r_ptr->flagsr & RFR_RES_ALL)
1932 note = _("には完全な耐性がある!", " is immune.");
1934 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1937 if (r_ptr->flags3 & RF3_GOOD)
1939 note = _("には完全な耐性がある!", " is immune.");
1941 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1943 else if (r_ptr->flags3 & RF3_EVIL)
1946 note = _("はひどい痛手をうけた。", " is hit hard.");
1947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1951 note = _("には耐性がある。", " resists.");
1952 dam *= 3; dam /= randint1(6) + 6;
1957 /* Arrow -- XXX no defense */
1960 if (seen) obvious = TRUE;
1962 if (r_ptr->flagsr & RFR_RES_ALL)
1964 note = _("には完全な耐性がある!", " is immune.");
1966 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1972 /* Plasma -- XXX perhaps check ELEC or FIRE */
1975 if (seen) obvious = TRUE;
1977 if (r_ptr->flagsr & RFR_RES_ALL)
1979 note = _("には完全な耐性がある!", " is immune.");
1981 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1984 if (r_ptr->flagsr & RFR_RES_PLAS)
1986 note = _("には耐性がある。", " resists.");
1987 dam *= 3; dam /= randint1(6) + 6;
1988 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1993 /* Nether -- see above */
1996 if (seen) obvious = TRUE;
1998 if (r_ptr->flagsr & RFR_RES_ALL)
2000 note = _("には完全な耐性がある!", " is immune.");
2002 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2005 if (r_ptr->flagsr & RFR_RES_NETH)
2007 if (r_ptr->flags3 & RF3_UNDEAD)
2009 note = _("には完全な耐性がある!", " is immune.");
2011 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2015 note = _("には耐性がある。", " resists.");
2016 dam *= 3; dam /= randint1(6) + 6;
2018 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2020 else if (r_ptr->flags3 & RF3_EVIL)
2022 note = _("はいくらか耐性を示した。", " resists somewhat.");
2024 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2029 /* Water (acid) damage -- Water spirits/elementals are immune */
2032 if (seen) obvious = TRUE;
2034 if (r_ptr->flagsr & RFR_RES_ALL)
2036 note = _("には完全な耐性がある!", " is immune.");
2038 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2041 if (r_ptr->flagsr & RFR_RES_WATE)
2043 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2045 note = _("には完全な耐性がある!", " is immune.");
2050 note = _("には耐性がある。", " resists.");
2051 dam *= 3; dam /= randint1(6) + 6;
2053 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2058 /* Chaos -- Chaos breathers resist */
2061 if (seen) obvious = TRUE;
2063 if (r_ptr->flagsr & RFR_RES_ALL)
2065 note = _("には完全な耐性がある!", " is immune.");
2067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2070 if (r_ptr->flagsr & RFR_RES_CHAO)
2072 note = _("には耐性がある。", " resists.");
2073 dam *= 3; dam /= randint1(6) + 6;
2074 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2076 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2078 note = _("はいくらか耐性を示した。", " resists somewhat.");
2079 dam *= 3; dam /= randint1(6) + 6;
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2085 do_conf = (5 + randint1(11) + r) / (r + 1);
2090 /* Shards -- Shard breathers resist */
2093 if (seen) obvious = TRUE;
2095 if (r_ptr->flagsr & RFR_RES_ALL)
2097 note = _("には完全な耐性がある!", " is immune.");
2099 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2102 if (r_ptr->flagsr & RFR_RES_SHAR)
2104 note = _("には耐性がある。", " resists.");
2105 dam *= 3; dam /= randint1(6) + 6;
2106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2111 /* Rocket: Shard resistance helps */
2114 if (seen) obvious = TRUE;
2116 if (r_ptr->flagsr & RFR_RES_ALL)
2118 note = _("には完全な耐性がある!", " is immune.");
2120 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2123 if (r_ptr->flagsr & RFR_RES_SHAR)
2125 note = _("はいくらか耐性を示した。", " resists somewhat.");
2127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2133 /* Sound -- Sound breathers resist */
2136 if (seen) obvious = TRUE;
2138 if (r_ptr->flagsr & RFR_RES_ALL)
2140 note = _("には完全な耐性がある!", " is immune.");
2142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2145 if (r_ptr->flagsr & RFR_RES_SOUN)
2147 note = _("には耐性がある。", " resists.");
2148 dam *= 2; dam /= randint1(6) + 6;
2149 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2151 else do_stun = (10 + randint1(15) + r) / (r + 1);
2158 if (seen) obvious = TRUE;
2160 if (r_ptr->flagsr & RFR_RES_ALL)
2162 note = _("には完全な耐性がある!", " is immune.");
2164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2167 if (r_ptr->flags3 & RF3_NO_CONF)
2169 note = _("には耐性がある。", " resists.");
2170 dam *= 3; dam /= randint1(6) + 6;
2171 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2173 else do_conf = (10 + randint1(15) + r) / (r + 1);
2177 /* Disenchantment -- Breathers and Disenchanters resist */
2180 if (seen) obvious = TRUE;
2182 if (r_ptr->flagsr & RFR_RES_ALL)
2184 note = _("には完全な耐性がある!", " is immune.");
2186 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2189 if (r_ptr->flagsr & RFR_RES_DISE)
2191 note = _("には耐性がある。", " resists.");
2192 dam *= 3; dam /= randint1(6) + 6;
2193 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2198 /* Nexus -- Breathers and Existers resist */
2201 if (seen) obvious = TRUE;
2203 if (r_ptr->flagsr & RFR_RES_ALL)
2205 note = _("には完全な耐性がある!", " is immune.");
2207 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2210 if (r_ptr->flagsr & RFR_RES_NEXU)
2212 note = _("には耐性がある。", " resists.");
2213 dam *= 3; dam /= randint1(6) + 6;
2214 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2222 if (seen) obvious = TRUE;
2224 if (r_ptr->flagsr & RFR_RES_ALL)
2226 note = _("には完全な耐性がある!", " is immune.");
2228 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2231 if (r_ptr->flagsr & RFR_RES_WALL)
2233 note = _("には耐性がある。", " resists.");
2234 dam *= 3; dam /= randint1(6) + 6;
2235 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2237 else do_stun = (randint1(15) + r) / (r + 1);
2241 /* Inertia -- breathers resist */
2244 if (seen) obvious = TRUE;
2246 if (r_ptr->flagsr & RFR_RES_ALL)
2248 note = _("には完全な耐性がある!", " is immune.");
2250 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2253 if (r_ptr->flagsr & RFR_RES_INER)
2255 note = _("には耐性がある。", " resists.");
2256 dam *= 3; dam /= randint1(6) + 6;
2257 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2261 /* Powerful monsters can resist */
2262 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2263 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2267 /* Normal monsters slow down */
2270 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2272 note = _("の動きが遅くなった。", " starts moving slower.");
2279 /* Time -- breathers resist */
2282 if (seen) obvious = TRUE;
2284 if (r_ptr->flagsr & RFR_RES_ALL)
2286 note = _("には完全な耐性がある!", " is immune.");
2288 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2291 if (r_ptr->flagsr & RFR_RES_TIME)
2293 note = _("には耐性がある。", " resists.");
2294 dam *= 3; dam /= randint1(6) + 6;
2295 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2297 else do_time = (dam + 1) / 2;
2301 /* Gravity -- breathers resist */
2304 bool resist_tele = FALSE;
2306 if (seen) obvious = TRUE;
2308 if (r_ptr->flagsr & RFR_RES_ALL)
2310 note = _("には完全な耐性がある!", " is immune.");
2312 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2315 if (r_ptr->flagsr & RFR_RES_TELE)
2317 if (r_ptr->flags1 & (RF1_UNIQUE))
2319 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2320 note = _("には効果がなかった。", " is unaffected!");
2323 else if (r_ptr->level > randint1(100))
2325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2326 note = _("には耐性がある!", " resists!");
2331 if (!resist_tele) do_dist = 10;
2333 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2335 if (r_ptr->flagsr & RFR_RES_GRAV)
2337 note = _("には耐性がある!", " resists!");
2338 dam *= 3; dam /= randint1(6) + 6;
2340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2345 /* Powerful monsters can resist */
2346 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2347 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2351 /* Normal monsters slow down */
2354 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2356 note = _("の動きが遅くなった。", " starts moving slower.");
2361 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2363 /* Attempt a saving throw */
2364 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2365 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2369 /* No obvious effect */
2370 note = _("には効果がなかった。", " is unaffected!");
2382 if (seen) obvious = TRUE;
2384 if (r_ptr->flagsr & RFR_RES_ALL)
2386 note = _("には完全な耐性がある!", " is immune.");
2388 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2396 case GF_DISINTEGRATE:
2398 if (seen) obvious = TRUE;
2400 if (r_ptr->flagsr & RFR_RES_ALL)
2402 note = _("には完全な耐性がある!", " is immune.");
2404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2407 if (r_ptr->flags3 & RF3_HURT_ROCK)
2409 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2410 note = _("の皮膚がただれた!", " loses some skin!");
2411 note_dies = _("は蒸発した!", " evaporates!");
2419 if (seen) obvious = TRUE;
2421 /* PSI only works if the monster can see you! -- RG */
2422 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2425 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2430 if (r_ptr->flagsr & RFR_RES_ALL)
2432 note = _("には完全な耐性がある!", " is immune.");
2434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2437 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2440 note = _("には完全な耐性がある!", " is immune.");
2441 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2444 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2445 (r_ptr->flags3 & RF3_ANIMAL) ||
2446 (r_ptr->level > randint1(3 * dam)))
2448 note = _("には耐性がある!", " resists!");
2452 * Powerful demons & undead can turn a mindcrafter's
2453 * attacks back on them
2455 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2456 (r_ptr->level > p_ptr->lev / 2) &&
2460 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2461 (seen ? "%^s's corrupted mind backlashes your attack!" :
2462 "%^ss corrupted mind backlashes your attack!")), m_name);
2465 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2467 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2471 /* Injure +/- confusion */
2472 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2473 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2474 if (one_in_(4) && !CHECK_MULTISHADOW())
2476 switch (randint1(4))
2479 set_confused(p_ptr->confused + 3 + randint1(dam));
2482 set_stun(p_ptr->stun + randint1(dam));
2486 if (r_ptr->flags3 & RF3_NO_FEAR)
2487 note = _("には効果がなかった。", " is unaffected.");
2489 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2493 if (!p_ptr->free_act)
2494 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2503 if ((dam > 0) && one_in_(4))
2505 switch (randint1(4))
2508 do_conf = 3 + randint1(dam);
2511 do_stun = 3 + randint1(dam);
2514 do_fear = 3 + randint1(dam);
2517 note = _("は眠り込んでしまった!", " falls asleep!");
2518 do_sleep = 3 + randint1(dam);
2523 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2529 if (seen) obvious = TRUE;
2531 if (r_ptr->flagsr & RFR_RES_ALL)
2533 note = _("には完全な耐性がある!", " is immune.");
2535 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2538 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2541 note = _("には完全な耐性がある!", " is immune.");
2543 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2544 (r_ptr->flags3 & RF3_ANIMAL) ||
2545 (r_ptr->level > randint1(3 * dam)))
2547 note = _("には耐性がある!", " resists!");
2551 * Powerful demons & undead can turn a mindcrafter's
2552 * attacks back on them
2554 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2555 (r_ptr->level > p_ptr->lev / 2) &&
2559 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2560 (seen ? "%^s's corrupted mind backlashes your attack!" :
2561 "%^ss corrupted mind backlashes your attack!")), m_name);
2563 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2565 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2569 /* Injure + mana drain */
2570 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2571 if (!CHECK_MULTISHADOW())
2573 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2574 p_ptr->csp -= damroll(5, dam) / 2;
2575 if (p_ptr->csp < 0) p_ptr->csp = 0;
2576 p_ptr->redraw |= PR_MANA;
2577 p_ptr->window |= (PW_SPELL);
2579 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2586 int b = damroll(5, dam) / 4;
2587 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2588 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2589 (seen ? "You convert %s's pain into %s!" :
2590 "You convert %ss pain into %s!"));
2591 msg_format(msg, m_name, str);
2593 b = MIN(p_ptr->msp, p_ptr->csp + b);
2595 p_ptr->redraw |= PR_MANA;
2596 p_ptr->window |= (PW_SPELL);
2598 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2602 case GF_TELEKINESIS:
2604 if (seen) obvious = TRUE;
2606 if (r_ptr->flagsr & RFR_RES_ALL)
2608 note = _("には完全な耐性がある!", " is immune.");
2610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2615 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2620 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2622 /* Attempt a saving throw */
2623 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2624 (r_ptr->level > 5 + randint1(dam)))
2628 /* No obvious effect */
2634 /* Psycho-spear -- powerful magic missile */
2637 if (seen) obvious = TRUE;
2639 if (r_ptr->flagsr & RFR_RES_ALL)
2641 note = _("には完全な耐性がある!", " is immune.");
2643 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2649 /* Meteor -- powerful magic missile */
2652 if (seen) obvious = TRUE;
2654 if (r_ptr->flagsr & RFR_RES_ALL)
2656 note = _("には完全な耐性がある!", " is immune.");
2658 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2666 if (!is_hostile(m_ptr)) break;
2668 if (seen) obvious = TRUE;
2670 if (r_ptr->flagsr & RFR_RES_ALL)
2672 note = _("には効果がなかった!", " is immune.");
2674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2677 /* Attempt a saving throw */
2678 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2679 (r_ptr->flags3 & RF3_NO_CONF) ||
2680 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2682 /* Memorize a flag */
2683 if (r_ptr->flags3 & RF3_NO_CONF)
2685 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2692 * Powerful demons & undead can turn a mindcrafter's
2693 * attacks back on them
2695 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2696 (r_ptr->level > p_ptr->lev / 2) &&
2700 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2701 (seen ? "%^s's corrupted mind backlashes your attack!" :
2702 "%^ss corrupted mind backlashes your attack!")), m_name);
2705 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2707 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2711 /* Confuse, stun, terrify */
2712 switch (randint1(4))
2715 set_stun(p_ptr->stun + dam / 2);
2718 set_confused(p_ptr->confused + dam / 2);
2722 if (r_ptr->flags3 & RF3_NO_FEAR)
2723 note = _("には効果がなかった。", " is unaffected.");
2725 set_afraid(p_ptr->afraid + dam);
2732 /* No obvious effect */
2733 note = _("には効果がなかった。", " is unaffected.");
2739 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2741 note = _("があなたに隷属した。", " is in your thrall!");
2746 switch (randint1(4))
2760 /* No "real" damage */
2767 /* Ice -- Cold + Cuts + Stun */
2770 if (seen) obvious = TRUE;
2772 if (r_ptr->flagsr & RFR_RES_ALL)
2774 note = _("には完全な耐性がある!", " is immune.");
2776 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2779 do_stun = (randint1(15) + 1) / (r + 1);
2780 if (r_ptr->flagsr & RFR_IM_COLD)
2782 note = _("にはかなり耐性がある!", " resists a lot.");
2784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2786 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2788 note = _("はひどい痛手をうけた。", " is hit hard.");
2790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2797 case GF_HYPODYNAMIA:
2799 if (seen) obvious = TRUE;
2801 if (r_ptr->flagsr & RFR_RES_ALL)
2803 note = _("には完全な耐性がある!", " is immune.");
2805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2808 if (!monster_living(r_ptr))
2810 if (is_original_ap_and_seen(m_ptr))
2812 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2813 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2814 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2816 note = _("には効果がなかった。", " is unaffected.");
2820 else do_time = (dam+7)/8;
2828 if (seen) obvious = TRUE;
2830 if (r_ptr->flagsr & RFR_RES_ALL)
2832 note = _("には完全な耐性がある!", " is immune.");
2834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2837 if (!monster_living(r_ptr))
2839 if (is_original_ap_and_seen(m_ptr))
2841 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2842 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2843 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2845 note = _("には完全な耐性がある!", " is immune.");
2849 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2850 (randint1(888) != 666)) ||
2851 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2852 randint1(100) != 66))
2854 note = _("には耐性がある!", " resists!");
2862 /* Polymorph monster (Use "dam" as "power") */
2865 if (seen) obvious = TRUE;
2867 if (r_ptr->flagsr & RFR_RES_ALL)
2869 note = _("には効果がなかった。", " is unaffected.");
2871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2874 /* Attempt to polymorph (see below) */
2877 /* Powerful monsters can resist */
2878 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2879 (r_ptr->flags1 & RF1_QUESTOR) ||
2880 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2882 note = _("には効果がなかった。", " is unaffected.");
2887 /* No "real" damage */
2894 /* Clone monsters (Ignore "dam") */
2897 if (seen) obvious = TRUE;
2899 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2901 note = _("には効果がなかった。", " is unaffected.");
2906 m_ptr->hp = m_ptr->maxhp;
2908 /* Attempt to clone. */
2909 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2911 note = _("が分裂した!", " spawns!");
2915 /* No "real" damage */
2922 /* Heal Monster (use "dam" as amount of healing) */
2925 if (seen) obvious = TRUE;
2928 (void)set_monster_csleep(c_ptr->m_idx, 0);
2930 if (m_ptr->maxhp < m_ptr->max_maxhp)
2932 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2933 m_ptr->maxhp = m_ptr->max_maxhp;
2938 /* Redraw (later) if needed */
2939 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2940 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2948 if (seen) obvious = TRUE;
2951 (void)set_monster_csleep(c_ptr->m_idx, 0);
2952 if (MON_STUNNED(m_ptr))
2954 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2955 (void)set_monster_stunned(c_ptr->m_idx, 0);
2957 if (MON_CONFUSED(m_ptr))
2959 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2960 (void)set_monster_confused(c_ptr->m_idx, 0);
2962 if (MON_MONFEAR(m_ptr))
2964 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2965 (void)set_monster_monfear(c_ptr->m_idx, 0);
2969 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2972 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2976 chg_virtue(V_VITALITY, 1);
2978 if (r_ptr->flags1 & RF1_UNIQUE)
2979 chg_virtue(V_INDIVIDUALISM, 1);
2981 if (is_friendly(m_ptr))
2982 chg_virtue(V_HONOUR, 1);
2983 else if (!(r_ptr->flags3 & RF3_EVIL))
2985 if (r_ptr->flags3 & RF3_GOOD)
2986 chg_virtue(V_COMPASSION, 2);
2988 chg_virtue(V_COMPASSION, 1);
2991 if (r_ptr->flags3 & RF3_ANIMAL)
2992 chg_virtue(V_NATURE, 1);
2995 if (m_ptr->r_idx == MON_LEPER)
2998 if (!who) chg_virtue(V_COMPASSION, 5);
3001 /* Redraw (later) if needed */
3002 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3003 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3005 note = _("は体力を回復したようだ。", " looks healthier.");
3007 /* No "real" damage */
3013 /* Speed Monster (Ignore "dam") */
3016 if (seen) obvious = TRUE;
3019 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3021 note = _("の動きが速くなった。", " starts moving faster.");
3026 if (r_ptr->flags1 & RF1_UNIQUE)
3027 chg_virtue(V_INDIVIDUALISM, 1);
3028 if (is_friendly(m_ptr))
3029 chg_virtue(V_HONOUR, 1);
3032 /* No "real" damage */
3038 /* Slow Monster (Use "dam" as "power") */
3041 if (seen) obvious = TRUE;
3043 if (r_ptr->flagsr & RFR_RES_ALL)
3045 note = _("には効果がなかった。", " is unaffected.");
3047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3050 /* Powerful monsters can resist */
3051 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3052 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3054 note = _("には効果がなかった。", " is unaffected.");
3058 /* Normal monsters slow down */
3061 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3063 note = _("の動きが遅くなった。", " starts moving slower.");
3067 /* No "real" damage */
3073 /* Sleep (Use "dam" as "power") */
3076 if (seen) obvious = TRUE;
3078 if (r_ptr->flagsr & RFR_RES_ALL)
3080 note = _("には効果がなかった。", " is unaffected.");
3082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3085 /* Attempt a saving throw */
3086 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3087 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3088 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3090 /* Memorize a flag */
3091 if (r_ptr->flags3 & RF3_NO_SLEEP)
3093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3095 /* No obvious effect */
3096 note = _("には効果がなかった。", " is unaffected.");
3101 /* Go to sleep (much) later */
3102 note = _("は眠り込んでしまった!", " falls asleep!");
3106 /* No "real" damage */
3112 /* Sleep (Use "dam" as "power") */
3113 case GF_STASIS_EVIL:
3115 if (seen) obvious = TRUE;
3117 if (r_ptr->flagsr & RFR_RES_ALL)
3119 note = _("には効果がなかった!", " is immune.");
3121 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3124 /* Attempt a saving throw */
3125 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3126 !(r_ptr->flags3 & RF3_EVIL) ||
3127 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3129 note = _("には効果がなかった。", " is unaffected.");
3134 /* Go to sleep (much) later */
3135 note = _("は動けなくなった!", " is suspended!");
3139 /* No "real" damage */
3144 /* Sleep (Use "dam" as "power") */
3147 if (seen) obvious = TRUE;
3149 if (r_ptr->flagsr & RFR_RES_ALL)
3151 note = _("には効果がなかった。", " is unaffected.");
3153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3156 /* Attempt a saving throw */
3157 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3158 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3160 note = _("には効果がなかった。", " is unaffected.");
3165 /* Go to sleep (much) later */
3166 note = _("は動けなくなった!", " is suspended!");
3170 /* No "real" damage */
3179 vir = virtue_number(V_HARMONY);
3182 dam += p_ptr->virtues[vir-1]/10;
3185 vir = virtue_number(V_INDIVIDUALISM);
3188 dam -= p_ptr->virtues[vir-1]/20;
3191 if (seen) obvious = TRUE;
3193 /* Attempt a saving throw */
3194 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3198 /* No obvious effect */
3199 note = _("には効果がなかった。", " is unaffected.");
3202 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3204 else if (p_ptr->cursed & TRC_AGGRAVATE)
3206 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3207 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3211 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3214 chg_virtue(V_INDIVIDUALISM, -1);
3215 if (r_ptr->flags3 & RF3_ANIMAL)
3216 chg_virtue(V_NATURE, 1);
3219 /* No "real" damage */
3224 /* Control undead */
3225 case GF_CONTROL_UNDEAD:
3228 if (seen) obvious = TRUE;
3230 vir = virtue_number(V_UNLIFE);
3233 dam += p_ptr->virtues[vir-1]/10;
3236 vir = virtue_number(V_INDIVIDUALISM);
3239 dam -= p_ptr->virtues[vir-1]/20;
3242 /* Attempt a saving throw */
3243 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3244 !(r_ptr->flags3 & RF3_UNDEAD))
3246 /* No obvious effect */
3247 note = _("には効果がなかった。", " is unaffected.");
3249 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3251 else if (p_ptr->cursed & TRC_AGGRAVATE)
3253 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3254 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3258 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3262 /* No "real" damage */
3268 case GF_CONTROL_DEMON:
3271 if (seen) obvious = TRUE;
3273 vir = virtue_number(V_UNLIFE);
3276 dam += p_ptr->virtues[vir-1]/10;
3279 vir = virtue_number(V_INDIVIDUALISM);
3282 dam -= p_ptr->virtues[vir-1]/20;
3285 /* Attempt a saving throw */
3286 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3287 !(r_ptr->flags3 & RF3_DEMON))
3289 /* No obvious effect */
3290 note = _("には効果がなかった。", " is unaffected.");
3292 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3294 else if (p_ptr->cursed & TRC_AGGRAVATE)
3296 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3297 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3301 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3305 /* No "real" damage */
3311 case GF_CONTROL_ANIMAL:
3314 if (seen) obvious = TRUE;
3316 vir = virtue_number(V_NATURE);
3319 dam += p_ptr->virtues[vir-1]/10;
3322 vir = virtue_number(V_INDIVIDUALISM);
3325 dam -= p_ptr->virtues[vir-1]/20;
3328 /* Attempt a saving throw */
3329 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3330 !(r_ptr->flags3 & RF3_ANIMAL))
3333 /* No obvious effect */
3334 note = _("には効果がなかった。", " is unaffected.");
3336 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3338 else if (p_ptr->cursed & TRC_AGGRAVATE)
3340 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3341 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3345 note = _("はなついた。", " is tamed!");
3347 if (r_ptr->flags3 & RF3_ANIMAL)
3348 chg_virtue(V_NATURE, 1);
3351 /* No "real" damage */
3357 case GF_CHARM_LIVING:
3361 vir = virtue_number(V_UNLIFE);
3362 if (seen) obvious = TRUE;
3364 vir = virtue_number(V_UNLIFE);
3367 dam -= p_ptr->virtues[vir-1]/10;
3370 vir = virtue_number(V_INDIVIDUALISM);
3373 dam -= p_ptr->virtues[vir-1]/20;
3376 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3378 /* Attempt a saving throw */
3379 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3380 !monster_living(r_ptr))
3383 /* No obvious effect */
3384 note = _("には効果がなかった。", " is unaffected.");
3386 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3388 else if (p_ptr->cursed & TRC_AGGRAVATE)
3390 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3391 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3395 note = _("を支配した。", " is tamed!");
3397 if (r_ptr->flags3 & RF3_ANIMAL)
3398 chg_virtue(V_NATURE, 1);
3401 /* No "real" damage */
3406 /* Confusion (Use "dam" as "power") */
3409 if (seen) obvious = TRUE;
3411 if (r_ptr->flagsr & RFR_RES_ALL)
3413 note = _("には効果がなかった。", " is unaffected.");
3415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3418 /* Get confused later */
3419 do_conf = damroll(3, (dam / 2)) + 1;
3421 /* Attempt a saving throw */
3422 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3423 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3424 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3426 /* Memorize a flag */
3427 if (r_ptr->flags3 & (RF3_NO_CONF))
3429 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3435 /* No obvious effect */
3436 note = _("には効果がなかった。", " is unaffected.");
3440 /* No "real" damage */
3447 if (seen) obvious = TRUE;
3449 if (r_ptr->flagsr & RFR_RES_ALL)
3451 note = _("には効果がなかった。", " is unaffected.");
3453 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3456 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3458 /* Attempt a saving throw */
3459 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3460 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3465 /* No obvious effect */
3466 note = _("には効果がなかった。", " is unaffected.");
3470 /* No "real" damage */
3478 /* Lite, but only hurts susceptible creatures */
3486 if (r_ptr->flagsr & RFR_RES_ALL)
3492 if (r_ptr->flags3 & (RF3_HURT_LITE))
3494 /* Obvious effect */
3495 if (seen) obvious = TRUE;
3497 /* Memorize the effects */
3498 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3500 /* Special effect */
3501 note = _("は光に身をすくめた!", " cringes from the light!");
3502 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3505 /* Normally no damage */
3517 /* Lite -- opposite of Dark */
3520 if (seen) obvious = TRUE;
3522 if (r_ptr->flagsr & RFR_RES_ALL)
3524 note = _("には完全な耐性がある!", " is immune.");
3526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3529 if (r_ptr->flagsr & RFR_RES_LITE)
3531 note = _("には耐性がある!", " resists!");
3532 dam *= 2; dam /= (randint1(6)+6);
3533 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3535 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3538 note = _("は光に身をすくめた!", " cringes from the light!");
3539 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3546 /* Dark -- opposite of Lite */
3549 if (seen) obvious = TRUE;
3551 if (r_ptr->flagsr & RFR_RES_ALL)
3553 note = _("には完全な耐性がある!", " is immune.");
3555 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3558 if (r_ptr->flagsr & RFR_RES_DARK)
3560 note = _("には耐性がある!", " resists!");
3561 dam *= 2; dam /= (randint1(6)+6);
3562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3571 if (r_ptr->flagsr & RFR_RES_ALL)
3576 /* Hurt by rock remover */
3577 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3580 if (seen) obvious = TRUE;
3582 /* Memorize the effects */
3583 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3585 /* Cute little message */
3586 note = _("の皮膚がただれた!", " loses some skin!");
3587 note_dies = _("はドロドロに溶けた!", " dissolves!");
3590 /* Usually, ignore the effects */
3601 /* Teleport undead (Use "dam" as "power") */
3602 case GF_AWAY_UNDEAD:
3604 /* Only affect undead */
3605 if (r_ptr->flags3 & (RF3_UNDEAD))
3607 bool resists_tele = FALSE;
3609 if (r_ptr->flagsr & RFR_RES_TELE)
3611 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3613 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3614 note = _("には効果がなかった。", " is unaffected.");
3615 resists_tele = TRUE;
3617 else if (r_ptr->level > randint1(100))
3619 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3620 note = _("には耐性がある!", " resists!");
3621 resists_tele = TRUE;
3627 if (seen) obvious = TRUE;
3628 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3640 /* No "real" damage */
3646 /* Teleport evil (Use "dam" as "power") */
3649 /* Only affect evil */
3650 if (r_ptr->flags3 & (RF3_EVIL))
3652 bool resists_tele = FALSE;
3654 if (r_ptr->flagsr & RFR_RES_TELE)
3656 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3658 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3659 note = _("には効果がなかった。", " is unaffected.");
3660 resists_tele = TRUE;
3662 else if (r_ptr->level > randint1(100))
3664 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3665 note = _("には耐性がある!", " resists!");
3666 resists_tele = TRUE;
3672 if (seen) obvious = TRUE;
3673 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3685 /* No "real" damage */
3691 /* Teleport monster (Use "dam" as "power") */
3694 bool resists_tele = FALSE;
3695 if (r_ptr->flagsr & RFR_RES_TELE)
3697 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3699 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3700 note = _("には効果がなかった。", " is unaffected.");
3701 resists_tele = TRUE;
3703 else if (r_ptr->level > randint1(100))
3705 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3706 note = _("には耐性がある!", " resists!");
3707 resists_tele = TRUE;
3714 if (seen) obvious = TRUE;
3716 /* Prepare to teleport */
3720 /* No "real" damage */
3726 /* Turn undead (Use "dam" as "power") */
3727 case GF_TURN_UNDEAD:
3729 if (r_ptr->flagsr & RFR_RES_ALL)
3734 /* Only affect undead */
3735 if (r_ptr->flags3 & (RF3_UNDEAD))
3738 if (seen) obvious = TRUE;
3740 /* Learn about type */
3741 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3743 /* Apply some fear */
3744 do_fear = damroll(3, (dam / 2)) + 1;
3746 /* Attempt a saving throw */
3747 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3749 /* No obvious effect */
3750 note = _("には効果がなかった。", " is unaffected.");
3763 /* No "real" damage */
3769 /* Turn evil (Use "dam" as "power") */
3772 if (r_ptr->flagsr & RFR_RES_ALL)
3777 /* Only affect evil */
3778 if (r_ptr->flags3 & (RF3_EVIL))
3781 if (seen) obvious = TRUE;
3783 /* Learn about type */
3784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3786 /* Apply some fear */
3787 do_fear = damroll(3, (dam / 2)) + 1;
3789 /* Attempt a saving throw */
3790 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3792 /* No obvious effect */
3793 note = _("には効果がなかった。", " is unaffected.");
3806 /* No "real" damage */
3812 /* Turn monster (Use "dam" as "power") */
3815 if (r_ptr->flagsr & RFR_RES_ALL)
3821 if (seen) obvious = TRUE;
3823 /* Apply some fear */
3824 do_fear = damroll(3, (dam / 2)) + 1;
3826 /* Attempt a saving throw */
3827 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3828 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3829 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3831 /* No obvious effect */
3832 note = _("には効果がなかった。", " is unaffected.");
3837 /* No "real" damage */
3844 case GF_DISP_UNDEAD:
3846 if (r_ptr->flagsr & RFR_RES_ALL)
3852 /* Only affect undead */
3853 if (r_ptr->flags3 & (RF3_UNDEAD))
3856 if (seen) obvious = TRUE;
3858 /* Learn about type */
3859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3861 note = _("は身震いした。", " shudders.");
3862 note_dies = _("はドロドロに溶けた!", " dissolves!");
3882 if (r_ptr->flagsr & RFR_RES_ALL)
3888 /* Only affect evil */
3889 if (r_ptr->flags3 & (RF3_EVIL))
3892 if (seen) obvious = TRUE;
3894 /* Learn about type */
3895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3897 note = _("は身震いした。", " shudders.");
3898 note_dies = _("はドロドロに溶けた!", " dissolves!");
3917 if (r_ptr->flagsr & RFR_RES_ALL)
3923 /* Only affect good */
3924 if (r_ptr->flags3 & (RF3_GOOD))
3927 if (seen) obvious = TRUE;
3929 /* Learn about type */
3930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3932 note = _("は身震いした。", " shudders.");
3933 note_dies = _("はドロドロに溶けた!", " dissolves!");
3950 case GF_DISP_LIVING:
3952 if (r_ptr->flagsr & RFR_RES_ALL)
3958 /* Only affect non-undead */
3959 if (monster_living(r_ptr))
3962 if (seen) obvious = TRUE;
3964 note = _("は身震いした。", " shudders.");
3965 note_dies = _("はドロドロに溶けた!", " dissolves!");
3984 if (r_ptr->flagsr & RFR_RES_ALL)
3990 /* Only affect demons */
3991 if (r_ptr->flags3 & (RF3_DEMON))
3994 if (seen) obvious = TRUE;
3996 /* Learn about type */
3997 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3999 note = _("は身震いした。", " shudders.");
4000 note_dies = _("はドロドロに溶けた!", " dissolves!");
4016 /* Dispel monster */
4019 if (r_ptr->flagsr & RFR_RES_ALL)
4026 if (seen) obvious = TRUE;
4028 note = _("は身震いした。", " shudders.");
4029 note_dies = _("はドロドロに溶けた!", " dissolves!");
4036 if (seen) obvious = TRUE;
4038 if (r_ptr->flagsr & RFR_RES_ALL)
4040 note = _("には完全な耐性がある!", " is immune.");
4042 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4046 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4050 /* Heal the monster */
4051 if (caster_ptr->hp < caster_ptr->maxhp)
4054 caster_ptr->hp += dam;
4055 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4057 /* Redraw (later) if needed */
4058 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4059 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4061 /* Special message */
4064 /* Get the monster name */
4065 monster_desc(killer, caster_ptr, 0);
4066 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4072 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4073 (void)hp_player(dam);
4078 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4087 if (seen) obvious = TRUE;
4088 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4090 if (r_ptr->flagsr & RFR_RES_ALL)
4092 note = _("には完全な耐性がある!", " is immune.");
4094 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4098 /* Attempt a saving throw */
4099 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4100 (r_ptr->flags3 & RF3_NO_CONF) ||
4101 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4103 /* Memorize a flag */
4104 if (r_ptr->flags3 & (RF3_NO_CONF))
4106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4108 note = _("には効果がなかった。", " is unaffected.");
4111 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4113 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4114 note = _("には完全な耐性がある!", " is immune.");
4117 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4119 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4120 note = _("には耐性がある。", " resists.");
4125 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4126 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4128 if (who > 0) do_conf = randint0(4) + 4;
4129 else do_conf = randint0(8) + 8;
4135 case GF_BRAIN_SMASH:
4137 if (seen) obvious = TRUE;
4138 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4140 if (r_ptr->flagsr & RFR_RES_ALL)
4142 note = _("には完全な耐性がある!", " is immune.");
4144 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4148 /* Attempt a saving throw */
4149 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4150 (r_ptr->flags3 & RF3_NO_CONF) ||
4151 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4153 /* Memorize a flag */
4154 if (r_ptr->flags3 & (RF3_NO_CONF))
4156 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4158 note = _("には効果がなかった。", " is unaffected.");
4161 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4163 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4164 note = _("には完全な耐性がある!", " is immune.");
4167 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4170 note = _("には耐性がある!", " resists!");
4175 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4176 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4180 do_conf = randint0(4) + 4;
4181 do_stun = randint0(4) + 4;
4185 do_conf = randint0(8) + 8;
4186 do_stun = randint0(8) + 8;
4188 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4196 if (seen) obvious = TRUE;
4197 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4199 if (r_ptr->flagsr & RFR_RES_ALL)
4201 note = _("には完全な耐性がある!", " is immune.");
4203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4207 /* Attempt a saving throw */
4208 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4210 note = _("には効果がなかった。", " is unaffected.");
4219 if (seen) obvious = TRUE;
4220 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4222 if (r_ptr->flagsr & RFR_RES_ALL)
4224 note = _("には完全な耐性がある!", " is immune.");
4226 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4230 /* Attempt a saving throw */
4231 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4233 note = _("には効果がなかった。", " is unaffected.");
4242 if (seen) obvious = TRUE;
4243 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4245 if (r_ptr->flagsr & RFR_RES_ALL)
4247 note = _("には完全な耐性がある!", " is immune.");
4249 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4253 /* Attempt a saving throw */
4254 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4256 note = _("には効果がなかった。", " is unaffected.");
4265 if (seen) obvious = TRUE;
4267 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4268 "You point at %s, screaming the word, 'DIE!'."), m_name);
4270 if (r_ptr->flagsr & RFR_RES_ALL)
4272 note = _("には完全な耐性がある!", " is immune.");
4274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4278 /* Attempt a saving throw */
4279 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4281 note = _("には効果がなかった。", " is unaffected.");
4290 if (seen) obvious = TRUE;
4292 if (r_ptr->flagsr & RFR_RES_ALL)
4294 note = _("には完全な耐性がある!", " is immune.");
4296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4300 if (r_ptr->flags1 & RF1_UNIQUE)
4302 note = _("には効果がなかった。", " is unaffected.");
4307 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4308 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4310 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4312 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4316 note = _("は耐性を持っている!", "resists!");
4323 /* Capture monster */
4327 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4328 (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)
4330 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4335 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4336 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4337 nokori_hp = m_ptr->maxhp * 3 / 10;
4339 nokori_hp = m_ptr->maxhp * 3 / 20;
4341 if (m_ptr->hp >= nokori_hp)
4343 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4346 else if (m_ptr->hp < randint0(nokori_hp))
4348 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4349 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4350 cap_mon = m_ptr->r_idx;
4351 cap_mspeed = m_ptr->mspeed;
4353 cap_maxhp = m_ptr->max_maxhp;
4354 cap_nickname = m_ptr->nickname; /* Quark transfer */
4355 if (c_ptr->m_idx == p_ptr->riding)
4357 if (rakuba(-1, FALSE))
4359 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4363 delete_monster_idx(c_ptr->m_idx);
4369 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4375 /* Attack (Use "dam" as attack type) */
4378 /* Return this monster's death */
4379 return py_attack(y, x, dam);
4382 /* Sleep (Use "dam" as "power") */
4388 if (seen) obvious = TRUE;
4390 if (r_ptr->flagsr & RFR_RES_ALL)
4392 note = _("には効果がなかった。", " is unaffected.");
4394 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4397 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4399 note = _("には効果がなかった。", " is unaffected.");
4402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4405 if (MON_CSLEEP(m_ptr))
4407 note = _("には効果がなかった。", " is unaffected.");
4413 if (one_in_(5)) effect = 1;
4414 else if (one_in_(4)) effect = 2;
4415 else if (one_in_(3)) effect = 3;
4420 /* Powerful monsters can resist */
4421 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4422 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4424 note = _("には効果がなかった。", " is unaffected.");
4428 /* Normal monsters slow down */
4431 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4433 note = _("の動きが遅くなった。", " starts moving slower.");
4438 else if (effect == 2)
4440 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4442 /* Attempt a saving throw */
4443 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4444 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4449 /* No obvious effect */
4450 note = _("には効果がなかった。", " is unaffected.");
4455 else if (effect == 3)
4457 /* Attempt a saving throw */
4458 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4459 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4460 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4462 /* Memorize a flag */
4463 if (r_ptr->flags3 & RF3_NO_SLEEP)
4465 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4468 /* No obvious effect */
4469 note = _("には効果がなかった。", " is unaffected.");
4474 /* Go to sleep (much) later */
4475 note = _("は眠り込んでしまった!", " falls asleep!");
4482 note = _("には効果がなかった。", " is unaffected.");
4485 /* No "real" damage */
4493 if (seen) obvious = TRUE;
4495 if (r_ptr->flagsr & RFR_RES_ALL)
4497 note = _("には効果がなかった。", " is unaffected.");
4499 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4503 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4505 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4506 chg_virtue(V_VITALITY, -1);
4516 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4518 if (r_ptr->flags3 & (RF3_HURT_LITE))
4520 /* Obvious effect */
4521 if (seen) obvious = TRUE;
4523 /* Memorize the effects */
4524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4526 /* Special effect */
4527 note = _("は光に身をすくめた!", " cringes from the light!");
4528 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4531 /* Normally no damage */
4538 photo = m_ptr->r_idx;
4545 case GF_BLOOD_CURSE:
4547 if (seen) obvious = TRUE;
4549 if (r_ptr->flagsr & RFR_RES_ALL)
4551 note = _("には完全な耐性がある!", " is immune.");
4553 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4561 bool success = FALSE;
4562 if (seen) obvious = TRUE;
4564 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4566 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4567 if (dam < 1) dam = 1;
4569 /* No need to tame your pet */
4572 note = _("の動きが速くなった。", " starts moving faster.");
4573 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4577 /* Attempt a saving throw */
4578 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4579 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4580 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4581 (p_ptr->cursed & TRC_AGGRAVATE) ||
4582 ((r_ptr->level+10) > randint1(dam)))
4585 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4589 note = _("を支配した。", " is tamed!");
4591 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4593 /* Learn about type */
4594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4601 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4603 do_fear = randint1(90)+10;
4605 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4608 /* No "real" damage */
4615 if (seen) obvious = TRUE;
4617 if (r_ptr->flagsr & RFR_RES_ALL)
4619 note = _("には完全な耐性がある!", " is immune.");
4621 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4625 /* Attempt a saving throw */
4626 if (randint0(100 + dam) < (r_ptr->level + 50))
4628 note = _("には効果がなかった。", " is unaffected.");
4648 /* Absolutely no effect */
4649 if (skipped) return (FALSE);
4651 /* "Unique" monsters cannot be polymorphed */
4652 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4654 /* Quest monsters cannot be polymorphed */
4655 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4657 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4659 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4660 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4662 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4667 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4668 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4671 /* Modify the damage */
4673 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4674 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4676 /* Check for death */
4677 if (dam > m_ptr->hp)
4679 /* Extract method of death */
4684 /* Sound and Impact resisters never stun */
4686 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4687 !(r_ptr->flags3 & RF3_NO_STUN))
4690 if (seen) obvious = TRUE;
4693 if (MON_STUNNED(m_ptr))
4695 note = _("はひどくもうろうとした。", " is more dazed.");
4696 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4700 note = _("はもうろうとした。", " is dazed.");
4705 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4711 /* Confusion and Chaos resisters (and sleepers) never confuse */
4713 !(r_ptr->flags3 & RF3_NO_CONF) &&
4714 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4717 if (seen) obvious = TRUE;
4719 /* Already partially confused */
4720 if (MON_CONFUSED(m_ptr))
4722 note = _("はさらに混乱したようだ。", " looks more confused.");
4723 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4726 /* Was not confused */
4729 note = _("は混乱したようだ。", " looks confused.");
4733 /* Apply confusion */
4734 (void)set_monster_confused(c_ptr->m_idx, tmp);
4743 if (seen) obvious = TRUE;
4745 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4749 note = _("は弱くなったようだ。", " seems weakened.");
4750 m_ptr->maxhp -= do_time;
4751 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4756 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4757 if (do_poly && (randint1(90) > r_ptr->level))
4759 if (polymorph_monster(y, x))
4762 if (seen) obvious = TRUE;
4764 /* Monster polymorphs */
4765 note = _("が変身した!", " changes!");
4767 /* Turn off the damage */
4773 note = _("には効果がなかった。", " is unaffected.");
4776 /* Hack -- Get new monster */
4777 m_ptr = &m_list[c_ptr->m_idx];
4779 /* Hack -- Get new race */
4780 r_ptr = &r_info[m_ptr->r_idx];
4783 /* Handle "teleport" */
4787 if (seen) obvious = TRUE;
4789 note = _("が消え去った!", " disappears!");
4791 if (!who) chg_virtue(V_VALOUR, -1);
4794 teleport_away(c_ptr->m_idx, do_dist,
4795 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4797 /* Hack -- get new location */
4801 /* Hack -- get new grid */
4802 c_ptr = &cave[y][x];
4809 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4816 if (typ == GF_DRAIN_MANA)
4818 /* Drain mana does nothing */
4821 /* If another monster did the damage, hurt the monster by hand */
4824 /* Redraw (later) if needed */
4825 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4826 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4828 /* Wake the monster up */
4829 (void)set_monster_csleep(c_ptr->m_idx, 0);
4831 /* Hurt the monster */
4839 if (is_pet(m_ptr) && !(m_ptr->ml))
4842 /* Give detailed messages if destroyed */
4845 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4848 msg_format("%^s%s", m_name, note);
4856 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4858 /* Generate treasure, etc */
4859 monster_death(c_ptr->m_idx, FALSE);
4862 delete_monster_idx(c_ptr->m_idx);
4866 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4870 /* Damaged monster */
4873 /* Give detailed messages if visible or destroyed */
4874 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4876 /* Hack -- Pain message */
4879 message_pain(c_ptr->m_idx, dam);
4886 /* Hack -- handle sleep */
4887 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4891 else if (heal_leper)
4893 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4895 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4899 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4900 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4903 delete_monster_idx(c_ptr->m_idx);
4906 /* If the player did it, give him experience, check fear */
4911 /* Hurt the monster, check for fear and death */
4912 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4917 /* Damaged monster */
4920 /* HACK - anger the monster before showing the sleep message */
4921 if (do_sleep) anger_monster(m_ptr);
4923 /* Give detailed messages if visible or destroyed */
4924 if (note && seen_msg)
4925 msg_format(_("%s%s", "%^s%s"), m_name, note);
4927 /* Hack -- Pain message */
4928 else if (known && (dam || !do_fear))
4930 message_pain(c_ptr->m_idx, dam);
4933 /* Anger monsters */
4934 if (((dam > 0) || get_angry) && !do_sleep)
4935 anger_monster(m_ptr);
4938 if ((fear || do_fear) && seen)
4942 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4945 /* Hack -- handle sleep */
4946 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4950 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4952 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4956 switch (randint1(28))
4961 msg_print(_("地面が揺れた...", "The ground trembles..."));
4962 earthquake(ty, tx, 4 + randint0(4));
4963 if (!one_in_(6)) break;
4965 case 3: case 4: case 5: case 6:
4968 int extra_dam = damroll(10, 10);
4969 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4971 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4972 if (!one_in_(6)) break;
4977 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4979 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4980 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4981 if (!one_in_(6)) break;
4983 case 9: case 10: case 11:
4984 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4985 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4986 if (!one_in_(6)) break;
4987 case 12: case 13: case 14: case 15: case 16:
4988 aggravate_monsters(0);
4989 if (!one_in_(6)) break;
4991 count += activate_hi_summon(ty, tx, TRUE);
4992 if (!one_in_(6)) break;
4993 case 19: case 20: case 21: case 22:
4995 bool pet = !one_in_(3);
4996 BIT_FLAGS mode = PM_ALLOW_GROUP;
4998 if (pet) mode |= PM_FORCE_PET;
4999 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5001 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);
5002 if (!one_in_(6)) break;
5004 case 23: case 24: case 25:
5005 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5006 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5008 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5009 else lose_exp(p_ptr->exp / 16);
5010 if (!one_in_(6)) break;
5011 case 26: case 27: case 28:
5020 (void)do_dec_stat(i);
5029 (void)do_dec_stat(randint0(6));
5038 if (p_ptr->inside_battle)
5040 p_ptr->health_who = c_ptr->m_idx;
5041 p_ptr->redraw |= (PR_HEALTH);
5045 /* Verify this code */
5047 /* Update the monster */
5048 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5050 /* Redraw the monster grid */
5054 /* Update monster recall window */
5055 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5057 p_ptr->window |= (PW_MONSTER);
5060 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5064 if (!(flg & PROJECT_NO_HANGEKI))
5066 set_target(m_ptr, monster_target_y, monster_target_x);
5069 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5071 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5075 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5077 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5078 rakubadam_m = (dam > 200) ? 200 : dam;
5087 /* Get local object */
5090 /* Prepare to make a Blade of Chaos */
5091 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5093 q_ptr->pval = photo;
5095 /* Mark the item as fully known */
5096 q_ptr->ident |= (IDENT_MENTAL);
5098 /* Drop it in the dungeon */
5099 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5107 /* Return "Anything seen?" */
5112 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5113 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5114 * @param who_name 効果を起こしたモンスターの名前
5115 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5116 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5117 * @param x 目標X座標 / Target x location (or location to travel "towards")
5118 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5119 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5121 * @param monspell 効果元のモンスター魔法ID
5122 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5124 * Handle a beam/bolt/ball causing damage to the player.
5125 * This routine takes a "source monster" (by index), a "distance", a default
5126 * "damage", and a "damage type". See "project_m()" above.
5127 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5128 * is reduced (see "project_m()" above). This can happen if a monster breathes
5129 * at the player and hits a wall instead.
5130 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5131 * to know if this is actually a ball or a bolt spell
5132 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5133 * we just assume that the effects were obvious, for historical reasons.
5135 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)
5140 /* Hack -- assume obvious */
5141 bool obvious = TRUE;
5143 /* Player blind-ness */
5144 bool blind = (p_ptr->blind ? TRUE : FALSE);
5146 /* Player needs a "description" (he is blind) */
5149 /* Source monster */
5150 monster_type *m_ptr = NULL;
5152 /* Monster name (for attacks) */
5155 /* Monster name (for damage) */
5158 /* Hack -- messages */
5164 /* Player is not here */
5165 if (!player_bold(y, x)) return (FALSE);
5167 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5169 if (kawarimi(TRUE)) return FALSE;
5172 /* Player cannot hurt himself */
5173 if (!who) return (FALSE);
5174 if (who == p_ptr->riding) return (FALSE);
5176 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5179 int max_attempts = 10;
5180 sound(SOUND_REFLECT);
5183 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5184 else if (p_ptr->special_defense & KATA_FUUJIN)
5185 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5187 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5190 /* Choose 'new' target */
5195 t_y = m_list[who].fy - 1 + randint1(3);
5196 t_x = m_list[who].fx - 1 + randint1(3);
5199 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5201 if (max_attempts < 1)
5203 t_y = m_list[who].fy;
5204 t_x = m_list[who].fx;
5209 t_y = p_ptr->y - 1 + randint1(3);
5210 t_x = p_ptr->x - 1 + randint1(3);
5213 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5215 disturb(TRUE, TRUE);
5219 /* Limit maximum damage */
5220 if (dam > 1600) dam = 1600;
5222 /* Reduce damage by distance */
5223 dam = (dam + r) / (r + 1);
5226 /* If the player is blind, be more descriptive */
5227 if (blind) fuzzy = TRUE;
5232 /* Get the source monster */
5233 m_ptr = &m_list[who];
5234 /* Extract the monster level */
5235 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5237 /* Get the monster name */
5238 monster_desc(m_name, m_ptr, 0);
5240 /* Get the monster's real name (gotten before polymorph!) */
5241 strcpy(killer, who_name);
5247 case PROJECT_WHO_UNCTRL_POWER:
5248 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5251 case PROJECT_WHO_GLASS_SHARDS:
5252 strcpy(killer, _("ガラスの破片", "shards of glass"));
5256 strcpy(killer, _("罠", "a trap"));
5261 strcpy(m_name, killer);
5264 /* Analyze the damage */
5267 /* Standard damage -- hurts inventory too */
5270 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5271 get_damage = acid_dam(dam, killer, monspell, FALSE);
5275 /* Standard damage -- hurts inventory too */
5278 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5279 get_damage = fire_dam(dam, killer, monspell, FALSE);
5283 /* Standard damage -- hurts inventory too */
5286 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5287 get_damage = cold_dam(dam, killer, monspell, FALSE);
5291 /* Standard damage -- hurts inventory too */
5294 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5295 get_damage = elec_dam(dam, killer, monspell, FALSE);
5299 /* Standard damage -- also poisons player */
5302 bool double_resist = IS_OPPOSE_POIS();
5303 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5305 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5306 if (double_resist) dam = (dam + 2) / 3;
5308 if ((!(double_resist || p_ptr->resist_pois)) &&
5309 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5314 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5316 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5318 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5323 /* Standard damage -- also poisons / mutates player */
5326 bool double_resist = IS_OPPOSE_POIS();
5327 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5329 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5330 if (double_resist) dam = (2 * dam + 2) / 5;
5331 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5332 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5334 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5336 if (one_in_(5)) /* 6 */
5338 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5339 if (one_in_(4)) /* 4 */
5347 inven_damage(set_acid_destroy, 2);
5353 /* Standard damage */
5356 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5357 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5361 /* Holy Orb -- Player only takes partial damage */
5364 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5365 if (p_ptr->align > 10)
5367 else if (p_ptr->align < -10)
5369 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5375 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5376 if (p_ptr->align > 10)
5378 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5382 /* Arrow -- XXX no dodging */
5387 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5389 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5391 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5394 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5398 /* Plasma -- XXX No resist */
5401 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5402 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5404 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5406 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5407 (void)set_stun(p_ptr->stun + plus_stun);
5410 if (!(p_ptr->resist_fire ||
5412 p_ptr->immune_fire))
5414 inven_damage(set_acid_destroy, 3);
5420 /* Nether -- drain experience */
5423 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5424 if (p_ptr->resist_neth)
5426 if (!prace_is_(RACE_SPECTRE))
5428 dam *= 6; dam /= (randint1(4) + 7);
5431 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5433 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5435 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5437 learn_spell(monspell);
5441 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5447 /* Water -- stun/confuse */
5450 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5451 if (!CHECK_MULTISHADOW())
5453 if (!p_ptr->resist_sound)
5455 set_stun(p_ptr->stun + randint1(40));
5457 if (!p_ptr->resist_conf)
5459 set_confused(p_ptr->confused + randint1(5) + 5);
5464 inven_damage(set_cold_destroy, 3);
5468 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5472 /* Chaos -- many effects */
5475 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5476 if (p_ptr->resist_chaos)
5478 dam *= 6; dam /= (randint1(4) + 7);
5481 if (!CHECK_MULTISHADOW())
5483 if (!p_ptr->resist_conf)
5485 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5487 if (!p_ptr->resist_chaos)
5489 (void)set_image(p_ptr->image + randint1(10));
5492 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5493 (void)gain_random_mutation(0);
5496 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5498 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5501 if (!p_ptr->resist_chaos || one_in_(9))
5503 inven_damage(set_elec_destroy, 2);
5504 inven_damage(set_fire_destroy, 2);
5508 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5512 /* Shards -- mostly cutting */
5515 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5516 if (p_ptr->resist_shard)
5518 dam *= 6; dam /= (randint1(4) + 7);
5520 else if (!CHECK_MULTISHADOW())
5522 (void)set_cut(p_ptr->cut + dam);
5525 if (!p_ptr->resist_shard || one_in_(13))
5527 inven_damage(set_cold_destroy, 2);
5530 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5534 /* Sound -- mostly stunning */
5537 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5538 if (p_ptr->resist_sound)
5540 dam *= 5; dam /= (randint1(4) + 7);
5542 else if (!CHECK_MULTISHADOW())
5544 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5545 (void)set_stun(p_ptr->stun + plus_stun);
5548 if (!p_ptr->resist_sound || one_in_(13))
5550 inven_damage(set_cold_destroy, 2);
5553 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5557 /* Pure confusion */
5560 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5561 if (p_ptr->resist_conf)
5563 dam *= 5; dam /= (randint1(4) + 7);
5565 else if (!CHECK_MULTISHADOW())
5567 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5569 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5573 /* Disenchantment -- see above */
5576 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5577 if (p_ptr->resist_disen)
5579 dam *= 6; dam /= (randint1(4) + 7);
5581 else if (!CHECK_MULTISHADOW())
5583 (void)apply_disenchant(0);
5585 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5589 /* Nexus -- see above */
5592 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5593 if (p_ptr->resist_nexus)
5595 dam *= 6; dam /= (randint1(4) + 7);
5597 else if (!CHECK_MULTISHADOW())
5601 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5605 /* Force -- mostly stun */
5608 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5609 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5611 (void)set_stun(p_ptr->stun + randint1(20));
5613 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5618 /* Rocket -- stun, cut */
5621 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5622 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5624 (void)set_stun(p_ptr->stun + randint1(20));
5627 if (p_ptr->resist_shard)
5631 else if (!CHECK_MULTISHADOW())
5633 (void)set_cut(p_ptr->cut + (dam / 2));
5636 if (!p_ptr->resist_shard || one_in_(12))
5638 inven_damage(set_cold_destroy, 3);
5641 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5645 /* Inertia -- slowness */
5648 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5649 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5650 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5654 /* Lite -- blinding */
5657 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5658 if (p_ptr->resist_lite)
5660 dam *= 4; dam /= (randint1(4) + 7);
5662 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5664 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5667 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5669 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5672 else if (prace_is_(RACE_S_FAIRY))
5677 if (p_ptr->wraith_form) dam *= 2;
5678 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5680 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5682 p_ptr->wraith_form = 0;
5683 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5684 "The light forces you out of your incorporeal shadow form."));
5686 p_ptr->redraw |= PR_MAP;
5687 /* Update monsters */
5688 p_ptr->update |= (PU_MONSTERS);
5689 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5691 /* Redraw status bar */
5692 p_ptr->redraw |= (PR_STATUS);
5699 /* Dark -- blinding */
5702 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5703 if (p_ptr->resist_dark)
5705 dam *= 4; dam /= (randint1(4) + 7);
5707 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5709 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5711 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5713 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5717 /* Time -- bolt fewer effects XXX */
5720 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5721 if (p_ptr->resist_time)
5724 dam /= (randint1(4) + 7);
5725 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5727 else if (!CHECK_MULTISHADOW())
5729 switch (randint1(10))
5731 case 1: case 2: case 3: case 4: case 5:
5733 if (p_ptr->prace == RACE_ANDROID) break;
5734 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5735 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5739 case 6: case 7: case 8: case 9:
5741 switch (randint1(6))
5743 case 1: k = A_STR; act = _("強く", "strong"); break;
5744 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5745 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5746 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5747 case 5: k = A_CON; act = _("健康で", "hale"); break;
5748 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5751 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5752 "You're not as %s as you used to be..."), act);
5754 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5755 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5756 p_ptr->update |= (PU_BONUS);
5762 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5763 "You're not as powerful as you used to be..."));
5765 for (k = 0; k < 6; k++)
5767 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5768 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5770 p_ptr->update |= (PU_BONUS);
5776 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5780 /* Gravity -- stun plus slowness plus teleport */
5783 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5784 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5786 if (!CHECK_MULTISHADOW())
5788 teleport_player(5, TELEPORT_PASSIVE);
5789 if (!p_ptr->levitation)
5790 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5791 if (!(p_ptr->resist_sound || p_ptr->levitation))
5793 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5794 (void)set_stun(p_ptr->stun + plus_stun);
5797 if (p_ptr->levitation)
5799 dam = (dam * 2) / 3;
5802 if (!p_ptr->levitation || one_in_(13))
5804 inven_damage(set_cold_destroy, 2);
5807 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5811 /* Standard damage */
5812 case GF_DISINTEGRATE:
5814 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5816 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5822 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5824 (void)hp_player(dam);
5831 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5832 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5839 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5840 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5846 if (p_ptr->free_act) break;
5847 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5849 if (ironman_nightmare)
5851 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5852 /* Have some nightmares */
5853 sanity_blast(NULL, FALSE);
5856 set_paralyzed(p_ptr->paralyzed + dam);
5866 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5867 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5874 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5875 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5882 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5884 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5885 if (!p_ptr->resist_shard || one_in_(13))
5887 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5888 inven_damage(set_cold_destroy, 2);
5894 /* Ice -- cold plus stun plus cuts */
5897 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5898 get_damage = cold_dam(dam, killer, monspell, FALSE);
5899 if (!CHECK_MULTISHADOW())
5901 if (!p_ptr->resist_shard)
5903 (void)set_cut(p_ptr->cut + damroll(5, 8));
5905 if (!p_ptr->resist_sound)
5907 (void)set_stun(p_ptr->stun + randint1(15));
5910 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5912 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5922 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5924 if (p_ptr->mimic_form)
5926 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5927 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5932 switch (p_ptr->prace)
5934 /* Some races are immune */
5948 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5960 if (CHECK_MULTISHADOW())
5962 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5964 else if (p_ptr->csp)
5968 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5970 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5973 if (dam >= p_ptr->csp)
5977 p_ptr->csp_frac = 0;
5986 learn_spell(monspell);
5989 p_ptr->redraw |= (PR_MANA);
5991 p_ptr->window |= (PW_PLAYER);
5992 p_ptr->window |= (PW_SPELL);
5996 /* Heal the monster */
5997 if (m_ptr->hp < m_ptr->maxhp)
6001 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6003 /* Redraw (later) if needed */
6004 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6005 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6007 /* Special message */
6010 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6023 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6025 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6026 learn_spell(monspell);
6030 if (!CHECK_MULTISHADOW())
6032 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6034 if (!p_ptr->resist_conf)
6036 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6039 if (!p_ptr->resist_chaos && one_in_(3))
6041 (void)set_image(p_ptr->image + randint0(250) + 150);
6048 p_ptr->csp_frac = 0;
6050 p_ptr->redraw |= PR_MANA;
6053 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6059 case GF_BRAIN_SMASH:
6061 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6063 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6064 learn_spell(monspell);
6068 if (!CHECK_MULTISHADOW())
6070 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6076 p_ptr->csp_frac = 0;
6078 p_ptr->redraw |= PR_MANA;
6081 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6082 if (!CHECK_MULTISHADOW())
6084 if (!p_ptr->resist_blind)
6086 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6088 if (!p_ptr->resist_conf)
6090 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6092 if (!p_ptr->free_act)
6094 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6096 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6098 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6099 (void)do_dec_stat(A_INT);
6100 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6101 (void)do_dec_stat(A_WIS);
6103 if (!p_ptr->resist_chaos)
6105 (void)set_image(p_ptr->image + randint0(250) + 150);
6115 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6117 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6118 learn_spell(monspell);
6122 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6123 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6131 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6133 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6134 learn_spell(monspell);
6138 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6139 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6147 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6149 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6150 learn_spell(monspell);
6154 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6155 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6163 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6165 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6166 learn_spell(monspell);
6170 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6171 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6179 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6181 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6182 learn_spell(monspell);
6186 if (!CHECK_MULTISHADOW())
6188 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6189 curse_equipment(40, 20);
6192 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6194 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6209 /* Hex - revenge damage stored */
6210 revenge_store(get_damage);
6212 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6213 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6215 char m_name_self[80];
6218 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6220 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6221 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6222 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6225 if (p_ptr->riding && dam > 0)
6227 rakubadam_p = (dam > 200) ? 200 : dam;
6231 disturb(TRUE, TRUE);
6234 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6236 (void)kawarimi(FALSE);
6239 /* Return "Anything seen?" */
6245 * Find the distance from (x, y) to a line.
6247 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6249 /* Vector from (x, y) to (x1, y1) */
6250 POSITION py = y1 - y;
6251 POSITION px = x1 - x;
6254 POSITION ny = x2 - x1;
6255 POSITION nx = y1 - y2;
6258 POSITION pd = distance(y1, x1, y, x);
6259 POSITION nd = distance(y1, x1, y2, x2);
6261 if (pd > nd) return distance(y, x, y2, x2);
6263 /* Component of P on N */
6264 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6266 /* Absolute value */
6267 return((nd >= 0) ? nd : 0 - nd);
6274 * Modified version of los() for calculation of disintegration balls.
6275 * Disintegration effects are stopped by permanent walls.
6277 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6297 /* Slope, or 1/Slope, of LOS */
6301 /* Extract the offset */
6305 /* Extract the absolute offset */
6310 /* Handle adjacent (or identical) grids */
6311 if ((ax < 2) && (ay < 2)) return (TRUE);
6314 /* Paranoia -- require "safe" origin */
6315 /* if (!in_bounds(y1, x1)) return (FALSE); */
6318 /* Directly South/North */
6321 /* South -- check for walls */
6324 for (ty = y1 + 1; ty < y2; ty++)
6326 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6330 /* North -- check for walls */
6333 for (ty = y1 - 1; ty > y2; ty--)
6335 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6343 /* Directly East/West */
6346 /* East -- check for walls */
6349 for (tx = x1 + 1; tx < x2; tx++)
6351 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6355 /* West -- check for walls */
6358 for (tx = x1 - 1; tx > x2; tx--)
6360 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6369 /* Extract some signs */
6370 sx = (dx < 0) ? -1 : 1;
6371 sy = (dy < 0) ? -1 : 1;
6374 /* Vertical "knights" */
6379 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6383 /* Horizontal "knights" */
6388 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6393 /* Calculate scale factor div 2 */
6396 /* Calculate scale factor */
6400 /* Travel horizontally */
6403 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6409 /* Consider the special case where slope == 1. */
6420 /* Note (below) the case (qy == f2), where */
6421 /* the LOS exactly meets the corner of a tile. */
6424 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6435 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6448 /* Travel vertically */
6451 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6467 /* Note (below) the case (qx == f2), where */
6468 /* the LOS exactly meets the corner of a tile. */
6471 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6482 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6503 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)
6508 int brev = rad * rad / dist;
6512 int mdis = distance(y1, x1, y2, x2) + rad;
6514 while (bdis <= mdis)
6518 if ((0 < dist) && (path_n < dist))
6520 POSITION ny = GRID_Y(path_g[path_n]);
6521 POSITION nx = GRID_X(path_g[path_n]);
6522 POSITION nd = distance(ny, nx, y1, x1);
6524 /* Get next base point */
6533 /* Travel from center outward */
6534 for (cdis = 0; cdis <= brad; cdis++)
6536 /* Scan the maximal blast area of radius "cdis" */
6537 for (y = by - cdis; y <= by + cdis; y++)
6539 for (x = bx - cdis; x <= bx + cdis; x++)
6541 /* Ignore "illegal" locations */
6542 if (!in_bounds(y, x)) continue;
6544 /* Enforce a circular "ripple" */
6545 if (distance(y1, x1, y, x) != bdis) continue;
6547 /* Enforce an arc */
6548 if (distance(by, bx, y, x) != cdis) continue;
6554 /* Lights are stopped by opaque terrains */
6555 if (!los(by, bx, y, x)) continue;
6557 case GF_DISINTEGRATE:
6558 /* Disintegration are stopped only by perma-walls */
6559 if (!in_disintegration_range(by, bx, y, x)) continue;
6562 /* Ball explosions are stopped by walls */
6563 if (!projectable(by, bx, y, x)) continue;
6567 /* Save this grid */
6575 /* Encode some more "radius" info */
6576 gm[bdis + 1] = *pgrids;
6578 /* Increase the size */
6579 brad = rad * (path_n + brev) / (dist + brev);
6581 /* Find the next ripple */
6585 /* Store the effect size */
6591 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6592 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6593 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6594 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6595 * @param x 目標X座標 / Target x location (or location to travel "towards")
6596 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6597 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6598 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6599 * @param monspell 効果元のモンスター魔法ID
6600 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6603 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6604 * towards a given location (optionally passing over the heads of interposing
6605 * monsters), and have it do a given amount of damage to the monsters (and
6606 * optionally objects) within the given radius of the final location.
6608 * A "bolt" travels from source to target and affects only the target grid.
6609 * A "beam" travels from source to target, affecting all grids passed through.
6610 * A "ball" travels from source to the target, exploding at the target, and
6611 * affecting everything within the given radius of the target location.
6613 * Traditionally, a "bolt" does not affect anything on the ground, and does
6614 * not pass over the heads of interposing monsters, much like a traditional
6615 * missile, and will "stop" abruptly at the "target" even if no monster is
6616 * positioned there, while a "ball", on the other hand, passes over the heads
6617 * of monsters between the source and target, and affects everything except
6618 * the source monster which lies within the final radius, while a "beam"
6619 * affects every monster between the source and target, except for the casting
6620 * monster (or player), and rarely affects things on the ground.
6622 * Two special flags allow us to use this function in special ways, the
6623 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6624 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6625 * actually projecting from the source monster (or player).
6627 * The player will only get "experience" for monsters killed by himself
6628 * Unique monsters can only be destroyed by attacks from the player
6630 * Only 256 grids can be affected per projection, limiting the effective
6631 * "radius" of standard ball attacks to nine units (diameter nineteen).
6633 * One can project in a given "direction" by combining PROJECT_THRU with small
6634 * offsets to the initial location (see "line_spell()"), or by calculating
6635 * "virtual targets" far away from the player.
6637 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6638 * continuing until it actually hits somethings (useful for "stone to mud").
6640 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6642 * Balls must explode BEFORE hitting walls, or they would affect monsters
6643 * on both sides of a wall. Some bug reports indicate that this is still
6644 * happening in 2.7.8 for Windows, though it appears to be impossible.
6646 * We "pre-calculate" the blast area only in part for efficiency.
6647 * More importantly, this lets us do "explosions" from the "inside" out.
6648 * This results in a more logical distribution of "blast" treasure.
6649 * It also produces a better (in my opinion) animation of the explosion.
6650 * It could be (but is not) used to have the treasure dropped by monsters
6651 * in the middle of the explosion fall "outwards", and then be damaged by
6652 * the blast as it spreads outwards towards the treasure drop location.
6654 * Walls and doors are included in the blast area, so that they can be
6655 * "burned" or "melted" in later versions.
6657 * This algorithm is intended to maximize simplicity, not necessarily
6658 * efficiency, since this function is not a bottleneck in the code.
6660 * We apply the blast effect from ground zero outwards, in several passes,
6661 * first affecting features, then objects, then monsters, then the player.
6662 * This allows walls to be removed before checking the object or monster
6663 * in the wall, and protects objects which are dropped by monsters killed
6664 * in the blast, and allows the player to see all affects before he is
6665 * killed or teleported away. The semantics of this method are open to
6666 * various interpretations, but they seem to work well in practice.
6668 * We process the blast area from ground-zero outwards to allow for better
6669 * distribution of treasure dropped by monsters, and because it provides a
6670 * pleasing visual effect at low cost.
6672 * Note that the damage done by "ball" explosions decreases with distance.
6673 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6675 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6676 * the target, and then the damage "flows" along this beam of destruction.
6677 * The damage at every grid is the same as at the "center" of a "ball"
6678 * explosion, since the "beam" grids are treated as if they ARE at the
6679 * center of a "ball" explosion.
6681 * Currently, specifying "beam" plus "ball" means that locations which are
6682 * covered by the initial "beam", and also covered by the final "ball", except
6683 * for the final grid (the epicenter of the ball), will be "hit twice", once
6684 * by the initial beam, and once by the exploding ball. For the grid right
6685 * next to the epicenter, this results in 150% damage being done. The center
6686 * does not have this problem, for the same reason the final grid in a "beam"
6687 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6688 * grids which are covered by the "ball" will NOT work, as then they will
6689 * receive LESS damage than they should. Do not combine "beam" with "ball".
6691 * The array "gy[],gx[]" with current size "grids" is used to hold the
6692 * collected locations of all grids in the "blast area" plus "beam path".
6694 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6695 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6696 * first blast grid (see above) with radius "N" from the blast center. Note
6697 * that only the first gm[1] grids in the blast area thus take full damage.
6698 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6699 * number of blast grids.
6701 * Note that once the projection is complete, (y2,x2) holds the final location
6702 * of bolts/beams, and the "epicenter" of balls.
6704 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6705 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6706 * implementation of the "distance" function. Also, a bolt can be properly
6707 * viewed as a "ball" with a "rad" of "zero".
6709 * Note that if no "target" is reached before the beam/bolt/ball travels the
6710 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6711 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6713 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6714 * to move from point A to point B, even if the player cannot see part of the
6715 * projection path. Note that in general, the player will *always* see part
6716 * of the path, since it either starts at the player or ends on the player.
6718 * Hack -- we assume that every "projection" is "self-illuminating".
6720 * Hack -- when only a single monster is affected, we automatically track
6721 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6723 * Note that all projections now "explode" at their final destination, even
6724 * if they were being projected at a more distant destination. This means
6725 * that "ball" spells will *always* explode.
6727 * Note that we must call "handle_stuff()" after affecting terrain features
6728 * in the blast radius, in case the "illumination" of the grid was changed,
6729 * and "update_view()" and "update_monsters()" need to be called.
6732 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6742 POSITION y_saver, x_saver; /* For reflecting monsters */
6744 int msec = delay_factor * delay_factor * delay_factor;
6746 /* Assume the player sees nothing */
6747 bool notice = FALSE;
6749 /* Assume the player has seen nothing */
6750 bool visual = FALSE;
6752 /* Assume the player has seen no blast grids */
6755 /* Assume to be a normal ball spell */
6756 bool breath = FALSE;
6758 /* Is the player blind? */
6759 bool blind = (p_ptr->blind ? TRUE : FALSE);
6761 bool old_hide = FALSE;
6763 /* Number of grids in the "path" */
6766 /* Actual grids in the "path" */
6769 /* Number of grids in the "blast area" (including the "beam" path) */
6772 /* Coordinates of the affected grids */
6773 POSITION gx[1024], gy[1024];
6775 /* Encoded "radius" info (see above) */
6778 /* Actual radius encoded in gm[] */
6779 POSITION gm_rad = rad;
6783 /* Attacker's name (prepared before polymorph)*/
6786 /* Can the player see the source of this effect? */
6787 bool see_s_msg = TRUE;
6789 /* Initialize by null string */
6795 /* Default target of monsterspell is player */
6796 monster_target_y = p_ptr->y;
6797 monster_target_x = p_ptr->x;
6799 /* Hack -- Jump to target */
6800 if (flg & (PROJECT_JUMP))
6805 /* Clear the flag */
6806 flg &= ~(PROJECT_JUMP);
6811 /* Start at player */
6818 /* Start at monster */
6821 x1 = m_list[who].fx;
6822 y1 = m_list[who].fy;
6823 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6835 /* Default "destination" */
6840 /* Hack -- verify stuff */
6841 if (flg & (PROJECT_THRU))
6843 if ((x1 == x2) && (y1 == y2))
6845 flg &= ~(PROJECT_THRU);
6849 /* Handle a breath attack */
6854 if (flg & PROJECT_HIDE) old_hide = TRUE;
6855 flg |= PROJECT_HIDE;
6859 /* Hack -- Assume there will be no blast (max radius 32) */
6860 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6868 /* Collect beam grids */
6869 if (flg & (PROJECT_BEAM))
6880 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6882 case GF_DISINTEGRATE:
6883 flg |= (PROJECT_GRID);
6884 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6888 /* Calculate the projection path */
6890 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6892 /* Hack -- Handle stuff */
6895 /* Giga-Hack SEEKER & SUPER_RAY */
6897 if( typ == GF_SEEKER )
6907 for (i = 0; i < path_n; ++i)
6912 int ny = GRID_Y(path_g[i]);
6913 int nx = GRID_X(path_g[i]);
6924 /* Only do visuals if requested */
6925 if (!blind && !(flg & (PROJECT_HIDE)))
6927 /* Only do visuals if the player can "see" the bolt */
6928 if (panel_contains(y, x) && player_has_los_bold(y, x))
6935 /* Obtain the bolt pict */
6936 p = bolt_pict(oy, ox, y, x, typ);
6938 /* Extract attr/char */
6942 /* Visual effects */
6943 print_rel(c, a, y, x);
6944 move_cursor_relative(y, x);
6945 /*if (fresh_before)*/ Term_fresh();
6946 Term_xtra(TERM_XTRA_DELAY, msec);
6948 /*if (fresh_before)*/ Term_fresh();
6950 /* Display "beam" grids */
6951 if (flg & (PROJECT_BEAM))
6953 /* Obtain the explosion pict */
6954 p = bolt_pict(y, x, y, x, typ);
6956 /* Extract attr/char */
6960 /* Visual effects */
6961 print_rel(c, a, y, x);
6964 /* Hack -- Activate delay */
6968 /* Hack -- delay anyway for consistency */
6971 /* Delay for consistency */
6972 Term_xtra(TERM_XTRA_DELAY, msec);
6975 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6976 if( is_mirror_grid(&cave[y][x]))
6978 /* The target of monsterspell becomes tha mirror(broken) */
6979 monster_target_y=(s16b)y;
6980 monster_target_x=(s16b)x;
6982 remove_mirror(y, x);
6983 next_mirror(&oy, &ox, y, x);
6985 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6986 for(j = last_i; j <= i; j++)
6988 y = GRID_Y(path_g[j]);
6989 x = GRID_X(path_g[j]);
6990 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6991 if(!who && (project_m_n==1) && !jump ){
6992 if(cave[project_m_y][project_m_x].m_idx >0 ){
6993 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6997 /* Hack -- auto-recall */
6998 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7000 /* Hack - auto-track */
7001 health_track(cave[project_m_y][project_m_x].m_idx);
7005 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7010 for(i = last_i ; i < path_n ; i++)
7013 py = GRID_Y(path_g[i]);
7014 px = GRID_X(path_g[i]);
7015 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7017 if(!who && (project_m_n==1) && !jump ){
7018 if(cave[project_m_y][project_m_x].m_idx > 0)
7020 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7024 /* Hack -- auto-recall */
7025 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7027 /* Hack - auto-track */
7028 health_track(cave[project_m_y][project_m_x].m_idx);
7032 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7036 else if(typ == GF_SUPER_RAY){
7038 int second_step = 0;
7045 for (i = 0; i < path_n; ++i)
7050 int ny = GRID_Y(path_g[i]);
7051 int nx = GRID_X(path_g[i]);
7062 /* Only do visuals if requested */
7063 if (!blind && !(flg & (PROJECT_HIDE)))
7065 /* Only do visuals if the player can "see" the bolt */
7066 if (panel_contains(y, x) && player_has_los_bold(y, x))
7073 /* Obtain the bolt pict */
7074 p = bolt_pict(oy, ox, y, x, typ);
7076 /* Extract attr/char */
7080 /* Visual effects */
7081 print_rel(c, a, y, x);
7082 move_cursor_relative(y, x);
7083 /*if (fresh_before)*/ Term_fresh();
7084 Term_xtra(TERM_XTRA_DELAY, msec);
7086 /*if (fresh_before)*/ Term_fresh();
7088 /* Display "beam" grids */
7089 if (flg & (PROJECT_BEAM))
7091 /* Obtain the explosion pict */
7092 p = bolt_pict(y, x, y, x, typ);
7094 /* Extract attr/char */
7098 /* Visual effects */
7099 print_rel(c, a, y, x);
7102 /* Hack -- Activate delay */
7106 /* Hack -- delay anyway for consistency */
7109 /* Delay for consistency */
7110 Term_xtra(TERM_XTRA_DELAY, msec);
7113 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7114 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7116 if( second_step )continue;
7119 if( is_mirror_grid(&cave[y][x]) && !second_step )
7121 /* The target of monsterspell becomes tha mirror(broken) */
7122 monster_target_y=(s16b)y;
7123 monster_target_x=(s16b)x;
7126 for( j = 0; j <=i ; j++ )
7128 y = GRID_Y(path_g[j]);
7129 x = GRID_X(path_g[j]);
7130 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7134 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7135 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7136 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7137 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7138 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7139 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7140 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7141 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7144 for( i = 0; i < path_n ; i++ )
7147 py = GRID_Y(path_g[i]);
7148 px = GRID_X(path_g[i]);
7149 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7150 if(!who && (project_m_n == 1) && !jump){
7151 if(cave[project_m_y][project_m_x].m_idx >0 ){
7152 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7156 /* Hack -- auto-recall */
7157 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7159 /* Hack - auto-track */
7160 health_track(cave[project_m_y][project_m_x].m_idx);
7164 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7169 /* Project along the path */
7170 for (i = 0; i < path_n; ++i)
7175 int ny = GRID_Y(path_g[i]);
7176 int nx = GRID_X(path_g[i]);
7178 if (flg & PROJECT_DISI)
7180 /* Hack -- Balls explode before reaching walls */
7181 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7183 else if (flg & PROJECT_LOS)
7185 /* Hack -- Balls explode before reaching walls */
7186 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7190 /* Hack -- Balls explode before reaching walls */
7191 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7198 /* Collect beam grids */
7199 if (flg & (PROJECT_BEAM))
7206 /* Only do visuals if requested */
7207 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7209 /* Only do visuals if the player can "see" the bolt */
7210 if (panel_contains(y, x) && player_has_los_bold(y, x))
7217 /* Obtain the bolt pict */
7218 p = bolt_pict(oy, ox, y, x, typ);
7220 /* Extract attr/char */
7224 /* Visual effects */
7225 print_rel(c, a, y, x);
7226 move_cursor_relative(y, x);
7227 /*if (fresh_before)*/ Term_fresh();
7228 Term_xtra(TERM_XTRA_DELAY, msec);
7230 /*if (fresh_before)*/ Term_fresh();
7232 /* Display "beam" grids */
7233 if (flg & (PROJECT_BEAM))
7235 /* Obtain the explosion pict */
7236 p = bolt_pict(y, x, y, x, typ);
7238 /* Extract attr/char */
7242 /* Visual effects */
7243 print_rel(c, a, y, x);
7246 /* Hack -- Activate delay */
7250 /* Hack -- delay anyway for consistency */
7253 /* Delay for consistency */
7254 Term_xtra(TERM_XTRA_DELAY, msec);
7261 /* Save the "blast epicenter" */
7265 if (breath && !path_n)
7271 flg &= ~(PROJECT_HIDE);
7275 /* Start the "explosion" */
7278 /* Hack -- make sure beams get to "explode" */
7286 /* If we found a "target", explode there */
7287 if (dist <= MAX_RANGE)
7289 /* Mega-Hack -- remove the final "beam" grid */
7290 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7293 * Create a conical breath attack
7304 flg &= ~(PROJECT_HIDE);
7306 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7310 /* Determine the blast area, work from the inside out */
7311 for (dist = 0; dist <= rad; dist++)
7313 /* Scan the maximal blast area of radius "dist" */
7314 for (y = by - dist; y <= by + dist; y++)
7316 for (x = bx - dist; x <= bx + dist; x++)
7318 /* Ignore "illegal" locations */
7319 if (!in_bounds2(y, x)) continue;
7321 /* Enforce a "circular" explosion */
7322 if (distance(by, bx, y, x) != dist) continue;
7328 /* Lights are stopped by opaque terrains */
7329 if (!los(by, bx, y, x)) continue;
7331 case GF_DISINTEGRATE:
7332 /* Disintegration are stopped only by perma-walls */
7333 if (!in_disintegration_range(by, bx, y, x)) continue;
7336 /* Ball explosions are stopped by walls */
7337 if (!projectable(by, bx, y, x)) continue;
7341 /* Save this grid */
7348 /* Encode some more "radius" info */
7354 /* Speed -- ignore "non-explosions" */
7355 if (!grids) return (FALSE);
7358 /* Display the "blast area" if requested */
7359 if (!blind && !(flg & (PROJECT_HIDE)))
7361 /* Then do the "blast", from inside out */
7362 for (t = 0; t <= gm_rad; t++)
7364 /* Dump everything with this radius */
7365 for (i = gm[t]; i < gm[t+1]; i++)
7367 /* Extract the location */
7371 /* Only do visuals if the player can "see" the blast */
7372 if (panel_contains(y, x) && player_has_los_bold(y, x))
7381 /* Obtain the explosion pict */
7382 p = bolt_pict(y, x, y, x, typ);
7384 /* Extract attr/char */
7388 /* Visual effects -- Display */
7389 print_rel(c, a, y, x);
7393 /* Hack -- center the cursor */
7394 move_cursor_relative(by, bx);
7396 /* Flush each "radius" seperately */
7397 /*if (fresh_before)*/ Term_fresh();
7399 /* Delay (efficiently) */
7400 if (visual || drawn)
7402 Term_xtra(TERM_XTRA_DELAY, msec);
7406 /* Flush the erasing */
7409 /* Erase the explosion drawn above */
7410 for (i = 0; i < grids; i++)
7412 /* Extract the location */
7416 /* Hack -- Erase if needed */
7417 if (panel_contains(y, x) && player_has_los_bold(y, x))
7423 /* Hack -- center the cursor */
7424 move_cursor_relative(by, bx);
7426 /* Flush the explosion */
7427 /*if (fresh_before)*/ Term_fresh();
7432 /* Update stuff if needed */
7433 if (p_ptr->update) update_stuff();
7436 if (flg & PROJECT_KILL)
7438 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7439 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7443 /* Check features */
7444 if (flg & (PROJECT_GRID))
7446 /* Start with "dist" of zero */
7449 /* Scan for features */
7450 for (i = 0; i < grids; i++)
7452 /* Hack -- Notice new "dist" values */
7453 if (gm[dist+1] == i) dist++;
7455 /* Get the grid location */
7459 /* Find the closest point in the blast */
7462 int d = dist_to_line(y, x, y1, x1, by, bx);
7464 /* Affect the grid */
7465 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7469 /* Affect the grid */
7470 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7475 /* Update stuff if needed */
7476 if (p_ptr->update) update_stuff();
7479 if (flg & (PROJECT_ITEM))
7481 /* Start with "dist" of zero */
7484 /* Scan for objects */
7485 for (i = 0; i < grids; i++)
7487 /* Hack -- Notice new "dist" values */
7488 if (gm[dist+1] == i) dist++;
7490 /* Get the grid location */
7494 /* Find the closest point in the blast */
7497 int d = dist_to_line(y, x, y1, x1, by, bx);
7499 /* Affect the object in the grid */
7500 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7504 /* Affect the object in the grid */
7505 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7511 /* Check monsters */
7512 if (flg & (PROJECT_KILL))
7519 /* Start with "dist" of zero */
7522 /* Scan for monsters */
7523 for (i = 0; i < grids; i++)
7527 /* Hack -- Notice new "dist" values */
7528 if (gm[dist + 1] == i) dist++;
7530 /* Get the grid location */
7534 /* A single bolt may be reflected */
7537 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7538 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7540 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7541 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7542 (!who || dist_hack > 1) && !one_in_(10))
7545 int max_attempts = 10;
7547 /* Choose 'new' target */
7550 t_y = y_saver - 1 + randint1(3);
7551 t_x = x_saver - 1 + randint1(3);
7554 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7556 if (max_attempts < 1)
7562 sound(SOUND_REFLECT);
7565 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7566 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7567 else if (m_ptr->r_idx == MON_DIO)
7568 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7570 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7572 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7574 /* Reflected bolts randomly target either one */
7575 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7576 else flg |= PROJECT_PLAYER;
7578 /* The bolt is reflected */
7579 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7581 /* Don't affect the monster any longer */
7587 /* Find the closest point in the blast */
7590 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7594 effective_dist = dist;
7598 /* There is the riding player on this monster */
7599 if (p_ptr->riding && player_bold(y, x))
7601 /* Aimed on the player */
7602 if (flg & PROJECT_PLAYER)
7604 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7607 * A beam or bolt is well aimed
7609 * So don't affects the mount.
7616 * The spell is not well aimed,
7617 * So partly affect the mount too.
7624 * This grid is the original target.
7625 * Or aimed on your horse.
7627 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7629 /* Hit the mount with full damage */
7633 * Otherwise this grid is not the
7634 * original target, it means that line
7635 * of fire is obstructed by this
7639 * A beam or bolt will hit either
7640 * player or mount. Choose randomly.
7642 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7646 /* Hit the mount with full damage */
7650 /* Hit the player later */
7651 flg |= PROJECT_PLAYER;
7653 /* Don't affect the mount */
7659 * The spell is not well aimed, so
7660 * partly affect both player and
7669 /* Affect the monster in the grid */
7670 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7674 /* Player affected one monster (without "jumping") */
7675 if (!who && (project_m_n == 1) && !jump)
7680 /* Track if possible */
7681 if (cave[y][x].m_idx > 0)
7683 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7687 /* Hack -- auto-recall */
7688 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7690 /* Hack - auto-track */
7691 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7699 if (flg & (PROJECT_KILL))
7701 /* Start with "dist" of zero */
7704 /* Scan for player */
7705 for (i = 0; i < grids; i++)
7709 /* Hack -- Notice new "dist" values */
7710 if (gm[dist+1] == i) dist++;
7712 /* Get the grid location */
7716 /* Affect the player? */
7717 if (!player_bold(y, x)) continue;
7719 /* Find the closest point in the blast */
7722 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7726 effective_dist = dist;
7729 /* Target may be your horse */
7732 /* Aimed on the player */
7733 if (flg & PROJECT_PLAYER)
7735 /* Hit the player with full damage */
7739 * Hack -- When this grid was not the
7740 * original target, a beam or bolt
7741 * would hit either player or mount,
7742 * and should be choosen randomly.
7744 * But already choosen to hit the
7745 * mount at this point.
7747 * Or aimed on your horse.
7749 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7752 * A beam or bolt is well aimed
7754 * So don't affects the player.
7761 * The spell is not well aimed,
7762 * So partly affect the player too.
7768 /* Affect the player */
7769 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7777 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7779 if (rakubadam_m > 0)
7781 if (rakuba(rakubadam_m, FALSE))
7783 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7786 if (p_ptr->riding && rakubadam_p > 0)
7788 if(rakuba(rakubadam_p, FALSE))
7790 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7795 /* Return "something was noticed" */
7800 * @brief 鏡魔法「封魔結界」の効果処理
7802 * @return 効果があったらTRUEを返す
7804 bool binding_field(HIT_POINT dam)
7806 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7807 int mirror_num = 0; /* 鏡の数 */
7809 POSITION centersign;
7810 POSITION x1, x2, y1, y2;
7812 int msec = delay_factor*delay_factor*delay_factor;
7815 POSITION point_x[3];
7816 POSITION point_y[3];
7818 /* Default target of monsterspell is player */
7819 monster_target_y = p_ptr->y;
7820 monster_target_x = p_ptr->x;
7822 for (x = 0; x < cur_wid; x++)
7824 for (y = 0; y < cur_hgt; y++)
7826 if (is_mirror_grid(&cave[y][x]) &&
7827 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7828 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7829 player_has_los_bold(y, x) &&
7830 projectable(p_ptr->y, p_ptr->x, y, x)
7832 mirror_y[mirror_num] = y;
7833 mirror_x[mirror_num] = x;
7839 if (mirror_num < 2)return FALSE;
7841 point_x[0] = randint0(mirror_num);
7843 point_x[1] = randint0(mirror_num);
7844 } while (point_x[0] == point_x[1]);
7846 point_y[0] = mirror_y[point_x[0]];
7847 point_x[0] = mirror_x[point_x[0]];
7848 point_y[1] = mirror_y[point_x[1]];
7849 point_x[1] = mirror_x[point_x[1]];
7850 point_y[2] = p_ptr->y;
7851 point_x[2] = p_ptr->x;
7853 x = point_x[0] + point_x[1] + point_x[2];
7854 y = point_y[0] + point_y[1] + point_y[2];
7856 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7857 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7858 if (centersign == 0)return FALSE;
7860 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7861 x1 = x1 < point_x[2] ? x1 : point_x[2];
7862 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7863 y1 = y1 < point_y[2] ? y1 : point_y[2];
7865 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7866 x2 = x2 > point_x[2] ? x2 : point_x[2];
7867 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7868 y2 = y2 > point_y[2] ? y2 : point_y[2];
7870 for (y = y1; y <= y2; y++) {
7871 for (x = x1; x <= x2; x++) {
7872 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7873 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7874 centersign*((point_x[1] - x)*(point_y[2] - y)
7875 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7876 centersign*((point_x[2] - x)*(point_y[0] - y)
7877 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7879 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7880 /* Visual effects */
7882 && panel_contains(y, x)) {
7883 p = bolt_pict(y, x, y, x, GF_MANA);
7884 print_rel(PICT_C(p), PICT_A(p), y, x);
7885 move_cursor_relative(y, x);
7886 /*if (fresh_before)*/ Term_fresh();
7887 Term_xtra(TERM_XTRA_DELAY, msec);
7893 for (y = y1; y <= y2; y++) {
7894 for (x = x1; x <= x2; x++) {
7895 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7896 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7897 centersign*((point_x[1] - x)*(point_y[2] - y)
7898 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7899 centersign*((point_x[2] - x)*(point_y[0] - y)
7900 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7902 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7903 (void)project_f(0, 0, y, x, dam, GF_MANA);
7908 for (y = y1; y <= y2; y++) {
7909 for (x = x1; x <= x2; x++) {
7910 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7911 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7912 centersign*((point_x[1] - x)*(point_y[2] - y)
7913 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7914 centersign*((point_x[2] - x)*(point_y[0] - y)
7915 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7917 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7918 (void)project_o(0, 0, y, x, dam, GF_MANA);
7923 for (y = y1; y <= y2; y++) {
7924 for (x = x1; x <= x2; x++) {
7925 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7926 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7927 centersign*((point_x[1] - x)*(point_y[2] - y)
7928 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7929 centersign*((point_x[2] - x)*(point_y[0] - y)
7930 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7932 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7933 (void)project_m(0, 0, y, x, dam, GF_MANA,
7934 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7940 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7941 remove_mirror(point_y[0], point_x[0]);
7948 * @brief 鏡魔法「鏡の封印」の効果処理
7950 * @return 効果があったらTRUEを返す
7952 void seal_of_mirror(HIT_POINT dam)
7956 for (x = 0; x < cur_wid; x++)
7958 for (y = 0; y < cur_hgt; y++)
7960 if (is_mirror_grid(&cave[y][x]))
7962 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7963 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7965 if (!cave[y][x].m_idx)
7967 remove_mirror(y, x);