3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
19 #include "monsterrace-hook.h"
22 #include "projection.h"
25 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
26 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
28 int project_length = 0; /*!< 投射の射程距離 */
32 * @brief モンスター魅了用セービングスロー共通部(汎用系)
34 * @param m_ptr 対象モンスター
35 * @return 魅了に抵抗したらTRUE
37 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
39 monster_race *r_ptr = &r_info[m_ptr->r_idx];
41 if(p_ptr->inside_arena) return TRUE;
44 if (r_ptr->flagsr & RFR_RES_ALL)
46 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
50 if (r_ptr->flags3 & RF3_NO_CONF)
52 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
56 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
58 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
59 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
60 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
64 * @brief モンスター服従用セービングスロー共通部(部族依存系)
66 * @param m_ptr 対象モンスター
67 * @return 服従に抵抗したらTRUE
69 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
71 monster_race *r_ptr = &r_info[m_ptr->r_idx];
73 if (p_ptr->inside_arena) return TRUE;
76 if (r_ptr->flagsr & RFR_RES_ALL)
78 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
82 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
84 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
85 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
86 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
90 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
93 * ハードコーティングによる実装が行われている。
94 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
96 PERCENTAGE beam_chance(void)
98 if (p_ptr->pclass == CLASS_MAGE)
99 return (PERCENTAGE)(p_ptr->lev);
100 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
101 return (PERCENTAGE)(p_ptr->lev + 10);
103 return (PERCENTAGE)(p_ptr->lev / 2);
108 * @brief 配置した鏡リストの次を取得する /
109 * Get another mirror. for SEEKER
110 * @param next_y 次の鏡のy座標を返す参照ポインタ
111 * @param next_x 次の鏡のx座標を返す参照ポインタ
112 * @param cury 現在の鏡のy座標
113 * @param curx 現在の鏡のx座標
115 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
117 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
118 int mirror_num = 0; /* 鏡の数 */
122 for (x = 0; x < cur_wid; x++)
124 for (y = 0; y < cur_hgt; y++)
126 if (is_mirror_grid(&cave[y][x])) {
127 mirror_y[mirror_num] = y;
128 mirror_x[mirror_num] = x;
135 num = randint0(mirror_num);
136 *next_y = mirror_y[num];
137 *next_x = mirror_x[num];
140 *next_y = cury + randint0(5) - 2;
141 *next_x = curx + randint0(5) - 2;
146 * @brief 万色表現用にランダムな色を選択する関数 /
147 * Get a legal "multi-hued" color for drawing "spells"
151 static TERM_COLOR mh_attr(int max)
153 switch (randint1(max))
155 case 1: return (TERM_RED);
156 case 2: return (TERM_GREEN);
157 case 3: return (TERM_BLUE);
158 case 4: return (TERM_YELLOW);
159 case 5: return (TERM_ORANGE);
160 case 6: return (TERM_VIOLET);
161 case 7: return (TERM_L_RED);
162 case 8: return (TERM_L_GREEN);
163 case 9: return (TERM_L_BLUE);
164 case 10: return (TERM_UMBER);
165 case 11: return (TERM_L_UMBER);
166 case 12: return (TERM_SLATE);
167 case 13: return (TERM_WHITE);
168 case 14: return (TERM_L_WHITE);
169 case 15: return (TERM_L_DARK);
177 * @brief 魔法属性に応じたエフェクトの色を返す /
178 * Return a color to use for the bolt/ball spells
182 static TERM_COLOR spell_color(int type)
184 /* Check if A.B.'s new graphics should be used (rr9) */
185 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
190 case GF_PSY_SPEAR: return (0x06);
191 case GF_MISSILE: return (0x0F);
192 case GF_ACID: return (0x04);
193 case GF_ELEC: return (0x02);
194 case GF_FIRE: return (0x00);
195 case GF_COLD: return (0x01);
196 case GF_POIS: return (0x03);
197 case GF_HOLY_FIRE: return (0x00);
198 case GF_HELL_FIRE: return (0x00);
199 case GF_MANA: return (0x0E);
201 case GF_SEEKER: return (0x0E);
202 case GF_SUPER_RAY: return (0x0E);
204 case GF_ARROW: return (0x0F);
205 case GF_WATER: return (0x04);
206 case GF_NETHER: return (0x07);
207 case GF_CHAOS: return (mh_attr(15));
208 case GF_DISENCHANT: return (0x05);
209 case GF_NEXUS: return (0x0C);
210 case GF_CONFUSION: return (mh_attr(4));
211 case GF_SOUND: return (0x09);
212 case GF_SHARDS: return (0x08);
213 case GF_FORCE: return (0x09);
214 case GF_INERTIAL: return (0x09);
215 case GF_GRAVITY: return (0x09);
216 case GF_TIME: return (0x09);
217 case GF_LITE_WEAK: return (0x06);
218 case GF_LITE: return (0x06);
219 case GF_DARK_WEAK: return (0x07);
220 case GF_DARK: return (0x07);
221 case GF_PLASMA: return (0x0B);
222 case GF_METEOR: return (0x00);
223 case GF_ICE: return (0x01);
224 case GF_ROCKET: return (0x0F);
225 case GF_DEATH_RAY: return (0x07);
226 case GF_NUKE: return (mh_attr(2));
227 case GF_DISINTEGRATE: return (0x05);
239 case GF_CAUSE_4: return (0x0E);
240 case GF_HAND_DOOM: return (0x07);
241 case GF_CAPTURE : return (0x0E);
242 case GF_IDENTIFY: return (0x01);
243 case GF_ATTACK: return (0x0F);
244 case GF_PHOTO : return (0x06);
247 /* Normal tiles or ASCII */
253 /* Lookup the default colors for this type */
254 concptr s = quark_str(gf_color[type]);
256 if (!s) return (TERM_WHITE);
258 /* Pick a random color */
259 c = s[randint0(strlen(s))];
261 /* Lookup this color */
262 a = my_strchr(color_char, c) - color_char;
264 /* Invalid color (note check for < 0 removed, gave a silly
265 * warning because bytes are always >= 0 -- RG) */
266 if (a > 15) return (TERM_WHITE);
272 /* Standard "color" */
278 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
279 * Find the attr/char pair to use for a spell effect
288 * It is moving (or has moved) from (x,y) to (nx,ny).
289 * If the distance is not "one", we (may) return "*".
292 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
302 if ((ny == y) && (nx == x)) base = 0x30;
305 else if (nx == x) base = 0x40;
308 else if (ny == y) base = 0x50;
311 else if ((ny - y) == (x - nx)) base = 0x60;
314 else if ((ny - y) == (nx - x)) base = 0x70;
319 /* Basic spell color */
320 k = spell_color(typ);
322 /* Obtain attr/char */
323 a = misc_to_attr[base + k];
324 c = misc_to_char[base + k];
332 * @brief 始点から終点への経路を返す /
333 * Determine the path taken by a projection.
334 * @param gp 経路座標リストを返す参照ポインタ
344 * The projection will always start from the grid (y1,x1), and will travel
345 * towards the grid (y2,x2), touching one grid per unit of distance along
346 * the major axis, and stopping when it enters the destination grid or a
347 * wall grid, or has travelled the maximum legal distance of "range".
349 * Note that "distance" in this function (as in the "update_view()" code)
350 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
351 * actually has an "octagon of projection" not a "circle of projection".
353 * The path grids are saved into the grid array pointed to by "gp", and
354 * there should be room for at least "range" grids in "gp". Note that
355 * due to the way in which distance is calculated, this function normally
356 * uses fewer than "range" grids for the projection path, so the result
357 * of this function should never be compared directly to "range". Note
358 * that the initial grid (y1,x1) is never saved into the grid array, not
359 * even if the initial grid is also the final grid.
361 * The "flg" flags can be used to modify the behavior of this function.
363 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
364 * semantics as they do for the "project" function, namely, that the path
365 * will stop as soon as it hits a monster, or that the path will continue
366 * through the destination grid, respectively.
368 * The "PROJECT_JUMP" flag, which for the "project()" function means to
369 * start at a special grid (which makes no sense in this function), means
370 * that the path should be "angled" slightly if needed to avoid any wall
371 * grids, allowing the player to "target" any grid which is in "view".
372 * This flag is non-trivial and has not yet been implemented, but could
373 * perhaps make use of the "vinfo" array (above).
375 * This function returns the number of grids (if any) in the path. This
376 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
378 * This algorithm is similar to, but slightly different from, the one used
379 * by "update_view_los()", and very different from the one used by "los()".
382 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
404 /* No path necessary (or allowed) */
405 if ((x1 == x2) && (y1 == y2)) return (0);
433 /* Number of "units" in one "half" grid */
436 /* Number of "units" in one "full" grid */
442 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
453 /* Advance (X) part 2 */
456 /* Advance (X) part 3 */
463 /* Create the projection path */
467 gp[n++] = GRID(y, x);
469 /* Hack -- Check maximum range */
470 if ((n + (k >> 1)) >= range) break;
472 /* Sometimes stop at destination grid */
473 if (!(flg & (PROJECT_THRU)))
475 if ((x == x2) && (y == y2)) break;
478 if (flg & (PROJECT_DISI))
480 if ((n > 0) && cave_stop_disintegration(y, x)) break;
482 else if (flg & (PROJECT_LOS))
484 if ((n > 0) && !cave_los_bold(y, x)) break;
486 else if (!(flg & (PROJECT_PATH)))
488 /* Always stop at non-initial wall grids */
489 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
492 /* Sometimes stop at non-initial monsters/players */
493 if (flg & (PROJECT_STOP))
496 (player_bold(y, x) || cave[y][x].m_idx != 0))
500 if (!in_bounds(y, x)) break;
505 /* Advance (X) part 1 */
508 /* Horizontal change */
511 /* Advance (X) part 2 */
514 /* Advance (X) part 3 */
530 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
539 /* Vertical change */
542 /* Advance (Y) part 2 */
545 /* Advance (Y) part 3 */
552 /* Create the projection path */
556 gp[n++] = GRID(y, x);
558 /* Hack -- Check maximum range */
559 if ((n + (k >> 1)) >= range) break;
561 /* Sometimes stop at destination grid */
562 if (!(flg & (PROJECT_THRU)))
564 if ((x == x2) && (y == y2)) break;
567 if (flg & (PROJECT_DISI))
569 if ((n > 0) && cave_stop_disintegration(y, x)) break;
571 else if (flg & (PROJECT_LOS))
573 if ((n > 0) && !cave_los_bold(y, x)) break;
575 else if (!(flg & (PROJECT_PATH)))
577 /* Always stop at non-initial wall grids */
578 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
581 /* Sometimes stop at non-initial monsters/players */
582 if (flg & (PROJECT_STOP))
585 (player_bold(y, x) || cave[y][x].m_idx != 0))
589 if (!in_bounds(y, x)) break;
594 /* Advance (Y) part 1 */
597 /* Vertical change */
600 /* Advance (Y) part 2 */
603 /* Advance (Y) part 3 */
623 /* Create the projection path */
627 gp[n++] = GRID(y, x);
629 /* Hack -- Check maximum range */
630 if ((n + (n >> 1)) >= range) break;
632 /* Sometimes stop at destination grid */
633 if (!(flg & (PROJECT_THRU)))
635 if ((x == x2) && (y == y2)) break;
638 if (flg & (PROJECT_DISI))
640 if ((n > 0) && cave_stop_disintegration(y, x)) break;
642 else if (flg & (PROJECT_LOS))
644 if ((n > 0) && !cave_los_bold(y, x)) break;
646 else if (!(flg & (PROJECT_PATH)))
648 /* Always stop at non-initial wall grids */
649 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
652 /* Sometimes stop at non-initial monsters/players */
653 if (flg & (PROJECT_STOP))
656 (player_bold(y, x) || cave[y][x].m_idx != 0))
660 if (!in_bounds(y, x)) break;
677 * Mega-Hack -- track "affected" monsters (see "project()" comments)
679 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
680 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
681 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
682 /* Mega-Hack -- monsters target */
683 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
684 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
688 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
689 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
690 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
691 * @param y 目標Y座標 / Target y location (or location to travel "towards")
692 * @param x 目標X座標 / Target x location (or location to travel "towards")
693 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
694 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
695 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
698 * We are called both for "beam" effects and "ball" effects.
700 * The "r" parameter is the "distance from ground zero".
702 * Note that we determine if the player can "see" anything that happens
703 * by taking into account: blindness, line-of-sight, and illumination.
705 * We return "TRUE" if the effect of the projection is "obvious".
707 * We also "see" grids which are "memorized", probably a hack
709 * Perhaps we should affect doors?
712 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
714 cave_type *c_ptr = &cave[y][x];
715 feature_type *f_ptr = &f_info[c_ptr->feat];
717 bool obvious = FALSE;
718 bool known = player_has_los_bold(y, x);
723 /* Reduce damage by distance */
724 dam = (dam + r) / (r + 1);
727 if (have_flag(f_ptr->flags, FF_TREE))
735 message = _("枯れた", "was blasted."); break;
737 message = _("縮んだ", "shrank."); break;
739 message = _("溶けた", "melted."); break;
742 message = _("凍り、砕け散った", "was frozen and smashed."); break;
746 message = _("燃えた", "burns up!"); break;
758 message = _("粉砕された", "was crushed."); break;
760 message = NULL; break;
764 msg_format(_("木は%s。", "A tree %s"), message);
765 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
768 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
772 /* Analyze the type */
775 /* Ignore most effects */
810 /* Destroy Traps (and Locks) */
813 /* Reveal secret doors */
814 if (is_hidden_door(c_ptr))
819 /* Check line of sight */
827 if (is_trap(c_ptr->feat))
829 /* Check line of sight */
832 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
836 /* Destroy the trap */
837 cave_alter_feat(y, x, FF_DISARM);
840 /* Locked doors are unlocked */
841 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
843 s16b old_feat = c_ptr->feat;
845 /* Unlock the door */
846 cave_alter_feat(y, x, FF_DISARM);
848 /* Check line of sound */
849 if (known && (old_feat != c_ptr->feat))
851 msg_print(_("カチッと音がした!", "Click!"));
856 /* Remove "unsafe" flag if player is not blind */
857 if (!p_ptr->blind && player_has_los_bold(y, x))
859 c_ptr->info &= ~(CAVE_UNSAFE);
867 /* Destroy Doors (and traps) */
870 /* Destroy all doors and traps */
871 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
873 /* Check line of sight */
876 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
880 /* Destroy the feature */
881 cave_alter_feat(y, x, FF_TUNNEL);
884 /* Remove "unsafe" flag if player is not blind */
885 if (!p_ptr->blind && player_has_los_bold(y, x))
887 c_ptr->info &= ~(CAVE_UNSAFE);
895 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
897 if (have_flag(f_ptr->flags, FF_SPIKE))
899 s16b old_mimic = c_ptr->mimic;
900 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
902 cave_alter_feat(y, x, FF_SPIKE);
903 c_ptr->mimic = old_mimic;
908 /* Check line of sight */
909 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
911 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
918 /* Destroy walls (and doors) */
921 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
923 if (known && (c_ptr->info & (CAVE_MARK)))
925 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
929 /* Destroy the wall */
930 cave_alter_feat(y, x, FF_HURT_ROCK);
932 /* Update some things */
933 p_ptr->update |= (PU_FLOW);
942 /* Require a "naked" floor grid */
943 if (!cave_naked_bold(y, x)) break;
945 /* Not on the player */
946 if (player_bold(y, x)) break;
948 /* Create a closed door */
949 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
952 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
969 /* Require a "naked" floor grid */
970 if (!cave_naked_bold(y, x)) break;
972 /* Not on the player */
973 if (player_bold(y, x)) break;
975 /* Create a closed door */
976 cave_set_feat(y, x, feat_tree);
979 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
987 /* Require a "naked" floor grid */
988 if (!cave_naked_bold(y, x)) break;
991 c_ptr->info |= CAVE_OBJECT;
992 c_ptr->mimic = feat_glyph;
1003 /* Require a "naked" floor grid */
1004 if (!cave_naked_bold(y, x)) break;
1006 /* Not on the player */
1007 if (player_bold(y, x)) break;
1010 cave_set_feat(y, x, feat_granite);
1018 /* Ignore permanent grid */
1019 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1024 /* Ignore grid without enough space */
1025 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1027 /* Place a shallow lava */
1028 cave_set_feat(y, x, feat_shallow_lava);
1033 /* Place a deep lava */
1034 cave_set_feat(y, x, feat_deep_lava);
1041 /* Ignore permanent grid */
1042 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1047 /* Ignore grid without enough space */
1048 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1050 /* Place a shallow water */
1051 cave_set_feat(y, x, feat_shallow_water);
1056 /* Place a deep water */
1057 cave_set_feat(y, x, feat_deep_water);
1062 /* Lite up the grid */
1066 /* Turn on the light */
1067 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1069 c_ptr->info |= (CAVE_GLOW);
1072 update_local_illumination(y, x);
1075 if (player_can_see_bold(y, x)) obvious = TRUE;
1077 /* Mega-Hack -- Update the monster in the affected grid */
1078 /* This allows "spear of light" (etc) to work "correctly" */
1079 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1081 if (p_ptr->special_defense & NINJA_S_STEALTH)
1083 if (player_bold(y, x)) set_superstealth(FALSE);
1090 /* Darken the grid */
1094 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1097 /* Turn off the light. */
1100 if (dun_level || !is_daytime())
1102 for (j = 0; j < 9; j++)
1104 int by = y + ddy_ddd[j];
1105 int bx = x + ddx_ddd[j];
1107 if (in_bounds2(by, bx))
1109 cave_type *cc_ptr = &cave[by][bx];
1111 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1119 if (!do_dark) break;
1122 c_ptr->info &= ~(CAVE_GLOW);
1124 /* Hack -- Forget "boring" grids */
1125 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1128 c_ptr->info &= ~(CAVE_MARK);
1135 update_local_illumination(y, x);
1137 if (player_can_see_bold(y, x)) obvious = TRUE;
1139 /* Mega-Hack -- Update the monster in the affected grid */
1140 /* This allows "spear of light" (etc) to work "correctly" */
1141 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1151 if (is_mirror_grid(c_ptr))
1153 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1155 remove_mirror(y, x);
1156 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1159 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1161 if (known && (c_ptr->info & CAVE_MARK))
1163 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1167 /* Destroy the wall */
1168 cave_alter_feat(y, x, FF_HURT_ROCK);
1170 /* Update some things */
1171 p_ptr->update |= (PU_FLOW);
1178 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1180 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1182 remove_mirror(y, x);
1183 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1186 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1188 if (known && (c_ptr->info & CAVE_MARK))
1190 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1194 /* Destroy the wall */
1195 cave_alter_feat(y, x, FF_HURT_ROCK);
1197 /* Update some things */
1198 p_ptr->update |= (PU_FLOW);
1203 case GF_DISINTEGRATE:
1205 /* Destroy mirror/glyph */
1206 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1207 remove_mirror(y, x);
1209 /* Permanent features don't get effect */
1210 /* But not protect monsters and other objects */
1211 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1213 cave_alter_feat(y, x, FF_HURT_DISI);
1215 /* Update some things -- similar to GF_KILL_WALL */
1216 p_ptr->update |= (PU_FLOW);
1223 /* Return "Anything seen?" */
1230 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1231 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1232 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1233 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1234 * @param x 目標X座標 / Target x location (or location to travel "towards")
1235 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1236 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1237 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1240 * We are called from "project()" to "damage" objects
1242 * We are called both for "beam" effects and "ball" effects.
1244 * Perhaps we should only SOMETIMES damage things on the ground.
1246 * The "r" parameter is the "distance from ground zero".
1248 * Note that we determine if the player can "see" anything that happens
1249 * by taking into account: blindness, line-of-sight, and illumination.
1251 * We also "see" grids which are "memorized", probably a hack
1253 * We return "TRUE" if the effect of the projection is "obvious".
1256 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1258 cave_type *c_ptr = &cave[y][x];
1260 OBJECT_IDX this_o_idx, next_o_idx = 0;
1262 bool obvious = FALSE;
1263 bool known = player_has_los_bold(y, x);
1265 BIT_FLAGS flgs[TR_FLAG_SIZE];
1267 GAME_TEXT o_name[MAX_NLEN];
1269 KIND_OBJECT_IDX k_idx = 0;
1270 bool is_potion = FALSE;
1273 who = who ? who : 0;
1275 /* Reduce damage by distance */
1276 dam = (dam + r) / (r + 1);
1279 /* Scan all objects in the grid */
1280 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1282 object_type *o_ptr = &o_list[this_o_idx];
1284 bool is_art = FALSE;
1285 bool ignore = FALSE;
1286 bool do_kill = FALSE;
1288 concptr note_kill = NULL;
1291 /* Get the "plural"-ness */
1292 bool plural = (o_ptr->number > 1);
1295 /* Acquire next object */
1296 next_o_idx = o_ptr->next_o_idx;
1297 object_flags(o_ptr, flgs);
1299 /* Check for artifact */
1300 if (object_is_artifact(o_ptr)) is_art = TRUE;
1302 /* Analyze the type */
1305 /* Acid -- Lots of things */
1308 if (hates_acid(o_ptr))
1311 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1312 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1317 /* Elec -- Rings and Wands */
1320 if (hates_elec(o_ptr))
1323 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1324 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1329 /* Fire -- Flammable objects */
1332 if (hates_fire(o_ptr))
1335 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1336 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1341 /* Cold -- potions and flasks */
1344 if (hates_cold(o_ptr))
1346 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1348 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1356 if (hates_fire(o_ptr))
1359 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1360 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1362 if (hates_elec(o_ptr))
1366 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1367 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1375 if (hates_fire(o_ptr))
1378 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1379 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1381 if (hates_cold(o_ptr))
1385 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1386 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1391 /* Hack -- break potions and such */
1397 if (hates_cold(o_ptr))
1399 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1405 /* Mana and Chaos -- destroy everything */
1411 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1415 case GF_DISINTEGRATE:
1418 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1425 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1426 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1427 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1431 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1435 if (object_is_cursed(o_ptr))
1438 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1445 identify_item(o_ptr);
1447 /* Auto-inscription */
1448 autopick_alter_item((-this_o_idx), FALSE);
1456 /* Chests are noticed only if trapped or locked */
1457 if (o_ptr->tval == TV_CHEST)
1459 /* Disarm/Unlock traps */
1460 if (o_ptr->pval > 0)
1462 /* Disarm or Unlock */
1463 o_ptr->pval = (0 - o_ptr->pval);
1466 object_known(o_ptr);
1468 if (known && (o_ptr->marked & OM_FOUND))
1470 msg_print(_("カチッと音がした!", "Click!"));
1480 if (o_ptr->tval == TV_CORPSE)
1483 BIT_FLAGS mode = 0L;
1485 if (!who || is_pet(&m_list[who]))
1486 mode |= PM_FORCE_PET;
1488 for (i = 0; i < o_ptr->number ; i++)
1490 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1491 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1495 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1499 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1501 note_kill = _("生き返った。", " revived.");
1503 else if (!note_kill)
1505 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1516 /* Attempt to destroy the object */
1519 /* Effect "observed" */
1520 if (known && (o_ptr->marked & OM_FOUND))
1523 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1526 /* Artifacts, and other objects, get to resist */
1527 if (is_art || ignore)
1529 /* Observe the resist */
1530 if (known && (o_ptr->marked & OM_FOUND))
1532 msg_format(_("%sは影響を受けない!",
1533 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1540 /* Describe if needed */
1541 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1543 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1546 k_idx = o_ptr->k_idx;
1547 is_potion = object_is_potion(o_ptr);
1548 delete_object_idx(this_o_idx);
1550 /* Potions produce effects when 'shattered' */
1553 (void)potion_smash_effect(who, y, x, k_idx);
1561 /* Return "Anything seen?" */
1567 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1568 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1569 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1570 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1571 * @param x 目標X座標 / Target x location (or location to travel "towards")
1572 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1573 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1575 * @param see_s_msg TRUEならばメッセージを表示する
1576 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1579 * This routine takes a "source monster" (by index) which is mostly used to
1580 * determine if the player is causing the damage, and a "radius" (see below),
1581 * which is used to decrease the power of explosions with distance, and a
1582 * location, via integers which are modified by certain types of attacks
1583 * (polymorph and teleport being the obvious ones), a default damage, which
1584 * is modified as needed based on various properties, and finally a "damage
1585 * type" (see below).
1588 * Note that this routine can handle "no damage" attacks (like teleport) by
1589 * taking a "zero" damage, and can even take "parameters" to attacks (like
1590 * confuse) by accepting a "damage", using it to calculate the effect, and
1591 * then setting the damage to zero. Note that the "damage" parameter is
1592 * divided by the radius, so monsters not at the "epicenter" will not take
1593 * as much damage (or whatever)...
1596 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1597 * may result in a dereference of an invalid pointer.
1600 * Various messages are produced, and damage is applied.
1603 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1604 * actually be "made" of that substance, or "breathe" big balls of it.
1605 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1607 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1608 * and hurts evil less. If can breath nether, then it resists it as well.
1611 * Damage reductions use the following formulas:
1612 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1613 * gives avg damage of .655, ranging from .858 to .500
1614 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1615 * gives avg damage of .544, ranging from .714 to .417
1616 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1617 * gives avg damage of .444, ranging from .556 to .333
1618 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1619 * gives avg damage of .327, ranging from .427 to .250
1620 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1621 * gives something simple.
1624 * In this function, "result" messages are postponed until the end, where
1625 * the "note" string is appended to the monster name, if not NULL. So,
1626 * to make a spell have "no effect" just set "note" to NULL. You should
1627 * also set "notice" to FALSE, or the player will learn what the spell does.
1630 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1634 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)
1638 cave_type *c_ptr = &cave[y][x];
1640 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1641 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1643 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1647 /* Is the monster "seen"? */
1648 bool seen = m_ptr->ml;
1649 bool seen_msg = is_seen(m_ptr);
1651 bool slept = (bool)MON_CSLEEP(m_ptr);
1653 /* Were the effects "obvious" (if seen)? */
1654 bool obvious = FALSE;
1656 /* Can the player know about this effect? */
1657 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1659 /* Were the effects "irrelevant"? */
1660 bool skipped = FALSE;
1662 /* Gets the monster angry at the source of the effect? */
1663 bool get_angry = FALSE;
1665 /* Polymorph setting (true or false) */
1666 bool do_poly = FALSE;
1668 /* Teleport setting (max distance) */
1671 /* Confusion setting (amount to confuse) */
1674 /* Stunning setting (amount to stun) */
1677 /* Sleep amount (amount to sleep) */
1680 /* Fear amount (amount to fear) */
1683 /* Time amount (amount to time) */
1686 bool heal_leper = FALSE;
1688 /* Hold the monster name */
1689 GAME_TEXT m_name[MAX_NLEN];
1692 PARAMETER_VALUE photo = 0;
1694 /* Assume no note */
1695 concptr note = NULL;
1697 /* Assume a default death */
1698 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1700 POSITION ty = m_ptr->fy;
1701 POSITION tx = m_ptr->fx;
1703 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1706 if (!c_ptr->m_idx) return (FALSE);
1708 /* Never affect projector */
1709 if (who && (c_ptr->m_idx == who)) return (FALSE);
1710 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1711 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1713 /* Don't affect already death monsters */
1714 /* Prevents problems with chain reactions of exploding monsters */
1715 if (m_ptr->hp < 0) return (FALSE);
1717 /* Reduce damage by distance */
1718 dam = (dam + r) / (r + 1);
1721 /* Get the monster name (BEFORE polymorphing) */
1722 monster_desc(m_name, m_ptr, 0);
1724 /* Get the monster possessive ("his"/"her"/"its") */
1725 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1727 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1729 /* Analyze the damage type */
1732 /* Magic Missile -- pure damage */
1735 if (seen) obvious = TRUE;
1737 if (r_ptr->flagsr & RFR_RES_ALL)
1739 note = _("には完全な耐性がある!", " is immune.");
1741 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1750 if (seen) obvious = TRUE;
1752 if (r_ptr->flagsr & RFR_RES_ALL)
1754 note = _("には完全な耐性がある!", " is immune.");
1756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1759 if (r_ptr->flagsr & RFR_IM_ACID)
1761 note = _("にはかなり耐性がある!", " resists a lot.");
1763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1771 if (seen) obvious = TRUE;
1773 if (r_ptr->flagsr & RFR_RES_ALL)
1775 note = _("には完全な耐性がある!", " is immune.");
1777 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1780 if (r_ptr->flagsr & RFR_IM_ELEC)
1782 note = _("にはかなり耐性がある!", " resists a lot.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1792 if (seen) obvious = TRUE;
1794 if (r_ptr->flagsr & RFR_RES_ALL)
1796 note = _("には完全な耐性がある!", " is immune.");
1798 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1801 if (r_ptr->flagsr & RFR_IM_FIRE)
1803 note = _("にはかなり耐性がある!", " resists a lot.");
1805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1807 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1809 note = _("はひどい痛手をうけた。", " is hit hard.");
1811 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1819 if (seen) obvious = TRUE;
1821 if (r_ptr->flagsr & RFR_RES_ALL)
1823 note = _("には完全な耐性がある!", " is immune.");
1825 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1828 if (r_ptr->flagsr & RFR_IM_COLD)
1830 note = _("にはかなり耐性がある!", " resists a lot.");
1832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1834 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1836 note = _("はひどい痛手をうけた。", " is hit hard.");
1838 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1846 if (seen) obvious = TRUE;
1848 if (r_ptr->flagsr & RFR_RES_ALL)
1850 note = _("には完全な耐性がある!", " is immune.");
1852 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1855 if (r_ptr->flagsr & RFR_IM_POIS)
1857 note = _("にはかなり耐性がある!", " resists a lot.");
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1867 if (seen) obvious = TRUE;
1869 if (r_ptr->flagsr & RFR_RES_ALL)
1871 note = _("には完全な耐性がある!", " is immune.");
1873 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1876 if (r_ptr->flagsr & RFR_IM_POIS)
1878 note = _("には耐性がある。", " resists.");
1879 dam *= 3; dam /= randint1(6) + 6;
1880 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1882 else if (one_in_(3)) do_poly = TRUE;
1886 /* Hellfire -- hurts Evil */
1889 if (seen) obvious = TRUE;
1891 if (r_ptr->flagsr & RFR_RES_ALL)
1893 note = _("には完全な耐性がある!", " is immune.");
1895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1898 if (r_ptr->flags3 & RF3_GOOD)
1900 note = _("はひどい痛手をうけた。", " is hit hard.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1907 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1910 if (seen) obvious = TRUE;
1912 if (r_ptr->flagsr & RFR_RES_ALL)
1914 note = _("には完全な耐性がある!", " is immune.");
1916 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1919 if (r_ptr->flags3 & RF3_GOOD)
1921 note = _("には完全な耐性がある!", " is immune.");
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1925 else if (r_ptr->flags3 & RF3_EVIL)
1928 note = _("はひどい痛手をうけた。", " is hit hard.");
1929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1933 note = _("には耐性がある。", " resists.");
1934 dam *= 3; dam /= randint1(6) + 6;
1939 /* Arrow -- XXX no defense */
1942 if (seen) obvious = TRUE;
1944 if (r_ptr->flagsr & RFR_RES_ALL)
1946 note = _("には完全な耐性がある!", " is immune.");
1948 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1954 /* Plasma -- XXX perhaps check ELEC or FIRE */
1957 if (seen) obvious = TRUE;
1959 if (r_ptr->flagsr & RFR_RES_ALL)
1961 note = _("には完全な耐性がある!", " is immune.");
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1966 if (r_ptr->flagsr & RFR_RES_PLAS)
1968 note = _("には耐性がある。", " resists.");
1969 dam *= 3; dam /= randint1(6) + 6;
1970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1975 /* Nether -- see above */
1978 if (seen) obvious = TRUE;
1980 if (r_ptr->flagsr & RFR_RES_ALL)
1982 note = _("には完全な耐性がある!", " is immune.");
1984 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1987 if (r_ptr->flagsr & RFR_RES_NETH)
1989 if (r_ptr->flags3 & RF3_UNDEAD)
1991 note = _("には完全な耐性がある!", " is immune.");
1993 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1997 note = _("には耐性がある。", " resists.");
1998 dam *= 3; dam /= randint1(6) + 6;
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2002 else if (r_ptr->flags3 & RF3_EVIL)
2004 note = _("はいくらか耐性を示した。", " resists somewhat.");
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2011 /* Water (acid) damage -- Water spirits/elementals are immune */
2014 if (seen) obvious = TRUE;
2016 if (r_ptr->flagsr & RFR_RES_ALL)
2018 note = _("には完全な耐性がある!", " is immune.");
2020 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2023 if (r_ptr->flagsr & RFR_RES_WATE)
2025 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2027 note = _("には完全な耐性がある!", " is immune.");
2032 note = _("には耐性がある。", " resists.");
2033 dam *= 3; dam /= randint1(6) + 6;
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2040 /* Chaos -- Chaos breathers resist */
2043 if (seen) obvious = TRUE;
2045 if (r_ptr->flagsr & RFR_RES_ALL)
2047 note = _("には完全な耐性がある!", " is immune.");
2049 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2052 if (r_ptr->flagsr & RFR_RES_CHAO)
2054 note = _("には耐性がある。", " resists.");
2055 dam *= 3; dam /= randint1(6) + 6;
2056 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2058 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2060 note = _("はいくらか耐性を示した。", " resists somewhat.");
2061 dam *= 3; dam /= randint1(6) + 6;
2062 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2067 do_conf = (5 + randint1(11) + r) / (r + 1);
2072 /* Shards -- Shard breathers resist */
2075 if (seen) obvious = TRUE;
2077 if (r_ptr->flagsr & RFR_RES_ALL)
2079 note = _("には完全な耐性がある!", " is immune.");
2081 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2084 if (r_ptr->flagsr & RFR_RES_SHAR)
2086 note = _("には耐性がある。", " resists.");
2087 dam *= 3; dam /= randint1(6) + 6;
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2093 /* Rocket: Shard resistance helps */
2096 if (seen) obvious = TRUE;
2098 if (r_ptr->flagsr & RFR_RES_ALL)
2100 note = _("には完全な耐性がある!", " is immune.");
2102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2105 if (r_ptr->flagsr & RFR_RES_SHAR)
2107 note = _("はいくらか耐性を示した。", " resists somewhat.");
2109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2115 /* Sound -- Sound breathers resist */
2118 if (seen) obvious = TRUE;
2120 if (r_ptr->flagsr & RFR_RES_ALL)
2122 note = _("には完全な耐性がある!", " is immune.");
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2127 if (r_ptr->flagsr & RFR_RES_SOUN)
2129 note = _("には耐性がある。", " resists.");
2130 dam *= 2; dam /= randint1(6) + 6;
2131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2133 else do_stun = (10 + randint1(15) + r) / (r + 1);
2140 if (seen) obvious = TRUE;
2142 if (r_ptr->flagsr & RFR_RES_ALL)
2144 note = _("には完全な耐性がある!", " is immune.");
2146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2149 if (r_ptr->flags3 & RF3_NO_CONF)
2151 note = _("には耐性がある。", " resists.");
2152 dam *= 3; dam /= randint1(6) + 6;
2153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2155 else do_conf = (10 + randint1(15) + r) / (r + 1);
2159 /* Disenchantment -- Breathers and Disenchanters resist */
2162 if (seen) obvious = TRUE;
2164 if (r_ptr->flagsr & RFR_RES_ALL)
2166 note = _("には完全な耐性がある!", " is immune.");
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2171 if (r_ptr->flagsr & RFR_RES_DISE)
2173 note = _("には耐性がある。", " resists.");
2174 dam *= 3; dam /= randint1(6) + 6;
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2180 /* Nexus -- Breathers and Existers resist */
2183 if (seen) obvious = TRUE;
2185 if (r_ptr->flagsr & RFR_RES_ALL)
2187 note = _("には完全な耐性がある!", " is immune.");
2189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2192 if (r_ptr->flagsr & RFR_RES_NEXU)
2194 note = _("には耐性がある。", " resists.");
2195 dam *= 3; dam /= randint1(6) + 6;
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2204 if (seen) obvious = TRUE;
2206 if (r_ptr->flagsr & RFR_RES_ALL)
2208 note = _("には完全な耐性がある!", " is immune.");
2210 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2213 if (r_ptr->flagsr & RFR_RES_WALL)
2215 note = _("には耐性がある。", " resists.");
2216 dam *= 3; dam /= randint1(6) + 6;
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2219 else do_stun = (randint1(15) + r) / (r + 1);
2223 /* Inertia -- breathers resist */
2226 if (seen) obvious = TRUE;
2228 if (r_ptr->flagsr & RFR_RES_ALL)
2230 note = _("には完全な耐性がある!", " is immune.");
2232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2235 if (r_ptr->flagsr & RFR_RES_INER)
2237 note = _("には耐性がある。", " resists.");
2238 dam *= 3; dam /= randint1(6) + 6;
2239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2243 /* Powerful monsters can resist */
2244 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2245 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2249 /* Normal monsters slow down */
2252 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2254 note = _("の動きが遅くなった。", " starts moving slower.");
2261 /* Time -- breathers resist */
2264 if (seen) obvious = TRUE;
2266 if (r_ptr->flagsr & RFR_RES_ALL)
2268 note = _("には完全な耐性がある!", " is immune.");
2270 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2273 if (r_ptr->flagsr & RFR_RES_TIME)
2275 note = _("には耐性がある。", " resists.");
2276 dam *= 3; dam /= randint1(6) + 6;
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2279 else do_time = (dam + 1) / 2;
2283 /* Gravity -- breathers resist */
2286 bool resist_tele = FALSE;
2288 if (seen) obvious = TRUE;
2290 if (r_ptr->flagsr & RFR_RES_ALL)
2292 note = _("には完全な耐性がある!", " is immune.");
2294 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2297 if (r_ptr->flagsr & RFR_RES_TELE)
2299 if (r_ptr->flags1 & (RF1_UNIQUE))
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2302 note = _("には効果がなかった。", " is unaffected!");
2305 else if (r_ptr->level > randint1(100))
2307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2308 note = _("には耐性がある!", " resists!");
2313 if (!resist_tele) do_dist = 10;
2315 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2317 if (r_ptr->flagsr & RFR_RES_GRAV)
2319 note = _("には耐性がある!", " resists!");
2320 dam *= 3; dam /= randint1(6) + 6;
2322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2327 /* Powerful monsters can resist */
2328 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2329 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2333 /* Normal monsters slow down */
2336 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2338 note = _("の動きが遅くなった。", " starts moving slower.");
2343 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2345 /* Attempt a saving throw */
2346 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2347 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2351 /* No obvious effect */
2352 note = _("には効果がなかった。", " is unaffected!");
2364 if (seen) obvious = TRUE;
2366 if (r_ptr->flagsr & RFR_RES_ALL)
2368 note = _("には完全な耐性がある!", " is immune.");
2370 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2378 case GF_DISINTEGRATE:
2380 if (seen) obvious = TRUE;
2382 if (r_ptr->flagsr & RFR_RES_ALL)
2384 note = _("には完全な耐性がある!", " is immune.");
2386 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2389 if (r_ptr->flags3 & RF3_HURT_ROCK)
2391 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2392 note = _("の皮膚がただれた!", " loses some skin!");
2393 note_dies = _("は蒸発した!", " evaporates!");
2401 if (seen) obvious = TRUE;
2403 /* PSI only works if the monster can see you! -- RG */
2404 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2407 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2412 if (r_ptr->flagsr & RFR_RES_ALL)
2414 note = _("には完全な耐性がある!", " is immune.");
2416 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2419 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2422 note = _("には完全な耐性がある!", " is immune.");
2423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2426 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2427 (r_ptr->flags3 & RF3_ANIMAL) ||
2428 (r_ptr->level > randint1(3 * dam)))
2430 note = _("には耐性がある!", " resists!");
2434 * Powerful demons & undead can turn a mindcrafter's
2435 * attacks back on them
2437 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2438 (r_ptr->level > p_ptr->lev / 2) &&
2442 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2443 (seen ? "%^s's corrupted mind backlashes your attack!" :
2444 "%^ss corrupted mind backlashes your attack!")), m_name);
2447 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2449 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2453 /* Injure +/- confusion */
2454 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2455 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2456 if (one_in_(4) && !CHECK_MULTISHADOW())
2458 switch (randint1(4))
2461 set_confused(p_ptr->confused + 3 + randint1(dam));
2464 set_stun(p_ptr->stun + randint1(dam));
2468 if (r_ptr->flags3 & RF3_NO_FEAR)
2469 note = _("には効果がなかった。", " is unaffected.");
2471 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2475 if (!p_ptr->free_act)
2476 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2485 if ((dam > 0) && one_in_(4))
2487 switch (randint1(4))
2490 do_conf = 3 + randint1(dam);
2493 do_stun = 3 + randint1(dam);
2496 do_fear = 3 + randint1(dam);
2499 note = _("は眠り込んでしまった!", " falls asleep!");
2500 do_sleep = 3 + randint1(dam);
2505 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2511 if (seen) obvious = TRUE;
2513 if (r_ptr->flagsr & RFR_RES_ALL)
2515 note = _("には完全な耐性がある!", " is immune.");
2517 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2520 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2523 note = _("には完全な耐性がある!", " is immune.");
2525 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2526 (r_ptr->flags3 & RF3_ANIMAL) ||
2527 (r_ptr->level > randint1(3 * dam)))
2529 note = _("には耐性がある!", " resists!");
2533 * Powerful demons & undead can turn a mindcrafter's
2534 * attacks back on them
2536 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2537 (r_ptr->level > p_ptr->lev / 2) &&
2541 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2542 (seen ? "%^s's corrupted mind backlashes your attack!" :
2543 "%^ss corrupted mind backlashes your attack!")), m_name);
2545 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2547 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2551 /* Injure + mana drain */
2552 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2553 if (!CHECK_MULTISHADOW())
2555 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2556 p_ptr->csp -= damroll(5, dam) / 2;
2557 if (p_ptr->csp < 0) p_ptr->csp = 0;
2558 p_ptr->redraw |= PR_MANA;
2559 p_ptr->window |= (PW_SPELL);
2561 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2568 int b = damroll(5, dam) / 4;
2569 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2570 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2571 (seen ? "You convert %s's pain into %s!" :
2572 "You convert %ss pain into %s!"));
2573 msg_format(msg, m_name, str);
2575 b = MIN(p_ptr->msp, p_ptr->csp + b);
2577 p_ptr->redraw |= PR_MANA;
2578 p_ptr->window |= (PW_SPELL);
2580 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2584 case GF_TELEKINESIS:
2586 if (seen) obvious = TRUE;
2588 if (r_ptr->flagsr & RFR_RES_ALL)
2590 note = _("には完全な耐性がある!", " is immune.");
2592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2597 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2602 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2604 /* Attempt a saving throw */
2605 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2606 (r_ptr->level > 5 + randint1(dam)))
2610 /* No obvious effect */
2616 /* Psycho-spear -- powerful magic missile */
2619 if (seen) obvious = TRUE;
2621 if (r_ptr->flagsr & RFR_RES_ALL)
2623 note = _("には完全な耐性がある!", " is immune.");
2625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2631 /* Meteor -- powerful magic missile */
2634 if (seen) obvious = TRUE;
2636 if (r_ptr->flagsr & RFR_RES_ALL)
2638 note = _("には完全な耐性がある!", " is immune.");
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2648 if (!is_hostile(m_ptr)) break;
2650 if (seen) obvious = TRUE;
2652 if (r_ptr->flagsr & RFR_RES_ALL)
2654 note = _("には効果がなかった!", " is immune.");
2656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2659 /* Attempt a saving throw */
2660 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2661 (r_ptr->flags3 & RF3_NO_CONF) ||
2662 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2664 /* Memorize a flag */
2665 if (r_ptr->flags3 & RF3_NO_CONF)
2667 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2674 * Powerful demons & undead can turn a mindcrafter's
2675 * attacks back on them
2677 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2678 (r_ptr->level > p_ptr->lev / 2) &&
2682 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2683 (seen ? "%^s's corrupted mind backlashes your attack!" :
2684 "%^ss corrupted mind backlashes your attack!")), m_name);
2687 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2689 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2693 /* Confuse, stun, terrify */
2694 switch (randint1(4))
2697 set_stun(p_ptr->stun + dam / 2);
2700 set_confused(p_ptr->confused + dam / 2);
2704 if (r_ptr->flags3 & RF3_NO_FEAR)
2705 note = _("には効果がなかった。", " is unaffected.");
2707 set_afraid(p_ptr->afraid + dam);
2714 /* No obvious effect */
2715 note = _("には効果がなかった。", " is unaffected.");
2721 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2723 note = _("があなたに隷属した。", " is in your thrall!");
2728 switch (randint1(4))
2742 /* No "real" damage */
2749 /* Ice -- Cold + Cuts + Stun */
2752 if (seen) obvious = TRUE;
2754 if (r_ptr->flagsr & RFR_RES_ALL)
2756 note = _("には完全な耐性がある!", " is immune.");
2758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2761 do_stun = (randint1(15) + 1) / (r + 1);
2762 if (r_ptr->flagsr & RFR_IM_COLD)
2764 note = _("にはかなり耐性がある!", " resists a lot.");
2766 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2768 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2770 note = _("はひどい痛手をうけた。", " is hit hard.");
2772 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2779 case GF_HYPODYNAMIA:
2781 if (seen) obvious = TRUE;
2783 if (r_ptr->flagsr & RFR_RES_ALL)
2785 note = _("には完全な耐性がある!", " is immune.");
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2790 if (!monster_living(m_ptr->r_idx))
2792 if (is_original_ap_and_seen(m_ptr))
2794 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2795 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2796 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2798 note = _("には効果がなかった。", " is unaffected.");
2802 else do_time = (dam+7)/8;
2810 if (seen) obvious = TRUE;
2812 if (r_ptr->flagsr & RFR_RES_ALL)
2814 note = _("には完全な耐性がある!", " is immune.");
2816 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2819 if (!monster_living(m_ptr->r_idx))
2821 if (is_original_ap_and_seen(m_ptr))
2823 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2824 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2825 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2827 note = _("には完全な耐性がある!", " is immune.");
2831 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2832 (randint1(888) != 666)) ||
2833 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2834 randint1(100) != 66))
2836 note = _("には耐性がある!", " resists!");
2844 /* Polymorph monster (Use "dam" as "power") */
2847 if (seen) obvious = TRUE;
2849 if (r_ptr->flagsr & RFR_RES_ALL)
2851 note = _("には効果がなかった。", " is unaffected.");
2853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2856 /* Attempt to polymorph (see below) */
2859 /* Powerful monsters can resist */
2860 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2861 (r_ptr->flags1 & RF1_QUESTOR) ||
2862 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2864 note = _("には効果がなかった。", " is unaffected.");
2869 /* No "real" damage */
2876 /* Clone monsters (Ignore "dam") */
2879 if (seen) obvious = TRUE;
2881 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2883 note = _("には効果がなかった。", " is unaffected.");
2888 m_ptr->hp = m_ptr->maxhp;
2890 /* Attempt to clone. */
2891 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2893 note = _("が分裂した!", " spawns!");
2897 /* No "real" damage */
2904 /* Heal Monster (use "dam" as amount of healing) */
2907 if (seen) obvious = TRUE;
2910 (void)set_monster_csleep(c_ptr->m_idx, 0);
2912 if (m_ptr->maxhp < m_ptr->max_maxhp)
2914 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2915 m_ptr->maxhp = m_ptr->max_maxhp;
2920 /* Redraw (later) if needed */
2921 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2922 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2930 if (seen) obvious = TRUE;
2933 (void)set_monster_csleep(c_ptr->m_idx, 0);
2934 if (MON_STUNNED(m_ptr))
2936 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2937 (void)set_monster_stunned(c_ptr->m_idx, 0);
2939 if (MON_CONFUSED(m_ptr))
2941 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2942 (void)set_monster_confused(c_ptr->m_idx, 0);
2944 if (MON_MONFEAR(m_ptr))
2946 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2947 (void)set_monster_monfear(c_ptr->m_idx, 0);
2951 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2954 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2958 chg_virtue(V_VITALITY, 1);
2960 if (r_ptr->flags1 & RF1_UNIQUE)
2961 chg_virtue(V_INDIVIDUALISM, 1);
2963 if (is_friendly(m_ptr))
2964 chg_virtue(V_HONOUR, 1);
2965 else if (!(r_ptr->flags3 & RF3_EVIL))
2967 if (r_ptr->flags3 & RF3_GOOD)
2968 chg_virtue(V_COMPASSION, 2);
2970 chg_virtue(V_COMPASSION, 1);
2973 if (r_ptr->flags3 & RF3_ANIMAL)
2974 chg_virtue(V_NATURE, 1);
2977 if (m_ptr->r_idx == MON_LEPER)
2980 if (!who) chg_virtue(V_COMPASSION, 5);
2983 /* Redraw (later) if needed */
2984 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2985 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2987 note = _("は体力を回復したようだ。", " looks healthier.");
2989 /* No "real" damage */
2995 /* Speed Monster (Ignore "dam") */
2998 if (seen) obvious = TRUE;
3001 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3003 note = _("の動きが速くなった。", " starts moving faster.");
3008 if (r_ptr->flags1 & RF1_UNIQUE)
3009 chg_virtue(V_INDIVIDUALISM, 1);
3010 if (is_friendly(m_ptr))
3011 chg_virtue(V_HONOUR, 1);
3014 /* No "real" damage */
3020 /* Slow Monster (Use "dam" as "power") */
3023 if (seen) obvious = TRUE;
3025 if (r_ptr->flagsr & RFR_RES_ALL)
3027 note = _("には効果がなかった。", " is unaffected.");
3029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3032 /* Powerful monsters can resist */
3033 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3034 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3036 note = _("には効果がなかった。", " is unaffected.");
3040 /* Normal monsters slow down */
3043 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3045 note = _("の動きが遅くなった。", " starts moving slower.");
3049 /* No "real" damage */
3055 /* Sleep (Use "dam" as "power") */
3058 if (seen) obvious = TRUE;
3060 if (r_ptr->flagsr & RFR_RES_ALL)
3062 note = _("には効果がなかった。", " is unaffected.");
3064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3067 /* Attempt a saving throw */
3068 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3069 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3070 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3072 /* Memorize a flag */
3073 if (r_ptr->flags3 & RF3_NO_SLEEP)
3075 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3077 /* No obvious effect */
3078 note = _("には効果がなかった。", " is unaffected.");
3083 /* Go to sleep (much) later */
3084 note = _("は眠り込んでしまった!", " falls asleep!");
3088 /* No "real" damage */
3094 /* Sleep (Use "dam" as "power") */
3095 case GF_STASIS_EVIL:
3097 if (seen) obvious = TRUE;
3099 if (r_ptr->flagsr & RFR_RES_ALL)
3101 note = _("には効果がなかった!", " is immune.");
3103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3106 /* Attempt a saving throw */
3107 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3108 !(r_ptr->flags3 & RF3_EVIL) ||
3109 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3111 note = _("には効果がなかった。", " is unaffected.");
3116 /* Go to sleep (much) later */
3117 note = _("は動けなくなった!", " is suspended!");
3121 /* No "real" damage */
3126 /* Sleep (Use "dam" as "power") */
3129 if (seen) obvious = TRUE;
3131 if (r_ptr->flagsr & RFR_RES_ALL)
3133 note = _("には効果がなかった。", " is unaffected.");
3135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3138 /* Attempt a saving throw */
3139 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3140 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3142 note = _("には効果がなかった。", " is unaffected.");
3147 /* Go to sleep (much) later */
3148 note = _("は動けなくなった!", " is suspended!");
3152 /* No "real" damage */
3161 vir = virtue_number(V_HARMONY);
3164 dam += p_ptr->virtues[vir-1]/10;
3167 vir = virtue_number(V_INDIVIDUALISM);
3170 dam -= p_ptr->virtues[vir-1]/20;
3173 if (seen) obvious = TRUE;
3175 /* Attempt a saving throw */
3176 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3180 /* No obvious effect */
3181 note = _("には効果がなかった。", " is unaffected.");
3184 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3186 else if (p_ptr->cursed & TRC_AGGRAVATE)
3188 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3189 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3193 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3196 chg_virtue(V_INDIVIDUALISM, -1);
3197 if (r_ptr->flags3 & RF3_ANIMAL)
3198 chg_virtue(V_NATURE, 1);
3201 /* No "real" damage */
3206 /* Control undead */
3207 case GF_CONTROL_UNDEAD:
3210 if (seen) obvious = TRUE;
3212 vir = virtue_number(V_UNLIFE);
3215 dam += p_ptr->virtues[vir-1]/10;
3218 vir = virtue_number(V_INDIVIDUALISM);
3221 dam -= p_ptr->virtues[vir-1]/20;
3224 /* Attempt a saving throw */
3225 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3226 !(r_ptr->flags3 & RF3_UNDEAD))
3228 /* No obvious effect */
3229 note = _("には効果がなかった。", " is unaffected.");
3231 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3233 else if (p_ptr->cursed & TRC_AGGRAVATE)
3235 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3236 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3240 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3244 /* No "real" damage */
3250 case GF_CONTROL_DEMON:
3253 if (seen) obvious = TRUE;
3255 vir = virtue_number(V_UNLIFE);
3258 dam += p_ptr->virtues[vir-1]/10;
3261 vir = virtue_number(V_INDIVIDUALISM);
3264 dam -= p_ptr->virtues[vir-1]/20;
3267 /* Attempt a saving throw */
3268 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3269 !(r_ptr->flags3 & RF3_DEMON))
3271 /* No obvious effect */
3272 note = _("には効果がなかった。", " is unaffected.");
3274 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3276 else if (p_ptr->cursed & TRC_AGGRAVATE)
3278 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3279 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3283 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3287 /* No "real" damage */
3293 case GF_CONTROL_ANIMAL:
3296 if (seen) obvious = TRUE;
3298 vir = virtue_number(V_NATURE);
3301 dam += p_ptr->virtues[vir-1]/10;
3304 vir = virtue_number(V_INDIVIDUALISM);
3307 dam -= p_ptr->virtues[vir-1]/20;
3310 /* Attempt a saving throw */
3311 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3312 !(r_ptr->flags3 & RF3_ANIMAL))
3315 /* No obvious effect */
3316 note = _("には効果がなかった。", " is unaffected.");
3318 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3320 else if (p_ptr->cursed & TRC_AGGRAVATE)
3322 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3323 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3327 note = _("はなついた。", " is tamed!");
3329 if (r_ptr->flags3 & RF3_ANIMAL)
3330 chg_virtue(V_NATURE, 1);
3333 /* No "real" damage */
3339 case GF_CHARM_LIVING:
3343 vir = virtue_number(V_UNLIFE);
3344 if (seen) obvious = TRUE;
3346 vir = virtue_number(V_UNLIFE);
3349 dam -= p_ptr->virtues[vir-1]/10;
3352 vir = virtue_number(V_INDIVIDUALISM);
3355 dam -= p_ptr->virtues[vir-1]/20;
3358 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3360 /* Attempt a saving throw */
3361 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3362 !monster_living(m_ptr->r_idx))
3365 /* No obvious effect */
3366 note = _("には効果がなかった。", " is unaffected.");
3368 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3370 else if (p_ptr->cursed & TRC_AGGRAVATE)
3372 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3373 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3377 note = _("を支配した。", " is tamed!");
3379 if (r_ptr->flags3 & RF3_ANIMAL)
3380 chg_virtue(V_NATURE, 1);
3383 /* No "real" damage */
3388 /* Confusion (Use "dam" as "power") */
3391 if (seen) obvious = TRUE;
3393 if (r_ptr->flagsr & RFR_RES_ALL)
3395 note = _("には効果がなかった。", " is unaffected.");
3397 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3400 /* Get confused later */
3401 do_conf = damroll(3, (dam / 2)) + 1;
3403 /* Attempt a saving throw */
3404 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3405 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3406 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3408 /* Memorize a flag */
3409 if (r_ptr->flags3 & (RF3_NO_CONF))
3411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3417 /* No obvious effect */
3418 note = _("には効果がなかった。", " is unaffected.");
3422 /* No "real" damage */
3429 if (seen) obvious = TRUE;
3431 if (r_ptr->flagsr & RFR_RES_ALL)
3433 note = _("には効果がなかった。", " is unaffected.");
3435 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3438 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3440 /* Attempt a saving throw */
3441 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3442 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3447 /* No obvious effect */
3448 note = _("には効果がなかった。", " is unaffected.");
3452 /* No "real" damage */
3460 /* Lite, but only hurts susceptible creatures */
3468 if (r_ptr->flagsr & RFR_RES_ALL)
3474 if (r_ptr->flags3 & (RF3_HURT_LITE))
3476 /* Obvious effect */
3477 if (seen) obvious = TRUE;
3479 /* Memorize the effects */
3480 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3482 /* Special effect */
3483 note = _("は光に身をすくめた!", " cringes from the light!");
3484 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3487 /* Normally no damage */
3499 /* Lite -- opposite of Dark */
3502 if (seen) obvious = TRUE;
3504 if (r_ptr->flagsr & RFR_RES_ALL)
3506 note = _("には完全な耐性がある!", " is immune.");
3508 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3511 if (r_ptr->flagsr & RFR_RES_LITE)
3513 note = _("には耐性がある!", " resists!");
3514 dam *= 2; dam /= (randint1(6)+6);
3515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3517 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3519 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3520 note = _("は光に身をすくめた!", " cringes from the light!");
3521 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3528 /* Dark -- opposite of Lite */
3531 if (seen) obvious = TRUE;
3533 if (r_ptr->flagsr & RFR_RES_ALL)
3535 note = _("には完全な耐性がある!", " is immune.");
3537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3540 if (r_ptr->flagsr & RFR_RES_DARK)
3542 note = _("には耐性がある!", " resists!");
3543 dam *= 2; dam /= (randint1(6)+6);
3544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3553 if (r_ptr->flagsr & RFR_RES_ALL)
3558 /* Hurt by rock remover */
3559 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3562 if (seen) obvious = TRUE;
3564 /* Memorize the effects */
3565 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3567 /* Cute little message */
3568 note = _("の皮膚がただれた!", " loses some skin!");
3569 note_dies = _("はドロドロに溶けた!", " dissolves!");
3572 /* Usually, ignore the effects */
3583 /* Teleport undead (Use "dam" as "power") */
3584 case GF_AWAY_UNDEAD:
3586 /* Only affect undead */
3587 if (r_ptr->flags3 & (RF3_UNDEAD))
3589 bool resists_tele = FALSE;
3591 if (r_ptr->flagsr & RFR_RES_TELE)
3593 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3596 note = _("には効果がなかった。", " is unaffected.");
3597 resists_tele = TRUE;
3599 else if (r_ptr->level > randint1(100))
3601 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3602 note = _("には耐性がある!", " resists!");
3603 resists_tele = TRUE;
3609 if (seen) obvious = TRUE;
3610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3622 /* No "real" damage */
3628 /* Teleport evil (Use "dam" as "power") */
3631 /* Only affect evil */
3632 if (r_ptr->flags3 & (RF3_EVIL))
3634 bool resists_tele = FALSE;
3636 if (r_ptr->flagsr & RFR_RES_TELE)
3638 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3641 note = _("には効果がなかった。", " is unaffected.");
3642 resists_tele = TRUE;
3644 else if (r_ptr->level > randint1(100))
3646 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3647 note = _("には耐性がある!", " resists!");
3648 resists_tele = TRUE;
3654 if (seen) obvious = TRUE;
3655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3667 /* No "real" damage */
3673 /* Teleport monster (Use "dam" as "power") */
3676 bool resists_tele = FALSE;
3677 if (r_ptr->flagsr & RFR_RES_TELE)
3679 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3681 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3682 note = _("には効果がなかった。", " is unaffected.");
3683 resists_tele = TRUE;
3685 else if (r_ptr->level > randint1(100))
3687 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3688 note = _("には耐性がある!", " resists!");
3689 resists_tele = TRUE;
3695 if (seen) obvious = TRUE;
3697 /* Prepare to teleport */
3701 /* No "real" damage */
3707 /* Turn undead (Use "dam" as "power") */
3708 case GF_TURN_UNDEAD:
3710 if (r_ptr->flagsr & RFR_RES_ALL)
3715 /* Only affect undead */
3716 if (r_ptr->flags3 & (RF3_UNDEAD))
3718 if (seen) obvious = TRUE;
3720 /* Learn about type */
3721 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3723 /* Apply some fear */
3724 do_fear = damroll(3, (dam / 2)) + 1;
3726 /* Attempt a saving throw */
3727 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3729 /* No obvious effect */
3730 note = _("には効果がなかった。", " is unaffected.");
3743 /* No "real" damage */
3749 /* Turn evil (Use "dam" as "power") */
3752 if (r_ptr->flagsr & RFR_RES_ALL)
3757 /* Only affect evil */
3758 if (r_ptr->flags3 & (RF3_EVIL))
3760 if (seen) obvious = TRUE;
3762 /* Learn about type */
3763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3765 /* Apply some fear */
3766 do_fear = damroll(3, (dam / 2)) + 1;
3768 /* Attempt a saving throw */
3769 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3771 /* No obvious effect */
3772 note = _("には効果がなかった。", " is unaffected.");
3785 /* No "real" damage */
3791 /* Turn monster (Use "dam" as "power") */
3794 if (r_ptr->flagsr & RFR_RES_ALL)
3799 if (seen) obvious = TRUE;
3801 /* Apply some fear */
3802 do_fear = damroll(3, (dam / 2)) + 1;
3804 /* Attempt a saving throw */
3805 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3806 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3807 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3809 /* No obvious effect */
3810 note = _("には効果がなかった。", " is unaffected.");
3815 /* No "real" damage */
3822 case GF_DISP_UNDEAD:
3824 if (r_ptr->flagsr & RFR_RES_ALL)
3830 /* Only affect undead */
3831 if (r_ptr->flags3 & (RF3_UNDEAD))
3833 if (seen) obvious = TRUE;
3835 /* Learn about type */
3836 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3838 note = _("は身震いした。", " shudders.");
3839 note_dies = _("はドロドロに溶けた!", " dissolves!");
3859 if (r_ptr->flagsr & RFR_RES_ALL)
3865 /* Only affect evil */
3866 if (r_ptr->flags3 & (RF3_EVIL))
3868 if (seen) obvious = TRUE;
3870 /* Learn about type */
3871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3873 note = _("は身震いした。", " shudders.");
3874 note_dies = _("はドロドロに溶けた!", " dissolves!");
3893 if (r_ptr->flagsr & RFR_RES_ALL)
3899 /* Only affect good */
3900 if (r_ptr->flags3 & (RF3_GOOD))
3902 if (seen) obvious = TRUE;
3904 /* Learn about type */
3905 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3907 note = _("は身震いした。", " shudders.");
3908 note_dies = _("はドロドロに溶けた!", " dissolves!");
3925 case GF_DISP_LIVING:
3927 if (r_ptr->flagsr & RFR_RES_ALL)
3933 /* Only affect non-undead */
3934 if (monster_living(m_ptr->r_idx))
3936 if (seen) obvious = TRUE;
3938 note = _("は身震いした。", " shudders.");
3939 note_dies = _("はドロドロに溶けた!", " dissolves!");
3958 if (r_ptr->flagsr & RFR_RES_ALL)
3964 /* Only affect demons */
3965 if (r_ptr->flags3 & (RF3_DEMON))
3967 if (seen) obvious = TRUE;
3969 /* Learn about type */
3970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3972 note = _("は身震いした。", " shudders.");
3973 note_dies = _("はドロドロに溶けた!", " dissolves!");
3989 /* Dispel monster */
3992 if (r_ptr->flagsr & RFR_RES_ALL)
3998 if (seen) obvious = TRUE;
4000 note = _("は身震いした。", " shudders.");
4001 note_dies = _("はドロドロに溶けた!", " dissolves!");
4008 if (seen) obvious = TRUE;
4010 if (r_ptr->flagsr & RFR_RES_ALL)
4012 note = _("には完全な耐性がある!", " is immune.");
4014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4018 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4022 /* Heal the monster */
4023 if (caster_ptr->hp < caster_ptr->maxhp)
4026 caster_ptr->hp += dam;
4027 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4029 /* Redraw (later) if needed */
4030 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4031 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4033 /* Special message */
4036 monster_desc(killer, caster_ptr, 0);
4037 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4043 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4044 (void)hp_player(dam);
4049 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4058 if (seen) obvious = TRUE;
4059 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4061 if (r_ptr->flagsr & RFR_RES_ALL)
4063 note = _("には完全な耐性がある!", " is immune.");
4065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4069 /* Attempt a saving throw */
4070 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4071 (r_ptr->flags3 & RF3_NO_CONF) ||
4072 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4074 /* Memorize a flag */
4075 if (r_ptr->flags3 & (RF3_NO_CONF))
4077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4079 note = _("には効果がなかった。", " is unaffected.");
4082 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4084 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4085 note = _("には完全な耐性がある!", " is immune.");
4088 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4091 note = _("には耐性がある。", " resists.");
4096 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4097 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4099 if (who > 0) do_conf = randint0(4) + 4;
4100 else do_conf = randint0(8) + 8;
4106 case GF_BRAIN_SMASH:
4108 if (seen) obvious = TRUE;
4109 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4111 if (r_ptr->flagsr & RFR_RES_ALL)
4113 note = _("には完全な耐性がある!", " is immune.");
4115 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4119 /* Attempt a saving throw */
4120 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4121 (r_ptr->flags3 & RF3_NO_CONF) ||
4122 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4124 /* Memorize a flag */
4125 if (r_ptr->flags3 & (RF3_NO_CONF))
4127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4129 note = _("には効果がなかった。", " is unaffected.");
4132 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4135 note = _("には完全な耐性がある!", " is immune.");
4138 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4140 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4141 note = _("には耐性がある!", " resists!");
4146 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4147 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4151 do_conf = randint0(4) + 4;
4152 do_stun = randint0(4) + 4;
4156 do_conf = randint0(8) + 8;
4157 do_stun = randint0(8) + 8;
4159 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4167 if (seen) obvious = TRUE;
4168 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4170 if (r_ptr->flagsr & RFR_RES_ALL)
4172 note = _("には完全な耐性がある!", " is immune.");
4174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4178 /* Attempt a saving throw */
4179 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4181 note = _("には効果がなかった。", " is unaffected.");
4190 if (seen) obvious = TRUE;
4191 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4193 if (r_ptr->flagsr & RFR_RES_ALL)
4195 note = _("には完全な耐性がある!", " is immune.");
4197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4201 /* Attempt a saving throw */
4202 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4204 note = _("には効果がなかった。", " is unaffected.");
4213 if (seen) obvious = TRUE;
4214 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4216 if (r_ptr->flagsr & RFR_RES_ALL)
4218 note = _("には完全な耐性がある!", " is immune.");
4220 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4224 /* Attempt a saving throw */
4225 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4227 note = _("には効果がなかった。", " is unaffected.");
4236 if (seen) obvious = TRUE;
4238 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4239 "You point at %s, screaming the word, 'DIE!'."), m_name);
4241 if (r_ptr->flagsr & RFR_RES_ALL)
4243 note = _("には完全な耐性がある!", " is immune.");
4245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4249 /* Attempt a saving throw */
4250 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4252 note = _("には効果がなかった。", " is unaffected.");
4261 if (seen) obvious = TRUE;
4263 if (r_ptr->flagsr & RFR_RES_ALL)
4265 note = _("には完全な耐性がある!", " is immune.");
4267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4271 if (r_ptr->flags1 & RF1_UNIQUE)
4273 note = _("には効果がなかった。", " is unaffected.");
4278 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4279 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4281 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4283 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4287 note = _("は耐性を持っている!", "resists!");
4294 /* Capture monster */
4298 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4299 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
4301 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4306 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4307 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4308 nokori_hp = m_ptr->maxhp * 3 / 10;
4310 nokori_hp = m_ptr->maxhp * 3 / 20;
4312 if (m_ptr->hp >= nokori_hp)
4314 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4317 else if (m_ptr->hp < randint0(nokori_hp))
4319 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4320 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4321 cap_mon = m_ptr->r_idx;
4322 cap_mspeed = m_ptr->mspeed;
4324 cap_maxhp = m_ptr->max_maxhp;
4325 cap_nickname = m_ptr->nickname; /* Quark transfer */
4326 if (c_ptr->m_idx == p_ptr->riding)
4328 if (rakuba(-1, FALSE))
4330 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4334 delete_monster_idx(c_ptr->m_idx);
4340 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4346 /* Attack (Use "dam" as attack type) */
4349 /* Return this monster's death */
4350 return py_attack(y, x, dam);
4353 /* Sleep (Use "dam" as "power") */
4359 if (seen) obvious = TRUE;
4361 if (r_ptr->flagsr & RFR_RES_ALL)
4363 note = _("には効果がなかった。", " is unaffected.");
4365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4368 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4370 note = _("には効果がなかった。", " is unaffected.");
4373 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4376 if (MON_CSLEEP(m_ptr))
4378 note = _("には効果がなかった。", " is unaffected.");
4384 if (one_in_(5)) effect = 1;
4385 else if (one_in_(4)) effect = 2;
4386 else if (one_in_(3)) effect = 3;
4391 /* Powerful monsters can resist */
4392 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4393 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4395 note = _("には効果がなかった。", " is unaffected.");
4399 /* Normal monsters slow down */
4402 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4404 note = _("の動きが遅くなった。", " starts moving slower.");
4409 else if (effect == 2)
4411 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4413 /* Attempt a saving throw */
4414 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4415 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4420 /* No obvious effect */
4421 note = _("には効果がなかった。", " is unaffected.");
4426 else if (effect == 3)
4428 /* Attempt a saving throw */
4429 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4430 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4431 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4433 /* Memorize a flag */
4434 if (r_ptr->flags3 & RF3_NO_SLEEP)
4436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4439 /* No obvious effect */
4440 note = _("には効果がなかった。", " is unaffected.");
4445 /* Go to sleep (much) later */
4446 note = _("は眠り込んでしまった!", " falls asleep!");
4453 note = _("には効果がなかった。", " is unaffected.");
4456 /* No "real" damage */
4464 if (seen) obvious = TRUE;
4466 if (r_ptr->flagsr & RFR_RES_ALL)
4468 note = _("には効果がなかった。", " is unaffected.");
4470 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4474 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4476 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4477 chg_virtue(V_VITALITY, -1);
4487 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4489 if (r_ptr->flags3 & (RF3_HURT_LITE))
4491 /* Obvious effect */
4492 if (seen) obvious = TRUE;
4494 /* Memorize the effects */
4495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4497 /* Special effect */
4498 note = _("は光に身をすくめた!", " cringes from the light!");
4499 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4502 /* Normally no damage */
4509 photo = m_ptr->r_idx;
4516 case GF_BLOOD_CURSE:
4518 if (seen) obvious = TRUE;
4520 if (r_ptr->flagsr & RFR_RES_ALL)
4522 note = _("には完全な耐性がある!", " is immune.");
4524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4532 bool success = FALSE;
4533 if (seen) obvious = TRUE;
4535 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4537 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4538 if (dam < 1) dam = 1;
4540 /* No need to tame your pet */
4543 note = _("の動きが速くなった。", " starts moving faster.");
4544 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4548 /* Attempt a saving throw */
4549 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4550 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4551 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4552 (p_ptr->cursed & TRC_AGGRAVATE) ||
4553 ((r_ptr->level+10) > randint1(dam)))
4556 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4560 note = _("を支配した。", " is tamed!");
4562 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4564 /* Learn about type */
4565 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4572 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4574 do_fear = randint1(90)+10;
4576 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4579 /* No "real" damage */
4586 if (seen) obvious = TRUE;
4588 if (r_ptr->flagsr & RFR_RES_ALL)
4590 note = _("には完全な耐性がある!", " is immune.");
4592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4596 /* Attempt a saving throw */
4597 if (randint0(100 + dam) < (r_ptr->level + 50))
4599 note = _("には効果がなかった。", " is unaffected.");
4619 /* Absolutely no effect */
4620 if (skipped) return (FALSE);
4622 /* "Unique" monsters cannot be polymorphed */
4623 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4625 /* Quest monsters cannot be polymorphed */
4626 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4628 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4630 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4631 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4633 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4638 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4639 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4642 /* Modify the damage */
4644 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4645 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4647 /* Check for death */
4648 if (dam > m_ptr->hp)
4650 /* Extract method of death */
4655 /* Sound and Impact resisters never stun */
4657 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4658 !(r_ptr->flags3 & RF3_NO_STUN))
4660 if (seen) obvious = TRUE;
4663 if (MON_STUNNED(m_ptr))
4665 note = _("はひどくもうろうとした。", " is more dazed.");
4666 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4670 note = _("はもうろうとした。", " is dazed.");
4675 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4681 /* Confusion and Chaos resisters (and sleepers) never confuse */
4683 !(r_ptr->flags3 & RF3_NO_CONF) &&
4684 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4686 if (seen) obvious = TRUE;
4688 /* Already partially confused */
4689 if (MON_CONFUSED(m_ptr))
4691 note = _("はさらに混乱したようだ。", " looks more confused.");
4692 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4695 /* Was not confused */
4698 note = _("は混乱したようだ。", " looks confused.");
4702 /* Apply confusion */
4703 (void)set_monster_confused(c_ptr->m_idx, tmp);
4711 if (seen) obvious = TRUE;
4713 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4717 note = _("は弱くなったようだ。", " seems weakened.");
4718 m_ptr->maxhp -= do_time;
4719 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4724 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4725 if (do_poly && (randint1(90) > r_ptr->level))
4727 if (polymorph_monster(y, x))
4729 if (seen) obvious = TRUE;
4731 /* Monster polymorphs */
4732 note = _("が変身した!", " changes!");
4734 /* Turn off the damage */
4740 note = _("には効果がなかった。", " is unaffected.");
4743 /* Hack -- Get new monster */
4744 m_ptr = &m_list[c_ptr->m_idx];
4746 /* Hack -- Get new race */
4747 r_ptr = &r_info[m_ptr->r_idx];
4750 /* Handle "teleport" */
4753 if (seen) obvious = TRUE;
4755 note = _("が消え去った!", " disappears!");
4757 if (!who) chg_virtue(V_VALOUR, -1);
4760 teleport_away(c_ptr->m_idx, do_dist,
4761 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4763 /* Hack -- get new location */
4767 /* Hack -- get new grid */
4768 c_ptr = &cave[y][x];
4775 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4782 if (typ == GF_DRAIN_MANA)
4784 /* Drain mana does nothing */
4787 /* If another monster did the damage, hurt the monster by hand */
4790 /* Redraw (later) if needed */
4791 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4792 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4794 /* Wake the monster up */
4795 (void)set_monster_csleep(c_ptr->m_idx, 0);
4797 /* Hurt the monster */
4805 if (is_pet(m_ptr) && !(m_ptr->ml))
4808 /* Give detailed messages if destroyed */
4811 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4814 msg_format("%^s%s", m_name, note);
4822 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4824 /* Generate treasure, etc */
4825 monster_death(c_ptr->m_idx, FALSE);
4828 delete_monster_idx(c_ptr->m_idx);
4832 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4836 /* Damaged monster */
4839 /* Give detailed messages if visible or destroyed */
4840 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4842 /* Hack -- Pain message */
4845 message_pain(c_ptr->m_idx, dam);
4852 /* Hack -- handle sleep */
4853 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4857 else if (heal_leper)
4859 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4861 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4863 char m2_name[MAX_NLEN];
4865 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4866 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4869 delete_monster_idx(c_ptr->m_idx);
4872 /* If the player did it, give him experience, check fear */
4877 /* Hurt the monster, check for fear and death */
4878 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4883 /* Damaged monster */
4886 /* HACK - anger the monster before showing the sleep message */
4887 if (do_sleep) anger_monster(m_ptr);
4889 /* Give detailed messages if visible or destroyed */
4890 if (note && seen_msg)
4891 msg_format(_("%s%s", "%^s%s"), m_name, note);
4893 /* Hack -- Pain message */
4894 else if (known && (dam || !do_fear))
4896 message_pain(c_ptr->m_idx, dam);
4899 /* Anger monsters */
4900 if (((dam > 0) || get_angry) && !do_sleep)
4901 anger_monster(m_ptr);
4903 if ((fear || do_fear) && seen)
4906 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4909 /* Hack -- handle sleep */
4910 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4914 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4916 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4920 switch (randint1(28))
4925 msg_print(_("地面が揺れた...", "The ground trembles..."));
4926 earthquake(ty, tx, 4 + randint0(4));
4927 if (!one_in_(6)) break;
4929 case 3: case 4: case 5: case 6:
4932 int extra_dam = damroll(10, 10);
4933 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4935 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4936 if (!one_in_(6)) break;
4941 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4943 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4944 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4945 if (!one_in_(6)) break;
4947 case 9: case 10: case 11:
4948 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4949 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4950 if (!one_in_(6)) break;
4951 case 12: case 13: case 14: case 15: case 16:
4952 aggravate_monsters(0);
4953 if (!one_in_(6)) break;
4955 count += activate_hi_summon(ty, tx, TRUE);
4956 if (!one_in_(6)) break;
4957 case 19: case 20: case 21: case 22:
4959 bool pet = !one_in_(3);
4960 BIT_FLAGS mode = PM_ALLOW_GROUP;
4962 if (pet) mode |= PM_FORCE_PET;
4963 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4965 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, '\0');
4966 if (!one_in_(6)) break;
4968 case 23: case 24: case 25:
4969 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4970 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4972 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4973 else lose_exp(p_ptr->exp / 16);
4974 if (!one_in_(6)) break;
4975 case 26: case 27: case 28:
4984 (void)do_dec_stat(i);
4993 (void)do_dec_stat(randint0(6));
5002 if (p_ptr->inside_battle)
5004 p_ptr->health_who = c_ptr->m_idx;
5005 p_ptr->redraw |= (PR_HEALTH);
5009 /* Verify this code */
5010 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5012 /* Redraw the monster grid */
5016 /* Update monster recall window */
5017 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5019 p_ptr->window |= (PW_MONSTER);
5022 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5026 if (!(flg & PROJECT_NO_HANGEKI))
5028 set_target(m_ptr, monster_target_y, monster_target_x);
5031 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5033 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5037 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5039 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5040 rakubadam_m = (dam > 200) ? 200 : dam;
5050 /* Prepare to make a Blade of Chaos */
5051 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5053 q_ptr->pval = photo;
5055 /* Mark the item as fully known */
5056 q_ptr->ident |= (IDENT_MENTAL);
5057 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5065 /* Return "Anything seen?" */
5070 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5071 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5072 * @param who_name 効果を起こしたモンスターの名前
5073 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5074 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5075 * @param x 目標X座標 / Target x location (or location to travel "towards")
5076 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5077 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5079 * @param monspell 効果元のモンスター魔法ID
5080 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5082 * Handle a beam/bolt/ball causing damage to the player.
5083 * This routine takes a "source monster" (by index), a "distance", a default
5084 * "damage", and a "damage type". See "project_m()" above.
5085 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5086 * is reduced (see "project_m()" above). This can happen if a monster breathes
5087 * at the player and hits a wall instead.
5088 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5089 * to know if this is actually a ball or a bolt spell
5090 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5091 * we just assume that the effects were obvious, for historical reasons.
5093 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5098 /* Hack -- assume obvious */
5099 bool obvious = TRUE;
5101 /* Player blind-ness */
5102 bool blind = (p_ptr->blind ? TRUE : FALSE);
5104 /* Player needs a "description" (he is blind) */
5107 /* Source monster */
5108 monster_type *m_ptr = NULL;
5110 /* Monster name (for attacks) */
5111 GAME_TEXT m_name[MAX_NLEN];
5113 /* Monster name (for damage) */
5116 /* Hack -- messages */
5122 /* Player is not here */
5123 if (!player_bold(y, x)) return (FALSE);
5125 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5127 if (kawarimi(TRUE)) return FALSE;
5130 /* Player cannot hurt himself */
5131 if (!who) return (FALSE);
5132 if (who == p_ptr->riding) return (FALSE);
5134 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5137 int max_attempts = 10;
5138 sound(SOUND_REFLECT);
5141 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5142 else if (p_ptr->special_defense & KATA_FUUJIN)
5143 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5145 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5148 /* Choose 'new' target */
5153 t_y = m_list[who].fy - 1 + randint1(3);
5154 t_x = m_list[who].fx - 1 + randint1(3);
5157 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5159 if (max_attempts < 1)
5161 t_y = m_list[who].fy;
5162 t_x = m_list[who].fx;
5167 t_y = p_ptr->y - 1 + randint1(3);
5168 t_x = p_ptr->x - 1 + randint1(3);
5171 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5173 disturb(TRUE, TRUE);
5177 /* Limit maximum damage */
5178 if (dam > 1600) dam = 1600;
5180 /* Reduce damage by distance */
5181 dam = (dam + r) / (r + 1);
5184 /* If the player is blind, be more descriptive */
5185 if (blind) fuzzy = TRUE;
5190 m_ptr = &m_list[who];
5191 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5192 monster_desc(m_name, m_ptr, 0);
5194 /* Get the monster's real name (gotten before polymorph!) */
5195 strcpy(killer, who_name);
5201 case PROJECT_WHO_UNCTRL_POWER:
5202 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5205 case PROJECT_WHO_GLASS_SHARDS:
5206 strcpy(killer, _("ガラスの破片", "shards of glass"));
5210 strcpy(killer, _("罠", "a trap"));
5215 strcpy(m_name, killer);
5218 /* Analyze the damage */
5221 /* Standard damage -- hurts inventory too */
5224 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5225 get_damage = acid_dam(dam, killer, monspell, FALSE);
5229 /* Standard damage -- hurts inventory too */
5232 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5233 get_damage = fire_dam(dam, killer, monspell, FALSE);
5237 /* Standard damage -- hurts inventory too */
5240 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5241 get_damage = cold_dam(dam, killer, monspell, FALSE);
5245 /* Standard damage -- hurts inventory too */
5248 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5249 get_damage = elec_dam(dam, killer, monspell, FALSE);
5253 /* Standard damage -- also poisons player */
5256 bool double_resist = IS_OPPOSE_POIS();
5257 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5259 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5260 if (double_resist) dam = (dam + 2) / 3;
5262 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5267 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5269 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5271 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5276 /* Standard damage -- also poisons / mutates player */
5279 bool double_resist = IS_OPPOSE_POIS();
5280 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5282 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5283 if (double_resist) dam = (2 * dam + 2) / 5;
5284 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5285 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5287 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5289 if (one_in_(5)) /* 6 */
5291 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5292 if (one_in_(4)) /* 4 */
5300 inven_damage(set_acid_destroy, 2);
5306 /* Standard damage */
5309 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5310 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5314 /* Holy Orb -- Player only takes partial damage */
5317 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5318 if (p_ptr->align > 10)
5320 else if (p_ptr->align < -10)
5322 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5328 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5329 if (p_ptr->align > 10)
5331 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5335 /* Arrow -- XXX no dodging */
5340 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5342 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5344 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5347 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5351 /* Plasma -- XXX No resist */
5354 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5355 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5357 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5359 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5360 (void)set_stun(p_ptr->stun + plus_stun);
5363 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5365 inven_damage(set_acid_destroy, 3);
5371 /* Nether -- drain experience */
5374 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5375 if (p_ptr->resist_neth)
5377 if (!prace_is_(RACE_SPECTRE))
5379 dam *= 6; dam /= (randint1(4) + 7);
5382 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5384 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5386 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5388 learn_spell(monspell);
5392 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5398 /* Water -- stun/confuse */
5401 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5402 if (!CHECK_MULTISHADOW())
5404 if (!p_ptr->resist_sound && !p_ptr->resist_water)
5406 set_stun(p_ptr->stun + randint1(40));
5408 if (!p_ptr->resist_conf && !p_ptr->resist_water)
5410 set_confused(p_ptr->confused + randint1(5) + 5);
5413 if (one_in_(5) && !p_ptr->resist_water)
5415 inven_damage(set_cold_destroy, 3);
5418 if (p_ptr->resist_water) get_damage /= 4;
5421 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5425 /* Chaos -- many effects */
5428 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5429 if (p_ptr->resist_chaos)
5431 dam *= 6; dam /= (randint1(4) + 7);
5434 if (!CHECK_MULTISHADOW())
5436 if (!p_ptr->resist_conf)
5438 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5440 if (!p_ptr->resist_chaos)
5442 (void)set_image(p_ptr->image + randint1(10));
5445 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5446 (void)gain_random_mutation(0);
5449 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5451 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5454 if (!p_ptr->resist_chaos || one_in_(9))
5456 inven_damage(set_elec_destroy, 2);
5457 inven_damage(set_fire_destroy, 2);
5461 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5465 /* Shards -- mostly cutting */
5468 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5469 if (p_ptr->resist_shard)
5471 dam *= 6; dam /= (randint1(4) + 7);
5473 else if (!CHECK_MULTISHADOW())
5475 (void)set_cut(p_ptr->cut + dam);
5478 if (!p_ptr->resist_shard || one_in_(13))
5480 inven_damage(set_cold_destroy, 2);
5483 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5487 /* Sound -- mostly stunning */
5490 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5491 if (p_ptr->resist_sound)
5493 dam *= 5; dam /= (randint1(4) + 7);
5495 else if (!CHECK_MULTISHADOW())
5497 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5498 (void)set_stun(p_ptr->stun + plus_stun);
5501 if (!p_ptr->resist_sound || one_in_(13))
5503 inven_damage(set_cold_destroy, 2);
5506 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5510 /* Pure confusion */
5513 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5514 if (p_ptr->resist_conf)
5516 dam *= 5; dam /= (randint1(4) + 7);
5518 else if (!CHECK_MULTISHADOW())
5520 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5522 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5526 /* Disenchantment -- see above */
5529 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5530 if (p_ptr->resist_disen)
5532 dam *= 6; dam /= (randint1(4) + 7);
5534 else if (!CHECK_MULTISHADOW())
5536 (void)apply_disenchant(0);
5538 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5542 /* Nexus -- see above */
5545 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5546 if (p_ptr->resist_nexus)
5548 dam *= 6; dam /= (randint1(4) + 7);
5550 else if (!CHECK_MULTISHADOW())
5554 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5558 /* Force -- mostly stun */
5561 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5562 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5564 (void)set_stun(p_ptr->stun + randint1(20));
5566 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5571 /* Rocket -- stun, cut */
5574 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5575 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5577 (void)set_stun(p_ptr->stun + randint1(20));
5580 if (p_ptr->resist_shard)
5584 else if (!CHECK_MULTISHADOW())
5586 (void)set_cut(p_ptr->cut + (dam / 2));
5589 if (!p_ptr->resist_shard || one_in_(12))
5591 inven_damage(set_cold_destroy, 3);
5594 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5598 /* Inertia -- slowness */
5601 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5602 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5603 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5607 /* Lite -- blinding */
5610 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5611 if (p_ptr->resist_lite)
5613 dam *= 4; dam /= (randint1(4) + 7);
5615 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5617 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5620 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5622 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5625 else if (prace_is_(RACE_S_FAIRY))
5630 if (p_ptr->wraith_form) dam *= 2;
5631 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5633 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5635 p_ptr->wraith_form = 0;
5636 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5637 "The light forces you out of your incorporeal shadow form."));
5639 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5640 p_ptr->update |= (PU_MONSTERS);
5641 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5647 /* Dark -- blinding */
5650 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5651 if (p_ptr->resist_dark)
5653 dam *= 4; dam /= (randint1(4) + 7);
5655 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5657 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5659 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5661 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5665 /* Time -- bolt fewer effects XXX */
5668 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5669 if (p_ptr->resist_time)
5672 dam /= (randint1(4) + 7);
5673 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5675 else if (!CHECK_MULTISHADOW())
5677 switch (randint1(10))
5679 case 1: case 2: case 3: case 4: case 5:
5681 if (p_ptr->prace == RACE_ANDROID) break;
5682 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5683 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5687 case 6: case 7: case 8: case 9:
5689 switch (randint1(6))
5691 case 1: k = A_STR; act = _("強く", "strong"); break;
5692 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5693 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5694 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5695 case 5: k = A_CON; act = _("健康で", "hale"); break;
5696 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5699 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5700 "You're not as %s as you used to be..."), act);
5702 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5703 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5704 p_ptr->update |= (PU_BONUS);
5710 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5711 "You're not as powerful as you used to be..."));
5713 for (k = 0; k < A_MAX; k++)
5715 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5716 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5718 p_ptr->update |= (PU_BONUS);
5724 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5728 /* Gravity -- stun plus slowness plus teleport */
5731 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5732 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5734 if (!CHECK_MULTISHADOW())
5736 teleport_player(5, TELEPORT_PASSIVE);
5737 if (!p_ptr->levitation)
5738 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5739 if (!(p_ptr->resist_sound || p_ptr->levitation))
5741 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5742 (void)set_stun(p_ptr->stun + plus_stun);
5745 if (p_ptr->levitation)
5747 dam = (dam * 2) / 3;
5750 if (!p_ptr->levitation || one_in_(13))
5752 inven_damage(set_cold_destroy, 2);
5755 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5759 /* Standard damage */
5760 case GF_DISINTEGRATE:
5762 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5764 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5770 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5772 (void)hp_player(dam);
5779 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5780 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5787 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5788 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5794 if (p_ptr->free_act) break;
5795 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5797 if (ironman_nightmare)
5799 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5800 /* Have some nightmares */
5801 sanity_blast(NULL, FALSE);
5804 set_paralyzed(p_ptr->paralyzed + dam);
5814 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5815 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5822 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5823 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5830 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5832 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5833 if (!p_ptr->resist_shard || one_in_(13))
5835 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5836 inven_damage(set_cold_destroy, 2);
5842 /* Ice -- cold plus stun plus cuts */
5845 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5846 get_damage = cold_dam(dam, killer, monspell, FALSE);
5847 if (!CHECK_MULTISHADOW())
5849 if (!p_ptr->resist_shard)
5851 (void)set_cut(p_ptr->cut + damroll(5, 8));
5853 if (!p_ptr->resist_sound)
5855 (void)set_stun(p_ptr->stun + randint1(15));
5858 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5860 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5870 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5872 if (p_ptr->mimic_form)
5874 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5875 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5880 switch (p_ptr->prace)
5882 /* Some races are immune */
5896 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5908 if (CHECK_MULTISHADOW())
5910 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5912 else if (p_ptr->csp)
5916 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5918 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5921 if (dam >= p_ptr->csp)
5925 p_ptr->csp_frac = 0;
5934 learn_spell(monspell);
5935 p_ptr->redraw |= (PR_MANA);
5936 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5940 /* Heal the monster */
5941 if (m_ptr->hp < m_ptr->maxhp)
5945 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5947 /* Redraw (later) if needed */
5948 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5949 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5951 /* Special message */
5954 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5967 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5969 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5970 learn_spell(monspell);
5974 if (!CHECK_MULTISHADOW())
5976 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5978 if (!p_ptr->resist_conf)
5980 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5983 if (!p_ptr->resist_chaos && one_in_(3))
5985 (void)set_image(p_ptr->image + randint0(250) + 150);
5992 p_ptr->csp_frac = 0;
5994 p_ptr->redraw |= PR_MANA;
5997 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6003 case GF_BRAIN_SMASH:
6005 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6007 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6008 learn_spell(monspell);
6012 if (!CHECK_MULTISHADOW())
6014 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6020 p_ptr->csp_frac = 0;
6022 p_ptr->redraw |= PR_MANA;
6025 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6026 if (!CHECK_MULTISHADOW())
6028 if (!p_ptr->resist_blind)
6030 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6032 if (!p_ptr->resist_conf)
6034 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6036 if (!p_ptr->free_act)
6038 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6040 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6042 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6043 (void)do_dec_stat(A_INT);
6044 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6045 (void)do_dec_stat(A_WIS);
6047 if (!p_ptr->resist_chaos)
6049 (void)set_image(p_ptr->image + randint0(250) + 150);
6059 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6061 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6062 learn_spell(monspell);
6066 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6067 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6075 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6077 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6078 learn_spell(monspell);
6082 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6083 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6091 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6093 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6094 learn_spell(monspell);
6098 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6099 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6107 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6109 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6110 learn_spell(monspell);
6114 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6115 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6123 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6125 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6126 learn_spell(monspell);
6130 if (!CHECK_MULTISHADOW())
6132 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6133 curse_equipment(40, 20);
6136 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6138 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6153 /* Hex - revenge damage stored */
6154 revenge_store(get_damage);
6156 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6157 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6159 GAME_TEXT m_name_self[80];
6162 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6164 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6165 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6166 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6169 if (p_ptr->riding && dam > 0)
6171 rakubadam_p = (dam > 200) ? 200 : dam;
6175 disturb(TRUE, TRUE);
6178 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6180 (void)kawarimi(FALSE);
6183 /* Return "Anything seen?" */
6189 * Find the distance from (x, y) to a line.
6191 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6193 /* Vector from (x, y) to (x1, y1) */
6194 POSITION py = y1 - y;
6195 POSITION px = x1 - x;
6198 POSITION ny = x2 - x1;
6199 POSITION nx = y1 - y2;
6202 POSITION pd = distance(y1, x1, y, x);
6203 POSITION nd = distance(y1, x1, y2, x2);
6205 if (pd > nd) return distance(y, x, y2, x2);
6207 /* Component of P on N */
6208 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6210 /* Absolute value */
6211 return((nd >= 0) ? nd : 0 - nd);
6218 * Modified version of los() for calculation of disintegration balls.
6219 * Disintegration effects are stopped by permanent walls.
6221 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6223 POSITION dx, dy; /* Delta */
6224 POSITION ax, ay; /* Absolute */
6225 POSITION sx, sy; /* Signs */
6226 POSITION qx, qy; /* Fractions */
6227 POSITION tx, ty; /* Scanners */
6228 POSITION f1, f2; /* Scale factors */
6229 POSITION m; /* Slope, or 1/Slope, of LOS */
6231 /* Extract the offset */
6235 /* Extract the absolute offset */
6239 /* Handle adjacent (or identical) grids */
6240 if ((ax < 2) && (ay < 2)) return (TRUE);
6242 /* Paranoia -- require "safe" origin */
6243 /* if (!in_bounds(y1, x1)) return (FALSE); */
6245 /* Directly South/North */
6248 /* South -- check for walls */
6251 for (ty = y1 + 1; ty < y2; ty++)
6253 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6257 /* North -- check for walls */
6260 for (ty = y1 - 1; ty > y2; ty--)
6262 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6270 /* Directly East/West */
6273 /* East -- check for walls */
6276 for (tx = x1 + 1; tx < x2; tx++)
6278 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6282 /* West -- check for walls */
6285 for (tx = x1 - 1; tx > x2; tx--)
6287 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6295 /* Extract some signs */
6296 sx = (dx < 0) ? -1 : 1;
6297 sy = (dy < 0) ? -1 : 1;
6299 /* Vertical "knights" */
6304 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6308 /* Horizontal "knights" */
6313 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6317 /* Calculate scale factor div 2 */
6320 /* Calculate scale factor */
6324 /* Travel horizontally */
6327 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6333 /* Consider the special case where slope == 1. */
6344 /* Note (below) the case (qy == f2), where */
6345 /* the LOS exactly meets the corner of a tile. */
6348 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6359 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6372 /* Travel vertically */
6375 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6391 /* Note (below) the case (qx == f2), where */
6392 /* the LOS exactly meets the corner of a tile. */
6395 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6406 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6427 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)
6432 int brev = rad * rad / dist;
6436 int mdis = distance(y1, x1, y2, x2) + rad;
6438 while (bdis <= mdis)
6442 if ((0 < dist) && (path_n < dist))
6444 POSITION ny = GRID_Y(path_g[path_n]);
6445 POSITION nx = GRID_X(path_g[path_n]);
6446 POSITION nd = distance(ny, nx, y1, x1);
6448 /* Get next base point */
6457 /* Travel from center outward */
6458 for (cdis = 0; cdis <= brad; cdis++)
6460 /* Scan the maximal blast area of radius "cdis" */
6461 for (y = by - cdis; y <= by + cdis; y++)
6463 for (x = bx - cdis; x <= bx + cdis; x++)
6465 /* Ignore "illegal" locations */
6466 if (!in_bounds(y, x)) continue;
6468 /* Enforce a circular "ripple" */
6469 if (distance(y1, x1, y, x) != bdis) continue;
6471 /* Enforce an arc */
6472 if (distance(by, bx, y, x) != cdis) continue;
6478 /* Lights are stopped by opaque terrains */
6479 if (!los(by, bx, y, x)) continue;
6481 case GF_DISINTEGRATE:
6482 /* Disintegration are stopped only by perma-walls */
6483 if (!in_disintegration_range(by, bx, y, x)) continue;
6486 /* Ball explosions are stopped by walls */
6487 if (!projectable(by, bx, y, x)) continue;
6491 /* Save this grid */
6499 /* Encode some more "radius" info */
6500 gm[bdis + 1] = *pgrids;
6502 /* Increase the size */
6503 brad = rad * (path_n + brev) / (dist + brev);
6505 /* Find the next ripple */
6509 /* Store the effect size */
6515 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6516 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6517 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6518 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6519 * @param x 目標X座標 / Target x location (or location to travel "towards")
6520 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6521 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6522 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6523 * @param monspell 効果元のモンスター魔法ID
6524 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6527 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6528 * towards a given location (optionally passing over the heads of interposing
6529 * monsters), and have it do a given amount of damage to the monsters (and
6530 * optionally objects) within the given radius of the final location.
6532 * A "bolt" travels from source to target and affects only the target grid.
6533 * A "beam" travels from source to target, affecting all grids passed through.
6534 * A "ball" travels from source to the target, exploding at the target, and
6535 * affecting everything within the given radius of the target location.
6537 * Traditionally, a "bolt" does not affect anything on the ground, and does
6538 * not pass over the heads of interposing monsters, much like a traditional
6539 * missile, and will "stop" abruptly at the "target" even if no monster is
6540 * positioned there, while a "ball", on the other hand, passes over the heads
6541 * of monsters between the source and target, and affects everything except
6542 * the source monster which lies within the final radius, while a "beam"
6543 * affects every monster between the source and target, except for the casting
6544 * monster (or player), and rarely affects things on the ground.
6546 * Two special flags allow us to use this function in special ways, the
6547 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6548 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6549 * actually projecting from the source monster (or player).
6551 * The player will only get "experience" for monsters killed by himself
6552 * Unique monsters can only be destroyed by attacks from the player
6554 * Only 256 grids can be affected per projection, limiting the effective
6555 * "radius" of standard ball attacks to nine units (diameter nineteen).
6557 * One can project in a given "direction" by combining PROJECT_THRU with small
6558 * offsets to the initial location (see "line_spell()"), or by calculating
6559 * "virtual targets" far away from the player.
6561 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6562 * continuing until it actually hits somethings (useful for "stone to mud").
6564 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6566 * Balls must explode BEFORE hitting walls, or they would affect monsters
6567 * on both sides of a wall. Some bug reports indicate that this is still
6568 * happening in 2.7.8 for Windows, though it appears to be impossible.
6570 * We "pre-calculate" the blast area only in part for efficiency.
6571 * More importantly, this lets us do "explosions" from the "inside" out.
6572 * This results in a more logical distribution of "blast" treasure.
6573 * It also produces a better (in my opinion) animation of the explosion.
6574 * It could be (but is not) used to have the treasure dropped by monsters
6575 * in the middle of the explosion fall "outwards", and then be damaged by
6576 * the blast as it spreads outwards towards the treasure drop location.
6578 * Walls and doors are included in the blast area, so that they can be
6579 * "burned" or "melted" in later versions.
6581 * This algorithm is intended to maximize simplicity, not necessarily
6582 * efficiency, since this function is not a bottleneck in the code.
6584 * We apply the blast effect from ground zero outwards, in several passes,
6585 * first affecting features, then objects, then monsters, then the player.
6586 * This allows walls to be removed before checking the object or monster
6587 * in the wall, and protects objects which are dropped by monsters killed
6588 * in the blast, and allows the player to see all affects before he is
6589 * killed or teleported away. The semantics of this method are open to
6590 * various interpretations, but they seem to work well in practice.
6592 * We process the blast area from ground-zero outwards to allow for better
6593 * distribution of treasure dropped by monsters, and because it provides a
6594 * pleasing visual effect at low cost.
6596 * Note that the damage done by "ball" explosions decreases with distance.
6597 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6599 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6600 * the target, and then the damage "flows" along this beam of destruction.
6601 * The damage at every grid is the same as at the "center" of a "ball"
6602 * explosion, since the "beam" grids are treated as if they ARE at the
6603 * center of a "ball" explosion.
6605 * Currently, specifying "beam" plus "ball" means that locations which are
6606 * covered by the initial "beam", and also covered by the final "ball", except
6607 * for the final grid (the epicenter of the ball), will be "hit twice", once
6608 * by the initial beam, and once by the exploding ball. For the grid right
6609 * next to the epicenter, this results in 150% damage being done. The center
6610 * does not have this problem, for the same reason the final grid in a "beam"
6611 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6612 * grids which are covered by the "ball" will NOT work, as then they will
6613 * receive LESS damage than they should. Do not combine "beam" with "ball".
6615 * The array "gy[],gx[]" with current size "grids" is used to hold the
6616 * collected locations of all grids in the "blast area" plus "beam path".
6618 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6619 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6620 * first blast grid (see above) with radius "N" from the blast center. Note
6621 * that only the first gm[1] grids in the blast area thus take full damage.
6622 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6623 * number of blast grids.
6625 * Note that once the projection is complete, (y2,x2) holds the final location
6626 * of bolts/beams, and the "epicenter" of balls.
6628 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6629 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6630 * implementation of the "distance" function. Also, a bolt can be properly
6631 * viewed as a "ball" with a "rad" of "zero".
6633 * Note that if no "target" is reached before the beam/bolt/ball travels the
6634 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6635 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6637 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6638 * to move from point A to point B, even if the player cannot see part of the
6639 * projection path. Note that in general, the player will *always* see part
6640 * of the path, since it either starts at the player or ends on the player.
6642 * Hack -- we assume that every "projection" is "self-illuminating".
6644 * Hack -- when only a single monster is affected, we automatically track
6645 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6647 * Note that all projections now "explode" at their final destination, even
6648 * if they were being projected at a more distant destination. This means
6649 * that "ball" spells will *always* explode.
6651 * Note that we must call "handle_stuff()" after affecting terrain features
6652 * in the blast radius, in case the "illumination" of the grid was changed,
6653 * and "update_view()" and "update_monsters()" need to be called.
6656 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6666 POSITION y_saver, x_saver; /* For reflecting monsters */
6668 int msec = delay_factor * delay_factor * delay_factor;
6670 /* Assume the player sees nothing */
6671 bool notice = FALSE;
6673 /* Assume the player has seen nothing */
6674 bool visual = FALSE;
6676 /* Assume the player has seen no blast grids */
6679 /* Assume to be a normal ball spell */
6680 bool breath = FALSE;
6682 /* Is the player blind? */
6683 bool blind = (p_ptr->blind ? TRUE : FALSE);
6685 bool old_hide = FALSE;
6687 /* Number of grids in the "path" */
6690 /* Actual grids in the "path" */
6693 /* Number of grids in the "blast area" (including the "beam" path) */
6696 /* Coordinates of the affected grids */
6697 POSITION gx[1024], gy[1024];
6699 /* Encoded "radius" info (see above) */
6702 /* Actual radius encoded in gm[] */
6703 POSITION gm_rad = rad;
6707 /* Attacker's name (prepared before polymorph)*/
6708 GAME_TEXT who_name[MAX_NLEN];
6710 /* Can the player see the source of this effect? */
6711 bool see_s_msg = TRUE;
6713 /* Initialize by null string */
6719 /* Default target of monsterspell is player */
6720 monster_target_y = p_ptr->y;
6721 monster_target_x = p_ptr->x;
6723 /* Hack -- Jump to target */
6724 if (flg & (PROJECT_JUMP))
6729 /* Clear the flag */
6730 flg &= ~(PROJECT_JUMP);
6735 /* Start at player */
6742 /* Start at monster */
6745 x1 = m_list[who].fx;
6746 y1 = m_list[who].fy;
6747 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6759 /* Default "destination" */
6764 /* Hack -- verify stuff */
6765 if (flg & (PROJECT_THRU))
6767 if ((x1 == x2) && (y1 == y2))
6769 flg &= ~(PROJECT_THRU);
6773 /* Handle a breath attack */
6778 if (flg & PROJECT_HIDE) old_hide = TRUE;
6779 flg |= PROJECT_HIDE;
6783 /* Hack -- Assume there will be no blast (max radius 32) */
6784 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6792 /* Collect beam grids */
6793 if (flg & (PROJECT_BEAM))
6804 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6806 case GF_DISINTEGRATE:
6807 flg |= (PROJECT_GRID);
6808 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6812 /* Calculate the projection path */
6814 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6817 /* Giga-Hack SEEKER & SUPER_RAY */
6819 if( typ == GF_SEEKER )
6829 for (i = 0; i < path_n; ++i)
6834 int ny = GRID_Y(path_g[i]);
6835 int nx = GRID_X(path_g[i]);
6846 /* Only do visuals if requested */
6847 if (!blind && !(flg & (PROJECT_HIDE)))
6849 /* Only do visuals if the player can "see" the bolt */
6850 if (panel_contains(y, x) && player_has_los_bold(y, x))
6857 /* Obtain the bolt pict */
6858 p = bolt_pict(oy, ox, y, x, typ);
6860 /* Extract attr/char */
6864 /* Visual effects */
6865 print_rel(c, a, y, x);
6866 move_cursor_relative(y, x);
6867 /*if (fresh_before)*/ Term_fresh();
6868 Term_xtra(TERM_XTRA_DELAY, msec);
6870 /*if (fresh_before)*/ Term_fresh();
6872 /* Display "beam" grids */
6873 if (flg & (PROJECT_BEAM))
6875 /* Obtain the explosion pict */
6876 p = bolt_pict(y, x, y, x, typ);
6878 /* Extract attr/char */
6882 /* Visual effects */
6883 print_rel(c, a, y, x);
6886 /* Hack -- Activate delay */
6890 /* Hack -- delay anyway for consistency */
6893 /* Delay for consistency */
6894 Term_xtra(TERM_XTRA_DELAY, msec);
6897 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6898 if (is_mirror_grid(&cave[y][x]))
6900 /* The target of monsterspell becomes tha mirror(broken) */
6901 monster_target_y = y;
6902 monster_target_x = x;
6904 remove_mirror(y, x);
6905 next_mirror(&oy, &ox, y, x);
6907 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6908 for (j = last_i; j <= i; j++)
6910 y = GRID_Y(path_g[j]);
6911 x = GRID_X(path_g[j]);
6912 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6913 if (!who && (project_m_n == 1) && !jump) {
6914 if (cave[project_m_y][project_m_x].m_idx > 0) {
6915 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6919 /* Hack -- auto-recall */
6920 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6922 /* Hack - auto-track */
6923 health_track(cave[project_m_y][project_m_x].m_idx);
6927 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6932 for(i = last_i ; i < path_n ; i++)
6935 py = GRID_Y(path_g[i]);
6936 px = GRID_X(path_g[i]);
6937 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6939 if (!who && (project_m_n == 1) && !jump) {
6940 if (cave[project_m_y][project_m_x].m_idx > 0)
6942 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6946 /* Hack -- auto-recall */
6947 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6949 /* Hack - auto-track */
6950 health_track(cave[project_m_y][project_m_x].m_idx);
6954 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6958 else if(typ == GF_SUPER_RAY){
6960 int second_step = 0;
6967 for (i = 0; i < path_n; ++i)
6972 POSITION ny = GRID_Y(path_g[i]);
6973 POSITION nx = GRID_X(path_g[i]);
6984 /* Only do visuals if requested */
6985 if (!blind && !(flg & (PROJECT_HIDE)))
6987 /* Only do visuals if the player can "see" the bolt */
6988 if (panel_contains(y, x) && player_has_los_bold(y, x))
6995 /* Obtain the bolt pict */
6996 p = bolt_pict(oy, ox, y, x, typ);
6998 /* Extract attr/char */
7002 /* Visual effects */
7003 print_rel(c, a, y, x);
7004 move_cursor_relative(y, x);
7005 /*if (fresh_before)*/ Term_fresh();
7006 Term_xtra(TERM_XTRA_DELAY, msec);
7008 /*if (fresh_before)*/ Term_fresh();
7010 /* Display "beam" grids */
7011 if (flg & (PROJECT_BEAM))
7013 /* Obtain the explosion pict */
7014 p = bolt_pict(y, x, y, x, typ);
7016 /* Extract attr/char */
7020 /* Visual effects */
7021 print_rel(c, a, y, x);
7024 /* Hack -- Activate delay */
7028 /* Hack -- delay anyway for consistency */
7031 /* Delay for consistency */
7032 Term_xtra(TERM_XTRA_DELAY, msec);
7035 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7036 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7038 if( second_step )continue;
7041 if( is_mirror_grid(&cave[y][x]) && !second_step )
7043 /* The target of monsterspell becomes tha mirror(broken) */
7044 monster_target_y=(s16b)y;
7045 monster_target_x=(s16b)x;
7048 for( j = 0; j <=i ; j++ )
7050 y = GRID_Y(path_g[j]);
7051 x = GRID_X(path_g[j]);
7052 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7056 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7057 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7058 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7059 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7060 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7061 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7062 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7063 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7066 for( i = 0; i < path_n ; i++ )
7069 py = GRID_Y(path_g[i]);
7070 px = GRID_X(path_g[i]);
7071 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7072 if(!who && (project_m_n == 1) && !jump){
7073 if(cave[project_m_y][project_m_x].m_idx >0 ){
7074 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7078 /* Hack -- auto-recall */
7079 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7081 /* Hack - auto-track */
7082 health_track(cave[project_m_y][project_m_x].m_idx);
7086 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7091 /* Project along the path */
7092 for (i = 0; i < path_n; ++i)
7097 POSITION ny = GRID_Y(path_g[i]);
7098 POSITION nx = GRID_X(path_g[i]);
7100 if (flg & PROJECT_DISI)
7102 /* Hack -- Balls explode before reaching walls */
7103 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7105 else if (flg & PROJECT_LOS)
7107 /* Hack -- Balls explode before reaching walls */
7108 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7112 /* Hack -- Balls explode before reaching walls */
7113 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7120 /* Collect beam grids */
7121 if (flg & (PROJECT_BEAM))
7128 /* Only do visuals if requested */
7129 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7131 /* Only do visuals if the player can "see" the bolt */
7132 if (panel_contains(y, x) && player_has_los_bold(y, x))
7139 /* Obtain the bolt pict */
7140 p = bolt_pict(oy, ox, y, x, typ);
7142 /* Extract attr/char */
7146 /* Visual effects */
7147 print_rel(c, a, y, x);
7148 move_cursor_relative(y, x);
7149 /*if (fresh_before)*/ Term_fresh();
7150 Term_xtra(TERM_XTRA_DELAY, msec);
7152 /*if (fresh_before)*/ Term_fresh();
7154 /* Display "beam" grids */
7155 if (flg & (PROJECT_BEAM))
7157 /* Obtain the explosion pict */
7158 p = bolt_pict(y, x, y, x, typ);
7160 /* Extract attr/char */
7164 /* Visual effects */
7165 print_rel(c, a, y, x);
7168 /* Hack -- Activate delay */
7172 /* Hack -- delay anyway for consistency */
7175 /* Delay for consistency */
7176 Term_xtra(TERM_XTRA_DELAY, msec);
7183 /* Save the "blast epicenter" */
7187 if (breath && !path_n)
7193 flg &= ~(PROJECT_HIDE);
7197 /* Start the "explosion" */
7200 /* Hack -- make sure beams get to "explode" */
7208 /* If we found a "target", explode there */
7209 if (dist <= MAX_RANGE)
7211 /* Mega-Hack -- remove the final "beam" grid */
7212 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7215 * Create a conical breath attack
7226 flg &= ~(PROJECT_HIDE);
7228 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7232 /* Determine the blast area, work from the inside out */
7233 for (dist = 0; dist <= rad; dist++)
7235 /* Scan the maximal blast area of radius "dist" */
7236 for (y = by - dist; y <= by + dist; y++)
7238 for (x = bx - dist; x <= bx + dist; x++)
7240 /* Ignore "illegal" locations */
7241 if (!in_bounds2(y, x)) continue;
7243 /* Enforce a "circular" explosion */
7244 if (distance(by, bx, y, x) != dist) continue;
7250 /* Lights are stopped by opaque terrains */
7251 if (!los(by, bx, y, x)) continue;
7253 case GF_DISINTEGRATE:
7254 /* Disintegration are stopped only by perma-walls */
7255 if (!in_disintegration_range(by, bx, y, x)) continue;
7258 /* Ball explosions are stopped by walls */
7259 if (!projectable(by, bx, y, x)) continue;
7263 /* Save this grid */
7270 /* Encode some more "radius" info */
7276 /* Speed -- ignore "non-explosions" */
7277 if (!grids) return (FALSE);
7280 /* Display the "blast area" if requested */
7281 if (!blind && !(flg & (PROJECT_HIDE)))
7283 /* Then do the "blast", from inside out */
7284 for (t = 0; t <= gm_rad; t++)
7286 /* Dump everything with this radius */
7287 for (i = gm[t]; i < gm[t+1]; i++)
7289 /* Extract the location */
7293 /* Only do visuals if the player can "see" the blast */
7294 if (panel_contains(y, x) && player_has_los_bold(y, x))
7303 /* Obtain the explosion pict */
7304 p = bolt_pict(y, x, y, x, typ);
7306 /* Extract attr/char */
7310 /* Visual effects -- Display */
7311 print_rel(c, a, y, x);
7315 /* Hack -- center the cursor */
7316 move_cursor_relative(by, bx);
7318 /* Flush each "radius" seperately */
7319 /*if (fresh_before)*/ Term_fresh();
7321 /* Delay (efficiently) */
7322 if (visual || drawn)
7324 Term_xtra(TERM_XTRA_DELAY, msec);
7328 /* Flush the erasing */
7331 /* Erase the explosion drawn above */
7332 for (i = 0; i < grids; i++)
7334 /* Extract the location */
7338 /* Hack -- Erase if needed */
7339 if (panel_contains(y, x) && player_has_los_bold(y, x))
7345 /* Hack -- center the cursor */
7346 move_cursor_relative(by, bx);
7348 /* Flush the explosion */
7349 /*if (fresh_before)*/ Term_fresh();
7353 update_creature(p_ptr);
7355 if (flg & PROJECT_KILL)
7357 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7358 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7362 /* Check features */
7363 if (flg & (PROJECT_GRID))
7365 /* Start with "dist" of zero */
7368 /* Scan for features */
7369 for (i = 0; i < grids; i++)
7371 /* Hack -- Notice new "dist" values */
7372 if (gm[dist+1] == i) dist++;
7374 /* Get the grid location */
7378 /* Find the closest point in the blast */
7381 int d = dist_to_line(y, x, y1, x1, by, bx);
7383 /* Affect the grid */
7384 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7388 /* Affect the grid */
7389 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7394 update_creature(p_ptr);
7397 if (flg & (PROJECT_ITEM))
7399 /* Start with "dist" of zero */
7402 /* Scan for objects */
7403 for (i = 0; i < grids; i++)
7405 /* Hack -- Notice new "dist" values */
7406 if (gm[dist+1] == i) dist++;
7408 /* Get the grid location */
7412 /* Find the closest point in the blast */
7415 int d = dist_to_line(y, x, y1, x1, by, bx);
7417 /* Affect the object in the grid */
7418 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7422 /* Affect the object in the grid */
7423 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7429 /* Check monsters */
7430 if (flg & (PROJECT_KILL))
7437 /* Start with "dist" of zero */
7440 /* Scan for monsters */
7441 for (i = 0; i < grids; i++)
7445 /* Hack -- Notice new "dist" values */
7446 if (gm[dist + 1] == i) dist++;
7448 /* Get the grid location */
7452 /* A single bolt may be reflected */
7455 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7456 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7458 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7459 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7460 (!who || dist_hack > 1) && !one_in_(10))
7463 int max_attempts = 10;
7465 /* Choose 'new' target */
7468 t_y = y_saver - 1 + randint1(3);
7469 t_x = x_saver - 1 + randint1(3);
7472 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7474 if (max_attempts < 1)
7480 sound(SOUND_REFLECT);
7483 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7484 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7485 else if (m_ptr->r_idx == MON_DIO)
7486 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7488 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7490 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7492 /* Reflected bolts randomly target either one */
7493 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7494 else flg |= PROJECT_PLAYER;
7496 /* The bolt is reflected */
7497 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7499 /* Don't affect the monster any longer */
7505 /* Find the closest point in the blast */
7508 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7512 effective_dist = dist;
7516 /* There is the riding player on this monster */
7517 if (p_ptr->riding && player_bold(y, x))
7519 /* Aimed on the player */
7520 if (flg & PROJECT_PLAYER)
7522 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7525 * A beam or bolt is well aimed
7527 * So don't affects the mount.
7534 * The spell is not well aimed,
7535 * So partly affect the mount too.
7542 * This grid is the original target.
7543 * Or aimed on your horse.
7545 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7547 /* Hit the mount with full damage */
7551 * Otherwise this grid is not the
7552 * original target, it means that line
7553 * of fire is obstructed by this
7557 * A beam or bolt will hit either
7558 * player or mount. Choose randomly.
7560 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7564 /* Hit the mount with full damage */
7568 /* Hit the player later */
7569 flg |= PROJECT_PLAYER;
7571 /* Don't affect the mount */
7577 * The spell is not well aimed, so
7578 * partly affect both player and
7587 /* Affect the monster in the grid */
7588 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7592 /* Player affected one monster (without "jumping") */
7593 if (!who && (project_m_n == 1) && !jump)
7598 /* Track if possible */
7599 if (cave[y][x].m_idx > 0)
7601 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7605 /* Hack -- auto-recall */
7606 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7608 /* Hack - auto-track */
7609 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7617 if (flg & (PROJECT_KILL))
7619 /* Start with "dist" of zero */
7622 /* Scan for player */
7623 for (i = 0; i < grids; i++)
7627 /* Hack -- Notice new "dist" values */
7628 if (gm[dist+1] == i) dist++;
7630 /* Get the grid location */
7634 /* Affect the player? */
7635 if (!player_bold(y, x)) continue;
7637 /* Find the closest point in the blast */
7640 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7644 effective_dist = dist;
7647 /* Target may be your horse */
7650 /* Aimed on the player */
7651 if (flg & PROJECT_PLAYER)
7653 /* Hit the player with full damage */
7657 * Hack -- When this grid was not the
7658 * original target, a beam or bolt
7659 * would hit either player or mount,
7660 * and should be choosen randomly.
7662 * But already choosen to hit the
7663 * mount at this point.
7665 * Or aimed on your horse.
7667 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7670 * A beam or bolt is well aimed
7672 * So don't affects the player.
7679 * The spell is not well aimed,
7680 * So partly affect the player too.
7686 /* Affect the player */
7687 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7693 GAME_TEXT m_name[MAX_NLEN];
7695 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7697 if (rakubadam_m > 0)
7699 if (rakuba(rakubadam_m, FALSE))
7701 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7704 if (p_ptr->riding && rakubadam_p > 0)
7706 if(rakuba(rakubadam_p, FALSE))
7708 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7713 /* Return "something was noticed" */
7718 * @brief 鏡魔法「封魔結界」の効果処理
7720 * @return 効果があったらTRUEを返す
7722 bool binding_field(HIT_POINT dam)
7724 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7725 int mirror_num = 0; /* 鏡の数 */
7727 POSITION centersign;
7728 POSITION x1, x2, y1, y2;
7730 int msec = delay_factor*delay_factor*delay_factor;
7733 POSITION point_x[3];
7734 POSITION point_y[3];
7736 /* Default target of monsterspell is player */
7737 monster_target_y = p_ptr->y;
7738 monster_target_x = p_ptr->x;
7740 for (x = 0; x < cur_wid; x++)
7742 for (y = 0; y < cur_hgt; y++)
7744 if (is_mirror_grid(&cave[y][x]) &&
7745 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7746 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7747 player_has_los_bold(y, x) &&
7748 projectable(p_ptr->y, p_ptr->x, y, x)
7750 mirror_y[mirror_num] = y;
7751 mirror_x[mirror_num] = x;
7757 if (mirror_num < 2)return FALSE;
7759 point_x[0] = randint0(mirror_num);
7761 point_x[1] = randint0(mirror_num);
7762 } while (point_x[0] == point_x[1]);
7764 point_y[0] = mirror_y[point_x[0]];
7765 point_x[0] = mirror_x[point_x[0]];
7766 point_y[1] = mirror_y[point_x[1]];
7767 point_x[1] = mirror_x[point_x[1]];
7768 point_y[2] = p_ptr->y;
7769 point_x[2] = p_ptr->x;
7771 x = point_x[0] + point_x[1] + point_x[2];
7772 y = point_y[0] + point_y[1] + point_y[2];
7774 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7775 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7776 if (centersign == 0)return FALSE;
7778 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7779 x1 = x1 < point_x[2] ? x1 : point_x[2];
7780 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7781 y1 = y1 < point_y[2] ? y1 : point_y[2];
7783 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7784 x2 = x2 > point_x[2] ? x2 : point_x[2];
7785 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7786 y2 = y2 > point_y[2] ? y2 : point_y[2];
7788 for (y = y1; y <= y2; y++) {
7789 for (x = x1; x <= x2; x++) {
7790 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7791 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7792 centersign*((point_x[1] - x)*(point_y[2] - y)
7793 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7794 centersign*((point_x[2] - x)*(point_y[0] - y)
7795 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7797 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7798 /* Visual effects */
7800 && panel_contains(y, x)) {
7801 p = bolt_pict(y, x, y, x, GF_MANA);
7802 print_rel(PICT_C(p), PICT_A(p), y, x);
7803 move_cursor_relative(y, x);
7804 /*if (fresh_before)*/ Term_fresh();
7805 Term_xtra(TERM_XTRA_DELAY, msec);
7811 for (y = y1; y <= y2; y++) {
7812 for (x = x1; x <= x2; x++) {
7813 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7814 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7815 centersign*((point_x[1] - x)*(point_y[2] - y)
7816 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7817 centersign*((point_x[2] - x)*(point_y[0] - y)
7818 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7820 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7821 (void)project_f(0, 0, y, x, dam, GF_MANA);
7826 for (y = y1; y <= y2; y++) {
7827 for (x = x1; x <= x2; x++) {
7828 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7829 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7830 centersign*((point_x[1] - x)*(point_y[2] - y)
7831 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7832 centersign*((point_x[2] - x)*(point_y[0] - y)
7833 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7835 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7836 (void)project_o(0, 0, y, x, dam, GF_MANA);
7841 for (y = y1; y <= y2; y++) {
7842 for (x = x1; x <= x2; x++) {
7843 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7844 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7845 centersign*((point_x[1] - x)*(point_y[2] - y)
7846 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7847 centersign*((point_x[2] - x)*(point_y[0] - y)
7848 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7850 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7851 (void)project_m(0, 0, y, x, dam, GF_MANA,
7852 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7858 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7859 remove_mirror(point_y[0], point_x[0]);
7866 * @brief 鏡魔法「鏡の封印」の効果処理
7868 * @return 効果があったらTRUEを返す
7870 void seal_of_mirror(HIT_POINT dam)
7874 for (x = 0; x < cur_wid; x++)
7876 for (y = 0; y < cur_hgt; y++)
7878 if (is_mirror_grid(&cave[y][x]))
7880 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7881 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7883 if (!cave[y][x].m_idx)
7885 remove_mirror(y, x);