3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
19 #include "monster-hook.h"
22 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
23 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
25 int project_length = 0; /*!< 投射の射程距離 */
29 * @brief モンスター魅了用セービングスロー共通部(汎用系)
31 * @param m_ptr 対象モンスター
32 * @return 魅了に抵抗したらTRUE
34 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
36 monster_race *r_ptr = &r_info[m_ptr->r_idx];
38 if(p_ptr->inside_arena) return TRUE;
41 if (r_ptr->flagsr & RFR_RES_ALL)
43 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
47 if (r_ptr->flags3 & RF3_NO_CONF)
49 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
53 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
55 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
56 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
57 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
61 * @brief モンスター服従用セービングスロー共通部(部族依存系)
63 * @param m_ptr 対象モンスター
64 * @return 服従に抵抗したらTRUE
66 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
68 monster_race *r_ptr = &r_info[m_ptr->r_idx];
70 if (p_ptr->inside_arena) return TRUE;
73 if (r_ptr->flagsr & RFR_RES_ALL)
75 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
79 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
81 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
82 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
83 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
87 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
90 * ハードコーティングによる実装が行われている。
91 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
93 PERCENTAGE beam_chance(void)
95 if (p_ptr->pclass == CLASS_MAGE)
96 return (PERCENTAGE)(p_ptr->lev);
97 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
98 return (PERCENTAGE)(p_ptr->lev + 10);
100 return (PERCENTAGE)(p_ptr->lev / 2);
105 * @brief 配置した鏡リストの次を取得する /
106 * Get another mirror. for SEEKER
107 * @param next_y 次の鏡のy座標を返す参照ポインタ
108 * @param next_x 次の鏡のx座標を返す参照ポインタ
109 * @param cury 現在の鏡のy座標
110 * @param curx 現在の鏡のx座標
112 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
114 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
115 int mirror_num = 0; /* 鏡の数 */
119 for (x = 0; x < cur_wid; x++)
121 for (y = 0; y < cur_hgt; y++)
123 if (is_mirror_grid(&cave[y][x])) {
124 mirror_y[mirror_num] = y;
125 mirror_x[mirror_num] = x;
132 num = randint0(mirror_num);
133 *next_y = mirror_y[num];
134 *next_x = mirror_x[num];
137 *next_y = cury + randint0(5) - 2;
138 *next_x = curx + randint0(5) - 2;
143 * @brief 万色表現用にランダムな色を選択する関数 /
144 * Get a legal "multi-hued" color for drawing "spells"
148 static TERM_COLOR mh_attr(int max)
150 switch (randint1(max))
152 case 1: return (TERM_RED);
153 case 2: return (TERM_GREEN);
154 case 3: return (TERM_BLUE);
155 case 4: return (TERM_YELLOW);
156 case 5: return (TERM_ORANGE);
157 case 6: return (TERM_VIOLET);
158 case 7: return (TERM_L_RED);
159 case 8: return (TERM_L_GREEN);
160 case 9: return (TERM_L_BLUE);
161 case 10: return (TERM_UMBER);
162 case 11: return (TERM_L_UMBER);
163 case 12: return (TERM_SLATE);
164 case 13: return (TERM_WHITE);
165 case 14: return (TERM_L_WHITE);
166 case 15: return (TERM_L_DARK);
174 * @brief 魔法属性に応じたエフェクトの色を返す /
175 * Return a color to use for the bolt/ball spells
179 static TERM_COLOR spell_color(int type)
181 /* Check if A.B.'s new graphics should be used (rr9) */
182 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
187 case GF_PSY_SPEAR: return (0x06);
188 case GF_MISSILE: return (0x0F);
189 case GF_ACID: return (0x04);
190 case GF_ELEC: return (0x02);
191 case GF_FIRE: return (0x00);
192 case GF_COLD: return (0x01);
193 case GF_POIS: return (0x03);
194 case GF_HOLY_FIRE: return (0x00);
195 case GF_HELL_FIRE: return (0x00);
196 case GF_MANA: return (0x0E);
198 case GF_SEEKER: return (0x0E);
199 case GF_SUPER_RAY: return (0x0E);
201 case GF_ARROW: return (0x0F);
202 case GF_WATER: return (0x04);
203 case GF_NETHER: return (0x07);
204 case GF_CHAOS: return (mh_attr(15));
205 case GF_DISENCHANT: return (0x05);
206 case GF_NEXUS: return (0x0C);
207 case GF_CONFUSION: return (mh_attr(4));
208 case GF_SOUND: return (0x09);
209 case GF_SHARDS: return (0x08);
210 case GF_FORCE: return (0x09);
211 case GF_INERTIAL: return (0x09);
212 case GF_GRAVITY: return (0x09);
213 case GF_TIME: return (0x09);
214 case GF_LITE_WEAK: return (0x06);
215 case GF_LITE: return (0x06);
216 case GF_DARK_WEAK: return (0x07);
217 case GF_DARK: return (0x07);
218 case GF_PLASMA: return (0x0B);
219 case GF_METEOR: return (0x00);
220 case GF_ICE: return (0x01);
221 case GF_ROCKET: return (0x0F);
222 case GF_DEATH_RAY: return (0x07);
223 case GF_NUKE: return (mh_attr(2));
224 case GF_DISINTEGRATE: return (0x05);
236 case GF_CAUSE_4: return (0x0E);
237 case GF_HAND_DOOM: return (0x07);
238 case GF_CAPTURE : return (0x0E);
239 case GF_IDENTIFY: return (0x01);
240 case GF_ATTACK: return (0x0F);
241 case GF_PHOTO : return (0x06);
244 /* Normal tiles or ASCII */
250 /* Lookup the default colors for this type */
251 cptr s = quark_str(gf_color[type]);
253 if (!s) return (TERM_WHITE);
255 /* Pick a random color */
256 c = s[randint0(strlen(s))];
258 /* Lookup this color */
259 a = my_strchr(color_char, c) - color_char;
261 /* Invalid color (note check for < 0 removed, gave a silly
262 * warning because bytes are always >= 0 -- RG) */
263 if (a > 15) return (TERM_WHITE);
269 /* Standard "color" */
275 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
276 * Find the attr/char pair to use for a spell effect
285 * It is moving (or has moved) from (x,y) to (nx,ny).
286 * If the distance is not "one", we (may) return "*".
289 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
299 if ((ny == y) && (nx == x)) base = 0x30;
302 else if (nx == x) base = 0x40;
305 else if (ny == y) base = 0x50;
308 else if ((ny - y) == (x - nx)) base = 0x60;
311 else if ((ny - y) == (nx - x)) base = 0x70;
316 /* Basic spell color */
317 k = spell_color(typ);
319 /* Obtain attr/char */
320 a = misc_to_attr[base + k];
321 c = misc_to_char[base + k];
329 * @brief 始点から終点への経路を返す /
330 * Determine the path taken by a projection.
331 * @param gp 経路座標リストを返す参照ポインタ
341 * The projection will always start from the grid (y1,x1), and will travel
342 * towards the grid (y2,x2), touching one grid per unit of distance along
343 * the major axis, and stopping when it enters the destination grid or a
344 * wall grid, or has travelled the maximum legal distance of "range".
346 * Note that "distance" in this function (as in the "update_view()" code)
347 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
348 * actually has an "octagon of projection" not a "circle of projection".
350 * The path grids are saved into the grid array pointed to by "gp", and
351 * there should be room for at least "range" grids in "gp". Note that
352 * due to the way in which distance is calculated, this function normally
353 * uses fewer than "range" grids for the projection path, so the result
354 * of this function should never be compared directly to "range". Note
355 * that the initial grid (y1,x1) is never saved into the grid array, not
356 * even if the initial grid is also the final grid.
358 * The "flg" flags can be used to modify the behavior of this function.
360 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
361 * semantics as they do for the "project" function, namely, that the path
362 * will stop as soon as it hits a monster, or that the path will continue
363 * through the destination grid, respectively.
365 * The "PROJECT_JUMP" flag, which for the "project()" function means to
366 * start at a special grid (which makes no sense in this function), means
367 * that the path should be "angled" slightly if needed to avoid any wall
368 * grids, allowing the player to "target" any grid which is in "view".
369 * This flag is non-trivial and has not yet been implemented, but could
370 * perhaps make use of the "vinfo" array (above).
372 * This function returns the number of grids (if any) in the path. This
373 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
375 * This algorithm is similar to, but slightly different from, the one used
376 * by "update_view_los()", and very different from the one used by "los()".
379 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
401 /* No path necessary (or allowed) */
402 if ((x1 == x2) && (y1 == y2)) return (0);
430 /* Number of "units" in one "half" grid */
433 /* Number of "units" in one "full" grid */
439 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
450 /* Advance (X) part 2 */
453 /* Advance (X) part 3 */
460 /* Create the projection path */
464 gp[n++] = GRID(y, x);
466 /* Hack -- Check maximum range */
467 if ((n + (k >> 1)) >= range) break;
469 /* Sometimes stop at destination grid */
470 if (!(flg & (PROJECT_THRU)))
472 if ((x == x2) && (y == y2)) break;
475 if (flg & (PROJECT_DISI))
477 if ((n > 0) && cave_stop_disintegration(y, x)) break;
479 else if (flg & (PROJECT_LOS))
481 if ((n > 0) && !cave_los_bold(y, x)) break;
483 else if (!(flg & (PROJECT_PATH)))
485 /* Always stop at non-initial wall grids */
486 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
489 /* Sometimes stop at non-initial monsters/players */
490 if (flg & (PROJECT_STOP))
493 (player_bold(y, x) || cave[y][x].m_idx != 0))
497 if (!in_bounds(y, x)) break;
502 /* Advance (X) part 1 */
505 /* Horizontal change */
508 /* Advance (X) part 2 */
511 /* Advance (X) part 3 */
527 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
536 /* Vertical change */
539 /* Advance (Y) part 2 */
542 /* Advance (Y) part 3 */
549 /* Create the projection path */
553 gp[n++] = GRID(y, x);
555 /* Hack -- Check maximum range */
556 if ((n + (k >> 1)) >= range) break;
558 /* Sometimes stop at destination grid */
559 if (!(flg & (PROJECT_THRU)))
561 if ((x == x2) && (y == y2)) break;
564 if (flg & (PROJECT_DISI))
566 if ((n > 0) && cave_stop_disintegration(y, x)) break;
568 else if (flg & (PROJECT_LOS))
570 if ((n > 0) && !cave_los_bold(y, x)) break;
572 else if (!(flg & (PROJECT_PATH)))
574 /* Always stop at non-initial wall grids */
575 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
578 /* Sometimes stop at non-initial monsters/players */
579 if (flg & (PROJECT_STOP))
582 (player_bold(y, x) || cave[y][x].m_idx != 0))
586 if (!in_bounds(y, x)) break;
591 /* Advance (Y) part 1 */
594 /* Vertical change */
597 /* Advance (Y) part 2 */
600 /* Advance (Y) part 3 */
620 /* Create the projection path */
624 gp[n++] = GRID(y, x);
626 /* Hack -- Check maximum range */
627 if ((n + (n >> 1)) >= range) break;
629 /* Sometimes stop at destination grid */
630 if (!(flg & (PROJECT_THRU)))
632 if ((x == x2) && (y == y2)) break;
635 if (flg & (PROJECT_DISI))
637 if ((n > 0) && cave_stop_disintegration(y, x)) break;
639 else if (flg & (PROJECT_LOS))
641 if ((n > 0) && !cave_los_bold(y, x)) break;
643 else if (!(flg & (PROJECT_PATH)))
645 /* Always stop at non-initial wall grids */
646 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
649 /* Sometimes stop at non-initial monsters/players */
650 if (flg & (PROJECT_STOP))
653 (player_bold(y, x) || cave[y][x].m_idx != 0))
657 if (!in_bounds(y, x)) break;
674 * Mega-Hack -- track "affected" monsters (see "project()" comments)
676 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
677 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
678 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
679 /* Mega-Hack -- monsters target */
680 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
681 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
685 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
686 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
687 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
688 * @param y 目標Y座標 / Target y location (or location to travel "towards")
689 * @param x 目標X座標 / Target x location (or location to travel "towards")
690 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
691 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
692 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
695 * We are called both for "beam" effects and "ball" effects.
697 * The "r" parameter is the "distance from ground zero".
699 * Note that we determine if the player can "see" anything that happens
700 * by taking into account: blindness, line-of-sight, and illumination.
702 * We return "TRUE" if the effect of the projection is "obvious".
704 * We also "see" grids which are "memorized", probably a hack
706 * Perhaps we should affect doors?
709 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
711 cave_type *c_ptr = &cave[y][x];
712 feature_type *f_ptr = &f_info[c_ptr->feat];
714 bool obvious = FALSE;
715 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);
864 /* Destroy Doors (and traps) */
867 /* Destroy all doors and traps */
868 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
870 /* Check line of sight */
873 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
877 /* Destroy the feature */
878 cave_alter_feat(y, x, FF_TUNNEL);
881 /* Remove "unsafe" flag if player is not blind */
882 if (!p_ptr->blind && player_has_los_bold(y, x))
884 c_ptr->info &= ~(CAVE_UNSAFE);
892 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
894 if (have_flag(f_ptr->flags, FF_SPIKE))
896 s16b old_mimic = c_ptr->mimic;
897 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
899 cave_alter_feat(y, x, FF_SPIKE);
900 c_ptr->mimic = old_mimic;
905 /* Check line of sight */
906 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
908 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
915 /* Destroy walls (and doors) */
918 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
920 if (known && (c_ptr->info & (CAVE_MARK)))
922 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
926 /* Destroy the wall */
927 cave_alter_feat(y, x, FF_HURT_ROCK);
929 /* Update some things */
930 p_ptr->update |= (PU_FLOW);
939 /* Require a "naked" floor grid */
940 if (!cave_naked_bold(y, x)) break;
942 /* Not on the player */
943 if (player_bold(y, x)) break;
945 /* Create a closed door */
946 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
949 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
966 /* Require a "naked" floor grid */
967 if (!cave_naked_bold(y, x)) break;
969 /* Not on the player */
970 if (player_bold(y, x)) break;
972 /* Create a closed door */
973 cave_set_feat(y, x, feat_tree);
976 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
984 /* Require a "naked" floor grid */
985 if (!cave_naked_bold(y, x)) break;
988 c_ptr->info |= CAVE_OBJECT;
989 c_ptr->mimic = feat_glyph;
1000 /* Require a "naked" floor grid */
1001 if (!cave_naked_bold(y, x)) break;
1003 /* Not on the player */
1004 if (player_bold(y, x)) break;
1007 cave_set_feat(y, x, feat_granite);
1015 /* Ignore permanent grid */
1016 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1021 /* Ignore grid without enough space */
1022 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1024 /* Place a shallow lava */
1025 cave_set_feat(y, x, feat_shallow_lava);
1030 /* Place a deep lava */
1031 cave_set_feat(y, x, feat_deep_lava);
1038 /* Ignore permanent grid */
1039 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1044 /* Ignore grid without enough space */
1045 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1047 /* Place a shallow water */
1048 cave_set_feat(y, x, feat_shallow_water);
1053 /* Place a deep water */
1054 cave_set_feat(y, x, feat_deep_water);
1059 /* Lite up the grid */
1063 /* Turn on the light */
1064 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1066 c_ptr->info |= (CAVE_GLOW);
1069 update_local_illumination(y, x);
1072 if (player_can_see_bold(y, x)) obvious = TRUE;
1074 /* Mega-Hack -- Update the monster in the affected grid */
1075 /* This allows "spear of light" (etc) to work "correctly" */
1076 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1078 if (p_ptr->special_defense & NINJA_S_STEALTH)
1080 if (player_bold(y, x)) set_superstealth(FALSE);
1087 /* Darken the grid */
1091 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1094 /* Turn off the light. */
1097 if (dun_level || !is_daytime())
1099 for (j = 0; j < 9; j++)
1101 int by = y + ddy_ddd[j];
1102 int bx = x + ddx_ddd[j];
1104 if (in_bounds2(by, bx))
1106 cave_type *cc_ptr = &cave[by][bx];
1108 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1116 if (!do_dark) break;
1119 c_ptr->info &= ~(CAVE_GLOW);
1121 /* Hack -- Forget "boring" grids */
1122 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1125 c_ptr->info &= ~(CAVE_MARK);
1132 update_local_illumination(y, x);
1134 if (player_can_see_bold(y, x)) obvious = TRUE;
1136 /* Mega-Hack -- Update the monster in the affected grid */
1137 /* This allows "spear of light" (etc) to work "correctly" */
1138 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1148 if (is_mirror_grid(c_ptr))
1150 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1152 remove_mirror(y, x);
1153 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1156 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1158 if (known && (c_ptr->info & CAVE_MARK))
1160 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1164 /* Destroy the wall */
1165 cave_alter_feat(y, x, FF_HURT_ROCK);
1167 /* Update some things */
1168 p_ptr->update |= (PU_FLOW);
1175 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1177 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1179 remove_mirror(y, x);
1180 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1183 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1185 if (known && (c_ptr->info & CAVE_MARK))
1187 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1191 /* Destroy the wall */
1192 cave_alter_feat(y, x, FF_HURT_ROCK);
1194 /* Update some things */
1195 p_ptr->update |= (PU_FLOW);
1200 case GF_DISINTEGRATE:
1202 /* Destroy mirror/glyph */
1203 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1204 remove_mirror(y, x);
1206 /* Permanent features don't get effect */
1207 /* But not protect monsters and other objects */
1208 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1210 cave_alter_feat(y, x, FF_HURT_DISI);
1212 /* Update some things -- similar to GF_KILL_WALL */
1213 p_ptr->update |= (PU_FLOW);
1220 /* Return "Anything seen?" */
1227 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1228 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1229 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1230 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1231 * @param x 目標X座標 / Target x location (or location to travel "towards")
1232 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1233 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1234 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1237 * We are called from "project()" to "damage" objects
1239 * We are called both for "beam" effects and "ball" effects.
1241 * Perhaps we should only SOMETIMES damage things on the ground.
1243 * The "r" parameter is the "distance from ground zero".
1245 * Note that we determine if the player can "see" anything that happens
1246 * by taking into account: blindness, line-of-sight, and illumination.
1248 * We also "see" grids which are "memorized", probably a hack
1250 * We return "TRUE" if the effect of the projection is "obvious".
1253 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1255 cave_type *c_ptr = &cave[y][x];
1257 OBJECT_IDX this_o_idx, next_o_idx = 0;
1259 bool obvious = FALSE;
1260 bool known = player_has_los_bold(y, x);
1262 BIT_FLAGS flgs[TR_FLAG_SIZE];
1264 char o_name[MAX_NLEN];
1266 KIND_OBJECT_IDX k_idx = 0;
1267 bool is_potion = FALSE;
1270 who = who ? who : 0;
1272 /* Reduce damage by distance */
1273 dam = (dam + r) / (r + 1);
1276 /* Scan all objects in the grid */
1277 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1279 object_type *o_ptr = &o_list[this_o_idx];
1281 bool is_art = FALSE;
1282 bool ignore = FALSE;
1283 bool do_kill = FALSE;
1285 cptr note_kill = NULL;
1288 /* Get the "plural"-ness */
1289 bool plural = (o_ptr->number > 1);
1292 /* Acquire next object */
1293 next_o_idx = o_ptr->next_o_idx;
1295 /* Extract the flags */
1296 object_flags(o_ptr, flgs);
1298 /* Check for artifact */
1299 if (object_is_artifact(o_ptr)) is_art = TRUE;
1301 /* Analyze the type */
1304 /* Acid -- Lots of things */
1307 if (hates_acid(o_ptr))
1310 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1311 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1316 /* Elec -- Rings and Wands */
1319 if (hates_elec(o_ptr))
1322 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1323 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1328 /* Fire -- Flammable objects */
1331 if (hates_fire(o_ptr))
1334 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1335 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1340 /* Cold -- potions and flasks */
1343 if (hates_cold(o_ptr))
1345 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1347 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1355 if (hates_fire(o_ptr))
1358 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1359 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1361 if (hates_elec(o_ptr))
1365 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1366 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1374 if (hates_fire(o_ptr))
1377 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1378 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1380 if (hates_cold(o_ptr))
1384 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1385 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1390 /* Hack -- break potions and such */
1396 if (hates_cold(o_ptr))
1398 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1404 /* Mana and Chaos -- destroy everything */
1410 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1414 case GF_DISINTEGRATE:
1417 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1424 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1425 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1426 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1430 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1434 if (object_is_cursed(o_ptr))
1437 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1444 identify_item(o_ptr);
1446 /* Auto-inscription */
1447 autopick_alter_item((-this_o_idx), FALSE);
1455 /* Chests are noticed only if trapped or locked */
1456 if (o_ptr->tval == TV_CHEST)
1458 /* Disarm/Unlock traps */
1459 if (o_ptr->pval > 0)
1461 /* Disarm or Unlock */
1462 o_ptr->pval = (0 - o_ptr->pval);
1465 object_known(o_ptr);
1467 if (known && (o_ptr->marked & OM_FOUND))
1469 msg_print(_("カチッと音がした!", "Click!"));
1479 if (o_ptr->tval == TV_CORPSE)
1482 BIT_FLAGS mode = 0L;
1484 if (!who || is_pet(&m_list[who]))
1485 mode |= PM_FORCE_PET;
1487 for (i = 0; i < o_ptr->number ; i++)
1489 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1490 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1494 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1498 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1500 note_kill = _("生き返った。", " revived.");
1502 else if (!note_kill)
1504 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1515 /* Attempt to destroy the object */
1518 /* Effect "observed" */
1519 if (known && (o_ptr->marked & OM_FOUND))
1522 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1525 /* Artifacts, and other objects, get to resist */
1526 if (is_art || ignore)
1528 /* Observe the resist */
1529 if (known && (o_ptr->marked & OM_FOUND))
1531 msg_format(_("%sは影響を受けない!",
1532 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1539 /* Describe if needed */
1540 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1542 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1545 k_idx = o_ptr->k_idx;
1546 is_potion = object_is_potion(o_ptr);
1547 delete_object_idx(this_o_idx);
1549 /* Potions produce effects when 'shattered' */
1552 (void)potion_smash_effect(who, y, x, k_idx);
1560 /* Return "Anything seen?" */
1566 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1567 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1568 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1569 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1570 * @param x 目標X座標 / Target x location (or location to travel "towards")
1571 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1572 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1574 * @param see_s_msg TRUEならばメッセージを表示する
1575 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1578 * This routine takes a "source monster" (by index) which is mostly used to
1579 * determine if the player is causing the damage, and a "radius" (see below),
1580 * which is used to decrease the power of explosions with distance, and a
1581 * location, via integers which are modified by certain types of attacks
1582 * (polymorph and teleport being the obvious ones), a default damage, which
1583 * is modified as needed based on various properties, and finally a "damage
1584 * type" (see below).
1587 * Note that this routine can handle "no damage" attacks (like teleport) by
1588 * taking a "zero" damage, and can even take "parameters" to attacks (like
1589 * confuse) by accepting a "damage", using it to calculate the effect, and
1590 * then setting the damage to zero. Note that the "damage" parameter is
1591 * divided by the radius, so monsters not at the "epicenter" will not take
1592 * as much damage (or whatever)...
1595 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1596 * may result in a dereference of an invalid pointer.
1599 * Various messages are produced, and damage is applied.
1602 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1603 * actually be "made" of that substance, or "breathe" big balls of it.
1604 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1606 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1607 * and hurts evil less. If can breath nether, then it resists it as well.
1610 * Damage reductions use the following formulas:
1611 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1612 * gives avg damage of .655, ranging from .858 to .500
1613 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1614 * gives avg damage of .544, ranging from .714 to .417
1615 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1616 * gives avg damage of .444, ranging from .556 to .333
1617 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1618 * gives avg damage of .327, ranging from .427 to .250
1619 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1620 * gives something simple.
1623 * In this function, "result" messages are postponed until the end, where
1624 * the "note" string is appended to the monster name, if not NULL. So,
1625 * to make a spell have "no effect" just set "note" to NULL. You should
1626 * also set "notice" to FALSE, or the player will learn what the spell does.
1629 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1633 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)
1637 cave_type *c_ptr = &cave[y][x];
1639 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1640 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1642 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1646 /* Is the monster "seen"? */
1647 bool seen = m_ptr->ml;
1648 bool seen_msg = is_seen(m_ptr);
1650 bool slept = (bool)MON_CSLEEP(m_ptr);
1652 /* Were the effects "obvious" (if seen)? */
1653 bool obvious = FALSE;
1655 /* Can the player know about this effect? */
1656 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1658 /* Were the effects "irrelevant"? */
1659 bool skipped = FALSE;
1661 /* Gets the monster angry at the source of the effect? */
1662 bool get_angry = FALSE;
1664 /* Polymorph setting (true or false) */
1665 bool do_poly = FALSE;
1667 /* Teleport setting (max distance) */
1670 /* Confusion setting (amount to confuse) */
1673 /* Stunning setting (amount to stun) */
1676 /* Sleep amount (amount to sleep) */
1679 /* Fear amount (amount to fear) */
1682 /* Time amount (amount to time) */
1685 bool heal_leper = FALSE;
1687 /* Hold the monster name */
1691 PARAMETER_VALUE photo = 0;
1693 /* Assume no note */
1696 /* Assume a default death */
1697 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1702 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1705 if (!c_ptr->m_idx) return (FALSE);
1707 /* Never affect projector */
1708 if (who && (c_ptr->m_idx == who)) return (FALSE);
1709 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1710 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1712 /* Don't affect already death monsters */
1713 /* Prevents problems with chain reactions of exploding monsters */
1714 if (m_ptr->hp < 0) return (FALSE);
1716 /* Reduce damage by distance */
1717 dam = (dam + r) / (r + 1);
1720 /* Get the monster name (BEFORE polymorphing) */
1721 monster_desc(m_name, m_ptr, 0);
1723 /* Get the monster possessive ("his"/"her"/"its") */
1724 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1726 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1728 /* Analyze the damage type */
1731 /* Magic Missile -- pure damage */
1734 if (seen) obvious = TRUE;
1736 if (r_ptr->flagsr & RFR_RES_ALL)
1738 note = _("には完全な耐性がある!", " is immune.");
1740 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1749 if (seen) obvious = TRUE;
1751 if (r_ptr->flagsr & RFR_RES_ALL)
1753 note = _("には完全な耐性がある!", " is immune.");
1755 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1758 if (r_ptr->flagsr & RFR_IM_ACID)
1760 note = _("にはかなり耐性がある!", " resists a lot.");
1762 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1770 if (seen) obvious = TRUE;
1772 if (r_ptr->flagsr & RFR_RES_ALL)
1774 note = _("には完全な耐性がある!", " is immune.");
1776 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1779 if (r_ptr->flagsr & RFR_IM_ELEC)
1781 note = _("にはかなり耐性がある!", " resists a lot.");
1783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1791 if (seen) obvious = TRUE;
1793 if (r_ptr->flagsr & RFR_RES_ALL)
1795 note = _("には完全な耐性がある!", " is immune.");
1797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1800 if (r_ptr->flagsr & RFR_IM_FIRE)
1802 note = _("にはかなり耐性がある!", " resists a lot.");
1804 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1806 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1808 note = _("はひどい痛手をうけた。", " is hit hard.");
1810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
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_COLD)
1829 note = _("にはかなり耐性がある!", " resists a lot.");
1831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1833 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1835 note = _("はひどい痛手をうけた。", " is hit hard.");
1837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
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_POIS)
1856 note = _("にはかなり耐性がある!", " resists a lot.");
1858 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1866 if (seen) obvious = TRUE;
1868 if (r_ptr->flagsr & RFR_RES_ALL)
1870 note = _("には完全な耐性がある!", " is immune.");
1872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1875 if (r_ptr->flagsr & RFR_IM_POIS)
1877 note = _("には耐性がある。", " resists.");
1878 dam *= 3; dam /= randint1(6) + 6;
1879 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1881 else if (one_in_(3)) do_poly = TRUE;
1885 /* Hellfire -- hurts Evil */
1888 if (seen) obvious = TRUE;
1890 if (r_ptr->flagsr & RFR_RES_ALL)
1892 note = _("には完全な耐性がある!", " is immune.");
1894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1897 if (r_ptr->flags3 & RF3_GOOD)
1899 note = _("はひどい痛手をうけた。", " is hit hard.");
1901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1906 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1909 if (seen) obvious = TRUE;
1911 if (r_ptr->flagsr & RFR_RES_ALL)
1913 note = _("には完全な耐性がある!", " is immune.");
1915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1918 if (r_ptr->flags3 & RF3_GOOD)
1920 note = _("には完全な耐性がある!", " is immune.");
1922 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1924 else if (r_ptr->flags3 & RF3_EVIL)
1927 note = _("はひどい痛手をうけた。", " is hit hard.");
1928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1932 note = _("には耐性がある。", " resists.");
1933 dam *= 3; dam /= randint1(6) + 6;
1938 /* Arrow -- XXX no defense */
1941 if (seen) obvious = TRUE;
1943 if (r_ptr->flagsr & RFR_RES_ALL)
1945 note = _("には完全な耐性がある!", " is immune.");
1947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1953 /* Plasma -- XXX perhaps check ELEC or FIRE */
1956 if (seen) obvious = TRUE;
1958 if (r_ptr->flagsr & RFR_RES_ALL)
1960 note = _("には完全な耐性がある!", " is immune.");
1962 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1965 if (r_ptr->flagsr & RFR_RES_PLAS)
1967 note = _("には耐性がある。", " resists.");
1968 dam *= 3; dam /= randint1(6) + 6;
1969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1974 /* Nether -- see above */
1977 if (seen) obvious = TRUE;
1979 if (r_ptr->flagsr & RFR_RES_ALL)
1981 note = _("には完全な耐性がある!", " is immune.");
1983 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1986 if (r_ptr->flagsr & RFR_RES_NETH)
1988 if (r_ptr->flags3 & RF3_UNDEAD)
1990 note = _("には完全な耐性がある!", " is immune.");
1992 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1996 note = _("には耐性がある。", " resists.");
1997 dam *= 3; dam /= randint1(6) + 6;
1999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2001 else if (r_ptr->flags3 & RF3_EVIL)
2003 note = _("はいくらか耐性を示した。", " resists somewhat.");
2005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2010 /* Water (acid) damage -- Water spirits/elementals are immune */
2013 if (seen) obvious = TRUE;
2015 if (r_ptr->flagsr & RFR_RES_ALL)
2017 note = _("には完全な耐性がある!", " is immune.");
2019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2022 if (r_ptr->flagsr & RFR_RES_WATE)
2024 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2026 note = _("には完全な耐性がある!", " is immune.");
2031 note = _("には耐性がある。", " resists.");
2032 dam *= 3; dam /= randint1(6) + 6;
2034 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2039 /* Chaos -- Chaos breathers resist */
2042 if (seen) obvious = TRUE;
2044 if (r_ptr->flagsr & RFR_RES_ALL)
2046 note = _("には完全な耐性がある!", " is immune.");
2048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2051 if (r_ptr->flagsr & RFR_RES_CHAO)
2053 note = _("には耐性がある。", " resists.");
2054 dam *= 3; dam /= randint1(6) + 6;
2055 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2057 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2059 note = _("はいくらか耐性を示した。", " resists somewhat.");
2060 dam *= 3; dam /= randint1(6) + 6;
2061 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2066 do_conf = (5 + randint1(11) + r) / (r + 1);
2071 /* Shards -- Shard breathers resist */
2074 if (seen) obvious = TRUE;
2076 if (r_ptr->flagsr & RFR_RES_ALL)
2078 note = _("には完全な耐性がある!", " is immune.");
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2083 if (r_ptr->flagsr & RFR_RES_SHAR)
2085 note = _("には耐性がある。", " resists.");
2086 dam *= 3; dam /= randint1(6) + 6;
2087 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2092 /* Rocket: Shard resistance helps */
2095 if (seen) obvious = TRUE;
2097 if (r_ptr->flagsr & RFR_RES_ALL)
2099 note = _("には完全な耐性がある!", " is immune.");
2101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2104 if (r_ptr->flagsr & RFR_RES_SHAR)
2106 note = _("はいくらか耐性を示した。", " resists somewhat.");
2108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2114 /* Sound -- Sound breathers resist */
2117 if (seen) obvious = TRUE;
2119 if (r_ptr->flagsr & RFR_RES_ALL)
2121 note = _("には完全な耐性がある!", " is immune.");
2123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2126 if (r_ptr->flagsr & RFR_RES_SOUN)
2128 note = _("には耐性がある。", " resists.");
2129 dam *= 2; dam /= randint1(6) + 6;
2130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2132 else do_stun = (10 + randint1(15) + r) / (r + 1);
2139 if (seen) obvious = TRUE;
2141 if (r_ptr->flagsr & RFR_RES_ALL)
2143 note = _("には完全な耐性がある!", " is immune.");
2145 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2148 if (r_ptr->flags3 & RF3_NO_CONF)
2150 note = _("には耐性がある。", " resists.");
2151 dam *= 3; dam /= randint1(6) + 6;
2152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2154 else do_conf = (10 + randint1(15) + r) / (r + 1);
2158 /* Disenchantment -- Breathers and Disenchanters resist */
2161 if (seen) obvious = TRUE;
2163 if (r_ptr->flagsr & RFR_RES_ALL)
2165 note = _("には完全な耐性がある!", " is immune.");
2167 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2170 if (r_ptr->flagsr & RFR_RES_DISE)
2172 note = _("には耐性がある。", " resists.");
2173 dam *= 3; dam /= randint1(6) + 6;
2174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2179 /* Nexus -- Breathers and Existers resist */
2182 if (seen) obvious = TRUE;
2184 if (r_ptr->flagsr & RFR_RES_ALL)
2186 note = _("には完全な耐性がある!", " is immune.");
2188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2191 if (r_ptr->flagsr & RFR_RES_NEXU)
2193 note = _("には耐性がある。", " resists.");
2194 dam *= 3; dam /= randint1(6) + 6;
2195 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2203 if (seen) obvious = TRUE;
2205 if (r_ptr->flagsr & RFR_RES_ALL)
2207 note = _("には完全な耐性がある!", " is immune.");
2209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2212 if (r_ptr->flagsr & RFR_RES_WALL)
2214 note = _("には耐性がある。", " resists.");
2215 dam *= 3; dam /= randint1(6) + 6;
2216 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2218 else do_stun = (randint1(15) + r) / (r + 1);
2222 /* Inertia -- breathers resist */
2225 if (seen) obvious = TRUE;
2227 if (r_ptr->flagsr & RFR_RES_ALL)
2229 note = _("には完全な耐性がある!", " is immune.");
2231 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2234 if (r_ptr->flagsr & RFR_RES_INER)
2236 note = _("には耐性がある。", " resists.");
2237 dam *= 3; dam /= randint1(6) + 6;
2238 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2242 /* Powerful monsters can resist */
2243 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2244 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2248 /* Normal monsters slow down */
2251 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2253 note = _("の動きが遅くなった。", " starts moving slower.");
2260 /* Time -- breathers resist */
2263 if (seen) obvious = TRUE;
2265 if (r_ptr->flagsr & RFR_RES_ALL)
2267 note = _("には完全な耐性がある!", " is immune.");
2269 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2272 if (r_ptr->flagsr & RFR_RES_TIME)
2274 note = _("には耐性がある。", " resists.");
2275 dam *= 3; dam /= randint1(6) + 6;
2276 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2278 else do_time = (dam + 1) / 2;
2282 /* Gravity -- breathers resist */
2285 bool resist_tele = FALSE;
2287 if (seen) obvious = TRUE;
2289 if (r_ptr->flagsr & RFR_RES_ALL)
2291 note = _("には完全な耐性がある!", " is immune.");
2293 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2296 if (r_ptr->flagsr & RFR_RES_TELE)
2298 if (r_ptr->flags1 & (RF1_UNIQUE))
2300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2301 note = _("には効果がなかった。", " is unaffected!");
2304 else if (r_ptr->level > randint1(100))
2306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2307 note = _("には耐性がある!", " resists!");
2312 if (!resist_tele) do_dist = 10;
2314 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2316 if (r_ptr->flagsr & RFR_RES_GRAV)
2318 note = _("には耐性がある!", " resists!");
2319 dam *= 3; dam /= randint1(6) + 6;
2321 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2326 /* Powerful monsters can resist */
2327 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2328 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2332 /* Normal monsters slow down */
2335 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2337 note = _("の動きが遅くなった。", " starts moving slower.");
2342 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2344 /* Attempt a saving throw */
2345 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2346 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2350 /* No obvious effect */
2351 note = _("には効果がなかった。", " is unaffected!");
2363 if (seen) obvious = TRUE;
2365 if (r_ptr->flagsr & RFR_RES_ALL)
2367 note = _("には完全な耐性がある!", " is immune.");
2369 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2377 case GF_DISINTEGRATE:
2379 if (seen) obvious = TRUE;
2381 if (r_ptr->flagsr & RFR_RES_ALL)
2383 note = _("には完全な耐性がある!", " is immune.");
2385 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2388 if (r_ptr->flags3 & RF3_HURT_ROCK)
2390 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2391 note = _("の皮膚がただれた!", " loses some skin!");
2392 note_dies = _("は蒸発した!", " evaporates!");
2400 if (seen) obvious = TRUE;
2402 /* PSI only works if the monster can see you! -- RG */
2403 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2406 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2411 if (r_ptr->flagsr & RFR_RES_ALL)
2413 note = _("には完全な耐性がある!", " is immune.");
2415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2418 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2421 note = _("には完全な耐性がある!", " is immune.");
2422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2425 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2426 (r_ptr->flags3 & RF3_ANIMAL) ||
2427 (r_ptr->level > randint1(3 * dam)))
2429 note = _("には耐性がある!", " resists!");
2433 * Powerful demons & undead can turn a mindcrafter's
2434 * attacks back on them
2436 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2437 (r_ptr->level > p_ptr->lev / 2) &&
2441 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2442 (seen ? "%^s's corrupted mind backlashes your attack!" :
2443 "%^ss corrupted mind backlashes your attack!")), m_name);
2446 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2448 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2452 /* Injure +/- confusion */
2453 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2454 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2455 if (one_in_(4) && !CHECK_MULTISHADOW())
2457 switch (randint1(4))
2460 set_confused(p_ptr->confused + 3 + randint1(dam));
2463 set_stun(p_ptr->stun + randint1(dam));
2467 if (r_ptr->flags3 & RF3_NO_FEAR)
2468 note = _("には効果がなかった。", " is unaffected.");
2470 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2474 if (!p_ptr->free_act)
2475 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2484 if ((dam > 0) && one_in_(4))
2486 switch (randint1(4))
2489 do_conf = 3 + randint1(dam);
2492 do_stun = 3 + randint1(dam);
2495 do_fear = 3 + randint1(dam);
2498 note = _("は眠り込んでしまった!", " falls asleep!");
2499 do_sleep = 3 + randint1(dam);
2504 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2510 if (seen) obvious = TRUE;
2512 if (r_ptr->flagsr & RFR_RES_ALL)
2514 note = _("には完全な耐性がある!", " is immune.");
2516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2519 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2522 note = _("には完全な耐性がある!", " is immune.");
2524 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2525 (r_ptr->flags3 & RF3_ANIMAL) ||
2526 (r_ptr->level > randint1(3 * dam)))
2528 note = _("には耐性がある!", " resists!");
2532 * Powerful demons & undead can turn a mindcrafter's
2533 * attacks back on them
2535 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2536 (r_ptr->level > p_ptr->lev / 2) &&
2540 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2541 (seen ? "%^s's corrupted mind backlashes your attack!" :
2542 "%^ss corrupted mind backlashes your attack!")), m_name);
2544 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2546 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2550 /* Injure + mana drain */
2551 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2552 if (!CHECK_MULTISHADOW())
2554 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2555 p_ptr->csp -= damroll(5, dam) / 2;
2556 if (p_ptr->csp < 0) p_ptr->csp = 0;
2557 p_ptr->redraw |= PR_MANA;
2558 p_ptr->window |= (PW_SPELL);
2560 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2567 int b = damroll(5, dam) / 4;
2568 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2569 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2570 (seen ? "You convert %s's pain into %s!" :
2571 "You convert %ss pain into %s!"));
2572 msg_format(msg, m_name, str);
2574 b = MIN(p_ptr->msp, p_ptr->csp + b);
2576 p_ptr->redraw |= PR_MANA;
2577 p_ptr->window |= (PW_SPELL);
2579 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2583 case GF_TELEKINESIS:
2585 if (seen) obvious = TRUE;
2587 if (r_ptr->flagsr & RFR_RES_ALL)
2589 note = _("には完全な耐性がある!", " is immune.");
2591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2596 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2601 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2603 /* Attempt a saving throw */
2604 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2605 (r_ptr->level > 5 + randint1(dam)))
2609 /* No obvious effect */
2615 /* Psycho-spear -- powerful magic missile */
2618 if (seen) obvious = TRUE;
2620 if (r_ptr->flagsr & RFR_RES_ALL)
2622 note = _("には完全な耐性がある!", " is immune.");
2624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2630 /* Meteor -- powerful magic missile */
2633 if (seen) obvious = TRUE;
2635 if (r_ptr->flagsr & RFR_RES_ALL)
2637 note = _("には完全な耐性がある!", " is immune.");
2639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2647 if (!is_hostile(m_ptr)) break;
2649 if (seen) obvious = TRUE;
2651 if (r_ptr->flagsr & RFR_RES_ALL)
2653 note = _("には効果がなかった!", " is immune.");
2655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2658 /* Attempt a saving throw */
2659 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2660 (r_ptr->flags3 & RF3_NO_CONF) ||
2661 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2663 /* Memorize a flag */
2664 if (r_ptr->flags3 & RF3_NO_CONF)
2666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2673 * Powerful demons & undead can turn a mindcrafter's
2674 * attacks back on them
2676 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2677 (r_ptr->level > p_ptr->lev / 2) &&
2681 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2682 (seen ? "%^s's corrupted mind backlashes your attack!" :
2683 "%^ss corrupted mind backlashes your attack!")), m_name);
2686 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2688 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2692 /* Confuse, stun, terrify */
2693 switch (randint1(4))
2696 set_stun(p_ptr->stun + dam / 2);
2699 set_confused(p_ptr->confused + dam / 2);
2703 if (r_ptr->flags3 & RF3_NO_FEAR)
2704 note = _("には効果がなかった。", " is unaffected.");
2706 set_afraid(p_ptr->afraid + dam);
2713 /* No obvious effect */
2714 note = _("には効果がなかった。", " is unaffected.");
2720 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2722 note = _("があなたに隷属した。", " is in your thrall!");
2727 switch (randint1(4))
2741 /* No "real" damage */
2748 /* Ice -- Cold + Cuts + Stun */
2751 if (seen) obvious = TRUE;
2753 if (r_ptr->flagsr & RFR_RES_ALL)
2755 note = _("には完全な耐性がある!", " is immune.");
2757 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2760 do_stun = (randint1(15) + 1) / (r + 1);
2761 if (r_ptr->flagsr & RFR_IM_COLD)
2763 note = _("にはかなり耐性がある!", " resists a lot.");
2765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2767 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2769 note = _("はひどい痛手をうけた。", " is hit hard.");
2771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2778 case GF_HYPODYNAMIA:
2780 if (seen) obvious = TRUE;
2782 if (r_ptr->flagsr & RFR_RES_ALL)
2784 note = _("には完全な耐性がある!", " is immune.");
2786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2789 if (!monster_living(r_ptr))
2791 if (is_original_ap_and_seen(m_ptr))
2793 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2794 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2795 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2797 note = _("には効果がなかった。", " is unaffected.");
2801 else do_time = (dam+7)/8;
2809 if (seen) obvious = TRUE;
2811 if (r_ptr->flagsr & RFR_RES_ALL)
2813 note = _("には完全な耐性がある!", " is immune.");
2815 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2818 if (!monster_living(r_ptr))
2820 if (is_original_ap_and_seen(m_ptr))
2822 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2823 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2824 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2826 note = _("には完全な耐性がある!", " is immune.");
2830 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2831 (randint1(888) != 666)) ||
2832 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2833 randint1(100) != 66))
2835 note = _("には耐性がある!", " resists!");
2843 /* Polymorph monster (Use "dam" as "power") */
2846 if (seen) obvious = TRUE;
2848 if (r_ptr->flagsr & RFR_RES_ALL)
2850 note = _("には効果がなかった。", " is unaffected.");
2852 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2855 /* Attempt to polymorph (see below) */
2858 /* Powerful monsters can resist */
2859 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2860 (r_ptr->flags1 & RF1_QUESTOR) ||
2861 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2863 note = _("には効果がなかった。", " is unaffected.");
2868 /* No "real" damage */
2875 /* Clone monsters (Ignore "dam") */
2878 if (seen) obvious = TRUE;
2880 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2882 note = _("には効果がなかった。", " is unaffected.");
2887 m_ptr->hp = m_ptr->maxhp;
2889 /* Attempt to clone. */
2890 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2892 note = _("が分裂した!", " spawns!");
2896 /* No "real" damage */
2903 /* Heal Monster (use "dam" as amount of healing) */
2906 if (seen) obvious = TRUE;
2909 (void)set_monster_csleep(c_ptr->m_idx, 0);
2911 if (m_ptr->maxhp < m_ptr->max_maxhp)
2913 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2914 m_ptr->maxhp = m_ptr->max_maxhp;
2919 /* Redraw (later) if needed */
2920 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2921 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2929 if (seen) obvious = TRUE;
2932 (void)set_monster_csleep(c_ptr->m_idx, 0);
2933 if (MON_STUNNED(m_ptr))
2935 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2936 (void)set_monster_stunned(c_ptr->m_idx, 0);
2938 if (MON_CONFUSED(m_ptr))
2940 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2941 (void)set_monster_confused(c_ptr->m_idx, 0);
2943 if (MON_MONFEAR(m_ptr))
2945 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2946 (void)set_monster_monfear(c_ptr->m_idx, 0);
2950 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2953 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2957 chg_virtue(V_VITALITY, 1);
2959 if (r_ptr->flags1 & RF1_UNIQUE)
2960 chg_virtue(V_INDIVIDUALISM, 1);
2962 if (is_friendly(m_ptr))
2963 chg_virtue(V_HONOUR, 1);
2964 else if (!(r_ptr->flags3 & RF3_EVIL))
2966 if (r_ptr->flags3 & RF3_GOOD)
2967 chg_virtue(V_COMPASSION, 2);
2969 chg_virtue(V_COMPASSION, 1);
2972 if (r_ptr->flags3 & RF3_ANIMAL)
2973 chg_virtue(V_NATURE, 1);
2976 if (m_ptr->r_idx == MON_LEPER)
2979 if (!who) chg_virtue(V_COMPASSION, 5);
2982 /* Redraw (later) if needed */
2983 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2984 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2986 note = _("は体力を回復したようだ。", " looks healthier.");
2988 /* No "real" damage */
2994 /* Speed Monster (Ignore "dam") */
2997 if (seen) obvious = TRUE;
3000 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3002 note = _("の動きが速くなった。", " starts moving faster.");
3007 if (r_ptr->flags1 & RF1_UNIQUE)
3008 chg_virtue(V_INDIVIDUALISM, 1);
3009 if (is_friendly(m_ptr))
3010 chg_virtue(V_HONOUR, 1);
3013 /* No "real" damage */
3019 /* Slow Monster (Use "dam" as "power") */
3022 if (seen) obvious = TRUE;
3024 if (r_ptr->flagsr & RFR_RES_ALL)
3026 note = _("には効果がなかった。", " is unaffected.");
3028 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3031 /* Powerful monsters can resist */
3032 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3033 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3035 note = _("には効果がなかった。", " is unaffected.");
3039 /* Normal monsters slow down */
3042 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3044 note = _("の動きが遅くなった。", " starts moving slower.");
3048 /* No "real" damage */
3054 /* Sleep (Use "dam" as "power") */
3057 if (seen) obvious = TRUE;
3059 if (r_ptr->flagsr & RFR_RES_ALL)
3061 note = _("には効果がなかった。", " is unaffected.");
3063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3066 /* Attempt a saving throw */
3067 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3068 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3069 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3071 /* Memorize a flag */
3072 if (r_ptr->flags3 & RF3_NO_SLEEP)
3074 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3076 /* No obvious effect */
3077 note = _("には効果がなかった。", " is unaffected.");
3082 /* Go to sleep (much) later */
3083 note = _("は眠り込んでしまった!", " falls asleep!");
3087 /* No "real" damage */
3093 /* Sleep (Use "dam" as "power") */
3094 case GF_STASIS_EVIL:
3096 if (seen) obvious = TRUE;
3098 if (r_ptr->flagsr & RFR_RES_ALL)
3100 note = _("には効果がなかった!", " is immune.");
3102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3105 /* Attempt a saving throw */
3106 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3107 !(r_ptr->flags3 & RF3_EVIL) ||
3108 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3110 note = _("には効果がなかった。", " is unaffected.");
3115 /* Go to sleep (much) later */
3116 note = _("は動けなくなった!", " is suspended!");
3120 /* No "real" damage */
3125 /* Sleep (Use "dam" as "power") */
3128 if (seen) obvious = TRUE;
3130 if (r_ptr->flagsr & RFR_RES_ALL)
3132 note = _("には効果がなかった。", " is unaffected.");
3134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3137 /* Attempt a saving throw */
3138 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3139 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3141 note = _("には効果がなかった。", " is unaffected.");
3146 /* Go to sleep (much) later */
3147 note = _("は動けなくなった!", " is suspended!");
3151 /* No "real" damage */
3160 vir = virtue_number(V_HARMONY);
3163 dam += p_ptr->virtues[vir-1]/10;
3166 vir = virtue_number(V_INDIVIDUALISM);
3169 dam -= p_ptr->virtues[vir-1]/20;
3172 if (seen) obvious = TRUE;
3174 /* Attempt a saving throw */
3175 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3179 /* No obvious effect */
3180 note = _("には効果がなかった。", " is unaffected.");
3183 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3185 else if (p_ptr->cursed & TRC_AGGRAVATE)
3187 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3188 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3192 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3195 chg_virtue(V_INDIVIDUALISM, -1);
3196 if (r_ptr->flags3 & RF3_ANIMAL)
3197 chg_virtue(V_NATURE, 1);
3200 /* No "real" damage */
3205 /* Control undead */
3206 case GF_CONTROL_UNDEAD:
3209 if (seen) obvious = TRUE;
3211 vir = virtue_number(V_UNLIFE);
3214 dam += p_ptr->virtues[vir-1]/10;
3217 vir = virtue_number(V_INDIVIDUALISM);
3220 dam -= p_ptr->virtues[vir-1]/20;
3223 /* Attempt a saving throw */
3224 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3225 !(r_ptr->flags3 & RF3_UNDEAD))
3227 /* No obvious effect */
3228 note = _("には効果がなかった。", " is unaffected.");
3230 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3232 else if (p_ptr->cursed & TRC_AGGRAVATE)
3234 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3235 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3239 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3243 /* No "real" damage */
3249 case GF_CONTROL_DEMON:
3252 if (seen) obvious = TRUE;
3254 vir = virtue_number(V_UNLIFE);
3257 dam += p_ptr->virtues[vir-1]/10;
3260 vir = virtue_number(V_INDIVIDUALISM);
3263 dam -= p_ptr->virtues[vir-1]/20;
3266 /* Attempt a saving throw */
3267 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3268 !(r_ptr->flags3 & RF3_DEMON))
3270 /* No obvious effect */
3271 note = _("には効果がなかった。", " is unaffected.");
3273 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3275 else if (p_ptr->cursed & TRC_AGGRAVATE)
3277 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3278 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3282 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3286 /* No "real" damage */
3292 case GF_CONTROL_ANIMAL:
3295 if (seen) obvious = TRUE;
3297 vir = virtue_number(V_NATURE);
3300 dam += p_ptr->virtues[vir-1]/10;
3303 vir = virtue_number(V_INDIVIDUALISM);
3306 dam -= p_ptr->virtues[vir-1]/20;
3309 /* Attempt a saving throw */
3310 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3311 !(r_ptr->flags3 & RF3_ANIMAL))
3314 /* No obvious effect */
3315 note = _("には効果がなかった。", " is unaffected.");
3317 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3319 else if (p_ptr->cursed & TRC_AGGRAVATE)
3321 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3322 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3326 note = _("はなついた。", " is tamed!");
3328 if (r_ptr->flags3 & RF3_ANIMAL)
3329 chg_virtue(V_NATURE, 1);
3332 /* No "real" damage */
3338 case GF_CHARM_LIVING:
3342 vir = virtue_number(V_UNLIFE);
3343 if (seen) obvious = TRUE;
3345 vir = virtue_number(V_UNLIFE);
3348 dam -= p_ptr->virtues[vir-1]/10;
3351 vir = virtue_number(V_INDIVIDUALISM);
3354 dam -= p_ptr->virtues[vir-1]/20;
3357 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3359 /* Attempt a saving throw */
3360 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3361 !monster_living(r_ptr))
3364 /* No obvious effect */
3365 note = _("には効果がなかった。", " is unaffected.");
3367 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3369 else if (p_ptr->cursed & TRC_AGGRAVATE)
3371 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3372 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3376 note = _("を支配した。", " is tamed!");
3378 if (r_ptr->flags3 & RF3_ANIMAL)
3379 chg_virtue(V_NATURE, 1);
3382 /* No "real" damage */
3387 /* Confusion (Use "dam" as "power") */
3390 if (seen) obvious = TRUE;
3392 if (r_ptr->flagsr & RFR_RES_ALL)
3394 note = _("には効果がなかった。", " is unaffected.");
3396 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3399 /* Get confused later */
3400 do_conf = damroll(3, (dam / 2)) + 1;
3402 /* Attempt a saving throw */
3403 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3404 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3405 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3407 /* Memorize a flag */
3408 if (r_ptr->flags3 & (RF3_NO_CONF))
3410 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3416 /* No obvious effect */
3417 note = _("には効果がなかった。", " is unaffected.");
3421 /* No "real" damage */
3428 if (seen) obvious = TRUE;
3430 if (r_ptr->flagsr & RFR_RES_ALL)
3432 note = _("には効果がなかった。", " is unaffected.");
3434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3437 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3439 /* Attempt a saving throw */
3440 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3441 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3446 /* No obvious effect */
3447 note = _("には効果がなかった。", " is unaffected.");
3451 /* No "real" damage */
3459 /* Lite, but only hurts susceptible creatures */
3467 if (r_ptr->flagsr & RFR_RES_ALL)
3473 if (r_ptr->flags3 & (RF3_HURT_LITE))
3475 /* Obvious effect */
3476 if (seen) obvious = TRUE;
3478 /* Memorize the effects */
3479 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3481 /* Special effect */
3482 note = _("は光に身をすくめた!", " cringes from the light!");
3483 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3486 /* Normally no damage */
3498 /* Lite -- opposite of Dark */
3501 if (seen) obvious = TRUE;
3503 if (r_ptr->flagsr & RFR_RES_ALL)
3505 note = _("には完全な耐性がある!", " is immune.");
3507 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3510 if (r_ptr->flagsr & RFR_RES_LITE)
3512 note = _("には耐性がある!", " resists!");
3513 dam *= 2; dam /= (randint1(6)+6);
3514 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3516 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3518 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3519 note = _("は光に身をすくめた!", " cringes from the light!");
3520 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3527 /* Dark -- opposite of Lite */
3530 if (seen) obvious = TRUE;
3532 if (r_ptr->flagsr & RFR_RES_ALL)
3534 note = _("には完全な耐性がある!", " is immune.");
3536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3539 if (r_ptr->flagsr & RFR_RES_DARK)
3541 note = _("には耐性がある!", " resists!");
3542 dam *= 2; dam /= (randint1(6)+6);
3543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3552 if (r_ptr->flagsr & RFR_RES_ALL)
3557 /* Hurt by rock remover */
3558 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3561 if (seen) obvious = TRUE;
3563 /* Memorize the effects */
3564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3566 /* Cute little message */
3567 note = _("の皮膚がただれた!", " loses some skin!");
3568 note_dies = _("はドロドロに溶けた!", " dissolves!");
3571 /* Usually, ignore the effects */
3582 /* Teleport undead (Use "dam" as "power") */
3583 case GF_AWAY_UNDEAD:
3585 /* Only affect undead */
3586 if (r_ptr->flags3 & (RF3_UNDEAD))
3588 bool resists_tele = FALSE;
3590 if (r_ptr->flagsr & RFR_RES_TELE)
3592 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3595 note = _("には効果がなかった。", " is unaffected.");
3596 resists_tele = TRUE;
3598 else if (r_ptr->level > randint1(100))
3600 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3601 note = _("には耐性がある!", " resists!");
3602 resists_tele = TRUE;
3608 if (seen) obvious = TRUE;
3609 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3621 /* No "real" damage */
3627 /* Teleport evil (Use "dam" as "power") */
3630 /* Only affect evil */
3631 if (r_ptr->flags3 & (RF3_EVIL))
3633 bool resists_tele = FALSE;
3635 if (r_ptr->flagsr & RFR_RES_TELE)
3637 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3640 note = _("には効果がなかった。", " is unaffected.");
3641 resists_tele = TRUE;
3643 else if (r_ptr->level > randint1(100))
3645 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3646 note = _("には耐性がある!", " resists!");
3647 resists_tele = TRUE;
3653 if (seen) obvious = TRUE;
3654 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3666 /* No "real" damage */
3672 /* Teleport monster (Use "dam" as "power") */
3675 bool resists_tele = FALSE;
3676 if (r_ptr->flagsr & RFR_RES_TELE)
3678 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3680 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3681 note = _("には効果がなかった。", " is unaffected.");
3682 resists_tele = TRUE;
3684 else if (r_ptr->level > randint1(100))
3686 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3687 note = _("には耐性がある!", " resists!");
3688 resists_tele = TRUE;
3694 if (seen) obvious = TRUE;
3696 /* Prepare to teleport */
3700 /* No "real" damage */
3706 /* Turn undead (Use "dam" as "power") */
3707 case GF_TURN_UNDEAD:
3709 if (r_ptr->flagsr & RFR_RES_ALL)
3714 /* Only affect undead */
3715 if (r_ptr->flags3 & (RF3_UNDEAD))
3717 if (seen) obvious = TRUE;
3719 /* Learn about type */
3720 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3722 /* Apply some fear */
3723 do_fear = damroll(3, (dam / 2)) + 1;
3725 /* Attempt a saving throw */
3726 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3728 /* No obvious effect */
3729 note = _("には効果がなかった。", " is unaffected.");
3742 /* No "real" damage */
3748 /* Turn evil (Use "dam" as "power") */
3751 if (r_ptr->flagsr & RFR_RES_ALL)
3756 /* Only affect evil */
3757 if (r_ptr->flags3 & (RF3_EVIL))
3759 if (seen) obvious = TRUE;
3761 /* Learn about type */
3762 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3764 /* Apply some fear */
3765 do_fear = damroll(3, (dam / 2)) + 1;
3767 /* Attempt a saving throw */
3768 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3770 /* No obvious effect */
3771 note = _("には効果がなかった。", " is unaffected.");
3784 /* No "real" damage */
3790 /* Turn monster (Use "dam" as "power") */
3793 if (r_ptr->flagsr & RFR_RES_ALL)
3798 if (seen) obvious = TRUE;
3800 /* Apply some fear */
3801 do_fear = damroll(3, (dam / 2)) + 1;
3803 /* Attempt a saving throw */
3804 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3805 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3806 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3808 /* No obvious effect */
3809 note = _("には効果がなかった。", " is unaffected.");
3814 /* No "real" damage */
3821 case GF_DISP_UNDEAD:
3823 if (r_ptr->flagsr & RFR_RES_ALL)
3829 /* Only affect undead */
3830 if (r_ptr->flags3 & (RF3_UNDEAD))
3832 if (seen) obvious = TRUE;
3834 /* Learn about type */
3835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3837 note = _("は身震いした。", " shudders.");
3838 note_dies = _("はドロドロに溶けた!", " dissolves!");
3858 if (r_ptr->flagsr & RFR_RES_ALL)
3864 /* Only affect evil */
3865 if (r_ptr->flags3 & (RF3_EVIL))
3867 if (seen) obvious = TRUE;
3869 /* Learn about type */
3870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3872 note = _("は身震いした。", " shudders.");
3873 note_dies = _("はドロドロに溶けた!", " dissolves!");
3892 if (r_ptr->flagsr & RFR_RES_ALL)
3898 /* Only affect good */
3899 if (r_ptr->flags3 & (RF3_GOOD))
3901 if (seen) obvious = TRUE;
3903 /* Learn about type */
3904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3906 note = _("は身震いした。", " shudders.");
3907 note_dies = _("はドロドロに溶けた!", " dissolves!");
3924 case GF_DISP_LIVING:
3926 if (r_ptr->flagsr & RFR_RES_ALL)
3932 /* Only affect non-undead */
3933 if (monster_living(r_ptr))
3935 if (seen) obvious = TRUE;
3937 note = _("は身震いした。", " shudders.");
3938 note_dies = _("はドロドロに溶けた!", " dissolves!");
3957 if (r_ptr->flagsr & RFR_RES_ALL)
3963 /* Only affect demons */
3964 if (r_ptr->flags3 & (RF3_DEMON))
3966 if (seen) obvious = TRUE;
3968 /* Learn about type */
3969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3971 note = _("は身震いした。", " shudders.");
3972 note_dies = _("はドロドロに溶けた!", " dissolves!");
3988 /* Dispel monster */
3991 if (r_ptr->flagsr & RFR_RES_ALL)
3997 if (seen) obvious = TRUE;
3999 note = _("は身震いした。", " shudders.");
4000 note_dies = _("はドロドロに溶けた!", " dissolves!");
4007 if (seen) obvious = TRUE;
4009 if (r_ptr->flagsr & RFR_RES_ALL)
4011 note = _("には完全な耐性がある!", " is immune.");
4013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4017 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4021 /* Heal the monster */
4022 if (caster_ptr->hp < caster_ptr->maxhp)
4025 caster_ptr->hp += dam;
4026 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4028 /* Redraw (later) if needed */
4029 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4030 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4032 /* Special message */
4035 /* Get the monster name */
4036 monster_desc(killer, caster_ptr, 0);
4037 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4043 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4044 (void)hp_player(dam);
4049 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4058 if (seen) obvious = TRUE;
4059 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4061 if (r_ptr->flagsr & RFR_RES_ALL)
4063 note = _("には完全な耐性がある!", " is immune.");
4065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4069 /* Attempt a saving throw */
4070 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4071 (r_ptr->flags3 & RF3_NO_CONF) ||
4072 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4074 /* Memorize a flag */
4075 if (r_ptr->flags3 & (RF3_NO_CONF))
4077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4079 note = _("には効果がなかった。", " is unaffected.");
4082 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4084 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4085 note = _("には完全な耐性がある!", " is immune.");
4088 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4091 note = _("には耐性がある。", " resists.");
4096 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4097 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4099 if (who > 0) do_conf = randint0(4) + 4;
4100 else do_conf = randint0(8) + 8;
4106 case GF_BRAIN_SMASH:
4108 if (seen) obvious = TRUE;
4109 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4111 if (r_ptr->flagsr & RFR_RES_ALL)
4113 note = _("には完全な耐性がある!", " is immune.");
4115 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4119 /* Attempt a saving throw */
4120 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4121 (r_ptr->flags3 & RF3_NO_CONF) ||
4122 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4124 /* Memorize a flag */
4125 if (r_ptr->flags3 & (RF3_NO_CONF))
4127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4129 note = _("には効果がなかった。", " is unaffected.");
4132 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4135 note = _("には完全な耐性がある!", " is immune.");
4138 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4140 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4141 note = _("には耐性がある!", " resists!");
4146 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4147 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4151 do_conf = randint0(4) + 4;
4152 do_stun = randint0(4) + 4;
4156 do_conf = randint0(8) + 8;
4157 do_stun = randint0(8) + 8;
4159 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4167 if (seen) obvious = TRUE;
4168 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4170 if (r_ptr->flagsr & RFR_RES_ALL)
4172 note = _("には完全な耐性がある!", " is immune.");
4174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4178 /* Attempt a saving throw */
4179 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4181 note = _("には効果がなかった。", " is unaffected.");
4190 if (seen) obvious = TRUE;
4191 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4193 if (r_ptr->flagsr & RFR_RES_ALL)
4195 note = _("には完全な耐性がある!", " is immune.");
4197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4201 /* Attempt a saving throw */
4202 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4204 note = _("には効果がなかった。", " is unaffected.");
4213 if (seen) obvious = TRUE;
4214 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4216 if (r_ptr->flagsr & RFR_RES_ALL)
4218 note = _("には完全な耐性がある!", " is immune.");
4220 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4224 /* Attempt a saving throw */
4225 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4227 note = _("には効果がなかった。", " is unaffected.");
4236 if (seen) obvious = TRUE;
4238 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4239 "You point at %s, screaming the word, 'DIE!'."), m_name);
4241 if (r_ptr->flagsr & RFR_RES_ALL)
4243 note = _("には完全な耐性がある!", " is immune.");
4245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4249 /* Attempt a saving throw */
4250 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4252 note = _("には効果がなかった。", " is unaffected.");
4261 if (seen) obvious = TRUE;
4263 if (r_ptr->flagsr & RFR_RES_ALL)
4265 note = _("には完全な耐性がある!", " is immune.");
4267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4271 if (r_ptr->flags1 & RF1_UNIQUE)
4273 note = _("には効果がなかった。", " is unaffected.");
4278 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4279 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4281 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4283 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4287 note = _("は耐性を持っている!", "resists!");
4294 /* Capture monster */
4298 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4299 (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)
4301 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4306 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4307 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4308 nokori_hp = m_ptr->maxhp * 3 / 10;
4310 nokori_hp = m_ptr->maxhp * 3 / 20;
4312 if (m_ptr->hp >= nokori_hp)
4314 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4317 else if (m_ptr->hp < randint0(nokori_hp))
4319 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4320 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4321 cap_mon = m_ptr->r_idx;
4322 cap_mspeed = m_ptr->mspeed;
4324 cap_maxhp = m_ptr->max_maxhp;
4325 cap_nickname = m_ptr->nickname; /* Quark transfer */
4326 if (c_ptr->m_idx == p_ptr->riding)
4328 if (rakuba(-1, FALSE))
4330 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4334 delete_monster_idx(c_ptr->m_idx);
4340 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4346 /* Attack (Use "dam" as attack type) */
4349 /* Return this monster's death */
4350 return py_attack(y, x, dam);
4353 /* Sleep (Use "dam" as "power") */
4359 if (seen) obvious = TRUE;
4361 if (r_ptr->flagsr & RFR_RES_ALL)
4363 note = _("には効果がなかった。", " is unaffected.");
4365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4368 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4370 note = _("には効果がなかった。", " is unaffected.");
4373 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4376 if (MON_CSLEEP(m_ptr))
4378 note = _("には効果がなかった。", " is unaffected.");
4384 if (one_in_(5)) effect = 1;
4385 else if (one_in_(4)) effect = 2;
4386 else if (one_in_(3)) effect = 3;
4391 /* Powerful monsters can resist */
4392 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4393 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4395 note = _("には効果がなかった。", " is unaffected.");
4399 /* Normal monsters slow down */
4402 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4404 note = _("の動きが遅くなった。", " starts moving slower.");
4409 else if (effect == 2)
4411 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4413 /* Attempt a saving throw */
4414 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4415 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4420 /* No obvious effect */
4421 note = _("には効果がなかった。", " is unaffected.");
4426 else if (effect == 3)
4428 /* Attempt a saving throw */
4429 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4430 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4431 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4433 /* Memorize a flag */
4434 if (r_ptr->flags3 & RF3_NO_SLEEP)
4436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4439 /* No obvious effect */
4440 note = _("には効果がなかった。", " is unaffected.");
4445 /* Go to sleep (much) later */
4446 note = _("は眠り込んでしまった!", " falls asleep!");
4453 note = _("には効果がなかった。", " is unaffected.");
4456 /* No "real" damage */
4464 if (seen) obvious = TRUE;
4466 if (r_ptr->flagsr & RFR_RES_ALL)
4468 note = _("には効果がなかった。", " is unaffected.");
4470 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4474 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4476 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4477 chg_virtue(V_VITALITY, -1);
4487 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4489 if (r_ptr->flags3 & (RF3_HURT_LITE))
4491 /* Obvious effect */
4492 if (seen) obvious = TRUE;
4494 /* Memorize the effects */
4495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4497 /* Special effect */
4498 note = _("は光に身をすくめた!", " cringes from the light!");
4499 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4502 /* Normally no damage */
4509 photo = m_ptr->r_idx;
4516 case GF_BLOOD_CURSE:
4518 if (seen) obvious = TRUE;
4520 if (r_ptr->flagsr & RFR_RES_ALL)
4522 note = _("には完全な耐性がある!", " is immune.");
4524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4532 bool success = FALSE;
4533 if (seen) obvious = TRUE;
4535 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4537 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4538 if (dam < 1) dam = 1;
4540 /* No need to tame your pet */
4543 note = _("の動きが速くなった。", " starts moving faster.");
4544 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4548 /* Attempt a saving throw */
4549 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4550 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4551 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4552 (p_ptr->cursed & TRC_AGGRAVATE) ||
4553 ((r_ptr->level+10) > randint1(dam)))
4556 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4560 note = _("を支配した。", " is tamed!");
4562 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4564 /* Learn about type */
4565 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4572 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4574 do_fear = randint1(90)+10;
4576 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4579 /* No "real" damage */
4586 if (seen) obvious = TRUE;
4588 if (r_ptr->flagsr & RFR_RES_ALL)
4590 note = _("には完全な耐性がある!", " is immune.");
4592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4596 /* Attempt a saving throw */
4597 if (randint0(100 + dam) < (r_ptr->level + 50))
4599 note = _("には効果がなかった。", " is unaffected.");
4619 /* Absolutely no effect */
4620 if (skipped) return (FALSE);
4622 /* "Unique" monsters cannot be polymorphed */
4623 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4625 /* Quest monsters cannot be polymorphed */
4626 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4628 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4630 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4631 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4633 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4638 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4639 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4642 /* Modify the damage */
4644 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4645 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4647 /* Check for death */
4648 if (dam > m_ptr->hp)
4650 /* Extract method of death */
4655 /* Sound and Impact resisters never stun */
4657 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4658 !(r_ptr->flags3 & RF3_NO_STUN))
4660 if (seen) obvious = TRUE;
4663 if (MON_STUNNED(m_ptr))
4665 note = _("はひどくもうろうとした。", " is more dazed.");
4666 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4670 note = _("はもうろうとした。", " is dazed.");
4675 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4681 /* Confusion and Chaos resisters (and sleepers) never confuse */
4683 !(r_ptr->flags3 & RF3_NO_CONF) &&
4684 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4686 if (seen) obvious = TRUE;
4688 /* Already partially confused */
4689 if (MON_CONFUSED(m_ptr))
4691 note = _("はさらに混乱したようだ。", " looks more confused.");
4692 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4695 /* Was not confused */
4698 note = _("は混乱したようだ。", " looks confused.");
4702 /* Apply confusion */
4703 (void)set_monster_confused(c_ptr->m_idx, tmp);
4711 if (seen) obvious = TRUE;
4713 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4717 note = _("は弱くなったようだ。", " seems weakened.");
4718 m_ptr->maxhp -= do_time;
4719 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4724 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4725 if (do_poly && (randint1(90) > r_ptr->level))
4727 if (polymorph_monster(y, x))
4729 if (seen) obvious = TRUE;
4731 /* Monster polymorphs */
4732 note = _("が変身した!", " changes!");
4734 /* Turn off the damage */
4740 note = _("には効果がなかった。", " is unaffected.");
4743 /* Hack -- Get new monster */
4744 m_ptr = &m_list[c_ptr->m_idx];
4746 /* Hack -- Get new race */
4747 r_ptr = &r_info[m_ptr->r_idx];
4750 /* Handle "teleport" */
4753 if (seen) obvious = TRUE;
4755 note = _("が消え去った!", " disappears!");
4757 if (!who) chg_virtue(V_VALOUR, -1);
4760 teleport_away(c_ptr->m_idx, do_dist,
4761 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4763 /* Hack -- get new location */
4767 /* Hack -- get new grid */
4768 c_ptr = &cave[y][x];
4775 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4782 if (typ == GF_DRAIN_MANA)
4784 /* Drain mana does nothing */
4787 /* If another monster did the damage, hurt the monster by hand */
4790 /* Redraw (later) if needed */
4791 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4792 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4794 /* Wake the monster up */
4795 (void)set_monster_csleep(c_ptr->m_idx, 0);
4797 /* Hurt the monster */
4805 if (is_pet(m_ptr) && !(m_ptr->ml))
4808 /* Give detailed messages if destroyed */
4811 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4814 msg_format("%^s%s", m_name, note);
4822 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4824 /* Generate treasure, etc */
4825 monster_death(c_ptr->m_idx, FALSE);
4828 delete_monster_idx(c_ptr->m_idx);
4832 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4836 /* Damaged monster */
4839 /* Give detailed messages if visible or destroyed */
4840 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4842 /* Hack -- Pain message */
4845 message_pain(c_ptr->m_idx, dam);
4852 /* Hack -- handle sleep */
4853 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4857 else if (heal_leper)
4859 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4861 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4865 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4866 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4869 delete_monster_idx(c_ptr->m_idx);
4872 /* If the player did it, give him experience, check fear */
4877 /* Hurt the monster, check for fear and death */
4878 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4883 /* Damaged monster */
4886 /* HACK - anger the monster before showing the sleep message */
4887 if (do_sleep) anger_monster(m_ptr);
4889 /* Give detailed messages if visible or destroyed */
4890 if (note && seen_msg)
4891 msg_format(_("%s%s", "%^s%s"), m_name, note);
4893 /* Hack -- Pain message */
4894 else if (known && (dam || !do_fear))
4896 message_pain(c_ptr->m_idx, dam);
4899 /* Anger monsters */
4900 if (((dam > 0) || get_angry) && !do_sleep)
4901 anger_monster(m_ptr);
4904 if ((fear || do_fear) && seen)
4908 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4911 /* Hack -- handle sleep */
4912 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4916 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4918 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4922 switch (randint1(28))
4927 msg_print(_("地面が揺れた...", "The ground trembles..."));
4928 earthquake(ty, tx, 4 + randint0(4));
4929 if (!one_in_(6)) break;
4931 case 3: case 4: case 5: case 6:
4934 int extra_dam = damroll(10, 10);
4935 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4937 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4938 if (!one_in_(6)) break;
4943 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4945 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4946 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4947 if (!one_in_(6)) break;
4949 case 9: case 10: case 11:
4950 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4951 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4952 if (!one_in_(6)) break;
4953 case 12: case 13: case 14: case 15: case 16:
4954 aggravate_monsters(0);
4955 if (!one_in_(6)) break;
4957 count += activate_hi_summon(ty, tx, TRUE);
4958 if (!one_in_(6)) break;
4959 case 19: case 20: case 21: case 22:
4961 bool pet = !one_in_(3);
4962 BIT_FLAGS mode = PM_ALLOW_GROUP;
4964 if (pet) mode |= PM_FORCE_PET;
4965 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4967 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);
4968 if (!one_in_(6)) break;
4970 case 23: case 24: case 25:
4971 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4972 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4974 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4975 else lose_exp(p_ptr->exp / 16);
4976 if (!one_in_(6)) break;
4977 case 26: case 27: case 28:
4986 (void)do_dec_stat(i);
4995 (void)do_dec_stat(randint0(6));
5004 if (p_ptr->inside_battle)
5006 p_ptr->health_who = c_ptr->m_idx;
5007 p_ptr->redraw |= (PR_HEALTH);
5011 /* Verify this code */
5012 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5014 /* Redraw the monster grid */
5018 /* Update monster recall window */
5019 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5021 p_ptr->window |= (PW_MONSTER);
5024 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5028 if (!(flg & PROJECT_NO_HANGEKI))
5030 set_target(m_ptr, monster_target_y, monster_target_x);
5033 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5035 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5039 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5041 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5042 rakubadam_m = (dam > 200) ? 200 : dam;
5052 /* Prepare to make a Blade of Chaos */
5053 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5055 q_ptr->pval = photo;
5057 /* Mark the item as fully known */
5058 q_ptr->ident |= (IDENT_MENTAL);
5060 /* Drop it in the dungeon */
5061 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5069 /* Return "Anything seen?" */
5074 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5075 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5076 * @param who_name 効果を起こしたモンスターの名前
5077 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5078 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5079 * @param x 目標X座標 / Target x location (or location to travel "towards")
5080 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5081 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5083 * @param monspell 効果元のモンスター魔法ID
5084 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5086 * Handle a beam/bolt/ball causing damage to the player.
5087 * This routine takes a "source monster" (by index), a "distance", a default
5088 * "damage", and a "damage type". See "project_m()" above.
5089 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5090 * is reduced (see "project_m()" above). This can happen if a monster breathes
5091 * at the player and hits a wall instead.
5092 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5093 * to know if this is actually a ball or a bolt spell
5094 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5095 * we just assume that the effects were obvious, for historical reasons.
5097 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)
5102 /* Hack -- assume obvious */
5103 bool obvious = TRUE;
5105 /* Player blind-ness */
5106 bool blind = (p_ptr->blind ? TRUE : FALSE);
5108 /* Player needs a "description" (he is blind) */
5111 /* Source monster */
5112 monster_type *m_ptr = NULL;
5114 /* Monster name (for attacks) */
5117 /* Monster name (for damage) */
5120 /* Hack -- messages */
5126 /* Player is not here */
5127 if (!player_bold(y, x)) return (FALSE);
5129 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5131 if (kawarimi(TRUE)) return FALSE;
5134 /* Player cannot hurt himself */
5135 if (!who) return (FALSE);
5136 if (who == p_ptr->riding) return (FALSE);
5138 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5141 int max_attempts = 10;
5142 sound(SOUND_REFLECT);
5145 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5146 else if (p_ptr->special_defense & KATA_FUUJIN)
5147 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5149 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5152 /* Choose 'new' target */
5157 t_y = m_list[who].fy - 1 + randint1(3);
5158 t_x = m_list[who].fx - 1 + randint1(3);
5161 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5163 if (max_attempts < 1)
5165 t_y = m_list[who].fy;
5166 t_x = m_list[who].fx;
5171 t_y = p_ptr->y - 1 + randint1(3);
5172 t_x = p_ptr->x - 1 + randint1(3);
5175 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5177 disturb(TRUE, TRUE);
5181 /* Limit maximum damage */
5182 if (dam > 1600) dam = 1600;
5184 /* Reduce damage by distance */
5185 dam = (dam + r) / (r + 1);
5188 /* If the player is blind, be more descriptive */
5189 if (blind) fuzzy = TRUE;
5194 /* Get the source monster */
5195 m_ptr = &m_list[who];
5196 /* Extract the monster level */
5197 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5199 /* Get the monster name */
5200 monster_desc(m_name, m_ptr, 0);
5202 /* Get the monster's real name (gotten before polymorph!) */
5203 strcpy(killer, who_name);
5209 case PROJECT_WHO_UNCTRL_POWER:
5210 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5213 case PROJECT_WHO_GLASS_SHARDS:
5214 strcpy(killer, _("ガラスの破片", "shards of glass"));
5218 strcpy(killer, _("罠", "a trap"));
5223 strcpy(m_name, killer);
5226 /* Analyze the damage */
5229 /* Standard damage -- hurts inventory too */
5232 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5233 get_damage = acid_dam(dam, killer, monspell, FALSE);
5237 /* Standard damage -- hurts inventory too */
5240 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5241 get_damage = fire_dam(dam, killer, monspell, FALSE);
5245 /* Standard damage -- hurts inventory too */
5248 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5249 get_damage = cold_dam(dam, killer, monspell, FALSE);
5253 /* Standard damage -- hurts inventory too */
5256 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5257 get_damage = elec_dam(dam, killer, monspell, FALSE);
5261 /* Standard damage -- also poisons player */
5264 bool double_resist = IS_OPPOSE_POIS();
5265 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5267 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5268 if (double_resist) dam = (dam + 2) / 3;
5270 if ((!(double_resist || p_ptr->resist_pois)) &&
5271 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5276 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5278 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5280 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5285 /* Standard damage -- also poisons / mutates player */
5288 bool double_resist = IS_OPPOSE_POIS();
5289 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5291 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5292 if (double_resist) dam = (2 * dam + 2) / 5;
5293 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5294 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5296 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5298 if (one_in_(5)) /* 6 */
5300 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5301 if (one_in_(4)) /* 4 */
5309 inven_damage(set_acid_destroy, 2);
5315 /* Standard damage */
5318 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5319 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5323 /* Holy Orb -- Player only takes partial damage */
5326 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5327 if (p_ptr->align > 10)
5329 else if (p_ptr->align < -10)
5331 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5337 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5338 if (p_ptr->align > 10)
5340 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5344 /* Arrow -- XXX no dodging */
5349 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5351 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5353 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5360 /* Plasma -- XXX No resist */
5363 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5364 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5366 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5368 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5369 (void)set_stun(p_ptr->stun + plus_stun);
5372 if (!(p_ptr->resist_fire ||
5374 p_ptr->immune_fire))
5376 inven_damage(set_acid_destroy, 3);
5382 /* Nether -- drain experience */
5385 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5386 if (p_ptr->resist_neth)
5388 if (!prace_is_(RACE_SPECTRE))
5390 dam *= 6; dam /= (randint1(4) + 7);
5393 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5395 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5397 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5399 learn_spell(monspell);
5403 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5409 /* Water -- stun/confuse */
5412 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5413 if (!CHECK_MULTISHADOW())
5415 if (!p_ptr->resist_sound)
5417 set_stun(p_ptr->stun + randint1(40));
5419 if (!p_ptr->resist_conf)
5421 set_confused(p_ptr->confused + randint1(5) + 5);
5426 inven_damage(set_cold_destroy, 3);
5430 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5434 /* Chaos -- many effects */
5437 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5438 if (p_ptr->resist_chaos)
5440 dam *= 6; dam /= (randint1(4) + 7);
5443 if (!CHECK_MULTISHADOW())
5445 if (!p_ptr->resist_conf)
5447 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5449 if (!p_ptr->resist_chaos)
5451 (void)set_image(p_ptr->image + randint1(10));
5454 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5455 (void)gain_random_mutation(0);
5458 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5460 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5463 if (!p_ptr->resist_chaos || one_in_(9))
5465 inven_damage(set_elec_destroy, 2);
5466 inven_damage(set_fire_destroy, 2);
5470 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5474 /* Shards -- mostly cutting */
5477 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5478 if (p_ptr->resist_shard)
5480 dam *= 6; dam /= (randint1(4) + 7);
5482 else if (!CHECK_MULTISHADOW())
5484 (void)set_cut(p_ptr->cut + dam);
5487 if (!p_ptr->resist_shard || one_in_(13))
5489 inven_damage(set_cold_destroy, 2);
5492 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5496 /* Sound -- mostly stunning */
5499 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5500 if (p_ptr->resist_sound)
5502 dam *= 5; dam /= (randint1(4) + 7);
5504 else if (!CHECK_MULTISHADOW())
5506 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5507 (void)set_stun(p_ptr->stun + plus_stun);
5510 if (!p_ptr->resist_sound || one_in_(13))
5512 inven_damage(set_cold_destroy, 2);
5515 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5519 /* Pure confusion */
5522 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5523 if (p_ptr->resist_conf)
5525 dam *= 5; dam /= (randint1(4) + 7);
5527 else if (!CHECK_MULTISHADOW())
5529 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5531 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5535 /* Disenchantment -- see above */
5538 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5539 if (p_ptr->resist_disen)
5541 dam *= 6; dam /= (randint1(4) + 7);
5543 else if (!CHECK_MULTISHADOW())
5545 (void)apply_disenchant(0);
5547 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5551 /* Nexus -- see above */
5554 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5555 if (p_ptr->resist_nexus)
5557 dam *= 6; dam /= (randint1(4) + 7);
5559 else if (!CHECK_MULTISHADOW())
5563 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5567 /* Force -- mostly stun */
5570 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5571 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5573 (void)set_stun(p_ptr->stun + randint1(20));
5575 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5580 /* Rocket -- stun, cut */
5583 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5584 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5586 (void)set_stun(p_ptr->stun + randint1(20));
5589 if (p_ptr->resist_shard)
5593 else if (!CHECK_MULTISHADOW())
5595 (void)set_cut(p_ptr->cut + (dam / 2));
5598 if (!p_ptr->resist_shard || one_in_(12))
5600 inven_damage(set_cold_destroy, 3);
5603 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5607 /* Inertia -- slowness */
5610 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5611 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5612 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5616 /* Lite -- blinding */
5619 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5620 if (p_ptr->resist_lite)
5622 dam *= 4; dam /= (randint1(4) + 7);
5624 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5626 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5629 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5631 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5634 else if (prace_is_(RACE_S_FAIRY))
5639 if (p_ptr->wraith_form) dam *= 2;
5640 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5642 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5644 p_ptr->wraith_form = 0;
5645 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5646 "The light forces you out of your incorporeal shadow form."));
5648 p_ptr->redraw |= PR_MAP;
5649 /* Update monsters */
5650 p_ptr->update |= (PU_MONSTERS);
5651 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5653 /* Redraw status bar */
5654 p_ptr->redraw |= (PR_STATUS);
5661 /* Dark -- blinding */
5664 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5665 if (p_ptr->resist_dark)
5667 dam *= 4; dam /= (randint1(4) + 7);
5669 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5671 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5673 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5675 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5679 /* Time -- bolt fewer effects XXX */
5682 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5683 if (p_ptr->resist_time)
5686 dam /= (randint1(4) + 7);
5687 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5689 else if (!CHECK_MULTISHADOW())
5691 switch (randint1(10))
5693 case 1: case 2: case 3: case 4: case 5:
5695 if (p_ptr->prace == RACE_ANDROID) break;
5696 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5697 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5701 case 6: case 7: case 8: case 9:
5703 switch (randint1(6))
5705 case 1: k = A_STR; act = _("強く", "strong"); break;
5706 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5707 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5708 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5709 case 5: k = A_CON; act = _("健康で", "hale"); break;
5710 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5713 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5714 "You're not as %s as you used to be..."), act);
5716 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5717 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5718 p_ptr->update |= (PU_BONUS);
5724 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5725 "You're not as powerful as you used to be..."));
5727 for (k = 0; k < 6; k++)
5729 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5730 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5732 p_ptr->update |= (PU_BONUS);
5738 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5742 /* Gravity -- stun plus slowness plus teleport */
5745 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5746 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5748 if (!CHECK_MULTISHADOW())
5750 teleport_player(5, TELEPORT_PASSIVE);
5751 if (!p_ptr->levitation)
5752 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5753 if (!(p_ptr->resist_sound || p_ptr->levitation))
5755 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5756 (void)set_stun(p_ptr->stun + plus_stun);
5759 if (p_ptr->levitation)
5761 dam = (dam * 2) / 3;
5764 if (!p_ptr->levitation || one_in_(13))
5766 inven_damage(set_cold_destroy, 2);
5769 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5773 /* Standard damage */
5774 case GF_DISINTEGRATE:
5776 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5778 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5784 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5786 (void)hp_player(dam);
5793 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5794 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5801 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5802 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5808 if (p_ptr->free_act) break;
5809 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5811 if (ironman_nightmare)
5813 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5814 /* Have some nightmares */
5815 sanity_blast(NULL, FALSE);
5818 set_paralyzed(p_ptr->paralyzed + dam);
5828 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5829 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5836 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5837 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5844 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5846 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5847 if (!p_ptr->resist_shard || one_in_(13))
5849 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5850 inven_damage(set_cold_destroy, 2);
5856 /* Ice -- cold plus stun plus cuts */
5859 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5860 get_damage = cold_dam(dam, killer, monspell, FALSE);
5861 if (!CHECK_MULTISHADOW())
5863 if (!p_ptr->resist_shard)
5865 (void)set_cut(p_ptr->cut + damroll(5, 8));
5867 if (!p_ptr->resist_sound)
5869 (void)set_stun(p_ptr->stun + randint1(15));
5872 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5874 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5884 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5886 if (p_ptr->mimic_form)
5888 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5889 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5894 switch (p_ptr->prace)
5896 /* Some races are immune */
5910 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5922 if (CHECK_MULTISHADOW())
5924 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5926 else if (p_ptr->csp)
5930 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5932 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5935 if (dam >= p_ptr->csp)
5939 p_ptr->csp_frac = 0;
5948 learn_spell(monspell);
5951 p_ptr->redraw |= (PR_MANA);
5953 p_ptr->window |= (PW_PLAYER);
5954 p_ptr->window |= (PW_SPELL);
5958 /* Heal the monster */
5959 if (m_ptr->hp < m_ptr->maxhp)
5963 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5965 /* Redraw (later) if needed */
5966 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5967 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5969 /* Special message */
5972 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5985 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5987 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5988 learn_spell(monspell);
5992 if (!CHECK_MULTISHADOW())
5994 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5996 if (!p_ptr->resist_conf)
5998 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6001 if (!p_ptr->resist_chaos && one_in_(3))
6003 (void)set_image(p_ptr->image + randint0(250) + 150);
6010 p_ptr->csp_frac = 0;
6012 p_ptr->redraw |= PR_MANA;
6015 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6021 case GF_BRAIN_SMASH:
6023 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6025 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6026 learn_spell(monspell);
6030 if (!CHECK_MULTISHADOW())
6032 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6038 p_ptr->csp_frac = 0;
6040 p_ptr->redraw |= PR_MANA;
6043 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6044 if (!CHECK_MULTISHADOW())
6046 if (!p_ptr->resist_blind)
6048 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6050 if (!p_ptr->resist_conf)
6052 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6054 if (!p_ptr->free_act)
6056 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6058 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6060 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6061 (void)do_dec_stat(A_INT);
6062 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6063 (void)do_dec_stat(A_WIS);
6065 if (!p_ptr->resist_chaos)
6067 (void)set_image(p_ptr->image + randint0(250) + 150);
6077 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6079 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6080 learn_spell(monspell);
6084 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6085 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6093 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6095 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6096 learn_spell(monspell);
6100 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6101 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6109 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6111 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6112 learn_spell(monspell);
6116 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6117 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6125 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6127 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6128 learn_spell(monspell);
6132 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6133 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6141 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6143 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6144 learn_spell(monspell);
6148 if (!CHECK_MULTISHADOW())
6150 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6151 curse_equipment(40, 20);
6154 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6156 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6171 /* Hex - revenge damage stored */
6172 revenge_store(get_damage);
6174 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6175 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6177 char m_name_self[80];
6180 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6182 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6183 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6184 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6187 if (p_ptr->riding && dam > 0)
6189 rakubadam_p = (dam > 200) ? 200 : dam;
6193 disturb(TRUE, TRUE);
6196 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6198 (void)kawarimi(FALSE);
6201 /* Return "Anything seen?" */
6207 * Find the distance from (x, y) to a line.
6209 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6211 /* Vector from (x, y) to (x1, y1) */
6212 POSITION py = y1 - y;
6213 POSITION px = x1 - x;
6216 POSITION ny = x2 - x1;
6217 POSITION nx = y1 - y2;
6220 POSITION pd = distance(y1, x1, y, x);
6221 POSITION nd = distance(y1, x1, y2, x2);
6223 if (pd > nd) return distance(y, x, y2, x2);
6225 /* Component of P on N */
6226 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6228 /* Absolute value */
6229 return((nd >= 0) ? nd : 0 - nd);
6236 * Modified version of los() for calculation of disintegration balls.
6237 * Disintegration effects are stopped by permanent walls.
6239 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6259 /* Slope, or 1/Slope, of LOS */
6263 /* Extract the offset */
6267 /* Extract the absolute offset */
6272 /* Handle adjacent (or identical) grids */
6273 if ((ax < 2) && (ay < 2)) return (TRUE);
6276 /* Paranoia -- require "safe" origin */
6277 /* if (!in_bounds(y1, x1)) return (FALSE); */
6280 /* Directly South/North */
6283 /* South -- check for walls */
6286 for (ty = y1 + 1; ty < y2; ty++)
6288 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6292 /* North -- check for walls */
6295 for (ty = y1 - 1; ty > y2; ty--)
6297 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6305 /* Directly East/West */
6308 /* East -- check for walls */
6311 for (tx = x1 + 1; tx < x2; tx++)
6313 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6317 /* West -- check for walls */
6320 for (tx = x1 - 1; tx > x2; tx--)
6322 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6331 /* Extract some signs */
6332 sx = (dx < 0) ? -1 : 1;
6333 sy = (dy < 0) ? -1 : 1;
6336 /* Vertical "knights" */
6341 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6345 /* Horizontal "knights" */
6350 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6355 /* Calculate scale factor div 2 */
6358 /* Calculate scale factor */
6362 /* Travel horizontally */
6365 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6371 /* Consider the special case where slope == 1. */
6382 /* Note (below) the case (qy == f2), where */
6383 /* the LOS exactly meets the corner of a tile. */
6386 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6397 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6410 /* Travel vertically */
6413 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6429 /* Note (below) the case (qx == f2), where */
6430 /* the LOS exactly meets the corner of a tile. */
6433 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6444 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6465 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)
6470 int brev = rad * rad / dist;
6474 int mdis = distance(y1, x1, y2, x2) + rad;
6476 while (bdis <= mdis)
6480 if ((0 < dist) && (path_n < dist))
6482 POSITION ny = GRID_Y(path_g[path_n]);
6483 POSITION nx = GRID_X(path_g[path_n]);
6484 POSITION nd = distance(ny, nx, y1, x1);
6486 /* Get next base point */
6495 /* Travel from center outward */
6496 for (cdis = 0; cdis <= brad; cdis++)
6498 /* Scan the maximal blast area of radius "cdis" */
6499 for (y = by - cdis; y <= by + cdis; y++)
6501 for (x = bx - cdis; x <= bx + cdis; x++)
6503 /* Ignore "illegal" locations */
6504 if (!in_bounds(y, x)) continue;
6506 /* Enforce a circular "ripple" */
6507 if (distance(y1, x1, y, x) != bdis) continue;
6509 /* Enforce an arc */
6510 if (distance(by, bx, y, x) != cdis) continue;
6516 /* Lights are stopped by opaque terrains */
6517 if (!los(by, bx, y, x)) continue;
6519 case GF_DISINTEGRATE:
6520 /* Disintegration are stopped only by perma-walls */
6521 if (!in_disintegration_range(by, bx, y, x)) continue;
6524 /* Ball explosions are stopped by walls */
6525 if (!projectable(by, bx, y, x)) continue;
6529 /* Save this grid */
6537 /* Encode some more "radius" info */
6538 gm[bdis + 1] = *pgrids;
6540 /* Increase the size */
6541 brad = rad * (path_n + brev) / (dist + brev);
6543 /* Find the next ripple */
6547 /* Store the effect size */
6553 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6554 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6555 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6556 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6557 * @param x 目標X座標 / Target x location (or location to travel "towards")
6558 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6559 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6560 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6561 * @param monspell 効果元のモンスター魔法ID
6562 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6565 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6566 * towards a given location (optionally passing over the heads of interposing
6567 * monsters), and have it do a given amount of damage to the monsters (and
6568 * optionally objects) within the given radius of the final location.
6570 * A "bolt" travels from source to target and affects only the target grid.
6571 * A "beam" travels from source to target, affecting all grids passed through.
6572 * A "ball" travels from source to the target, exploding at the target, and
6573 * affecting everything within the given radius of the target location.
6575 * Traditionally, a "bolt" does not affect anything on the ground, and does
6576 * not pass over the heads of interposing monsters, much like a traditional
6577 * missile, and will "stop" abruptly at the "target" even if no monster is
6578 * positioned there, while a "ball", on the other hand, passes over the heads
6579 * of monsters between the source and target, and affects everything except
6580 * the source monster which lies within the final radius, while a "beam"
6581 * affects every monster between the source and target, except for the casting
6582 * monster (or player), and rarely affects things on the ground.
6584 * Two special flags allow us to use this function in special ways, the
6585 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6586 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6587 * actually projecting from the source monster (or player).
6589 * The player will only get "experience" for monsters killed by himself
6590 * Unique monsters can only be destroyed by attacks from the player
6592 * Only 256 grids can be affected per projection, limiting the effective
6593 * "radius" of standard ball attacks to nine units (diameter nineteen).
6595 * One can project in a given "direction" by combining PROJECT_THRU with small
6596 * offsets to the initial location (see "line_spell()"), or by calculating
6597 * "virtual targets" far away from the player.
6599 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6600 * continuing until it actually hits somethings (useful for "stone to mud").
6602 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6604 * Balls must explode BEFORE hitting walls, or they would affect monsters
6605 * on both sides of a wall. Some bug reports indicate that this is still
6606 * happening in 2.7.8 for Windows, though it appears to be impossible.
6608 * We "pre-calculate" the blast area only in part for efficiency.
6609 * More importantly, this lets us do "explosions" from the "inside" out.
6610 * This results in a more logical distribution of "blast" treasure.
6611 * It also produces a better (in my opinion) animation of the explosion.
6612 * It could be (but is not) used to have the treasure dropped by monsters
6613 * in the middle of the explosion fall "outwards", and then be damaged by
6614 * the blast as it spreads outwards towards the treasure drop location.
6616 * Walls and doors are included in the blast area, so that they can be
6617 * "burned" or "melted" in later versions.
6619 * This algorithm is intended to maximize simplicity, not necessarily
6620 * efficiency, since this function is not a bottleneck in the code.
6622 * We apply the blast effect from ground zero outwards, in several passes,
6623 * first affecting features, then objects, then monsters, then the player.
6624 * This allows walls to be removed before checking the object or monster
6625 * in the wall, and protects objects which are dropped by monsters killed
6626 * in the blast, and allows the player to see all affects before he is
6627 * killed or teleported away. The semantics of this method are open to
6628 * various interpretations, but they seem to work well in practice.
6630 * We process the blast area from ground-zero outwards to allow for better
6631 * distribution of treasure dropped by monsters, and because it provides a
6632 * pleasing visual effect at low cost.
6634 * Note that the damage done by "ball" explosions decreases with distance.
6635 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6637 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6638 * the target, and then the damage "flows" along this beam of destruction.
6639 * The damage at every grid is the same as at the "center" of a "ball"
6640 * explosion, since the "beam" grids are treated as if they ARE at the
6641 * center of a "ball" explosion.
6643 * Currently, specifying "beam" plus "ball" means that locations which are
6644 * covered by the initial "beam", and also covered by the final "ball", except
6645 * for the final grid (the epicenter of the ball), will be "hit twice", once
6646 * by the initial beam, and once by the exploding ball. For the grid right
6647 * next to the epicenter, this results in 150% damage being done. The center
6648 * does not have this problem, for the same reason the final grid in a "beam"
6649 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6650 * grids which are covered by the "ball" will NOT work, as then they will
6651 * receive LESS damage than they should. Do not combine "beam" with "ball".
6653 * The array "gy[],gx[]" with current size "grids" is used to hold the
6654 * collected locations of all grids in the "blast area" plus "beam path".
6656 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6657 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6658 * first blast grid (see above) with radius "N" from the blast center. Note
6659 * that only the first gm[1] grids in the blast area thus take full damage.
6660 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6661 * number of blast grids.
6663 * Note that once the projection is complete, (y2,x2) holds the final location
6664 * of bolts/beams, and the "epicenter" of balls.
6666 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6667 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6668 * implementation of the "distance" function. Also, a bolt can be properly
6669 * viewed as a "ball" with a "rad" of "zero".
6671 * Note that if no "target" is reached before the beam/bolt/ball travels the
6672 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6673 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6675 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6676 * to move from point A to point B, even if the player cannot see part of the
6677 * projection path. Note that in general, the player will *always* see part
6678 * of the path, since it either starts at the player or ends on the player.
6680 * Hack -- we assume that every "projection" is "self-illuminating".
6682 * Hack -- when only a single monster is affected, we automatically track
6683 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6685 * Note that all projections now "explode" at their final destination, even
6686 * if they were being projected at a more distant destination. This means
6687 * that "ball" spells will *always* explode.
6689 * Note that we must call "handle_stuff()" after affecting terrain features
6690 * in the blast radius, in case the "illumination" of the grid was changed,
6691 * and "update_view()" and "update_monsters()" need to be called.
6694 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6704 POSITION y_saver, x_saver; /* For reflecting monsters */
6706 int msec = delay_factor * delay_factor * delay_factor;
6708 /* Assume the player sees nothing */
6709 bool notice = FALSE;
6711 /* Assume the player has seen nothing */
6712 bool visual = FALSE;
6714 /* Assume the player has seen no blast grids */
6717 /* Assume to be a normal ball spell */
6718 bool breath = FALSE;
6720 /* Is the player blind? */
6721 bool blind = (p_ptr->blind ? TRUE : FALSE);
6723 bool old_hide = FALSE;
6725 /* Number of grids in the "path" */
6728 /* Actual grids in the "path" */
6731 /* Number of grids in the "blast area" (including the "beam" path) */
6734 /* Coordinates of the affected grids */
6735 POSITION gx[1024], gy[1024];
6737 /* Encoded "radius" info (see above) */
6740 /* Actual radius encoded in gm[] */
6741 POSITION gm_rad = rad;
6745 /* Attacker's name (prepared before polymorph)*/
6748 /* Can the player see the source of this effect? */
6749 bool see_s_msg = TRUE;
6751 /* Initialize by null string */
6757 /* Default target of monsterspell is player */
6758 monster_target_y = p_ptr->y;
6759 monster_target_x = p_ptr->x;
6761 /* Hack -- Jump to target */
6762 if (flg & (PROJECT_JUMP))
6767 /* Clear the flag */
6768 flg &= ~(PROJECT_JUMP);
6773 /* Start at player */
6780 /* Start at monster */
6783 x1 = m_list[who].fx;
6784 y1 = m_list[who].fy;
6785 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6797 /* Default "destination" */
6802 /* Hack -- verify stuff */
6803 if (flg & (PROJECT_THRU))
6805 if ((x1 == x2) && (y1 == y2))
6807 flg &= ~(PROJECT_THRU);
6811 /* Handle a breath attack */
6816 if (flg & PROJECT_HIDE) old_hide = TRUE;
6817 flg |= PROJECT_HIDE;
6821 /* Hack -- Assume there will be no blast (max radius 32) */
6822 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6830 /* Collect beam grids */
6831 if (flg & (PROJECT_BEAM))
6842 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6844 case GF_DISINTEGRATE:
6845 flg |= (PROJECT_GRID);
6846 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6850 /* Calculate the projection path */
6852 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6855 /* Giga-Hack SEEKER & SUPER_RAY */
6857 if( typ == GF_SEEKER )
6867 for (i = 0; i < path_n; ++i)
6872 int ny = GRID_Y(path_g[i]);
6873 int nx = GRID_X(path_g[i]);
6884 /* Only do visuals if requested */
6885 if (!blind && !(flg & (PROJECT_HIDE)))
6887 /* Only do visuals if the player can "see" the bolt */
6888 if (panel_contains(y, x) && player_has_los_bold(y, x))
6895 /* Obtain the bolt pict */
6896 p = bolt_pict(oy, ox, y, x, typ);
6898 /* Extract attr/char */
6902 /* Visual effects */
6903 print_rel(c, a, y, x);
6904 move_cursor_relative(y, x);
6905 /*if (fresh_before)*/ Term_fresh();
6906 Term_xtra(TERM_XTRA_DELAY, msec);
6908 /*if (fresh_before)*/ Term_fresh();
6910 /* Display "beam" grids */
6911 if (flg & (PROJECT_BEAM))
6913 /* Obtain the explosion pict */
6914 p = bolt_pict(y, x, y, x, typ);
6916 /* Extract attr/char */
6920 /* Visual effects */
6921 print_rel(c, a, y, x);
6924 /* Hack -- Activate delay */
6928 /* Hack -- delay anyway for consistency */
6931 /* Delay for consistency */
6932 Term_xtra(TERM_XTRA_DELAY, msec);
6935 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6936 if( is_mirror_grid(&cave[y][x]))
6938 /* The target of monsterspell becomes tha mirror(broken) */
6939 monster_target_y=(s16b)y;
6940 monster_target_x=(s16b)x;
6942 remove_mirror(y, x);
6943 next_mirror(&oy, &ox, y, x);
6945 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6946 for(j = last_i; j <= i; j++)
6948 y = GRID_Y(path_g[j]);
6949 x = GRID_X(path_g[j]);
6950 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6951 if(!who && (project_m_n==1) && !jump ){
6952 if(cave[project_m_y][project_m_x].m_idx >0 ){
6953 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6957 /* Hack -- auto-recall */
6958 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6960 /* Hack - auto-track */
6961 health_track(cave[project_m_y][project_m_x].m_idx);
6965 (void)project_f(0,0,y,x,dam,GF_SEEKER);
6970 for(i = last_i ; i < path_n ; i++)
6973 py = GRID_Y(path_g[i]);
6974 px = GRID_X(path_g[i]);
6975 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6977 if(!who && (project_m_n==1) && !jump ){
6978 if(cave[project_m_y][project_m_x].m_idx > 0)
6980 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6984 /* Hack -- auto-recall */
6985 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6987 /* Hack - auto-track */
6988 health_track(cave[project_m_y][project_m_x].m_idx);
6992 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6996 else if(typ == GF_SUPER_RAY){
6998 int second_step = 0;
7005 for (i = 0; i < path_n; ++i)
7010 int ny = GRID_Y(path_g[i]);
7011 int nx = GRID_X(path_g[i]);
7022 /* Only do visuals if requested */
7023 if (!blind && !(flg & (PROJECT_HIDE)))
7025 /* Only do visuals if the player can "see" the bolt */
7026 if (panel_contains(y, x) && player_has_los_bold(y, x))
7033 /* Obtain the bolt pict */
7034 p = bolt_pict(oy, ox, y, x, typ);
7036 /* Extract attr/char */
7040 /* Visual effects */
7041 print_rel(c, a, y, x);
7042 move_cursor_relative(y, x);
7043 /*if (fresh_before)*/ Term_fresh();
7044 Term_xtra(TERM_XTRA_DELAY, msec);
7046 /*if (fresh_before)*/ Term_fresh();
7048 /* Display "beam" grids */
7049 if (flg & (PROJECT_BEAM))
7051 /* Obtain the explosion pict */
7052 p = bolt_pict(y, x, y, x, typ);
7054 /* Extract attr/char */
7058 /* Visual effects */
7059 print_rel(c, a, y, x);
7062 /* Hack -- Activate delay */
7066 /* Hack -- delay anyway for consistency */
7069 /* Delay for consistency */
7070 Term_xtra(TERM_XTRA_DELAY, msec);
7073 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7074 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7076 if( second_step )continue;
7079 if( is_mirror_grid(&cave[y][x]) && !second_step )
7081 /* The target of monsterspell becomes tha mirror(broken) */
7082 monster_target_y=(s16b)y;
7083 monster_target_x=(s16b)x;
7086 for( j = 0; j <=i ; j++ )
7088 y = GRID_Y(path_g[j]);
7089 x = GRID_X(path_g[j]);
7090 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7094 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7095 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7096 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7097 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7098 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7099 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7100 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7101 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7104 for( i = 0; i < path_n ; i++ )
7107 py = GRID_Y(path_g[i]);
7108 px = GRID_X(path_g[i]);
7109 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7110 if(!who && (project_m_n == 1) && !jump){
7111 if(cave[project_m_y][project_m_x].m_idx >0 ){
7112 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7116 /* Hack -- auto-recall */
7117 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7119 /* Hack - auto-track */
7120 health_track(cave[project_m_y][project_m_x].m_idx);
7124 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7129 /* Project along the path */
7130 for (i = 0; i < path_n; ++i)
7135 int ny = GRID_Y(path_g[i]);
7136 int nx = GRID_X(path_g[i]);
7138 if (flg & PROJECT_DISI)
7140 /* Hack -- Balls explode before reaching walls */
7141 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7143 else if (flg & PROJECT_LOS)
7145 /* Hack -- Balls explode before reaching walls */
7146 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7150 /* Hack -- Balls explode before reaching walls */
7151 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7158 /* Collect beam grids */
7159 if (flg & (PROJECT_BEAM))
7166 /* Only do visuals if requested */
7167 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7169 /* Only do visuals if the player can "see" the bolt */
7170 if (panel_contains(y, x) && player_has_los_bold(y, x))
7177 /* Obtain the bolt pict */
7178 p = bolt_pict(oy, ox, y, x, typ);
7180 /* Extract attr/char */
7184 /* Visual effects */
7185 print_rel(c, a, y, x);
7186 move_cursor_relative(y, x);
7187 /*if (fresh_before)*/ Term_fresh();
7188 Term_xtra(TERM_XTRA_DELAY, msec);
7190 /*if (fresh_before)*/ Term_fresh();
7192 /* Display "beam" grids */
7193 if (flg & (PROJECT_BEAM))
7195 /* Obtain the explosion pict */
7196 p = bolt_pict(y, x, y, x, typ);
7198 /* Extract attr/char */
7202 /* Visual effects */
7203 print_rel(c, a, y, x);
7206 /* Hack -- Activate delay */
7210 /* Hack -- delay anyway for consistency */
7213 /* Delay for consistency */
7214 Term_xtra(TERM_XTRA_DELAY, msec);
7221 /* Save the "blast epicenter" */
7225 if (breath && !path_n)
7231 flg &= ~(PROJECT_HIDE);
7235 /* Start the "explosion" */
7238 /* Hack -- make sure beams get to "explode" */
7246 /* If we found a "target", explode there */
7247 if (dist <= MAX_RANGE)
7249 /* Mega-Hack -- remove the final "beam" grid */
7250 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7253 * Create a conical breath attack
7264 flg &= ~(PROJECT_HIDE);
7266 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7270 /* Determine the blast area, work from the inside out */
7271 for (dist = 0; dist <= rad; dist++)
7273 /* Scan the maximal blast area of radius "dist" */
7274 for (y = by - dist; y <= by + dist; y++)
7276 for (x = bx - dist; x <= bx + dist; x++)
7278 /* Ignore "illegal" locations */
7279 if (!in_bounds2(y, x)) continue;
7281 /* Enforce a "circular" explosion */
7282 if (distance(by, bx, y, x) != dist) continue;
7288 /* Lights are stopped by opaque terrains */
7289 if (!los(by, bx, y, x)) continue;
7291 case GF_DISINTEGRATE:
7292 /* Disintegration are stopped only by perma-walls */
7293 if (!in_disintegration_range(by, bx, y, x)) continue;
7296 /* Ball explosions are stopped by walls */
7297 if (!projectable(by, bx, y, x)) continue;
7301 /* Save this grid */
7308 /* Encode some more "radius" info */
7314 /* Speed -- ignore "non-explosions" */
7315 if (!grids) return (FALSE);
7318 /* Display the "blast area" if requested */
7319 if (!blind && !(flg & (PROJECT_HIDE)))
7321 /* Then do the "blast", from inside out */
7322 for (t = 0; t <= gm_rad; t++)
7324 /* Dump everything with this radius */
7325 for (i = gm[t]; i < gm[t+1]; i++)
7327 /* Extract the location */
7331 /* Only do visuals if the player can "see" the blast */
7332 if (panel_contains(y, x) && player_has_los_bold(y, x))
7341 /* Obtain the explosion pict */
7342 p = bolt_pict(y, x, y, x, typ);
7344 /* Extract attr/char */
7348 /* Visual effects -- Display */
7349 print_rel(c, a, y, x);
7353 /* Hack -- center the cursor */
7354 move_cursor_relative(by, bx);
7356 /* Flush each "radius" seperately */
7357 /*if (fresh_before)*/ Term_fresh();
7359 /* Delay (efficiently) */
7360 if (visual || drawn)
7362 Term_xtra(TERM_XTRA_DELAY, msec);
7366 /* Flush the erasing */
7369 /* Erase the explosion drawn above */
7370 for (i = 0; i < grids; i++)
7372 /* Extract the location */
7376 /* Hack -- Erase if needed */
7377 if (panel_contains(y, x) && player_has_los_bold(y, x))
7383 /* Hack -- center the cursor */
7384 move_cursor_relative(by, bx);
7386 /* Flush the explosion */
7387 /*if (fresh_before)*/ Term_fresh();
7392 /* Update stuff if needed */
7393 if (p_ptr->update) update_stuff();
7396 if (flg & PROJECT_KILL)
7398 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7399 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7403 /* Check features */
7404 if (flg & (PROJECT_GRID))
7406 /* Start with "dist" of zero */
7409 /* Scan for features */
7410 for (i = 0; i < grids; i++)
7412 /* Hack -- Notice new "dist" values */
7413 if (gm[dist+1] == i) dist++;
7415 /* Get the grid location */
7419 /* Find the closest point in the blast */
7422 int d = dist_to_line(y, x, y1, x1, by, bx);
7424 /* Affect the grid */
7425 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7429 /* Affect the grid */
7430 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7435 /* Update stuff if needed */
7436 if (p_ptr->update) update_stuff();
7439 if (flg & (PROJECT_ITEM))
7441 /* Start with "dist" of zero */
7444 /* Scan for objects */
7445 for (i = 0; i < grids; i++)
7447 /* Hack -- Notice new "dist" values */
7448 if (gm[dist+1] == i) dist++;
7450 /* Get the grid location */
7454 /* Find the closest point in the blast */
7457 int d = dist_to_line(y, x, y1, x1, by, bx);
7459 /* Affect the object in the grid */
7460 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7464 /* Affect the object in the grid */
7465 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7471 /* Check monsters */
7472 if (flg & (PROJECT_KILL))
7479 /* Start with "dist" of zero */
7482 /* Scan for monsters */
7483 for (i = 0; i < grids; i++)
7487 /* Hack -- Notice new "dist" values */
7488 if (gm[dist + 1] == i) dist++;
7490 /* Get the grid location */
7494 /* A single bolt may be reflected */
7497 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7498 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7500 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7501 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7502 (!who || dist_hack > 1) && !one_in_(10))
7505 int max_attempts = 10;
7507 /* Choose 'new' target */
7510 t_y = y_saver - 1 + randint1(3);
7511 t_x = x_saver - 1 + randint1(3);
7514 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7516 if (max_attempts < 1)
7522 sound(SOUND_REFLECT);
7525 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7526 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7527 else if (m_ptr->r_idx == MON_DIO)
7528 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7530 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7532 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7534 /* Reflected bolts randomly target either one */
7535 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7536 else flg |= PROJECT_PLAYER;
7538 /* The bolt is reflected */
7539 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7541 /* Don't affect the monster any longer */
7547 /* Find the closest point in the blast */
7550 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7554 effective_dist = dist;
7558 /* There is the riding player on this monster */
7559 if (p_ptr->riding && player_bold(y, x))
7561 /* Aimed on the player */
7562 if (flg & PROJECT_PLAYER)
7564 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7567 * A beam or bolt is well aimed
7569 * So don't affects the mount.
7576 * The spell is not well aimed,
7577 * So partly affect the mount too.
7584 * This grid is the original target.
7585 * Or aimed on your horse.
7587 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7589 /* Hit the mount with full damage */
7593 * Otherwise this grid is not the
7594 * original target, it means that line
7595 * of fire is obstructed by this
7599 * A beam or bolt will hit either
7600 * player or mount. Choose randomly.
7602 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7606 /* Hit the mount with full damage */
7610 /* Hit the player later */
7611 flg |= PROJECT_PLAYER;
7613 /* Don't affect the mount */
7619 * The spell is not well aimed, so
7620 * partly affect both player and
7629 /* Affect the monster in the grid */
7630 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7634 /* Player affected one monster (without "jumping") */
7635 if (!who && (project_m_n == 1) && !jump)
7640 /* Track if possible */
7641 if (cave[y][x].m_idx > 0)
7643 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7647 /* Hack -- auto-recall */
7648 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7650 /* Hack - auto-track */
7651 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7659 if (flg & (PROJECT_KILL))
7661 /* Start with "dist" of zero */
7664 /* Scan for player */
7665 for (i = 0; i < grids; i++)
7669 /* Hack -- Notice new "dist" values */
7670 if (gm[dist+1] == i) dist++;
7672 /* Get the grid location */
7676 /* Affect the player? */
7677 if (!player_bold(y, x)) continue;
7679 /* Find the closest point in the blast */
7682 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7686 effective_dist = dist;
7689 /* Target may be your horse */
7692 /* Aimed on the player */
7693 if (flg & PROJECT_PLAYER)
7695 /* Hit the player with full damage */
7699 * Hack -- When this grid was not the
7700 * original target, a beam or bolt
7701 * would hit either player or mount,
7702 * and should be choosen randomly.
7704 * But already choosen to hit the
7705 * mount at this point.
7707 * Or aimed on your horse.
7709 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7712 * A beam or bolt is well aimed
7714 * So don't affects the player.
7721 * The spell is not well aimed,
7722 * So partly affect the player too.
7728 /* Affect the player */
7729 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7737 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7739 if (rakubadam_m > 0)
7741 if (rakuba(rakubadam_m, FALSE))
7743 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7746 if (p_ptr->riding && rakubadam_p > 0)
7748 if(rakuba(rakubadam_p, FALSE))
7750 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7755 /* Return "something was noticed" */
7760 * @brief 鏡魔法「封魔結界」の効果処理
7762 * @return 効果があったらTRUEを返す
7764 bool binding_field(HIT_POINT dam)
7766 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7767 int mirror_num = 0; /* 鏡の数 */
7769 POSITION centersign;
7770 POSITION x1, x2, y1, y2;
7772 int msec = delay_factor*delay_factor*delay_factor;
7775 POSITION point_x[3];
7776 POSITION point_y[3];
7778 /* Default target of monsterspell is player */
7779 monster_target_y = p_ptr->y;
7780 monster_target_x = p_ptr->x;
7782 for (x = 0; x < cur_wid; x++)
7784 for (y = 0; y < cur_hgt; y++)
7786 if (is_mirror_grid(&cave[y][x]) &&
7787 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7788 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7789 player_has_los_bold(y, x) &&
7790 projectable(p_ptr->y, p_ptr->x, y, x)
7792 mirror_y[mirror_num] = y;
7793 mirror_x[mirror_num] = x;
7799 if (mirror_num < 2)return FALSE;
7801 point_x[0] = randint0(mirror_num);
7803 point_x[1] = randint0(mirror_num);
7804 } while (point_x[0] == point_x[1]);
7806 point_y[0] = mirror_y[point_x[0]];
7807 point_x[0] = mirror_x[point_x[0]];
7808 point_y[1] = mirror_y[point_x[1]];
7809 point_x[1] = mirror_x[point_x[1]];
7810 point_y[2] = p_ptr->y;
7811 point_x[2] = p_ptr->x;
7813 x = point_x[0] + point_x[1] + point_x[2];
7814 y = point_y[0] + point_y[1] + point_y[2];
7816 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7817 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7818 if (centersign == 0)return FALSE;
7820 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7821 x1 = x1 < point_x[2] ? x1 : point_x[2];
7822 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7823 y1 = y1 < point_y[2] ? y1 : point_y[2];
7825 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7826 x2 = x2 > point_x[2] ? x2 : point_x[2];
7827 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7828 y2 = y2 > point_y[2] ? y2 : point_y[2];
7830 for (y = y1; y <= y2; y++) {
7831 for (x = x1; x <= x2; x++) {
7832 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7833 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7834 centersign*((point_x[1] - x)*(point_y[2] - y)
7835 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7836 centersign*((point_x[2] - x)*(point_y[0] - y)
7837 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7839 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7840 /* Visual effects */
7842 && panel_contains(y, x)) {
7843 p = bolt_pict(y, x, y, x, GF_MANA);
7844 print_rel(PICT_C(p), PICT_A(p), y, x);
7845 move_cursor_relative(y, x);
7846 /*if (fresh_before)*/ Term_fresh();
7847 Term_xtra(TERM_XTRA_DELAY, msec);
7853 for (y = y1; y <= y2; y++) {
7854 for (x = x1; x <= x2; x++) {
7855 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7856 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7857 centersign*((point_x[1] - x)*(point_y[2] - y)
7858 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7859 centersign*((point_x[2] - x)*(point_y[0] - y)
7860 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7862 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7863 (void)project_f(0, 0, y, x, dam, GF_MANA);
7868 for (y = y1; y <= y2; y++) {
7869 for (x = x1; x <= x2; x++) {
7870 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7871 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7872 centersign*((point_x[1] - x)*(point_y[2] - y)
7873 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7874 centersign*((point_x[2] - x)*(point_y[0] - y)
7875 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7877 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7878 (void)project_o(0, 0, y, x, dam, GF_MANA);
7883 for (y = y1; y <= y2; y++) {
7884 for (x = x1; x <= x2; x++) {
7885 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7886 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7887 centersign*((point_x[1] - x)*(point_y[2] - y)
7888 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7889 centersign*((point_x[2] - x)*(point_y[0] - y)
7890 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7892 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7893 (void)project_m(0, 0, y, x, dam, GF_MANA,
7894 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7900 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7901 remove_mirror(point_y[0], point_x[0]);
7908 * @brief 鏡魔法「鏡の封印」の効果処理
7910 * @return 効果があったらTRUEを返す
7912 void seal_of_mirror(HIT_POINT dam)
7916 for (x = 0; x < cur_wid; x++)
7918 for (y = 0; y < cur_hgt; y++)
7920 if (is_mirror_grid(&cave[y][x]))
7922 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7923 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7925 if (!cave[y][x].m_idx)
7927 remove_mirror(y, x);