3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
20 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
21 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
23 int project_length = 0; /*!< 投射の射程距離 */
27 * @brief モンスター魅了用セービングスロー共通部(汎用系)
29 * @param m_ptr 対象モンスター
30 * @return 魅了に抵抗したらTRUE
32 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
34 monster_race *r_ptr = &r_info[m_ptr->r_idx];
36 if(p_ptr->inside_arena) return TRUE;
39 if (r_ptr->flagsr & RFR_RES_ALL)
41 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
45 if (r_ptr->flags3 & RF3_NO_CONF)
47 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
51 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
53 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
54 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
55 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
59 * @brief モンスター服従用セービングスロー共通部(部族依存系)
61 * @param m_ptr 対象モンスター
62 * @return 服従に抵抗したらTRUE
64 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
66 monster_race *r_ptr = &r_info[m_ptr->r_idx];
68 if (p_ptr->inside_arena) return TRUE;
71 if (r_ptr->flagsr & RFR_RES_ALL)
73 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
77 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
79 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
80 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
81 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
85 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
88 * ハードコーティングによる実装が行われている。
89 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
91 PERCENTAGE beam_chance(void)
93 if (p_ptr->pclass == CLASS_MAGE)
94 return (PERCENTAGE)(p_ptr->lev);
95 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
96 return (PERCENTAGE)(p_ptr->lev + 10);
98 return (PERCENTAGE)(p_ptr->lev / 2);
103 * @brief 配置した鏡リストの次を取得する /
104 * Get another mirror. for SEEKER
105 * @param next_y 次の鏡のy座標を返す参照ポインタ
106 * @param next_x 次の鏡のx座標を返す参照ポインタ
107 * @param cury 現在の鏡のy座標
108 * @param curx 現在の鏡のx座標
110 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
112 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
113 int mirror_num = 0; /* 鏡の数 */
117 for (x = 0; x < cur_wid; x++)
119 for (y = 0; y < cur_hgt; y++)
121 if (is_mirror_grid(&cave[y][x])) {
122 mirror_y[mirror_num] = y;
123 mirror_x[mirror_num] = x;
130 num = randint0(mirror_num);
131 *next_y = mirror_y[num];
132 *next_x = mirror_x[num];
135 *next_y = cury + randint0(5) - 2;
136 *next_x = curx + randint0(5) - 2;
141 * @brief 万色表現用にランダムな色を選択する関数 /
142 * Get a legal "multi-hued" color for drawing "spells"
146 static byte mh_attr(int max)
148 switch (randint1(max))
150 case 1: return (TERM_RED);
151 case 2: return (TERM_GREEN);
152 case 3: return (TERM_BLUE);
153 case 4: return (TERM_YELLOW);
154 case 5: return (TERM_ORANGE);
155 case 6: return (TERM_VIOLET);
156 case 7: return (TERM_L_RED);
157 case 8: return (TERM_L_GREEN);
158 case 9: return (TERM_L_BLUE);
159 case 10: return (TERM_UMBER);
160 case 11: return (TERM_L_UMBER);
161 case 12: return (TERM_SLATE);
162 case 13: return (TERM_WHITE);
163 case 14: return (TERM_L_WHITE);
164 case 15: return (TERM_L_DARK);
172 * @brief 魔法属性に応じたエフェクトの色を返す /
173 * Return a color to use for the bolt/ball spells
177 static byte spell_color(int type)
179 /* Check if A.B.'s new graphics should be used (rr9) */
180 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
185 case GF_PSY_SPEAR: return (0x06);
186 case GF_MISSILE: return (0x0F);
187 case GF_ACID: return (0x04);
188 case GF_ELEC: return (0x02);
189 case GF_FIRE: return (0x00);
190 case GF_COLD: return (0x01);
191 case GF_POIS: return (0x03);
192 case GF_HOLY_FIRE: return (0x00);
193 case GF_HELL_FIRE: return (0x00);
194 case GF_MANA: return (0x0E);
196 case GF_SEEKER: return (0x0E);
197 case GF_SUPER_RAY: return (0x0E);
199 case GF_ARROW: return (0x0F);
200 case GF_WATER: return (0x04);
201 case GF_NETHER: return (0x07);
202 case GF_CHAOS: return (mh_attr(15));
203 case GF_DISENCHANT: return (0x05);
204 case GF_NEXUS: return (0x0C);
205 case GF_CONFUSION: return (mh_attr(4));
206 case GF_SOUND: return (0x09);
207 case GF_SHARDS: return (0x08);
208 case GF_FORCE: return (0x09);
209 case GF_INERTIAL: return (0x09);
210 case GF_GRAVITY: return (0x09);
211 case GF_TIME: return (0x09);
212 case GF_LITE_WEAK: return (0x06);
213 case GF_LITE: return (0x06);
214 case GF_DARK_WEAK: return (0x07);
215 case GF_DARK: return (0x07);
216 case GF_PLASMA: return (0x0B);
217 case GF_METEOR: return (0x00);
218 case GF_ICE: return (0x01);
219 case GF_ROCKET: return (0x0F);
220 case GF_DEATH_RAY: return (0x07);
221 case GF_NUKE: return (mh_attr(2));
222 case GF_DISINTEGRATE: return (0x05);
234 case GF_CAUSE_4: return (0x0E);
235 case GF_HAND_DOOM: return (0x07);
236 case GF_CAPTURE : return (0x0E);
237 case GF_IDENTIFY: return (0x01);
238 case GF_ATTACK: return (0x0F);
239 case GF_PHOTO : return (0x06);
242 /* Normal tiles or ASCII */
248 /* Lookup the default colors for this type */
249 cptr s = quark_str(gf_color[type]);
251 if (!s) return (TERM_WHITE);
253 /* Pick a random color */
254 c = s[randint0(strlen(s))];
256 /* Lookup this color */
257 a = my_strchr(color_char, c) - color_char;
259 /* Invalid color (note check for < 0 removed, gave a silly
260 * warning because bytes are always >= 0 -- RG) */
261 if (a > 15) return (TERM_WHITE);
267 /* Standard "color" */
273 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
274 * Find the attr/char pair to use for a spell effect
283 * It is moving (or has moved) from (x,y) to (nx,ny).
284 * If the distance is not "one", we (may) return "*".
287 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
297 if ((ny == y) && (nx == x)) base = 0x30;
300 else if (nx == x) base = 0x40;
303 else if (ny == y) base = 0x50;
306 else if ((ny - y) == (x - nx)) base = 0x60;
309 else if ((ny - y) == (nx - x)) base = 0x70;
314 /* Basic spell color */
315 k = spell_color(typ);
317 /* Obtain attr/char */
318 a = misc_to_attr[base + k];
319 c = misc_to_char[base + k];
327 * @brief 始点から終点への経路を返す /
328 * Determine the path taken by a projection.
329 * @param gp 経路座標リストを返す参照ポインタ
339 * The projection will always start from the grid (y1,x1), and will travel
340 * towards the grid (y2,x2), touching one grid per unit of distance along
341 * the major axis, and stopping when it enters the destination grid or a
342 * wall grid, or has travelled the maximum legal distance of "range".
344 * Note that "distance" in this function (as in the "update_view()" code)
345 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
346 * actually has an "octagon of projection" not a "circle of projection".
348 * The path grids are saved into the grid array pointed to by "gp", and
349 * there should be room for at least "range" grids in "gp". Note that
350 * due to the way in which distance is calculated, this function normally
351 * uses fewer than "range" grids for the projection path, so the result
352 * of this function should never be compared directly to "range". Note
353 * that the initial grid (y1,x1) is never saved into the grid array, not
354 * even if the initial grid is also the final grid.
356 * The "flg" flags can be used to modify the behavior of this function.
358 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
359 * semantics as they do for the "project" function, namely, that the path
360 * will stop as soon as it hits a monster, or that the path will continue
361 * through the destination grid, respectively.
363 * The "PROJECT_JUMP" flag, which for the "project()" function means to
364 * start at a special grid (which makes no sense in this function), means
365 * that the path should be "angled" slightly if needed to avoid any wall
366 * grids, allowing the player to "target" any grid which is in "view".
367 * This flag is non-trivial and has not yet been implemented, but could
368 * perhaps make use of the "vinfo" array (above).
370 * This function returns the number of grids (if any) in the path. This
371 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
373 * This algorithm is similar to, but slightly different from, the one used
374 * by "update_view_los()", and very different from the one used by "los()".
377 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
399 /* No path necessary (or allowed) */
400 if ((x1 == x2) && (y1 == y2)) return (0);
428 /* Number of "units" in one "half" grid */
431 /* Number of "units" in one "full" grid */
437 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
448 /* Advance (X) part 2 */
451 /* Advance (X) part 3 */
458 /* Create the projection path */
462 gp[n++] = GRID(y, x);
464 /* Hack -- Check maximum range */
465 if ((n + (k >> 1)) >= range) break;
467 /* Sometimes stop at destination grid */
468 if (!(flg & (PROJECT_THRU)))
470 if ((x == x2) && (y == y2)) break;
473 if (flg & (PROJECT_DISI))
475 if ((n > 0) && cave_stop_disintegration(y, x)) break;
477 else if (flg & (PROJECT_LOS))
479 if ((n > 0) && !cave_los_bold(y, x)) break;
481 else if (!(flg & (PROJECT_PATH)))
483 /* Always stop at non-initial wall grids */
484 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
487 /* Sometimes stop at non-initial monsters/players */
488 if (flg & (PROJECT_STOP))
491 (player_bold(y, x) || cave[y][x].m_idx != 0))
495 if (!in_bounds(y, x)) break;
500 /* Advance (X) part 1 */
503 /* Horizontal change */
506 /* Advance (X) part 2 */
509 /* Advance (X) part 3 */
525 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
534 /* Vertical change */
537 /* Advance (Y) part 2 */
540 /* Advance (Y) part 3 */
547 /* Create the projection path */
551 gp[n++] = GRID(y, x);
553 /* Hack -- Check maximum range */
554 if ((n + (k >> 1)) >= range) break;
556 /* Sometimes stop at destination grid */
557 if (!(flg & (PROJECT_THRU)))
559 if ((x == x2) && (y == y2)) break;
562 if (flg & (PROJECT_DISI))
564 if ((n > 0) && cave_stop_disintegration(y, x)) break;
566 else if (flg & (PROJECT_LOS))
568 if ((n > 0) && !cave_los_bold(y, x)) break;
570 else if (!(flg & (PROJECT_PATH)))
572 /* Always stop at non-initial wall grids */
573 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
576 /* Sometimes stop at non-initial monsters/players */
577 if (flg & (PROJECT_STOP))
580 (player_bold(y, x) || cave[y][x].m_idx != 0))
584 if (!in_bounds(y, x)) break;
589 /* Advance (Y) part 1 */
592 /* Vertical change */
595 /* Advance (Y) part 2 */
598 /* Advance (Y) part 3 */
618 /* Create the projection path */
622 gp[n++] = GRID(y, x);
624 /* Hack -- Check maximum range */
625 if ((n + (n >> 1)) >= range) break;
627 /* Sometimes stop at destination grid */
628 if (!(flg & (PROJECT_THRU)))
630 if ((x == x2) && (y == y2)) break;
633 if (flg & (PROJECT_DISI))
635 if ((n > 0) && cave_stop_disintegration(y, x)) break;
637 else if (flg & (PROJECT_LOS))
639 if ((n > 0) && !cave_los_bold(y, x)) break;
641 else if (!(flg & (PROJECT_PATH)))
643 /* Always stop at non-initial wall grids */
644 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
647 /* Sometimes stop at non-initial monsters/players */
648 if (flg & (PROJECT_STOP))
651 (player_bold(y, x) || cave[y][x].m_idx != 0))
655 if (!in_bounds(y, x)) break;
672 * Mega-Hack -- track "affected" monsters (see "project()" comments)
674 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
675 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
676 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
677 /* Mega-Hack -- monsters target */
678 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
679 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
683 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
684 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
685 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
686 * @param y 目標Y座標 / Target y location (or location to travel "towards")
687 * @param x 目標X座標 / Target x location (or location to travel "towards")
688 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
689 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
690 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
693 * We are called both for "beam" effects and "ball" effects.
695 * The "r" parameter is the "distance from ground zero".
697 * Note that we determine if the player can "see" anything that happens
698 * by taking into account: blindness, line-of-sight, and illumination.
700 * We return "TRUE" if the effect of the projection is "obvious".
702 * We also "see" grids which are "memorized", probably a hack
704 * Perhaps we should affect doors?
707 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
709 cave_type *c_ptr = &cave[y][x];
710 feature_type *f_ptr = &f_info[c_ptr->feat];
712 bool obvious = FALSE;
713 bool known = player_has_los_bold(y, x);
718 /* Reduce damage by distance */
719 dam = (dam + r) / (r + 1);
722 if (have_flag(f_ptr->flags, FF_TREE))
730 message = _("枯れた", "was blasted."); break;
732 message = _("縮んだ", "shrank."); break;
734 message = _("溶けた", "melted."); break;
737 message = _("凍り、砕け散った", "was frozen and smashed."); break;
741 message = _("燃えた", "burns up!"); break;
753 message = _("粉砕された", "was crushed."); break;
755 message = NULL;break;
759 msg_format(_("木は%s。", "A tree %s"), message);
760 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
763 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
767 /* Analyze the type */
770 /* Ignore most effects */
805 /* Destroy Traps (and Locks) */
808 /* Reveal secret doors */
809 if (is_hidden_door(c_ptr))
814 /* Check line of sight */
822 if (is_trap(c_ptr->feat))
824 /* Check line of sight */
827 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
831 /* Destroy the trap */
832 cave_alter_feat(y, x, FF_DISARM);
835 /* Locked doors are unlocked */
836 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
838 s16b old_feat = c_ptr->feat;
840 /* Unlock the door */
841 cave_alter_feat(y, x, FF_DISARM);
843 /* Check line of sound */
844 if (known && (old_feat != c_ptr->feat))
846 msg_print(_("カチッと音がした!", "Click!"));
851 /* Remove "unsafe" flag if player is not blind */
852 if (!p_ptr->blind && player_has_los_bold(y, x))
854 c_ptr->info &= ~(CAVE_UNSAFE);
865 /* Destroy Doors (and traps) */
868 /* Destroy all doors and traps */
869 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
871 /* Check line of sight */
874 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
878 /* Destroy the feature */
879 cave_alter_feat(y, x, FF_TUNNEL);
882 /* Remove "unsafe" flag if player is not blind */
883 if (!p_ptr->blind && player_has_los_bold(y, x))
885 c_ptr->info &= ~(CAVE_UNSAFE);
896 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
898 if (have_flag(f_ptr->flags, FF_SPIKE))
900 s16b old_mimic = c_ptr->mimic;
901 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
903 cave_alter_feat(y, x, FF_SPIKE);
905 c_ptr->mimic = old_mimic;
912 /* Check line of sight */
913 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
915 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
922 /* Destroy walls (and doors) */
925 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
927 if (known && (c_ptr->info & (CAVE_MARK)))
929 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
933 /* Destroy the wall */
934 cave_alter_feat(y, x, FF_HURT_ROCK);
936 /* Update some things */
937 p_ptr->update |= (PU_FLOW);
946 /* Require a "naked" floor grid */
947 if (!cave_naked_bold(y, x)) break;
949 /* Not on the player */
950 if (player_bold(y, x)) break;
952 /* Create a closed door */
953 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
956 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
973 /* Require a "naked" floor grid */
974 if (!cave_naked_bold(y, x)) break;
976 /* Not on the player */
977 if (player_bold(y, x)) break;
979 /* Create a closed door */
980 cave_set_feat(y, x, feat_tree);
983 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
991 /* Require a "naked" floor grid */
992 if (!cave_naked_bold(y, x)) break;
995 c_ptr->info |= CAVE_OBJECT;
996 c_ptr->mimic = feat_glyph;
1008 /* Require a "naked" floor grid */
1009 if (!cave_naked_bold(y, x)) break;
1011 /* Not on the player */
1012 if (player_bold(y, x)) break;
1015 cave_set_feat(y, x, feat_granite);
1023 /* Ignore permanent grid */
1024 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1029 /* Ignore grid without enough space */
1030 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1032 /* Place a shallow lava */
1033 cave_set_feat(y, x, feat_shallow_lava);
1038 /* Place a deep lava */
1039 cave_set_feat(y, x, feat_deep_lava);
1046 /* Ignore permanent grid */
1047 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1052 /* Ignore grid without enough space */
1053 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1055 /* Place a shallow water */
1056 cave_set_feat(y, x, feat_shallow_water);
1061 /* Place a deep water */
1062 cave_set_feat(y, x, feat_deep_water);
1067 /* Lite up the grid */
1071 /* Turn on the light */
1072 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1074 c_ptr->info |= (CAVE_GLOW);
1081 update_local_illumination(y, x);
1084 if (player_can_see_bold(y, x)) obvious = TRUE;
1086 /* Mega-Hack -- Update the monster in the affected grid */
1087 /* This allows "spear of light" (etc) to work "correctly" */
1088 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1090 if (p_ptr->special_defense & NINJA_S_STEALTH)
1092 if (player_bold(y, x)) set_superstealth(FALSE);
1099 /* Darken the grid */
1103 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1106 /* Turn off the light. */
1109 if (dun_level || !is_daytime())
1111 for (j = 0; j < 9; j++)
1113 int by = y + ddy_ddd[j];
1114 int bx = x + ddx_ddd[j];
1116 if (in_bounds2(by, bx))
1118 cave_type *cc_ptr = &cave[by][bx];
1120 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1128 if (!do_dark) break;
1131 c_ptr->info &= ~(CAVE_GLOW);
1133 /* Hack -- Forget "boring" grids */
1134 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1137 c_ptr->info &= ~(CAVE_MARK);
1145 update_local_illumination(y, x);
1147 if (player_can_see_bold(y, x)) obvious = TRUE;
1149 /* Mega-Hack -- Update the monster in the affected grid */
1150 /* This allows "spear of light" (etc) to work "correctly" */
1151 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1161 if (is_mirror_grid(c_ptr))
1163 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1165 remove_mirror(y, x);
1166 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1169 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1171 if (known && (c_ptr->info & CAVE_MARK))
1173 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1177 /* Destroy the wall */
1178 cave_alter_feat(y, x, FF_HURT_ROCK);
1180 /* Update some things */
1181 p_ptr->update |= (PU_FLOW);
1188 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1190 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1192 remove_mirror(y, x);
1193 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1196 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1198 if (known && (c_ptr->info & CAVE_MARK))
1200 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1204 /* Destroy the wall */
1205 cave_alter_feat(y, x, FF_HURT_ROCK);
1207 /* Update some things */
1208 p_ptr->update |= (PU_FLOW);
1213 case GF_DISINTEGRATE:
1215 /* Destroy mirror/glyph */
1216 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1217 remove_mirror(y, x);
1219 /* Permanent features don't get effect */
1220 /* But not protect monsters and other objects */
1221 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1223 cave_alter_feat(y, x, FF_HURT_DISI);
1225 /* Update some things -- similar to GF_KILL_WALL */
1226 p_ptr->update |= (PU_FLOW);
1233 /* Return "Anything seen?" */
1240 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1241 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1242 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1243 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1244 * @param x 目標X座標 / Target x location (or location to travel "towards")
1245 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1246 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1247 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1250 * We are called from "project()" to "damage" objects
1252 * We are called both for "beam" effects and "ball" effects.
1254 * Perhaps we should only SOMETIMES damage things on the ground.
1256 * The "r" parameter is the "distance from ground zero".
1258 * Note that we determine if the player can "see" anything that happens
1259 * by taking into account: blindness, line-of-sight, and illumination.
1261 * We also "see" grids which are "memorized", probably a hack
1263 * We return "TRUE" if the effect of the projection is "obvious".
1266 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1268 cave_type *c_ptr = &cave[y][x];
1270 OBJECT_IDX this_o_idx, next_o_idx = 0;
1272 bool obvious = FALSE;
1273 bool known = player_has_los_bold(y, x);
1275 BIT_FLAGS flgs[TR_FLAG_SIZE];
1277 char o_name[MAX_NLEN];
1279 KIND_OBJECT_IDX k_idx = 0;
1280 bool is_potion = FALSE;
1283 who = who ? who : 0;
1285 /* Reduce damage by distance */
1286 dam = (dam + r) / (r + 1);
1289 /* Scan all objects in the grid */
1290 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1292 /* Acquire object */
1293 object_type *o_ptr = &o_list[this_o_idx];
1295 bool is_art = FALSE;
1296 bool ignore = FALSE;
1297 bool do_kill = FALSE;
1299 cptr note_kill = NULL;
1302 /* Get the "plural"-ness */
1303 bool plural = (o_ptr->number > 1);
1306 /* Acquire next object */
1307 next_o_idx = o_ptr->next_o_idx;
1309 /* Extract the flags */
1310 object_flags(o_ptr, flgs);
1312 /* Check for artifact */
1313 if (object_is_artifact(o_ptr)) is_art = TRUE;
1315 /* Analyze the type */
1318 /* Acid -- Lots of things */
1321 if (hates_acid(o_ptr))
1324 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1325 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1330 /* Elec -- Rings and Wands */
1333 if (hates_elec(o_ptr))
1336 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1337 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1342 /* Fire -- Flammable objects */
1345 if (hates_fire(o_ptr))
1348 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1349 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1354 /* Cold -- potions and flasks */
1357 if (hates_cold(o_ptr))
1359 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1361 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1369 if (hates_fire(o_ptr))
1372 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1373 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1375 if (hates_elec(o_ptr))
1379 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1380 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1388 if (hates_fire(o_ptr))
1391 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1392 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1394 if (hates_cold(o_ptr))
1398 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1399 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1404 /* Hack -- break potions and such */
1410 if (hates_cold(o_ptr))
1412 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1418 /* Mana and Chaos -- destroy everything */
1424 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1428 case GF_DISINTEGRATE:
1431 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1438 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1439 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1440 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1444 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1448 if (object_is_cursed(o_ptr))
1451 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1458 identify_item(o_ptr);
1460 /* Auto-inscription */
1461 autopick_alter_item((-this_o_idx), FALSE);
1469 /* Chests are noticed only if trapped or locked */
1470 if (o_ptr->tval == TV_CHEST)
1472 /* Disarm/Unlock traps */
1473 if (o_ptr->pval > 0)
1475 /* Disarm or Unlock */
1476 o_ptr->pval = (0 - o_ptr->pval);
1479 object_known(o_ptr);
1481 if (known && (o_ptr->marked & OM_FOUND))
1483 msg_print(_("カチッと音がした!", "Click!"));
1493 if (o_ptr->tval == TV_CORPSE)
1496 BIT_FLAGS mode = 0L;
1498 if (!who || is_pet(&m_list[who]))
1499 mode |= PM_FORCE_PET;
1501 for (i = 0; i < o_ptr->number ; i++)
1503 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1504 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1508 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1512 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1514 note_kill = _("生き返った。", " revived.");
1516 else if (!note_kill)
1518 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1529 /* Attempt to destroy the object */
1532 /* Effect "observed" */
1533 if (known && (o_ptr->marked & OM_FOUND))
1536 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1539 /* Artifacts, and other objects, get to resist */
1540 if (is_art || ignore)
1542 /* Observe the resist */
1543 if (known && (o_ptr->marked & OM_FOUND))
1545 msg_format(_("%sは影響を受けない!",
1546 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1553 /* Describe if needed */
1554 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1556 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1559 k_idx = o_ptr->k_idx;
1560 is_potion = object_is_potion(o_ptr);
1563 /* Delete the object */
1564 delete_object_idx(this_o_idx);
1566 /* Potions produce effects when 'shattered' */
1569 (void)potion_smash_effect(who, y, x, k_idx);
1578 /* Return "Anything seen?" */
1584 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1585 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1586 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1587 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1588 * @param x 目標X座標 / Target x location (or location to travel "towards")
1589 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1590 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1592 * @param see_s_msg TRUEならばメッセージを表示する
1593 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1596 * This routine takes a "source monster" (by index) which is mostly used to
1597 * determine if the player is causing the damage, and a "radius" (see below),
1598 * which is used to decrease the power of explosions with distance, and a
1599 * location, via integers which are modified by certain types of attacks
1600 * (polymorph and teleport being the obvious ones), a default damage, which
1601 * is modified as needed based on various properties, and finally a "damage
1602 * type" (see below).
1605 * Note that this routine can handle "no damage" attacks (like teleport) by
1606 * taking a "zero" damage, and can even take "parameters" to attacks (like
1607 * confuse) by accepting a "damage", using it to calculate the effect, and
1608 * then setting the damage to zero. Note that the "damage" parameter is
1609 * divided by the radius, so monsters not at the "epicenter" will not take
1610 * as much damage (or whatever)...
1613 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1614 * may result in a dereference of an invalid pointer.
1617 * Various messages are produced, and damage is applied.
1620 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1621 * actually be "made" of that substance, or "breathe" big balls of it.
1622 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1624 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1625 * and hurts evil less. If can breath nether, then it resists it as well.
1628 * Damage reductions use the following formulas:
1629 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1630 * gives avg damage of .655, ranging from .858 to .500
1631 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1632 * gives avg damage of .544, ranging from .714 to .417
1633 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1634 * gives avg damage of .444, ranging from .556 to .333
1635 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1636 * gives avg damage of .327, ranging from .427 to .250
1637 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1638 * gives something simple.
1641 * In this function, "result" messages are postponed until the end, where
1642 * the "note" string is appended to the monster name, if not NULL. So,
1643 * to make a spell have "no effect" just set "note" to NULL. You should
1644 * also set "notice" to FALSE, or the player will learn what the spell does.
1647 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1651 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)
1655 cave_type *c_ptr = &cave[y][x];
1657 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1658 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1660 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1664 /* Is the monster "seen"? */
1665 bool seen = m_ptr->ml;
1666 bool seen_msg = is_seen(m_ptr);
1668 bool slept = (bool)MON_CSLEEP(m_ptr);
1670 /* Were the effects "obvious" (if seen)? */
1671 bool obvious = FALSE;
1673 /* Can the player know about this effect? */
1674 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1676 /* Were the effects "irrelevant"? */
1677 bool skipped = FALSE;
1679 /* Gets the monster angry at the source of the effect? */
1680 bool get_angry = FALSE;
1682 /* Polymorph setting (true or false) */
1683 bool do_poly = FALSE;
1685 /* Teleport setting (max distance) */
1688 /* Confusion setting (amount to confuse) */
1691 /* Stunning setting (amount to stun) */
1694 /* Sleep amount (amount to sleep) */
1697 /* Fear amount (amount to fear) */
1700 /* Time amount (amount to time) */
1703 bool heal_leper = FALSE;
1705 /* Hold the monster name */
1709 PARAMETER_VALUE photo = 0;
1711 /* Assume no note */
1714 /* Assume a default death */
1715 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1720 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1723 if (!c_ptr->m_idx) return (FALSE);
1725 /* Never affect projector */
1726 if (who && (c_ptr->m_idx == who)) return (FALSE);
1727 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1728 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1730 /* Don't affect already death monsters */
1731 /* Prevents problems with chain reactions of exploding monsters */
1732 if (m_ptr->hp < 0) return (FALSE);
1734 /* Reduce damage by distance */
1735 dam = (dam + r) / (r + 1);
1738 /* Get the monster name (BEFORE polymorphing) */
1739 monster_desc(m_name, m_ptr, 0);
1741 /* Get the monster possessive ("his"/"her"/"its") */
1742 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1744 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1746 /* Analyze the damage type */
1749 /* Magic Missile -- pure damage */
1752 if (seen) obvious = TRUE;
1754 if (r_ptr->flagsr & RFR_RES_ALL)
1756 note = _("には完全な耐性がある!", " is immune.");
1758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1767 if (seen) obvious = TRUE;
1769 if (r_ptr->flagsr & RFR_RES_ALL)
1771 note = _("には完全な耐性がある!", " is immune.");
1773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1776 if (r_ptr->flagsr & RFR_IM_ACID)
1778 note = _("にはかなり耐性がある!", " resists a lot.");
1780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1788 if (seen) obvious = TRUE;
1790 if (r_ptr->flagsr & RFR_RES_ALL)
1792 note = _("には完全な耐性がある!", " is immune.");
1794 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1797 if (r_ptr->flagsr & RFR_IM_ELEC)
1799 note = _("にはかなり耐性がある!", " resists a lot.");
1801 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1809 if (seen) obvious = TRUE;
1811 if (r_ptr->flagsr & RFR_RES_ALL)
1813 note = _("には完全な耐性がある!", " is immune.");
1815 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1818 if (r_ptr->flagsr & RFR_IM_FIRE)
1820 note = _("にはかなり耐性がある!", " resists a lot.");
1822 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1824 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1826 note = _("はひどい痛手をうけた。", " is hit hard.");
1828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1836 if (seen) obvious = TRUE;
1838 if (r_ptr->flagsr & RFR_RES_ALL)
1840 note = _("には完全な耐性がある!", " is immune.");
1842 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1845 if (r_ptr->flagsr & RFR_IM_COLD)
1847 note = _("にはかなり耐性がある!", " resists a lot.");
1849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1851 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1853 note = _("はひどい痛手をうけた。", " is hit hard.");
1855 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1863 if (seen) obvious = TRUE;
1865 if (r_ptr->flagsr & RFR_RES_ALL)
1867 note = _("には完全な耐性がある!", " is immune.");
1869 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1872 if (r_ptr->flagsr & RFR_IM_POIS)
1874 note = _("にはかなり耐性がある!", " resists a lot.");
1876 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1884 if (seen) obvious = TRUE;
1886 if (r_ptr->flagsr & RFR_RES_ALL)
1888 note = _("には完全な耐性がある!", " is immune.");
1890 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1893 if (r_ptr->flagsr & RFR_IM_POIS)
1895 note = _("には耐性がある。", " resists.");
1896 dam *= 3; dam /= randint1(6) + 6;
1897 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1899 else if (one_in_(3)) do_poly = TRUE;
1903 /* Hellfire -- hurts Evil */
1906 if (seen) obvious = TRUE;
1908 if (r_ptr->flagsr & RFR_RES_ALL)
1910 note = _("には完全な耐性がある!", " is immune.");
1912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1915 if (r_ptr->flags3 & RF3_GOOD)
1917 note = _("はひどい痛手をうけた。", " is hit hard.");
1919 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1924 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1927 if (seen) obvious = TRUE;
1929 if (r_ptr->flagsr & RFR_RES_ALL)
1931 note = _("には完全な耐性がある!", " is immune.");
1933 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1936 if (r_ptr->flags3 & RF3_GOOD)
1938 note = _("には完全な耐性がある!", " is immune.");
1940 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1942 else if (r_ptr->flags3 & RF3_EVIL)
1945 note = _("はひどい痛手をうけた。", " is hit hard.");
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1950 note = _("には耐性がある。", " resists.");
1951 dam *= 3; dam /= randint1(6) + 6;
1956 /* Arrow -- XXX no defense */
1959 if (seen) obvious = TRUE;
1961 if (r_ptr->flagsr & RFR_RES_ALL)
1963 note = _("には完全な耐性がある!", " is immune.");
1965 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1971 /* Plasma -- XXX perhaps check ELEC or FIRE */
1974 if (seen) obvious = TRUE;
1976 if (r_ptr->flagsr & RFR_RES_ALL)
1978 note = _("には完全な耐性がある!", " is immune.");
1980 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1983 if (r_ptr->flagsr & RFR_RES_PLAS)
1985 note = _("には耐性がある。", " resists.");
1986 dam *= 3; dam /= randint1(6) + 6;
1987 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1992 /* Nether -- see above */
1995 if (seen) obvious = TRUE;
1997 if (r_ptr->flagsr & RFR_RES_ALL)
1999 note = _("には完全な耐性がある!", " is immune.");
2001 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2004 if (r_ptr->flagsr & RFR_RES_NETH)
2006 if (r_ptr->flags3 & RF3_UNDEAD)
2008 note = _("には完全な耐性がある!", " is immune.");
2010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2014 note = _("には耐性がある。", " resists.");
2015 dam *= 3; dam /= randint1(6) + 6;
2017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2019 else if (r_ptr->flags3 & RF3_EVIL)
2021 note = _("はいくらか耐性を示した。", " resists somewhat.");
2023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2028 /* Water (acid) damage -- Water spirits/elementals are immune */
2031 if (seen) obvious = TRUE;
2033 if (r_ptr->flagsr & RFR_RES_ALL)
2035 note = _("には完全な耐性がある!", " is immune.");
2037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2040 if (r_ptr->flagsr & RFR_RES_WATE)
2042 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2044 note = _("には完全な耐性がある!", " is immune.");
2049 note = _("には耐性がある。", " resists.");
2050 dam *= 3; dam /= randint1(6) + 6;
2052 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2057 /* Chaos -- Chaos breathers resist */
2060 if (seen) obvious = TRUE;
2062 if (r_ptr->flagsr & RFR_RES_ALL)
2064 note = _("には完全な耐性がある!", " is immune.");
2066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2069 if (r_ptr->flagsr & RFR_RES_CHAO)
2071 note = _("には耐性がある。", " resists.");
2072 dam *= 3; dam /= randint1(6) + 6;
2073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2075 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2077 note = _("はいくらか耐性を示した。", " resists somewhat.");
2078 dam *= 3; dam /= randint1(6) + 6;
2079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2084 do_conf = (5 + randint1(11) + r) / (r + 1);
2089 /* Shards -- Shard breathers resist */
2092 if (seen) obvious = TRUE;
2094 if (r_ptr->flagsr & RFR_RES_ALL)
2096 note = _("には完全な耐性がある!", " is immune.");
2098 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2101 if (r_ptr->flagsr & RFR_RES_SHAR)
2103 note = _("には耐性がある。", " resists.");
2104 dam *= 3; dam /= randint1(6) + 6;
2105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2110 /* Rocket: Shard resistance helps */
2113 if (seen) obvious = TRUE;
2115 if (r_ptr->flagsr & RFR_RES_ALL)
2117 note = _("には完全な耐性がある!", " is immune.");
2119 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2122 if (r_ptr->flagsr & RFR_RES_SHAR)
2124 note = _("はいくらか耐性を示した。", " resists somewhat.");
2126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2132 /* Sound -- Sound breathers resist */
2135 if (seen) obvious = TRUE;
2137 if (r_ptr->flagsr & RFR_RES_ALL)
2139 note = _("には完全な耐性がある!", " is immune.");
2141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2144 if (r_ptr->flagsr & RFR_RES_SOUN)
2146 note = _("には耐性がある。", " resists.");
2147 dam *= 2; dam /= randint1(6) + 6;
2148 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2150 else do_stun = (10 + randint1(15) + r) / (r + 1);
2157 if (seen) obvious = TRUE;
2159 if (r_ptr->flagsr & RFR_RES_ALL)
2161 note = _("には完全な耐性がある!", " is immune.");
2163 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2166 if (r_ptr->flags3 & RF3_NO_CONF)
2168 note = _("には耐性がある。", " resists.");
2169 dam *= 3; dam /= randint1(6) + 6;
2170 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2172 else do_conf = (10 + randint1(15) + r) / (r + 1);
2176 /* Disenchantment -- Breathers and Disenchanters resist */
2179 if (seen) obvious = TRUE;
2181 if (r_ptr->flagsr & RFR_RES_ALL)
2183 note = _("には完全な耐性がある!", " is immune.");
2185 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2188 if (r_ptr->flagsr & RFR_RES_DISE)
2190 note = _("には耐性がある。", " resists.");
2191 dam *= 3; dam /= randint1(6) + 6;
2192 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2197 /* Nexus -- Breathers and Existers resist */
2200 if (seen) obvious = TRUE;
2202 if (r_ptr->flagsr & RFR_RES_ALL)
2204 note = _("には完全な耐性がある!", " is immune.");
2206 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2209 if (r_ptr->flagsr & RFR_RES_NEXU)
2211 note = _("には耐性がある。", " resists.");
2212 dam *= 3; dam /= randint1(6) + 6;
2213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2221 if (seen) obvious = TRUE;
2223 if (r_ptr->flagsr & RFR_RES_ALL)
2225 note = _("には完全な耐性がある!", " is immune.");
2227 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2230 if (r_ptr->flagsr & RFR_RES_WALL)
2232 note = _("には耐性がある。", " resists.");
2233 dam *= 3; dam /= randint1(6) + 6;
2234 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2236 else do_stun = (randint1(15) + r) / (r + 1);
2240 /* Inertia -- breathers resist */
2243 if (seen) obvious = TRUE;
2245 if (r_ptr->flagsr & RFR_RES_ALL)
2247 note = _("には完全な耐性がある!", " is immune.");
2249 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2252 if (r_ptr->flagsr & RFR_RES_INER)
2254 note = _("には耐性がある。", " resists.");
2255 dam *= 3; dam /= randint1(6) + 6;
2256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2260 /* Powerful monsters can resist */
2261 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2262 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2266 /* Normal monsters slow down */
2269 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2271 note = _("の動きが遅くなった。", " starts moving slower.");
2278 /* Time -- breathers resist */
2281 if (seen) obvious = TRUE;
2283 if (r_ptr->flagsr & RFR_RES_ALL)
2285 note = _("には完全な耐性がある!", " is immune.");
2287 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2290 if (r_ptr->flagsr & RFR_RES_TIME)
2292 note = _("には耐性がある。", " resists.");
2293 dam *= 3; dam /= randint1(6) + 6;
2294 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2296 else do_time = (dam + 1) / 2;
2300 /* Gravity -- breathers resist */
2303 bool resist_tele = FALSE;
2305 if (seen) obvious = TRUE;
2307 if (r_ptr->flagsr & RFR_RES_ALL)
2309 note = _("には完全な耐性がある!", " is immune.");
2311 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2314 if (r_ptr->flagsr & RFR_RES_TELE)
2316 if (r_ptr->flags1 & (RF1_UNIQUE))
2318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2319 note = _("には効果がなかった。", " is unaffected!");
2322 else if (r_ptr->level > randint1(100))
2324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2325 note = _("には耐性がある!", " resists!");
2330 if (!resist_tele) do_dist = 10;
2332 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2334 if (r_ptr->flagsr & RFR_RES_GRAV)
2336 note = _("には耐性がある!", " resists!");
2337 dam *= 3; dam /= randint1(6) + 6;
2339 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2344 /* Powerful monsters can resist */
2345 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2346 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2350 /* Normal monsters slow down */
2353 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2355 note = _("の動きが遅くなった。", " starts moving slower.");
2360 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2362 /* Attempt a saving throw */
2363 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2364 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2368 /* No obvious effect */
2369 note = _("には効果がなかった。", " is unaffected!");
2381 if (seen) obvious = TRUE;
2383 if (r_ptr->flagsr & RFR_RES_ALL)
2385 note = _("には完全な耐性がある!", " is immune.");
2387 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2395 case GF_DISINTEGRATE:
2397 if (seen) obvious = TRUE;
2399 if (r_ptr->flagsr & RFR_RES_ALL)
2401 note = _("には完全な耐性がある!", " is immune.");
2403 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2406 if (r_ptr->flags3 & RF3_HURT_ROCK)
2408 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2409 note = _("の皮膚がただれた!", " loses some skin!");
2410 note_dies = _("は蒸発した!", " evaporates!");
2418 if (seen) obvious = TRUE;
2420 /* PSI only works if the monster can see you! -- RG */
2421 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2424 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2429 if (r_ptr->flagsr & RFR_RES_ALL)
2431 note = _("には完全な耐性がある!", " is immune.");
2433 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2436 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2439 note = _("には完全な耐性がある!", " is immune.");
2440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2443 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2444 (r_ptr->flags3 & RF3_ANIMAL) ||
2445 (r_ptr->level > randint1(3 * dam)))
2447 note = _("には耐性がある!", " resists!");
2451 * Powerful demons & undead can turn a mindcrafter's
2452 * attacks back on them
2454 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2455 (r_ptr->level > p_ptr->lev / 2) &&
2459 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2460 (seen ? "%^s's corrupted mind backlashes your attack!" :
2461 "%^ss corrupted mind backlashes your attack!")), m_name);
2464 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2466 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2470 /* Injure +/- confusion */
2471 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2472 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2473 if (one_in_(4) && !CHECK_MULTISHADOW())
2475 switch (randint1(4))
2478 set_confused(p_ptr->confused + 3 + randint1(dam));
2481 set_stun(p_ptr->stun + randint1(dam));
2485 if (r_ptr->flags3 & RF3_NO_FEAR)
2486 note = _("には効果がなかった。", " is unaffected.");
2488 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2492 if (!p_ptr->free_act)
2493 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2502 if ((dam > 0) && one_in_(4))
2504 switch (randint1(4))
2507 do_conf = 3 + randint1(dam);
2510 do_stun = 3 + randint1(dam);
2513 do_fear = 3 + randint1(dam);
2516 note = _("は眠り込んでしまった!", " falls asleep!");
2517 do_sleep = 3 + randint1(dam);
2522 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2528 if (seen) obvious = TRUE;
2530 if (r_ptr->flagsr & RFR_RES_ALL)
2532 note = _("には完全な耐性がある!", " is immune.");
2534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2537 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2540 note = _("には完全な耐性がある!", " is immune.");
2542 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2543 (r_ptr->flags3 & RF3_ANIMAL) ||
2544 (r_ptr->level > randint1(3 * dam)))
2546 note = _("には耐性がある!", " resists!");
2550 * Powerful demons & undead can turn a mindcrafter's
2551 * attacks back on them
2553 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2554 (r_ptr->level > p_ptr->lev / 2) &&
2558 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2559 (seen ? "%^s's corrupted mind backlashes your attack!" :
2560 "%^ss corrupted mind backlashes your attack!")), m_name);
2562 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2564 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2568 /* Injure + mana drain */
2569 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2570 if (!CHECK_MULTISHADOW())
2572 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2573 p_ptr->csp -= damroll(5, dam) / 2;
2574 if (p_ptr->csp < 0) p_ptr->csp = 0;
2575 p_ptr->redraw |= PR_MANA;
2576 p_ptr->window |= (PW_SPELL);
2578 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2585 int b = damroll(5, dam) / 4;
2586 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2587 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2588 (seen ? "You convert %s's pain into %s!" :
2589 "You convert %ss pain into %s!"));
2590 msg_format(msg, m_name, str);
2592 b = MIN(p_ptr->msp, p_ptr->csp + b);
2594 p_ptr->redraw |= PR_MANA;
2595 p_ptr->window |= (PW_SPELL);
2597 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2601 case GF_TELEKINESIS:
2603 if (seen) obvious = TRUE;
2605 if (r_ptr->flagsr & RFR_RES_ALL)
2607 note = _("には完全な耐性がある!", " is immune.");
2609 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2614 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2619 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2621 /* Attempt a saving throw */
2622 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2623 (r_ptr->level > 5 + randint1(dam)))
2627 /* No obvious effect */
2633 /* Psycho-spear -- powerful magic missile */
2636 if (seen) obvious = TRUE;
2638 if (r_ptr->flagsr & RFR_RES_ALL)
2640 note = _("には完全な耐性がある!", " is immune.");
2642 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2648 /* Meteor -- powerful magic missile */
2651 if (seen) obvious = TRUE;
2653 if (r_ptr->flagsr & RFR_RES_ALL)
2655 note = _("には完全な耐性がある!", " is immune.");
2657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2665 if (!is_hostile(m_ptr)) break;
2667 if (seen) obvious = TRUE;
2669 if (r_ptr->flagsr & RFR_RES_ALL)
2671 note = _("には効果がなかった!", " is immune.");
2673 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2676 /* Attempt a saving throw */
2677 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2678 (r_ptr->flags3 & RF3_NO_CONF) ||
2679 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2681 /* Memorize a flag */
2682 if (r_ptr->flags3 & RF3_NO_CONF)
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2691 * Powerful demons & undead can turn a mindcrafter's
2692 * attacks back on them
2694 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2695 (r_ptr->level > p_ptr->lev / 2) &&
2699 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2700 (seen ? "%^s's corrupted mind backlashes your attack!" :
2701 "%^ss corrupted mind backlashes your attack!")), m_name);
2704 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2706 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2710 /* Confuse, stun, terrify */
2711 switch (randint1(4))
2714 set_stun(p_ptr->stun + dam / 2);
2717 set_confused(p_ptr->confused + dam / 2);
2721 if (r_ptr->flags3 & RF3_NO_FEAR)
2722 note = _("には効果がなかった。", " is unaffected.");
2724 set_afraid(p_ptr->afraid + dam);
2731 /* No obvious effect */
2732 note = _("には効果がなかった。", " is unaffected.");
2738 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2740 note = _("があなたに隷属した。", " is in your thrall!");
2745 switch (randint1(4))
2759 /* No "real" damage */
2766 /* Ice -- Cold + Cuts + Stun */
2769 if (seen) obvious = TRUE;
2771 if (r_ptr->flagsr & RFR_RES_ALL)
2773 note = _("には完全な耐性がある!", " is immune.");
2775 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2778 do_stun = (randint1(15) + 1) / (r + 1);
2779 if (r_ptr->flagsr & RFR_IM_COLD)
2781 note = _("にはかなり耐性がある!", " resists a lot.");
2783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2785 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2787 note = _("はひどい痛手をうけた。", " is hit hard.");
2789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2796 case GF_HYPODYNAMIA:
2798 if (seen) obvious = TRUE;
2800 if (r_ptr->flagsr & RFR_RES_ALL)
2802 note = _("には完全な耐性がある!", " is immune.");
2804 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2807 if (!monster_living(r_ptr))
2809 if (is_original_ap_and_seen(m_ptr))
2811 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2812 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2813 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2815 note = _("には効果がなかった。", " is unaffected.");
2819 else do_time = (dam+7)/8;
2827 if (seen) obvious = TRUE;
2829 if (r_ptr->flagsr & RFR_RES_ALL)
2831 note = _("には完全な耐性がある!", " is immune.");
2833 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2836 if (!monster_living(r_ptr))
2838 if (is_original_ap_and_seen(m_ptr))
2840 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2841 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2842 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2844 note = _("には完全な耐性がある!", " is immune.");
2848 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2849 (randint1(888) != 666)) ||
2850 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2851 randint1(100) != 66))
2853 note = _("には耐性がある!", " resists!");
2861 /* Polymorph monster (Use "dam" as "power") */
2864 if (seen) obvious = TRUE;
2866 if (r_ptr->flagsr & RFR_RES_ALL)
2868 note = _("には効果がなかった。", " is unaffected.");
2870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2873 /* Attempt to polymorph (see below) */
2876 /* Powerful monsters can resist */
2877 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2878 (r_ptr->flags1 & RF1_QUESTOR) ||
2879 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2881 note = _("には効果がなかった。", " is unaffected.");
2886 /* No "real" damage */
2893 /* Clone monsters (Ignore "dam") */
2896 if (seen) obvious = TRUE;
2898 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2900 note = _("には効果がなかった。", " is unaffected.");
2905 m_ptr->hp = m_ptr->maxhp;
2907 /* Attempt to clone. */
2908 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2910 note = _("が分裂した!", " spawns!");
2914 /* No "real" damage */
2921 /* Heal Monster (use "dam" as amount of healing) */
2924 if (seen) obvious = TRUE;
2927 (void)set_monster_csleep(c_ptr->m_idx, 0);
2929 if (m_ptr->maxhp < m_ptr->max_maxhp)
2931 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2932 m_ptr->maxhp = m_ptr->max_maxhp;
2937 /* Redraw (later) if needed */
2938 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2939 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2947 if (seen) obvious = TRUE;
2950 (void)set_monster_csleep(c_ptr->m_idx, 0);
2951 if (MON_STUNNED(m_ptr))
2953 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2954 (void)set_monster_stunned(c_ptr->m_idx, 0);
2956 if (MON_CONFUSED(m_ptr))
2958 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2959 (void)set_monster_confused(c_ptr->m_idx, 0);
2961 if (MON_MONFEAR(m_ptr))
2963 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2964 (void)set_monster_monfear(c_ptr->m_idx, 0);
2968 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2971 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2975 chg_virtue(V_VITALITY, 1);
2977 if (r_ptr->flags1 & RF1_UNIQUE)
2978 chg_virtue(V_INDIVIDUALISM, 1);
2980 if (is_friendly(m_ptr))
2981 chg_virtue(V_HONOUR, 1);
2982 else if (!(r_ptr->flags3 & RF3_EVIL))
2984 if (r_ptr->flags3 & RF3_GOOD)
2985 chg_virtue(V_COMPASSION, 2);
2987 chg_virtue(V_COMPASSION, 1);
2990 if (r_ptr->flags3 & RF3_ANIMAL)
2991 chg_virtue(V_NATURE, 1);
2994 if (m_ptr->r_idx == MON_LEPER)
2997 if (!who) chg_virtue(V_COMPASSION, 5);
3000 /* Redraw (later) if needed */
3001 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3002 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3004 note = _("は体力を回復したようだ。", " looks healthier.");
3006 /* No "real" damage */
3012 /* Speed Monster (Ignore "dam") */
3015 if (seen) obvious = TRUE;
3018 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3020 note = _("の動きが速くなった。", " starts moving faster.");
3025 if (r_ptr->flags1 & RF1_UNIQUE)
3026 chg_virtue(V_INDIVIDUALISM, 1);
3027 if (is_friendly(m_ptr))
3028 chg_virtue(V_HONOUR, 1);
3031 /* No "real" damage */
3037 /* Slow Monster (Use "dam" as "power") */
3040 if (seen) obvious = TRUE;
3042 if (r_ptr->flagsr & RFR_RES_ALL)
3044 note = _("には効果がなかった。", " is unaffected.");
3046 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3049 /* Powerful monsters can resist */
3050 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3051 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3053 note = _("には効果がなかった。", " is unaffected.");
3057 /* Normal monsters slow down */
3060 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3062 note = _("の動きが遅くなった。", " starts moving slower.");
3066 /* No "real" damage */
3072 /* Sleep (Use "dam" as "power") */
3075 if (seen) obvious = TRUE;
3077 if (r_ptr->flagsr & RFR_RES_ALL)
3079 note = _("には効果がなかった。", " is unaffected.");
3081 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3084 /* Attempt a saving throw */
3085 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3086 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3087 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3089 /* Memorize a flag */
3090 if (r_ptr->flags3 & RF3_NO_SLEEP)
3092 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3094 /* No obvious effect */
3095 note = _("には効果がなかった。", " is unaffected.");
3100 /* Go to sleep (much) later */
3101 note = _("は眠り込んでしまった!", " falls asleep!");
3105 /* No "real" damage */
3111 /* Sleep (Use "dam" as "power") */
3112 case GF_STASIS_EVIL:
3114 if (seen) obvious = TRUE;
3116 if (r_ptr->flagsr & RFR_RES_ALL)
3118 note = _("には効果がなかった!", " is immune.");
3120 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3123 /* Attempt a saving throw */
3124 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3125 !(r_ptr->flags3 & RF3_EVIL) ||
3126 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3128 note = _("には効果がなかった。", " is unaffected.");
3133 /* Go to sleep (much) later */
3134 note = _("は動けなくなった!", " is suspended!");
3138 /* No "real" damage */
3143 /* Sleep (Use "dam" as "power") */
3146 if (seen) obvious = TRUE;
3148 if (r_ptr->flagsr & RFR_RES_ALL)
3150 note = _("には効果がなかった。", " is unaffected.");
3152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3155 /* Attempt a saving throw */
3156 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3157 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3159 note = _("には効果がなかった。", " is unaffected.");
3164 /* Go to sleep (much) later */
3165 note = _("は動けなくなった!", " is suspended!");
3169 /* No "real" damage */
3178 vir = virtue_number(V_HARMONY);
3181 dam += p_ptr->virtues[vir-1]/10;
3184 vir = virtue_number(V_INDIVIDUALISM);
3187 dam -= p_ptr->virtues[vir-1]/20;
3190 if (seen) obvious = TRUE;
3192 /* Attempt a saving throw */
3193 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3197 /* No obvious effect */
3198 note = _("には効果がなかった。", " is unaffected.");
3201 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3203 else if (p_ptr->cursed & TRC_AGGRAVATE)
3205 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3206 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3210 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3213 chg_virtue(V_INDIVIDUALISM, -1);
3214 if (r_ptr->flags3 & RF3_ANIMAL)
3215 chg_virtue(V_NATURE, 1);
3218 /* No "real" damage */
3223 /* Control undead */
3224 case GF_CONTROL_UNDEAD:
3227 if (seen) obvious = TRUE;
3229 vir = virtue_number(V_UNLIFE);
3232 dam += p_ptr->virtues[vir-1]/10;
3235 vir = virtue_number(V_INDIVIDUALISM);
3238 dam -= p_ptr->virtues[vir-1]/20;
3241 /* Attempt a saving throw */
3242 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3243 !(r_ptr->flags3 & RF3_UNDEAD))
3245 /* No obvious effect */
3246 note = _("には効果がなかった。", " is unaffected.");
3248 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3250 else if (p_ptr->cursed & TRC_AGGRAVATE)
3252 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3253 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3257 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3261 /* No "real" damage */
3267 case GF_CONTROL_DEMON:
3270 if (seen) obvious = TRUE;
3272 vir = virtue_number(V_UNLIFE);
3275 dam += p_ptr->virtues[vir-1]/10;
3278 vir = virtue_number(V_INDIVIDUALISM);
3281 dam -= p_ptr->virtues[vir-1]/20;
3284 /* Attempt a saving throw */
3285 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3286 !(r_ptr->flags3 & RF3_DEMON))
3288 /* No obvious effect */
3289 note = _("には効果がなかった。", " is unaffected.");
3291 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3293 else if (p_ptr->cursed & TRC_AGGRAVATE)
3295 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3296 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3300 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3304 /* No "real" damage */
3310 case GF_CONTROL_ANIMAL:
3313 if (seen) obvious = TRUE;
3315 vir = virtue_number(V_NATURE);
3318 dam += p_ptr->virtues[vir-1]/10;
3321 vir = virtue_number(V_INDIVIDUALISM);
3324 dam -= p_ptr->virtues[vir-1]/20;
3327 /* Attempt a saving throw */
3328 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3329 !(r_ptr->flags3 & RF3_ANIMAL))
3332 /* No obvious effect */
3333 note = _("には効果がなかった。", " is unaffected.");
3335 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3337 else if (p_ptr->cursed & TRC_AGGRAVATE)
3339 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3340 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3344 note = _("はなついた。", " is tamed!");
3346 if (r_ptr->flags3 & RF3_ANIMAL)
3347 chg_virtue(V_NATURE, 1);
3350 /* No "real" damage */
3356 case GF_CHARM_LIVING:
3360 vir = virtue_number(V_UNLIFE);
3361 if (seen) obvious = TRUE;
3363 vir = virtue_number(V_UNLIFE);
3366 dam -= p_ptr->virtues[vir-1]/10;
3369 vir = virtue_number(V_INDIVIDUALISM);
3372 dam -= p_ptr->virtues[vir-1]/20;
3375 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3377 /* Attempt a saving throw */
3378 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3379 !monster_living(r_ptr))
3382 /* No obvious effect */
3383 note = _("には効果がなかった。", " is unaffected.");
3385 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3387 else if (p_ptr->cursed & TRC_AGGRAVATE)
3389 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3390 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3394 note = _("を支配した。", " is tamed!");
3396 if (r_ptr->flags3 & RF3_ANIMAL)
3397 chg_virtue(V_NATURE, 1);
3400 /* No "real" damage */
3405 /* Confusion (Use "dam" as "power") */
3408 if (seen) obvious = TRUE;
3410 if (r_ptr->flagsr & RFR_RES_ALL)
3412 note = _("には効果がなかった。", " is unaffected.");
3414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3417 /* Get confused later */
3418 do_conf = damroll(3, (dam / 2)) + 1;
3420 /* Attempt a saving throw */
3421 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3422 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3423 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3425 /* Memorize a flag */
3426 if (r_ptr->flags3 & (RF3_NO_CONF))
3428 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3434 /* No obvious effect */
3435 note = _("には効果がなかった。", " is unaffected.");
3439 /* No "real" damage */
3446 if (seen) obvious = TRUE;
3448 if (r_ptr->flagsr & RFR_RES_ALL)
3450 note = _("には効果がなかった。", " is unaffected.");
3452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3455 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3457 /* Attempt a saving throw */
3458 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3459 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3464 /* No obvious effect */
3465 note = _("には効果がなかった。", " is unaffected.");
3469 /* No "real" damage */
3477 /* Lite, but only hurts susceptible creatures */
3485 if (r_ptr->flagsr & RFR_RES_ALL)
3491 if (r_ptr->flags3 & (RF3_HURT_LITE))
3493 /* Obvious effect */
3494 if (seen) obvious = TRUE;
3496 /* Memorize the effects */
3497 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3499 /* Special effect */
3500 note = _("は光に身をすくめた!", " cringes from the light!");
3501 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3504 /* Normally no damage */
3516 /* Lite -- opposite of Dark */
3519 if (seen) obvious = TRUE;
3521 if (r_ptr->flagsr & RFR_RES_ALL)
3523 note = _("には完全な耐性がある!", " is immune.");
3525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3528 if (r_ptr->flagsr & RFR_RES_LITE)
3530 note = _("には耐性がある!", " resists!");
3531 dam *= 2; dam /= (randint1(6)+6);
3532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3534 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3537 note = _("は光に身をすくめた!", " cringes from the light!");
3538 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3545 /* Dark -- opposite of Lite */
3548 if (seen) obvious = TRUE;
3550 if (r_ptr->flagsr & RFR_RES_ALL)
3552 note = _("には完全な耐性がある!", " is immune.");
3554 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3557 if (r_ptr->flagsr & RFR_RES_DARK)
3559 note = _("には耐性がある!", " resists!");
3560 dam *= 2; dam /= (randint1(6)+6);
3561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3570 if (r_ptr->flagsr & RFR_RES_ALL)
3575 /* Hurt by rock remover */
3576 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3579 if (seen) obvious = TRUE;
3581 /* Memorize the effects */
3582 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3584 /* Cute little message */
3585 note = _("の皮膚がただれた!", " loses some skin!");
3586 note_dies = _("はドロドロに溶けた!", " dissolves!");
3589 /* Usually, ignore the effects */
3600 /* Teleport undead (Use "dam" as "power") */
3601 case GF_AWAY_UNDEAD:
3603 /* Only affect undead */
3604 if (r_ptr->flags3 & (RF3_UNDEAD))
3606 bool resists_tele = FALSE;
3608 if (r_ptr->flagsr & RFR_RES_TELE)
3610 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3612 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3613 note = _("には効果がなかった。", " is unaffected.");
3614 resists_tele = TRUE;
3616 else if (r_ptr->level > randint1(100))
3618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3619 note = _("には耐性がある!", " resists!");
3620 resists_tele = TRUE;
3626 if (seen) obvious = TRUE;
3627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3639 /* No "real" damage */
3645 /* Teleport evil (Use "dam" as "power") */
3648 /* Only affect evil */
3649 if (r_ptr->flags3 & (RF3_EVIL))
3651 bool resists_tele = FALSE;
3653 if (r_ptr->flagsr & RFR_RES_TELE)
3655 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3658 note = _("には効果がなかった。", " is unaffected.");
3659 resists_tele = TRUE;
3661 else if (r_ptr->level > randint1(100))
3663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3664 note = _("には耐性がある!", " resists!");
3665 resists_tele = TRUE;
3671 if (seen) obvious = TRUE;
3672 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3684 /* No "real" damage */
3690 /* Teleport monster (Use "dam" as "power") */
3693 bool resists_tele = FALSE;
3694 if (r_ptr->flagsr & RFR_RES_TELE)
3696 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3698 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3699 note = _("には効果がなかった。", " is unaffected.");
3700 resists_tele = TRUE;
3702 else if (r_ptr->level > randint1(100))
3704 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3705 note = _("には耐性がある!", " resists!");
3706 resists_tele = TRUE;
3713 if (seen) obvious = TRUE;
3715 /* Prepare to teleport */
3719 /* No "real" damage */
3725 /* Turn undead (Use "dam" as "power") */
3726 case GF_TURN_UNDEAD:
3728 if (r_ptr->flagsr & RFR_RES_ALL)
3733 /* Only affect undead */
3734 if (r_ptr->flags3 & (RF3_UNDEAD))
3737 if (seen) obvious = TRUE;
3739 /* Learn about type */
3740 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3742 /* Apply some fear */
3743 do_fear = damroll(3, (dam / 2)) + 1;
3745 /* Attempt a saving throw */
3746 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3748 /* No obvious effect */
3749 note = _("には効果がなかった。", " is unaffected.");
3762 /* No "real" damage */
3768 /* Turn evil (Use "dam" as "power") */
3771 if (r_ptr->flagsr & RFR_RES_ALL)
3776 /* Only affect evil */
3777 if (r_ptr->flags3 & (RF3_EVIL))
3780 if (seen) obvious = TRUE;
3782 /* Learn about type */
3783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3785 /* Apply some fear */
3786 do_fear = damroll(3, (dam / 2)) + 1;
3788 /* Attempt a saving throw */
3789 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3791 /* No obvious effect */
3792 note = _("には効果がなかった。", " is unaffected.");
3805 /* No "real" damage */
3811 /* Turn monster (Use "dam" as "power") */
3814 if (r_ptr->flagsr & RFR_RES_ALL)
3820 if (seen) obvious = TRUE;
3822 /* Apply some fear */
3823 do_fear = damroll(3, (dam / 2)) + 1;
3825 /* Attempt a saving throw */
3826 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3827 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3828 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3830 /* No obvious effect */
3831 note = _("には効果がなかった。", " is unaffected.");
3836 /* No "real" damage */
3843 case GF_DISP_UNDEAD:
3845 if (r_ptr->flagsr & RFR_RES_ALL)
3851 /* Only affect undead */
3852 if (r_ptr->flags3 & (RF3_UNDEAD))
3855 if (seen) obvious = TRUE;
3857 /* Learn about type */
3858 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3860 note = _("は身震いした。", " shudders.");
3861 note_dies = _("はドロドロに溶けた!", " dissolves!");
3881 if (r_ptr->flagsr & RFR_RES_ALL)
3887 /* Only affect evil */
3888 if (r_ptr->flags3 & (RF3_EVIL))
3891 if (seen) obvious = TRUE;
3893 /* Learn about type */
3894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3896 note = _("は身震いした。", " shudders.");
3897 note_dies = _("はドロドロに溶けた!", " dissolves!");
3916 if (r_ptr->flagsr & RFR_RES_ALL)
3922 /* Only affect good */
3923 if (r_ptr->flags3 & (RF3_GOOD))
3926 if (seen) obvious = TRUE;
3928 /* Learn about type */
3929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3931 note = _("は身震いした。", " shudders.");
3932 note_dies = _("はドロドロに溶けた!", " dissolves!");
3949 case GF_DISP_LIVING:
3951 if (r_ptr->flagsr & RFR_RES_ALL)
3957 /* Only affect non-undead */
3958 if (monster_living(r_ptr))
3961 if (seen) obvious = TRUE;
3963 note = _("は身震いした。", " shudders.");
3964 note_dies = _("はドロドロに溶けた!", " dissolves!");
3983 if (r_ptr->flagsr & RFR_RES_ALL)
3989 /* Only affect demons */
3990 if (r_ptr->flags3 & (RF3_DEMON))
3993 if (seen) obvious = TRUE;
3995 /* Learn about type */
3996 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3998 note = _("は身震いした。", " shudders.");
3999 note_dies = _("はドロドロに溶けた!", " dissolves!");
4015 /* Dispel monster */
4018 if (r_ptr->flagsr & RFR_RES_ALL)
4025 if (seen) obvious = TRUE;
4027 note = _("は身震いした。", " shudders.");
4028 note_dies = _("はドロドロに溶けた!", " dissolves!");
4035 if (seen) obvious = TRUE;
4037 if (r_ptr->flagsr & RFR_RES_ALL)
4039 note = _("には完全な耐性がある!", " is immune.");
4041 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4045 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4049 /* Heal the monster */
4050 if (caster_ptr->hp < caster_ptr->maxhp)
4053 caster_ptr->hp += dam;
4054 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4056 /* Redraw (later) if needed */
4057 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4058 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4060 /* Special message */
4063 /* Get the monster name */
4064 monster_desc(killer, caster_ptr, 0);
4065 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4071 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4072 (void)hp_player(dam);
4077 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4086 if (seen) obvious = TRUE;
4087 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4089 if (r_ptr->flagsr & RFR_RES_ALL)
4091 note = _("には完全な耐性がある!", " is immune.");
4093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4097 /* Attempt a saving throw */
4098 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4099 (r_ptr->flags3 & RF3_NO_CONF) ||
4100 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4102 /* Memorize a flag */
4103 if (r_ptr->flags3 & (RF3_NO_CONF))
4105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4107 note = _("には効果がなかった。", " is unaffected.");
4110 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4112 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4113 note = _("には完全な耐性がある!", " is immune.");
4116 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4118 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4119 note = _("には耐性がある。", " resists.");
4124 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4125 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4127 if (who > 0) do_conf = randint0(4) + 4;
4128 else do_conf = randint0(8) + 8;
4134 case GF_BRAIN_SMASH:
4136 if (seen) obvious = TRUE;
4137 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4139 if (r_ptr->flagsr & RFR_RES_ALL)
4141 note = _("には完全な耐性がある!", " is immune.");
4143 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4147 /* Attempt a saving throw */
4148 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4149 (r_ptr->flags3 & RF3_NO_CONF) ||
4150 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4152 /* Memorize a flag */
4153 if (r_ptr->flags3 & (RF3_NO_CONF))
4155 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4157 note = _("には効果がなかった。", " is unaffected.");
4160 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4162 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4163 note = _("には完全な耐性がある!", " is immune.");
4166 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4169 note = _("には耐性がある!", " resists!");
4174 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4175 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4179 do_conf = randint0(4) + 4;
4180 do_stun = randint0(4) + 4;
4184 do_conf = randint0(8) + 8;
4185 do_stun = randint0(8) + 8;
4187 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4195 if (seen) obvious = TRUE;
4196 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4198 if (r_ptr->flagsr & RFR_RES_ALL)
4200 note = _("には完全な耐性がある!", " is immune.");
4202 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4206 /* Attempt a saving throw */
4207 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4209 note = _("には効果がなかった。", " is unaffected.");
4218 if (seen) obvious = TRUE;
4219 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4221 if (r_ptr->flagsr & RFR_RES_ALL)
4223 note = _("には完全な耐性がある!", " is immune.");
4225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4229 /* Attempt a saving throw */
4230 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4232 note = _("には効果がなかった。", " is unaffected.");
4241 if (seen) obvious = TRUE;
4242 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4244 if (r_ptr->flagsr & RFR_RES_ALL)
4246 note = _("には完全な耐性がある!", " is immune.");
4248 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4252 /* Attempt a saving throw */
4253 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4255 note = _("には効果がなかった。", " is unaffected.");
4264 if (seen) obvious = TRUE;
4266 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4267 "You point at %s, screaming the word, 'DIE!'."), m_name);
4269 if (r_ptr->flagsr & RFR_RES_ALL)
4271 note = _("には完全な耐性がある!", " is immune.");
4273 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4277 /* Attempt a saving throw */
4278 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4280 note = _("には効果がなかった。", " is unaffected.");
4289 if (seen) obvious = TRUE;
4291 if (r_ptr->flagsr & RFR_RES_ALL)
4293 note = _("には完全な耐性がある!", " is immune.");
4295 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4299 if (r_ptr->flags1 & RF1_UNIQUE)
4301 note = _("には効果がなかった。", " is unaffected.");
4306 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4307 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4309 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4311 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4315 note = _("は耐性を持っている!", "resists!");
4322 /* Capture monster */
4326 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4327 (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)
4329 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4334 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4335 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4336 nokori_hp = m_ptr->maxhp * 3 / 10;
4338 nokori_hp = m_ptr->maxhp * 3 / 20;
4340 if (m_ptr->hp >= nokori_hp)
4342 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4345 else if (m_ptr->hp < randint0(nokori_hp))
4347 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4348 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4349 cap_mon = m_ptr->r_idx;
4350 cap_mspeed = m_ptr->mspeed;
4352 cap_maxhp = m_ptr->max_maxhp;
4353 cap_nickname = m_ptr->nickname; /* Quark transfer */
4354 if (c_ptr->m_idx == p_ptr->riding)
4356 if (rakuba(-1, FALSE))
4358 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4362 delete_monster_idx(c_ptr->m_idx);
4368 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4374 /* Attack (Use "dam" as attack type) */
4377 /* Return this monster's death */
4378 return py_attack(y, x, dam);
4381 /* Sleep (Use "dam" as "power") */
4387 if (seen) obvious = TRUE;
4389 if (r_ptr->flagsr & RFR_RES_ALL)
4391 note = _("には効果がなかった。", " is unaffected.");
4393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4396 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4398 note = _("には効果がなかった。", " is unaffected.");
4401 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4404 if (MON_CSLEEP(m_ptr))
4406 note = _("には効果がなかった。", " is unaffected.");
4412 if (one_in_(5)) effect = 1;
4413 else if (one_in_(4)) effect = 2;
4414 else if (one_in_(3)) effect = 3;
4419 /* Powerful monsters can resist */
4420 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4421 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4423 note = _("には効果がなかった。", " is unaffected.");
4427 /* Normal monsters slow down */
4430 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4432 note = _("の動きが遅くなった。", " starts moving slower.");
4437 else if (effect == 2)
4439 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4441 /* Attempt a saving throw */
4442 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4443 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4448 /* No obvious effect */
4449 note = _("には効果がなかった。", " is unaffected.");
4454 else if (effect == 3)
4456 /* Attempt a saving throw */
4457 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4458 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4459 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4461 /* Memorize a flag */
4462 if (r_ptr->flags3 & RF3_NO_SLEEP)
4464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4467 /* No obvious effect */
4468 note = _("には効果がなかった。", " is unaffected.");
4473 /* Go to sleep (much) later */
4474 note = _("は眠り込んでしまった!", " falls asleep!");
4481 note = _("には効果がなかった。", " is unaffected.");
4484 /* No "real" damage */
4492 if (seen) obvious = TRUE;
4494 if (r_ptr->flagsr & RFR_RES_ALL)
4496 note = _("には効果がなかった。", " is unaffected.");
4498 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4502 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4504 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4505 chg_virtue(V_VITALITY, -1);
4515 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4517 if (r_ptr->flags3 & (RF3_HURT_LITE))
4519 /* Obvious effect */
4520 if (seen) obvious = TRUE;
4522 /* Memorize the effects */
4523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4525 /* Special effect */
4526 note = _("は光に身をすくめた!", " cringes from the light!");
4527 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4530 /* Normally no damage */
4537 photo = m_ptr->r_idx;
4544 case GF_BLOOD_CURSE:
4546 if (seen) obvious = TRUE;
4548 if (r_ptr->flagsr & RFR_RES_ALL)
4550 note = _("には完全な耐性がある!", " is immune.");
4552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4560 bool success = FALSE;
4561 if (seen) obvious = TRUE;
4563 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4565 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4566 if (dam < 1) dam = 1;
4568 /* No need to tame your pet */
4571 note = _("の動きが速くなった。", " starts moving faster.");
4572 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4576 /* Attempt a saving throw */
4577 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4578 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4579 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4580 (p_ptr->cursed & TRC_AGGRAVATE) ||
4581 ((r_ptr->level+10) > randint1(dam)))
4584 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4588 note = _("を支配した。", " is tamed!");
4590 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4592 /* Learn about type */
4593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4600 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4602 do_fear = randint1(90)+10;
4604 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4607 /* No "real" damage */
4614 if (seen) obvious = TRUE;
4616 if (r_ptr->flagsr & RFR_RES_ALL)
4618 note = _("には完全な耐性がある!", " is immune.");
4620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4624 /* Attempt a saving throw */
4625 if (randint0(100 + dam) < (r_ptr->level + 50))
4627 note = _("には効果がなかった。", " is unaffected.");
4647 /* Absolutely no effect */
4648 if (skipped) return (FALSE);
4650 /* "Unique" monsters cannot be polymorphed */
4651 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4653 /* Quest monsters cannot be polymorphed */
4654 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4656 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4658 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4659 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4661 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4666 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4667 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4670 /* Modify the damage */
4672 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4673 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4675 /* Check for death */
4676 if (dam > m_ptr->hp)
4678 /* Extract method of death */
4683 /* Sound and Impact resisters never stun */
4685 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4686 !(r_ptr->flags3 & RF3_NO_STUN))
4689 if (seen) obvious = TRUE;
4692 if (MON_STUNNED(m_ptr))
4694 note = _("はひどくもうろうとした。", " is more dazed.");
4695 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4699 note = _("はもうろうとした。", " is dazed.");
4704 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4710 /* Confusion and Chaos resisters (and sleepers) never confuse */
4712 !(r_ptr->flags3 & RF3_NO_CONF) &&
4713 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4716 if (seen) obvious = TRUE;
4718 /* Already partially confused */
4719 if (MON_CONFUSED(m_ptr))
4721 note = _("はさらに混乱したようだ。", " looks more confused.");
4722 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4725 /* Was not confused */
4728 note = _("は混乱したようだ。", " looks confused.");
4732 /* Apply confusion */
4733 (void)set_monster_confused(c_ptr->m_idx, tmp);
4742 if (seen) obvious = TRUE;
4744 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4748 note = _("は弱くなったようだ。", " seems weakened.");
4749 m_ptr->maxhp -= do_time;
4750 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4755 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4756 if (do_poly && (randint1(90) > r_ptr->level))
4758 if (polymorph_monster(y, x))
4761 if (seen) obvious = TRUE;
4763 /* Monster polymorphs */
4764 note = _("が変身した!", " changes!");
4766 /* Turn off the damage */
4772 note = _("には効果がなかった。", " is unaffected.");
4775 /* Hack -- Get new monster */
4776 m_ptr = &m_list[c_ptr->m_idx];
4778 /* Hack -- Get new race */
4779 r_ptr = &r_info[m_ptr->r_idx];
4782 /* Handle "teleport" */
4786 if (seen) obvious = TRUE;
4788 note = _("が消え去った!", " disappears!");
4790 if (!who) chg_virtue(V_VALOUR, -1);
4793 teleport_away(c_ptr->m_idx, do_dist,
4794 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4796 /* Hack -- get new location */
4800 /* Hack -- get new grid */
4801 c_ptr = &cave[y][x];
4808 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4815 if (typ == GF_DRAIN_MANA)
4817 /* Drain mana does nothing */
4820 /* If another monster did the damage, hurt the monster by hand */
4823 /* Redraw (later) if needed */
4824 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4825 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4827 /* Wake the monster up */
4828 (void)set_monster_csleep(c_ptr->m_idx, 0);
4830 /* Hurt the monster */
4838 if (is_pet(m_ptr) && !(m_ptr->ml))
4841 /* Give detailed messages if destroyed */
4844 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4847 msg_format("%^s%s", m_name, note);
4855 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4857 /* Generate treasure, etc */
4858 monster_death(c_ptr->m_idx, FALSE);
4861 delete_monster_idx(c_ptr->m_idx);
4865 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4869 /* Damaged monster */
4872 /* Give detailed messages if visible or destroyed */
4873 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4875 /* Hack -- Pain message */
4878 message_pain(c_ptr->m_idx, dam);
4885 /* Hack -- handle sleep */
4886 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4890 else if (heal_leper)
4892 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4894 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4898 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4899 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4902 delete_monster_idx(c_ptr->m_idx);
4905 /* If the player did it, give him experience, check fear */
4910 /* Hurt the monster, check for fear and death */
4911 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4916 /* Damaged monster */
4919 /* HACK - anger the monster before showing the sleep message */
4920 if (do_sleep) anger_monster(m_ptr);
4922 /* Give detailed messages if visible or destroyed */
4923 if (note && seen_msg)
4924 msg_format(_("%s%s", "%^s%s"), m_name, note);
4926 /* Hack -- Pain message */
4927 else if (known && (dam || !do_fear))
4929 message_pain(c_ptr->m_idx, dam);
4932 /* Anger monsters */
4933 if (((dam > 0) || get_angry) && !do_sleep)
4934 anger_monster(m_ptr);
4937 if ((fear || do_fear) && seen)
4941 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4944 /* Hack -- handle sleep */
4945 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4949 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4951 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4955 switch (randint1(28))
4960 msg_print(_("地面が揺れた...", "The ground trembles..."));
4961 earthquake(ty, tx, 4 + randint0(4));
4962 if (!one_in_(6)) break;
4964 case 3: case 4: case 5: case 6:
4967 int extra_dam = damroll(10, 10);
4968 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4970 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4971 if (!one_in_(6)) break;
4976 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4978 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4979 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4980 if (!one_in_(6)) break;
4982 case 9: case 10: case 11:
4983 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4984 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4985 if (!one_in_(6)) break;
4986 case 12: case 13: case 14: case 15: case 16:
4987 aggravate_monsters(0);
4988 if (!one_in_(6)) break;
4990 count += activate_hi_summon(ty, tx, TRUE);
4991 if (!one_in_(6)) break;
4992 case 19: case 20: case 21: case 22:
4994 bool pet = !one_in_(3);
4995 BIT_FLAGS mode = PM_ALLOW_GROUP;
4997 if (pet) mode |= PM_FORCE_PET;
4998 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5000 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);
5001 if (!one_in_(6)) break;
5003 case 23: case 24: case 25:
5004 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5005 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5007 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5008 else lose_exp(p_ptr->exp / 16);
5009 if (!one_in_(6)) break;
5010 case 26: case 27: case 28:
5019 (void)do_dec_stat(i);
5028 (void)do_dec_stat(randint0(6));
5037 if (p_ptr->inside_battle)
5039 p_ptr->health_who = c_ptr->m_idx;
5040 p_ptr->redraw |= (PR_HEALTH);
5044 /* Verify this code */
5046 /* Update the monster */
5047 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5049 /* Redraw the monster grid */
5053 /* Update monster recall window */
5054 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5056 p_ptr->window |= (PW_MONSTER);
5059 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5063 if (!(flg & PROJECT_NO_HANGEKI))
5065 set_target(m_ptr, monster_target_y, monster_target_x);
5068 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5070 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5074 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5076 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5077 rakubadam_m = (dam > 200) ? 200 : dam;
5086 /* Get local object */
5089 /* Prepare to make a Blade of Chaos */
5090 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5092 q_ptr->pval = photo;
5094 /* Mark the item as fully known */
5095 q_ptr->ident |= (IDENT_MENTAL);
5097 /* Drop it in the dungeon */
5098 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5106 /* Return "Anything seen?" */
5111 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5112 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5113 * @param who_name 効果を起こしたモンスターの名前
5114 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5115 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5116 * @param x 目標X座標 / Target x location (or location to travel "towards")
5117 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5118 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5120 * @param monspell 効果元のモンスター魔法ID
5121 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5123 * Handle a beam/bolt/ball causing damage to the player.
5124 * This routine takes a "source monster" (by index), a "distance", a default
5125 * "damage", and a "damage type". See "project_m()" above.
5126 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5127 * is reduced (see "project_m()" above). This can happen if a monster breathes
5128 * at the player and hits a wall instead.
5129 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5130 * to know if this is actually a ball or a bolt spell
5131 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5132 * we just assume that the effects were obvious, for historical reasons.
5134 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)
5139 /* Hack -- assume obvious */
5140 bool obvious = TRUE;
5142 /* Player blind-ness */
5143 bool blind = (p_ptr->blind ? TRUE : FALSE);
5145 /* Player needs a "description" (he is blind) */
5148 /* Source monster */
5149 monster_type *m_ptr = NULL;
5151 /* Monster name (for attacks) */
5154 /* Monster name (for damage) */
5157 /* Hack -- messages */
5163 /* Player is not here */
5164 if (!player_bold(y, x)) return (FALSE);
5166 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5168 if (kawarimi(TRUE)) return FALSE;
5171 /* Player cannot hurt himself */
5172 if (!who) return (FALSE);
5173 if (who == p_ptr->riding) return (FALSE);
5175 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5178 int max_attempts = 10;
5179 sound(SOUND_REFLECT);
5182 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5183 else if (p_ptr->special_defense & KATA_FUUJIN)
5184 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5186 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5189 /* Choose 'new' target */
5194 t_y = m_list[who].fy - 1 + randint1(3);
5195 t_x = m_list[who].fx - 1 + randint1(3);
5198 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5200 if (max_attempts < 1)
5202 t_y = m_list[who].fy;
5203 t_x = m_list[who].fx;
5208 t_y = p_ptr->y - 1 + randint1(3);
5209 t_x = p_ptr->x - 1 + randint1(3);
5212 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5214 disturb(TRUE, TRUE);
5218 /* Limit maximum damage */
5219 if (dam > 1600) dam = 1600;
5221 /* Reduce damage by distance */
5222 dam = (dam + r) / (r + 1);
5225 /* If the player is blind, be more descriptive */
5226 if (blind) fuzzy = TRUE;
5231 /* Get the source monster */
5232 m_ptr = &m_list[who];
5233 /* Extract the monster level */
5234 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5236 /* Get the monster name */
5237 monster_desc(m_name, m_ptr, 0);
5239 /* Get the monster's real name (gotten before polymorph!) */
5240 strcpy(killer, who_name);
5246 case PROJECT_WHO_UNCTRL_POWER:
5247 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5250 case PROJECT_WHO_GLASS_SHARDS:
5251 strcpy(killer, _("ガラスの破片", "shards of glass"));
5255 strcpy(killer, _("罠", "a trap"));
5260 strcpy(m_name, killer);
5263 /* Analyze the damage */
5266 /* Standard damage -- hurts inventory too */
5269 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5270 get_damage = acid_dam(dam, killer, monspell, FALSE);
5274 /* Standard damage -- hurts inventory too */
5277 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5278 get_damage = fire_dam(dam, killer, monspell, FALSE);
5282 /* Standard damage -- hurts inventory too */
5285 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5286 get_damage = cold_dam(dam, killer, monspell, FALSE);
5290 /* Standard damage -- hurts inventory too */
5293 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5294 get_damage = elec_dam(dam, killer, monspell, FALSE);
5298 /* Standard damage -- also poisons player */
5301 bool double_resist = IS_OPPOSE_POIS();
5302 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5304 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5305 if (double_resist) dam = (dam + 2) / 3;
5307 if ((!(double_resist || p_ptr->resist_pois)) &&
5308 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5313 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5315 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5317 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5322 /* Standard damage -- also poisons / mutates player */
5325 bool double_resist = IS_OPPOSE_POIS();
5326 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5328 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5329 if (double_resist) dam = (2 * dam + 2) / 5;
5330 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5331 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5333 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5335 if (one_in_(5)) /* 6 */
5337 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5338 if (one_in_(4)) /* 4 */
5346 inven_damage(set_acid_destroy, 2);
5352 /* Standard damage */
5355 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5360 /* Holy Orb -- Player only takes partial damage */
5363 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5364 if (p_ptr->align > 10)
5366 else if (p_ptr->align < -10)
5368 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5374 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5375 if (p_ptr->align > 10)
5377 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5381 /* Arrow -- XXX no dodging */
5386 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5388 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5390 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5393 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5397 /* Plasma -- XXX No resist */
5400 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5401 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5403 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5405 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5406 (void)set_stun(p_ptr->stun + plus_stun);
5409 if (!(p_ptr->resist_fire ||
5411 p_ptr->immune_fire))
5413 inven_damage(set_acid_destroy, 3);
5419 /* Nether -- drain experience */
5422 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5423 if (p_ptr->resist_neth)
5425 if (!prace_is_(RACE_SPECTRE))
5427 dam *= 6; dam /= (randint1(4) + 7);
5430 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5432 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5434 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5436 learn_spell(monspell);
5440 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5446 /* Water -- stun/confuse */
5449 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5450 if (!CHECK_MULTISHADOW())
5452 if (!p_ptr->resist_sound)
5454 set_stun(p_ptr->stun + randint1(40));
5456 if (!p_ptr->resist_conf)
5458 set_confused(p_ptr->confused + randint1(5) + 5);
5463 inven_damage(set_cold_destroy, 3);
5467 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5471 /* Chaos -- many effects */
5474 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5475 if (p_ptr->resist_chaos)
5477 dam *= 6; dam /= (randint1(4) + 7);
5480 if (!CHECK_MULTISHADOW())
5482 if (!p_ptr->resist_conf)
5484 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5486 if (!p_ptr->resist_chaos)
5488 (void)set_image(p_ptr->image + randint1(10));
5491 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5492 (void)gain_random_mutation(0);
5495 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5497 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5500 if (!p_ptr->resist_chaos || one_in_(9))
5502 inven_damage(set_elec_destroy, 2);
5503 inven_damage(set_fire_destroy, 2);
5507 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5511 /* Shards -- mostly cutting */
5514 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5515 if (p_ptr->resist_shard)
5517 dam *= 6; dam /= (randint1(4) + 7);
5519 else if (!CHECK_MULTISHADOW())
5521 (void)set_cut(p_ptr->cut + dam);
5524 if (!p_ptr->resist_shard || one_in_(13))
5526 inven_damage(set_cold_destroy, 2);
5529 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5533 /* Sound -- mostly stunning */
5536 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5537 if (p_ptr->resist_sound)
5539 dam *= 5; dam /= (randint1(4) + 7);
5541 else if (!CHECK_MULTISHADOW())
5543 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5544 (void)set_stun(p_ptr->stun + plus_stun);
5547 if (!p_ptr->resist_sound || one_in_(13))
5549 inven_damage(set_cold_destroy, 2);
5552 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5556 /* Pure confusion */
5559 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5560 if (p_ptr->resist_conf)
5562 dam *= 5; dam /= (randint1(4) + 7);
5564 else if (!CHECK_MULTISHADOW())
5566 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5568 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5572 /* Disenchantment -- see above */
5575 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5576 if (p_ptr->resist_disen)
5578 dam *= 6; dam /= (randint1(4) + 7);
5580 else if (!CHECK_MULTISHADOW())
5582 (void)apply_disenchant(0);
5584 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5588 /* Nexus -- see above */
5591 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5592 if (p_ptr->resist_nexus)
5594 dam *= 6; dam /= (randint1(4) + 7);
5596 else if (!CHECK_MULTISHADOW())
5600 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5604 /* Force -- mostly stun */
5607 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5608 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5610 (void)set_stun(p_ptr->stun + randint1(20));
5612 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5617 /* Rocket -- stun, cut */
5620 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5621 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5623 (void)set_stun(p_ptr->stun + randint1(20));
5626 if (p_ptr->resist_shard)
5630 else if (!CHECK_MULTISHADOW())
5632 (void)set_cut(p_ptr->cut + (dam / 2));
5635 if (!p_ptr->resist_shard || one_in_(12))
5637 inven_damage(set_cold_destroy, 3);
5640 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5644 /* Inertia -- slowness */
5647 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5648 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5649 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5653 /* Lite -- blinding */
5656 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5657 if (p_ptr->resist_lite)
5659 dam *= 4; dam /= (randint1(4) + 7);
5661 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5663 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5666 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5668 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5671 else if (prace_is_(RACE_S_FAIRY))
5676 if (p_ptr->wraith_form) dam *= 2;
5677 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5679 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5681 p_ptr->wraith_form = 0;
5682 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5683 "The light forces you out of your incorporeal shadow form."));
5685 p_ptr->redraw |= PR_MAP;
5686 /* Update monsters */
5687 p_ptr->update |= (PU_MONSTERS);
5688 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5690 /* Redraw status bar */
5691 p_ptr->redraw |= (PR_STATUS);
5698 /* Dark -- blinding */
5701 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5702 if (p_ptr->resist_dark)
5704 dam *= 4; dam /= (randint1(4) + 7);
5706 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5708 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5710 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5712 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5716 /* Time -- bolt fewer effects XXX */
5719 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5720 if (p_ptr->resist_time)
5723 dam /= (randint1(4) + 7);
5724 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5726 else if (!CHECK_MULTISHADOW())
5728 switch (randint1(10))
5730 case 1: case 2: case 3: case 4: case 5:
5732 if (p_ptr->prace == RACE_ANDROID) break;
5733 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5734 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5738 case 6: case 7: case 8: case 9:
5740 switch (randint1(6))
5742 case 1: k = A_STR; act = _("強く", "strong"); break;
5743 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5744 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5745 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5746 case 5: k = A_CON; act = _("健康で", "hale"); break;
5747 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5750 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5751 "You're not as %s as you used to be..."), act);
5753 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5754 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5755 p_ptr->update |= (PU_BONUS);
5761 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5762 "You're not as powerful as you used to be..."));
5764 for (k = 0; k < 6; k++)
5766 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5767 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5769 p_ptr->update |= (PU_BONUS);
5775 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5779 /* Gravity -- stun plus slowness plus teleport */
5782 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5783 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5785 if (!CHECK_MULTISHADOW())
5787 teleport_player(5, TELEPORT_PASSIVE);
5788 if (!p_ptr->levitation)
5789 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5790 if (!(p_ptr->resist_sound || p_ptr->levitation))
5792 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5793 (void)set_stun(p_ptr->stun + plus_stun);
5796 if (p_ptr->levitation)
5798 dam = (dam * 2) / 3;
5801 if (!p_ptr->levitation || one_in_(13))
5803 inven_damage(set_cold_destroy, 2);
5806 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5810 /* Standard damage */
5811 case GF_DISINTEGRATE:
5813 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5815 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5821 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5823 (void)hp_player(dam);
5830 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5831 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5838 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5839 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5845 if (p_ptr->free_act) break;
5846 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5848 if (ironman_nightmare)
5850 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5851 /* Have some nightmares */
5852 sanity_blast(NULL, FALSE);
5855 set_paralyzed(p_ptr->paralyzed + dam);
5865 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5866 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5873 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5874 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5881 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5883 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5884 if (!p_ptr->resist_shard || one_in_(13))
5886 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5887 inven_damage(set_cold_destroy, 2);
5893 /* Ice -- cold plus stun plus cuts */
5896 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5897 get_damage = cold_dam(dam, killer, monspell, FALSE);
5898 if (!CHECK_MULTISHADOW())
5900 if (!p_ptr->resist_shard)
5902 (void)set_cut(p_ptr->cut + damroll(5, 8));
5904 if (!p_ptr->resist_sound)
5906 (void)set_stun(p_ptr->stun + randint1(15));
5909 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5911 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5921 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5923 if (p_ptr->mimic_form)
5925 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5926 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5931 switch (p_ptr->prace)
5933 /* Some races are immune */
5947 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5959 if (CHECK_MULTISHADOW())
5961 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5963 else if (p_ptr->csp)
5967 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5969 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5972 if (dam >= p_ptr->csp)
5976 p_ptr->csp_frac = 0;
5985 learn_spell(monspell);
5988 p_ptr->redraw |= (PR_MANA);
5990 p_ptr->window |= (PW_PLAYER);
5991 p_ptr->window |= (PW_SPELL);
5995 /* Heal the monster */
5996 if (m_ptr->hp < m_ptr->maxhp)
6000 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6002 /* Redraw (later) if needed */
6003 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6004 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6006 /* Special message */
6009 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6022 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6024 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6025 learn_spell(monspell);
6029 if (!CHECK_MULTISHADOW())
6031 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6033 if (!p_ptr->resist_conf)
6035 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6038 if (!p_ptr->resist_chaos && one_in_(3))
6040 (void)set_image(p_ptr->image + randint0(250) + 150);
6047 p_ptr->csp_frac = 0;
6049 p_ptr->redraw |= PR_MANA;
6052 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6058 case GF_BRAIN_SMASH:
6060 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6062 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6063 learn_spell(monspell);
6067 if (!CHECK_MULTISHADOW())
6069 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6075 p_ptr->csp_frac = 0;
6077 p_ptr->redraw |= PR_MANA;
6080 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6081 if (!CHECK_MULTISHADOW())
6083 if (!p_ptr->resist_blind)
6085 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6087 if (!p_ptr->resist_conf)
6089 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6091 if (!p_ptr->free_act)
6093 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6095 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6097 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6098 (void)do_dec_stat(A_INT);
6099 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6100 (void)do_dec_stat(A_WIS);
6102 if (!p_ptr->resist_chaos)
6104 (void)set_image(p_ptr->image + randint0(250) + 150);
6114 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6116 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6117 learn_spell(monspell);
6121 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6122 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6130 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6132 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6133 learn_spell(monspell);
6137 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6138 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6146 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6148 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6149 learn_spell(monspell);
6153 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6154 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6162 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6164 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6165 learn_spell(monspell);
6169 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6170 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6178 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6180 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6181 learn_spell(monspell);
6185 if (!CHECK_MULTISHADOW())
6187 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6188 curse_equipment(40, 20);
6191 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6193 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6208 /* Hex - revenge damage stored */
6209 revenge_store(get_damage);
6211 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6212 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6214 char m_name_self[80];
6217 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6219 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6220 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6221 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6224 if (p_ptr->riding && dam > 0)
6226 rakubadam_p = (dam > 200) ? 200 : dam;
6230 disturb(TRUE, TRUE);
6233 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6235 (void)kawarimi(FALSE);
6238 /* Return "Anything seen?" */
6244 * Find the distance from (x, y) to a line.
6246 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6248 /* Vector from (x, y) to (x1, y1) */
6249 POSITION py = y1 - y;
6250 POSITION px = x1 - x;
6253 POSITION ny = x2 - x1;
6254 POSITION nx = y1 - y2;
6257 POSITION pd = distance(y1, x1, y, x);
6258 POSITION nd = distance(y1, x1, y2, x2);
6260 if (pd > nd) return distance(y, x, y2, x2);
6262 /* Component of P on N */
6263 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6265 /* Absolute value */
6266 return((nd >= 0) ? nd : 0 - nd);
6273 * Modified version of los() for calculation of disintegration balls.
6274 * Disintegration effects are stopped by permanent walls.
6276 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6296 /* Slope, or 1/Slope, of LOS */
6300 /* Extract the offset */
6304 /* Extract the absolute offset */
6309 /* Handle adjacent (or identical) grids */
6310 if ((ax < 2) && (ay < 2)) return (TRUE);
6313 /* Paranoia -- require "safe" origin */
6314 /* if (!in_bounds(y1, x1)) return (FALSE); */
6317 /* Directly South/North */
6320 /* South -- check for walls */
6323 for (ty = y1 + 1; ty < y2; ty++)
6325 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6329 /* North -- check for walls */
6332 for (ty = y1 - 1; ty > y2; ty--)
6334 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6342 /* Directly East/West */
6345 /* East -- check for walls */
6348 for (tx = x1 + 1; tx < x2; tx++)
6350 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6354 /* West -- check for walls */
6357 for (tx = x1 - 1; tx > x2; tx--)
6359 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6368 /* Extract some signs */
6369 sx = (dx < 0) ? -1 : 1;
6370 sy = (dy < 0) ? -1 : 1;
6373 /* Vertical "knights" */
6378 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6382 /* Horizontal "knights" */
6387 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6392 /* Calculate scale factor div 2 */
6395 /* Calculate scale factor */
6399 /* Travel horizontally */
6402 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6408 /* Consider the special case where slope == 1. */
6419 /* Note (below) the case (qy == f2), where */
6420 /* the LOS exactly meets the corner of a tile. */
6423 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6434 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6447 /* Travel vertically */
6450 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6466 /* Note (below) the case (qx == f2), where */
6467 /* the LOS exactly meets the corner of a tile. */
6470 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6481 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6502 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)
6507 int brev = rad * rad / dist;
6511 int mdis = distance(y1, x1, y2, x2) + rad;
6513 while (bdis <= mdis)
6517 if ((0 < dist) && (path_n < dist))
6519 POSITION ny = GRID_Y(path_g[path_n]);
6520 POSITION nx = GRID_X(path_g[path_n]);
6521 POSITION nd = distance(ny, nx, y1, x1);
6523 /* Get next base point */
6532 /* Travel from center outward */
6533 for (cdis = 0; cdis <= brad; cdis++)
6535 /* Scan the maximal blast area of radius "cdis" */
6536 for (y = by - cdis; y <= by + cdis; y++)
6538 for (x = bx - cdis; x <= bx + cdis; x++)
6540 /* Ignore "illegal" locations */
6541 if (!in_bounds(y, x)) continue;
6543 /* Enforce a circular "ripple" */
6544 if (distance(y1, x1, y, x) != bdis) continue;
6546 /* Enforce an arc */
6547 if (distance(by, bx, y, x) != cdis) continue;
6553 /* Lights are stopped by opaque terrains */
6554 if (!los(by, bx, y, x)) continue;
6556 case GF_DISINTEGRATE:
6557 /* Disintegration are stopped only by perma-walls */
6558 if (!in_disintegration_range(by, bx, y, x)) continue;
6561 /* Ball explosions are stopped by walls */
6562 if (!projectable(by, bx, y, x)) continue;
6566 /* Save this grid */
6574 /* Encode some more "radius" info */
6575 gm[bdis + 1] = *pgrids;
6577 /* Increase the size */
6578 brad = rad * (path_n + brev) / (dist + brev);
6580 /* Find the next ripple */
6584 /* Store the effect size */
6590 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6591 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6592 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6593 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6594 * @param x 目標X座標 / Target x location (or location to travel "towards")
6595 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6596 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6597 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6598 * @param monspell 効果元のモンスター魔法ID
6599 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6602 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6603 * towards a given location (optionally passing over the heads of interposing
6604 * monsters), and have it do a given amount of damage to the monsters (and
6605 * optionally objects) within the given radius of the final location.
6607 * A "bolt" travels from source to target and affects only the target grid.
6608 * A "beam" travels from source to target, affecting all grids passed through.
6609 * A "ball" travels from source to the target, exploding at the target, and
6610 * affecting everything within the given radius of the target location.
6612 * Traditionally, a "bolt" does not affect anything on the ground, and does
6613 * not pass over the heads of interposing monsters, much like a traditional
6614 * missile, and will "stop" abruptly at the "target" even if no monster is
6615 * positioned there, while a "ball", on the other hand, passes over the heads
6616 * of monsters between the source and target, and affects everything except
6617 * the source monster which lies within the final radius, while a "beam"
6618 * affects every monster between the source and target, except for the casting
6619 * monster (or player), and rarely affects things on the ground.
6621 * Two special flags allow us to use this function in special ways, the
6622 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6623 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6624 * actually projecting from the source monster (or player).
6626 * The player will only get "experience" for monsters killed by himself
6627 * Unique monsters can only be destroyed by attacks from the player
6629 * Only 256 grids can be affected per projection, limiting the effective
6630 * "radius" of standard ball attacks to nine units (diameter nineteen).
6632 * One can project in a given "direction" by combining PROJECT_THRU with small
6633 * offsets to the initial location (see "line_spell()"), or by calculating
6634 * "virtual targets" far away from the player.
6636 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6637 * continuing until it actually hits somethings (useful for "stone to mud").
6639 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6641 * Balls must explode BEFORE hitting walls, or they would affect monsters
6642 * on both sides of a wall. Some bug reports indicate that this is still
6643 * happening in 2.7.8 for Windows, though it appears to be impossible.
6645 * We "pre-calculate" the blast area only in part for efficiency.
6646 * More importantly, this lets us do "explosions" from the "inside" out.
6647 * This results in a more logical distribution of "blast" treasure.
6648 * It also produces a better (in my opinion) animation of the explosion.
6649 * It could be (but is not) used to have the treasure dropped by monsters
6650 * in the middle of the explosion fall "outwards", and then be damaged by
6651 * the blast as it spreads outwards towards the treasure drop location.
6653 * Walls and doors are included in the blast area, so that they can be
6654 * "burned" or "melted" in later versions.
6656 * This algorithm is intended to maximize simplicity, not necessarily
6657 * efficiency, since this function is not a bottleneck in the code.
6659 * We apply the blast effect from ground zero outwards, in several passes,
6660 * first affecting features, then objects, then monsters, then the player.
6661 * This allows walls to be removed before checking the object or monster
6662 * in the wall, and protects objects which are dropped by monsters killed
6663 * in the blast, and allows the player to see all affects before he is
6664 * killed or teleported away. The semantics of this method are open to
6665 * various interpretations, but they seem to work well in practice.
6667 * We process the blast area from ground-zero outwards to allow for better
6668 * distribution of treasure dropped by monsters, and because it provides a
6669 * pleasing visual effect at low cost.
6671 * Note that the damage done by "ball" explosions decreases with distance.
6672 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6674 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6675 * the target, and then the damage "flows" along this beam of destruction.
6676 * The damage at every grid is the same as at the "center" of a "ball"
6677 * explosion, since the "beam" grids are treated as if they ARE at the
6678 * center of a "ball" explosion.
6680 * Currently, specifying "beam" plus "ball" means that locations which are
6681 * covered by the initial "beam", and also covered by the final "ball", except
6682 * for the final grid (the epicenter of the ball), will be "hit twice", once
6683 * by the initial beam, and once by the exploding ball. For the grid right
6684 * next to the epicenter, this results in 150% damage being done. The center
6685 * does not have this problem, for the same reason the final grid in a "beam"
6686 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6687 * grids which are covered by the "ball" will NOT work, as then they will
6688 * receive LESS damage than they should. Do not combine "beam" with "ball".
6690 * The array "gy[],gx[]" with current size "grids" is used to hold the
6691 * collected locations of all grids in the "blast area" plus "beam path".
6693 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6694 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6695 * first blast grid (see above) with radius "N" from the blast center. Note
6696 * that only the first gm[1] grids in the blast area thus take full damage.
6697 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6698 * number of blast grids.
6700 * Note that once the projection is complete, (y2,x2) holds the final location
6701 * of bolts/beams, and the "epicenter" of balls.
6703 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6704 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6705 * implementation of the "distance" function. Also, a bolt can be properly
6706 * viewed as a "ball" with a "rad" of "zero".
6708 * Note that if no "target" is reached before the beam/bolt/ball travels the
6709 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6710 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6712 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6713 * to move from point A to point B, even if the player cannot see part of the
6714 * projection path. Note that in general, the player will *always* see part
6715 * of the path, since it either starts at the player or ends on the player.
6717 * Hack -- we assume that every "projection" is "self-illuminating".
6719 * Hack -- when only a single monster is affected, we automatically track
6720 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6722 * Note that all projections now "explode" at their final destination, even
6723 * if they were being projected at a more distant destination. This means
6724 * that "ball" spells will *always* explode.
6726 * Note that we must call "handle_stuff()" after affecting terrain features
6727 * in the blast radius, in case the "illumination" of the grid was changed,
6728 * and "update_view()" and "update_monsters()" need to be called.
6731 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6741 POSITION y_saver, x_saver; /* For reflecting monsters */
6743 int msec = delay_factor * delay_factor * delay_factor;
6745 /* Assume the player sees nothing */
6746 bool notice = FALSE;
6748 /* Assume the player has seen nothing */
6749 bool visual = FALSE;
6751 /* Assume the player has seen no blast grids */
6754 /* Assume to be a normal ball spell */
6755 bool breath = FALSE;
6757 /* Is the player blind? */
6758 bool blind = (p_ptr->blind ? TRUE : FALSE);
6760 bool old_hide = FALSE;
6762 /* Number of grids in the "path" */
6765 /* Actual grids in the "path" */
6768 /* Number of grids in the "blast area" (including the "beam" path) */
6771 /* Coordinates of the affected grids */
6772 POSITION gx[1024], gy[1024];
6774 /* Encoded "radius" info (see above) */
6777 /* Actual radius encoded in gm[] */
6778 POSITION gm_rad = rad;
6782 /* Attacker's name (prepared before polymorph)*/
6785 /* Can the player see the source of this effect? */
6786 bool see_s_msg = TRUE;
6788 /* Initialize by null string */
6794 /* Default target of monsterspell is player */
6795 monster_target_y = p_ptr->y;
6796 monster_target_x = p_ptr->x;
6798 /* Hack -- Jump to target */
6799 if (flg & (PROJECT_JUMP))
6804 /* Clear the flag */
6805 flg &= ~(PROJECT_JUMP);
6810 /* Start at player */
6817 /* Start at monster */
6820 x1 = m_list[who].fx;
6821 y1 = m_list[who].fy;
6822 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6834 /* Default "destination" */
6839 /* Hack -- verify stuff */
6840 if (flg & (PROJECT_THRU))
6842 if ((x1 == x2) && (y1 == y2))
6844 flg &= ~(PROJECT_THRU);
6848 /* Handle a breath attack */
6853 if (flg & PROJECT_HIDE) old_hide = TRUE;
6854 flg |= PROJECT_HIDE;
6858 /* Hack -- Assume there will be no blast (max radius 32) */
6859 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6867 /* Collect beam grids */
6868 if (flg & (PROJECT_BEAM))
6879 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6881 case GF_DISINTEGRATE:
6882 flg |= (PROJECT_GRID);
6883 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6887 /* Calculate the projection path */
6889 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6891 /* Hack -- Handle stuff */
6894 /* Giga-Hack SEEKER & SUPER_RAY */
6896 if( typ == GF_SEEKER )
6906 for (i = 0; i < path_n; ++i)
6911 int ny = GRID_Y(path_g[i]);
6912 int nx = GRID_X(path_g[i]);
6923 /* Only do visuals if requested */
6924 if (!blind && !(flg & (PROJECT_HIDE)))
6926 /* Only do visuals if the player can "see" the bolt */
6927 if (panel_contains(y, x) && player_has_los_bold(y, x))
6934 /* Obtain the bolt pict */
6935 p = bolt_pict(oy, ox, y, x, typ);
6937 /* Extract attr/char */
6941 /* Visual effects */
6942 print_rel(c, a, y, x);
6943 move_cursor_relative(y, x);
6944 /*if (fresh_before)*/ Term_fresh();
6945 Term_xtra(TERM_XTRA_DELAY, msec);
6947 /*if (fresh_before)*/ Term_fresh();
6949 /* Display "beam" grids */
6950 if (flg & (PROJECT_BEAM))
6952 /* Obtain the explosion pict */
6953 p = bolt_pict(y, x, y, x, typ);
6955 /* Extract attr/char */
6959 /* Visual effects */
6960 print_rel(c, a, y, x);
6963 /* Hack -- Activate delay */
6967 /* Hack -- delay anyway for consistency */
6970 /* Delay for consistency */
6971 Term_xtra(TERM_XTRA_DELAY, msec);
6974 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6975 if( is_mirror_grid(&cave[y][x]))
6977 /* The target of monsterspell becomes tha mirror(broken) */
6978 monster_target_y=(s16b)y;
6979 monster_target_x=(s16b)x;
6981 remove_mirror(y, x);
6982 next_mirror(&oy, &ox, y, x);
6984 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6985 for(j = last_i; j <= i; j++)
6987 y = GRID_Y(path_g[j]);
6988 x = GRID_X(path_g[j]);
6989 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6990 if(!who && (project_m_n==1) && !jump ){
6991 if(cave[project_m_y][project_m_x].m_idx >0 ){
6992 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6996 /* Hack -- auto-recall */
6997 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6999 /* Hack - auto-track */
7000 health_track(cave[project_m_y][project_m_x].m_idx);
7004 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7009 for(i = last_i ; i < path_n ; i++)
7012 py = GRID_Y(path_g[i]);
7013 px = GRID_X(path_g[i]);
7014 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7016 if(!who && (project_m_n==1) && !jump ){
7017 if(cave[project_m_y][project_m_x].m_idx > 0)
7019 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7023 /* Hack -- auto-recall */
7024 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7026 /* Hack - auto-track */
7027 health_track(cave[project_m_y][project_m_x].m_idx);
7031 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7035 else if(typ == GF_SUPER_RAY){
7037 int second_step = 0;
7044 for (i = 0; i < path_n; ++i)
7049 int ny = GRID_Y(path_g[i]);
7050 int nx = GRID_X(path_g[i]);
7061 /* Only do visuals if requested */
7062 if (!blind && !(flg & (PROJECT_HIDE)))
7064 /* Only do visuals if the player can "see" the bolt */
7065 if (panel_contains(y, x) && player_has_los_bold(y, x))
7072 /* Obtain the bolt pict */
7073 p = bolt_pict(oy, ox, y, x, typ);
7075 /* Extract attr/char */
7079 /* Visual effects */
7080 print_rel(c, a, y, x);
7081 move_cursor_relative(y, x);
7082 /*if (fresh_before)*/ Term_fresh();
7083 Term_xtra(TERM_XTRA_DELAY, msec);
7085 /*if (fresh_before)*/ Term_fresh();
7087 /* Display "beam" grids */
7088 if (flg & (PROJECT_BEAM))
7090 /* Obtain the explosion pict */
7091 p = bolt_pict(y, x, y, x, typ);
7093 /* Extract attr/char */
7097 /* Visual effects */
7098 print_rel(c, a, y, x);
7101 /* Hack -- Activate delay */
7105 /* Hack -- delay anyway for consistency */
7108 /* Delay for consistency */
7109 Term_xtra(TERM_XTRA_DELAY, msec);
7112 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7113 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7115 if( second_step )continue;
7118 if( is_mirror_grid(&cave[y][x]) && !second_step )
7120 /* The target of monsterspell becomes tha mirror(broken) */
7121 monster_target_y=(s16b)y;
7122 monster_target_x=(s16b)x;
7125 for( j = 0; j <=i ; j++ )
7127 y = GRID_Y(path_g[j]);
7128 x = GRID_X(path_g[j]);
7129 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7133 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7134 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7135 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7136 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7137 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7138 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7139 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7140 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7143 for( i = 0; i < path_n ; i++ )
7146 py = GRID_Y(path_g[i]);
7147 px = GRID_X(path_g[i]);
7148 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7149 if(!who && (project_m_n == 1) && !jump){
7150 if(cave[project_m_y][project_m_x].m_idx >0 ){
7151 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7155 /* Hack -- auto-recall */
7156 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7158 /* Hack - auto-track */
7159 health_track(cave[project_m_y][project_m_x].m_idx);
7163 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7168 /* Project along the path */
7169 for (i = 0; i < path_n; ++i)
7174 int ny = GRID_Y(path_g[i]);
7175 int nx = GRID_X(path_g[i]);
7177 if (flg & PROJECT_DISI)
7179 /* Hack -- Balls explode before reaching walls */
7180 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7182 else if (flg & PROJECT_LOS)
7184 /* Hack -- Balls explode before reaching walls */
7185 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7189 /* Hack -- Balls explode before reaching walls */
7190 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7197 /* Collect beam grids */
7198 if (flg & (PROJECT_BEAM))
7205 /* Only do visuals if requested */
7206 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7208 /* Only do visuals if the player can "see" the bolt */
7209 if (panel_contains(y, x) && player_has_los_bold(y, x))
7216 /* Obtain the bolt pict */
7217 p = bolt_pict(oy, ox, y, x, typ);
7219 /* Extract attr/char */
7223 /* Visual effects */
7224 print_rel(c, a, y, x);
7225 move_cursor_relative(y, x);
7226 /*if (fresh_before)*/ Term_fresh();
7227 Term_xtra(TERM_XTRA_DELAY, msec);
7229 /*if (fresh_before)*/ Term_fresh();
7231 /* Display "beam" grids */
7232 if (flg & (PROJECT_BEAM))
7234 /* Obtain the explosion pict */
7235 p = bolt_pict(y, x, y, x, typ);
7237 /* Extract attr/char */
7241 /* Visual effects */
7242 print_rel(c, a, y, x);
7245 /* Hack -- Activate delay */
7249 /* Hack -- delay anyway for consistency */
7252 /* Delay for consistency */
7253 Term_xtra(TERM_XTRA_DELAY, msec);
7260 /* Save the "blast epicenter" */
7264 if (breath && !path_n)
7270 flg &= ~(PROJECT_HIDE);
7274 /* Start the "explosion" */
7277 /* Hack -- make sure beams get to "explode" */
7285 /* If we found a "target", explode there */
7286 if (dist <= MAX_RANGE)
7288 /* Mega-Hack -- remove the final "beam" grid */
7289 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7292 * Create a conical breath attack
7303 flg &= ~(PROJECT_HIDE);
7305 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7309 /* Determine the blast area, work from the inside out */
7310 for (dist = 0; dist <= rad; dist++)
7312 /* Scan the maximal blast area of radius "dist" */
7313 for (y = by - dist; y <= by + dist; y++)
7315 for (x = bx - dist; x <= bx + dist; x++)
7317 /* Ignore "illegal" locations */
7318 if (!in_bounds2(y, x)) continue;
7320 /* Enforce a "circular" explosion */
7321 if (distance(by, bx, y, x) != dist) continue;
7327 /* Lights are stopped by opaque terrains */
7328 if (!los(by, bx, y, x)) continue;
7330 case GF_DISINTEGRATE:
7331 /* Disintegration are stopped only by perma-walls */
7332 if (!in_disintegration_range(by, bx, y, x)) continue;
7335 /* Ball explosions are stopped by walls */
7336 if (!projectable(by, bx, y, x)) continue;
7340 /* Save this grid */
7347 /* Encode some more "radius" info */
7353 /* Speed -- ignore "non-explosions" */
7354 if (!grids) return (FALSE);
7357 /* Display the "blast area" if requested */
7358 if (!blind && !(flg & (PROJECT_HIDE)))
7360 /* Then do the "blast", from inside out */
7361 for (t = 0; t <= gm_rad; t++)
7363 /* Dump everything with this radius */
7364 for (i = gm[t]; i < gm[t+1]; i++)
7366 /* Extract the location */
7370 /* Only do visuals if the player can "see" the blast */
7371 if (panel_contains(y, x) && player_has_los_bold(y, x))
7380 /* Obtain the explosion pict */
7381 p = bolt_pict(y, x, y, x, typ);
7383 /* Extract attr/char */
7387 /* Visual effects -- Display */
7388 print_rel(c, a, y, x);
7392 /* Hack -- center the cursor */
7393 move_cursor_relative(by, bx);
7395 /* Flush each "radius" seperately */
7396 /*if (fresh_before)*/ Term_fresh();
7398 /* Delay (efficiently) */
7399 if (visual || drawn)
7401 Term_xtra(TERM_XTRA_DELAY, msec);
7405 /* Flush the erasing */
7408 /* Erase the explosion drawn above */
7409 for (i = 0; i < grids; i++)
7411 /* Extract the location */
7415 /* Hack -- Erase if needed */
7416 if (panel_contains(y, x) && player_has_los_bold(y, x))
7422 /* Hack -- center the cursor */
7423 move_cursor_relative(by, bx);
7425 /* Flush the explosion */
7426 /*if (fresh_before)*/ Term_fresh();
7431 /* Update stuff if needed */
7432 if (p_ptr->update) update_stuff();
7435 if (flg & PROJECT_KILL)
7437 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7438 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7442 /* Check features */
7443 if (flg & (PROJECT_GRID))
7445 /* Start with "dist" of zero */
7448 /* Scan for features */
7449 for (i = 0; i < grids; i++)
7451 /* Hack -- Notice new "dist" values */
7452 if (gm[dist+1] == i) dist++;
7454 /* Get the grid location */
7458 /* Find the closest point in the blast */
7461 int d = dist_to_line(y, x, y1, x1, by, bx);
7463 /* Affect the grid */
7464 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7468 /* Affect the grid */
7469 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7474 /* Update stuff if needed */
7475 if (p_ptr->update) update_stuff();
7478 if (flg & (PROJECT_ITEM))
7480 /* Start with "dist" of zero */
7483 /* Scan for objects */
7484 for (i = 0; i < grids; i++)
7486 /* Hack -- Notice new "dist" values */
7487 if (gm[dist+1] == i) dist++;
7489 /* Get the grid location */
7493 /* Find the closest point in the blast */
7496 int d = dist_to_line(y, x, y1, x1, by, bx);
7498 /* Affect the object in the grid */
7499 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7503 /* Affect the object in the grid */
7504 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7510 /* Check monsters */
7511 if (flg & (PROJECT_KILL))
7518 /* Start with "dist" of zero */
7521 /* Scan for monsters */
7522 for (i = 0; i < grids; i++)
7526 /* Hack -- Notice new "dist" values */
7527 if (gm[dist + 1] == i) dist++;
7529 /* Get the grid location */
7533 /* A single bolt may be reflected */
7536 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7537 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7539 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7540 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7541 (!who || dist_hack > 1) && !one_in_(10))
7544 int max_attempts = 10;
7546 /* Choose 'new' target */
7549 t_y = y_saver - 1 + randint1(3);
7550 t_x = x_saver - 1 + randint1(3);
7553 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7555 if (max_attempts < 1)
7561 sound(SOUND_REFLECT);
7564 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7565 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7566 else if (m_ptr->r_idx == MON_DIO)
7567 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7569 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7571 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7573 /* Reflected bolts randomly target either one */
7574 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7575 else flg |= PROJECT_PLAYER;
7577 /* The bolt is reflected */
7578 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7580 /* Don't affect the monster any longer */
7586 /* Find the closest point in the blast */
7589 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7593 effective_dist = dist;
7597 /* There is the riding player on this monster */
7598 if (p_ptr->riding && player_bold(y, x))
7600 /* Aimed on the player */
7601 if (flg & PROJECT_PLAYER)
7603 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7606 * A beam or bolt is well aimed
7608 * So don't affects the mount.
7615 * The spell is not well aimed,
7616 * So partly affect the mount too.
7623 * This grid is the original target.
7624 * Or aimed on your horse.
7626 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7628 /* Hit the mount with full damage */
7632 * Otherwise this grid is not the
7633 * original target, it means that line
7634 * of fire is obstructed by this
7638 * A beam or bolt will hit either
7639 * player or mount. Choose randomly.
7641 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7645 /* Hit the mount with full damage */
7649 /* Hit the player later */
7650 flg |= PROJECT_PLAYER;
7652 /* Don't affect the mount */
7658 * The spell is not well aimed, so
7659 * partly affect both player and
7668 /* Affect the monster in the grid */
7669 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7673 /* Player affected one monster (without "jumping") */
7674 if (!who && (project_m_n == 1) && !jump)
7679 /* Track if possible */
7680 if (cave[y][x].m_idx > 0)
7682 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7686 /* Hack -- auto-recall */
7687 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7689 /* Hack - auto-track */
7690 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7698 if (flg & (PROJECT_KILL))
7700 /* Start with "dist" of zero */
7703 /* Scan for player */
7704 for (i = 0; i < grids; i++)
7708 /* Hack -- Notice new "dist" values */
7709 if (gm[dist+1] == i) dist++;
7711 /* Get the grid location */
7715 /* Affect the player? */
7716 if (!player_bold(y, x)) continue;
7718 /* Find the closest point in the blast */
7721 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7725 effective_dist = dist;
7728 /* Target may be your horse */
7731 /* Aimed on the player */
7732 if (flg & PROJECT_PLAYER)
7734 /* Hit the player with full damage */
7738 * Hack -- When this grid was not the
7739 * original target, a beam or bolt
7740 * would hit either player or mount,
7741 * and should be choosen randomly.
7743 * But already choosen to hit the
7744 * mount at this point.
7746 * Or aimed on your horse.
7748 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7751 * A beam or bolt is well aimed
7753 * So don't affects the player.
7760 * The spell is not well aimed,
7761 * So partly affect the player too.
7767 /* Affect the player */
7768 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7776 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7778 if (rakubadam_m > 0)
7780 if (rakuba(rakubadam_m, FALSE))
7782 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7785 if (p_ptr->riding && rakubadam_p > 0)
7787 if(rakuba(rakubadam_p, FALSE))
7789 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7794 /* Return "something was noticed" */
7799 * @brief 鏡魔法「封魔結界」の効果処理
7801 * @return 効果があったらTRUEを返す
7803 bool binding_field(HIT_POINT dam)
7805 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7806 int mirror_num = 0; /* 鏡の数 */
7808 POSITION centersign;
7809 POSITION x1, x2, y1, y2;
7811 int msec = delay_factor*delay_factor*delay_factor;
7814 POSITION point_x[3];
7815 POSITION point_y[3];
7817 /* Default target of monsterspell is player */
7818 monster_target_y = p_ptr->y;
7819 monster_target_x = p_ptr->x;
7821 for (x = 0; x < cur_wid; x++)
7823 for (y = 0; y < cur_hgt; y++)
7825 if (is_mirror_grid(&cave[y][x]) &&
7826 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7827 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7828 player_has_los_bold(y, x) &&
7829 projectable(p_ptr->y, p_ptr->x, y, x)
7831 mirror_y[mirror_num] = y;
7832 mirror_x[mirror_num] = x;
7838 if (mirror_num < 2)return FALSE;
7840 point_x[0] = randint0(mirror_num);
7842 point_x[1] = randint0(mirror_num);
7843 } while (point_x[0] == point_x[1]);
7845 point_y[0] = mirror_y[point_x[0]];
7846 point_x[0] = mirror_x[point_x[0]];
7847 point_y[1] = mirror_y[point_x[1]];
7848 point_x[1] = mirror_x[point_x[1]];
7849 point_y[2] = p_ptr->y;
7850 point_x[2] = p_ptr->x;
7852 x = point_x[0] + point_x[1] + point_x[2];
7853 y = point_y[0] + point_y[1] + point_y[2];
7855 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7856 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7857 if (centersign == 0)return FALSE;
7859 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7860 x1 = x1 < point_x[2] ? x1 : point_x[2];
7861 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7862 y1 = y1 < point_y[2] ? y1 : point_y[2];
7864 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7865 x2 = x2 > point_x[2] ? x2 : point_x[2];
7866 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7867 y2 = y2 > point_y[2] ? y2 : point_y[2];
7869 for (y = y1; y <= y2; y++) {
7870 for (x = x1; x <= x2; x++) {
7871 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7872 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7873 centersign*((point_x[1] - x)*(point_y[2] - y)
7874 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7875 centersign*((point_x[2] - x)*(point_y[0] - y)
7876 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7878 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7879 /* Visual effects */
7881 && panel_contains(y, x)) {
7882 p = bolt_pict(y, x, y, x, GF_MANA);
7883 print_rel(PICT_C(p), PICT_A(p), y, x);
7884 move_cursor_relative(y, x);
7885 /*if (fresh_before)*/ Term_fresh();
7886 Term_xtra(TERM_XTRA_DELAY, msec);
7892 for (y = y1; y <= y2; y++) {
7893 for (x = x1; x <= x2; x++) {
7894 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7895 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7896 centersign*((point_x[1] - x)*(point_y[2] - y)
7897 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7898 centersign*((point_x[2] - x)*(point_y[0] - y)
7899 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7901 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7902 (void)project_f(0, 0, y, x, dam, GF_MANA);
7907 for (y = y1; y <= y2; y++) {
7908 for (x = x1; x <= x2; x++) {
7909 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7910 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7911 centersign*((point_x[1] - x)*(point_y[2] - y)
7912 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7913 centersign*((point_x[2] - x)*(point_y[0] - y)
7914 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7916 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7917 (void)project_o(0, 0, y, x, dam, GF_MANA);
7922 for (y = y1; y <= y2; y++) {
7923 for (x = x1; x <= x2; x++) {
7924 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7925 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7926 centersign*((point_x[1] - x)*(point_y[2] - y)
7927 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7928 centersign*((point_x[2] - x)*(point_y[0] - y)
7929 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7931 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7932 (void)project_m(0, 0, y, x, dam, GF_MANA,
7933 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7939 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7940 remove_mirror(point_y[0], point_x[0]);
7947 * @brief 鏡魔法「鏡の封印」の効果処理
7949 * @return 効果があったらTRUEを返す
7951 void seal_of_mirror(HIT_POINT dam)
7955 for (x = 0; x < cur_wid; x++)
7957 for (y = 0; y < cur_hgt; y++)
7959 if (is_mirror_grid(&cave[y][x]))
7961 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7962 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7964 if (!cave[y][x].m_idx)
7966 remove_mirror(y, x);