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.
16 /* ToDo: Make this global */
17 #define HURT_CHANCE 16 /*!< 属性攻撃を受けた際に能力値低下を起こす確率(1/X) / 1/x chance of reducing stats (for elemental attacks) */
19 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
20 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
22 int project_length = 0; /*!< 投射の射程距離 */
26 * @brief モンスター魅了用セービングスロー共通部
28 * @param m_ptr 対象モンスター
29 * @return 魅了に抵抗したらTRUE
31 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
33 monster_race *r_ptr = &r_info[m_ptr->r_idx];
35 if(p_ptr->inside_arena) return TRUE;
38 if (r_ptr->flagsr & RFR_RES_ALL)
40 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
44 if (r_ptr->flags3 & RF3_NO_CONF)
46 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
50 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
52 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
53 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
54 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
58 * @brief 配置した鏡リストの次を取得する /
59 * Get another mirror. for SEEKER
60 * @param next_y 次の鏡のy座標を返す参照ポインタ
61 * @param next_x 次の鏡のx座標を返す参照ポインタ
62 * @param cury 現在の鏡のy座標
63 * @param curx 現在の鏡のx座標
65 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
67 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
68 int mirror_num = 0; /* 鏡の数 */
72 for (x = 0; x < cur_wid; x++)
74 for (y = 0; y < cur_hgt; y++)
76 if (is_mirror_grid(&cave[y][x])) {
77 mirror_y[mirror_num] = y;
78 mirror_x[mirror_num] = x;
85 num = randint0(mirror_num);
86 *next_y = mirror_y[num];
87 *next_x = mirror_x[num];
90 *next_y = cury + randint0(5) - 2;
91 *next_x = curx + randint0(5) - 2;
96 * @brief 万色表現用にランダムな色を選択する関数 /
97 * Get a legal "multi-hued" color for drawing "spells"
101 static byte mh_attr(int max)
103 switch (randint1(max))
105 case 1: return (TERM_RED);
106 case 2: return (TERM_GREEN);
107 case 3: return (TERM_BLUE);
108 case 4: return (TERM_YELLOW);
109 case 5: return (TERM_ORANGE);
110 case 6: return (TERM_VIOLET);
111 case 7: return (TERM_L_RED);
112 case 8: return (TERM_L_GREEN);
113 case 9: return (TERM_L_BLUE);
114 case 10: return (TERM_UMBER);
115 case 11: return (TERM_L_UMBER);
116 case 12: return (TERM_SLATE);
117 case 13: return (TERM_WHITE);
118 case 14: return (TERM_L_WHITE);
119 case 15: return (TERM_L_DARK);
127 * @brief 魔法属性に応じたエフェクトの色を返す /
128 * Return a color to use for the bolt/ball spells
132 static byte spell_color(int type)
134 /* Check if A.B.'s new graphics should be used (rr9) */
135 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
140 case GF_PSY_SPEAR: return (0x06);
141 case GF_MISSILE: return (0x0F);
142 case GF_ACID: return (0x04);
143 case GF_ELEC: return (0x02);
144 case GF_FIRE: return (0x00);
145 case GF_COLD: return (0x01);
146 case GF_POIS: return (0x03);
147 case GF_HOLY_FIRE: return (0x00);
148 case GF_HELL_FIRE: return (0x00);
149 case GF_MANA: return (0x0E);
151 case GF_SEEKER: return (0x0E);
152 case GF_SUPER_RAY: return (0x0E);
154 case GF_ARROW: return (0x0F);
155 case GF_WATER: return (0x04);
156 case GF_NETHER: return (0x07);
157 case GF_CHAOS: return (mh_attr(15));
158 case GF_DISENCHANT: return (0x05);
159 case GF_NEXUS: return (0x0C);
160 case GF_CONFUSION: return (mh_attr(4));
161 case GF_SOUND: return (0x09);
162 case GF_SHARDS: return (0x08);
163 case GF_FORCE: return (0x09);
164 case GF_INERTIAL: return (0x09);
165 case GF_GRAVITY: return (0x09);
166 case GF_TIME: return (0x09);
167 case GF_LITE_WEAK: return (0x06);
168 case GF_LITE: return (0x06);
169 case GF_DARK_WEAK: return (0x07);
170 case GF_DARK: return (0x07);
171 case GF_PLASMA: return (0x0B);
172 case GF_METEOR: return (0x00);
173 case GF_ICE: return (0x01);
174 case GF_ROCKET: return (0x0F);
175 case GF_DEATH_RAY: return (0x07);
176 case GF_NUKE: return (mh_attr(2));
177 case GF_DISINTEGRATE: return (0x05);
189 case GF_CAUSE_4: return (0x0E);
190 case GF_HAND_DOOM: return (0x07);
191 case GF_CAPTURE : return (0x0E);
192 case GF_IDENTIFY: return (0x01);
193 case GF_ATTACK: return (0x0F);
194 case GF_PHOTO : return (0x06);
197 /* Normal tiles or ASCII */
203 /* Lookup the default colors for this type */
204 cptr s = quark_str(gf_color[type]);
207 if (!s) return (TERM_WHITE);
209 /* Pick a random color */
210 c = s[randint0(strlen(s))];
212 /* Lookup this color */
213 a = my_strchr(color_char, c) - color_char;
215 /* Invalid color (note check for < 0 removed, gave a silly
216 * warning because bytes are always >= 0 -- RG) */
217 if (a > 15) return (TERM_WHITE);
223 /* Standard "color" */
229 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
230 * Find the attr/char pair to use for a spell effect
239 * It is moving (or has moved) from (x,y) to (nx,ny).
240 * If the distance is not "one", we (may) return "*".
243 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
253 if ((ny == y) && (nx == x)) base = 0x30;
256 else if (nx == x) base = 0x40;
259 else if (ny == y) base = 0x50;
262 else if ((ny - y) == (x - nx)) base = 0x60;
265 else if ((ny - y) == (nx - x)) base = 0x70;
270 /* Basic spell color */
271 k = spell_color(typ);
273 /* Obtain attr/char */
274 a = misc_to_attr[base + k];
275 c = misc_to_char[base + k];
283 * @brief 始点から終点への経路を返す /
284 * Determine the path taken by a projection.
285 * @param gp 経路座標リストを返す参照ポインタ
295 * The projection will always start from the grid (y1,x1), and will travel
296 * towards the grid (y2,x2), touching one grid per unit of distance along
297 * the major axis, and stopping when it enters the destination grid or a
298 * wall grid, or has travelled the maximum legal distance of "range".
300 * Note that "distance" in this function (as in the "update_view()" code)
301 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
302 * actually has an "octagon of projection" not a "circle of projection".
304 * The path grids are saved into the grid array pointed to by "gp", and
305 * there should be room for at least "range" grids in "gp". Note that
306 * due to the way in which distance is calculated, this function normally
307 * uses fewer than "range" grids for the projection path, so the result
308 * of this function should never be compared directly to "range". Note
309 * that the initial grid (y1,x1) is never saved into the grid array, not
310 * even if the initial grid is also the final grid. XXX XXX XXX
312 * The "flg" flags can be used to modify the behavior of this function.
314 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
315 * semantics as they do for the "project" function, namely, that the path
316 * will stop as soon as it hits a monster, or that the path will continue
317 * through the destination grid, respectively.
319 * The "PROJECT_JUMP" flag, which for the "project()" function means to
320 * start at a special grid (which makes no sense in this function), means
321 * that the path should be "angled" slightly if needed to avoid any wall
322 * grids, allowing the player to "target" any grid which is in "view".
323 * This flag is non-trivial and has not yet been implemented, but could
324 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
326 * This function returns the number of grids (if any) in the path. This
327 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
329 * This algorithm is similar to, but slightly different from, the one used
330 * by "update_view_los()", and very different from the one used by "los()".
333 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
355 /* No path necessary (or allowed) */
356 if ((x1 == x2) && (y1 == y2)) return (0);
384 /* Number of "units" in one "half" grid */
387 /* Number of "units" in one "full" grid */
393 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
404 /* Advance (X) part 2 */
407 /* Advance (X) part 3 */
414 /* Create the projection path */
418 gp[n++] = GRID(y, x);
420 /* Hack -- Check maximum range */
421 if ((n + (k >> 1)) >= range) break;
423 /* Sometimes stop at destination grid */
424 if (!(flg & (PROJECT_THRU)))
426 if ((x == x2) && (y == y2)) break;
429 if (flg & (PROJECT_DISI))
431 if ((n > 0) && cave_stop_disintegration(y, x)) break;
433 else if (flg & (PROJECT_LOS))
435 if ((n > 0) && !cave_los_bold(y, x)) break;
437 else if (!(flg & (PROJECT_PATH)))
439 /* Always stop at non-initial wall grids */
440 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
443 /* Sometimes stop at non-initial monsters/players */
444 if (flg & (PROJECT_STOP))
447 (player_bold(y, x) || cave[y][x].m_idx != 0))
451 if (!in_bounds(y, x)) break;
456 /* Advance (X) part 1 */
459 /* Horizontal change */
462 /* Advance (X) part 2 */
465 /* Advance (X) part 3 */
481 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
490 /* Vertical change */
493 /* Advance (Y) part 2 */
496 /* Advance (Y) part 3 */
503 /* Create the projection path */
507 gp[n++] = GRID(y, x);
509 /* Hack -- Check maximum range */
510 if ((n + (k >> 1)) >= range) break;
512 /* Sometimes stop at destination grid */
513 if (!(flg & (PROJECT_THRU)))
515 if ((x == x2) && (y == y2)) break;
518 if (flg & (PROJECT_DISI))
520 if ((n > 0) && cave_stop_disintegration(y, x)) break;
522 else if (flg & (PROJECT_LOS))
524 if ((n > 0) && !cave_los_bold(y, x)) break;
526 else if (!(flg & (PROJECT_PATH)))
528 /* Always stop at non-initial wall grids */
529 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
532 /* Sometimes stop at non-initial monsters/players */
533 if (flg & (PROJECT_STOP))
536 (player_bold(y, x) || cave[y][x].m_idx != 0))
540 if (!in_bounds(y, x)) break;
545 /* Advance (Y) part 1 */
548 /* Vertical change */
551 /* Advance (Y) part 2 */
554 /* Advance (Y) part 3 */
574 /* Create the projection path */
578 gp[n++] = GRID(y, x);
580 /* Hack -- Check maximum range */
581 if ((n + (n >> 1)) >= range) break;
583 /* Sometimes stop at destination grid */
584 if (!(flg & (PROJECT_THRU)))
586 if ((x == x2) && (y == y2)) break;
589 if (flg & (PROJECT_DISI))
591 if ((n > 0) && cave_stop_disintegration(y, x)) break;
593 else if (flg & (PROJECT_LOS))
595 if ((n > 0) && !cave_los_bold(y, x)) break;
597 else if (!(flg & (PROJECT_PATH)))
599 /* Always stop at non-initial wall grids */
600 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
603 /* Sometimes stop at non-initial monsters/players */
604 if (flg & (PROJECT_STOP))
607 (player_bold(y, x) || cave[y][x].m_idx != 0))
611 if (!in_bounds(y, x)) break;
628 * Mega-Hack -- track "affected" monsters (see "project()" comments)
630 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
631 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
632 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
633 /* Mega-Hack -- monsters target */
634 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
635 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
639 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
640 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
641 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
642 * @param y 目標Y座標 / Target y location (or location to travel "towards")
643 * @param x 目標X座標 / Target x location (or location to travel "towards")
644 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
645 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
646 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
649 * We are called both for "beam" effects and "ball" effects.
651 * The "r" parameter is the "distance from ground zero".
653 * Note that we determine if the player can "see" anything that happens
654 * by taking into account: blindness, line-of-sight, and illumination.
656 * We return "TRUE" if the effect of the projection is "obvious".
658 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
660 * XXX XXX XXX Perhaps we should affect doors?
663 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
665 cave_type *c_ptr = &cave[y][x];
666 feature_type *f_ptr = &f_info[c_ptr->feat];
668 bool obvious = FALSE;
669 bool known = player_has_los_bold(y, x);
675 /* Reduce damage by distance */
676 dam = (dam + r) / (r + 1);
679 if (have_flag(f_ptr->flags, FF_TREE))
687 message = _("枯れた", "was blasted."); break;
689 message = _("縮んだ", "shrank."); break;
691 message = _("溶けた", "melted."); break;
694 message = _("凍り、砕け散った", "was frozen and smashed."); break;
698 message = _("燃えた", "burns up!"); break;
710 message = _("粉砕された", "was crushed."); break;
712 message = NULL;break;
716 msg_format(_("木は%s。", "A tree %s"), message);
717 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
720 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
724 /* Analyze the type */
727 /* Ignore most effects */
762 /* Destroy Traps (and Locks) */
765 /* Reveal secret doors */
766 if (is_hidden_door(c_ptr))
771 /* Check line of sight */
779 if (is_trap(c_ptr->feat))
781 /* Check line of sight */
784 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
788 /* Destroy the trap */
789 cave_alter_feat(y, x, FF_DISARM);
792 /* Locked doors are unlocked */
793 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
795 s16b old_feat = c_ptr->feat;
797 /* Unlock the door */
798 cave_alter_feat(y, x, FF_DISARM);
800 /* Check line of sound */
801 if (known && (old_feat != c_ptr->feat))
803 msg_print(_("カチッと音がした!", "Click!"));
808 /* Remove "unsafe" flag if player is not blind */
809 if (!p_ptr->blind && player_has_los_bold(y, x))
811 c_ptr->info &= ~(CAVE_UNSAFE);
822 /* Destroy Doors (and traps) */
825 /* Destroy all doors and traps */
826 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
828 /* Check line of sight */
832 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
836 /* Destroy the feature */
837 cave_alter_feat(y, x, FF_TUNNEL);
840 /* Remove "unsafe" flag if player is not blind */
841 if (!p_ptr->blind && player_has_los_bold(y, x))
843 c_ptr->info &= ~(CAVE_UNSAFE);
854 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
856 if (have_flag(f_ptr->flags, FF_SPIKE))
858 s16b old_mimic = c_ptr->mimic;
859 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
861 cave_alter_feat(y, x, FF_SPIKE);
863 c_ptr->mimic = old_mimic;
871 /* Check line of sight */
872 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
875 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
882 /* Destroy walls (and doors) */
885 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
888 if (known && (c_ptr->info & (CAVE_MARK)))
890 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
894 /* Destroy the wall */
895 cave_alter_feat(y, x, FF_HURT_ROCK);
897 /* Update some things */
898 p_ptr->update |= (PU_FLOW);
907 /* Require a "naked" floor grid */
908 if (!cave_naked_bold(y, x)) break;
910 /* Not on the player */
911 if (player_bold(y, x)) break;
913 /* Create a closed door */
914 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
917 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
934 /* Require a "naked" floor grid */
935 if (!cave_naked_bold(y, x)) break;
937 /* Not on the player */
938 if (player_bold(y, x)) break;
940 /* Create a closed door */
941 cave_set_feat(y, x, feat_tree);
944 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
952 /* Require a "naked" floor grid */
953 if (!cave_naked_bold(y, x)) break;
956 c_ptr->info |= CAVE_OBJECT;
957 c_ptr->mimic = feat_glyph;
970 /* Require a "naked" floor grid */
971 if (!cave_naked_bold(y, x)) break;
973 /* Not on the player */
974 if (player_bold(y, x)) break;
977 cave_set_feat(y, x, feat_granite);
985 /* Ignore permanent grid */
986 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
991 /* Ignore grid without enough space */
992 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
994 /* Place a shallow lava */
995 cave_set_feat(y, x, feat_shallow_lava);
1000 /* Place a deep lava */
1001 cave_set_feat(y, x, feat_deep_lava);
1008 /* Ignore permanent grid */
1009 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1014 /* Ignore grid without enough space */
1015 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1017 /* Place a shallow water */
1018 cave_set_feat(y, x, feat_shallow_water);
1023 /* Place a deep water */
1024 cave_set_feat(y, x, feat_deep_water);
1029 /* Lite up the grid */
1033 /* Turn on the light */
1034 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1036 c_ptr->info |= (CAVE_GLOW);
1044 update_local_illumination(y, x);
1047 if (player_can_see_bold(y, x)) obvious = TRUE;
1049 /* Mega-Hack -- Update the monster in the affected grid */
1050 /* This allows "spear of light" (etc) to work "correctly" */
1051 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1053 if (p_ptr->special_defense & NINJA_S_STEALTH)
1055 if (player_bold(y, x)) set_superstealth(FALSE);
1062 /* Darken the grid */
1066 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1069 /* Turn off the light. */
1072 if (dun_level || !is_daytime())
1074 for (j = 0; j < 9; j++)
1076 int by = y + ddy_ddd[j];
1077 int bx = x + ddx_ddd[j];
1079 if (in_bounds2(by, bx))
1081 cave_type *cc_ptr = &cave[by][bx];
1083 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1091 if (!do_dark) break;
1094 c_ptr->info &= ~(CAVE_GLOW);
1096 /* Hack -- Forget "boring" grids */
1097 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1100 c_ptr->info &= ~(CAVE_MARK);
1109 update_local_illumination(y, x);
1112 if (player_can_see_bold(y, x)) obvious = TRUE;
1114 /* Mega-Hack -- Update the monster in the affected grid */
1115 /* This allows "spear of light" (etc) to work "correctly" */
1116 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1126 if (is_mirror_grid(c_ptr))
1128 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1130 remove_mirror(y, x);
1131 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1134 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1137 if (known && (c_ptr->info & CAVE_MARK))
1139 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1143 /* Destroy the wall */
1144 cave_alter_feat(y, x, FF_HURT_ROCK);
1146 /* Update some things */
1147 p_ptr->update |= (PU_FLOW);
1154 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1156 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1158 remove_mirror(y, x);
1159 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1162 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1165 if (known && (c_ptr->info & CAVE_MARK))
1167 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1171 /* Destroy the wall */
1172 cave_alter_feat(y, x, FF_HURT_ROCK);
1174 /* Update some things */
1175 p_ptr->update |= (PU_FLOW);
1180 case GF_DISINTEGRATE:
1182 /* Destroy mirror/glyph */
1183 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1184 remove_mirror(y, x);
1186 /* Permanent features don't get effect */
1187 /* But not protect monsters and other objects */
1188 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1190 cave_alter_feat(y, x, FF_HURT_DISI);
1192 /* Update some things -- similar to GF_KILL_WALL */
1193 p_ptr->update |= (PU_FLOW);
1200 /* Return "Anything seen?" */
1207 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1208 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1209 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1210 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1211 * @param x 目標X座標 / Target x location (or location to travel "towards")
1212 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1213 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1214 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1217 * We are called from "project()" to "damage" objects
1219 * We are called both for "beam" effects and "ball" effects.
1221 * Perhaps we should only SOMETIMES damage things on the ground.
1223 * The "r" parameter is the "distance from ground zero".
1225 * Note that we determine if the player can "see" anything that happens
1226 * by taking into account: blindness, line-of-sight, and illumination.
1228 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1230 * We return "TRUE" if the effect of the projection is "obvious".
1233 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1235 cave_type *c_ptr = &cave[y][x];
1237 OBJECT_IDX this_o_idx, next_o_idx = 0;
1239 bool obvious = FALSE;
1240 bool known = player_has_los_bold(y, x);
1242 BIT_FLAGS flgs[TR_FLAG_SIZE];
1244 char o_name[MAX_NLEN];
1246 KIND_OBJECT_IDX k_idx = 0;
1247 bool is_potion = FALSE;
1251 who = who ? who : 0;
1253 /* Reduce damage by distance */
1254 dam = (dam + r) / (r + 1);
1257 /* Scan all objects in the grid */
1258 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1260 /* Acquire object */
1261 object_type *o_ptr = &o_list[this_o_idx];
1263 bool is_art = FALSE;
1264 bool ignore = FALSE;
1265 bool do_kill = FALSE;
1267 cptr note_kill = NULL;
1270 /* Get the "plural"-ness */
1271 bool plural = (o_ptr->number > 1);
1274 /* Acquire next object */
1275 next_o_idx = o_ptr->next_o_idx;
1277 /* Extract the flags */
1278 object_flags(o_ptr, flgs);
1280 /* Check for artifact */
1281 if (object_is_artifact(o_ptr)) is_art = TRUE;
1283 /* Analyze the type */
1286 /* Acid -- Lots of things */
1289 if (hates_acid(o_ptr))
1292 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1293 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1298 /* Elec -- Rings and Wands */
1301 if (hates_elec(o_ptr))
1304 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1305 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1310 /* Fire -- Flammable objects */
1313 if (hates_fire(o_ptr))
1316 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1317 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1322 /* Cold -- potions and flasks */
1325 if (hates_cold(o_ptr))
1327 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1329 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1337 if (hates_fire(o_ptr))
1340 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1341 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1343 if (hates_elec(o_ptr))
1347 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1348 if (have_flag(flgs, TR_IGNORE_ELEC)) 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_cold(o_ptr))
1366 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1367 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1372 /* Hack -- break potions and such */
1378 if (hates_cold(o_ptr))
1380 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1386 /* Mana and Chaos -- destroy everything */
1392 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1396 case GF_DISINTEGRATE:
1399 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1406 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1407 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1408 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1412 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1416 if (object_is_cursed(o_ptr))
1419 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1426 identify_item(o_ptr);
1428 /* Auto-inscription */
1429 autopick_alter_item((-this_o_idx), FALSE);
1437 /* Chests are noticed only if trapped or locked */
1438 if (o_ptr->tval == TV_CHEST)
1440 /* Disarm/Unlock traps */
1441 if (o_ptr->pval > 0)
1443 /* Disarm or Unlock */
1444 o_ptr->pval = (0 - o_ptr->pval);
1447 object_known(o_ptr);
1450 if (known && (o_ptr->marked & OM_FOUND))
1452 msg_print(_("カチッと音がした!", "Click!"));
1462 if (o_ptr->tval == TV_CORPSE)
1465 BIT_FLAGS mode = 0L;
1467 if (!who || is_pet(&m_list[who]))
1468 mode |= PM_FORCE_PET;
1470 for (i = 0; i < o_ptr->number ; i++)
1472 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1473 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1477 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1481 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1483 note_kill = _("生き返った。", " revived.");
1485 else if (!note_kill)
1487 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1498 /* Attempt to destroy the object */
1501 /* Effect "observed" */
1502 if (known && (o_ptr->marked & OM_FOUND))
1505 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1508 /* Artifacts, and other objects, get to resist */
1509 if (is_art || ignore)
1511 /* Observe the resist */
1512 if (known && (o_ptr->marked & OM_FOUND))
1514 msg_format(_("%sは影響を受けない!",
1515 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1522 /* Describe if needed */
1523 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1525 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1528 k_idx = o_ptr->k_idx;
1529 is_potion = object_is_potion(o_ptr);
1532 /* Delete the object */
1533 delete_object_idx(this_o_idx);
1535 /* Potions produce effects when 'shattered' */
1538 (void)potion_smash_effect(who, y, x, k_idx);
1547 /* Return "Anything seen?" */
1553 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1554 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1555 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1556 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1557 * @param x 目標X座標 / Target x location (or location to travel "towards")
1558 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1559 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1561 * @param see_s_msg TRUEならばメッセージを表示する
1562 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1565 * This routine takes a "source monster" (by index) which is mostly used to
1566 * determine if the player is causing the damage, and a "radius" (see below),
1567 * which is used to decrease the power of explosions with distance, and a
1568 * location, via integers which are modified by certain types of attacks
1569 * (polymorph and teleport being the obvious ones), a default damage, which
1570 * is modified as needed based on various properties, and finally a "damage
1571 * type" (see below).
1574 * Note that this routine can handle "no damage" attacks (like teleport) by
1575 * taking a "zero" damage, and can even take "parameters" to attacks (like
1576 * confuse) by accepting a "damage", using it to calculate the effect, and
1577 * then setting the damage to zero. Note that the "damage" parameter is
1578 * divided by the radius, so monsters not at the "epicenter" will not take
1579 * as much damage (or whatever)...
1582 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1583 * may result in a dereference of an invalid pointer. XXX XXX XXX
1586 * Various messages are produced, and damage is applied.
1589 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1590 * actually be "made" of that substance, or "breathe" big balls of it.
1591 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1593 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1594 * and hurts evil less. If can breath nether, then it resists it as well.
1597 * Damage reductions use the following formulas:
1598 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1599 * gives avg damage of .655, ranging from .858 to .500
1600 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1601 * gives avg damage of .544, ranging from .714 to .417
1602 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1603 * gives avg damage of .444, ranging from .556 to .333
1604 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1605 * gives avg damage of .327, ranging from .427 to .250
1606 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1607 * gives something simple.
1610 * In this function, "result" messages are postponed until the end, where
1611 * the "note" string is appended to the monster name, if not NULL. So,
1612 * to make a spell have "no effect" just set "note" to NULL. You should
1613 * also set "notice" to FALSE, or the player will learn what the spell does.
1616 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1620 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, bool see_s_msg)
1624 cave_type *c_ptr = &cave[y][x];
1626 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1627 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1629 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1633 /* Is the monster "seen"? */
1634 bool seen = m_ptr->ml;
1635 bool seen_msg = is_seen(m_ptr);
1637 bool slept = (bool)MON_CSLEEP(m_ptr);
1639 /* Were the effects "obvious" (if seen)? */
1640 bool obvious = FALSE;
1642 /* Can the player know about this effect? */
1643 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1645 /* Were the effects "irrelevant"? */
1646 bool skipped = FALSE;
1648 /* Gets the monster angry at the source of the effect? */
1649 bool get_angry = FALSE;
1651 /* Polymorph setting (true or false) */
1652 bool do_poly = FALSE;
1654 /* Teleport setting (max distance) */
1657 /* Confusion setting (amount to confuse) */
1660 /* Stunning setting (amount to stun) */
1663 /* Sleep amount (amount to sleep) */
1666 /* Fear amount (amount to fear) */
1669 /* Time amount (amount to time) */
1672 bool heal_leper = FALSE;
1674 /* Hold the monster name */
1678 PARAMETER_VALUE photo = 0;
1680 /* Assume no note */
1683 /* Assume a default death */
1684 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1689 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1692 if (!c_ptr->m_idx) return (FALSE);
1694 /* Never affect projector */
1695 if (who && (c_ptr->m_idx == who)) return (FALSE);
1696 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1697 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1699 /* Don't affect already death monsters */
1700 /* Prevents problems with chain reactions of exploding monsters */
1701 if (m_ptr->hp < 0) return (FALSE);
1703 /* Reduce damage by distance */
1704 dam = (dam + r) / (r + 1);
1707 /* Get the monster name (BEFORE polymorphing) */
1708 monster_desc(m_name, m_ptr, 0);
1710 /* Get the monster possessive ("his"/"her"/"its") */
1711 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1713 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1715 /* Analyze the damage type */
1718 /* Magic Missile -- pure damage */
1721 if (seen) obvious = TRUE;
1723 if (r_ptr->flagsr & RFR_RES_ALL)
1725 note = _("には完全な耐性がある!", " is immune.");
1727 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1736 if (seen) obvious = TRUE;
1738 if (r_ptr->flagsr & RFR_RES_ALL)
1740 note = _("には完全な耐性がある!", " is immune.");
1742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1745 if (r_ptr->flagsr & RFR_IM_ACID)
1747 note = _("にはかなり耐性がある!", " resists a lot.");
1749 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1757 if (seen) obvious = TRUE;
1759 if (r_ptr->flagsr & RFR_RES_ALL)
1761 note = _("には完全な耐性がある!", " is immune.");
1763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1766 if (r_ptr->flagsr & RFR_IM_ELEC)
1768 note = _("にはかなり耐性がある!", " resists a lot.");
1770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1778 if (seen) obvious = TRUE;
1780 if (r_ptr->flagsr & RFR_RES_ALL)
1782 note = _("には完全な耐性がある!", " is immune.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1787 if (r_ptr->flagsr & RFR_IM_FIRE)
1789 note = _("にはかなり耐性がある!", " resists a lot.");
1791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1793 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1795 note = _("はひどい痛手をうけた。", " is hit hard.");
1797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1805 if (seen) obvious = TRUE;
1807 if (r_ptr->flagsr & RFR_RES_ALL)
1809 note = _("には完全な耐性がある!", " is immune.");
1811 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1814 if (r_ptr->flagsr & RFR_IM_COLD)
1816 note = _("にはかなり耐性がある!", " resists a lot.");
1818 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1820 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1822 note = _("はひどい痛手をうけた。", " is hit hard.");
1824 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1832 if (seen) obvious = TRUE;
1834 if (r_ptr->flagsr & RFR_RES_ALL)
1836 note = _("には完全な耐性がある!", " is immune.");
1838 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1841 if (r_ptr->flagsr & RFR_IM_POIS)
1843 note = _("にはかなり耐性がある!", " resists a lot.");
1845 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1853 if (seen) obvious = TRUE;
1855 if (r_ptr->flagsr & RFR_RES_ALL)
1857 note = _("には完全な耐性がある!", " is immune.");
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1862 if (r_ptr->flagsr & RFR_IM_POIS)
1864 note = _("には耐性がある。", " resists.");
1865 dam *= 3; dam /= randint1(6) + 6;
1866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1868 else if (one_in_(3)) do_poly = TRUE;
1872 /* Hellfire -- hurts Evil */
1875 if (seen) obvious = TRUE;
1877 if (r_ptr->flagsr & RFR_RES_ALL)
1879 note = _("には完全な耐性がある!", " is immune.");
1881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1884 if (r_ptr->flags3 & RF3_GOOD)
1886 note = _("はひどい痛手をうけた。", " is hit hard.");
1888 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1893 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1896 if (seen) obvious = TRUE;
1898 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = _("には完全な耐性がある!", " is immune.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1905 if (r_ptr->flags3 & RF3_GOOD)
1907 note = _("には完全な耐性がある!", " is immune.");
1909 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1911 else if (r_ptr->flags3 & RF3_EVIL)
1914 note = _("はひどい痛手をうけた。", " is hit hard.");
1915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1919 note = _("には耐性がある。", " resists.");
1920 dam *= 3; dam /= randint1(6) + 6;
1925 /* Arrow -- XXX no defense */
1928 if (seen) obvious = TRUE;
1930 if (r_ptr->flagsr & RFR_RES_ALL)
1932 note = _("には完全な耐性がある!", " is immune.");
1934 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1940 /* Plasma -- XXX perhaps check ELEC or FIRE */
1943 if (seen) obvious = TRUE;
1945 if (r_ptr->flagsr & RFR_RES_ALL)
1947 note = _("には完全な耐性がある!", " is immune.");
1949 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1952 if (r_ptr->flagsr & RFR_RES_PLAS)
1954 note = _("には耐性がある。", " resists.");
1955 dam *= 3; dam /= randint1(6) + 6;
1956 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1961 /* Nether -- see above */
1964 if (seen) obvious = TRUE;
1966 if (r_ptr->flagsr & RFR_RES_ALL)
1968 note = _("には完全な耐性がある!", " is immune.");
1970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1973 if (r_ptr->flagsr & RFR_RES_NETH)
1975 if (r_ptr->flags3 & RF3_UNDEAD)
1977 note = _("には完全な耐性がある!", " is immune.");
1979 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1983 note = _("には耐性がある。", " resists.");
1984 dam *= 3; dam /= randint1(6) + 6;
1986 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1988 else if (r_ptr->flags3 & RF3_EVIL)
1990 note = _("はいくらか耐性を示した。", " resists somewhat.");
1992 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1997 /* Water (acid) damage -- Water spirits/elementals are immune */
2000 if (seen) obvious = TRUE;
2002 if (r_ptr->flagsr & RFR_RES_ALL)
2004 note = _("には完全な耐性がある!", " is immune.");
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2009 if (r_ptr->flagsr & RFR_RES_WATE)
2011 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2013 note = _("には完全な耐性がある!", " is immune.");
2018 note = _("には耐性がある。", " resists.");
2019 dam *= 3; dam /= randint1(6) + 6;
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2026 /* Chaos -- Chaos breathers resist */
2029 if (seen) obvious = TRUE;
2031 if (r_ptr->flagsr & RFR_RES_ALL)
2033 note = _("には完全な耐性がある!", " is immune.");
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2038 if (r_ptr->flagsr & RFR_RES_CHAO)
2040 note = _("には耐性がある。", " resists.");
2041 dam *= 3; dam /= randint1(6) + 6;
2042 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2044 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2046 note = _("はいくらか耐性を示した。", " resists somewhat.");
2047 dam *= 3; dam /= randint1(6) + 6;
2048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2053 do_conf = (5 + randint1(11) + r) / (r + 1);
2058 /* Shards -- Shard breathers resist */
2061 if (seen) obvious = TRUE;
2063 if (r_ptr->flagsr & RFR_RES_ALL)
2065 note = _("には完全な耐性がある!", " is immune.");
2067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2070 if (r_ptr->flagsr & RFR_RES_SHAR)
2072 note = _("には耐性がある。", " resists.");
2073 dam *= 3; dam /= randint1(6) + 6;
2074 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2079 /* Rocket: Shard resistance helps */
2082 if (seen) obvious = TRUE;
2084 if (r_ptr->flagsr & RFR_RES_ALL)
2086 note = _("には完全な耐性がある!", " is immune.");
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2091 if (r_ptr->flagsr & RFR_RES_SHAR)
2093 note = _("はいくらか耐性を示した。", " resists somewhat.");
2095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2101 /* Sound -- Sound breathers resist */
2104 if (seen) obvious = TRUE;
2106 if (r_ptr->flagsr & RFR_RES_ALL)
2108 note = _("には完全な耐性がある!", " is immune.");
2110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2113 if (r_ptr->flagsr & RFR_RES_SOUN)
2115 note = _("には耐性がある。", " resists.");
2116 dam *= 2; dam /= randint1(6) + 6;
2117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2119 else do_stun = (10 + randint1(15) + r) / (r + 1);
2126 if (seen) obvious = TRUE;
2128 if (r_ptr->flagsr & RFR_RES_ALL)
2130 note = _("には完全な耐性がある!", " is immune.");
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2135 if (r_ptr->flags3 & RF3_NO_CONF)
2137 note = _("には耐性がある。", " resists.");
2138 dam *= 3; dam /= randint1(6) + 6;
2139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2141 else do_conf = (10 + randint1(15) + r) / (r + 1);
2145 /* Disenchantment -- Breathers and Disenchanters resist */
2148 if (seen) obvious = TRUE;
2150 if (r_ptr->flagsr & RFR_RES_ALL)
2152 note = _("には完全な耐性がある!", " is immune.");
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2157 if (r_ptr->flagsr & RFR_RES_DISE)
2159 note = _("には耐性がある。", " resists.");
2160 dam *= 3; dam /= randint1(6) + 6;
2161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2166 /* Nexus -- Breathers and Existers resist */
2169 if (seen) obvious = TRUE;
2171 if (r_ptr->flagsr & RFR_RES_ALL)
2173 note = _("には完全な耐性がある!", " is immune.");
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2178 if (r_ptr->flagsr & RFR_RES_NEXU)
2180 note = _("には耐性がある。", " resists.");
2181 dam *= 3; dam /= randint1(6) + 6;
2182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2190 if (seen) obvious = TRUE;
2192 if (r_ptr->flagsr & RFR_RES_ALL)
2194 note = _("には完全な耐性がある!", " is immune.");
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2199 if (r_ptr->flagsr & RFR_RES_WALL)
2201 note = _("には耐性がある。", " resists.");
2202 dam *= 3; dam /= randint1(6) + 6;
2203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2205 else do_stun = (randint1(15) + r) / (r + 1);
2209 /* Inertia -- breathers resist */
2212 if (seen) obvious = TRUE;
2214 if (r_ptr->flagsr & RFR_RES_ALL)
2216 note = _("には完全な耐性がある!", " is immune.");
2218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2221 if (r_ptr->flagsr & RFR_RES_INER)
2223 note = _("には耐性がある。", " resists.");
2224 dam *= 3; dam /= randint1(6) + 6;
2225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2229 /* Powerful monsters can resist */
2230 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2231 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2235 /* Normal monsters slow down */
2238 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2240 note = _("の動きが遅くなった。", " starts moving slower.");
2247 /* Time -- breathers resist */
2250 if (seen) obvious = TRUE;
2252 if (r_ptr->flagsr & RFR_RES_ALL)
2254 note = _("には完全な耐性がある!", " is immune.");
2256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2259 if (r_ptr->flagsr & RFR_RES_TIME)
2261 note = _("には耐性がある。", " resists.");
2262 dam *= 3; dam /= randint1(6) + 6;
2263 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2265 else do_time = (dam + 1) / 2;
2269 /* Gravity -- breathers resist */
2272 bool resist_tele = FALSE;
2274 if (seen) obvious = TRUE;
2276 if (r_ptr->flagsr & RFR_RES_ALL)
2278 note = _("には完全な耐性がある!", " is immune.");
2280 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2283 if (r_ptr->flagsr & RFR_RES_TELE)
2285 if (r_ptr->flags1 & (RF1_UNIQUE))
2287 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2288 note = _("には効果がなかった。", " is unaffected!");
2291 else if (r_ptr->level > randint1(100))
2293 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2294 note = _("には耐性がある!", " resists!");
2299 if (!resist_tele) do_dist = 10;
2301 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2303 if (r_ptr->flagsr & RFR_RES_GRAV)
2305 note = _("には耐性がある!", " resists!");
2306 dam *= 3; dam /= randint1(6) + 6;
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2313 /* Powerful monsters can resist */
2314 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2315 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2319 /* Normal monsters slow down */
2322 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2324 note = _("の動きが遅くなった。", " starts moving slower.");
2329 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2331 /* Attempt a saving throw */
2332 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2333 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2337 /* No obvious effect */
2338 note = _("には効果がなかった。", " is unaffected!");
2350 if (seen) obvious = TRUE;
2352 if (r_ptr->flagsr & RFR_RES_ALL)
2354 note = _("には完全な耐性がある!", " is immune.");
2356 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2364 case GF_DISINTEGRATE:
2366 if (seen) obvious = TRUE;
2368 if (r_ptr->flagsr & RFR_RES_ALL)
2370 note = _("には完全な耐性がある!", " is immune.");
2372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2375 if (r_ptr->flags3 & RF3_HURT_ROCK)
2377 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2378 note = _("の皮膚がただれた!", " loses some skin!");
2379 note_dies = _("は蒸発した!", " evaporates!");
2387 if (seen) obvious = TRUE;
2389 /* PSI only works if the monster can see you! -- RG */
2390 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2393 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2398 if (r_ptr->flagsr & RFR_RES_ALL)
2400 note = _("には完全な耐性がある!", " is immune.");
2402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2405 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2408 note = _("には完全な耐性がある!", " is immune.");
2409 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2412 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2413 (r_ptr->flags3 & RF3_ANIMAL) ||
2414 (r_ptr->level > randint1(3 * dam)))
2416 note = _("には耐性がある!", " resists!");
2420 * Powerful demons & undead can turn a mindcrafter's
2421 * attacks back on them
2423 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2424 (r_ptr->level > p_ptr->lev / 2) &&
2428 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2429 (seen ? "%^s's corrupted mind backlashes your attack!" :
2430 "%^ss corrupted mind backlashes your attack!")), m_name);
2433 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2435 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2439 /* Injure +/- confusion */
2440 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2441 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2442 if (one_in_(4) && !CHECK_MULTISHADOW())
2444 switch (randint1(4))
2447 set_confused(p_ptr->confused + 3 + randint1(dam));
2450 set_stun(p_ptr->stun + randint1(dam));
2454 if (r_ptr->flags3 & RF3_NO_FEAR)
2455 note = _("には効果がなかった。", " is unaffected.");
2457 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2461 if (!p_ptr->free_act)
2462 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2471 if ((dam > 0) && one_in_(4))
2473 switch (randint1(4))
2476 do_conf = 3 + randint1(dam);
2479 do_stun = 3 + randint1(dam);
2482 do_fear = 3 + randint1(dam);
2485 note = _("は眠り込んでしまった!", " falls asleep!");
2486 do_sleep = 3 + randint1(dam);
2491 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2497 if (seen) obvious = TRUE;
2499 if (r_ptr->flagsr & RFR_RES_ALL)
2501 note = _("には完全な耐性がある!", " is immune.");
2503 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2506 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2509 note = _("には完全な耐性がある!", " is immune.");
2511 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2512 (r_ptr->flags3 & RF3_ANIMAL) ||
2513 (r_ptr->level > randint1(3 * dam)))
2515 note = _("には耐性がある!", " resists!");
2519 * Powerful demons & undead can turn a mindcrafter's
2520 * attacks back on them
2522 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2523 (r_ptr->level > p_ptr->lev / 2) &&
2527 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2528 (seen ? "%^s's corrupted mind backlashes your attack!" :
2529 "%^ss corrupted mind backlashes your attack!")), m_name);
2531 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2533 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2537 /* Injure + mana drain */
2538 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2539 if (!CHECK_MULTISHADOW())
2541 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2542 p_ptr->csp -= damroll(5, dam) / 2;
2543 if (p_ptr->csp < 0) p_ptr->csp = 0;
2544 p_ptr->redraw |= PR_MANA;
2545 p_ptr->window |= (PW_SPELL);
2547 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2554 int b = damroll(5, dam) / 4;
2555 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2556 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2557 (seen ? "You convert %s's pain into %s!" :
2558 "You convert %ss pain into %s!"));
2559 msg_format(msg, m_name, str);
2561 b = MIN(p_ptr->msp, p_ptr->csp + b);
2563 p_ptr->redraw |= PR_MANA;
2564 p_ptr->window |= (PW_SPELL);
2566 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2570 case GF_TELEKINESIS:
2572 if (seen) obvious = TRUE;
2574 if (r_ptr->flagsr & RFR_RES_ALL)
2576 note = _("には完全な耐性がある!", " is immune.");
2578 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2583 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2588 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2590 /* Attempt a saving throw */
2591 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2592 (r_ptr->level > 5 + randint1(dam)))
2596 /* No obvious effect */
2602 /* Psycho-spear -- powerful magic missile */
2605 if (seen) obvious = TRUE;
2607 if (r_ptr->flagsr & RFR_RES_ALL)
2609 note = _("には完全な耐性がある!", " is immune.");
2611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2617 /* Meteor -- powerful magic missile */
2620 if (seen) obvious = TRUE;
2622 if (r_ptr->flagsr & RFR_RES_ALL)
2624 note = _("には完全な耐性がある!", " is immune.");
2626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2634 if (!is_hostile(m_ptr)) break;
2636 if (seen) obvious = TRUE;
2638 if (r_ptr->flagsr & RFR_RES_ALL)
2640 note = _("には効果がなかった!", " is immune.");
2642 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2645 /* Attempt a saving throw */
2646 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2647 (r_ptr->flags3 & RF3_NO_CONF) ||
2648 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2650 /* Memorize a flag */
2651 if (r_ptr->flags3 & RF3_NO_CONF)
2653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2660 * Powerful demons & undead can turn a mindcrafter's
2661 * attacks back on them
2663 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2664 (r_ptr->level > p_ptr->lev / 2) &&
2668 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2669 (seen ? "%^s's corrupted mind backlashes your attack!" :
2670 "%^ss corrupted mind backlashes your attack!")), m_name);
2673 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2675 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2679 /* Confuse, stun, terrify */
2680 switch (randint1(4))
2683 set_stun(p_ptr->stun + dam / 2);
2686 set_confused(p_ptr->confused + dam / 2);
2690 if (r_ptr->flags3 & RF3_NO_FEAR)
2691 note = _("には効果がなかった。", " is unaffected.");
2693 set_afraid(p_ptr->afraid + dam);
2700 /* No obvious effect */
2701 note = _("には効果がなかった。", " is unaffected.");
2707 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2709 note = _("があなたに隷属した。", " is in your thrall!");
2714 switch (randint1(4))
2728 /* No "real" damage */
2735 /* Ice -- Cold + Cuts + Stun */
2738 if (seen) obvious = TRUE;
2740 if (r_ptr->flagsr & RFR_RES_ALL)
2742 note = _("には完全な耐性がある!", " is immune.");
2744 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2747 do_stun = (randint1(15) + 1) / (r + 1);
2748 if (r_ptr->flagsr & RFR_IM_COLD)
2750 note = _("にはかなり耐性がある!", " resists a lot.");
2752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2754 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2756 note = _("はひどい痛手をうけた。", " is hit hard.");
2758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2765 case GF_HYPODYNAMIA:
2767 if (seen) obvious = TRUE;
2769 if (r_ptr->flagsr & RFR_RES_ALL)
2771 note = _("には完全な耐性がある!", " is immune.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2776 if (!monster_living(r_ptr))
2778 if (is_original_ap_and_seen(m_ptr))
2780 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2781 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2782 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2784 note = _("には効果がなかった。", " is unaffected.");
2788 else do_time = (dam+7)/8;
2796 if (seen) obvious = TRUE;
2798 if (r_ptr->flagsr & RFR_RES_ALL)
2800 note = _("には完全な耐性がある!", " is immune.");
2802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2805 if (!monster_living(r_ptr))
2807 if (is_original_ap_and_seen(m_ptr))
2809 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2810 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2811 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2813 note = _("には完全な耐性がある!", " is immune.");
2817 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2818 (randint1(888) != 666)) ||
2819 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2820 randint1(100) != 66))
2822 note = _("には耐性がある!", " resists!");
2830 /* Polymorph monster (Use "dam" as "power") */
2833 if (seen) obvious = TRUE;
2835 if (r_ptr->flagsr & RFR_RES_ALL)
2837 note = _("には効果がなかった。", " is unaffected.");
2839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2842 /* Attempt to polymorph (see below) */
2845 /* Powerful monsters can resist */
2846 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2847 (r_ptr->flags1 & RF1_QUESTOR) ||
2848 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2850 note = _("には効果がなかった。", " is unaffected.");
2855 /* No "real" damage */
2862 /* Clone monsters (Ignore "dam") */
2865 if (seen) obvious = TRUE;
2867 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2869 note = _("には効果がなかった。", " is unaffected.");
2874 m_ptr->hp = m_ptr->maxhp;
2876 /* Attempt to clone. */
2877 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2879 note = _("が分裂した!", " spawns!");
2883 /* No "real" damage */
2890 /* Heal Monster (use "dam" as amount of healing) */
2893 if (seen) obvious = TRUE;
2896 (void)set_monster_csleep(c_ptr->m_idx, 0);
2898 if (m_ptr->maxhp < m_ptr->max_maxhp)
2900 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2901 m_ptr->maxhp = m_ptr->max_maxhp;
2906 /* Redraw (later) if needed */
2907 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2908 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2916 if (seen) obvious = TRUE;
2919 (void)set_monster_csleep(c_ptr->m_idx, 0);
2920 if (MON_STUNNED(m_ptr))
2922 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2923 (void)set_monster_stunned(c_ptr->m_idx, 0);
2925 if (MON_CONFUSED(m_ptr))
2927 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2928 (void)set_monster_confused(c_ptr->m_idx, 0);
2930 if (MON_MONFEAR(m_ptr))
2932 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2933 (void)set_monster_monfear(c_ptr->m_idx, 0);
2937 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2940 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2944 chg_virtue(V_VITALITY, 1);
2946 if (r_ptr->flags1 & RF1_UNIQUE)
2947 chg_virtue(V_INDIVIDUALISM, 1);
2949 if (is_friendly(m_ptr))
2950 chg_virtue(V_HONOUR, 1);
2951 else if (!(r_ptr->flags3 & RF3_EVIL))
2953 if (r_ptr->flags3 & RF3_GOOD)
2954 chg_virtue(V_COMPASSION, 2);
2956 chg_virtue(V_COMPASSION, 1);
2959 if (r_ptr->flags3 & RF3_ANIMAL)
2960 chg_virtue(V_NATURE, 1);
2963 if (m_ptr->r_idx == MON_LEPER)
2966 if (!who) chg_virtue(V_COMPASSION, 5);
2969 /* Redraw (later) if needed */
2970 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2971 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2974 note = _("は体力を回復したようだ。", " looks healthier.");
2976 /* No "real" damage */
2982 /* Speed Monster (Ignore "dam") */
2985 if (seen) obvious = TRUE;
2988 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2990 note = _("の動きが速くなった。", " starts moving faster.");
2995 if (r_ptr->flags1 & RF1_UNIQUE)
2996 chg_virtue(V_INDIVIDUALISM, 1);
2997 if (is_friendly(m_ptr))
2998 chg_virtue(V_HONOUR, 1);
3001 /* No "real" damage */
3007 /* Slow Monster (Use "dam" as "power") */
3010 if (seen) obvious = TRUE;
3012 if (r_ptr->flagsr & RFR_RES_ALL)
3014 note = _("には効果がなかった。", " is unaffected.");
3016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3019 /* Powerful monsters can resist */
3020 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3021 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3023 note = _("には効果がなかった。", " is unaffected.");
3027 /* Normal monsters slow down */
3030 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3032 note = _("の動きが遅くなった。", " starts moving slower.");
3036 /* No "real" damage */
3042 /* Sleep (Use "dam" as "power") */
3045 if (seen) obvious = TRUE;
3047 if (r_ptr->flagsr & RFR_RES_ALL)
3049 note = _("には効果がなかった。", " is unaffected.");
3051 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3054 /* Attempt a saving throw */
3055 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3056 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3057 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3059 /* Memorize a flag */
3060 if (r_ptr->flags3 & RF3_NO_SLEEP)
3062 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3064 /* No obvious effect */
3065 note = _("には効果がなかった。", " is unaffected.");
3070 /* Go to sleep (much) later */
3071 note = _("は眠り込んでしまった!", " falls asleep!");
3075 /* No "real" damage */
3081 /* Sleep (Use "dam" as "power") */
3082 case GF_STASIS_EVIL:
3084 if (seen) obvious = TRUE;
3086 if (r_ptr->flagsr & RFR_RES_ALL)
3088 note = _("には効果がなかった!", " is immune.");
3090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3093 /* Attempt a saving throw */
3094 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3095 !(r_ptr->flags3 & RF3_EVIL) ||
3096 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3098 note = _("には効果がなかった。", " is unaffected.");
3103 /* Go to sleep (much) later */
3104 note = _("は動けなくなった!", " is suspended!");
3108 /* No "real" damage */
3113 /* Sleep (Use "dam" as "power") */
3116 if (seen) obvious = TRUE;
3118 if (r_ptr->flagsr & RFR_RES_ALL)
3120 note = _("には効果がなかった。", " is unaffected.");
3122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3125 /* Attempt a saving throw */
3126 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3127 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3129 note = _("には効果がなかった。", " is unaffected.");
3134 /* Go to sleep (much) later */
3135 note = _("は動けなくなった!", " is suspended!");
3139 /* No "real" damage */
3148 vir = virtue_number(V_HARMONY);
3151 dam += p_ptr->virtues[vir-1]/10;
3154 vir = virtue_number(V_INDIVIDUALISM);
3157 dam -= p_ptr->virtues[vir-1]/20;
3160 if (seen) obvious = TRUE;
3162 /* Attempt a saving throw */
3163 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3167 /* No obvious effect */
3168 note = _("には効果がなかった。", " is unaffected.");
3171 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3173 else if (p_ptr->cursed & TRC_AGGRAVATE)
3175 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3176 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3180 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3183 chg_virtue(V_INDIVIDUALISM, -1);
3184 if (r_ptr->flags3 & RF3_ANIMAL)
3185 chg_virtue(V_NATURE, 1);
3188 /* No "real" damage */
3193 /* Control undead */
3194 case GF_CONTROL_UNDEAD:
3197 if (seen) obvious = TRUE;
3199 vir = virtue_number(V_UNLIFE);
3202 dam += p_ptr->virtues[vir-1]/10;
3205 vir = virtue_number(V_INDIVIDUALISM);
3208 dam -= p_ptr->virtues[vir-1]/20;
3211 /* Attempt a saving throw */
3212 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3213 !(r_ptr->flags3 & RF3_UNDEAD))
3215 /* No obvious effect */
3216 note = _("には効果がなかった。", " is unaffected.");
3218 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3220 else if (p_ptr->cursed & TRC_AGGRAVATE)
3222 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3223 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3227 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3231 /* No "real" damage */
3237 case GF_CONTROL_DEMON:
3240 if (seen) obvious = TRUE;
3242 vir = virtue_number(V_UNLIFE);
3245 dam += p_ptr->virtues[vir-1]/10;
3248 vir = virtue_number(V_INDIVIDUALISM);
3251 dam -= p_ptr->virtues[vir-1]/20;
3254 /* Attempt a saving throw */
3255 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3256 !(r_ptr->flags3 & RF3_DEMON))
3258 /* No obvious effect */
3259 note = _("には効果がなかった。", " is unaffected.");
3261 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3263 else if (p_ptr->cursed & TRC_AGGRAVATE)
3265 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3266 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3270 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3274 /* No "real" damage */
3280 case GF_CONTROL_ANIMAL:
3283 if (seen) obvious = TRUE;
3285 vir = virtue_number(V_NATURE);
3288 dam += p_ptr->virtues[vir-1]/10;
3291 vir = virtue_number(V_INDIVIDUALISM);
3294 dam -= p_ptr->virtues[vir-1]/20;
3297 /* Attempt a saving throw */
3298 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3299 !(r_ptr->flags3 & RF3_ANIMAL))
3302 /* No obvious effect */
3303 note = _("には効果がなかった。", " is unaffected.");
3305 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3307 else if (p_ptr->cursed & TRC_AGGRAVATE)
3309 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3310 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3314 note = _("はなついた。", " is tamed!");
3316 if (r_ptr->flags3 & RF3_ANIMAL)
3317 chg_virtue(V_NATURE, 1);
3320 /* No "real" damage */
3326 case GF_CONTROL_LIVING:
3330 vir = virtue_number(V_UNLIFE);
3331 if (seen) obvious = TRUE;
3333 vir = virtue_number(V_UNLIFE);
3336 dam -= p_ptr->virtues[vir-1]/10;
3339 vir = virtue_number(V_INDIVIDUALISM);
3342 dam -= p_ptr->virtues[vir-1]/20;
3345 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3347 /* Attempt a saving throw */
3348 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3349 !monster_living(r_ptr))
3352 /* No obvious effect */
3353 note = _("には効果がなかった。", " is unaffected.");
3355 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3357 else if (p_ptr->cursed & TRC_AGGRAVATE)
3359 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3360 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3364 note = _("を支配した。", " is tamed!");
3366 if (r_ptr->flags3 & RF3_ANIMAL)
3367 chg_virtue(V_NATURE, 1);
3370 /* No "real" damage */
3375 /* Confusion (Use "dam" as "power") */
3378 if (seen) obvious = TRUE;
3380 if (r_ptr->flagsr & RFR_RES_ALL)
3382 note = _("には効果がなかった。", " is unaffected.");
3384 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3387 /* Get confused later */
3388 do_conf = damroll(3, (dam / 2)) + 1;
3390 /* Attempt a saving throw */
3391 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3392 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3393 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3395 /* Memorize a flag */
3396 if (r_ptr->flags3 & (RF3_NO_CONF))
3398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3404 /* No obvious effect */
3405 note = _("には効果がなかった。", " is unaffected.");
3409 /* No "real" damage */
3416 if (seen) obvious = TRUE;
3418 if (r_ptr->flagsr & RFR_RES_ALL)
3420 note = _("には効果がなかった。", " is unaffected.");
3422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3425 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3427 /* Attempt a saving throw */
3428 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3429 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3434 /* No obvious effect */
3435 note = _("には効果がなかった。", " is unaffected.");
3439 /* No "real" damage */
3447 /* Lite, but only hurts susceptible creatures */
3455 if (r_ptr->flagsr & RFR_RES_ALL)
3461 if (r_ptr->flags3 & (RF3_HURT_LITE))
3463 /* Obvious effect */
3464 if (seen) obvious = TRUE;
3466 /* Memorize the effects */
3467 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3469 /* Special effect */
3470 note = _("は光に身をすくめた!", " cringes from the light!");
3471 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3474 /* Normally no damage */
3486 /* Lite -- opposite of Dark */
3489 if (seen) obvious = TRUE;
3491 if (r_ptr->flagsr & RFR_RES_ALL)
3493 note = _("には完全な耐性がある!", " is immune.");
3495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3498 if (r_ptr->flagsr & RFR_RES_LITE)
3500 note = _("には耐性がある!", " resists!");
3501 dam *= 2; dam /= (randint1(6)+6);
3502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3504 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3507 note = _("は光に身をすくめた!", " cringes from the light!");
3508 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3515 /* Dark -- opposite of Lite */
3518 if (seen) obvious = TRUE;
3520 if (r_ptr->flagsr & RFR_RES_ALL)
3522 note = _("には完全な耐性がある!", " is immune.");
3524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3527 if (r_ptr->flagsr & RFR_RES_DARK)
3529 note = _("には耐性がある!", " resists!");
3530 dam *= 2; dam /= (randint1(6)+6);
3531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3540 if (r_ptr->flagsr & RFR_RES_ALL)
3545 /* Hurt by rock remover */
3546 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3549 if (seen) obvious = TRUE;
3551 /* Memorize the effects */
3552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3554 /* Cute little message */
3555 note = _("の皮膚がただれた!", " loses some skin!");
3556 note_dies = _("はドロドロに溶けた!", " dissolves!");
3559 /* Usually, ignore the effects */
3570 /* Teleport undead (Use "dam" as "power") */
3571 case GF_AWAY_UNDEAD:
3573 /* Only affect undead */
3574 if (r_ptr->flags3 & (RF3_UNDEAD))
3576 bool resists_tele = FALSE;
3578 if (r_ptr->flagsr & RFR_RES_TELE)
3580 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3582 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3583 note = _("には効果がなかった。", " is unaffected.");
3584 resists_tele = TRUE;
3586 else if (r_ptr->level > randint1(100))
3588 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3589 note = _("には耐性がある!", " resists!");
3590 resists_tele = TRUE;
3596 if (seen) obvious = TRUE;
3597 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3609 /* No "real" damage */
3615 /* Teleport evil (Use "dam" as "power") */
3618 /* Only affect evil */
3619 if (r_ptr->flags3 & (RF3_EVIL))
3621 bool resists_tele = FALSE;
3623 if (r_ptr->flagsr & RFR_RES_TELE)
3625 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3628 note = _("には効果がなかった。", " is unaffected.");
3629 resists_tele = TRUE;
3631 else if (r_ptr->level > randint1(100))
3633 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3634 note = _("には耐性がある!", " resists!");
3635 resists_tele = TRUE;
3641 if (seen) obvious = TRUE;
3642 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3654 /* No "real" damage */
3660 /* Teleport monster (Use "dam" as "power") */
3663 bool resists_tele = FALSE;
3664 if (r_ptr->flagsr & RFR_RES_TELE)
3666 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3669 note = _("には効果がなかった。", " is unaffected.");
3670 resists_tele = TRUE;
3672 else if (r_ptr->level > randint1(100))
3674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3675 note = _("には耐性がある!", " resists!");
3676 resists_tele = TRUE;
3683 if (seen) obvious = TRUE;
3685 /* Prepare to teleport */
3689 /* No "real" damage */
3695 /* Turn undead (Use "dam" as "power") */
3696 case GF_TURN_UNDEAD:
3698 if (r_ptr->flagsr & RFR_RES_ALL)
3703 /* Only affect undead */
3704 if (r_ptr->flags3 & (RF3_UNDEAD))
3707 if (seen) obvious = TRUE;
3709 /* Learn about type */
3710 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3712 /* Apply some fear */
3713 do_fear = damroll(3, (dam / 2)) + 1;
3715 /* Attempt a saving throw */
3716 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3718 /* No obvious effect */
3719 note = _("には効果がなかった。", " is unaffected.");
3732 /* No "real" damage */
3738 /* Turn evil (Use "dam" as "power") */
3741 if (r_ptr->flagsr & RFR_RES_ALL)
3746 /* Only affect evil */
3747 if (r_ptr->flags3 & (RF3_EVIL))
3750 if (seen) obvious = TRUE;
3752 /* Learn about type */
3753 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3755 /* Apply some fear */
3756 do_fear = damroll(3, (dam / 2)) + 1;
3758 /* Attempt a saving throw */
3759 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3761 /* No obvious effect */
3762 note = _("には効果がなかった。", " is unaffected.");
3775 /* No "real" damage */
3781 /* Turn monster (Use "dam" as "power") */
3784 if (r_ptr->flagsr & RFR_RES_ALL)
3790 if (seen) obvious = TRUE;
3792 /* Apply some fear */
3793 do_fear = damroll(3, (dam / 2)) + 1;
3795 /* Attempt a saving throw */
3796 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3797 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3798 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3800 /* No obvious effect */
3801 note = _("には効果がなかった。", " is unaffected.");
3806 /* No "real" damage */
3813 case GF_DISP_UNDEAD:
3815 if (r_ptr->flagsr & RFR_RES_ALL)
3821 /* Only affect undead */
3822 if (r_ptr->flags3 & (RF3_UNDEAD))
3825 if (seen) obvious = TRUE;
3827 /* Learn about type */
3828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3831 note = _("は身震いした。", " shudders.");
3832 note_dies = _("はドロドロに溶けた!", " dissolves!");
3852 if (r_ptr->flagsr & RFR_RES_ALL)
3858 /* Only affect evil */
3859 if (r_ptr->flags3 & (RF3_EVIL))
3862 if (seen) obvious = TRUE;
3864 /* Learn about type */
3865 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3868 note = _("は身震いした。", " shudders.");
3869 note_dies = _("はドロドロに溶けた!", " dissolves!");
3888 if (r_ptr->flagsr & RFR_RES_ALL)
3894 /* Only affect good */
3895 if (r_ptr->flags3 & (RF3_GOOD))
3898 if (seen) obvious = TRUE;
3900 /* Learn about type */
3901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3904 note = _("は身震いした。", " shudders.");
3905 note_dies = _("はドロドロに溶けた!", " dissolves!");
3922 case GF_DISP_LIVING:
3924 if (r_ptr->flagsr & RFR_RES_ALL)
3930 /* Only affect non-undead */
3931 if (monster_living(r_ptr))
3934 if (seen) obvious = TRUE;
3937 note = _("は身震いした。", " shudders.");
3938 note_dies = _("はドロドロに溶けた!", " dissolves!");
3957 if (r_ptr->flagsr & RFR_RES_ALL)
3963 /* Only affect demons */
3964 if (r_ptr->flags3 & (RF3_DEMON))
3967 if (seen) obvious = TRUE;
3969 /* Learn about type */
3970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3973 note = _("は身震いした。", " shudders.");
3974 note_dies = _("はドロドロに溶けた!", " dissolves!");
3990 /* Dispel monster */
3993 if (r_ptr->flagsr & RFR_RES_ALL)
4000 if (seen) obvious = TRUE;
4003 note = _("は身震いした。", " shudders.");
4004 note_dies = _("はドロドロに溶けた!", " dissolves!");
4011 if (seen) obvious = TRUE;
4013 if (r_ptr->flagsr & RFR_RES_ALL)
4015 note = _("には完全な耐性がある!", " is immune.");
4017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4021 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4025 /* Heal the monster */
4026 if (caster_ptr->hp < caster_ptr->maxhp)
4029 caster_ptr->hp += dam;
4030 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4032 /* Redraw (later) if needed */
4033 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4034 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4036 /* Special message */
4039 /* Get the monster name */
4040 monster_desc(killer, caster_ptr, 0);
4041 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4048 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4049 (void)hp_player(dam);
4054 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4063 if (seen) obvious = TRUE;
4065 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4067 if (r_ptr->flagsr & RFR_RES_ALL)
4069 note = _("には完全な耐性がある!", " is immune.");
4071 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4075 /* Attempt a saving throw */
4076 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4077 (r_ptr->flags3 & RF3_NO_CONF) ||
4078 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4080 /* Memorize a flag */
4081 if (r_ptr->flags3 & (RF3_NO_CONF))
4083 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4085 note = _("には効果がなかった。", " is unaffected.");
4088 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4091 note = _("には完全な耐性がある!", " is immune.");
4094 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4096 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4097 note = _("には耐性がある。", " resists.");
4102 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4103 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4105 if (who > 0) do_conf = randint0(4) + 4;
4106 else do_conf = randint0(8) + 8;
4112 case GF_BRAIN_SMASH:
4114 if (seen) obvious = TRUE;
4116 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4118 if (r_ptr->flagsr & RFR_RES_ALL)
4120 note = _("には完全な耐性がある!", " is immune.");
4122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4126 /* Attempt a saving throw */
4127 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4128 (r_ptr->flags3 & RF3_NO_CONF) ||
4129 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4131 /* Memorize a flag */
4132 if (r_ptr->flags3 & (RF3_NO_CONF))
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4136 note = _("には効果がなかった。", " is unaffected.");
4139 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4142 note = _("には完全な耐性がある!", " is immune.");
4145 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4148 note = _("には耐性がある!", " resists!");
4153 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4154 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4158 do_conf = randint0(4) + 4;
4159 do_stun = randint0(4) + 4;
4163 do_conf = randint0(8) + 8;
4164 do_stun = randint0(8) + 8;
4166 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4174 if (seen) obvious = TRUE;
4176 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4178 if (r_ptr->flagsr & RFR_RES_ALL)
4180 note = _("には完全な耐性がある!", " is immune.");
4182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4186 /* Attempt a saving throw */
4187 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4189 note = _("には効果がなかった。", " is unaffected.");
4198 if (seen) obvious = TRUE;
4200 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4202 if (r_ptr->flagsr & RFR_RES_ALL)
4204 note = _("には完全な耐性がある!", " is immune.");
4206 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4210 /* Attempt a saving throw */
4211 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4213 note = _("には効果がなかった。", " is unaffected.");
4222 if (seen) obvious = TRUE;
4224 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4226 if (r_ptr->flagsr & RFR_RES_ALL)
4228 note = _("には完全な耐性がある!", " is immune.");
4230 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4234 /* Attempt a saving throw */
4235 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4237 note = _("には効果がなかった。", " is unaffected.");
4246 if (seen) obvious = TRUE;
4249 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4250 "You point at %s, screaming the word, 'DIE!'."), m_name);
4252 if (r_ptr->flagsr & RFR_RES_ALL)
4254 note = _("には完全な耐性がある!", " is immune.");
4256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4260 /* Attempt a saving throw */
4261 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4263 note = _("には効果がなかった。", " is unaffected.");
4272 if (seen) obvious = TRUE;
4274 if (r_ptr->flagsr & RFR_RES_ALL)
4276 note = _("には完全な耐性がある!", " is immune.");
4278 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4282 if (r_ptr->flags1 & RF1_UNIQUE)
4284 note = _("には効果がなかった。", " is unaffected.");
4289 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4290 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4292 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4294 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4298 note = _("は耐性を持っている!", "resists!");
4305 /* Capture monster */
4309 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4310 (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)
4312 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4317 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4318 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4319 nokori_hp = m_ptr->maxhp * 3 / 10;
4321 nokori_hp = m_ptr->maxhp * 3 / 20;
4323 if (m_ptr->hp >= nokori_hp)
4325 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4328 else if (m_ptr->hp < randint0(nokori_hp))
4330 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4331 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4332 cap_mon = m_ptr->r_idx;
4333 cap_mspeed = m_ptr->mspeed;
4335 cap_maxhp = m_ptr->max_maxhp;
4336 cap_nickname = m_ptr->nickname; /* Quark transfer */
4337 if (c_ptr->m_idx == p_ptr->riding)
4339 if (rakuba(-1, FALSE))
4341 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4345 delete_monster_idx(c_ptr->m_idx);
4351 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4357 /* Attack (Use "dam" as attack type) */
4360 /* Return this monster's death */
4361 return py_attack(y, x, dam);
4364 /* Sleep (Use "dam" as "power") */
4370 if (seen) obvious = TRUE;
4372 if (r_ptr->flagsr & RFR_RES_ALL)
4374 note = _("には効果がなかった。", " is unaffected.");
4376 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4379 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4381 note = _("には効果がなかった。", " is unaffected.");
4384 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4387 if (MON_CSLEEP(m_ptr))
4389 note = _("には効果がなかった。", " is unaffected.");
4395 if (one_in_(5)) effect = 1;
4396 else if (one_in_(4)) effect = 2;
4397 else if (one_in_(3)) effect = 3;
4402 /* Powerful monsters can resist */
4403 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4404 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4406 note = _("には効果がなかった。", " is unaffected.");
4410 /* Normal monsters slow down */
4413 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4415 note = _("の動きが遅くなった。", " starts moving slower.");
4420 else if (effect == 2)
4422 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4424 /* Attempt a saving throw */
4425 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4426 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4431 /* No obvious effect */
4432 note = _("には効果がなかった。", " is unaffected.");
4437 else if (effect == 3)
4439 /* Attempt a saving throw */
4440 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4441 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4442 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4444 /* Memorize a flag */
4445 if (r_ptr->flags3 & RF3_NO_SLEEP)
4447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4450 /* No obvious effect */
4451 note = _("には効果がなかった。", " is unaffected.");
4456 /* Go to sleep (much) later */
4457 note = _("は眠り込んでしまった!", " falls asleep!");
4464 note = _("には効果がなかった。", " is unaffected.");
4467 /* No "real" damage */
4475 if (seen) obvious = TRUE;
4477 if (r_ptr->flagsr & RFR_RES_ALL)
4479 note = _("には効果がなかった。", " is unaffected.");
4481 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4485 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4487 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4488 chg_virtue(V_VITALITY, -1);
4498 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4500 if (r_ptr->flags3 & (RF3_HURT_LITE))
4502 /* Obvious effect */
4503 if (seen) obvious = TRUE;
4505 /* Memorize the effects */
4506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4508 /* Special effect */
4509 note = _("は光に身をすくめた!", " cringes from the light!");
4510 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4513 /* Normally no damage */
4520 photo = m_ptr->r_idx;
4527 case GF_BLOOD_CURSE:
4529 if (seen) obvious = TRUE;
4531 if (r_ptr->flagsr & RFR_RES_ALL)
4533 note = _("には完全な耐性がある!", " is immune.");
4535 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4543 bool success = FALSE;
4544 if (seen) obvious = TRUE;
4546 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4548 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4549 if (dam < 1) dam = 1;
4551 /* No need to tame your pet */
4554 note = _("の動きが速くなった。", " starts moving faster.");
4555 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4559 /* Attempt a saving throw */
4560 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4561 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4562 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4563 (p_ptr->cursed & TRC_AGGRAVATE) ||
4564 ((r_ptr->level+10) > randint1(dam)))
4567 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4571 note = _("を支配した。", " is tamed!");
4573 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4575 /* Learn about type */
4576 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4583 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4585 do_fear = randint1(90)+10;
4587 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4590 /* No "real" damage */
4597 if (seen) obvious = TRUE;
4599 if (r_ptr->flagsr & RFR_RES_ALL)
4601 note = _("には完全な耐性がある!", " is immune.");
4603 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4607 /* Attempt a saving throw */
4608 if (randint0(100 + dam) < (r_ptr->level + 50))
4610 note = _("には効果がなかった。", " is unaffected.");
4630 /* Absolutely no effect */
4631 if (skipped) return (FALSE);
4633 /* "Unique" monsters cannot be polymorphed */
4634 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4636 /* Quest monsters cannot be polymorphed */
4637 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4639 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4641 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4642 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4644 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4649 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4650 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4653 /* Modify the damage */
4655 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4656 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4658 /* Check for death */
4659 if (dam > m_ptr->hp)
4661 /* Extract method of death */
4666 /* Sound and Impact resisters never stun */
4668 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4669 !(r_ptr->flags3 & RF3_NO_STUN))
4672 if (seen) obvious = TRUE;
4675 if (MON_STUNNED(m_ptr))
4677 note = _("はひどくもうろうとした。", " is more dazed.");
4678 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4682 note = _("はもうろうとした。", " is dazed.");
4687 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4693 /* Confusion and Chaos resisters (and sleepers) never confuse */
4695 !(r_ptr->flags3 & RF3_NO_CONF) &&
4696 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4699 if (seen) obvious = TRUE;
4701 /* Already partially confused */
4702 if (MON_CONFUSED(m_ptr))
4704 note = _("はさらに混乱したようだ。", " looks more confused.");
4705 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4708 /* Was not confused */
4711 note = _("は混乱したようだ。", " looks confused.");
4715 /* Apply confusion */
4716 (void)set_monster_confused(c_ptr->m_idx, tmp);
4725 if (seen) obvious = TRUE;
4727 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4731 note = _("は弱くなったようだ。", " seems weakened.");
4732 m_ptr->maxhp -= do_time;
4733 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4738 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4739 if (do_poly && (randint1(90) > r_ptr->level))
4741 if (polymorph_monster(y, x))
4744 if (seen) obvious = TRUE;
4746 /* Monster polymorphs */
4747 note = _("が変身した!", " changes!");
4749 /* Turn off the damage */
4755 note = _("には効果がなかった。", " is unaffected.");
4758 /* Hack -- Get new monster */
4759 m_ptr = &m_list[c_ptr->m_idx];
4761 /* Hack -- Get new race */
4762 r_ptr = &r_info[m_ptr->r_idx];
4765 /* Handle "teleport" */
4769 if (seen) obvious = TRUE;
4772 note = _("が消え去った!", " disappears!");
4774 if (!who) chg_virtue(V_VALOUR, -1);
4777 teleport_away(c_ptr->m_idx, do_dist,
4778 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4780 /* Hack -- get new location */
4784 /* Hack -- get new grid */
4785 c_ptr = &cave[y][x];
4792 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4799 if (typ == GF_DRAIN_MANA)
4801 /* Drain mana does nothing */
4804 /* If another monster did the damage, hurt the monster by hand */
4807 /* Redraw (later) if needed */
4808 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4809 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4811 /* Wake the monster up */
4812 (void)set_monster_csleep(c_ptr->m_idx, 0);
4814 /* Hurt the monster */
4822 if (is_pet(m_ptr) && !(m_ptr->ml))
4825 /* Give detailed messages if destroyed */
4828 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4831 msg_format("%^s%s", m_name, note);
4839 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4841 /* Generate treasure, etc */
4842 monster_death(c_ptr->m_idx, FALSE);
4844 /* Delete the monster */
4845 delete_monster_idx(c_ptr->m_idx);
4849 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4853 /* Damaged monster */
4856 /* Give detailed messages if visible or destroyed */
4857 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4859 /* Hack -- Pain message */
4862 message_pain(c_ptr->m_idx, dam);
4869 /* Hack -- handle sleep */
4870 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4874 else if (heal_leper)
4876 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4878 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4882 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4883 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4886 delete_monster_idx(c_ptr->m_idx);
4889 /* If the player did it, give him experience, check fear */
4894 /* Hurt the monster, check for fear and death */
4895 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4900 /* Damaged monster */
4903 /* HACK - anger the monster before showing the sleep message */
4904 if (do_sleep) anger_monster(m_ptr);
4906 /* Give detailed messages if visible or destroyed */
4907 if (note && seen_msg)
4908 msg_format(_("%s%s", "%^s%s"), m_name, note);
4910 /* Hack -- Pain message */
4911 else if (known && (dam || !do_fear))
4913 message_pain(c_ptr->m_idx, dam);
4916 /* Anger monsters */
4917 if (((dam > 0) || get_angry) && !do_sleep)
4918 anger_monster(m_ptr);
4921 if ((fear || do_fear) && seen)
4927 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4930 /* Hack -- handle sleep */
4931 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4935 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4937 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4941 switch (randint1(28))
4946 msg_print(_("地面が揺れた...", "The ground trembles..."));
4947 earthquake(ty, tx, 4 + randint0(4));
4948 if (!one_in_(6)) break;
4950 case 3: case 4: case 5: case 6:
4953 int extra_dam = damroll(10, 10);
4954 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4956 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4957 if (!one_in_(6)) break;
4962 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4964 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4965 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4966 if (!one_in_(6)) break;
4968 case 9: case 10: case 11:
4969 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4970 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4971 if (!one_in_(6)) break;
4972 case 12: case 13: case 14: case 15: case 16:
4973 aggravate_monsters(0);
4974 if (!one_in_(6)) break;
4976 count += activate_hi_summon(ty, tx, TRUE);
4977 if (!one_in_(6)) break;
4978 case 19: case 20: case 21: case 22:
4980 bool pet = !one_in_(3);
4981 BIT_FLAGS mode = PM_ALLOW_GROUP;
4983 if (pet) mode |= PM_FORCE_PET;
4984 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4986 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);
4987 if (!one_in_(6)) break;
4989 case 23: case 24: case 25:
4990 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4991 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4993 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4994 else lose_exp(p_ptr->exp / 16);
4995 if (!one_in_(6)) break;
4996 case 26: case 27: case 28:
5005 (void)do_dec_stat(i);
5014 (void)do_dec_stat(randint0(6));
5023 if (p_ptr->inside_battle)
5025 p_ptr->health_who = c_ptr->m_idx;
5026 p_ptr->redraw |= (PR_HEALTH);
5030 /* XXX XXX XXX Verify this code */
5032 /* Update the monster */
5033 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5035 /* Redraw the monster grid */
5039 /* Update monster recall window */
5040 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5043 p_ptr->window |= (PW_MONSTER);
5046 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5050 if (!(flg & PROJECT_NO_HANGEKI))
5052 set_target(m_ptr, monster_target_y, monster_target_x);
5055 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5057 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5061 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5063 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5064 rakubadam_m = (dam > 200) ? 200 : dam;
5073 /* Get local object */
5076 /* Prepare to make a Blade of Chaos */
5077 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5079 q_ptr->pval = photo;
5081 /* Mark the item as fully known */
5082 q_ptr->ident |= (IDENT_MENTAL);
5084 /* Drop it in the dungeon */
5085 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5093 /* Return "Anything seen?" */
5098 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5099 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5100 * @param who_name 効果を起こしたモンスターの名前
5101 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5102 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5103 * @param x 目標X座標 / Target x location (or location to travel "towards")
5104 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5105 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5107 * @param monspell 効果元のモンスター魔法ID
5108 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5110 * Handle a beam/bolt/ball causing damage to the player.
5111 * This routine takes a "source monster" (by index), a "distance", a default
5112 * "damage", and a "damage type". See "project_m()" above.
5113 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5114 * is reduced (see "project_m()" above). This can happen if a monster breathes
5115 * at the player and hits a wall instead.
5116 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5117 * to know if this is actually a ball or a bolt spell
5118 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5119 * we just assume that the effects were obvious, for historical reasons.
5121 static bool project_p(int who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
5126 /* Hack -- assume obvious */
5127 bool obvious = TRUE;
5129 /* Player blind-ness */
5130 bool blind = (p_ptr->blind ? TRUE : FALSE);
5132 /* Player needs a "description" (he is blind) */
5135 /* Source monster */
5136 monster_type *m_ptr = NULL;
5138 /* Monster name (for attacks) */
5141 /* Monster name (for damage) */
5144 /* Hack -- messages */
5150 /* Player is not here */
5151 if (!player_bold(y, x)) return (FALSE);
5153 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5155 if (kawarimi(TRUE)) return FALSE;
5158 /* Player cannot hurt himself */
5159 if (!who) return (FALSE);
5160 if (who == p_ptr->riding) return (FALSE);
5162 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5165 int max_attempts = 10;
5166 sound(SOUND_REFLECT);
5169 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5170 else if (p_ptr->special_defense & KATA_FUUJIN)
5171 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5173 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5176 /* Choose 'new' target */
5181 t_y = m_list[who].fy - 1 + randint1(3);
5182 t_x = m_list[who].fx - 1 + randint1(3);
5185 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5187 if (max_attempts < 1)
5189 t_y = m_list[who].fy;
5190 t_x = m_list[who].fx;
5195 t_y = p_ptr->y - 1 + randint1(3);
5196 t_x = p_ptr->x - 1 + randint1(3);
5199 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5206 /* Limit maximum damage */
5207 if (dam > 1600) dam = 1600;
5209 /* Reduce damage by distance */
5210 dam = (dam + r) / (r + 1);
5213 /* If the player is blind, be more descriptive */
5214 if (blind) fuzzy = TRUE;
5219 /* Get the source monster */
5220 m_ptr = &m_list[who];
5221 /* Extract the monster level */
5222 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5224 /* Get the monster name */
5225 monster_desc(m_name, m_ptr, 0);
5227 /* Get the monster's real name (gotten before polymorph!) */
5228 strcpy(killer, who_name);
5234 case PROJECT_WHO_UNCTRL_POWER:
5235 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5238 case PROJECT_WHO_GLASS_SHARDS:
5239 strcpy(killer, _("ガラスの破片", "shards of glass"));
5243 strcpy(killer, _("罠", "a trap"));
5248 strcpy(m_name, killer);
5251 /* Analyze the damage */
5254 /* Standard damage -- hurts inventory too */
5257 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5258 get_damage = acid_dam(dam, killer, monspell, FALSE);
5262 /* Standard damage -- hurts inventory too */
5265 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5266 get_damage = fire_dam(dam, killer, monspell, FALSE);
5270 /* Standard damage -- hurts inventory too */
5273 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5274 get_damage = cold_dam(dam, killer, monspell, FALSE);
5278 /* Standard damage -- hurts inventory too */
5281 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5282 get_damage = elec_dam(dam, killer, monspell, FALSE);
5286 /* Standard damage -- also poisons player */
5289 bool double_resist = IS_OPPOSE_POIS();
5290 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5292 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5293 if (double_resist) dam = (dam + 2) / 3;
5295 if ((!(double_resist || p_ptr->resist_pois)) &&
5296 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5301 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5303 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5305 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5310 /* Standard damage -- also poisons / mutates player */
5313 bool double_resist = IS_OPPOSE_POIS();
5314 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5316 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5317 if (double_resist) dam = (2 * dam + 2) / 5;
5318 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5319 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5321 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5323 if (one_in_(5)) /* 6 */
5325 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5326 if (one_in_(4)) /* 4 */
5334 inven_damage(set_acid_destroy, 2);
5340 /* Standard damage */
5343 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5344 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5348 /* Holy Orb -- Player only takes partial damage */
5351 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5352 if (p_ptr->align > 10)
5354 else if (p_ptr->align < -10)
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5362 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5363 if (p_ptr->align > 10)
5365 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5369 /* Arrow -- XXX no dodging */
5374 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5376 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5378 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5381 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5385 /* Plasma -- XXX No resist */
5388 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5389 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5391 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5393 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5394 (void)set_stun(p_ptr->stun + plus_stun);
5397 if (!(p_ptr->resist_fire ||
5399 p_ptr->immune_fire))
5401 inven_damage(set_acid_destroy, 3);
5407 /* Nether -- drain experience */
5410 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5411 if (p_ptr->resist_neth)
5413 if (!prace_is_(RACE_SPECTRE))
5415 dam *= 6; dam /= (randint1(4) + 7);
5418 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5420 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5422 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5424 learn_spell(monspell);
5428 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5434 /* Water -- stun/confuse */
5437 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5438 if (!CHECK_MULTISHADOW())
5440 if (!p_ptr->resist_sound)
5442 set_stun(p_ptr->stun + randint1(40));
5444 if (!p_ptr->resist_conf)
5446 set_confused(p_ptr->confused + randint1(5) + 5);
5451 inven_damage(set_cold_destroy, 3);
5455 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5459 /* Chaos -- many effects */
5462 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5463 if (p_ptr->resist_chaos)
5465 dam *= 6; dam /= (randint1(4) + 7);
5468 if (!CHECK_MULTISHADOW())
5470 if (!p_ptr->resist_conf)
5472 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5474 if (!p_ptr->resist_chaos)
5476 (void)set_image(p_ptr->image + randint1(10));
5479 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5480 (void)gain_random_mutation(0);
5483 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5485 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5488 if (!p_ptr->resist_chaos || one_in_(9))
5490 inven_damage(set_elec_destroy, 2);
5491 inven_damage(set_fire_destroy, 2);
5495 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5499 /* Shards -- mostly cutting */
5502 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5503 if (p_ptr->resist_shard)
5505 dam *= 6; dam /= (randint1(4) + 7);
5507 else if (!CHECK_MULTISHADOW())
5509 (void)set_cut(p_ptr->cut + dam);
5512 if (!p_ptr->resist_shard || one_in_(13))
5514 inven_damage(set_cold_destroy, 2);
5517 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5521 /* Sound -- mostly stunning */
5524 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5525 if (p_ptr->resist_sound)
5527 dam *= 5; dam /= (randint1(4) + 7);
5529 else if (!CHECK_MULTISHADOW())
5531 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5532 (void)set_stun(p_ptr->stun + plus_stun);
5535 if (!p_ptr->resist_sound || one_in_(13))
5537 inven_damage(set_cold_destroy, 2);
5540 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5544 /* Pure confusion */
5547 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5548 if (p_ptr->resist_conf)
5550 dam *= 5; dam /= (randint1(4) + 7);
5552 else if (!CHECK_MULTISHADOW())
5554 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5556 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5560 /* Disenchantment -- see above */
5563 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5564 if (p_ptr->resist_disen)
5566 dam *= 6; dam /= (randint1(4) + 7);
5568 else if (!CHECK_MULTISHADOW())
5570 (void)apply_disenchant(0);
5572 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5576 /* Nexus -- see above */
5579 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5580 if (p_ptr->resist_nexus)
5582 dam *= 6; dam /= (randint1(4) + 7);
5584 else if (!CHECK_MULTISHADOW())
5588 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5592 /* Force -- mostly stun */
5595 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5596 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5598 (void)set_stun(p_ptr->stun + randint1(20));
5600 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5605 /* Rocket -- stun, cut */
5608 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5609 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5611 (void)set_stun(p_ptr->stun + randint1(20));
5614 if (p_ptr->resist_shard)
5618 else if (!CHECK_MULTISHADOW())
5620 (void)set_cut(p_ptr->cut + (dam / 2));
5623 if (!p_ptr->resist_shard || one_in_(12))
5625 inven_damage(set_cold_destroy, 3);
5628 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5632 /* Inertia -- slowness */
5635 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5636 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5637 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5641 /* Lite -- blinding */
5644 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5645 if (p_ptr->resist_lite)
5647 dam *= 4; dam /= (randint1(4) + 7);
5649 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5651 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5654 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5656 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5659 else if (prace_is_(RACE_S_FAIRY))
5664 if (p_ptr->wraith_form) dam *= 2;
5665 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5667 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5669 p_ptr->wraith_form = 0;
5670 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5671 "The light forces you out of your incorporeal shadow form."));
5673 p_ptr->redraw |= PR_MAP;
5674 /* Update monsters */
5675 p_ptr->update |= (PU_MONSTERS);
5677 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5679 /* Redraw status bar */
5680 p_ptr->redraw |= (PR_STATUS);
5687 /* Dark -- blinding */
5690 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5691 if (p_ptr->resist_dark)
5693 dam *= 4; dam /= (randint1(4) + 7);
5695 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5697 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5699 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5701 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5705 /* Time -- bolt fewer effects XXX */
5708 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5709 if (p_ptr->resist_time)
5712 dam /= (randint1(4) + 7);
5713 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5715 else if (!CHECK_MULTISHADOW())
5717 switch (randint1(10))
5719 case 1: case 2: case 3: case 4: case 5:
5721 if (p_ptr->prace == RACE_ANDROID) break;
5722 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5723 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5727 case 6: case 7: case 8: case 9:
5729 switch (randint1(6))
5731 case 1: k = A_STR; act = _("強く", "strong"); break;
5732 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5733 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5734 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5735 case 5: k = A_CON; act = _("健康で", "hale"); break;
5736 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5739 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5740 "You're not as %s as you used to be..."), act);
5742 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5743 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5744 p_ptr->update |= (PU_BONUS);
5750 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5751 "You're not as powerful as you used to be..."));
5753 for (k = 0; k < 6; k++)
5755 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5756 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5758 p_ptr->update |= (PU_BONUS);
5764 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5768 /* Gravity -- stun plus slowness plus teleport */
5771 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5772 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5774 if (!CHECK_MULTISHADOW())
5776 teleport_player(5, TELEPORT_PASSIVE);
5777 if (!p_ptr->levitation)
5778 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5779 if (!(p_ptr->resist_sound || p_ptr->levitation))
5781 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5782 (void)set_stun(p_ptr->stun + plus_stun);
5785 if (p_ptr->levitation)
5787 dam = (dam * 2) / 3;
5790 if (!p_ptr->levitation || one_in_(13))
5792 inven_damage(set_cold_destroy, 2);
5795 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5799 /* Standard damage */
5800 case GF_DISINTEGRATE:
5802 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5804 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5810 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5812 (void)hp_player(dam);
5819 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5820 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5827 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5828 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5834 if (p_ptr->free_act) break;
5835 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5837 if (ironman_nightmare)
5839 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5840 /* Have some nightmares */
5841 sanity_blast(NULL, FALSE);
5844 set_paralyzed(p_ptr->paralyzed + dam);
5854 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5855 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5862 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5863 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5870 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5872 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5873 if (!p_ptr->resist_shard || one_in_(13))
5875 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5876 inven_damage(set_cold_destroy, 2);
5882 /* Ice -- cold plus stun plus cuts */
5885 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5886 get_damage = cold_dam(dam, killer, monspell, FALSE);
5887 if (!CHECK_MULTISHADOW())
5889 if (!p_ptr->resist_shard)
5891 (void)set_cut(p_ptr->cut + damroll(5, 8));
5893 if (!p_ptr->resist_sound)
5895 (void)set_stun(p_ptr->stun + randint1(15));
5898 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5900 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5910 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5912 if (p_ptr->mimic_form)
5914 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5915 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5920 switch (p_ptr->prace)
5922 /* Some races are immune */
5936 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5948 if (CHECK_MULTISHADOW())
5950 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5952 else if (p_ptr->csp)
5956 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5958 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5961 if (dam >= p_ptr->csp)
5965 p_ptr->csp_frac = 0;
5974 learn_spell(monspell);
5977 p_ptr->redraw |= (PR_MANA);
5980 p_ptr->window |= (PW_PLAYER);
5981 p_ptr->window |= (PW_SPELL);
5985 /* Heal the monster */
5986 if (m_ptr->hp < m_ptr->maxhp)
5990 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5992 /* Redraw (later) if needed */
5993 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5994 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5996 /* Special message */
5999 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6012 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6014 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6015 learn_spell(monspell);
6019 if (!CHECK_MULTISHADOW())
6021 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6023 if (!p_ptr->resist_conf)
6025 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6028 if (!p_ptr->resist_chaos && one_in_(3))
6030 (void)set_image(p_ptr->image + randint0(250) + 150);
6037 p_ptr->csp_frac = 0;
6039 p_ptr->redraw |= PR_MANA;
6042 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6048 case GF_BRAIN_SMASH:
6050 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6052 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6053 learn_spell(monspell);
6057 if (!CHECK_MULTISHADOW())
6059 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6065 p_ptr->csp_frac = 0;
6067 p_ptr->redraw |= PR_MANA;
6070 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6071 if (!CHECK_MULTISHADOW())
6073 if (!p_ptr->resist_blind)
6075 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6077 if (!p_ptr->resist_conf)
6079 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6081 if (!p_ptr->free_act)
6083 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6085 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6087 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6088 (void)do_dec_stat(A_INT);
6089 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6090 (void)do_dec_stat(A_WIS);
6092 if (!p_ptr->resist_chaos)
6094 (void)set_image(p_ptr->image + randint0(250) + 150);
6104 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6106 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6107 learn_spell(monspell);
6111 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6112 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6120 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6122 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6123 learn_spell(monspell);
6127 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6128 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6136 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6138 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6139 learn_spell(monspell);
6143 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6144 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6152 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6154 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6155 learn_spell(monspell);
6159 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6160 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6168 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6170 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6171 learn_spell(monspell);
6175 if (!CHECK_MULTISHADOW())
6177 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6178 curse_equipment(40, 20);
6181 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6183 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6198 /* Hex - revenge damage stored */
6199 revenge_store(get_damage);
6201 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6202 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6204 char m_name_self[80];
6207 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6209 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6210 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6211 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6214 if (p_ptr->riding && dam > 0)
6216 rakubadam_p = (dam > 200) ? 200 : dam;
6224 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6226 (void)kawarimi(FALSE);
6229 /* Return "Anything seen?" */
6235 * Find the distance from (x, y) to a line.
6237 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6239 /* Vector from (x, y) to (x1, y1) */
6240 POSITION py = y1 - y;
6241 POSITION px = x1 - x;
6244 POSITION ny = x2 - x1;
6245 POSITION nx = y1 - y2;
6248 POSITION pd = distance(y1, x1, y, x);
6249 POSITION nd = distance(y1, x1, y2, x2);
6251 if (pd > nd) return distance(y, x, y2, x2);
6253 /* Component of P on N */
6254 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6256 /* Absolute value */
6257 return((nd >= 0) ? nd : 0 - nd);
6264 * Modified version of los() for calculation of disintegration balls.
6265 * Disintegration effects are stopped by permanent walls.
6267 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6287 /* Slope, or 1/Slope, of LOS */
6291 /* Extract the offset */
6295 /* Extract the absolute offset */
6300 /* Handle adjacent (or identical) grids */
6301 if ((ax < 2) && (ay < 2)) return (TRUE);
6304 /* Paranoia -- require "safe" origin */
6305 /* if (!in_bounds(y1, x1)) return (FALSE); */
6308 /* Directly South/North */
6311 /* South -- check for walls */
6314 for (ty = y1 + 1; ty < y2; ty++)
6316 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6320 /* North -- check for walls */
6323 for (ty = y1 - 1; ty > y2; ty--)
6325 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6333 /* Directly East/West */
6336 /* East -- check for walls */
6339 for (tx = x1 + 1; tx < x2; tx++)
6341 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6345 /* West -- check for walls */
6348 for (tx = x1 - 1; tx > x2; tx--)
6350 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6359 /* Extract some signs */
6360 sx = (dx < 0) ? -1 : 1;
6361 sy = (dy < 0) ? -1 : 1;
6364 /* Vertical "knights" */
6369 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6373 /* Horizontal "knights" */
6378 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6383 /* Calculate scale factor div 2 */
6386 /* Calculate scale factor */
6390 /* Travel horizontally */
6393 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6399 /* Consider the special case where slope == 1. */
6410 /* Note (below) the case (qy == f2), where */
6411 /* the LOS exactly meets the corner of a tile. */
6414 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6425 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6438 /* Travel vertically */
6441 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6457 /* Note (below) the case (qx == f2), where */
6458 /* the LOS exactly meets the corner of a tile. */
6461 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6472 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6493 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, int typ)
6498 int brev = rad * rad / dist;
6502 int mdis = distance(y1, x1, y2, x2) + rad;
6504 while (bdis <= mdis)
6508 if ((0 < dist) && (path_n < dist))
6510 int ny = GRID_Y(path_g[path_n]);
6511 int nx = GRID_X(path_g[path_n]);
6512 int nd = distance(ny, nx, y1, x1);
6514 /* Get next base point */
6523 /* Travel from center outward */
6524 for (cdis = 0; cdis <= brad; cdis++)
6526 /* Scan the maximal blast area of radius "cdis" */
6527 for (y = by - cdis; y <= by + cdis; y++)
6529 for (x = bx - cdis; x <= bx + cdis; x++)
6531 /* Ignore "illegal" locations */
6532 if (!in_bounds(y, x)) continue;
6534 /* Enforce a circular "ripple" */
6535 if (distance(y1, x1, y, x) != bdis) continue;
6537 /* Enforce an arc */
6538 if (distance(by, bx, y, x) != cdis) continue;
6544 /* Lights are stopped by opaque terrains */
6545 if (!los(by, bx, y, x)) continue;
6547 case GF_DISINTEGRATE:
6548 /* Disintegration are stopped only by perma-walls */
6549 if (!in_disintegration_range(by, bx, y, x)) continue;
6552 /* Ball explosions are stopped by walls */
6553 if (!projectable(by, bx, y, x)) continue;
6557 /* Save this grid */
6565 /* Encode some more "radius" info */
6566 gm[bdis + 1] = *pgrids;
6568 /* Increase the size */
6569 brad = rad * (path_n + brev) / (dist + brev);
6571 /* Find the next ripple */
6575 /* Store the effect size */
6581 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6582 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6583 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6584 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6585 * @param x 目標X座標 / Target x location (or location to travel "towards")
6586 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6587 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6588 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6589 * @param monspell 効果元のモンスター魔法ID
6590 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6593 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6594 * towards a given location (optionally passing over the heads of interposing
6595 * monsters), and have it do a given amount of damage to the monsters (and
6596 * optionally objects) within the given radius of the final location.
6598 * A "bolt" travels from source to target and affects only the target grid.
6599 * A "beam" travels from source to target, affecting all grids passed through.
6600 * A "ball" travels from source to the target, exploding at the target, and
6601 * affecting everything within the given radius of the target location.
6603 * Traditionally, a "bolt" does not affect anything on the ground, and does
6604 * not pass over the heads of interposing monsters, much like a traditional
6605 * missile, and will "stop" abruptly at the "target" even if no monster is
6606 * positioned there, while a "ball", on the other hand, passes over the heads
6607 * of monsters between the source and target, and affects everything except
6608 * the source monster which lies within the final radius, while a "beam"
6609 * affects every monster between the source and target, except for the casting
6610 * monster (or player), and rarely affects things on the ground.
6612 * Two special flags allow us to use this function in special ways, the
6613 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6614 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6615 * actually projecting from the source monster (or player).
6617 * The player will only get "experience" for monsters killed by himself
6618 * Unique monsters can only be destroyed by attacks from the player
6620 * Only 256 grids can be affected per projection, limiting the effective
6621 * "radius" of standard ball attacks to nine units (diameter nineteen).
6623 * One can project in a given "direction" by combining PROJECT_THRU with small
6624 * offsets to the initial location (see "line_spell()"), or by calculating
6625 * "virtual targets" far away from the player.
6627 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6628 * continuing until it actually hits somethings (useful for "stone to mud").
6630 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6632 * Balls must explode BEFORE hitting walls, or they would affect monsters
6633 * on both sides of a wall. Some bug reports indicate that this is still
6634 * happening in 2.7.8 for Windows, though it appears to be impossible.
6636 * We "pre-calculate" the blast area only in part for efficiency.
6637 * More importantly, this lets us do "explosions" from the "inside" out.
6638 * This results in a more logical distribution of "blast" treasure.
6639 * It also produces a better (in my opinion) animation of the explosion.
6640 * It could be (but is not) used to have the treasure dropped by monsters
6641 * in the middle of the explosion fall "outwards", and then be damaged by
6642 * the blast as it spreads outwards towards the treasure drop location.
6644 * Walls and doors are included in the blast area, so that they can be
6645 * "burned" or "melted" in later versions.
6647 * This algorithm is intended to maximize simplicity, not necessarily
6648 * efficiency, since this function is not a bottleneck in the code.
6650 * We apply the blast effect from ground zero outwards, in several passes,
6651 * first affecting features, then objects, then monsters, then the player.
6652 * This allows walls to be removed before checking the object or monster
6653 * in the wall, and protects objects which are dropped by monsters killed
6654 * in the blast, and allows the player to see all affects before he is
6655 * killed or teleported away. The semantics of this method are open to
6656 * various interpretations, but they seem to work well in practice.
6658 * We process the blast area from ground-zero outwards to allow for better
6659 * distribution of treasure dropped by monsters, and because it provides a
6660 * pleasing visual effect at low cost.
6662 * Note that the damage done by "ball" explosions decreases with distance.
6663 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6665 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6666 * the target, and then the damage "flows" along this beam of destruction.
6667 * The damage at every grid is the same as at the "center" of a "ball"
6668 * explosion, since the "beam" grids are treated as if they ARE at the
6669 * center of a "ball" explosion.
6671 * Currently, specifying "beam" plus "ball" means that locations which are
6672 * covered by the initial "beam", and also covered by the final "ball", except
6673 * for the final grid (the epicenter of the ball), will be "hit twice", once
6674 * by the initial beam, and once by the exploding ball. For the grid right
6675 * next to the epicenter, this results in 150% damage being done. The center
6676 * does not have this problem, for the same reason the final grid in a "beam"
6677 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6678 * grids which are covered by the "ball" will NOT work, as then they will
6679 * receive LESS damage than they should. Do not combine "beam" with "ball".
6681 * The array "gy[],gx[]" with current size "grids" is used to hold the
6682 * collected locations of all grids in the "blast area" plus "beam path".
6684 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6685 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6686 * first blast grid (see above) with radius "N" from the blast center. Note
6687 * that only the first gm[1] grids in the blast area thus take full damage.
6688 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6689 * number of blast grids.
6691 * Note that once the projection is complete, (y2,x2) holds the final location
6692 * of bolts/beams, and the "epicenter" of balls.
6694 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6695 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6696 * implementation of the "distance" function. Also, a bolt can be properly
6697 * viewed as a "ball" with a "rad" of "zero".
6699 * Note that if no "target" is reached before the beam/bolt/ball travels the
6700 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6701 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6703 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6704 * to move from point A to point B, even if the player cannot see part of the
6705 * projection path. Note that in general, the player will *always* see part
6706 * of the path, since it either starts at the player or ends on the player.
6708 * Hack -- we assume that every "projection" is "self-illuminating".
6710 * Hack -- when only a single monster is affected, we automatically track
6711 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6713 * Note that all projections now "explode" at their final destination, even
6714 * if they were being projected at a more distant destination. This means
6715 * that "ball" spells will *always* explode.
6717 * Note that we must call "handle_stuff()" after affecting terrain features
6718 * in the blast radius, in case the "illumination" of the grid was changed,
6719 * and "update_view()" and "update_monsters()" need to be called.
6722 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6732 POSITION y_saver, x_saver; /* For reflecting monsters */
6734 int msec = delay_factor * delay_factor * delay_factor;
6736 /* Assume the player sees nothing */
6737 bool notice = FALSE;
6739 /* Assume the player has seen nothing */
6740 bool visual = FALSE;
6742 /* Assume the player has seen no blast grids */
6745 /* Assume to be a normal ball spell */
6746 bool breath = FALSE;
6748 /* Is the player blind? */
6749 bool blind = (p_ptr->blind ? TRUE : FALSE);
6751 bool old_hide = FALSE;
6753 /* Number of grids in the "path" */
6756 /* Actual grids in the "path" */
6759 /* Number of grids in the "blast area" (including the "beam" path) */
6762 /* Coordinates of the affected grids */
6763 POSITION gx[1024], gy[1024];
6765 /* Encoded "radius" info (see above) */
6768 /* Actual radius encoded in gm[] */
6769 POSITION gm_rad = rad;
6773 /* Attacker's name (prepared before polymorph)*/
6776 /* Can the player see the source of this effect? */
6777 bool see_s_msg = TRUE;
6779 /* Initialize by null string */
6785 /* Default target of monsterspell is player */
6786 monster_target_y=p_ptr->y;
6787 monster_target_x=p_ptr->x;
6789 /* Hack -- Jump to target */
6790 if (flg & (PROJECT_JUMP))
6795 /* Clear the flag */
6796 flg &= ~(PROJECT_JUMP);
6801 /* Start at player */
6808 /* Start at monster */
6811 x1 = m_list[who].fx;
6812 y1 = m_list[who].fy;
6813 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6826 /* Default "destination" */
6831 /* Hack -- verify stuff */
6832 if (flg & (PROJECT_THRU))
6834 if ((x1 == x2) && (y1 == y2))
6836 flg &= ~(PROJECT_THRU);
6840 /* Handle a breath attack */
6845 if (flg & PROJECT_HIDE) old_hide = TRUE;
6846 flg |= PROJECT_HIDE;
6850 /* Hack -- Assume there will be no blast (max radius 32) */
6851 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6859 /* Collect beam grids */
6860 if (flg & (PROJECT_BEAM))
6871 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6873 case GF_DISINTEGRATE:
6874 flg |= (PROJECT_GRID);
6875 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6879 /* Calculate the projection path */
6881 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6883 /* Hack -- Handle stuff */
6886 /* Giga-Hack SEEKER & SUPER_RAY */
6888 if( typ == GF_SEEKER )
6898 for (i = 0; i < path_n; ++i)
6903 int ny = GRID_Y(path_g[i]);
6904 int nx = GRID_X(path_g[i]);
6915 /* Only do visuals if requested */
6916 if (!blind && !(flg & (PROJECT_HIDE)))
6918 /* Only do visuals if the player can "see" the bolt */
6919 if (panel_contains(y, x) && player_has_los_bold(y, x))
6926 /* Obtain the bolt pict */
6927 p = bolt_pict(oy, ox, y, x, typ);
6929 /* Extract attr/char */
6933 /* Visual effects */
6934 print_rel(c, a, y, x);
6935 move_cursor_relative(y, x);
6936 /*if (fresh_before)*/ Term_fresh();
6937 Term_xtra(TERM_XTRA_DELAY, msec);
6939 /*if (fresh_before)*/ Term_fresh();
6941 /* Display "beam" grids */
6942 if (flg & (PROJECT_BEAM))
6944 /* Obtain the explosion pict */
6945 p = bolt_pict(y, x, y, x, typ);
6947 /* Extract attr/char */
6951 /* Visual effects */
6952 print_rel(c, a, y, x);
6955 /* Hack -- Activate delay */
6959 /* Hack -- delay anyway for consistency */
6962 /* Delay for consistency */
6963 Term_xtra(TERM_XTRA_DELAY, msec);
6966 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6967 if( is_mirror_grid(&cave[y][x]))
6969 /* The target of monsterspell becomes tha mirror(broken) */
6970 monster_target_y=(s16b)y;
6971 monster_target_x=(s16b)x;
6973 remove_mirror(y, x);
6974 next_mirror(&oy, &ox, y, x);
6976 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6977 for(j = last_i; j <= i; j++)
6979 y = GRID_Y(path_g[j]);
6980 x = GRID_X(path_g[j]);
6981 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6982 if(!who && (project_m_n==1) && !jump ){
6983 if(cave[project_m_y][project_m_x].m_idx >0 ){
6984 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6988 /* Hack -- auto-recall */
6989 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6991 /* Hack - auto-track */
6992 health_track(cave[project_m_y][project_m_x].m_idx);
6996 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7001 for(i = last_i ; i < path_n ; i++)
7004 py = GRID_Y(path_g[i]);
7005 px = GRID_X(path_g[i]);
7006 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7008 if(!who && (project_m_n==1) && !jump ){
7009 if(cave[project_m_y][project_m_x].m_idx > 0)
7011 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7015 /* Hack -- auto-recall */
7016 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7018 /* Hack - auto-track */
7019 health_track(cave[project_m_y][project_m_x].m_idx);
7023 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7027 else if(typ == GF_SUPER_RAY){
7029 int second_step = 0;
7036 for (i = 0; i < path_n; ++i)
7041 int ny = GRID_Y(path_g[i]);
7042 int nx = GRID_X(path_g[i]);
7053 /* Only do visuals if requested */
7054 if (!blind && !(flg & (PROJECT_HIDE)))
7056 /* Only do visuals if the player can "see" the bolt */
7057 if (panel_contains(y, x) && player_has_los_bold(y, x))
7064 /* Obtain the bolt pict */
7065 p = bolt_pict(oy, ox, y, x, typ);
7067 /* Extract attr/char */
7071 /* Visual effects */
7072 print_rel(c, a, y, x);
7073 move_cursor_relative(y, x);
7074 /*if (fresh_before)*/ Term_fresh();
7075 Term_xtra(TERM_XTRA_DELAY, msec);
7077 /*if (fresh_before)*/ Term_fresh();
7079 /* Display "beam" grids */
7080 if (flg & (PROJECT_BEAM))
7082 /* Obtain the explosion pict */
7083 p = bolt_pict(y, x, y, x, typ);
7085 /* Extract attr/char */
7089 /* Visual effects */
7090 print_rel(c, a, y, x);
7093 /* Hack -- Activate delay */
7097 /* Hack -- delay anyway for consistency */
7100 /* Delay for consistency */
7101 Term_xtra(TERM_XTRA_DELAY, msec);
7104 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7105 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7107 if( second_step )continue;
7110 if( is_mirror_grid(&cave[y][x]) && !second_step )
7112 /* The target of monsterspell becomes tha mirror(broken) */
7113 monster_target_y=(s16b)y;
7114 monster_target_x=(s16b)x;
7117 for( j = 0; j <=i ; j++ )
7119 y = GRID_Y(path_g[j]);
7120 x = GRID_X(path_g[j]);
7121 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7125 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7126 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7127 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7128 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7129 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7130 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7131 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7132 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7135 for( i = 0; i < path_n ; i++ )
7138 py = GRID_Y(path_g[i]);
7139 px = GRID_X(path_g[i]);
7140 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7141 if(!who && (project_m_n == 1) && !jump){
7142 if(cave[project_m_y][project_m_x].m_idx >0 ){
7143 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7147 /* Hack -- auto-recall */
7148 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7150 /* Hack - auto-track */
7151 health_track(cave[project_m_y][project_m_x].m_idx);
7155 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7160 /* Project along the path */
7161 for (i = 0; i < path_n; ++i)
7166 int ny = GRID_Y(path_g[i]);
7167 int nx = GRID_X(path_g[i]);
7169 if (flg & PROJECT_DISI)
7171 /* Hack -- Balls explode before reaching walls */
7172 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7174 else if (flg & PROJECT_LOS)
7176 /* Hack -- Balls explode before reaching walls */
7177 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7181 /* Hack -- Balls explode before reaching walls */
7182 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7189 /* Collect beam grids */
7190 if (flg & (PROJECT_BEAM))
7197 /* Only do visuals if requested */
7198 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7200 /* Only do visuals if the player can "see" the bolt */
7201 if (panel_contains(y, x) && player_has_los_bold(y, x))
7208 /* Obtain the bolt pict */
7209 p = bolt_pict(oy, ox, y, x, typ);
7211 /* Extract attr/char */
7215 /* Visual effects */
7216 print_rel(c, a, y, x);
7217 move_cursor_relative(y, x);
7218 /*if (fresh_before)*/ Term_fresh();
7219 Term_xtra(TERM_XTRA_DELAY, msec);
7221 /*if (fresh_before)*/ Term_fresh();
7223 /* Display "beam" grids */
7224 if (flg & (PROJECT_BEAM))
7226 /* Obtain the explosion pict */
7227 p = bolt_pict(y, x, y, x, typ);
7229 /* Extract attr/char */
7233 /* Visual effects */
7234 print_rel(c, a, y, x);
7237 /* Hack -- Activate delay */
7241 /* Hack -- delay anyway for consistency */
7244 /* Delay for consistency */
7245 Term_xtra(TERM_XTRA_DELAY, msec);
7252 /* Save the "blast epicenter" */
7256 if (breath && !path_n)
7262 flg &= ~(PROJECT_HIDE);
7266 /* Start the "explosion" */
7269 /* Hack -- make sure beams get to "explode" */
7277 /* If we found a "target", explode there */
7278 if (dist <= MAX_RANGE)
7280 /* Mega-Hack -- remove the final "beam" grid */
7281 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7284 * Create a conical breath attack
7295 flg &= ~(PROJECT_HIDE);
7297 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7301 /* Determine the blast area, work from the inside out */
7302 for (dist = 0; dist <= rad; dist++)
7304 /* Scan the maximal blast area of radius "dist" */
7305 for (y = by - dist; y <= by + dist; y++)
7307 for (x = bx - dist; x <= bx + dist; x++)
7309 /* Ignore "illegal" locations */
7310 if (!in_bounds2(y, x)) continue;
7312 /* Enforce a "circular" explosion */
7313 if (distance(by, bx, y, x) != dist) continue;
7319 /* Lights are stopped by opaque terrains */
7320 if (!los(by, bx, y, x)) continue;
7322 case GF_DISINTEGRATE:
7323 /* Disintegration are stopped only by perma-walls */
7324 if (!in_disintegration_range(by, bx, y, x)) continue;
7327 /* Ball explosions are stopped by walls */
7328 if (!projectable(by, bx, y, x)) continue;
7332 /* Save this grid */
7339 /* Encode some more "radius" info */
7345 /* Speed -- ignore "non-explosions" */
7346 if (!grids) return (FALSE);
7349 /* Display the "blast area" if requested */
7350 if (!blind && !(flg & (PROJECT_HIDE)))
7352 /* Then do the "blast", from inside out */
7353 for (t = 0; t <= gm_rad; t++)
7355 /* Dump everything with this radius */
7356 for (i = gm[t]; i < gm[t+1]; i++)
7358 /* Extract the location */
7362 /* Only do visuals if the player can "see" the blast */
7363 if (panel_contains(y, x) && player_has_los_bold(y, x))
7372 /* Obtain the explosion pict */
7373 p = bolt_pict(y, x, y, x, typ);
7375 /* Extract attr/char */
7379 /* Visual effects -- Display */
7380 print_rel(c, a, y, x);
7384 /* Hack -- center the cursor */
7385 move_cursor_relative(by, bx);
7387 /* Flush each "radius" seperately */
7388 /*if (fresh_before)*/ Term_fresh();
7390 /* Delay (efficiently) */
7391 if (visual || drawn)
7393 Term_xtra(TERM_XTRA_DELAY, msec);
7397 /* Flush the erasing */
7400 /* Erase the explosion drawn above */
7401 for (i = 0; i < grids; i++)
7403 /* Extract the location */
7407 /* Hack -- Erase if needed */
7408 if (panel_contains(y, x) && player_has_los_bold(y, x))
7414 /* Hack -- center the cursor */
7415 move_cursor_relative(by, bx);
7417 /* Flush the explosion */
7418 /*if (fresh_before)*/ Term_fresh();
7423 /* Update stuff if needed */
7424 if (p_ptr->update) update_stuff();
7427 if (flg & PROJECT_KILL)
7429 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7430 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7434 /* Check features */
7435 if (flg & (PROJECT_GRID))
7437 /* Start with "dist" of zero */
7440 /* Scan for features */
7441 for (i = 0; i < grids; i++)
7443 /* Hack -- Notice new "dist" values */
7444 if (gm[dist+1] == i) dist++;
7446 /* Get the grid location */
7450 /* Find the closest point in the blast */
7453 int d = dist_to_line(y, x, y1, x1, by, bx);
7455 /* Affect the grid */
7456 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7460 /* Affect the grid */
7461 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7466 /* Update stuff if needed */
7467 if (p_ptr->update) update_stuff();
7470 if (flg & (PROJECT_ITEM))
7472 /* Start with "dist" of zero */
7475 /* Scan for objects */
7476 for (i = 0; i < grids; i++)
7478 /* Hack -- Notice new "dist" values */
7479 if (gm[dist+1] == i) dist++;
7481 /* Get the grid location */
7485 /* Find the closest point in the blast */
7488 int d = dist_to_line(y, x, y1, x1, by, bx);
7490 /* Affect the object in the grid */
7491 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7495 /* Affect the object in the grid */
7496 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7502 /* Check monsters */
7503 if (flg & (PROJECT_KILL))
7510 /* Start with "dist" of zero */
7513 /* Scan for monsters */
7514 for (i = 0; i < grids; i++)
7518 /* Hack -- Notice new "dist" values */
7519 if (gm[dist + 1] == i) dist++;
7521 /* Get the grid location */
7525 /* A single bolt may be reflected */
7528 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7529 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7531 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7532 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7533 (!who || dist_hack > 1) && !one_in_(10))
7536 int max_attempts = 10;
7538 /* Choose 'new' target */
7541 t_y = y_saver - 1 + randint1(3);
7542 t_x = x_saver - 1 + randint1(3);
7545 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7547 if (max_attempts < 1)
7553 sound(SOUND_REFLECT);
7556 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7557 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7558 else if (m_ptr->r_idx == MON_DIO)
7559 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7561 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7563 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7565 /* Reflected bolts randomly target either one */
7566 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7567 else flg |= PROJECT_PLAYER;
7569 /* The bolt is reflected */
7570 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7572 /* Don't affect the monster any longer */
7578 /* Find the closest point in the blast */
7581 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7585 effective_dist = dist;
7589 /* There is the riding player on this monster */
7590 if (p_ptr->riding && player_bold(y, x))
7592 /* Aimed on the player */
7593 if (flg & PROJECT_PLAYER)
7595 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7598 * A beam or bolt is well aimed
7600 * So don't affects the mount.
7607 * The spell is not well aimed,
7608 * So partly affect the mount too.
7615 * This grid is the original target.
7616 * Or aimed on your horse.
7618 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7620 /* Hit the mount with full damage */
7624 * Otherwise this grid is not the
7625 * original target, it means that line
7626 * of fire is obstructed by this
7630 * A beam or bolt will hit either
7631 * player or mount. Choose randomly.
7633 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7637 /* Hit the mount with full damage */
7641 /* Hit the player later */
7642 flg |= PROJECT_PLAYER;
7644 /* Don't affect the mount */
7650 * The spell is not well aimed, so
7651 * partly affect both player and
7660 /* Affect the monster in the grid */
7661 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7665 /* Player affected one monster (without "jumping") */
7666 if (!who && (project_m_n == 1) && !jump)
7672 /* Track if possible */
7673 if (cave[y][x].m_idx > 0)
7675 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7679 /* Hack -- auto-recall */
7680 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7682 /* Hack - auto-track */
7683 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7691 if (flg & (PROJECT_KILL))
7693 /* Start with "dist" of zero */
7696 /* Scan for player */
7697 for (i = 0; i < grids; i++)
7701 /* Hack -- Notice new "dist" values */
7702 if (gm[dist+1] == i) dist++;
7704 /* Get the grid location */
7708 /* Affect the player? */
7709 if (!player_bold(y, x)) continue;
7711 /* Find the closest point in the blast */
7714 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7718 effective_dist = dist;
7721 /* Target may be your horse */
7724 /* Aimed on the player */
7725 if (flg & PROJECT_PLAYER)
7727 /* Hit the player with full damage */
7731 * Hack -- When this grid was not the
7732 * original target, a beam or bolt
7733 * would hit either player or mount,
7734 * and should be choosen randomly.
7736 * But already choosen to hit the
7737 * mount at this point.
7739 * Or aimed on your horse.
7741 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7744 * A beam or bolt is well aimed
7746 * So don't affects the player.
7753 * The spell is not well aimed,
7754 * So partly affect the player too.
7760 /* Affect the player */
7761 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7769 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7771 if (rakubadam_m > 0)
7773 if (rakuba(rakubadam_m, FALSE))
7775 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7778 if (p_ptr->riding && rakubadam_p > 0)
7780 if(rakuba(rakubadam_p, FALSE))
7782 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7787 /* Return "something was noticed" */
7792 * @brief 鏡魔法「封魔結界」の効果処理
7794 * @return 効果があったらTRUEを返す
7796 bool binding_field( HIT_POINT dam )
7798 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7799 int mirror_num=0; /* 鏡の数 */
7804 int msec= delay_factor*delay_factor*delay_factor;
7810 /* Default target of monsterspell is player */
7811 monster_target_y=p_ptr->y;
7812 monster_target_x=p_ptr->x;
7814 for( x=0 ; x < cur_wid ; x++ )
7816 for( y=0 ; y < cur_hgt ; y++ )
7818 if( is_mirror_grid(&cave[y][x]) &&
7819 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7820 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7821 player_has_los_bold(y,x) &&
7822 projectable(p_ptr->y, p_ptr->x, y, x)
7824 mirror_y[mirror_num]=y;
7825 mirror_x[mirror_num]=x;
7831 if( mirror_num < 2 )return FALSE;
7833 point_x[0] = randint0( mirror_num );
7835 point_x[1] = randint0( mirror_num );
7837 while( point_x[0] == point_x[1] );
7839 point_y[0]=mirror_y[point_x[0]];
7840 point_x[0]=mirror_x[point_x[0]];
7841 point_y[1]=mirror_y[point_x[1]];
7842 point_x[1]=mirror_x[point_x[1]];
7843 point_y[2]=p_ptr->y;
7844 point_x[2]=p_ptr->x;
7846 x=point_x[0]+point_x[1]+point_x[2];
7847 y=point_y[0]+point_y[1]+point_y[2];
7849 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7850 - (point_y[0]*3-y)*(point_x[1]*3-x);
7851 if( centersign == 0 )return FALSE;
7853 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7854 x1 = x1 < point_x[2] ? x1 : point_x[2];
7855 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7856 y1 = y1 < point_y[2] ? y1 : point_y[2];
7858 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7859 x2 = x2 > point_x[2] ? x2 : point_x[2];
7860 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7861 y2 = y2 > point_y[2] ? y2 : point_y[2];
7863 for( y=y1 ; y <=y2 ; y++ ){
7864 for( x=x1 ; x <=x2 ; x++ ){
7865 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7866 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7867 centersign*( (point_x[1]-x)*(point_y[2]-y)
7868 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7869 centersign*( (point_x[2]-x)*(point_y[0]-y)
7870 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7872 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7873 /* Visual effects */
7875 && panel_contains(y,x)){
7876 p = bolt_pict(y,x,y,x, GF_MANA );
7877 print_rel(PICT_C(p), PICT_A(p),y,x);
7878 move_cursor_relative(y, x);
7879 /*if (fresh_before)*/ Term_fresh();
7880 Term_xtra(TERM_XTRA_DELAY, msec);
7886 for( y=y1 ; y <=y2 ; y++ ){
7887 for( x=x1 ; x <=x2 ; x++ ){
7888 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7889 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7890 centersign*( (point_x[1]-x)*(point_y[2]-y)
7891 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7892 centersign*( (point_x[2]-x)*(point_y[0]-y)
7893 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7895 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7896 (void)project_f(0,0,y,x,dam,GF_MANA);
7901 for( y=y1 ; y <=y2 ; y++ ){
7902 for( x=x1 ; x <=x2 ; x++ ){
7903 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7904 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7905 centersign*( (point_x[1]-x)*(point_y[2]-y)
7906 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7907 centersign*( (point_x[2]-x)*(point_y[0]-y)
7908 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7910 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7911 (void)project_o(0,0,y,x,dam,GF_MANA);
7916 for( y=y1 ; y <=y2 ; y++ ){
7917 for( x=x1 ; x <=x2 ; x++ ){
7918 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7919 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7920 centersign*( (point_x[1]-x)*(point_y[2]-y)
7921 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7922 centersign*( (point_x[2]-x)*(point_y[0]-y)
7923 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7925 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7926 (void)project_m(0,0,y,x,dam,GF_MANA,
7927 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7933 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7934 remove_mirror(point_y[0],point_x[0]);
7941 * @brief 鏡魔法「鏡の封印」の効果処理
7943 * @return 効果があったらTRUEを返す
7945 void seal_of_mirror( HIT_POINT dam )
7949 for( x = 0 ; x < cur_wid ; x++ )
7951 for( y = 0 ; y < cur_hgt ; y++ )
7953 if( is_mirror_grid(&cave[y][x]))
7955 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
7956 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
7958 if( !cave[y][x].m_idx )