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"
20 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
21 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
23 int project_length = 0; /*!< 投射の射程距離 */
27 * @brief モンスター魅了用セービングスロー共通部(汎用系)
29 * @param m_ptr 対象モンスター
30 * @return 魅了に抵抗したらTRUE
32 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
34 monster_race *r_ptr = &r_info[m_ptr->r_idx];
36 if(p_ptr->inside_arena) return TRUE;
39 if (r_ptr->flagsr & RFR_RES_ALL)
41 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
45 if (r_ptr->flags3 & RF3_NO_CONF)
47 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
51 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
53 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
54 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
55 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
59 * @brief モンスター服従用セービングスロー共通部(部族依存系)
61 * @param m_ptr 対象モンスター
62 * @return 服従に抵抗したらTRUE
64 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
66 monster_race *r_ptr = &r_info[m_ptr->r_idx];
68 if (p_ptr->inside_arena) return TRUE;
71 if (r_ptr->flagsr & RFR_RES_ALL)
73 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
77 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
79 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
80 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
81 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
85 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
88 * ハードコーティングによる実装が行われている。
89 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
91 PERCENTAGE beam_chance(void)
93 if (p_ptr->pclass == CLASS_MAGE)
94 return (PERCENTAGE)(p_ptr->lev);
95 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
96 return (PERCENTAGE)(p_ptr->lev + 10);
98 return (PERCENTAGE)(p_ptr->lev / 2);
103 * @brief 配置した鏡リストの次を取得する /
104 * Get another mirror. for SEEKER
105 * @param next_y 次の鏡のy座標を返す参照ポインタ
106 * @param next_x 次の鏡のx座標を返す参照ポインタ
107 * @param cury 現在の鏡のy座標
108 * @param curx 現在の鏡のx座標
110 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
112 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
113 int mirror_num = 0; /* 鏡の数 */
117 for (x = 0; x < cur_wid; x++)
119 for (y = 0; y < cur_hgt; y++)
121 if (is_mirror_grid(&cave[y][x])) {
122 mirror_y[mirror_num] = y;
123 mirror_x[mirror_num] = x;
130 num = randint0(mirror_num);
131 *next_y = mirror_y[num];
132 *next_x = mirror_x[num];
135 *next_y = cury + randint0(5) - 2;
136 *next_x = curx + randint0(5) - 2;
141 * @brief 万色表現用にランダムな色を選択する関数 /
142 * Get a legal "multi-hued" color for drawing "spells"
146 static byte mh_attr(int max)
148 switch (randint1(max))
150 case 1: return (TERM_RED);
151 case 2: return (TERM_GREEN);
152 case 3: return (TERM_BLUE);
153 case 4: return (TERM_YELLOW);
154 case 5: return (TERM_ORANGE);
155 case 6: return (TERM_VIOLET);
156 case 7: return (TERM_L_RED);
157 case 8: return (TERM_L_GREEN);
158 case 9: return (TERM_L_BLUE);
159 case 10: return (TERM_UMBER);
160 case 11: return (TERM_L_UMBER);
161 case 12: return (TERM_SLATE);
162 case 13: return (TERM_WHITE);
163 case 14: return (TERM_L_WHITE);
164 case 15: return (TERM_L_DARK);
172 * @brief 魔法属性に応じたエフェクトの色を返す /
173 * Return a color to use for the bolt/ball spells
177 static byte spell_color(int type)
179 /* Check if A.B.'s new graphics should be used (rr9) */
180 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
185 case GF_PSY_SPEAR: return (0x06);
186 case GF_MISSILE: return (0x0F);
187 case GF_ACID: return (0x04);
188 case GF_ELEC: return (0x02);
189 case GF_FIRE: return (0x00);
190 case GF_COLD: return (0x01);
191 case GF_POIS: return (0x03);
192 case GF_HOLY_FIRE: return (0x00);
193 case GF_HELL_FIRE: return (0x00);
194 case GF_MANA: return (0x0E);
196 case GF_SEEKER: return (0x0E);
197 case GF_SUPER_RAY: return (0x0E);
199 case GF_ARROW: return (0x0F);
200 case GF_WATER: return (0x04);
201 case GF_NETHER: return (0x07);
202 case GF_CHAOS: return (mh_attr(15));
203 case GF_DISENCHANT: return (0x05);
204 case GF_NEXUS: return (0x0C);
205 case GF_CONFUSION: return (mh_attr(4));
206 case GF_SOUND: return (0x09);
207 case GF_SHARDS: return (0x08);
208 case GF_FORCE: return (0x09);
209 case GF_INERTIAL: return (0x09);
210 case GF_GRAVITY: return (0x09);
211 case GF_TIME: return (0x09);
212 case GF_LITE_WEAK: return (0x06);
213 case GF_LITE: return (0x06);
214 case GF_DARK_WEAK: return (0x07);
215 case GF_DARK: return (0x07);
216 case GF_PLASMA: return (0x0B);
217 case GF_METEOR: return (0x00);
218 case GF_ICE: return (0x01);
219 case GF_ROCKET: return (0x0F);
220 case GF_DEATH_RAY: return (0x07);
221 case GF_NUKE: return (mh_attr(2));
222 case GF_DISINTEGRATE: return (0x05);
234 case GF_CAUSE_4: return (0x0E);
235 case GF_HAND_DOOM: return (0x07);
236 case GF_CAPTURE : return (0x0E);
237 case GF_IDENTIFY: return (0x01);
238 case GF_ATTACK: return (0x0F);
239 case GF_PHOTO : return (0x06);
242 /* Normal tiles or ASCII */
248 /* Lookup the default colors for this type */
249 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. XXX XXX XXX
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). XXX XXX XXX
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 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
705 * XXX XXX XXX 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);
720 /* Reduce damage by distance */
721 dam = (dam + r) / (r + 1);
724 if (have_flag(f_ptr->flags, FF_TREE))
732 message = _("枯れた", "was blasted."); break;
734 message = _("縮んだ", "shrank."); break;
736 message = _("溶けた", "melted."); break;
739 message = _("凍り、砕け散った", "was frozen and smashed."); break;
743 message = _("燃えた", "burns up!"); break;
755 message = _("粉砕された", "was crushed."); break;
757 message = NULL;break;
761 msg_format(_("木は%s。", "A tree %s"), message);
762 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
765 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
769 /* Analyze the type */
772 /* Ignore most effects */
807 /* Destroy Traps (and Locks) */
810 /* Reveal secret doors */
811 if (is_hidden_door(c_ptr))
816 /* Check line of sight */
824 if (is_trap(c_ptr->feat))
826 /* Check line of sight */
829 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
833 /* Destroy the trap */
834 cave_alter_feat(y, x, FF_DISARM);
837 /* Locked doors are unlocked */
838 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
840 s16b old_feat = c_ptr->feat;
842 /* Unlock the door */
843 cave_alter_feat(y, x, FF_DISARM);
845 /* Check line of sound */
846 if (known && (old_feat != c_ptr->feat))
848 msg_print(_("カチッと音がした!", "Click!"));
853 /* Remove "unsafe" flag if player is not blind */
854 if (!p_ptr->blind && player_has_los_bold(y, x))
856 c_ptr->info &= ~(CAVE_UNSAFE);
867 /* Destroy Doors (and traps) */
870 /* Destroy all doors and traps */
871 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
873 /* Check line of sight */
876 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
880 /* Destroy the feature */
881 cave_alter_feat(y, x, FF_TUNNEL);
884 /* Remove "unsafe" flag if player is not blind */
885 if (!p_ptr->blind && player_has_los_bold(y, x))
887 c_ptr->info &= ~(CAVE_UNSAFE);
898 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
900 if (have_flag(f_ptr->flags, FF_SPIKE))
902 s16b old_mimic = c_ptr->mimic;
903 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
905 cave_alter_feat(y, x, FF_SPIKE);
907 c_ptr->mimic = old_mimic;
915 /* Check line of sight */
916 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
918 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
925 /* Destroy walls (and doors) */
928 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
930 if (known && (c_ptr->info & (CAVE_MARK)))
932 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
936 /* Destroy the wall */
937 cave_alter_feat(y, x, FF_HURT_ROCK);
939 /* Update some things */
940 p_ptr->update |= (PU_FLOW);
949 /* Require a "naked" floor grid */
950 if (!cave_naked_bold(y, x)) break;
952 /* Not on the player */
953 if (player_bold(y, x)) break;
955 /* Create a closed door */
956 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
959 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
976 /* Require a "naked" floor grid */
977 if (!cave_naked_bold(y, x)) break;
979 /* Not on the player */
980 if (player_bold(y, x)) break;
982 /* Create a closed door */
983 cave_set_feat(y, x, feat_tree);
986 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
994 /* Require a "naked" floor grid */
995 if (!cave_naked_bold(y, x)) break;
998 c_ptr->info |= CAVE_OBJECT;
999 c_ptr->mimic = feat_glyph;
1012 /* Require a "naked" floor grid */
1013 if (!cave_naked_bold(y, x)) break;
1015 /* Not on the player */
1016 if (player_bold(y, x)) break;
1019 cave_set_feat(y, x, feat_granite);
1027 /* Ignore permanent grid */
1028 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1033 /* Ignore grid without enough space */
1034 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1036 /* Place a shallow lava */
1037 cave_set_feat(y, x, feat_shallow_lava);
1042 /* Place a deep lava */
1043 cave_set_feat(y, x, feat_deep_lava);
1050 /* Ignore permanent grid */
1051 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1056 /* Ignore grid without enough space */
1057 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1059 /* Place a shallow water */
1060 cave_set_feat(y, x, feat_shallow_water);
1065 /* Place a deep water */
1066 cave_set_feat(y, x, feat_deep_water);
1071 /* Lite up the grid */
1075 /* Turn on the light */
1076 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1078 c_ptr->info |= (CAVE_GLOW);
1086 update_local_illumination(y, x);
1089 if (player_can_see_bold(y, x)) obvious = TRUE;
1091 /* Mega-Hack -- Update the monster in the affected grid */
1092 /* This allows "spear of light" (etc) to work "correctly" */
1093 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1095 if (p_ptr->special_defense & NINJA_S_STEALTH)
1097 if (player_bold(y, x)) set_superstealth(FALSE);
1104 /* Darken the grid */
1108 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1111 /* Turn off the light. */
1114 if (dun_level || !is_daytime())
1116 for (j = 0; j < 9; j++)
1118 int by = y + ddy_ddd[j];
1119 int bx = x + ddx_ddd[j];
1121 if (in_bounds2(by, bx))
1123 cave_type *cc_ptr = &cave[by][bx];
1125 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1133 if (!do_dark) break;
1136 c_ptr->info &= ~(CAVE_GLOW);
1138 /* Hack -- Forget "boring" grids */
1139 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1142 c_ptr->info &= ~(CAVE_MARK);
1151 update_local_illumination(y, x);
1154 if (player_can_see_bold(y, x)) obvious = TRUE;
1156 /* Mega-Hack -- Update the monster in the affected grid */
1157 /* This allows "spear of light" (etc) to work "correctly" */
1158 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1168 if (is_mirror_grid(c_ptr))
1170 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1172 remove_mirror(y, x);
1173 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1176 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1178 if (known && (c_ptr->info & CAVE_MARK))
1180 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1184 /* Destroy the wall */
1185 cave_alter_feat(y, x, FF_HURT_ROCK);
1187 /* Update some things */
1188 p_ptr->update |= (PU_FLOW);
1195 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1197 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1199 remove_mirror(y, x);
1200 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1203 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1205 if (known && (c_ptr->info & CAVE_MARK))
1207 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1211 /* Destroy the wall */
1212 cave_alter_feat(y, x, FF_HURT_ROCK);
1214 /* Update some things */
1215 p_ptr->update |= (PU_FLOW);
1220 case GF_DISINTEGRATE:
1222 /* Destroy mirror/glyph */
1223 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1224 remove_mirror(y, x);
1226 /* Permanent features don't get effect */
1227 /* But not protect monsters and other objects */
1228 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1230 cave_alter_feat(y, x, FF_HURT_DISI);
1232 /* Update some things -- similar to GF_KILL_WALL */
1233 p_ptr->update |= (PU_FLOW);
1240 /* Return "Anything seen?" */
1247 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1248 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1249 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1250 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1251 * @param x 目標X座標 / Target x location (or location to travel "towards")
1252 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1253 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1254 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1257 * We are called from "project()" to "damage" objects
1259 * We are called both for "beam" effects and "ball" effects.
1261 * Perhaps we should only SOMETIMES damage things on the ground.
1263 * The "r" parameter is the "distance from ground zero".
1265 * Note that we determine if the player can "see" anything that happens
1266 * by taking into account: blindness, line-of-sight, and illumination.
1268 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1270 * We return "TRUE" if the effect of the projection is "obvious".
1273 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1275 cave_type *c_ptr = &cave[y][x];
1277 OBJECT_IDX this_o_idx, next_o_idx = 0;
1279 bool obvious = FALSE;
1280 bool known = player_has_los_bold(y, x);
1282 BIT_FLAGS flgs[TR_FLAG_SIZE];
1284 char o_name[MAX_NLEN];
1286 KIND_OBJECT_IDX k_idx = 0;
1287 bool is_potion = FALSE;
1291 who = who ? who : 0;
1293 /* Reduce damage by distance */
1294 dam = (dam + r) / (r + 1);
1297 /* Scan all objects in the grid */
1298 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1300 /* Acquire object */
1301 object_type *o_ptr = &o_list[this_o_idx];
1303 bool is_art = FALSE;
1304 bool ignore = FALSE;
1305 bool do_kill = FALSE;
1307 cptr note_kill = NULL;
1310 /* Get the "plural"-ness */
1311 bool plural = (o_ptr->number > 1);
1314 /* Acquire next object */
1315 next_o_idx = o_ptr->next_o_idx;
1317 /* Extract the flags */
1318 object_flags(o_ptr, flgs);
1320 /* Check for artifact */
1321 if (object_is_artifact(o_ptr)) is_art = TRUE;
1323 /* Analyze the type */
1326 /* Acid -- Lots of things */
1329 if (hates_acid(o_ptr))
1332 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1333 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1338 /* Elec -- Rings and Wands */
1341 if (hates_elec(o_ptr))
1344 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1345 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1350 /* Fire -- Flammable objects */
1353 if (hates_fire(o_ptr))
1356 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1357 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1362 /* Cold -- potions and flasks */
1365 if (hates_cold(o_ptr))
1367 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1369 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1377 if (hates_fire(o_ptr))
1380 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1381 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1383 if (hates_elec(o_ptr))
1387 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1388 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1396 if (hates_fire(o_ptr))
1399 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1400 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1402 if (hates_cold(o_ptr))
1406 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1407 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1412 /* Hack -- break potions and such */
1418 if (hates_cold(o_ptr))
1420 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1426 /* Mana and Chaos -- destroy everything */
1432 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1436 case GF_DISINTEGRATE:
1439 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1446 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1447 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1448 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1452 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1456 if (object_is_cursed(o_ptr))
1459 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1466 identify_item(o_ptr);
1468 /* Auto-inscription */
1469 autopick_alter_item((-this_o_idx), FALSE);
1477 /* Chests are noticed only if trapped or locked */
1478 if (o_ptr->tval == TV_CHEST)
1480 /* Disarm/Unlock traps */
1481 if (o_ptr->pval > 0)
1483 /* Disarm or Unlock */
1484 o_ptr->pval = (0 - o_ptr->pval);
1487 object_known(o_ptr);
1490 if (known && (o_ptr->marked & OM_FOUND))
1492 msg_print(_("カチッと音がした!", "Click!"));
1502 if (o_ptr->tval == TV_CORPSE)
1505 BIT_FLAGS mode = 0L;
1507 if (!who || is_pet(&m_list[who]))
1508 mode |= PM_FORCE_PET;
1510 for (i = 0; i < o_ptr->number ; i++)
1512 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1513 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1517 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1521 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1523 note_kill = _("生き返った。", " revived.");
1525 else if (!note_kill)
1527 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1538 /* Attempt to destroy the object */
1541 /* Effect "observed" */
1542 if (known && (o_ptr->marked & OM_FOUND))
1545 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1548 /* Artifacts, and other objects, get to resist */
1549 if (is_art || ignore)
1551 /* Observe the resist */
1552 if (known && (o_ptr->marked & OM_FOUND))
1554 msg_format(_("%sは影響を受けない!",
1555 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1562 /* Describe if needed */
1563 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1565 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1568 k_idx = o_ptr->k_idx;
1569 is_potion = object_is_potion(o_ptr);
1572 /* Delete the object */
1573 delete_object_idx(this_o_idx);
1575 /* Potions produce effects when 'shattered' */
1578 (void)potion_smash_effect(who, y, x, k_idx);
1587 /* Return "Anything seen?" */
1593 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1594 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1595 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1596 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1597 * @param x 目標X座標 / Target x location (or location to travel "towards")
1598 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1599 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1601 * @param see_s_msg TRUEならばメッセージを表示する
1602 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1605 * This routine takes a "source monster" (by index) which is mostly used to
1606 * determine if the player is causing the damage, and a "radius" (see below),
1607 * which is used to decrease the power of explosions with distance, and a
1608 * location, via integers which are modified by certain types of attacks
1609 * (polymorph and teleport being the obvious ones), a default damage, which
1610 * is modified as needed based on various properties, and finally a "damage
1611 * type" (see below).
1614 * Note that this routine can handle "no damage" attacks (like teleport) by
1615 * taking a "zero" damage, and can even take "parameters" to attacks (like
1616 * confuse) by accepting a "damage", using it to calculate the effect, and
1617 * then setting the damage to zero. Note that the "damage" parameter is
1618 * divided by the radius, so monsters not at the "epicenter" will not take
1619 * as much damage (or whatever)...
1622 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1623 * may result in a dereference of an invalid pointer. XXX XXX XXX
1626 * Various messages are produced, and damage is applied.
1629 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1630 * actually be "made" of that substance, or "breathe" big balls of it.
1631 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1633 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1634 * and hurts evil less. If can breath nether, then it resists it as well.
1637 * Damage reductions use the following formulas:
1638 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1639 * gives avg damage of .655, ranging from .858 to .500
1640 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1641 * gives avg damage of .544, ranging from .714 to .417
1642 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1643 * gives avg damage of .444, ranging from .556 to .333
1644 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1645 * gives avg damage of .327, ranging from .427 to .250
1646 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1647 * gives something simple.
1650 * In this function, "result" messages are postponed until the end, where
1651 * the "note" string is appended to the monster name, if not NULL. So,
1652 * to make a spell have "no effect" just set "note" to NULL. You should
1653 * also set "notice" to FALSE, or the player will learn what the spell does.
1656 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1660 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)
1664 cave_type *c_ptr = &cave[y][x];
1666 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1667 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1669 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1673 /* Is the monster "seen"? */
1674 bool seen = m_ptr->ml;
1675 bool seen_msg = is_seen(m_ptr);
1677 bool slept = (bool)MON_CSLEEP(m_ptr);
1679 /* Were the effects "obvious" (if seen)? */
1680 bool obvious = FALSE;
1682 /* Can the player know about this effect? */
1683 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1685 /* Were the effects "irrelevant"? */
1686 bool skipped = FALSE;
1688 /* Gets the monster angry at the source of the effect? */
1689 bool get_angry = FALSE;
1691 /* Polymorph setting (true or false) */
1692 bool do_poly = FALSE;
1694 /* Teleport setting (max distance) */
1697 /* Confusion setting (amount to confuse) */
1700 /* Stunning setting (amount to stun) */
1703 /* Sleep amount (amount to sleep) */
1706 /* Fear amount (amount to fear) */
1709 /* Time amount (amount to time) */
1712 bool heal_leper = FALSE;
1714 /* Hold the monster name */
1718 PARAMETER_VALUE photo = 0;
1720 /* Assume no note */
1723 /* Assume a default death */
1724 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1729 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1732 if (!c_ptr->m_idx) return (FALSE);
1734 /* Never affect projector */
1735 if (who && (c_ptr->m_idx == who)) return (FALSE);
1736 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1737 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1739 /* Don't affect already death monsters */
1740 /* Prevents problems with chain reactions of exploding monsters */
1741 if (m_ptr->hp < 0) return (FALSE);
1743 /* Reduce damage by distance */
1744 dam = (dam + r) / (r + 1);
1747 /* Get the monster name (BEFORE polymorphing) */
1748 monster_desc(m_name, m_ptr, 0);
1750 /* Get the monster possessive ("his"/"her"/"its") */
1751 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1753 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1755 /* Analyze the damage type */
1758 /* Magic Missile -- pure damage */
1761 if (seen) obvious = TRUE;
1763 if (r_ptr->flagsr & RFR_RES_ALL)
1765 note = _("には完全な耐性がある!", " is immune.");
1767 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1776 if (seen) obvious = TRUE;
1778 if (r_ptr->flagsr & RFR_RES_ALL)
1780 note = _("には完全な耐性がある!", " is immune.");
1782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1785 if (r_ptr->flagsr & RFR_IM_ACID)
1787 note = _("にはかなり耐性がある!", " resists a lot.");
1789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1797 if (seen) obvious = TRUE;
1799 if (r_ptr->flagsr & RFR_RES_ALL)
1801 note = _("には完全な耐性がある!", " is immune.");
1803 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1806 if (r_ptr->flagsr & RFR_IM_ELEC)
1808 note = _("にはかなり耐性がある!", " resists a lot.");
1810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1818 if (seen) obvious = TRUE;
1820 if (r_ptr->flagsr & RFR_RES_ALL)
1822 note = _("には完全な耐性がある!", " is immune.");
1824 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1827 if (r_ptr->flagsr & RFR_IM_FIRE)
1829 note = _("にはかなり耐性がある!", " resists a lot.");
1831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1833 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1835 note = _("はひどい痛手をうけた。", " is hit hard.");
1837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1845 if (seen) obvious = TRUE;
1847 if (r_ptr->flagsr & RFR_RES_ALL)
1849 note = _("には完全な耐性がある!", " is immune.");
1851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1854 if (r_ptr->flagsr & RFR_IM_COLD)
1856 note = _("にはかなり耐性がある!", " resists a lot.");
1858 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1860 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1862 note = _("はひどい痛手をうけた。", " is hit hard.");
1864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1872 if (seen) obvious = TRUE;
1874 if (r_ptr->flagsr & RFR_RES_ALL)
1876 note = _("には完全な耐性がある!", " is immune.");
1878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1881 if (r_ptr->flagsr & RFR_IM_POIS)
1883 note = _("にはかなり耐性がある!", " resists a lot.");
1885 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1893 if (seen) obvious = TRUE;
1895 if (r_ptr->flagsr & RFR_RES_ALL)
1897 note = _("には完全な耐性がある!", " is immune.");
1899 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1902 if (r_ptr->flagsr & RFR_IM_POIS)
1904 note = _("には耐性がある。", " resists.");
1905 dam *= 3; dam /= randint1(6) + 6;
1906 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1908 else if (one_in_(3)) do_poly = TRUE;
1912 /* Hellfire -- hurts Evil */
1915 if (seen) obvious = TRUE;
1917 if (r_ptr->flagsr & RFR_RES_ALL)
1919 note = _("には完全な耐性がある!", " is immune.");
1921 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1924 if (r_ptr->flags3 & RF3_GOOD)
1926 note = _("はひどい痛手をうけた。", " is hit hard.");
1928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1933 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1936 if (seen) obvious = TRUE;
1938 if (r_ptr->flagsr & RFR_RES_ALL)
1940 note = _("には完全な耐性がある!", " is immune.");
1942 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1945 if (r_ptr->flags3 & RF3_GOOD)
1947 note = _("には完全な耐性がある!", " is immune.");
1949 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1951 else if (r_ptr->flags3 & RF3_EVIL)
1954 note = _("はひどい痛手をうけた。", " is hit hard.");
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1959 note = _("には耐性がある。", " resists.");
1960 dam *= 3; dam /= randint1(6) + 6;
1965 /* Arrow -- XXX no defense */
1968 if (seen) obvious = TRUE;
1970 if (r_ptr->flagsr & RFR_RES_ALL)
1972 note = _("には完全な耐性がある!", " is immune.");
1974 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1980 /* Plasma -- XXX perhaps check ELEC or FIRE */
1983 if (seen) obvious = TRUE;
1985 if (r_ptr->flagsr & RFR_RES_ALL)
1987 note = _("には完全な耐性がある!", " is immune.");
1989 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1992 if (r_ptr->flagsr & RFR_RES_PLAS)
1994 note = _("には耐性がある。", " resists.");
1995 dam *= 3; dam /= randint1(6) + 6;
1996 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2001 /* Nether -- see above */
2004 if (seen) obvious = TRUE;
2006 if (r_ptr->flagsr & RFR_RES_ALL)
2008 note = _("には完全な耐性がある!", " is immune.");
2010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2013 if (r_ptr->flagsr & RFR_RES_NETH)
2015 if (r_ptr->flags3 & RF3_UNDEAD)
2017 note = _("には完全な耐性がある!", " is immune.");
2019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2023 note = _("には耐性がある。", " resists.");
2024 dam *= 3; dam /= randint1(6) + 6;
2026 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2028 else if (r_ptr->flags3 & RF3_EVIL)
2030 note = _("はいくらか耐性を示した。", " resists somewhat.");
2032 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2037 /* Water (acid) damage -- Water spirits/elementals are immune */
2040 if (seen) obvious = TRUE;
2042 if (r_ptr->flagsr & RFR_RES_ALL)
2044 note = _("には完全な耐性がある!", " is immune.");
2046 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2049 if (r_ptr->flagsr & RFR_RES_WATE)
2051 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2053 note = _("には完全な耐性がある!", " is immune.");
2058 note = _("には耐性がある。", " resists.");
2059 dam *= 3; dam /= randint1(6) + 6;
2061 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2066 /* Chaos -- Chaos breathers resist */
2069 if (seen) obvious = TRUE;
2071 if (r_ptr->flagsr & RFR_RES_ALL)
2073 note = _("には完全な耐性がある!", " is immune.");
2075 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2078 if (r_ptr->flagsr & RFR_RES_CHAO)
2080 note = _("には耐性がある。", " resists.");
2081 dam *= 3; dam /= randint1(6) + 6;
2082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2084 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2086 note = _("はいくらか耐性を示した。", " resists somewhat.");
2087 dam *= 3; dam /= randint1(6) + 6;
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2093 do_conf = (5 + randint1(11) + r) / (r + 1);
2098 /* Shards -- Shard breathers resist */
2101 if (seen) obvious = TRUE;
2103 if (r_ptr->flagsr & RFR_RES_ALL)
2105 note = _("には完全な耐性がある!", " is immune.");
2107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2110 if (r_ptr->flagsr & RFR_RES_SHAR)
2112 note = _("には耐性がある。", " resists.");
2113 dam *= 3; dam /= randint1(6) + 6;
2114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2119 /* Rocket: Shard resistance helps */
2122 if (seen) obvious = TRUE;
2124 if (r_ptr->flagsr & RFR_RES_ALL)
2126 note = _("には完全な耐性がある!", " is immune.");
2128 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2131 if (r_ptr->flagsr & RFR_RES_SHAR)
2133 note = _("はいくらか耐性を示した。", " resists somewhat.");
2135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2141 /* Sound -- Sound breathers resist */
2144 if (seen) obvious = TRUE;
2146 if (r_ptr->flagsr & RFR_RES_ALL)
2148 note = _("には完全な耐性がある!", " is immune.");
2150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2153 if (r_ptr->flagsr & RFR_RES_SOUN)
2155 note = _("には耐性がある。", " resists.");
2156 dam *= 2; dam /= randint1(6) + 6;
2157 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2159 else do_stun = (10 + randint1(15) + r) / (r + 1);
2166 if (seen) obvious = TRUE;
2168 if (r_ptr->flagsr & RFR_RES_ALL)
2170 note = _("には完全な耐性がある!", " is immune.");
2172 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2175 if (r_ptr->flags3 & RF3_NO_CONF)
2177 note = _("には耐性がある。", " resists.");
2178 dam *= 3; dam /= randint1(6) + 6;
2179 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2181 else do_conf = (10 + randint1(15) + r) / (r + 1);
2185 /* Disenchantment -- Breathers and Disenchanters resist */
2188 if (seen) obvious = TRUE;
2190 if (r_ptr->flagsr & RFR_RES_ALL)
2192 note = _("には完全な耐性がある!", " is immune.");
2194 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2197 if (r_ptr->flagsr & RFR_RES_DISE)
2199 note = _("には耐性がある。", " resists.");
2200 dam *= 3; dam /= randint1(6) + 6;
2201 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2206 /* Nexus -- Breathers and Existers resist */
2209 if (seen) obvious = TRUE;
2211 if (r_ptr->flagsr & RFR_RES_ALL)
2213 note = _("には完全な耐性がある!", " is immune.");
2215 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2218 if (r_ptr->flagsr & RFR_RES_NEXU)
2220 note = _("には耐性がある。", " resists.");
2221 dam *= 3; dam /= randint1(6) + 6;
2222 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2230 if (seen) obvious = TRUE;
2232 if (r_ptr->flagsr & RFR_RES_ALL)
2234 note = _("には完全な耐性がある!", " is immune.");
2236 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2239 if (r_ptr->flagsr & RFR_RES_WALL)
2241 note = _("には耐性がある。", " resists.");
2242 dam *= 3; dam /= randint1(6) + 6;
2243 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2245 else do_stun = (randint1(15) + r) / (r + 1);
2249 /* Inertia -- breathers resist */
2252 if (seen) obvious = TRUE;
2254 if (r_ptr->flagsr & RFR_RES_ALL)
2256 note = _("には完全な耐性がある!", " is immune.");
2258 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2261 if (r_ptr->flagsr & RFR_RES_INER)
2263 note = _("には耐性がある。", " resists.");
2264 dam *= 3; dam /= randint1(6) + 6;
2265 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2269 /* Powerful monsters can resist */
2270 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2271 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2275 /* Normal monsters slow down */
2278 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2280 note = _("の動きが遅くなった。", " starts moving slower.");
2287 /* Time -- breathers resist */
2290 if (seen) obvious = TRUE;
2292 if (r_ptr->flagsr & RFR_RES_ALL)
2294 note = _("には完全な耐性がある!", " is immune.");
2296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2299 if (r_ptr->flagsr & RFR_RES_TIME)
2301 note = _("には耐性がある。", " resists.");
2302 dam *= 3; dam /= randint1(6) + 6;
2303 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2305 else do_time = (dam + 1) / 2;
2309 /* Gravity -- breathers resist */
2312 bool resist_tele = FALSE;
2314 if (seen) obvious = TRUE;
2316 if (r_ptr->flagsr & RFR_RES_ALL)
2318 note = _("には完全な耐性がある!", " is immune.");
2320 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2323 if (r_ptr->flagsr & RFR_RES_TELE)
2325 if (r_ptr->flags1 & (RF1_UNIQUE))
2327 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2328 note = _("には効果がなかった。", " is unaffected!");
2331 else if (r_ptr->level > randint1(100))
2333 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2334 note = _("には耐性がある!", " resists!");
2339 if (!resist_tele) do_dist = 10;
2341 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2343 if (r_ptr->flagsr & RFR_RES_GRAV)
2345 note = _("には耐性がある!", " resists!");
2346 dam *= 3; dam /= randint1(6) + 6;
2348 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2353 /* Powerful monsters can resist */
2354 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2355 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2359 /* Normal monsters slow down */
2362 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2364 note = _("の動きが遅くなった。", " starts moving slower.");
2369 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2371 /* Attempt a saving throw */
2372 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2373 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2377 /* No obvious effect */
2378 note = _("には効果がなかった。", " is unaffected!");
2390 if (seen) obvious = TRUE;
2392 if (r_ptr->flagsr & RFR_RES_ALL)
2394 note = _("には完全な耐性がある!", " is immune.");
2396 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2404 case GF_DISINTEGRATE:
2406 if (seen) obvious = TRUE;
2408 if (r_ptr->flagsr & RFR_RES_ALL)
2410 note = _("には完全な耐性がある!", " is immune.");
2412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2415 if (r_ptr->flags3 & RF3_HURT_ROCK)
2417 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2418 note = _("の皮膚がただれた!", " loses some skin!");
2419 note_dies = _("は蒸発した!", " evaporates!");
2427 if (seen) obvious = TRUE;
2429 /* PSI only works if the monster can see you! -- RG */
2430 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2433 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2438 if (r_ptr->flagsr & RFR_RES_ALL)
2440 note = _("には完全な耐性がある!", " is immune.");
2442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2445 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2448 note = _("には完全な耐性がある!", " is immune.");
2449 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2452 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2453 (r_ptr->flags3 & RF3_ANIMAL) ||
2454 (r_ptr->level > randint1(3 * dam)))
2456 note = _("には耐性がある!", " resists!");
2460 * Powerful demons & undead can turn a mindcrafter's
2461 * attacks back on them
2463 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2464 (r_ptr->level > p_ptr->lev / 2) &&
2468 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2469 (seen ? "%^s's corrupted mind backlashes your attack!" :
2470 "%^ss corrupted mind backlashes your attack!")), m_name);
2473 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2475 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2479 /* Injure +/- confusion */
2480 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2481 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2482 if (one_in_(4) && !CHECK_MULTISHADOW())
2484 switch (randint1(4))
2487 set_confused(p_ptr->confused + 3 + randint1(dam));
2490 set_stun(p_ptr->stun + randint1(dam));
2494 if (r_ptr->flags3 & RF3_NO_FEAR)
2495 note = _("には効果がなかった。", " is unaffected.");
2497 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2501 if (!p_ptr->free_act)
2502 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2511 if ((dam > 0) && one_in_(4))
2513 switch (randint1(4))
2516 do_conf = 3 + randint1(dam);
2519 do_stun = 3 + randint1(dam);
2522 do_fear = 3 + randint1(dam);
2525 note = _("は眠り込んでしまった!", " falls asleep!");
2526 do_sleep = 3 + randint1(dam);
2531 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2537 if (seen) obvious = TRUE;
2539 if (r_ptr->flagsr & RFR_RES_ALL)
2541 note = _("には完全な耐性がある!", " is immune.");
2543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2546 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2549 note = _("には完全な耐性がある!", " is immune.");
2551 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2552 (r_ptr->flags3 & RF3_ANIMAL) ||
2553 (r_ptr->level > randint1(3 * dam)))
2555 note = _("には耐性がある!", " resists!");
2559 * Powerful demons & undead can turn a mindcrafter's
2560 * attacks back on them
2562 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2563 (r_ptr->level > p_ptr->lev / 2) &&
2567 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2568 (seen ? "%^s's corrupted mind backlashes your attack!" :
2569 "%^ss corrupted mind backlashes your attack!")), m_name);
2571 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2573 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2577 /* Injure + mana drain */
2578 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2579 if (!CHECK_MULTISHADOW())
2581 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2582 p_ptr->csp -= damroll(5, dam) / 2;
2583 if (p_ptr->csp < 0) p_ptr->csp = 0;
2584 p_ptr->redraw |= PR_MANA;
2585 p_ptr->window |= (PW_SPELL);
2587 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2594 int b = damroll(5, dam) / 4;
2595 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2596 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2597 (seen ? "You convert %s's pain into %s!" :
2598 "You convert %ss pain into %s!"));
2599 msg_format(msg, m_name, str);
2601 b = MIN(p_ptr->msp, p_ptr->csp + b);
2603 p_ptr->redraw |= PR_MANA;
2604 p_ptr->window |= (PW_SPELL);
2606 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2610 case GF_TELEKINESIS:
2612 if (seen) obvious = TRUE;
2614 if (r_ptr->flagsr & RFR_RES_ALL)
2616 note = _("には完全な耐性がある!", " is immune.");
2618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2623 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2628 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2630 /* Attempt a saving throw */
2631 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2632 (r_ptr->level > 5 + randint1(dam)))
2636 /* No obvious effect */
2642 /* Psycho-spear -- powerful magic missile */
2645 if (seen) obvious = TRUE;
2647 if (r_ptr->flagsr & RFR_RES_ALL)
2649 note = _("には完全な耐性がある!", " is immune.");
2651 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2657 /* Meteor -- powerful magic missile */
2660 if (seen) obvious = TRUE;
2662 if (r_ptr->flagsr & RFR_RES_ALL)
2664 note = _("には完全な耐性がある!", " is immune.");
2666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2674 if (!is_hostile(m_ptr)) break;
2676 if (seen) obvious = TRUE;
2678 if (r_ptr->flagsr & RFR_RES_ALL)
2680 note = _("には効果がなかった!", " is immune.");
2682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2685 /* Attempt a saving throw */
2686 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2687 (r_ptr->flags3 & RF3_NO_CONF) ||
2688 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2690 /* Memorize a flag */
2691 if (r_ptr->flags3 & RF3_NO_CONF)
2693 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2700 * Powerful demons & undead can turn a mindcrafter's
2701 * attacks back on them
2703 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2704 (r_ptr->level > p_ptr->lev / 2) &&
2708 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2709 (seen ? "%^s's corrupted mind backlashes your attack!" :
2710 "%^ss corrupted mind backlashes your attack!")), m_name);
2713 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2715 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2719 /* Confuse, stun, terrify */
2720 switch (randint1(4))
2723 set_stun(p_ptr->stun + dam / 2);
2726 set_confused(p_ptr->confused + dam / 2);
2730 if (r_ptr->flags3 & RF3_NO_FEAR)
2731 note = _("には効果がなかった。", " is unaffected.");
2733 set_afraid(p_ptr->afraid + dam);
2740 /* No obvious effect */
2741 note = _("には効果がなかった。", " is unaffected.");
2747 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2749 note = _("があなたに隷属した。", " is in your thrall!");
2754 switch (randint1(4))
2768 /* No "real" damage */
2775 /* Ice -- Cold + Cuts + Stun */
2778 if (seen) obvious = TRUE;
2780 if (r_ptr->flagsr & RFR_RES_ALL)
2782 note = _("には完全な耐性がある!", " is immune.");
2784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2787 do_stun = (randint1(15) + 1) / (r + 1);
2788 if (r_ptr->flagsr & RFR_IM_COLD)
2790 note = _("にはかなり耐性がある!", " resists a lot.");
2792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2794 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2796 note = _("はひどい痛手をうけた。", " is hit hard.");
2798 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2805 case GF_HYPODYNAMIA:
2807 if (seen) obvious = TRUE;
2809 if (r_ptr->flagsr & RFR_RES_ALL)
2811 note = _("には完全な耐性がある!", " is immune.");
2813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2816 if (!monster_living(r_ptr))
2818 if (is_original_ap_and_seen(m_ptr))
2820 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2821 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2822 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2824 note = _("には効果がなかった。", " is unaffected.");
2828 else do_time = (dam+7)/8;
2836 if (seen) obvious = TRUE;
2838 if (r_ptr->flagsr & RFR_RES_ALL)
2840 note = _("には完全な耐性がある!", " is immune.");
2842 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2845 if (!monster_living(r_ptr))
2847 if (is_original_ap_and_seen(m_ptr))
2849 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2850 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2851 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2853 note = _("には完全な耐性がある!", " is immune.");
2857 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2858 (randint1(888) != 666)) ||
2859 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2860 randint1(100) != 66))
2862 note = _("には耐性がある!", " resists!");
2870 /* Polymorph monster (Use "dam" as "power") */
2873 if (seen) obvious = TRUE;
2875 if (r_ptr->flagsr & RFR_RES_ALL)
2877 note = _("には効果がなかった。", " is unaffected.");
2879 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2882 /* Attempt to polymorph (see below) */
2885 /* Powerful monsters can resist */
2886 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2887 (r_ptr->flags1 & RF1_QUESTOR) ||
2888 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2890 note = _("には効果がなかった。", " is unaffected.");
2895 /* No "real" damage */
2902 /* Clone monsters (Ignore "dam") */
2905 if (seen) obvious = TRUE;
2907 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2909 note = _("には効果がなかった。", " is unaffected.");
2914 m_ptr->hp = m_ptr->maxhp;
2916 /* Attempt to clone. */
2917 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2919 note = _("が分裂した!", " spawns!");
2923 /* No "real" damage */
2930 /* Heal Monster (use "dam" as amount of healing) */
2933 if (seen) obvious = TRUE;
2936 (void)set_monster_csleep(c_ptr->m_idx, 0);
2938 if (m_ptr->maxhp < m_ptr->max_maxhp)
2940 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2941 m_ptr->maxhp = m_ptr->max_maxhp;
2946 /* Redraw (later) if needed */
2947 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2948 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2956 if (seen) obvious = TRUE;
2959 (void)set_monster_csleep(c_ptr->m_idx, 0);
2960 if (MON_STUNNED(m_ptr))
2962 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2963 (void)set_monster_stunned(c_ptr->m_idx, 0);
2965 if (MON_CONFUSED(m_ptr))
2967 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2968 (void)set_monster_confused(c_ptr->m_idx, 0);
2970 if (MON_MONFEAR(m_ptr))
2972 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2973 (void)set_monster_monfear(c_ptr->m_idx, 0);
2977 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2980 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2984 chg_virtue(V_VITALITY, 1);
2986 if (r_ptr->flags1 & RF1_UNIQUE)
2987 chg_virtue(V_INDIVIDUALISM, 1);
2989 if (is_friendly(m_ptr))
2990 chg_virtue(V_HONOUR, 1);
2991 else if (!(r_ptr->flags3 & RF3_EVIL))
2993 if (r_ptr->flags3 & RF3_GOOD)
2994 chg_virtue(V_COMPASSION, 2);
2996 chg_virtue(V_COMPASSION, 1);
2999 if (r_ptr->flags3 & RF3_ANIMAL)
3000 chg_virtue(V_NATURE, 1);
3003 if (m_ptr->r_idx == MON_LEPER)
3006 if (!who) chg_virtue(V_COMPASSION, 5);
3009 /* Redraw (later) if needed */
3010 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3011 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3013 note = _("は体力を回復したようだ。", " looks healthier.");
3015 /* No "real" damage */
3021 /* Speed Monster (Ignore "dam") */
3024 if (seen) obvious = TRUE;
3027 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3029 note = _("の動きが速くなった。", " starts moving faster.");
3034 if (r_ptr->flags1 & RF1_UNIQUE)
3035 chg_virtue(V_INDIVIDUALISM, 1);
3036 if (is_friendly(m_ptr))
3037 chg_virtue(V_HONOUR, 1);
3040 /* No "real" damage */
3046 /* Slow Monster (Use "dam" as "power") */
3049 if (seen) obvious = TRUE;
3051 if (r_ptr->flagsr & RFR_RES_ALL)
3053 note = _("には効果がなかった。", " is unaffected.");
3055 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3058 /* Powerful monsters can resist */
3059 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3060 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3062 note = _("には効果がなかった。", " is unaffected.");
3066 /* Normal monsters slow down */
3069 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3071 note = _("の動きが遅くなった。", " starts moving slower.");
3075 /* No "real" damage */
3081 /* Sleep (Use "dam" as "power") */
3084 if (seen) obvious = TRUE;
3086 if (r_ptr->flagsr & RFR_RES_ALL)
3088 note = _("には効果がなかった。", " is unaffected.");
3090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3093 /* Attempt a saving throw */
3094 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3095 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3096 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3098 /* Memorize a flag */
3099 if (r_ptr->flags3 & RF3_NO_SLEEP)
3101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3103 /* No obvious effect */
3104 note = _("には効果がなかった。", " is unaffected.");
3109 /* Go to sleep (much) later */
3110 note = _("は眠り込んでしまった!", " falls asleep!");
3114 /* No "real" damage */
3120 /* Sleep (Use "dam" as "power") */
3121 case GF_STASIS_EVIL:
3123 if (seen) obvious = TRUE;
3125 if (r_ptr->flagsr & RFR_RES_ALL)
3127 note = _("には効果がなかった!", " is immune.");
3129 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3132 /* Attempt a saving throw */
3133 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3134 !(r_ptr->flags3 & RF3_EVIL) ||
3135 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3137 note = _("には効果がなかった。", " is unaffected.");
3142 /* Go to sleep (much) later */
3143 note = _("は動けなくなった!", " is suspended!");
3147 /* No "real" damage */
3152 /* Sleep (Use "dam" as "power") */
3155 if (seen) obvious = TRUE;
3157 if (r_ptr->flagsr & RFR_RES_ALL)
3159 note = _("には効果がなかった。", " is unaffected.");
3161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3164 /* Attempt a saving throw */
3165 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3166 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3168 note = _("には効果がなかった。", " is unaffected.");
3173 /* Go to sleep (much) later */
3174 note = _("は動けなくなった!", " is suspended!");
3178 /* No "real" damage */
3187 vir = virtue_number(V_HARMONY);
3190 dam += p_ptr->virtues[vir-1]/10;
3193 vir = virtue_number(V_INDIVIDUALISM);
3196 dam -= p_ptr->virtues[vir-1]/20;
3199 if (seen) obvious = TRUE;
3201 /* Attempt a saving throw */
3202 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3206 /* No obvious effect */
3207 note = _("には効果がなかった。", " is unaffected.");
3210 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3212 else if (p_ptr->cursed & TRC_AGGRAVATE)
3214 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3215 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3219 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3222 chg_virtue(V_INDIVIDUALISM, -1);
3223 if (r_ptr->flags3 & RF3_ANIMAL)
3224 chg_virtue(V_NATURE, 1);
3227 /* No "real" damage */
3232 /* Control undead */
3233 case GF_CONTROL_UNDEAD:
3236 if (seen) obvious = TRUE;
3238 vir = virtue_number(V_UNLIFE);
3241 dam += p_ptr->virtues[vir-1]/10;
3244 vir = virtue_number(V_INDIVIDUALISM);
3247 dam -= p_ptr->virtues[vir-1]/20;
3250 /* Attempt a saving throw */
3251 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3252 !(r_ptr->flags3 & RF3_UNDEAD))
3254 /* No obvious effect */
3255 note = _("には効果がなかった。", " is unaffected.");
3257 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3259 else if (p_ptr->cursed & TRC_AGGRAVATE)
3261 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3262 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3266 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3270 /* No "real" damage */
3276 case GF_CONTROL_DEMON:
3279 if (seen) obvious = TRUE;
3281 vir = virtue_number(V_UNLIFE);
3284 dam += p_ptr->virtues[vir-1]/10;
3287 vir = virtue_number(V_INDIVIDUALISM);
3290 dam -= p_ptr->virtues[vir-1]/20;
3293 /* Attempt a saving throw */
3294 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3295 !(r_ptr->flags3 & RF3_DEMON))
3297 /* No obvious effect */
3298 note = _("には効果がなかった。", " is unaffected.");
3300 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3302 else if (p_ptr->cursed & TRC_AGGRAVATE)
3304 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3305 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3309 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3313 /* No "real" damage */
3319 case GF_CONTROL_ANIMAL:
3322 if (seen) obvious = TRUE;
3324 vir = virtue_number(V_NATURE);
3327 dam += p_ptr->virtues[vir-1]/10;
3330 vir = virtue_number(V_INDIVIDUALISM);
3333 dam -= p_ptr->virtues[vir-1]/20;
3336 /* Attempt a saving throw */
3337 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3338 !(r_ptr->flags3 & RF3_ANIMAL))
3341 /* No obvious effect */
3342 note = _("には効果がなかった。", " is unaffected.");
3344 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3346 else if (p_ptr->cursed & TRC_AGGRAVATE)
3348 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3349 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3353 note = _("はなついた。", " is tamed!");
3355 if (r_ptr->flags3 & RF3_ANIMAL)
3356 chg_virtue(V_NATURE, 1);
3359 /* No "real" damage */
3365 case GF_CHARM_LIVING:
3369 vir = virtue_number(V_UNLIFE);
3370 if (seen) obvious = TRUE;
3372 vir = virtue_number(V_UNLIFE);
3375 dam -= p_ptr->virtues[vir-1]/10;
3378 vir = virtue_number(V_INDIVIDUALISM);
3381 dam -= p_ptr->virtues[vir-1]/20;
3384 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3386 /* Attempt a saving throw */
3387 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3388 !monster_living(r_ptr))
3391 /* No obvious effect */
3392 note = _("には効果がなかった。", " is unaffected.");
3394 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3396 else if (p_ptr->cursed & TRC_AGGRAVATE)
3398 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3399 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3403 note = _("を支配した。", " is tamed!");
3405 if (r_ptr->flags3 & RF3_ANIMAL)
3406 chg_virtue(V_NATURE, 1);
3409 /* No "real" damage */
3414 /* Confusion (Use "dam" as "power") */
3417 if (seen) obvious = TRUE;
3419 if (r_ptr->flagsr & RFR_RES_ALL)
3421 note = _("には効果がなかった。", " is unaffected.");
3423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3426 /* Get confused later */
3427 do_conf = damroll(3, (dam / 2)) + 1;
3429 /* Attempt a saving throw */
3430 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3431 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3434 /* Memorize a flag */
3435 if (r_ptr->flags3 & (RF3_NO_CONF))
3437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3443 /* No obvious effect */
3444 note = _("には効果がなかった。", " is unaffected.");
3448 /* No "real" damage */
3455 if (seen) obvious = TRUE;
3457 if (r_ptr->flagsr & RFR_RES_ALL)
3459 note = _("には効果がなかった。", " is unaffected.");
3461 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3464 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3466 /* Attempt a saving throw */
3467 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3468 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3473 /* No obvious effect */
3474 note = _("には効果がなかった。", " is unaffected.");
3478 /* No "real" damage */
3486 /* Lite, but only hurts susceptible creatures */
3494 if (r_ptr->flagsr & RFR_RES_ALL)
3500 if (r_ptr->flags3 & (RF3_HURT_LITE))
3502 /* Obvious effect */
3503 if (seen) obvious = TRUE;
3505 /* Memorize the effects */
3506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3508 /* Special effect */
3509 note = _("は光に身をすくめた!", " cringes from the light!");
3510 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3513 /* Normally no damage */
3525 /* Lite -- opposite of Dark */
3528 if (seen) obvious = TRUE;
3530 if (r_ptr->flagsr & RFR_RES_ALL)
3532 note = _("には完全な耐性がある!", " is immune.");
3534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3537 if (r_ptr->flagsr & RFR_RES_LITE)
3539 note = _("には耐性がある!", " resists!");
3540 dam *= 2; dam /= (randint1(6)+6);
3541 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3543 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3546 note = _("は光に身をすくめた!", " cringes from the light!");
3547 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3554 /* Dark -- opposite of Lite */
3557 if (seen) obvious = TRUE;
3559 if (r_ptr->flagsr & RFR_RES_ALL)
3561 note = _("には完全な耐性がある!", " is immune.");
3563 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3566 if (r_ptr->flagsr & RFR_RES_DARK)
3568 note = _("には耐性がある!", " resists!");
3569 dam *= 2; dam /= (randint1(6)+6);
3570 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3579 if (r_ptr->flagsr & RFR_RES_ALL)
3584 /* Hurt by rock remover */
3585 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3588 if (seen) obvious = TRUE;
3590 /* Memorize the effects */
3591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3593 /* Cute little message */
3594 note = _("の皮膚がただれた!", " loses some skin!");
3595 note_dies = _("はドロドロに溶けた!", " dissolves!");
3598 /* Usually, ignore the effects */
3609 /* Teleport undead (Use "dam" as "power") */
3610 case GF_AWAY_UNDEAD:
3612 /* Only affect undead */
3613 if (r_ptr->flags3 & (RF3_UNDEAD))
3615 bool resists_tele = FALSE;
3617 if (r_ptr->flagsr & RFR_RES_TELE)
3619 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3621 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3622 note = _("には効果がなかった。", " is unaffected.");
3623 resists_tele = TRUE;
3625 else if (r_ptr->level > randint1(100))
3627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3628 note = _("には耐性がある!", " resists!");
3629 resists_tele = TRUE;
3635 if (seen) obvious = TRUE;
3636 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3648 /* No "real" damage */
3654 /* Teleport evil (Use "dam" as "power") */
3657 /* Only affect evil */
3658 if (r_ptr->flags3 & (RF3_EVIL))
3660 bool resists_tele = FALSE;
3662 if (r_ptr->flagsr & RFR_RES_TELE)
3664 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3667 note = _("には効果がなかった。", " is unaffected.");
3668 resists_tele = TRUE;
3670 else if (r_ptr->level > randint1(100))
3672 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3673 note = _("には耐性がある!", " resists!");
3674 resists_tele = TRUE;
3680 if (seen) obvious = TRUE;
3681 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3693 /* No "real" damage */
3699 /* Teleport monster (Use "dam" as "power") */
3702 bool resists_tele = FALSE;
3703 if (r_ptr->flagsr & RFR_RES_TELE)
3705 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3707 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3708 note = _("には効果がなかった。", " is unaffected.");
3709 resists_tele = TRUE;
3711 else if (r_ptr->level > randint1(100))
3713 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3714 note = _("には耐性がある!", " resists!");
3715 resists_tele = TRUE;
3722 if (seen) obvious = TRUE;
3724 /* Prepare to teleport */
3728 /* No "real" damage */
3734 /* Turn undead (Use "dam" as "power") */
3735 case GF_TURN_UNDEAD:
3737 if (r_ptr->flagsr & RFR_RES_ALL)
3742 /* Only affect undead */
3743 if (r_ptr->flags3 & (RF3_UNDEAD))
3746 if (seen) obvious = TRUE;
3748 /* Learn about type */
3749 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3751 /* Apply some fear */
3752 do_fear = damroll(3, (dam / 2)) + 1;
3754 /* Attempt a saving throw */
3755 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3757 /* No obvious effect */
3758 note = _("には効果がなかった。", " is unaffected.");
3771 /* No "real" damage */
3777 /* Turn evil (Use "dam" as "power") */
3780 if (r_ptr->flagsr & RFR_RES_ALL)
3785 /* Only affect evil */
3786 if (r_ptr->flags3 & (RF3_EVIL))
3789 if (seen) obvious = TRUE;
3791 /* Learn about type */
3792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3794 /* Apply some fear */
3795 do_fear = damroll(3, (dam / 2)) + 1;
3797 /* Attempt a saving throw */
3798 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3800 /* No obvious effect */
3801 note = _("には効果がなかった。", " is unaffected.");
3814 /* No "real" damage */
3820 /* Turn monster (Use "dam" as "power") */
3823 if (r_ptr->flagsr & RFR_RES_ALL)
3829 if (seen) obvious = TRUE;
3831 /* Apply some fear */
3832 do_fear = damroll(3, (dam / 2)) + 1;
3834 /* Attempt a saving throw */
3835 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3836 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3837 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3839 /* No obvious effect */
3840 note = _("には効果がなかった。", " is unaffected.");
3845 /* No "real" damage */
3852 case GF_DISP_UNDEAD:
3854 if (r_ptr->flagsr & RFR_RES_ALL)
3860 /* Only affect undead */
3861 if (r_ptr->flags3 & (RF3_UNDEAD))
3864 if (seen) obvious = TRUE;
3866 /* Learn about type */
3867 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3869 note = _("は身震いした。", " shudders.");
3870 note_dies = _("はドロドロに溶けた!", " dissolves!");
3890 if (r_ptr->flagsr & RFR_RES_ALL)
3896 /* Only affect evil */
3897 if (r_ptr->flags3 & (RF3_EVIL))
3900 if (seen) obvious = TRUE;
3902 /* Learn about type */
3903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3905 note = _("は身震いした。", " shudders.");
3906 note_dies = _("はドロドロに溶けた!", " dissolves!");
3925 if (r_ptr->flagsr & RFR_RES_ALL)
3931 /* Only affect good */
3932 if (r_ptr->flags3 & (RF3_GOOD))
3935 if (seen) obvious = TRUE;
3937 /* Learn about type */
3938 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3940 note = _("は身震いした。", " shudders.");
3941 note_dies = _("はドロドロに溶けた!", " dissolves!");
3958 case GF_DISP_LIVING:
3960 if (r_ptr->flagsr & RFR_RES_ALL)
3966 /* Only affect non-undead */
3967 if (monster_living(r_ptr))
3970 if (seen) obvious = TRUE;
3972 note = _("は身震いした。", " shudders.");
3973 note_dies = _("はドロドロに溶けた!", " dissolves!");
3992 if (r_ptr->flagsr & RFR_RES_ALL)
3998 /* Only affect demons */
3999 if (r_ptr->flags3 & (RF3_DEMON))
4002 if (seen) obvious = TRUE;
4004 /* Learn about type */
4005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4007 note = _("は身震いした。", " shudders.");
4008 note_dies = _("はドロドロに溶けた!", " dissolves!");
4024 /* Dispel monster */
4027 if (r_ptr->flagsr & RFR_RES_ALL)
4034 if (seen) obvious = TRUE;
4036 note = _("は身震いした。", " shudders.");
4037 note_dies = _("はドロドロに溶けた!", " dissolves!");
4044 if (seen) obvious = TRUE;
4046 if (r_ptr->flagsr & RFR_RES_ALL)
4048 note = _("には完全な耐性がある!", " is immune.");
4050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4054 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4058 /* Heal the monster */
4059 if (caster_ptr->hp < caster_ptr->maxhp)
4062 caster_ptr->hp += dam;
4063 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4065 /* Redraw (later) if needed */
4066 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4067 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4069 /* Special message */
4072 /* Get the monster name */
4073 monster_desc(killer, caster_ptr, 0);
4074 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4080 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4081 (void)hp_player(dam);
4086 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4095 if (seen) obvious = TRUE;
4096 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4098 if (r_ptr->flagsr & RFR_RES_ALL)
4100 note = _("には完全な耐性がある!", " is immune.");
4102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4106 /* Attempt a saving throw */
4107 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4108 (r_ptr->flags3 & RF3_NO_CONF) ||
4109 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4111 /* Memorize a flag */
4112 if (r_ptr->flags3 & (RF3_NO_CONF))
4114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4116 note = _("には効果がなかった。", " is unaffected.");
4119 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4121 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4122 note = _("には完全な耐性がある!", " is immune.");
4125 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4128 note = _("には耐性がある。", " resists.");
4133 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4134 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4136 if (who > 0) do_conf = randint0(4) + 4;
4137 else do_conf = randint0(8) + 8;
4143 case GF_BRAIN_SMASH:
4145 if (seen) obvious = TRUE;
4146 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4148 if (r_ptr->flagsr & RFR_RES_ALL)
4150 note = _("には完全な耐性がある!", " is immune.");
4152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4156 /* Attempt a saving throw */
4157 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4158 (r_ptr->flags3 & RF3_NO_CONF) ||
4159 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4161 /* Memorize a flag */
4162 if (r_ptr->flags3 & (RF3_NO_CONF))
4164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4166 note = _("には効果がなかった。", " is unaffected.");
4169 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4171 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4172 note = _("には完全な耐性がある!", " is immune.");
4175 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4177 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4178 note = _("には耐性がある!", " resists!");
4183 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4184 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4188 do_conf = randint0(4) + 4;
4189 do_stun = randint0(4) + 4;
4193 do_conf = randint0(8) + 8;
4194 do_stun = randint0(8) + 8;
4196 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4204 if (seen) obvious = TRUE;
4205 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4207 if (r_ptr->flagsr & RFR_RES_ALL)
4209 note = _("には完全な耐性がある!", " is immune.");
4211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4215 /* Attempt a saving throw */
4216 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4218 note = _("には効果がなかった。", " is unaffected.");
4227 if (seen) obvious = TRUE;
4228 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4230 if (r_ptr->flagsr & RFR_RES_ALL)
4232 note = _("には完全な耐性がある!", " is immune.");
4234 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4238 /* Attempt a saving throw */
4239 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4241 note = _("には効果がなかった。", " is unaffected.");
4250 if (seen) obvious = TRUE;
4251 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4253 if (r_ptr->flagsr & RFR_RES_ALL)
4255 note = _("には完全な耐性がある!", " is immune.");
4257 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4261 /* Attempt a saving throw */
4262 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4264 note = _("には効果がなかった。", " is unaffected.");
4273 if (seen) obvious = TRUE;
4275 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4276 "You point at %s, screaming the word, 'DIE!'."), m_name);
4278 if (r_ptr->flagsr & RFR_RES_ALL)
4280 note = _("には完全な耐性がある!", " is immune.");
4282 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4286 /* Attempt a saving throw */
4287 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4289 note = _("には効果がなかった。", " is unaffected.");
4298 if (seen) obvious = TRUE;
4300 if (r_ptr->flagsr & RFR_RES_ALL)
4302 note = _("には完全な耐性がある!", " is immune.");
4304 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4308 if (r_ptr->flags1 & RF1_UNIQUE)
4310 note = _("には効果がなかった。", " is unaffected.");
4315 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4316 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4318 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4320 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4324 note = _("は耐性を持っている!", "resists!");
4331 /* Capture monster */
4335 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4336 (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)
4338 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4343 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4344 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4345 nokori_hp = m_ptr->maxhp * 3 / 10;
4347 nokori_hp = m_ptr->maxhp * 3 / 20;
4349 if (m_ptr->hp >= nokori_hp)
4351 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4354 else if (m_ptr->hp < randint0(nokori_hp))
4356 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4357 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4358 cap_mon = m_ptr->r_idx;
4359 cap_mspeed = m_ptr->mspeed;
4361 cap_maxhp = m_ptr->max_maxhp;
4362 cap_nickname = m_ptr->nickname; /* Quark transfer */
4363 if (c_ptr->m_idx == p_ptr->riding)
4365 if (rakuba(-1, FALSE))
4367 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4371 delete_monster_idx(c_ptr->m_idx);
4377 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4383 /* Attack (Use "dam" as attack type) */
4386 /* Return this monster's death */
4387 return py_attack(y, x, dam);
4390 /* Sleep (Use "dam" as "power") */
4396 if (seen) obvious = TRUE;
4398 if (r_ptr->flagsr & RFR_RES_ALL)
4400 note = _("には効果がなかった。", " is unaffected.");
4402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4405 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4407 note = _("には効果がなかった。", " is unaffected.");
4410 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4413 if (MON_CSLEEP(m_ptr))
4415 note = _("には効果がなかった。", " is unaffected.");
4421 if (one_in_(5)) effect = 1;
4422 else if (one_in_(4)) effect = 2;
4423 else if (one_in_(3)) effect = 3;
4428 /* Powerful monsters can resist */
4429 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4430 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4432 note = _("には効果がなかった。", " is unaffected.");
4436 /* Normal monsters slow down */
4439 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4441 note = _("の動きが遅くなった。", " starts moving slower.");
4446 else if (effect == 2)
4448 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4450 /* Attempt a saving throw */
4451 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4452 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4457 /* No obvious effect */
4458 note = _("には効果がなかった。", " is unaffected.");
4463 else if (effect == 3)
4465 /* Attempt a saving throw */
4466 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4467 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4468 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4470 /* Memorize a flag */
4471 if (r_ptr->flags3 & RF3_NO_SLEEP)
4473 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4476 /* No obvious effect */
4477 note = _("には効果がなかった。", " is unaffected.");
4482 /* Go to sleep (much) later */
4483 note = _("は眠り込んでしまった!", " falls asleep!");
4490 note = _("には効果がなかった。", " is unaffected.");
4493 /* No "real" damage */
4501 if (seen) obvious = TRUE;
4503 if (r_ptr->flagsr & RFR_RES_ALL)
4505 note = _("には効果がなかった。", " is unaffected.");
4507 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4511 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4513 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4514 chg_virtue(V_VITALITY, -1);
4524 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4526 if (r_ptr->flags3 & (RF3_HURT_LITE))
4528 /* Obvious effect */
4529 if (seen) obvious = TRUE;
4531 /* Memorize the effects */
4532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4534 /* Special effect */
4535 note = _("は光に身をすくめた!", " cringes from the light!");
4536 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4539 /* Normally no damage */
4546 photo = m_ptr->r_idx;
4553 case GF_BLOOD_CURSE:
4555 if (seen) obvious = TRUE;
4557 if (r_ptr->flagsr & RFR_RES_ALL)
4559 note = _("には完全な耐性がある!", " is immune.");
4561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4569 bool success = FALSE;
4570 if (seen) obvious = TRUE;
4572 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4574 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4575 if (dam < 1) dam = 1;
4577 /* No need to tame your pet */
4580 note = _("の動きが速くなった。", " starts moving faster.");
4581 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4585 /* Attempt a saving throw */
4586 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4587 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4588 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4589 (p_ptr->cursed & TRC_AGGRAVATE) ||
4590 ((r_ptr->level+10) > randint1(dam)))
4593 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4597 note = _("を支配した。", " is tamed!");
4599 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4601 /* Learn about type */
4602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4609 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4611 do_fear = randint1(90)+10;
4613 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4616 /* No "real" damage */
4623 if (seen) obvious = TRUE;
4625 if (r_ptr->flagsr & RFR_RES_ALL)
4627 note = _("には完全な耐性がある!", " is immune.");
4629 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4633 /* Attempt a saving throw */
4634 if (randint0(100 + dam) < (r_ptr->level + 50))
4636 note = _("には効果がなかった。", " is unaffected.");
4656 /* Absolutely no effect */
4657 if (skipped) return (FALSE);
4659 /* "Unique" monsters cannot be polymorphed */
4660 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4662 /* Quest monsters cannot be polymorphed */
4663 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4665 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4667 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4668 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4670 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4675 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4676 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4679 /* Modify the damage */
4681 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4682 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4684 /* Check for death */
4685 if (dam > m_ptr->hp)
4687 /* Extract method of death */
4692 /* Sound and Impact resisters never stun */
4694 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4695 !(r_ptr->flags3 & RF3_NO_STUN))
4698 if (seen) obvious = TRUE;
4701 if (MON_STUNNED(m_ptr))
4703 note = _("はひどくもうろうとした。", " is more dazed.");
4704 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4708 note = _("はもうろうとした。", " is dazed.");
4713 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4719 /* Confusion and Chaos resisters (and sleepers) never confuse */
4721 !(r_ptr->flags3 & RF3_NO_CONF) &&
4722 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4725 if (seen) obvious = TRUE;
4727 /* Already partially confused */
4728 if (MON_CONFUSED(m_ptr))
4730 note = _("はさらに混乱したようだ。", " looks more confused.");
4731 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4734 /* Was not confused */
4737 note = _("は混乱したようだ。", " looks confused.");
4741 /* Apply confusion */
4742 (void)set_monster_confused(c_ptr->m_idx, tmp);
4751 if (seen) obvious = TRUE;
4753 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4757 note = _("は弱くなったようだ。", " seems weakened.");
4758 m_ptr->maxhp -= do_time;
4759 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4764 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4765 if (do_poly && (randint1(90) > r_ptr->level))
4767 if (polymorph_monster(y, x))
4770 if (seen) obvious = TRUE;
4772 /* Monster polymorphs */
4773 note = _("が変身した!", " changes!");
4775 /* Turn off the damage */
4781 note = _("には効果がなかった。", " is unaffected.");
4784 /* Hack -- Get new monster */
4785 m_ptr = &m_list[c_ptr->m_idx];
4787 /* Hack -- Get new race */
4788 r_ptr = &r_info[m_ptr->r_idx];
4791 /* Handle "teleport" */
4795 if (seen) obvious = TRUE;
4797 note = _("が消え去った!", " disappears!");
4799 if (!who) chg_virtue(V_VALOUR, -1);
4802 teleport_away(c_ptr->m_idx, do_dist,
4803 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4805 /* Hack -- get new location */
4809 /* Hack -- get new grid */
4810 c_ptr = &cave[y][x];
4817 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4824 if (typ == GF_DRAIN_MANA)
4826 /* Drain mana does nothing */
4829 /* If another monster did the damage, hurt the monster by hand */
4832 /* Redraw (later) if needed */
4833 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4834 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4836 /* Wake the monster up */
4837 (void)set_monster_csleep(c_ptr->m_idx, 0);
4839 /* Hurt the monster */
4847 if (is_pet(m_ptr) && !(m_ptr->ml))
4850 /* Give detailed messages if destroyed */
4853 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4856 msg_format("%^s%s", m_name, note);
4864 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4866 /* Generate treasure, etc */
4867 monster_death(c_ptr->m_idx, FALSE);
4869 /* Delete the monster */
4870 delete_monster_idx(c_ptr->m_idx);
4874 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4878 /* Damaged monster */
4881 /* Give detailed messages if visible or destroyed */
4882 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4884 /* Hack -- Pain message */
4887 message_pain(c_ptr->m_idx, dam);
4894 /* Hack -- handle sleep */
4895 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4899 else if (heal_leper)
4901 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4903 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4907 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4908 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4911 delete_monster_idx(c_ptr->m_idx);
4914 /* If the player did it, give him experience, check fear */
4919 /* Hurt the monster, check for fear and death */
4920 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4925 /* Damaged monster */
4928 /* HACK - anger the monster before showing the sleep message */
4929 if (do_sleep) anger_monster(m_ptr);
4931 /* Give detailed messages if visible or destroyed */
4932 if (note && seen_msg)
4933 msg_format(_("%s%s", "%^s%s"), m_name, note);
4935 /* Hack -- Pain message */
4936 else if (known && (dam || !do_fear))
4938 message_pain(c_ptr->m_idx, dam);
4941 /* Anger monsters */
4942 if (((dam > 0) || get_angry) && !do_sleep)
4943 anger_monster(m_ptr);
4946 if ((fear || do_fear) && seen)
4950 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4953 /* Hack -- handle sleep */
4954 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4958 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4960 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4964 switch (randint1(28))
4969 msg_print(_("地面が揺れた...", "The ground trembles..."));
4970 earthquake(ty, tx, 4 + randint0(4));
4971 if (!one_in_(6)) break;
4973 case 3: case 4: case 5: case 6:
4976 int extra_dam = damroll(10, 10);
4977 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4979 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4980 if (!one_in_(6)) break;
4985 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4987 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4988 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4989 if (!one_in_(6)) break;
4991 case 9: case 10: case 11:
4992 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4993 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4994 if (!one_in_(6)) break;
4995 case 12: case 13: case 14: case 15: case 16:
4996 aggravate_monsters(0);
4997 if (!one_in_(6)) break;
4999 count += activate_hi_summon(ty, tx, TRUE);
5000 if (!one_in_(6)) break;
5001 case 19: case 20: case 21: case 22:
5003 bool pet = !one_in_(3);
5004 BIT_FLAGS mode = PM_ALLOW_GROUP;
5006 if (pet) mode |= PM_FORCE_PET;
5007 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5009 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);
5010 if (!one_in_(6)) break;
5012 case 23: case 24: case 25:
5013 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5014 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5016 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5017 else lose_exp(p_ptr->exp / 16);
5018 if (!one_in_(6)) break;
5019 case 26: case 27: case 28:
5028 (void)do_dec_stat(i);
5037 (void)do_dec_stat(randint0(6));
5046 if (p_ptr->inside_battle)
5048 p_ptr->health_who = c_ptr->m_idx;
5049 p_ptr->redraw |= (PR_HEALTH);
5053 /* XXX XXX XXX Verify this code */
5055 /* Update the monster */
5056 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5058 /* Redraw the monster grid */
5062 /* Update monster recall window */
5063 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5066 p_ptr->window |= (PW_MONSTER);
5069 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5073 if (!(flg & PROJECT_NO_HANGEKI))
5075 set_target(m_ptr, monster_target_y, monster_target_x);
5078 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5080 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5084 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5086 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5087 rakubadam_m = (dam > 200) ? 200 : dam;
5096 /* Get local object */
5099 /* Prepare to make a Blade of Chaos */
5100 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5102 q_ptr->pval = photo;
5104 /* Mark the item as fully known */
5105 q_ptr->ident |= (IDENT_MENTAL);
5107 /* Drop it in the dungeon */
5108 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5116 /* Return "Anything seen?" */
5121 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5122 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5123 * @param who_name 効果を起こしたモンスターの名前
5124 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5125 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5126 * @param x 目標X座標 / Target x location (or location to travel "towards")
5127 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5128 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5130 * @param monspell 効果元のモンスター魔法ID
5131 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5133 * Handle a beam/bolt/ball causing damage to the player.
5134 * This routine takes a "source monster" (by index), a "distance", a default
5135 * "damage", and a "damage type". See "project_m()" above.
5136 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5137 * is reduced (see "project_m()" above). This can happen if a monster breathes
5138 * at the player and hits a wall instead.
5139 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5140 * to know if this is actually a ball or a bolt spell
5141 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5142 * we just assume that the effects were obvious, for historical reasons.
5144 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)
5149 /* Hack -- assume obvious */
5150 bool obvious = TRUE;
5152 /* Player blind-ness */
5153 bool blind = (p_ptr->blind ? TRUE : FALSE);
5155 /* Player needs a "description" (he is blind) */
5158 /* Source monster */
5159 monster_type *m_ptr = NULL;
5161 /* Monster name (for attacks) */
5164 /* Monster name (for damage) */
5167 /* Hack -- messages */
5173 /* Player is not here */
5174 if (!player_bold(y, x)) return (FALSE);
5176 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5178 if (kawarimi(TRUE)) return FALSE;
5181 /* Player cannot hurt himself */
5182 if (!who) return (FALSE);
5183 if (who == p_ptr->riding) return (FALSE);
5185 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5188 int max_attempts = 10;
5189 sound(SOUND_REFLECT);
5192 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5193 else if (p_ptr->special_defense & KATA_FUUJIN)
5194 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5196 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5199 /* Choose 'new' target */
5204 t_y = m_list[who].fy - 1 + randint1(3);
5205 t_x = m_list[who].fx - 1 + randint1(3);
5208 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5210 if (max_attempts < 1)
5212 t_y = m_list[who].fy;
5213 t_x = m_list[who].fx;
5218 t_y = p_ptr->y - 1 + randint1(3);
5219 t_x = p_ptr->x - 1 + randint1(3);
5222 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5229 /* Limit maximum damage */
5230 if (dam > 1600) dam = 1600;
5232 /* Reduce damage by distance */
5233 dam = (dam + r) / (r + 1);
5236 /* If the player is blind, be more descriptive */
5237 if (blind) fuzzy = TRUE;
5242 /* Get the source monster */
5243 m_ptr = &m_list[who];
5244 /* Extract the monster level */
5245 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5247 /* Get the monster name */
5248 monster_desc(m_name, m_ptr, 0);
5250 /* Get the monster's real name (gotten before polymorph!) */
5251 strcpy(killer, who_name);
5257 case PROJECT_WHO_UNCTRL_POWER:
5258 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5261 case PROJECT_WHO_GLASS_SHARDS:
5262 strcpy(killer, _("ガラスの破片", "shards of glass"));
5266 strcpy(killer, _("罠", "a trap"));
5271 strcpy(m_name, killer);
5274 /* Analyze the damage */
5277 /* Standard damage -- hurts inventory too */
5280 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5281 get_damage = acid_dam(dam, killer, monspell, FALSE);
5285 /* Standard damage -- hurts inventory too */
5288 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5289 get_damage = fire_dam(dam, killer, monspell, FALSE);
5293 /* Standard damage -- hurts inventory too */
5296 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5297 get_damage = cold_dam(dam, killer, monspell, FALSE);
5301 /* Standard damage -- hurts inventory too */
5304 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5305 get_damage = elec_dam(dam, killer, monspell, FALSE);
5309 /* Standard damage -- also poisons player */
5312 bool double_resist = IS_OPPOSE_POIS();
5313 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5315 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5316 if (double_resist) dam = (dam + 2) / 3;
5318 if ((!(double_resist || p_ptr->resist_pois)) &&
5319 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5324 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5326 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5328 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5333 /* Standard damage -- also poisons / mutates player */
5336 bool double_resist = IS_OPPOSE_POIS();
5337 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5339 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5340 if (double_resist) dam = (2 * dam + 2) / 5;
5341 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5342 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5344 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5346 if (one_in_(5)) /* 6 */
5348 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5349 if (one_in_(4)) /* 4 */
5357 inven_damage(set_acid_destroy, 2);
5363 /* Standard damage */
5366 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5367 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5371 /* Holy Orb -- Player only takes partial damage */
5374 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5375 if (p_ptr->align > 10)
5377 else if (p_ptr->align < -10)
5379 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5385 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5386 if (p_ptr->align > 10)
5388 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5392 /* Arrow -- XXX no dodging */
5397 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5399 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5401 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5404 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5408 /* Plasma -- XXX No resist */
5411 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5412 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5414 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5416 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5417 (void)set_stun(p_ptr->stun + plus_stun);
5420 if (!(p_ptr->resist_fire ||
5422 p_ptr->immune_fire))
5424 inven_damage(set_acid_destroy, 3);
5430 /* Nether -- drain experience */
5433 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5434 if (p_ptr->resist_neth)
5436 if (!prace_is_(RACE_SPECTRE))
5438 dam *= 6; dam /= (randint1(4) + 7);
5441 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5443 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5445 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5447 learn_spell(monspell);
5451 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5457 /* Water -- stun/confuse */
5460 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5461 if (!CHECK_MULTISHADOW())
5463 if (!p_ptr->resist_sound)
5465 set_stun(p_ptr->stun + randint1(40));
5467 if (!p_ptr->resist_conf)
5469 set_confused(p_ptr->confused + randint1(5) + 5);
5474 inven_damage(set_cold_destroy, 3);
5478 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5482 /* Chaos -- many effects */
5485 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5486 if (p_ptr->resist_chaos)
5488 dam *= 6; dam /= (randint1(4) + 7);
5491 if (!CHECK_MULTISHADOW())
5493 if (!p_ptr->resist_conf)
5495 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5497 if (!p_ptr->resist_chaos)
5499 (void)set_image(p_ptr->image + randint1(10));
5502 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5503 (void)gain_random_mutation(0);
5506 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5508 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5511 if (!p_ptr->resist_chaos || one_in_(9))
5513 inven_damage(set_elec_destroy, 2);
5514 inven_damage(set_fire_destroy, 2);
5518 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5522 /* Shards -- mostly cutting */
5525 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5526 if (p_ptr->resist_shard)
5528 dam *= 6; dam /= (randint1(4) + 7);
5530 else if (!CHECK_MULTISHADOW())
5532 (void)set_cut(p_ptr->cut + dam);
5535 if (!p_ptr->resist_shard || one_in_(13))
5537 inven_damage(set_cold_destroy, 2);
5540 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5544 /* Sound -- mostly stunning */
5547 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5548 if (p_ptr->resist_sound)
5550 dam *= 5; dam /= (randint1(4) + 7);
5552 else if (!CHECK_MULTISHADOW())
5554 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5555 (void)set_stun(p_ptr->stun + plus_stun);
5558 if (!p_ptr->resist_sound || one_in_(13))
5560 inven_damage(set_cold_destroy, 2);
5563 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5567 /* Pure confusion */
5570 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5571 if (p_ptr->resist_conf)
5573 dam *= 5; dam /= (randint1(4) + 7);
5575 else if (!CHECK_MULTISHADOW())
5577 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5579 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5583 /* Disenchantment -- see above */
5586 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5587 if (p_ptr->resist_disen)
5589 dam *= 6; dam /= (randint1(4) + 7);
5591 else if (!CHECK_MULTISHADOW())
5593 (void)apply_disenchant(0);
5595 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5599 /* Nexus -- see above */
5602 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5603 if (p_ptr->resist_nexus)
5605 dam *= 6; dam /= (randint1(4) + 7);
5607 else if (!CHECK_MULTISHADOW())
5611 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5615 /* Force -- mostly stun */
5618 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5619 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5621 (void)set_stun(p_ptr->stun + randint1(20));
5623 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5628 /* Rocket -- stun, cut */
5631 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5632 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5634 (void)set_stun(p_ptr->stun + randint1(20));
5637 if (p_ptr->resist_shard)
5641 else if (!CHECK_MULTISHADOW())
5643 (void)set_cut(p_ptr->cut + (dam / 2));
5646 if (!p_ptr->resist_shard || one_in_(12))
5648 inven_damage(set_cold_destroy, 3);
5651 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5655 /* Inertia -- slowness */
5658 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5659 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5660 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5664 /* Lite -- blinding */
5667 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5668 if (p_ptr->resist_lite)
5670 dam *= 4; dam /= (randint1(4) + 7);
5672 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5674 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5677 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5679 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5682 else if (prace_is_(RACE_S_FAIRY))
5687 if (p_ptr->wraith_form) dam *= 2;
5688 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5690 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5692 p_ptr->wraith_form = 0;
5693 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5694 "The light forces you out of your incorporeal shadow form."));
5696 p_ptr->redraw |= PR_MAP;
5697 /* Update monsters */
5698 p_ptr->update |= (PU_MONSTERS);
5700 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5702 /* Redraw status bar */
5703 p_ptr->redraw |= (PR_STATUS);
5710 /* Dark -- blinding */
5713 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5714 if (p_ptr->resist_dark)
5716 dam *= 4; dam /= (randint1(4) + 7);
5718 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5720 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5722 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5724 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5728 /* Time -- bolt fewer effects XXX */
5731 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5732 if (p_ptr->resist_time)
5735 dam /= (randint1(4) + 7);
5736 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5738 else if (!CHECK_MULTISHADOW())
5740 switch (randint1(10))
5742 case 1: case 2: case 3: case 4: case 5:
5744 if (p_ptr->prace == RACE_ANDROID) break;
5745 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5746 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5750 case 6: case 7: case 8: case 9:
5752 switch (randint1(6))
5754 case 1: k = A_STR; act = _("強く", "strong"); break;
5755 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5756 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5757 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5758 case 5: k = A_CON; act = _("健康で", "hale"); break;
5759 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5762 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5763 "You're not as %s as you used to be..."), act);
5765 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5766 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5767 p_ptr->update |= (PU_BONUS);
5773 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5774 "You're not as powerful as you used to be..."));
5776 for (k = 0; k < 6; k++)
5778 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5779 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5781 p_ptr->update |= (PU_BONUS);
5787 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5791 /* Gravity -- stun plus slowness plus teleport */
5794 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5795 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5797 if (!CHECK_MULTISHADOW())
5799 teleport_player(5, TELEPORT_PASSIVE);
5800 if (!p_ptr->levitation)
5801 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5802 if (!(p_ptr->resist_sound || p_ptr->levitation))
5804 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5805 (void)set_stun(p_ptr->stun + plus_stun);
5808 if (p_ptr->levitation)
5810 dam = (dam * 2) / 3;
5813 if (!p_ptr->levitation || one_in_(13))
5815 inven_damage(set_cold_destroy, 2);
5818 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5822 /* Standard damage */
5823 case GF_DISINTEGRATE:
5825 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5827 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5833 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5835 (void)hp_player(dam);
5842 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5843 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5850 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5851 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5857 if (p_ptr->free_act) break;
5858 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5860 if (ironman_nightmare)
5862 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5863 /* Have some nightmares */
5864 sanity_blast(NULL, FALSE);
5867 set_paralyzed(p_ptr->paralyzed + dam);
5877 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5878 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5885 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5886 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5893 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5895 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5896 if (!p_ptr->resist_shard || one_in_(13))
5898 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5899 inven_damage(set_cold_destroy, 2);
5905 /* Ice -- cold plus stun plus cuts */
5908 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5909 get_damage = cold_dam(dam, killer, monspell, FALSE);
5910 if (!CHECK_MULTISHADOW())
5912 if (!p_ptr->resist_shard)
5914 (void)set_cut(p_ptr->cut + damroll(5, 8));
5916 if (!p_ptr->resist_sound)
5918 (void)set_stun(p_ptr->stun + randint1(15));
5921 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5923 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5933 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5935 if (p_ptr->mimic_form)
5937 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5938 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5943 switch (p_ptr->prace)
5945 /* Some races are immune */
5959 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5971 if (CHECK_MULTISHADOW())
5973 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5975 else if (p_ptr->csp)
5979 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5981 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5984 if (dam >= p_ptr->csp)
5988 p_ptr->csp_frac = 0;
5997 learn_spell(monspell);
6000 p_ptr->redraw |= (PR_MANA);
6003 p_ptr->window |= (PW_PLAYER);
6004 p_ptr->window |= (PW_SPELL);
6008 /* Heal the monster */
6009 if (m_ptr->hp < m_ptr->maxhp)
6013 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6015 /* Redraw (later) if needed */
6016 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6017 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6019 /* Special message */
6022 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6035 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6037 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6038 learn_spell(monspell);
6042 if (!CHECK_MULTISHADOW())
6044 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6046 if (!p_ptr->resist_conf)
6048 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6051 if (!p_ptr->resist_chaos && one_in_(3))
6053 (void)set_image(p_ptr->image + randint0(250) + 150);
6060 p_ptr->csp_frac = 0;
6062 p_ptr->redraw |= PR_MANA;
6065 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6071 case GF_BRAIN_SMASH:
6073 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6075 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6076 learn_spell(monspell);
6080 if (!CHECK_MULTISHADOW())
6082 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6088 p_ptr->csp_frac = 0;
6090 p_ptr->redraw |= PR_MANA;
6093 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6094 if (!CHECK_MULTISHADOW())
6096 if (!p_ptr->resist_blind)
6098 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6100 if (!p_ptr->resist_conf)
6102 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6104 if (!p_ptr->free_act)
6106 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6108 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6110 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6111 (void)do_dec_stat(A_INT);
6112 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6113 (void)do_dec_stat(A_WIS);
6115 if (!p_ptr->resist_chaos)
6117 (void)set_image(p_ptr->image + randint0(250) + 150);
6127 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6129 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6130 learn_spell(monspell);
6134 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6135 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6143 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6145 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6146 learn_spell(monspell);
6150 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6151 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6159 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6161 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6162 learn_spell(monspell);
6166 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6167 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6175 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6177 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6178 learn_spell(monspell);
6182 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6183 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6191 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6193 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6194 learn_spell(monspell);
6198 if (!CHECK_MULTISHADOW())
6200 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6201 curse_equipment(40, 20);
6204 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6206 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6221 /* Hex - revenge damage stored */
6222 revenge_store(get_damage);
6224 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6225 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6227 char m_name_self[80];
6230 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6232 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6233 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6234 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6237 if (p_ptr->riding && dam > 0)
6239 rakubadam_p = (dam > 200) ? 200 : dam;
6247 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6249 (void)kawarimi(FALSE);
6252 /* Return "Anything seen?" */
6258 * Find the distance from (x, y) to a line.
6260 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6262 /* Vector from (x, y) to (x1, y1) */
6263 POSITION py = y1 - y;
6264 POSITION px = x1 - x;
6267 POSITION ny = x2 - x1;
6268 POSITION nx = y1 - y2;
6271 POSITION pd = distance(y1, x1, y, x);
6272 POSITION nd = distance(y1, x1, y2, x2);
6274 if (pd > nd) return distance(y, x, y2, x2);
6276 /* Component of P on N */
6277 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6279 /* Absolute value */
6280 return((nd >= 0) ? nd : 0 - nd);
6287 * Modified version of los() for calculation of disintegration balls.
6288 * Disintegration effects are stopped by permanent walls.
6290 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6310 /* Slope, or 1/Slope, of LOS */
6314 /* Extract the offset */
6318 /* Extract the absolute offset */
6323 /* Handle adjacent (or identical) grids */
6324 if ((ax < 2) && (ay < 2)) return (TRUE);
6327 /* Paranoia -- require "safe" origin */
6328 /* if (!in_bounds(y1, x1)) return (FALSE); */
6331 /* Directly South/North */
6334 /* South -- check for walls */
6337 for (ty = y1 + 1; ty < y2; ty++)
6339 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6343 /* North -- check for walls */
6346 for (ty = y1 - 1; ty > y2; ty--)
6348 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6356 /* Directly East/West */
6359 /* East -- check for walls */
6362 for (tx = x1 + 1; tx < x2; tx++)
6364 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6368 /* West -- check for walls */
6371 for (tx = x1 - 1; tx > x2; tx--)
6373 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6382 /* Extract some signs */
6383 sx = (dx < 0) ? -1 : 1;
6384 sy = (dy < 0) ? -1 : 1;
6387 /* Vertical "knights" */
6392 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6396 /* Horizontal "knights" */
6401 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6406 /* Calculate scale factor div 2 */
6409 /* Calculate scale factor */
6413 /* Travel horizontally */
6416 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6422 /* Consider the special case where slope == 1. */
6433 /* Note (below) the case (qy == f2), where */
6434 /* the LOS exactly meets the corner of a tile. */
6437 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6448 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6461 /* Travel vertically */
6464 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6480 /* Note (below) the case (qx == f2), where */
6481 /* the LOS exactly meets the corner of a tile. */
6484 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6495 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6516 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)
6521 int brev = rad * rad / dist;
6525 int mdis = distance(y1, x1, y2, x2) + rad;
6527 while (bdis <= mdis)
6531 if ((0 < dist) && (path_n < dist))
6533 POSITION ny = GRID_Y(path_g[path_n]);
6534 POSITION nx = GRID_X(path_g[path_n]);
6535 POSITION nd = distance(ny, nx, y1, x1);
6537 /* Get next base point */
6546 /* Travel from center outward */
6547 for (cdis = 0; cdis <= brad; cdis++)
6549 /* Scan the maximal blast area of radius "cdis" */
6550 for (y = by - cdis; y <= by + cdis; y++)
6552 for (x = bx - cdis; x <= bx + cdis; x++)
6554 /* Ignore "illegal" locations */
6555 if (!in_bounds(y, x)) continue;
6557 /* Enforce a circular "ripple" */
6558 if (distance(y1, x1, y, x) != bdis) continue;
6560 /* Enforce an arc */
6561 if (distance(by, bx, y, x) != cdis) continue;
6567 /* Lights are stopped by opaque terrains */
6568 if (!los(by, bx, y, x)) continue;
6570 case GF_DISINTEGRATE:
6571 /* Disintegration are stopped only by perma-walls */
6572 if (!in_disintegration_range(by, bx, y, x)) continue;
6575 /* Ball explosions are stopped by walls */
6576 if (!projectable(by, bx, y, x)) continue;
6580 /* Save this grid */
6588 /* Encode some more "radius" info */
6589 gm[bdis + 1] = *pgrids;
6591 /* Increase the size */
6592 brad = rad * (path_n + brev) / (dist + brev);
6594 /* Find the next ripple */
6598 /* Store the effect size */
6604 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6605 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6606 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6607 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6608 * @param x 目標X座標 / Target x location (or location to travel "towards")
6609 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6610 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6611 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6612 * @param monspell 効果元のモンスター魔法ID
6613 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6616 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6617 * towards a given location (optionally passing over the heads of interposing
6618 * monsters), and have it do a given amount of damage to the monsters (and
6619 * optionally objects) within the given radius of the final location.
6621 * A "bolt" travels from source to target and affects only the target grid.
6622 * A "beam" travels from source to target, affecting all grids passed through.
6623 * A "ball" travels from source to the target, exploding at the target, and
6624 * affecting everything within the given radius of the target location.
6626 * Traditionally, a "bolt" does not affect anything on the ground, and does
6627 * not pass over the heads of interposing monsters, much like a traditional
6628 * missile, and will "stop" abruptly at the "target" even if no monster is
6629 * positioned there, while a "ball", on the other hand, passes over the heads
6630 * of monsters between the source and target, and affects everything except
6631 * the source monster which lies within the final radius, while a "beam"
6632 * affects every monster between the source and target, except for the casting
6633 * monster (or player), and rarely affects things on the ground.
6635 * Two special flags allow us to use this function in special ways, the
6636 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6637 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6638 * actually projecting from the source monster (or player).
6640 * The player will only get "experience" for monsters killed by himself
6641 * Unique monsters can only be destroyed by attacks from the player
6643 * Only 256 grids can be affected per projection, limiting the effective
6644 * "radius" of standard ball attacks to nine units (diameter nineteen).
6646 * One can project in a given "direction" by combining PROJECT_THRU with small
6647 * offsets to the initial location (see "line_spell()"), or by calculating
6648 * "virtual targets" far away from the player.
6650 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6651 * continuing until it actually hits somethings (useful for "stone to mud").
6653 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6655 * Balls must explode BEFORE hitting walls, or they would affect monsters
6656 * on both sides of a wall. Some bug reports indicate that this is still
6657 * happening in 2.7.8 for Windows, though it appears to be impossible.
6659 * We "pre-calculate" the blast area only in part for efficiency.
6660 * More importantly, this lets us do "explosions" from the "inside" out.
6661 * This results in a more logical distribution of "blast" treasure.
6662 * It also produces a better (in my opinion) animation of the explosion.
6663 * It could be (but is not) used to have the treasure dropped by monsters
6664 * in the middle of the explosion fall "outwards", and then be damaged by
6665 * the blast as it spreads outwards towards the treasure drop location.
6667 * Walls and doors are included in the blast area, so that they can be
6668 * "burned" or "melted" in later versions.
6670 * This algorithm is intended to maximize simplicity, not necessarily
6671 * efficiency, since this function is not a bottleneck in the code.
6673 * We apply the blast effect from ground zero outwards, in several passes,
6674 * first affecting features, then objects, then monsters, then the player.
6675 * This allows walls to be removed before checking the object or monster
6676 * in the wall, and protects objects which are dropped by monsters killed
6677 * in the blast, and allows the player to see all affects before he is
6678 * killed or teleported away. The semantics of this method are open to
6679 * various interpretations, but they seem to work well in practice.
6681 * We process the blast area from ground-zero outwards to allow for better
6682 * distribution of treasure dropped by monsters, and because it provides a
6683 * pleasing visual effect at low cost.
6685 * Note that the damage done by "ball" explosions decreases with distance.
6686 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6688 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6689 * the target, and then the damage "flows" along this beam of destruction.
6690 * The damage at every grid is the same as at the "center" of a "ball"
6691 * explosion, since the "beam" grids are treated as if they ARE at the
6692 * center of a "ball" explosion.
6694 * Currently, specifying "beam" plus "ball" means that locations which are
6695 * covered by the initial "beam", and also covered by the final "ball", except
6696 * for the final grid (the epicenter of the ball), will be "hit twice", once
6697 * by the initial beam, and once by the exploding ball. For the grid right
6698 * next to the epicenter, this results in 150% damage being done. The center
6699 * does not have this problem, for the same reason the final grid in a "beam"
6700 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6701 * grids which are covered by the "ball" will NOT work, as then they will
6702 * receive LESS damage than they should. Do not combine "beam" with "ball".
6704 * The array "gy[],gx[]" with current size "grids" is used to hold the
6705 * collected locations of all grids in the "blast area" plus "beam path".
6707 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6708 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6709 * first blast grid (see above) with radius "N" from the blast center. Note
6710 * that only the first gm[1] grids in the blast area thus take full damage.
6711 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6712 * number of blast grids.
6714 * Note that once the projection is complete, (y2,x2) holds the final location
6715 * of bolts/beams, and the "epicenter" of balls.
6717 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6718 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6719 * implementation of the "distance" function. Also, a bolt can be properly
6720 * viewed as a "ball" with a "rad" of "zero".
6722 * Note that if no "target" is reached before the beam/bolt/ball travels the
6723 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6724 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6726 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6727 * to move from point A to point B, even if the player cannot see part of the
6728 * projection path. Note that in general, the player will *always* see part
6729 * of the path, since it either starts at the player or ends on the player.
6731 * Hack -- we assume that every "projection" is "self-illuminating".
6733 * Hack -- when only a single monster is affected, we automatically track
6734 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6736 * Note that all projections now "explode" at their final destination, even
6737 * if they were being projected at a more distant destination. This means
6738 * that "ball" spells will *always* explode.
6740 * Note that we must call "handle_stuff()" after affecting terrain features
6741 * in the blast radius, in case the "illumination" of the grid was changed,
6742 * and "update_view()" and "update_monsters()" need to be called.
6745 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6755 POSITION y_saver, x_saver; /* For reflecting monsters */
6757 int msec = delay_factor * delay_factor * delay_factor;
6759 /* Assume the player sees nothing */
6760 bool notice = FALSE;
6762 /* Assume the player has seen nothing */
6763 bool visual = FALSE;
6765 /* Assume the player has seen no blast grids */
6768 /* Assume to be a normal ball spell */
6769 bool breath = FALSE;
6771 /* Is the player blind? */
6772 bool blind = (p_ptr->blind ? TRUE : FALSE);
6774 bool old_hide = FALSE;
6776 /* Number of grids in the "path" */
6779 /* Actual grids in the "path" */
6782 /* Number of grids in the "blast area" (including the "beam" path) */
6785 /* Coordinates of the affected grids */
6786 POSITION gx[1024], gy[1024];
6788 /* Encoded "radius" info (see above) */
6791 /* Actual radius encoded in gm[] */
6792 POSITION gm_rad = rad;
6796 /* Attacker's name (prepared before polymorph)*/
6799 /* Can the player see the source of this effect? */
6800 bool see_s_msg = TRUE;
6802 /* Initialize by null string */
6808 /* Default target of monsterspell is player */
6809 monster_target_y = p_ptr->y;
6810 monster_target_x = p_ptr->x;
6812 /* Hack -- Jump to target */
6813 if (flg & (PROJECT_JUMP))
6818 /* Clear the flag */
6819 flg &= ~(PROJECT_JUMP);
6824 /* Start at player */
6831 /* Start at monster */
6834 x1 = m_list[who].fx;
6835 y1 = m_list[who].fy;
6836 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6849 /* Default "destination" */
6854 /* Hack -- verify stuff */
6855 if (flg & (PROJECT_THRU))
6857 if ((x1 == x2) && (y1 == y2))
6859 flg &= ~(PROJECT_THRU);
6863 /* Handle a breath attack */
6868 if (flg & PROJECT_HIDE) old_hide = TRUE;
6869 flg |= PROJECT_HIDE;
6873 /* Hack -- Assume there will be no blast (max radius 32) */
6874 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6882 /* Collect beam grids */
6883 if (flg & (PROJECT_BEAM))
6894 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6896 case GF_DISINTEGRATE:
6897 flg |= (PROJECT_GRID);
6898 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6902 /* Calculate the projection path */
6904 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6906 /* Hack -- Handle stuff */
6909 /* Giga-Hack SEEKER & SUPER_RAY */
6911 if( typ == GF_SEEKER )
6921 for (i = 0; i < path_n; ++i)
6926 int ny = GRID_Y(path_g[i]);
6927 int nx = GRID_X(path_g[i]);
6938 /* Only do visuals if requested */
6939 if (!blind && !(flg & (PROJECT_HIDE)))
6941 /* Only do visuals if the player can "see" the bolt */
6942 if (panel_contains(y, x) && player_has_los_bold(y, x))
6949 /* Obtain the bolt pict */
6950 p = bolt_pict(oy, ox, y, x, typ);
6952 /* Extract attr/char */
6956 /* Visual effects */
6957 print_rel(c, a, y, x);
6958 move_cursor_relative(y, x);
6959 /*if (fresh_before)*/ Term_fresh();
6960 Term_xtra(TERM_XTRA_DELAY, msec);
6962 /*if (fresh_before)*/ Term_fresh();
6964 /* Display "beam" grids */
6965 if (flg & (PROJECT_BEAM))
6967 /* Obtain the explosion pict */
6968 p = bolt_pict(y, x, y, x, typ);
6970 /* Extract attr/char */
6974 /* Visual effects */
6975 print_rel(c, a, y, x);
6978 /* Hack -- Activate delay */
6982 /* Hack -- delay anyway for consistency */
6985 /* Delay for consistency */
6986 Term_xtra(TERM_XTRA_DELAY, msec);
6989 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6990 if( is_mirror_grid(&cave[y][x]))
6992 /* The target of monsterspell becomes tha mirror(broken) */
6993 monster_target_y=(s16b)y;
6994 monster_target_x=(s16b)x;
6996 remove_mirror(y, x);
6997 next_mirror(&oy, &ox, y, x);
6999 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7000 for(j = last_i; j <= i; j++)
7002 y = GRID_Y(path_g[j]);
7003 x = GRID_X(path_g[j]);
7004 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7005 if(!who && (project_m_n==1) && !jump ){
7006 if(cave[project_m_y][project_m_x].m_idx >0 ){
7007 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7011 /* Hack -- auto-recall */
7012 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7014 /* Hack - auto-track */
7015 health_track(cave[project_m_y][project_m_x].m_idx);
7019 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7024 for(i = last_i ; i < path_n ; i++)
7027 py = GRID_Y(path_g[i]);
7028 px = GRID_X(path_g[i]);
7029 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7031 if(!who && (project_m_n==1) && !jump ){
7032 if(cave[project_m_y][project_m_x].m_idx > 0)
7034 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7038 /* Hack -- auto-recall */
7039 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7041 /* Hack - auto-track */
7042 health_track(cave[project_m_y][project_m_x].m_idx);
7046 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7050 else if(typ == GF_SUPER_RAY){
7052 int second_step = 0;
7059 for (i = 0; i < path_n; ++i)
7064 int ny = GRID_Y(path_g[i]);
7065 int nx = GRID_X(path_g[i]);
7076 /* Only do visuals if requested */
7077 if (!blind && !(flg & (PROJECT_HIDE)))
7079 /* Only do visuals if the player can "see" the bolt */
7080 if (panel_contains(y, x) && player_has_los_bold(y, x))
7087 /* Obtain the bolt pict */
7088 p = bolt_pict(oy, ox, y, x, typ);
7090 /* Extract attr/char */
7094 /* Visual effects */
7095 print_rel(c, a, y, x);
7096 move_cursor_relative(y, x);
7097 /*if (fresh_before)*/ Term_fresh();
7098 Term_xtra(TERM_XTRA_DELAY, msec);
7100 /*if (fresh_before)*/ Term_fresh();
7102 /* Display "beam" grids */
7103 if (flg & (PROJECT_BEAM))
7105 /* Obtain the explosion pict */
7106 p = bolt_pict(y, x, y, x, typ);
7108 /* Extract attr/char */
7112 /* Visual effects */
7113 print_rel(c, a, y, x);
7116 /* Hack -- Activate delay */
7120 /* Hack -- delay anyway for consistency */
7123 /* Delay for consistency */
7124 Term_xtra(TERM_XTRA_DELAY, msec);
7127 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7128 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7130 if( second_step )continue;
7133 if( is_mirror_grid(&cave[y][x]) && !second_step )
7135 /* The target of monsterspell becomes tha mirror(broken) */
7136 monster_target_y=(s16b)y;
7137 monster_target_x=(s16b)x;
7140 for( j = 0; j <=i ; j++ )
7142 y = GRID_Y(path_g[j]);
7143 x = GRID_X(path_g[j]);
7144 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7148 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7149 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7150 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7151 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7152 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7153 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7154 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7155 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7158 for( i = 0; i < path_n ; i++ )
7161 py = GRID_Y(path_g[i]);
7162 px = GRID_X(path_g[i]);
7163 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7164 if(!who && (project_m_n == 1) && !jump){
7165 if(cave[project_m_y][project_m_x].m_idx >0 ){
7166 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7170 /* Hack -- auto-recall */
7171 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7173 /* Hack - auto-track */
7174 health_track(cave[project_m_y][project_m_x].m_idx);
7178 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7183 /* Project along the path */
7184 for (i = 0; i < path_n; ++i)
7189 int ny = GRID_Y(path_g[i]);
7190 int nx = GRID_X(path_g[i]);
7192 if (flg & PROJECT_DISI)
7194 /* Hack -- Balls explode before reaching walls */
7195 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7197 else if (flg & PROJECT_LOS)
7199 /* Hack -- Balls explode before reaching walls */
7200 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7204 /* Hack -- Balls explode before reaching walls */
7205 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7212 /* Collect beam grids */
7213 if (flg & (PROJECT_BEAM))
7220 /* Only do visuals if requested */
7221 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7223 /* Only do visuals if the player can "see" the bolt */
7224 if (panel_contains(y, x) && player_has_los_bold(y, x))
7231 /* Obtain the bolt pict */
7232 p = bolt_pict(oy, ox, y, x, typ);
7234 /* Extract attr/char */
7238 /* Visual effects */
7239 print_rel(c, a, y, x);
7240 move_cursor_relative(y, x);
7241 /*if (fresh_before)*/ Term_fresh();
7242 Term_xtra(TERM_XTRA_DELAY, msec);
7244 /*if (fresh_before)*/ Term_fresh();
7246 /* Display "beam" grids */
7247 if (flg & (PROJECT_BEAM))
7249 /* Obtain the explosion pict */
7250 p = bolt_pict(y, x, y, x, typ);
7252 /* Extract attr/char */
7256 /* Visual effects */
7257 print_rel(c, a, y, x);
7260 /* Hack -- Activate delay */
7264 /* Hack -- delay anyway for consistency */
7267 /* Delay for consistency */
7268 Term_xtra(TERM_XTRA_DELAY, msec);
7275 /* Save the "blast epicenter" */
7279 if (breath && !path_n)
7285 flg &= ~(PROJECT_HIDE);
7289 /* Start the "explosion" */
7292 /* Hack -- make sure beams get to "explode" */
7300 /* If we found a "target", explode there */
7301 if (dist <= MAX_RANGE)
7303 /* Mega-Hack -- remove the final "beam" grid */
7304 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7307 * Create a conical breath attack
7318 flg &= ~(PROJECT_HIDE);
7320 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7324 /* Determine the blast area, work from the inside out */
7325 for (dist = 0; dist <= rad; dist++)
7327 /* Scan the maximal blast area of radius "dist" */
7328 for (y = by - dist; y <= by + dist; y++)
7330 for (x = bx - dist; x <= bx + dist; x++)
7332 /* Ignore "illegal" locations */
7333 if (!in_bounds2(y, x)) continue;
7335 /* Enforce a "circular" explosion */
7336 if (distance(by, bx, y, x) != dist) continue;
7342 /* Lights are stopped by opaque terrains */
7343 if (!los(by, bx, y, x)) continue;
7345 case GF_DISINTEGRATE:
7346 /* Disintegration are stopped only by perma-walls */
7347 if (!in_disintegration_range(by, bx, y, x)) continue;
7350 /* Ball explosions are stopped by walls */
7351 if (!projectable(by, bx, y, x)) continue;
7355 /* Save this grid */
7362 /* Encode some more "radius" info */
7368 /* Speed -- ignore "non-explosions" */
7369 if (!grids) return (FALSE);
7372 /* Display the "blast area" if requested */
7373 if (!blind && !(flg & (PROJECT_HIDE)))
7375 /* Then do the "blast", from inside out */
7376 for (t = 0; t <= gm_rad; t++)
7378 /* Dump everything with this radius */
7379 for (i = gm[t]; i < gm[t+1]; i++)
7381 /* Extract the location */
7385 /* Only do visuals if the player can "see" the blast */
7386 if (panel_contains(y, x) && player_has_los_bold(y, x))
7395 /* Obtain the explosion pict */
7396 p = bolt_pict(y, x, y, x, typ);
7398 /* Extract attr/char */
7402 /* Visual effects -- Display */
7403 print_rel(c, a, y, x);
7407 /* Hack -- center the cursor */
7408 move_cursor_relative(by, bx);
7410 /* Flush each "radius" seperately */
7411 /*if (fresh_before)*/ Term_fresh();
7413 /* Delay (efficiently) */
7414 if (visual || drawn)
7416 Term_xtra(TERM_XTRA_DELAY, msec);
7420 /* Flush the erasing */
7423 /* Erase the explosion drawn above */
7424 for (i = 0; i < grids; i++)
7426 /* Extract the location */
7430 /* Hack -- Erase if needed */
7431 if (panel_contains(y, x) && player_has_los_bold(y, x))
7437 /* Hack -- center the cursor */
7438 move_cursor_relative(by, bx);
7440 /* Flush the explosion */
7441 /*if (fresh_before)*/ Term_fresh();
7446 /* Update stuff if needed */
7447 if (p_ptr->update) update_stuff();
7450 if (flg & PROJECT_KILL)
7452 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7453 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7457 /* Check features */
7458 if (flg & (PROJECT_GRID))
7460 /* Start with "dist" of zero */
7463 /* Scan for features */
7464 for (i = 0; i < grids; i++)
7466 /* Hack -- Notice new "dist" values */
7467 if (gm[dist+1] == i) dist++;
7469 /* Get the grid location */
7473 /* Find the closest point in the blast */
7476 int d = dist_to_line(y, x, y1, x1, by, bx);
7478 /* Affect the grid */
7479 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7483 /* Affect the grid */
7484 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7489 /* Update stuff if needed */
7490 if (p_ptr->update) update_stuff();
7493 if (flg & (PROJECT_ITEM))
7495 /* Start with "dist" of zero */
7498 /* Scan for objects */
7499 for (i = 0; i < grids; i++)
7501 /* Hack -- Notice new "dist" values */
7502 if (gm[dist+1] == i) dist++;
7504 /* Get the grid location */
7508 /* Find the closest point in the blast */
7511 int d = dist_to_line(y, x, y1, x1, by, bx);
7513 /* Affect the object in the grid */
7514 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7518 /* Affect the object in the grid */
7519 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7525 /* Check monsters */
7526 if (flg & (PROJECT_KILL))
7533 /* Start with "dist" of zero */
7536 /* Scan for monsters */
7537 for (i = 0; i < grids; i++)
7541 /* Hack -- Notice new "dist" values */
7542 if (gm[dist + 1] == i) dist++;
7544 /* Get the grid location */
7548 /* A single bolt may be reflected */
7551 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7552 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7554 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7555 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7556 (!who || dist_hack > 1) && !one_in_(10))
7559 int max_attempts = 10;
7561 /* Choose 'new' target */
7564 t_y = y_saver - 1 + randint1(3);
7565 t_x = x_saver - 1 + randint1(3);
7568 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7570 if (max_attempts < 1)
7576 sound(SOUND_REFLECT);
7579 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7580 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7581 else if (m_ptr->r_idx == MON_DIO)
7582 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7584 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7586 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7588 /* Reflected bolts randomly target either one */
7589 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7590 else flg |= PROJECT_PLAYER;
7592 /* The bolt is reflected */
7593 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7595 /* Don't affect the monster any longer */
7601 /* Find the closest point in the blast */
7604 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7608 effective_dist = dist;
7612 /* There is the riding player on this monster */
7613 if (p_ptr->riding && player_bold(y, x))
7615 /* Aimed on the player */
7616 if (flg & PROJECT_PLAYER)
7618 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7621 * A beam or bolt is well aimed
7623 * So don't affects the mount.
7630 * The spell is not well aimed,
7631 * So partly affect the mount too.
7638 * This grid is the original target.
7639 * Or aimed on your horse.
7641 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7643 /* Hit the mount with full damage */
7647 * Otherwise this grid is not the
7648 * original target, it means that line
7649 * of fire is obstructed by this
7653 * A beam or bolt will hit either
7654 * player or mount. Choose randomly.
7656 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7660 /* Hit the mount with full damage */
7664 /* Hit the player later */
7665 flg |= PROJECT_PLAYER;
7667 /* Don't affect the mount */
7673 * The spell is not well aimed, so
7674 * partly affect both player and
7683 /* Affect the monster in the grid */
7684 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7688 /* Player affected one monster (without "jumping") */
7689 if (!who && (project_m_n == 1) && !jump)
7694 /* Track if possible */
7695 if (cave[y][x].m_idx > 0)
7697 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7701 /* Hack -- auto-recall */
7702 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7704 /* Hack - auto-track */
7705 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7713 if (flg & (PROJECT_KILL))
7715 /* Start with "dist" of zero */
7718 /* Scan for player */
7719 for (i = 0; i < grids; i++)
7723 /* Hack -- Notice new "dist" values */
7724 if (gm[dist+1] == i) dist++;
7726 /* Get the grid location */
7730 /* Affect the player? */
7731 if (!player_bold(y, x)) continue;
7733 /* Find the closest point in the blast */
7736 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7740 effective_dist = dist;
7743 /* Target may be your horse */
7746 /* Aimed on the player */
7747 if (flg & PROJECT_PLAYER)
7749 /* Hit the player with full damage */
7753 * Hack -- When this grid was not the
7754 * original target, a beam or bolt
7755 * would hit either player or mount,
7756 * and should be choosen randomly.
7758 * But already choosen to hit the
7759 * mount at this point.
7761 * Or aimed on your horse.
7763 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7766 * A beam or bolt is well aimed
7768 * So don't affects the player.
7775 * The spell is not well aimed,
7776 * So partly affect the player too.
7782 /* Affect the player */
7783 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7791 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7793 if (rakubadam_m > 0)
7795 if (rakuba(rakubadam_m, FALSE))
7797 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7800 if (p_ptr->riding && rakubadam_p > 0)
7802 if(rakuba(rakubadam_p, FALSE))
7804 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7809 /* Return "something was noticed" */
7814 * @brief 鏡魔法「封魔結界」の効果処理
7816 * @return 効果があったらTRUEを返す
7818 bool binding_field(HIT_POINT dam)
7820 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7821 int mirror_num = 0; /* 鏡の数 */
7823 POSITION centersign;
7824 POSITION x1, x2, y1, y2;
7826 int msec = delay_factor*delay_factor*delay_factor;
7829 POSITION point_x[3];
7830 POSITION point_y[3];
7832 /* Default target of monsterspell is player */
7833 monster_target_y = p_ptr->y;
7834 monster_target_x = p_ptr->x;
7836 for (x = 0; x < cur_wid; x++)
7838 for (y = 0; y < cur_hgt; y++)
7840 if (is_mirror_grid(&cave[y][x]) &&
7841 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7842 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7843 player_has_los_bold(y, x) &&
7844 projectable(p_ptr->y, p_ptr->x, y, x)
7846 mirror_y[mirror_num] = y;
7847 mirror_x[mirror_num] = x;
7853 if (mirror_num < 2)return FALSE;
7855 point_x[0] = randint0(mirror_num);
7857 point_x[1] = randint0(mirror_num);
7858 } while (point_x[0] == point_x[1]);
7860 point_y[0] = mirror_y[point_x[0]];
7861 point_x[0] = mirror_x[point_x[0]];
7862 point_y[1] = mirror_y[point_x[1]];
7863 point_x[1] = mirror_x[point_x[1]];
7864 point_y[2] = p_ptr->y;
7865 point_x[2] = p_ptr->x;
7867 x = point_x[0] + point_x[1] + point_x[2];
7868 y = point_y[0] + point_y[1] + point_y[2];
7870 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7871 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7872 if (centersign == 0)return FALSE;
7874 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7875 x1 = x1 < point_x[2] ? x1 : point_x[2];
7876 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7877 y1 = y1 < point_y[2] ? y1 : point_y[2];
7879 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7880 x2 = x2 > point_x[2] ? x2 : point_x[2];
7881 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7882 y2 = y2 > point_y[2] ? y2 : point_y[2];
7884 for (y = y1; y <= y2; y++) {
7885 for (x = x1; x <= x2; x++) {
7886 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7887 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7888 centersign*((point_x[1] - x)*(point_y[2] - y)
7889 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7890 centersign*((point_x[2] - x)*(point_y[0] - y)
7891 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7893 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7894 /* Visual effects */
7896 && panel_contains(y, x)) {
7897 p = bolt_pict(y, x, y, x, GF_MANA);
7898 print_rel(PICT_C(p), PICT_A(p), y, x);
7899 move_cursor_relative(y, x);
7900 /*if (fresh_before)*/ Term_fresh();
7901 Term_xtra(TERM_XTRA_DELAY, msec);
7907 for (y = y1; y <= y2; y++) {
7908 for (x = x1; x <= x2; x++) {
7909 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7910 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7911 centersign*((point_x[1] - x)*(point_y[2] - y)
7912 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7913 centersign*((point_x[2] - x)*(point_y[0] - y)
7914 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7916 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7917 (void)project_f(0, 0, y, x, dam, GF_MANA);
7922 for (y = y1; y <= y2; y++) {
7923 for (x = x1; x <= x2; x++) {
7924 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7925 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7926 centersign*((point_x[1] - x)*(point_y[2] - y)
7927 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7928 centersign*((point_x[2] - x)*(point_y[0] - y)
7929 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7931 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7932 (void)project_o(0, 0, y, x, dam, GF_MANA);
7937 for (y = y1; y <= y2; y++) {
7938 for (x = x1; x <= x2; x++) {
7939 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7940 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7941 centersign*((point_x[1] - x)*(point_y[2] - y)
7942 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7943 centersign*((point_x[2] - x)*(point_y[0] - y)
7944 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7946 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7947 (void)project_m(0, 0, y, x, dam, GF_MANA,
7948 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7954 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7955 remove_mirror(point_y[0], point_x[0]);
7962 * @brief 鏡魔法「鏡の封印」の効果処理
7964 * @return 効果があったらTRUEを返す
7966 void seal_of_mirror(HIT_POINT dam)
7970 for (x = 0; x < cur_wid; x++)
7972 for (y = 0; y < cur_hgt; y++)
7974 if (is_mirror_grid(&cave[y][x]))
7976 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7977 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7979 if (!cave[y][x].m_idx)
7981 remove_mirror(y, x);