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 モンスター服従用セービングスロー共通部(部族依存系)
60 * @param m_ptr 対象モンスター
61 * @return 服従に抵抗したらTRUE
63 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
65 monster_race *r_ptr = &r_info[m_ptr->r_idx];
67 if (p_ptr->inside_arena) return TRUE;
70 if (r_ptr->flagsr & RFR_RES_ALL)
72 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
76 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
78 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
79 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
80 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
85 * @brief 配置した鏡リストの次を取得する /
86 * Get another mirror. for SEEKER
87 * @param next_y 次の鏡のy座標を返す参照ポインタ
88 * @param next_x 次の鏡のx座標を返す参照ポインタ
89 * @param cury 現在の鏡のy座標
90 * @param curx 現在の鏡のx座標
92 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
94 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
95 int mirror_num = 0; /* 鏡の数 */
99 for (x = 0; x < cur_wid; x++)
101 for (y = 0; y < cur_hgt; y++)
103 if (is_mirror_grid(&cave[y][x])) {
104 mirror_y[mirror_num] = y;
105 mirror_x[mirror_num] = x;
112 num = randint0(mirror_num);
113 *next_y = mirror_y[num];
114 *next_x = mirror_x[num];
117 *next_y = cury + randint0(5) - 2;
118 *next_x = curx + randint0(5) - 2;
123 * @brief 万色表現用にランダムな色を選択する関数 /
124 * Get a legal "multi-hued" color for drawing "spells"
128 static byte mh_attr(int max)
130 switch (randint1(max))
132 case 1: return (TERM_RED);
133 case 2: return (TERM_GREEN);
134 case 3: return (TERM_BLUE);
135 case 4: return (TERM_YELLOW);
136 case 5: return (TERM_ORANGE);
137 case 6: return (TERM_VIOLET);
138 case 7: return (TERM_L_RED);
139 case 8: return (TERM_L_GREEN);
140 case 9: return (TERM_L_BLUE);
141 case 10: return (TERM_UMBER);
142 case 11: return (TERM_L_UMBER);
143 case 12: return (TERM_SLATE);
144 case 13: return (TERM_WHITE);
145 case 14: return (TERM_L_WHITE);
146 case 15: return (TERM_L_DARK);
154 * @brief 魔法属性に応じたエフェクトの色を返す /
155 * Return a color to use for the bolt/ball spells
159 static byte spell_color(int type)
161 /* Check if A.B.'s new graphics should be used (rr9) */
162 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
167 case GF_PSY_SPEAR: return (0x06);
168 case GF_MISSILE: return (0x0F);
169 case GF_ACID: return (0x04);
170 case GF_ELEC: return (0x02);
171 case GF_FIRE: return (0x00);
172 case GF_COLD: return (0x01);
173 case GF_POIS: return (0x03);
174 case GF_HOLY_FIRE: return (0x00);
175 case GF_HELL_FIRE: return (0x00);
176 case GF_MANA: return (0x0E);
178 case GF_SEEKER: return (0x0E);
179 case GF_SUPER_RAY: return (0x0E);
181 case GF_ARROW: return (0x0F);
182 case GF_WATER: return (0x04);
183 case GF_NETHER: return (0x07);
184 case GF_CHAOS: return (mh_attr(15));
185 case GF_DISENCHANT: return (0x05);
186 case GF_NEXUS: return (0x0C);
187 case GF_CONFUSION: return (mh_attr(4));
188 case GF_SOUND: return (0x09);
189 case GF_SHARDS: return (0x08);
190 case GF_FORCE: return (0x09);
191 case GF_INERTIAL: return (0x09);
192 case GF_GRAVITY: return (0x09);
193 case GF_TIME: return (0x09);
194 case GF_LITE_WEAK: return (0x06);
195 case GF_LITE: return (0x06);
196 case GF_DARK_WEAK: return (0x07);
197 case GF_DARK: return (0x07);
198 case GF_PLASMA: return (0x0B);
199 case GF_METEOR: return (0x00);
200 case GF_ICE: return (0x01);
201 case GF_ROCKET: return (0x0F);
202 case GF_DEATH_RAY: return (0x07);
203 case GF_NUKE: return (mh_attr(2));
204 case GF_DISINTEGRATE: return (0x05);
216 case GF_CAUSE_4: return (0x0E);
217 case GF_HAND_DOOM: return (0x07);
218 case GF_CAPTURE : return (0x0E);
219 case GF_IDENTIFY: return (0x01);
220 case GF_ATTACK: return (0x0F);
221 case GF_PHOTO : return (0x06);
224 /* Normal tiles or ASCII */
230 /* Lookup the default colors for this type */
231 cptr s = quark_str(gf_color[type]);
234 if (!s) return (TERM_WHITE);
236 /* Pick a random color */
237 c = s[randint0(strlen(s))];
239 /* Lookup this color */
240 a = my_strchr(color_char, c) - color_char;
242 /* Invalid color (note check for < 0 removed, gave a silly
243 * warning because bytes are always >= 0 -- RG) */
244 if (a > 15) return (TERM_WHITE);
250 /* Standard "color" */
256 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
257 * Find the attr/char pair to use for a spell effect
266 * It is moving (or has moved) from (x,y) to (nx,ny).
267 * If the distance is not "one", we (may) return "*".
270 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
280 if ((ny == y) && (nx == x)) base = 0x30;
283 else if (nx == x) base = 0x40;
286 else if (ny == y) base = 0x50;
289 else if ((ny - y) == (x - nx)) base = 0x60;
292 else if ((ny - y) == (nx - x)) base = 0x70;
297 /* Basic spell color */
298 k = spell_color(typ);
300 /* Obtain attr/char */
301 a = misc_to_attr[base + k];
302 c = misc_to_char[base + k];
310 * @brief 始点から終点への経路を返す /
311 * Determine the path taken by a projection.
312 * @param gp 経路座標リストを返す参照ポインタ
322 * The projection will always start from the grid (y1,x1), and will travel
323 * towards the grid (y2,x2), touching one grid per unit of distance along
324 * the major axis, and stopping when it enters the destination grid or a
325 * wall grid, or has travelled the maximum legal distance of "range".
327 * Note that "distance" in this function (as in the "update_view()" code)
328 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
329 * actually has an "octagon of projection" not a "circle of projection".
331 * The path grids are saved into the grid array pointed to by "gp", and
332 * there should be room for at least "range" grids in "gp". Note that
333 * due to the way in which distance is calculated, this function normally
334 * uses fewer than "range" grids for the projection path, so the result
335 * of this function should never be compared directly to "range". Note
336 * that the initial grid (y1,x1) is never saved into the grid array, not
337 * even if the initial grid is also the final grid. XXX XXX XXX
339 * The "flg" flags can be used to modify the behavior of this function.
341 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
342 * semantics as they do for the "project" function, namely, that the path
343 * will stop as soon as it hits a monster, or that the path will continue
344 * through the destination grid, respectively.
346 * The "PROJECT_JUMP" flag, which for the "project()" function means to
347 * start at a special grid (which makes no sense in this function), means
348 * that the path should be "angled" slightly if needed to avoid any wall
349 * grids, allowing the player to "target" any grid which is in "view".
350 * This flag is non-trivial and has not yet been implemented, but could
351 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
353 * This function returns the number of grids (if any) in the path. This
354 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
356 * This algorithm is similar to, but slightly different from, the one used
357 * by "update_view_los()", and very different from the one used by "los()".
360 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
382 /* No path necessary (or allowed) */
383 if ((x1 == x2) && (y1 == y2)) return (0);
411 /* Number of "units" in one "half" grid */
414 /* Number of "units" in one "full" grid */
420 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
431 /* Advance (X) part 2 */
434 /* Advance (X) part 3 */
441 /* Create the projection path */
445 gp[n++] = GRID(y, x);
447 /* Hack -- Check maximum range */
448 if ((n + (k >> 1)) >= range) break;
450 /* Sometimes stop at destination grid */
451 if (!(flg & (PROJECT_THRU)))
453 if ((x == x2) && (y == y2)) break;
456 if (flg & (PROJECT_DISI))
458 if ((n > 0) && cave_stop_disintegration(y, x)) break;
460 else if (flg & (PROJECT_LOS))
462 if ((n > 0) && !cave_los_bold(y, x)) break;
464 else if (!(flg & (PROJECT_PATH)))
466 /* Always stop at non-initial wall grids */
467 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
470 /* Sometimes stop at non-initial monsters/players */
471 if (flg & (PROJECT_STOP))
474 (player_bold(y, x) || cave[y][x].m_idx != 0))
478 if (!in_bounds(y, x)) break;
483 /* Advance (X) part 1 */
486 /* Horizontal change */
489 /* Advance (X) part 2 */
492 /* Advance (X) part 3 */
508 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
517 /* Vertical change */
520 /* Advance (Y) part 2 */
523 /* Advance (Y) part 3 */
530 /* Create the projection path */
534 gp[n++] = GRID(y, x);
536 /* Hack -- Check maximum range */
537 if ((n + (k >> 1)) >= range) break;
539 /* Sometimes stop at destination grid */
540 if (!(flg & (PROJECT_THRU)))
542 if ((x == x2) && (y == y2)) break;
545 if (flg & (PROJECT_DISI))
547 if ((n > 0) && cave_stop_disintegration(y, x)) break;
549 else if (flg & (PROJECT_LOS))
551 if ((n > 0) && !cave_los_bold(y, x)) break;
553 else if (!(flg & (PROJECT_PATH)))
555 /* Always stop at non-initial wall grids */
556 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
559 /* Sometimes stop at non-initial monsters/players */
560 if (flg & (PROJECT_STOP))
563 (player_bold(y, x) || cave[y][x].m_idx != 0))
567 if (!in_bounds(y, x)) break;
572 /* Advance (Y) part 1 */
575 /* Vertical change */
578 /* Advance (Y) part 2 */
581 /* Advance (Y) part 3 */
601 /* Create the projection path */
605 gp[n++] = GRID(y, x);
607 /* Hack -- Check maximum range */
608 if ((n + (n >> 1)) >= range) break;
610 /* Sometimes stop at destination grid */
611 if (!(flg & (PROJECT_THRU)))
613 if ((x == x2) && (y == y2)) break;
616 if (flg & (PROJECT_DISI))
618 if ((n > 0) && cave_stop_disintegration(y, x)) break;
620 else if (flg & (PROJECT_LOS))
622 if ((n > 0) && !cave_los_bold(y, x)) break;
624 else if (!(flg & (PROJECT_PATH)))
626 /* Always stop at non-initial wall grids */
627 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
630 /* Sometimes stop at non-initial monsters/players */
631 if (flg & (PROJECT_STOP))
634 (player_bold(y, x) || cave[y][x].m_idx != 0))
638 if (!in_bounds(y, x)) break;
655 * Mega-Hack -- track "affected" monsters (see "project()" comments)
657 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
658 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
659 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
660 /* Mega-Hack -- monsters target */
661 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
662 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
666 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
667 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
668 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
669 * @param y 目標Y座標 / Target y location (or location to travel "towards")
670 * @param x 目標X座標 / Target x location (or location to travel "towards")
671 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
672 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
673 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
676 * We are called both for "beam" effects and "ball" effects.
678 * The "r" parameter is the "distance from ground zero".
680 * Note that we determine if the player can "see" anything that happens
681 * by taking into account: blindness, line-of-sight, and illumination.
683 * We return "TRUE" if the effect of the projection is "obvious".
685 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
687 * XXX XXX XXX Perhaps we should affect doors?
690 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
692 cave_type *c_ptr = &cave[y][x];
693 feature_type *f_ptr = &f_info[c_ptr->feat];
695 bool obvious = FALSE;
696 bool known = player_has_los_bold(y, x);
702 /* Reduce damage by distance */
703 dam = (dam + r) / (r + 1);
706 if (have_flag(f_ptr->flags, FF_TREE))
714 message = _("枯れた", "was blasted."); break;
716 message = _("縮んだ", "shrank."); break;
718 message = _("溶けた", "melted."); break;
721 message = _("凍り、砕け散った", "was frozen and smashed."); break;
725 message = _("燃えた", "burns up!"); break;
737 message = _("粉砕された", "was crushed."); break;
739 message = NULL;break;
743 msg_format(_("木は%s。", "A tree %s"), message);
744 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
747 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
751 /* Analyze the type */
754 /* Ignore most effects */
789 /* Destroy Traps (and Locks) */
792 /* Reveal secret doors */
793 if (is_hidden_door(c_ptr))
798 /* Check line of sight */
806 if (is_trap(c_ptr->feat))
808 /* Check line of sight */
811 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
815 /* Destroy the trap */
816 cave_alter_feat(y, x, FF_DISARM);
819 /* Locked doors are unlocked */
820 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
822 s16b old_feat = c_ptr->feat;
824 /* Unlock the door */
825 cave_alter_feat(y, x, FF_DISARM);
827 /* Check line of sound */
828 if (known && (old_feat != c_ptr->feat))
830 msg_print(_("カチッと音がした!", "Click!"));
835 /* Remove "unsafe" flag if player is not blind */
836 if (!p_ptr->blind && player_has_los_bold(y, x))
838 c_ptr->info &= ~(CAVE_UNSAFE);
849 /* Destroy Doors (and traps) */
852 /* Destroy all doors and traps */
853 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
855 /* Check line of sight */
859 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
863 /* Destroy the feature */
864 cave_alter_feat(y, x, FF_TUNNEL);
867 /* Remove "unsafe" flag if player is not blind */
868 if (!p_ptr->blind && player_has_los_bold(y, x))
870 c_ptr->info &= ~(CAVE_UNSAFE);
881 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
883 if (have_flag(f_ptr->flags, FF_SPIKE))
885 s16b old_mimic = c_ptr->mimic;
886 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
888 cave_alter_feat(y, x, FF_SPIKE);
890 c_ptr->mimic = old_mimic;
898 /* Check line of sight */
899 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
902 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
909 /* Destroy walls (and doors) */
912 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
915 if (known && (c_ptr->info & (CAVE_MARK)))
917 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
921 /* Destroy the wall */
922 cave_alter_feat(y, x, FF_HURT_ROCK);
924 /* Update some things */
925 p_ptr->update |= (PU_FLOW);
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_door[DOOR_DOOR].closed);
944 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
961 /* Require a "naked" floor grid */
962 if (!cave_naked_bold(y, x)) break;
964 /* Not on the player */
965 if (player_bold(y, x)) break;
967 /* Create a closed door */
968 cave_set_feat(y, x, feat_tree);
971 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
979 /* Require a "naked" floor grid */
980 if (!cave_naked_bold(y, x)) break;
983 c_ptr->info |= CAVE_OBJECT;
984 c_ptr->mimic = feat_glyph;
997 /* Require a "naked" floor grid */
998 if (!cave_naked_bold(y, x)) break;
1000 /* Not on the player */
1001 if (player_bold(y, x)) break;
1004 cave_set_feat(y, x, feat_granite);
1012 /* Ignore permanent grid */
1013 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1018 /* Ignore grid without enough space */
1019 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1021 /* Place a shallow lava */
1022 cave_set_feat(y, x, feat_shallow_lava);
1027 /* Place a deep lava */
1028 cave_set_feat(y, x, feat_deep_lava);
1035 /* Ignore permanent grid */
1036 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1041 /* Ignore grid without enough space */
1042 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1044 /* Place a shallow water */
1045 cave_set_feat(y, x, feat_shallow_water);
1050 /* Place a deep water */
1051 cave_set_feat(y, x, feat_deep_water);
1056 /* Lite up the grid */
1060 /* Turn on the light */
1061 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1063 c_ptr->info |= (CAVE_GLOW);
1071 update_local_illumination(y, x);
1074 if (player_can_see_bold(y, x)) obvious = TRUE;
1076 /* Mega-Hack -- Update the monster in the affected grid */
1077 /* This allows "spear of light" (etc) to work "correctly" */
1078 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1080 if (p_ptr->special_defense & NINJA_S_STEALTH)
1082 if (player_bold(y, x)) set_superstealth(FALSE);
1089 /* Darken the grid */
1093 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1096 /* Turn off the light. */
1099 if (dun_level || !is_daytime())
1101 for (j = 0; j < 9; j++)
1103 int by = y + ddy_ddd[j];
1104 int bx = x + ddx_ddd[j];
1106 if (in_bounds2(by, bx))
1108 cave_type *cc_ptr = &cave[by][bx];
1110 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1118 if (!do_dark) break;
1121 c_ptr->info &= ~(CAVE_GLOW);
1123 /* Hack -- Forget "boring" grids */
1124 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1127 c_ptr->info &= ~(CAVE_MARK);
1136 update_local_illumination(y, x);
1139 if (player_can_see_bold(y, x)) obvious = TRUE;
1141 /* Mega-Hack -- Update the monster in the affected grid */
1142 /* This allows "spear of light" (etc) to work "correctly" */
1143 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1153 if (is_mirror_grid(c_ptr))
1155 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1157 remove_mirror(y, x);
1158 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1161 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1164 if (known && (c_ptr->info & CAVE_MARK))
1166 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1170 /* Destroy the wall */
1171 cave_alter_feat(y, x, FF_HURT_ROCK);
1173 /* Update some things */
1174 p_ptr->update |= (PU_FLOW);
1181 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1183 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1185 remove_mirror(y, x);
1186 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1189 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1192 if (known && (c_ptr->info & CAVE_MARK))
1194 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1198 /* Destroy the wall */
1199 cave_alter_feat(y, x, FF_HURT_ROCK);
1201 /* Update some things */
1202 p_ptr->update |= (PU_FLOW);
1207 case GF_DISINTEGRATE:
1209 /* Destroy mirror/glyph */
1210 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1211 remove_mirror(y, x);
1213 /* Permanent features don't get effect */
1214 /* But not protect monsters and other objects */
1215 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1217 cave_alter_feat(y, x, FF_HURT_DISI);
1219 /* Update some things -- similar to GF_KILL_WALL */
1220 p_ptr->update |= (PU_FLOW);
1227 /* Return "Anything seen?" */
1234 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1235 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1236 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1237 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1238 * @param x 目標X座標 / Target x location (or location to travel "towards")
1239 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1240 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1241 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1244 * We are called from "project()" to "damage" objects
1246 * We are called both for "beam" effects and "ball" effects.
1248 * Perhaps we should only SOMETIMES damage things on the ground.
1250 * The "r" parameter is the "distance from ground zero".
1252 * Note that we determine if the player can "see" anything that happens
1253 * by taking into account: blindness, line-of-sight, and illumination.
1255 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1257 * We return "TRUE" if the effect of the projection is "obvious".
1260 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1262 cave_type *c_ptr = &cave[y][x];
1264 OBJECT_IDX this_o_idx, next_o_idx = 0;
1266 bool obvious = FALSE;
1267 bool known = player_has_los_bold(y, x);
1269 BIT_FLAGS flgs[TR_FLAG_SIZE];
1271 char o_name[MAX_NLEN];
1273 KIND_OBJECT_IDX k_idx = 0;
1274 bool is_potion = FALSE;
1278 who = who ? who : 0;
1280 /* Reduce damage by distance */
1281 dam = (dam + r) / (r + 1);
1284 /* Scan all objects in the grid */
1285 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1287 /* Acquire object */
1288 object_type *o_ptr = &o_list[this_o_idx];
1290 bool is_art = FALSE;
1291 bool ignore = FALSE;
1292 bool do_kill = FALSE;
1294 cptr note_kill = NULL;
1297 /* Get the "plural"-ness */
1298 bool plural = (o_ptr->number > 1);
1301 /* Acquire next object */
1302 next_o_idx = o_ptr->next_o_idx;
1304 /* Extract the flags */
1305 object_flags(o_ptr, flgs);
1307 /* Check for artifact */
1308 if (object_is_artifact(o_ptr)) is_art = TRUE;
1310 /* Analyze the type */
1313 /* Acid -- Lots of things */
1316 if (hates_acid(o_ptr))
1319 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1320 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1325 /* Elec -- Rings and Wands */
1328 if (hates_elec(o_ptr))
1331 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1332 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1337 /* Fire -- Flammable objects */
1340 if (hates_fire(o_ptr))
1343 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1344 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1349 /* Cold -- potions and flasks */
1352 if (hates_cold(o_ptr))
1354 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1356 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1364 if (hates_fire(o_ptr))
1367 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1368 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1370 if (hates_elec(o_ptr))
1374 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1375 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1383 if (hates_fire(o_ptr))
1386 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1387 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1389 if (hates_cold(o_ptr))
1393 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1394 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1399 /* Hack -- break potions and such */
1405 if (hates_cold(o_ptr))
1407 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1413 /* Mana and Chaos -- destroy everything */
1419 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1423 case GF_DISINTEGRATE:
1426 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1433 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1434 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1435 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1439 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1443 if (object_is_cursed(o_ptr))
1446 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1453 identify_item(o_ptr);
1455 /* Auto-inscription */
1456 autopick_alter_item((-this_o_idx), FALSE);
1464 /* Chests are noticed only if trapped or locked */
1465 if (o_ptr->tval == TV_CHEST)
1467 /* Disarm/Unlock traps */
1468 if (o_ptr->pval > 0)
1470 /* Disarm or Unlock */
1471 o_ptr->pval = (0 - o_ptr->pval);
1474 object_known(o_ptr);
1477 if (known && (o_ptr->marked & OM_FOUND))
1479 msg_print(_("カチッと音がした!", "Click!"));
1489 if (o_ptr->tval == TV_CORPSE)
1492 BIT_FLAGS mode = 0L;
1494 if (!who || is_pet(&m_list[who]))
1495 mode |= PM_FORCE_PET;
1497 for (i = 0; i < o_ptr->number ; i++)
1499 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1500 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1504 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1508 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1510 note_kill = _("生き返った。", " revived.");
1512 else if (!note_kill)
1514 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1525 /* Attempt to destroy the object */
1528 /* Effect "observed" */
1529 if (known && (o_ptr->marked & OM_FOUND))
1532 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1535 /* Artifacts, and other objects, get to resist */
1536 if (is_art || ignore)
1538 /* Observe the resist */
1539 if (known && (o_ptr->marked & OM_FOUND))
1541 msg_format(_("%sは影響を受けない!",
1542 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1549 /* Describe if needed */
1550 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1552 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1555 k_idx = o_ptr->k_idx;
1556 is_potion = object_is_potion(o_ptr);
1559 /* Delete the object */
1560 delete_object_idx(this_o_idx);
1562 /* Potions produce effects when 'shattered' */
1565 (void)potion_smash_effect(who, y, x, k_idx);
1574 /* Return "Anything seen?" */
1580 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1581 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1582 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1583 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1584 * @param x 目標X座標 / Target x location (or location to travel "towards")
1585 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1586 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1588 * @param see_s_msg TRUEならばメッセージを表示する
1589 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1592 * This routine takes a "source monster" (by index) which is mostly used to
1593 * determine if the player is causing the damage, and a "radius" (see below),
1594 * which is used to decrease the power of explosions with distance, and a
1595 * location, via integers which are modified by certain types of attacks
1596 * (polymorph and teleport being the obvious ones), a default damage, which
1597 * is modified as needed based on various properties, and finally a "damage
1598 * type" (see below).
1601 * Note that this routine can handle "no damage" attacks (like teleport) by
1602 * taking a "zero" damage, and can even take "parameters" to attacks (like
1603 * confuse) by accepting a "damage", using it to calculate the effect, and
1604 * then setting the damage to zero. Note that the "damage" parameter is
1605 * divided by the radius, so monsters not at the "epicenter" will not take
1606 * as much damage (or whatever)...
1609 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1610 * may result in a dereference of an invalid pointer. XXX XXX XXX
1613 * Various messages are produced, and damage is applied.
1616 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1617 * actually be "made" of that substance, or "breathe" big balls of it.
1618 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1620 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1621 * and hurts evil less. If can breath nether, then it resists it as well.
1624 * Damage reductions use the following formulas:
1625 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1626 * gives avg damage of .655, ranging from .858 to .500
1627 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1628 * gives avg damage of .544, ranging from .714 to .417
1629 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1630 * gives avg damage of .444, ranging from .556 to .333
1631 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1632 * gives avg damage of .327, ranging from .427 to .250
1633 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1634 * gives something simple.
1637 * In this function, "result" messages are postponed until the end, where
1638 * the "note" string is appended to the monster name, if not NULL. So,
1639 * to make a spell have "no effect" just set "note" to NULL. You should
1640 * also set "notice" to FALSE, or the player will learn what the spell does.
1643 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1647 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)
1651 cave_type *c_ptr = &cave[y][x];
1653 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1654 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1656 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1660 /* Is the monster "seen"? */
1661 bool seen = m_ptr->ml;
1662 bool seen_msg = is_seen(m_ptr);
1664 bool slept = (bool)MON_CSLEEP(m_ptr);
1666 /* Were the effects "obvious" (if seen)? */
1667 bool obvious = FALSE;
1669 /* Can the player know about this effect? */
1670 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1672 /* Were the effects "irrelevant"? */
1673 bool skipped = FALSE;
1675 /* Gets the monster angry at the source of the effect? */
1676 bool get_angry = FALSE;
1678 /* Polymorph setting (true or false) */
1679 bool do_poly = FALSE;
1681 /* Teleport setting (max distance) */
1684 /* Confusion setting (amount to confuse) */
1687 /* Stunning setting (amount to stun) */
1690 /* Sleep amount (amount to sleep) */
1693 /* Fear amount (amount to fear) */
1696 /* Time amount (amount to time) */
1699 bool heal_leper = FALSE;
1701 /* Hold the monster name */
1705 PARAMETER_VALUE photo = 0;
1707 /* Assume no note */
1710 /* Assume a default death */
1711 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1716 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1719 if (!c_ptr->m_idx) return (FALSE);
1721 /* Never affect projector */
1722 if (who && (c_ptr->m_idx == who)) return (FALSE);
1723 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1724 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1726 /* Don't affect already death monsters */
1727 /* Prevents problems with chain reactions of exploding monsters */
1728 if (m_ptr->hp < 0) return (FALSE);
1730 /* Reduce damage by distance */
1731 dam = (dam + r) / (r + 1);
1734 /* Get the monster name (BEFORE polymorphing) */
1735 monster_desc(m_name, m_ptr, 0);
1737 /* Get the monster possessive ("his"/"her"/"its") */
1738 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1740 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1742 /* Analyze the damage type */
1745 /* Magic Missile -- pure damage */
1748 if (seen) obvious = TRUE;
1750 if (r_ptr->flagsr & RFR_RES_ALL)
1752 note = _("には完全な耐性がある!", " is immune.");
1754 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1763 if (seen) obvious = TRUE;
1765 if (r_ptr->flagsr & RFR_RES_ALL)
1767 note = _("には完全な耐性がある!", " is immune.");
1769 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1772 if (r_ptr->flagsr & RFR_IM_ACID)
1774 note = _("にはかなり耐性がある!", " resists a lot.");
1776 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1784 if (seen) obvious = TRUE;
1786 if (r_ptr->flagsr & RFR_RES_ALL)
1788 note = _("には完全な耐性がある!", " is immune.");
1790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1793 if (r_ptr->flagsr & RFR_IM_ELEC)
1795 note = _("にはかなり耐性がある!", " resists a lot.");
1797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
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_FIRE)
1816 note = _("にはかなり耐性がある!", " resists a lot.");
1818 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1820 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1822 note = _("はひどい痛手をうけた。", " is hit hard.");
1824 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
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_COLD)
1843 note = _("にはかなり耐性がある!", " resists a lot.");
1845 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1847 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1849 note = _("はひどい痛手をうけた。", " is hit hard.");
1851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1859 if (seen) obvious = TRUE;
1861 if (r_ptr->flagsr & RFR_RES_ALL)
1863 note = _("には完全な耐性がある!", " is immune.");
1865 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1868 if (r_ptr->flagsr & RFR_IM_POIS)
1870 note = _("にはかなり耐性がある!", " resists a lot.");
1872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1880 if (seen) obvious = TRUE;
1882 if (r_ptr->flagsr & RFR_RES_ALL)
1884 note = _("には完全な耐性がある!", " is immune.");
1886 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1889 if (r_ptr->flagsr & RFR_IM_POIS)
1891 note = _("には耐性がある。", " resists.");
1892 dam *= 3; dam /= randint1(6) + 6;
1893 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1895 else if (one_in_(3)) do_poly = TRUE;
1899 /* Hellfire -- hurts Evil */
1902 if (seen) obvious = TRUE;
1904 if (r_ptr->flagsr & RFR_RES_ALL)
1906 note = _("には完全な耐性がある!", " is immune.");
1908 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1911 if (r_ptr->flags3 & RF3_GOOD)
1913 note = _("はひどい痛手をうけた。", " is hit hard.");
1915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1920 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1923 if (seen) obvious = TRUE;
1925 if (r_ptr->flagsr & RFR_RES_ALL)
1927 note = _("には完全な耐性がある!", " is immune.");
1929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1932 if (r_ptr->flags3 & RF3_GOOD)
1934 note = _("には完全な耐性がある!", " is immune.");
1936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1938 else if (r_ptr->flags3 & RF3_EVIL)
1941 note = _("はひどい痛手をうけた。", " is hit hard.");
1942 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1946 note = _("には耐性がある。", " resists.");
1947 dam *= 3; dam /= randint1(6) + 6;
1952 /* Arrow -- XXX no defense */
1955 if (seen) obvious = TRUE;
1957 if (r_ptr->flagsr & RFR_RES_ALL)
1959 note = _("には完全な耐性がある!", " is immune.");
1961 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1967 /* Plasma -- XXX perhaps check ELEC or FIRE */
1970 if (seen) obvious = TRUE;
1972 if (r_ptr->flagsr & RFR_RES_ALL)
1974 note = _("には完全な耐性がある!", " is immune.");
1976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1979 if (r_ptr->flagsr & RFR_RES_PLAS)
1981 note = _("には耐性がある。", " resists.");
1982 dam *= 3; dam /= randint1(6) + 6;
1983 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1988 /* Nether -- see above */
1991 if (seen) obvious = TRUE;
1993 if (r_ptr->flagsr & RFR_RES_ALL)
1995 note = _("には完全な耐性がある!", " is immune.");
1997 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2000 if (r_ptr->flagsr & RFR_RES_NETH)
2002 if (r_ptr->flags3 & RF3_UNDEAD)
2004 note = _("には完全な耐性がある!", " is immune.");
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2010 note = _("には耐性がある。", " resists.");
2011 dam *= 3; dam /= randint1(6) + 6;
2013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2015 else if (r_ptr->flags3 & RF3_EVIL)
2017 note = _("はいくらか耐性を示した。", " resists somewhat.");
2019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2024 /* Water (acid) damage -- Water spirits/elementals are immune */
2027 if (seen) obvious = TRUE;
2029 if (r_ptr->flagsr & RFR_RES_ALL)
2031 note = _("には完全な耐性がある!", " is immune.");
2033 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2036 if (r_ptr->flagsr & RFR_RES_WATE)
2038 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2040 note = _("には完全な耐性がある!", " is immune.");
2045 note = _("には耐性がある。", " resists.");
2046 dam *= 3; dam /= randint1(6) + 6;
2048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2053 /* Chaos -- Chaos breathers resist */
2056 if (seen) obvious = TRUE;
2058 if (r_ptr->flagsr & RFR_RES_ALL)
2060 note = _("には完全な耐性がある!", " is immune.");
2062 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2065 if (r_ptr->flagsr & RFR_RES_CHAO)
2067 note = _("には耐性がある。", " resists.");
2068 dam *= 3; dam /= randint1(6) + 6;
2069 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2071 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2073 note = _("はいくらか耐性を示した。", " resists somewhat.");
2074 dam *= 3; dam /= randint1(6) + 6;
2075 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2080 do_conf = (5 + randint1(11) + r) / (r + 1);
2085 /* Shards -- Shard breathers resist */
2088 if (seen) obvious = TRUE;
2090 if (r_ptr->flagsr & RFR_RES_ALL)
2092 note = _("には完全な耐性がある!", " is immune.");
2094 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2097 if (r_ptr->flagsr & RFR_RES_SHAR)
2099 note = _("には耐性がある。", " resists.");
2100 dam *= 3; dam /= randint1(6) + 6;
2101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2106 /* Rocket: Shard resistance helps */
2109 if (seen) obvious = TRUE;
2111 if (r_ptr->flagsr & RFR_RES_ALL)
2113 note = _("には完全な耐性がある!", " is immune.");
2115 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2118 if (r_ptr->flagsr & RFR_RES_SHAR)
2120 note = _("はいくらか耐性を示した。", " resists somewhat.");
2122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2128 /* Sound -- Sound breathers resist */
2131 if (seen) obvious = TRUE;
2133 if (r_ptr->flagsr & RFR_RES_ALL)
2135 note = _("には完全な耐性がある!", " is immune.");
2137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2140 if (r_ptr->flagsr & RFR_RES_SOUN)
2142 note = _("には耐性がある。", " resists.");
2143 dam *= 2; dam /= randint1(6) + 6;
2144 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2146 else do_stun = (10 + randint1(15) + r) / (r + 1);
2153 if (seen) obvious = TRUE;
2155 if (r_ptr->flagsr & RFR_RES_ALL)
2157 note = _("には完全な耐性がある!", " is immune.");
2159 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2162 if (r_ptr->flags3 & RF3_NO_CONF)
2164 note = _("には耐性がある。", " resists.");
2165 dam *= 3; dam /= randint1(6) + 6;
2166 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2168 else do_conf = (10 + randint1(15) + r) / (r + 1);
2172 /* Disenchantment -- Breathers and Disenchanters resist */
2175 if (seen) obvious = TRUE;
2177 if (r_ptr->flagsr & RFR_RES_ALL)
2179 note = _("には完全な耐性がある!", " is immune.");
2181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2184 if (r_ptr->flagsr & RFR_RES_DISE)
2186 note = _("には耐性がある。", " resists.");
2187 dam *= 3; dam /= randint1(6) + 6;
2188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2193 /* Nexus -- Breathers and Existers resist */
2196 if (seen) obvious = TRUE;
2198 if (r_ptr->flagsr & RFR_RES_ALL)
2200 note = _("には完全な耐性がある!", " is immune.");
2202 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2205 if (r_ptr->flagsr & RFR_RES_NEXU)
2207 note = _("には耐性がある。", " resists.");
2208 dam *= 3; dam /= randint1(6) + 6;
2209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2217 if (seen) obvious = TRUE;
2219 if (r_ptr->flagsr & RFR_RES_ALL)
2221 note = _("には完全な耐性がある!", " is immune.");
2223 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2226 if (r_ptr->flagsr & RFR_RES_WALL)
2228 note = _("には耐性がある。", " resists.");
2229 dam *= 3; dam /= randint1(6) + 6;
2230 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2232 else do_stun = (randint1(15) + r) / (r + 1);
2236 /* Inertia -- breathers resist */
2239 if (seen) obvious = TRUE;
2241 if (r_ptr->flagsr & RFR_RES_ALL)
2243 note = _("には完全な耐性がある!", " is immune.");
2245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2248 if (r_ptr->flagsr & RFR_RES_INER)
2250 note = _("には耐性がある。", " resists.");
2251 dam *= 3; dam /= randint1(6) + 6;
2252 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2256 /* Powerful monsters can resist */
2257 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2258 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2262 /* Normal monsters slow down */
2265 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2267 note = _("の動きが遅くなった。", " starts moving slower.");
2274 /* Time -- breathers resist */
2277 if (seen) obvious = TRUE;
2279 if (r_ptr->flagsr & RFR_RES_ALL)
2281 note = _("には完全な耐性がある!", " is immune.");
2283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2286 if (r_ptr->flagsr & RFR_RES_TIME)
2288 note = _("には耐性がある。", " resists.");
2289 dam *= 3; dam /= randint1(6) + 6;
2290 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2292 else do_time = (dam + 1) / 2;
2296 /* Gravity -- breathers resist */
2299 bool resist_tele = FALSE;
2301 if (seen) obvious = TRUE;
2303 if (r_ptr->flagsr & RFR_RES_ALL)
2305 note = _("には完全な耐性がある!", " is immune.");
2307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2310 if (r_ptr->flagsr & RFR_RES_TELE)
2312 if (r_ptr->flags1 & (RF1_UNIQUE))
2314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2315 note = _("には効果がなかった。", " is unaffected!");
2318 else if (r_ptr->level > randint1(100))
2320 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2321 note = _("には耐性がある!", " resists!");
2326 if (!resist_tele) do_dist = 10;
2328 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2330 if (r_ptr->flagsr & RFR_RES_GRAV)
2332 note = _("には耐性がある!", " resists!");
2333 dam *= 3; dam /= randint1(6) + 6;
2335 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2340 /* Powerful monsters can resist */
2341 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2342 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2346 /* Normal monsters slow down */
2349 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2351 note = _("の動きが遅くなった。", " starts moving slower.");
2356 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2358 /* Attempt a saving throw */
2359 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2360 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2364 /* No obvious effect */
2365 note = _("には効果がなかった。", " is unaffected!");
2377 if (seen) obvious = TRUE;
2379 if (r_ptr->flagsr & RFR_RES_ALL)
2381 note = _("には完全な耐性がある!", " is immune.");
2383 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2391 case GF_DISINTEGRATE:
2393 if (seen) obvious = TRUE;
2395 if (r_ptr->flagsr & RFR_RES_ALL)
2397 note = _("には完全な耐性がある!", " is immune.");
2399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2402 if (r_ptr->flags3 & RF3_HURT_ROCK)
2404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2405 note = _("の皮膚がただれた!", " loses some skin!");
2406 note_dies = _("は蒸発した!", " evaporates!");
2414 if (seen) obvious = TRUE;
2416 /* PSI only works if the monster can see you! -- RG */
2417 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2420 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2425 if (r_ptr->flagsr & RFR_RES_ALL)
2427 note = _("には完全な耐性がある!", " is immune.");
2429 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2432 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2435 note = _("には完全な耐性がある!", " is immune.");
2436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2439 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2440 (r_ptr->flags3 & RF3_ANIMAL) ||
2441 (r_ptr->level > randint1(3 * dam)))
2443 note = _("には耐性がある!", " resists!");
2447 * Powerful demons & undead can turn a mindcrafter's
2448 * attacks back on them
2450 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2451 (r_ptr->level > p_ptr->lev / 2) &&
2455 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2456 (seen ? "%^s's corrupted mind backlashes your attack!" :
2457 "%^ss corrupted mind backlashes your attack!")), m_name);
2460 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2462 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2466 /* Injure +/- confusion */
2467 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2468 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2469 if (one_in_(4) && !CHECK_MULTISHADOW())
2471 switch (randint1(4))
2474 set_confused(p_ptr->confused + 3 + randint1(dam));
2477 set_stun(p_ptr->stun + randint1(dam));
2481 if (r_ptr->flags3 & RF3_NO_FEAR)
2482 note = _("には効果がなかった。", " is unaffected.");
2484 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2488 if (!p_ptr->free_act)
2489 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2498 if ((dam > 0) && one_in_(4))
2500 switch (randint1(4))
2503 do_conf = 3 + randint1(dam);
2506 do_stun = 3 + randint1(dam);
2509 do_fear = 3 + randint1(dam);
2512 note = _("は眠り込んでしまった!", " falls asleep!");
2513 do_sleep = 3 + randint1(dam);
2518 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2524 if (seen) obvious = TRUE;
2526 if (r_ptr->flagsr & RFR_RES_ALL)
2528 note = _("には完全な耐性がある!", " is immune.");
2530 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2533 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2536 note = _("には完全な耐性がある!", " is immune.");
2538 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2539 (r_ptr->flags3 & RF3_ANIMAL) ||
2540 (r_ptr->level > randint1(3 * dam)))
2542 note = _("には耐性がある!", " resists!");
2546 * Powerful demons & undead can turn a mindcrafter's
2547 * attacks back on them
2549 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2550 (r_ptr->level > p_ptr->lev / 2) &&
2554 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2555 (seen ? "%^s's corrupted mind backlashes your attack!" :
2556 "%^ss corrupted mind backlashes your attack!")), m_name);
2558 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2560 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2564 /* Injure + mana drain */
2565 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2566 if (!CHECK_MULTISHADOW())
2568 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2569 p_ptr->csp -= damroll(5, dam) / 2;
2570 if (p_ptr->csp < 0) p_ptr->csp = 0;
2571 p_ptr->redraw |= PR_MANA;
2572 p_ptr->window |= (PW_SPELL);
2574 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2581 int b = damroll(5, dam) / 4;
2582 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2583 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2584 (seen ? "You convert %s's pain into %s!" :
2585 "You convert %ss pain into %s!"));
2586 msg_format(msg, m_name, str);
2588 b = MIN(p_ptr->msp, p_ptr->csp + b);
2590 p_ptr->redraw |= PR_MANA;
2591 p_ptr->window |= (PW_SPELL);
2593 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2597 case GF_TELEKINESIS:
2599 if (seen) obvious = TRUE;
2601 if (r_ptr->flagsr & RFR_RES_ALL)
2603 note = _("には完全な耐性がある!", " is immune.");
2605 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2610 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2615 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2617 /* Attempt a saving throw */
2618 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2619 (r_ptr->level > 5 + randint1(dam)))
2623 /* No obvious effect */
2629 /* Psycho-spear -- powerful magic missile */
2632 if (seen) obvious = TRUE;
2634 if (r_ptr->flagsr & RFR_RES_ALL)
2636 note = _("には完全な耐性がある!", " is immune.");
2638 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2644 /* Meteor -- powerful magic missile */
2647 if (seen) obvious = TRUE;
2649 if (r_ptr->flagsr & RFR_RES_ALL)
2651 note = _("には完全な耐性がある!", " is immune.");
2653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2661 if (!is_hostile(m_ptr)) break;
2663 if (seen) obvious = TRUE;
2665 if (r_ptr->flagsr & RFR_RES_ALL)
2667 note = _("には効果がなかった!", " is immune.");
2669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2672 /* Attempt a saving throw */
2673 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2674 (r_ptr->flags3 & RF3_NO_CONF) ||
2675 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2677 /* Memorize a flag */
2678 if (r_ptr->flags3 & RF3_NO_CONF)
2680 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2687 * Powerful demons & undead can turn a mindcrafter's
2688 * attacks back on them
2690 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2691 (r_ptr->level > p_ptr->lev / 2) &&
2695 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2696 (seen ? "%^s's corrupted mind backlashes your attack!" :
2697 "%^ss corrupted mind backlashes your attack!")), m_name);
2700 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2702 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2706 /* Confuse, stun, terrify */
2707 switch (randint1(4))
2710 set_stun(p_ptr->stun + dam / 2);
2713 set_confused(p_ptr->confused + dam / 2);
2717 if (r_ptr->flags3 & RF3_NO_FEAR)
2718 note = _("には効果がなかった。", " is unaffected.");
2720 set_afraid(p_ptr->afraid + dam);
2727 /* No obvious effect */
2728 note = _("には効果がなかった。", " is unaffected.");
2734 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2736 note = _("があなたに隷属した。", " is in your thrall!");
2741 switch (randint1(4))
2755 /* No "real" damage */
2762 /* Ice -- Cold + Cuts + Stun */
2765 if (seen) obvious = TRUE;
2767 if (r_ptr->flagsr & RFR_RES_ALL)
2769 note = _("には完全な耐性がある!", " is immune.");
2771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2774 do_stun = (randint1(15) + 1) / (r + 1);
2775 if (r_ptr->flagsr & RFR_IM_COLD)
2777 note = _("にはかなり耐性がある!", " resists a lot.");
2779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2781 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2783 note = _("はひどい痛手をうけた。", " is hit hard.");
2785 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2792 case GF_HYPODYNAMIA:
2794 if (seen) obvious = TRUE;
2796 if (r_ptr->flagsr & RFR_RES_ALL)
2798 note = _("には完全な耐性がある!", " is immune.");
2800 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2803 if (!monster_living(r_ptr))
2805 if (is_original_ap_and_seen(m_ptr))
2807 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2808 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2809 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2811 note = _("には効果がなかった。", " is unaffected.");
2815 else do_time = (dam+7)/8;
2823 if (seen) obvious = TRUE;
2825 if (r_ptr->flagsr & RFR_RES_ALL)
2827 note = _("には完全な耐性がある!", " is immune.");
2829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2832 if (!monster_living(r_ptr))
2834 if (is_original_ap_and_seen(m_ptr))
2836 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2837 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2838 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2840 note = _("には完全な耐性がある!", " is immune.");
2844 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2845 (randint1(888) != 666)) ||
2846 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2847 randint1(100) != 66))
2849 note = _("には耐性がある!", " resists!");
2857 /* Polymorph monster (Use "dam" as "power") */
2860 if (seen) obvious = TRUE;
2862 if (r_ptr->flagsr & RFR_RES_ALL)
2864 note = _("には効果がなかった。", " is unaffected.");
2866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2869 /* Attempt to polymorph (see below) */
2872 /* Powerful monsters can resist */
2873 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2874 (r_ptr->flags1 & RF1_QUESTOR) ||
2875 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2877 note = _("には効果がなかった。", " is unaffected.");
2882 /* No "real" damage */
2889 /* Clone monsters (Ignore "dam") */
2892 if (seen) obvious = TRUE;
2894 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2896 note = _("には効果がなかった。", " is unaffected.");
2901 m_ptr->hp = m_ptr->maxhp;
2903 /* Attempt to clone. */
2904 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2906 note = _("が分裂した!", " spawns!");
2910 /* No "real" damage */
2917 /* Heal Monster (use "dam" as amount of healing) */
2920 if (seen) obvious = TRUE;
2923 (void)set_monster_csleep(c_ptr->m_idx, 0);
2925 if (m_ptr->maxhp < m_ptr->max_maxhp)
2927 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2928 m_ptr->maxhp = m_ptr->max_maxhp;
2933 /* Redraw (later) if needed */
2934 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2935 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2943 if (seen) obvious = TRUE;
2946 (void)set_monster_csleep(c_ptr->m_idx, 0);
2947 if (MON_STUNNED(m_ptr))
2949 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2950 (void)set_monster_stunned(c_ptr->m_idx, 0);
2952 if (MON_CONFUSED(m_ptr))
2954 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2955 (void)set_monster_confused(c_ptr->m_idx, 0);
2957 if (MON_MONFEAR(m_ptr))
2959 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2960 (void)set_monster_monfear(c_ptr->m_idx, 0);
2964 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2967 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2971 chg_virtue(V_VITALITY, 1);
2973 if (r_ptr->flags1 & RF1_UNIQUE)
2974 chg_virtue(V_INDIVIDUALISM, 1);
2976 if (is_friendly(m_ptr))
2977 chg_virtue(V_HONOUR, 1);
2978 else if (!(r_ptr->flags3 & RF3_EVIL))
2980 if (r_ptr->flags3 & RF3_GOOD)
2981 chg_virtue(V_COMPASSION, 2);
2983 chg_virtue(V_COMPASSION, 1);
2986 if (r_ptr->flags3 & RF3_ANIMAL)
2987 chg_virtue(V_NATURE, 1);
2990 if (m_ptr->r_idx == MON_LEPER)
2993 if (!who) chg_virtue(V_COMPASSION, 5);
2996 /* Redraw (later) if needed */
2997 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2998 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3001 note = _("は体力を回復したようだ。", " looks healthier.");
3003 /* No "real" damage */
3009 /* Speed Monster (Ignore "dam") */
3012 if (seen) obvious = TRUE;
3015 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3017 note = _("の動きが速くなった。", " starts moving faster.");
3022 if (r_ptr->flags1 & RF1_UNIQUE)
3023 chg_virtue(V_INDIVIDUALISM, 1);
3024 if (is_friendly(m_ptr))
3025 chg_virtue(V_HONOUR, 1);
3028 /* No "real" damage */
3034 /* Slow Monster (Use "dam" as "power") */
3037 if (seen) obvious = TRUE;
3039 if (r_ptr->flagsr & RFR_RES_ALL)
3041 note = _("には効果がなかった。", " is unaffected.");
3043 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3046 /* Powerful monsters can resist */
3047 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3048 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3050 note = _("には効果がなかった。", " is unaffected.");
3054 /* Normal monsters slow down */
3057 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3059 note = _("の動きが遅くなった。", " starts moving slower.");
3063 /* No "real" damage */
3069 /* Sleep (Use "dam" as "power") */
3072 if (seen) obvious = TRUE;
3074 if (r_ptr->flagsr & RFR_RES_ALL)
3076 note = _("には効果がなかった。", " is unaffected.");
3078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3081 /* Attempt a saving throw */
3082 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3083 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3084 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3086 /* Memorize a flag */
3087 if (r_ptr->flags3 & RF3_NO_SLEEP)
3089 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3091 /* No obvious effect */
3092 note = _("には効果がなかった。", " is unaffected.");
3097 /* Go to sleep (much) later */
3098 note = _("は眠り込んでしまった!", " falls asleep!");
3102 /* No "real" damage */
3108 /* Sleep (Use "dam" as "power") */
3109 case GF_STASIS_EVIL:
3111 if (seen) obvious = TRUE;
3113 if (r_ptr->flagsr & RFR_RES_ALL)
3115 note = _("には効果がなかった!", " is immune.");
3117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3120 /* Attempt a saving throw */
3121 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3122 !(r_ptr->flags3 & RF3_EVIL) ||
3123 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3125 note = _("には効果がなかった。", " is unaffected.");
3130 /* Go to sleep (much) later */
3131 note = _("は動けなくなった!", " is suspended!");
3135 /* No "real" damage */
3140 /* Sleep (Use "dam" as "power") */
3143 if (seen) obvious = TRUE;
3145 if (r_ptr->flagsr & RFR_RES_ALL)
3147 note = _("には効果がなかった。", " is unaffected.");
3149 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3152 /* Attempt a saving throw */
3153 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3154 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3156 note = _("には効果がなかった。", " is unaffected.");
3161 /* Go to sleep (much) later */
3162 note = _("は動けなくなった!", " is suspended!");
3166 /* No "real" damage */
3175 vir = virtue_number(V_HARMONY);
3178 dam += p_ptr->virtues[vir-1]/10;
3181 vir = virtue_number(V_INDIVIDUALISM);
3184 dam -= p_ptr->virtues[vir-1]/20;
3187 if (seen) obvious = TRUE;
3189 /* Attempt a saving throw */
3190 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3194 /* No obvious effect */
3195 note = _("には効果がなかった。", " is unaffected.");
3198 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3200 else if (p_ptr->cursed & TRC_AGGRAVATE)
3202 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3203 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3207 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3210 chg_virtue(V_INDIVIDUALISM, -1);
3211 if (r_ptr->flags3 & RF3_ANIMAL)
3212 chg_virtue(V_NATURE, 1);
3215 /* No "real" damage */
3220 /* Control undead */
3221 case GF_CONTROL_UNDEAD:
3224 if (seen) obvious = TRUE;
3226 vir = virtue_number(V_UNLIFE);
3229 dam += p_ptr->virtues[vir-1]/10;
3232 vir = virtue_number(V_INDIVIDUALISM);
3235 dam -= p_ptr->virtues[vir-1]/20;
3238 /* Attempt a saving throw */
3239 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3240 !(r_ptr->flags3 & RF3_UNDEAD))
3242 /* No obvious effect */
3243 note = _("には効果がなかった。", " is unaffected.");
3245 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3247 else if (p_ptr->cursed & TRC_AGGRAVATE)
3249 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3250 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3254 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3258 /* No "real" damage */
3264 case GF_CONTROL_DEMON:
3267 if (seen) obvious = TRUE;
3269 vir = virtue_number(V_UNLIFE);
3272 dam += p_ptr->virtues[vir-1]/10;
3275 vir = virtue_number(V_INDIVIDUALISM);
3278 dam -= p_ptr->virtues[vir-1]/20;
3281 /* Attempt a saving throw */
3282 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3283 !(r_ptr->flags3 & RF3_DEMON))
3285 /* No obvious effect */
3286 note = _("には効果がなかった。", " is unaffected.");
3288 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3290 else if (p_ptr->cursed & TRC_AGGRAVATE)
3292 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3293 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3297 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3301 /* No "real" damage */
3307 case GF_CONTROL_ANIMAL:
3310 if (seen) obvious = TRUE;
3312 vir = virtue_number(V_NATURE);
3315 dam += p_ptr->virtues[vir-1]/10;
3318 vir = virtue_number(V_INDIVIDUALISM);
3321 dam -= p_ptr->virtues[vir-1]/20;
3324 /* Attempt a saving throw */
3325 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3326 !(r_ptr->flags3 & RF3_ANIMAL))
3329 /* No obvious effect */
3330 note = _("には効果がなかった。", " is unaffected.");
3332 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3334 else if (p_ptr->cursed & TRC_AGGRAVATE)
3336 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3337 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3341 note = _("はなついた。", " is tamed!");
3343 if (r_ptr->flags3 & RF3_ANIMAL)
3344 chg_virtue(V_NATURE, 1);
3347 /* No "real" damage */
3353 case GF_CHARM_LIVING:
3357 vir = virtue_number(V_UNLIFE);
3358 if (seen) obvious = TRUE;
3360 vir = virtue_number(V_UNLIFE);
3363 dam -= p_ptr->virtues[vir-1]/10;
3366 vir = virtue_number(V_INDIVIDUALISM);
3369 dam -= p_ptr->virtues[vir-1]/20;
3372 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3374 /* Attempt a saving throw */
3375 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3376 !monster_living(r_ptr))
3379 /* No obvious effect */
3380 note = _("には効果がなかった。", " is unaffected.");
3382 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3384 else if (p_ptr->cursed & TRC_AGGRAVATE)
3386 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3387 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3391 note = _("を支配した。", " is tamed!");
3393 if (r_ptr->flags3 & RF3_ANIMAL)
3394 chg_virtue(V_NATURE, 1);
3397 /* No "real" damage */
3402 /* Confusion (Use "dam" as "power") */
3405 if (seen) obvious = TRUE;
3407 if (r_ptr->flagsr & RFR_RES_ALL)
3409 note = _("には効果がなかった。", " is unaffected.");
3411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3414 /* Get confused later */
3415 do_conf = damroll(3, (dam / 2)) + 1;
3417 /* Attempt a saving throw */
3418 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3419 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3420 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3422 /* Memorize a flag */
3423 if (r_ptr->flags3 & (RF3_NO_CONF))
3425 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3431 /* No obvious effect */
3432 note = _("には効果がなかった。", " is unaffected.");
3436 /* No "real" damage */
3443 if (seen) obvious = TRUE;
3445 if (r_ptr->flagsr & RFR_RES_ALL)
3447 note = _("には効果がなかった。", " is unaffected.");
3449 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3452 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3454 /* Attempt a saving throw */
3455 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3456 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3461 /* No obvious effect */
3462 note = _("には効果がなかった。", " is unaffected.");
3466 /* No "real" damage */
3474 /* Lite, but only hurts susceptible creatures */
3482 if (r_ptr->flagsr & RFR_RES_ALL)
3488 if (r_ptr->flags3 & (RF3_HURT_LITE))
3490 /* Obvious effect */
3491 if (seen) obvious = TRUE;
3493 /* Memorize the effects */
3494 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3496 /* Special effect */
3497 note = _("は光に身をすくめた!", " cringes from the light!");
3498 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3501 /* Normally no damage */
3513 /* Lite -- opposite of Dark */
3516 if (seen) obvious = TRUE;
3518 if (r_ptr->flagsr & RFR_RES_ALL)
3520 note = _("には完全な耐性がある!", " is immune.");
3522 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3525 if (r_ptr->flagsr & RFR_RES_LITE)
3527 note = _("には耐性がある!", " resists!");
3528 dam *= 2; dam /= (randint1(6)+6);
3529 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3531 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3533 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3534 note = _("は光に身をすくめた!", " cringes from the light!");
3535 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3542 /* Dark -- opposite of Lite */
3545 if (seen) obvious = TRUE;
3547 if (r_ptr->flagsr & RFR_RES_ALL)
3549 note = _("には完全な耐性がある!", " is immune.");
3551 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3554 if (r_ptr->flagsr & RFR_RES_DARK)
3556 note = _("には耐性がある!", " resists!");
3557 dam *= 2; dam /= (randint1(6)+6);
3558 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3567 if (r_ptr->flagsr & RFR_RES_ALL)
3572 /* Hurt by rock remover */
3573 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3576 if (seen) obvious = TRUE;
3578 /* Memorize the effects */
3579 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3581 /* Cute little message */
3582 note = _("の皮膚がただれた!", " loses some skin!");
3583 note_dies = _("はドロドロに溶けた!", " dissolves!");
3586 /* Usually, ignore the effects */
3597 /* Teleport undead (Use "dam" as "power") */
3598 case GF_AWAY_UNDEAD:
3600 /* Only affect undead */
3601 if (r_ptr->flags3 & (RF3_UNDEAD))
3603 bool resists_tele = FALSE;
3605 if (r_ptr->flagsr & RFR_RES_TELE)
3607 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3609 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3610 note = _("には効果がなかった。", " is unaffected.");
3611 resists_tele = TRUE;
3613 else if (r_ptr->level > randint1(100))
3615 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3616 note = _("には耐性がある!", " resists!");
3617 resists_tele = TRUE;
3623 if (seen) obvious = TRUE;
3624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3636 /* No "real" damage */
3642 /* Teleport evil (Use "dam" as "power") */
3645 /* Only affect evil */
3646 if (r_ptr->flags3 & (RF3_EVIL))
3648 bool resists_tele = FALSE;
3650 if (r_ptr->flagsr & RFR_RES_TELE)
3652 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3654 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3655 note = _("には効果がなかった。", " is unaffected.");
3656 resists_tele = TRUE;
3658 else if (r_ptr->level > randint1(100))
3660 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3661 note = _("には耐性がある!", " resists!");
3662 resists_tele = TRUE;
3668 if (seen) obvious = TRUE;
3669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3681 /* No "real" damage */
3687 /* Teleport monster (Use "dam" as "power") */
3690 bool resists_tele = FALSE;
3691 if (r_ptr->flagsr & RFR_RES_TELE)
3693 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3695 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3696 note = _("には効果がなかった。", " is unaffected.");
3697 resists_tele = TRUE;
3699 else if (r_ptr->level > randint1(100))
3701 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3702 note = _("には耐性がある!", " resists!");
3703 resists_tele = TRUE;
3710 if (seen) obvious = TRUE;
3712 /* Prepare to teleport */
3716 /* No "real" damage */
3722 /* Turn undead (Use "dam" as "power") */
3723 case GF_TURN_UNDEAD:
3725 if (r_ptr->flagsr & RFR_RES_ALL)
3730 /* Only affect undead */
3731 if (r_ptr->flags3 & (RF3_UNDEAD))
3734 if (seen) obvious = TRUE;
3736 /* Learn about type */
3737 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3739 /* Apply some fear */
3740 do_fear = damroll(3, (dam / 2)) + 1;
3742 /* Attempt a saving throw */
3743 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3745 /* No obvious effect */
3746 note = _("には効果がなかった。", " is unaffected.");
3759 /* No "real" damage */
3765 /* Turn evil (Use "dam" as "power") */
3768 if (r_ptr->flagsr & RFR_RES_ALL)
3773 /* Only affect evil */
3774 if (r_ptr->flags3 & (RF3_EVIL))
3777 if (seen) obvious = TRUE;
3779 /* Learn about type */
3780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3782 /* Apply some fear */
3783 do_fear = damroll(3, (dam / 2)) + 1;
3785 /* Attempt a saving throw */
3786 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3788 /* No obvious effect */
3789 note = _("には効果がなかった。", " is unaffected.");
3802 /* No "real" damage */
3808 /* Turn monster (Use "dam" as "power") */
3811 if (r_ptr->flagsr & RFR_RES_ALL)
3817 if (seen) obvious = TRUE;
3819 /* Apply some fear */
3820 do_fear = damroll(3, (dam / 2)) + 1;
3822 /* Attempt a saving throw */
3823 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3824 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3825 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3827 /* No obvious effect */
3828 note = _("には効果がなかった。", " is unaffected.");
3833 /* No "real" damage */
3840 case GF_DISP_UNDEAD:
3842 if (r_ptr->flagsr & RFR_RES_ALL)
3848 /* Only affect undead */
3849 if (r_ptr->flags3 & (RF3_UNDEAD))
3852 if (seen) obvious = TRUE;
3854 /* Learn about type */
3855 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3858 note = _("は身震いした。", " shudders.");
3859 note_dies = _("はドロドロに溶けた!", " dissolves!");
3879 if (r_ptr->flagsr & RFR_RES_ALL)
3885 /* Only affect evil */
3886 if (r_ptr->flags3 & (RF3_EVIL))
3889 if (seen) obvious = TRUE;
3891 /* Learn about type */
3892 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3895 note = _("は身震いした。", " shudders.");
3896 note_dies = _("はドロドロに溶けた!", " dissolves!");
3915 if (r_ptr->flagsr & RFR_RES_ALL)
3921 /* Only affect good */
3922 if (r_ptr->flags3 & (RF3_GOOD))
3925 if (seen) obvious = TRUE;
3927 /* Learn about type */
3928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3931 note = _("は身震いした。", " shudders.");
3932 note_dies = _("はドロドロに溶けた!", " dissolves!");
3949 case GF_DISP_LIVING:
3951 if (r_ptr->flagsr & RFR_RES_ALL)
3957 /* Only affect non-undead */
3958 if (monster_living(r_ptr))
3961 if (seen) obvious = TRUE;
3964 note = _("は身震いした。", " shudders.");
3965 note_dies = _("はドロドロに溶けた!", " dissolves!");
3984 if (r_ptr->flagsr & RFR_RES_ALL)
3990 /* Only affect demons */
3991 if (r_ptr->flags3 & (RF3_DEMON))
3994 if (seen) obvious = TRUE;
3996 /* Learn about type */
3997 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4000 note = _("は身震いした。", " shudders.");
4001 note_dies = _("はドロドロに溶けた!", " dissolves!");
4017 /* Dispel monster */
4020 if (r_ptr->flagsr & RFR_RES_ALL)
4027 if (seen) obvious = TRUE;
4030 note = _("は身震いした。", " shudders.");
4031 note_dies = _("はドロドロに溶けた!", " dissolves!");
4038 if (seen) obvious = TRUE;
4040 if (r_ptr->flagsr & RFR_RES_ALL)
4042 note = _("には完全な耐性がある!", " is immune.");
4044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4048 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4052 /* Heal the monster */
4053 if (caster_ptr->hp < caster_ptr->maxhp)
4056 caster_ptr->hp += dam;
4057 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4059 /* Redraw (later) if needed */
4060 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4061 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4063 /* Special message */
4066 /* Get the monster name */
4067 monster_desc(killer, caster_ptr, 0);
4068 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4075 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4076 (void)hp_player(dam);
4081 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4090 if (seen) obvious = TRUE;
4092 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4094 if (r_ptr->flagsr & RFR_RES_ALL)
4096 note = _("には完全な耐性がある!", " is immune.");
4098 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4102 /* Attempt a saving throw */
4103 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4104 (r_ptr->flags3 & RF3_NO_CONF) ||
4105 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4107 /* Memorize a flag */
4108 if (r_ptr->flags3 & (RF3_NO_CONF))
4110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4112 note = _("には効果がなかった。", " is unaffected.");
4115 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4118 note = _("には完全な耐性がある!", " is immune.");
4121 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4124 note = _("には耐性がある。", " resists.");
4129 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4130 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4132 if (who > 0) do_conf = randint0(4) + 4;
4133 else do_conf = randint0(8) + 8;
4139 case GF_BRAIN_SMASH:
4141 if (seen) obvious = TRUE;
4143 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4145 if (r_ptr->flagsr & RFR_RES_ALL)
4147 note = _("には完全な耐性がある!", " is immune.");
4149 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4153 /* Attempt a saving throw */
4154 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4155 (r_ptr->flags3 & RF3_NO_CONF) ||
4156 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4158 /* Memorize a flag */
4159 if (r_ptr->flags3 & (RF3_NO_CONF))
4161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4163 note = _("には効果がなかった。", " is unaffected.");
4166 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4169 note = _("には完全な耐性がある!", " is immune.");
4172 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4175 note = _("には耐性がある!", " resists!");
4180 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4181 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4185 do_conf = randint0(4) + 4;
4186 do_stun = randint0(4) + 4;
4190 do_conf = randint0(8) + 8;
4191 do_stun = randint0(8) + 8;
4193 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4201 if (seen) obvious = TRUE;
4203 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4205 if (r_ptr->flagsr & RFR_RES_ALL)
4207 note = _("には完全な耐性がある!", " is immune.");
4209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4213 /* Attempt a saving throw */
4214 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4216 note = _("には効果がなかった。", " is unaffected.");
4225 if (seen) obvious = TRUE;
4227 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4229 if (r_ptr->flagsr & RFR_RES_ALL)
4231 note = _("には完全な耐性がある!", " is immune.");
4233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4237 /* Attempt a saving throw */
4238 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4240 note = _("には効果がなかった。", " is unaffected.");
4249 if (seen) obvious = TRUE;
4251 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4253 if (r_ptr->flagsr & RFR_RES_ALL)
4255 note = _("には完全な耐性がある!", " is immune.");
4257 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4261 /* Attempt a saving throw */
4262 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4264 note = _("には効果がなかった。", " is unaffected.");
4273 if (seen) obvious = TRUE;
4276 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4277 "You point at %s, screaming the word, 'DIE!'."), m_name);
4279 if (r_ptr->flagsr & RFR_RES_ALL)
4281 note = _("には完全な耐性がある!", " is immune.");
4283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4287 /* Attempt a saving throw */
4288 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4290 note = _("には効果がなかった。", " is unaffected.");
4299 if (seen) obvious = TRUE;
4301 if (r_ptr->flagsr & RFR_RES_ALL)
4303 note = _("には完全な耐性がある!", " is immune.");
4305 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4309 if (r_ptr->flags1 & RF1_UNIQUE)
4311 note = _("には効果がなかった。", " is unaffected.");
4316 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4317 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4319 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4321 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4325 note = _("は耐性を持っている!", "resists!");
4332 /* Capture monster */
4336 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4337 (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)
4339 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4344 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4345 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4346 nokori_hp = m_ptr->maxhp * 3 / 10;
4348 nokori_hp = m_ptr->maxhp * 3 / 20;
4350 if (m_ptr->hp >= nokori_hp)
4352 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4355 else if (m_ptr->hp < randint0(nokori_hp))
4357 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4358 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4359 cap_mon = m_ptr->r_idx;
4360 cap_mspeed = m_ptr->mspeed;
4362 cap_maxhp = m_ptr->max_maxhp;
4363 cap_nickname = m_ptr->nickname; /* Quark transfer */
4364 if (c_ptr->m_idx == p_ptr->riding)
4366 if (rakuba(-1, FALSE))
4368 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4372 delete_monster_idx(c_ptr->m_idx);
4378 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4384 /* Attack (Use "dam" as attack type) */
4387 /* Return this monster's death */
4388 return py_attack(y, x, dam);
4391 /* Sleep (Use "dam" as "power") */
4397 if (seen) obvious = TRUE;
4399 if (r_ptr->flagsr & RFR_RES_ALL)
4401 note = _("には効果がなかった。", " is unaffected.");
4403 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4406 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4408 note = _("には効果がなかった。", " is unaffected.");
4411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4414 if (MON_CSLEEP(m_ptr))
4416 note = _("には効果がなかった。", " is unaffected.");
4422 if (one_in_(5)) effect = 1;
4423 else if (one_in_(4)) effect = 2;
4424 else if (one_in_(3)) effect = 3;
4429 /* Powerful monsters can resist */
4430 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4431 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4433 note = _("には効果がなかった。", " is unaffected.");
4437 /* Normal monsters slow down */
4440 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4442 note = _("の動きが遅くなった。", " starts moving slower.");
4447 else if (effect == 2)
4449 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4451 /* Attempt a saving throw */
4452 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4453 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4458 /* No obvious effect */
4459 note = _("には効果がなかった。", " is unaffected.");
4464 else if (effect == 3)
4466 /* Attempt a saving throw */
4467 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4468 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4469 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4471 /* Memorize a flag */
4472 if (r_ptr->flags3 & RF3_NO_SLEEP)
4474 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4477 /* No obvious effect */
4478 note = _("には効果がなかった。", " is unaffected.");
4483 /* Go to sleep (much) later */
4484 note = _("は眠り込んでしまった!", " falls asleep!");
4491 note = _("には効果がなかった。", " is unaffected.");
4494 /* No "real" damage */
4502 if (seen) obvious = TRUE;
4504 if (r_ptr->flagsr & RFR_RES_ALL)
4506 note = _("には効果がなかった。", " is unaffected.");
4508 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4512 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4514 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4515 chg_virtue(V_VITALITY, -1);
4525 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4527 if (r_ptr->flags3 & (RF3_HURT_LITE))
4529 /* Obvious effect */
4530 if (seen) obvious = TRUE;
4532 /* Memorize the effects */
4533 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4535 /* Special effect */
4536 note = _("は光に身をすくめた!", " cringes from the light!");
4537 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4540 /* Normally no damage */
4547 photo = m_ptr->r_idx;
4554 case GF_BLOOD_CURSE:
4556 if (seen) obvious = TRUE;
4558 if (r_ptr->flagsr & RFR_RES_ALL)
4560 note = _("には完全な耐性がある!", " is immune.");
4562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4570 bool success = FALSE;
4571 if (seen) obvious = TRUE;
4573 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4575 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4576 if (dam < 1) dam = 1;
4578 /* No need to tame your pet */
4581 note = _("の動きが速くなった。", " starts moving faster.");
4582 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4586 /* Attempt a saving throw */
4587 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4588 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4589 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4590 (p_ptr->cursed & TRC_AGGRAVATE) ||
4591 ((r_ptr->level+10) > randint1(dam)))
4594 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4598 note = _("を支配した。", " is tamed!");
4600 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4602 /* Learn about type */
4603 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4610 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4612 do_fear = randint1(90)+10;
4614 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4617 /* No "real" damage */
4624 if (seen) obvious = TRUE;
4626 if (r_ptr->flagsr & RFR_RES_ALL)
4628 note = _("には完全な耐性がある!", " is immune.");
4630 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4634 /* Attempt a saving throw */
4635 if (randint0(100 + dam) < (r_ptr->level + 50))
4637 note = _("には効果がなかった。", " is unaffected.");
4657 /* Absolutely no effect */
4658 if (skipped) return (FALSE);
4660 /* "Unique" monsters cannot be polymorphed */
4661 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4663 /* Quest monsters cannot be polymorphed */
4664 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4666 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4668 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4669 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4671 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4676 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4677 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4680 /* Modify the damage */
4682 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4683 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4685 /* Check for death */
4686 if (dam > m_ptr->hp)
4688 /* Extract method of death */
4693 /* Sound and Impact resisters never stun */
4695 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4696 !(r_ptr->flags3 & RF3_NO_STUN))
4699 if (seen) obvious = TRUE;
4702 if (MON_STUNNED(m_ptr))
4704 note = _("はひどくもうろうとした。", " is more dazed.");
4705 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4709 note = _("はもうろうとした。", " is dazed.");
4714 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4720 /* Confusion and Chaos resisters (and sleepers) never confuse */
4722 !(r_ptr->flags3 & RF3_NO_CONF) &&
4723 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4726 if (seen) obvious = TRUE;
4728 /* Already partially confused */
4729 if (MON_CONFUSED(m_ptr))
4731 note = _("はさらに混乱したようだ。", " looks more confused.");
4732 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4735 /* Was not confused */
4738 note = _("は混乱したようだ。", " looks confused.");
4742 /* Apply confusion */
4743 (void)set_monster_confused(c_ptr->m_idx, tmp);
4752 if (seen) obvious = TRUE;
4754 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4758 note = _("は弱くなったようだ。", " seems weakened.");
4759 m_ptr->maxhp -= do_time;
4760 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4765 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4766 if (do_poly && (randint1(90) > r_ptr->level))
4768 if (polymorph_monster(y, x))
4771 if (seen) obvious = TRUE;
4773 /* Monster polymorphs */
4774 note = _("が変身した!", " changes!");
4776 /* Turn off the damage */
4782 note = _("には効果がなかった。", " is unaffected.");
4785 /* Hack -- Get new monster */
4786 m_ptr = &m_list[c_ptr->m_idx];
4788 /* Hack -- Get new race */
4789 r_ptr = &r_info[m_ptr->r_idx];
4792 /* Handle "teleport" */
4796 if (seen) obvious = TRUE;
4799 note = _("が消え去った!", " disappears!");
4801 if (!who) chg_virtue(V_VALOUR, -1);
4804 teleport_away(c_ptr->m_idx, do_dist,
4805 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4807 /* Hack -- get new location */
4811 /* Hack -- get new grid */
4812 c_ptr = &cave[y][x];
4819 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4826 if (typ == GF_DRAIN_MANA)
4828 /* Drain mana does nothing */
4831 /* If another monster did the damage, hurt the monster by hand */
4834 /* Redraw (later) if needed */
4835 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4836 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4838 /* Wake the monster up */
4839 (void)set_monster_csleep(c_ptr->m_idx, 0);
4841 /* Hurt the monster */
4849 if (is_pet(m_ptr) && !(m_ptr->ml))
4852 /* Give detailed messages if destroyed */
4855 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4858 msg_format("%^s%s", m_name, note);
4866 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4868 /* Generate treasure, etc */
4869 monster_death(c_ptr->m_idx, FALSE);
4871 /* Delete the monster */
4872 delete_monster_idx(c_ptr->m_idx);
4876 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4880 /* Damaged monster */
4883 /* Give detailed messages if visible or destroyed */
4884 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4886 /* Hack -- Pain message */
4889 message_pain(c_ptr->m_idx, dam);
4896 /* Hack -- handle sleep */
4897 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4901 else if (heal_leper)
4903 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4905 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4909 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4910 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4913 delete_monster_idx(c_ptr->m_idx);
4916 /* If the player did it, give him experience, check fear */
4921 /* Hurt the monster, check for fear and death */
4922 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4927 /* Damaged monster */
4930 /* HACK - anger the monster before showing the sleep message */
4931 if (do_sleep) anger_monster(m_ptr);
4933 /* Give detailed messages if visible or destroyed */
4934 if (note && seen_msg)
4935 msg_format(_("%s%s", "%^s%s"), m_name, note);
4937 /* Hack -- Pain message */
4938 else if (known && (dam || !do_fear))
4940 message_pain(c_ptr->m_idx, dam);
4943 /* Anger monsters */
4944 if (((dam > 0) || get_angry) && !do_sleep)
4945 anger_monster(m_ptr);
4948 if ((fear || do_fear) && seen)
4954 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4957 /* Hack -- handle sleep */
4958 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4962 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4964 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4968 switch (randint1(28))
4973 msg_print(_("地面が揺れた...", "The ground trembles..."));
4974 earthquake(ty, tx, 4 + randint0(4));
4975 if (!one_in_(6)) break;
4977 case 3: case 4: case 5: case 6:
4980 int extra_dam = damroll(10, 10);
4981 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4983 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4984 if (!one_in_(6)) break;
4989 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4991 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4992 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4993 if (!one_in_(6)) break;
4995 case 9: case 10: case 11:
4996 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4997 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4998 if (!one_in_(6)) break;
4999 case 12: case 13: case 14: case 15: case 16:
5000 aggravate_monsters(0);
5001 if (!one_in_(6)) break;
5003 count += activate_hi_summon(ty, tx, TRUE);
5004 if (!one_in_(6)) break;
5005 case 19: case 20: case 21: case 22:
5007 bool pet = !one_in_(3);
5008 BIT_FLAGS mode = PM_ALLOW_GROUP;
5010 if (pet) mode |= PM_FORCE_PET;
5011 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5013 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);
5014 if (!one_in_(6)) break;
5016 case 23: case 24: case 25:
5017 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5018 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5020 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5021 else lose_exp(p_ptr->exp / 16);
5022 if (!one_in_(6)) break;
5023 case 26: case 27: case 28:
5032 (void)do_dec_stat(i);
5041 (void)do_dec_stat(randint0(6));
5050 if (p_ptr->inside_battle)
5052 p_ptr->health_who = c_ptr->m_idx;
5053 p_ptr->redraw |= (PR_HEALTH);
5057 /* XXX XXX XXX Verify this code */
5059 /* Update the monster */
5060 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5062 /* Redraw the monster grid */
5066 /* Update monster recall window */
5067 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5070 p_ptr->window |= (PW_MONSTER);
5073 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5077 if (!(flg & PROJECT_NO_HANGEKI))
5079 set_target(m_ptr, monster_target_y, monster_target_x);
5082 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5084 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5088 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5090 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5091 rakubadam_m = (dam > 200) ? 200 : dam;
5100 /* Get local object */
5103 /* Prepare to make a Blade of Chaos */
5104 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5106 q_ptr->pval = photo;
5108 /* Mark the item as fully known */
5109 q_ptr->ident |= (IDENT_MENTAL);
5111 /* Drop it in the dungeon */
5112 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5120 /* Return "Anything seen?" */
5125 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5126 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5127 * @param who_name 効果を起こしたモンスターの名前
5128 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5129 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5130 * @param x 目標X座標 / Target x location (or location to travel "towards")
5131 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5132 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5134 * @param monspell 効果元のモンスター魔法ID
5135 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5137 * Handle a beam/bolt/ball causing damage to the player.
5138 * This routine takes a "source monster" (by index), a "distance", a default
5139 * "damage", and a "damage type". See "project_m()" above.
5140 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5141 * is reduced (see "project_m()" above). This can happen if a monster breathes
5142 * at the player and hits a wall instead.
5143 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5144 * to know if this is actually a ball or a bolt spell
5145 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5146 * we just assume that the effects were obvious, for historical reasons.
5148 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)
5153 /* Hack -- assume obvious */
5154 bool obvious = TRUE;
5156 /* Player blind-ness */
5157 bool blind = (p_ptr->blind ? TRUE : FALSE);
5159 /* Player needs a "description" (he is blind) */
5162 /* Source monster */
5163 monster_type *m_ptr = NULL;
5165 /* Monster name (for attacks) */
5168 /* Monster name (for damage) */
5171 /* Hack -- messages */
5177 /* Player is not here */
5178 if (!player_bold(y, x)) return (FALSE);
5180 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5182 if (kawarimi(TRUE)) return FALSE;
5185 /* Player cannot hurt himself */
5186 if (!who) return (FALSE);
5187 if (who == p_ptr->riding) return (FALSE);
5189 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5192 int max_attempts = 10;
5193 sound(SOUND_REFLECT);
5196 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5197 else if (p_ptr->special_defense & KATA_FUUJIN)
5198 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5200 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5203 /* Choose 'new' target */
5208 t_y = m_list[who].fy - 1 + randint1(3);
5209 t_x = m_list[who].fx - 1 + randint1(3);
5212 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5214 if (max_attempts < 1)
5216 t_y = m_list[who].fy;
5217 t_x = m_list[who].fx;
5222 t_y = p_ptr->y - 1 + randint1(3);
5223 t_x = p_ptr->x - 1 + randint1(3);
5226 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5233 /* Limit maximum damage */
5234 if (dam > 1600) dam = 1600;
5236 /* Reduce damage by distance */
5237 dam = (dam + r) / (r + 1);
5240 /* If the player is blind, be more descriptive */
5241 if (blind) fuzzy = TRUE;
5246 /* Get the source monster */
5247 m_ptr = &m_list[who];
5248 /* Extract the monster level */
5249 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5251 /* Get the monster name */
5252 monster_desc(m_name, m_ptr, 0);
5254 /* Get the monster's real name (gotten before polymorph!) */
5255 strcpy(killer, who_name);
5261 case PROJECT_WHO_UNCTRL_POWER:
5262 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5265 case PROJECT_WHO_GLASS_SHARDS:
5266 strcpy(killer, _("ガラスの破片", "shards of glass"));
5270 strcpy(killer, _("罠", "a trap"));
5275 strcpy(m_name, killer);
5278 /* Analyze the damage */
5281 /* Standard damage -- hurts inventory too */
5284 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5285 get_damage = acid_dam(dam, killer, monspell, FALSE);
5289 /* Standard damage -- hurts inventory too */
5292 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5293 get_damage = fire_dam(dam, killer, monspell, FALSE);
5297 /* Standard damage -- hurts inventory too */
5300 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5301 get_damage = cold_dam(dam, killer, monspell, FALSE);
5305 /* Standard damage -- hurts inventory too */
5308 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5309 get_damage = elec_dam(dam, killer, monspell, FALSE);
5313 /* Standard damage -- also poisons player */
5316 bool double_resist = IS_OPPOSE_POIS();
5317 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5319 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5320 if (double_resist) dam = (dam + 2) / 3;
5322 if ((!(double_resist || p_ptr->resist_pois)) &&
5323 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5328 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5330 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5332 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5337 /* Standard damage -- also poisons / mutates player */
5340 bool double_resist = IS_OPPOSE_POIS();
5341 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5343 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5344 if (double_resist) dam = (2 * dam + 2) / 5;
5345 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5346 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5348 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5350 if (one_in_(5)) /* 6 */
5352 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5353 if (one_in_(4)) /* 4 */
5361 inven_damage(set_acid_destroy, 2);
5367 /* Standard damage */
5370 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5371 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5375 /* Holy Orb -- Player only takes partial damage */
5378 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5379 if (p_ptr->align > 10)
5381 else if (p_ptr->align < -10)
5383 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5389 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5390 if (p_ptr->align > 10)
5392 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5396 /* Arrow -- XXX no dodging */
5401 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5403 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5405 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5408 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5412 /* Plasma -- XXX No resist */
5415 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5416 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5418 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5420 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5421 (void)set_stun(p_ptr->stun + plus_stun);
5424 if (!(p_ptr->resist_fire ||
5426 p_ptr->immune_fire))
5428 inven_damage(set_acid_destroy, 3);
5434 /* Nether -- drain experience */
5437 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5438 if (p_ptr->resist_neth)
5440 if (!prace_is_(RACE_SPECTRE))
5442 dam *= 6; dam /= (randint1(4) + 7);
5445 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5447 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5449 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5451 learn_spell(monspell);
5455 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5461 /* Water -- stun/confuse */
5464 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5465 if (!CHECK_MULTISHADOW())
5467 if (!p_ptr->resist_sound)
5469 set_stun(p_ptr->stun + randint1(40));
5471 if (!p_ptr->resist_conf)
5473 set_confused(p_ptr->confused + randint1(5) + 5);
5478 inven_damage(set_cold_destroy, 3);
5482 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5486 /* Chaos -- many effects */
5489 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5490 if (p_ptr->resist_chaos)
5492 dam *= 6; dam /= (randint1(4) + 7);
5495 if (!CHECK_MULTISHADOW())
5497 if (!p_ptr->resist_conf)
5499 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5501 if (!p_ptr->resist_chaos)
5503 (void)set_image(p_ptr->image + randint1(10));
5506 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5507 (void)gain_random_mutation(0);
5510 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5512 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5515 if (!p_ptr->resist_chaos || one_in_(9))
5517 inven_damage(set_elec_destroy, 2);
5518 inven_damage(set_fire_destroy, 2);
5522 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5526 /* Shards -- mostly cutting */
5529 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5530 if (p_ptr->resist_shard)
5532 dam *= 6; dam /= (randint1(4) + 7);
5534 else if (!CHECK_MULTISHADOW())
5536 (void)set_cut(p_ptr->cut + dam);
5539 if (!p_ptr->resist_shard || one_in_(13))
5541 inven_damage(set_cold_destroy, 2);
5544 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5548 /* Sound -- mostly stunning */
5551 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5552 if (p_ptr->resist_sound)
5554 dam *= 5; dam /= (randint1(4) + 7);
5556 else if (!CHECK_MULTISHADOW())
5558 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5559 (void)set_stun(p_ptr->stun + plus_stun);
5562 if (!p_ptr->resist_sound || one_in_(13))
5564 inven_damage(set_cold_destroy, 2);
5567 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5571 /* Pure confusion */
5574 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5575 if (p_ptr->resist_conf)
5577 dam *= 5; dam /= (randint1(4) + 7);
5579 else if (!CHECK_MULTISHADOW())
5581 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5587 /* Disenchantment -- see above */
5590 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5591 if (p_ptr->resist_disen)
5593 dam *= 6; dam /= (randint1(4) + 7);
5595 else if (!CHECK_MULTISHADOW())
5597 (void)apply_disenchant(0);
5599 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5603 /* Nexus -- see above */
5606 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5607 if (p_ptr->resist_nexus)
5609 dam *= 6; dam /= (randint1(4) + 7);
5611 else if (!CHECK_MULTISHADOW())
5615 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5619 /* Force -- mostly stun */
5622 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5623 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5625 (void)set_stun(p_ptr->stun + randint1(20));
5627 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5632 /* Rocket -- stun, cut */
5635 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5636 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5638 (void)set_stun(p_ptr->stun + randint1(20));
5641 if (p_ptr->resist_shard)
5645 else if (!CHECK_MULTISHADOW())
5647 (void)set_cut(p_ptr->cut + (dam / 2));
5650 if (!p_ptr->resist_shard || one_in_(12))
5652 inven_damage(set_cold_destroy, 3);
5655 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5659 /* Inertia -- slowness */
5662 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5663 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5664 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5668 /* Lite -- blinding */
5671 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5672 if (p_ptr->resist_lite)
5674 dam *= 4; dam /= (randint1(4) + 7);
5676 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5678 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5681 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5683 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5686 else if (prace_is_(RACE_S_FAIRY))
5691 if (p_ptr->wraith_form) dam *= 2;
5692 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5694 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5696 p_ptr->wraith_form = 0;
5697 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5698 "The light forces you out of your incorporeal shadow form."));
5700 p_ptr->redraw |= PR_MAP;
5701 /* Update monsters */
5702 p_ptr->update |= (PU_MONSTERS);
5704 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5706 /* Redraw status bar */
5707 p_ptr->redraw |= (PR_STATUS);
5714 /* Dark -- blinding */
5717 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5718 if (p_ptr->resist_dark)
5720 dam *= 4; dam /= (randint1(4) + 7);
5722 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5724 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5726 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5728 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5732 /* Time -- bolt fewer effects XXX */
5735 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5736 if (p_ptr->resist_time)
5739 dam /= (randint1(4) + 7);
5740 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5742 else if (!CHECK_MULTISHADOW())
5744 switch (randint1(10))
5746 case 1: case 2: case 3: case 4: case 5:
5748 if (p_ptr->prace == RACE_ANDROID) break;
5749 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5750 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5754 case 6: case 7: case 8: case 9:
5756 switch (randint1(6))
5758 case 1: k = A_STR; act = _("強く", "strong"); break;
5759 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5760 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5761 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5762 case 5: k = A_CON; act = _("健康で", "hale"); break;
5763 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5766 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5767 "You're not as %s as you used to be..."), act);
5769 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5770 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5771 p_ptr->update |= (PU_BONUS);
5777 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5778 "You're not as powerful as you used to be..."));
5780 for (k = 0; k < 6; k++)
5782 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5783 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5785 p_ptr->update |= (PU_BONUS);
5791 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5795 /* Gravity -- stun plus slowness plus teleport */
5798 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5799 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5801 if (!CHECK_MULTISHADOW())
5803 teleport_player(5, TELEPORT_PASSIVE);
5804 if (!p_ptr->levitation)
5805 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5806 if (!(p_ptr->resist_sound || p_ptr->levitation))
5808 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5809 (void)set_stun(p_ptr->stun + plus_stun);
5812 if (p_ptr->levitation)
5814 dam = (dam * 2) / 3;
5817 if (!p_ptr->levitation || one_in_(13))
5819 inven_damage(set_cold_destroy, 2);
5822 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5826 /* Standard damage */
5827 case GF_DISINTEGRATE:
5829 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5831 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5837 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5839 (void)hp_player(dam);
5846 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5847 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5854 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5855 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5861 if (p_ptr->free_act) break;
5862 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5864 if (ironman_nightmare)
5866 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5867 /* Have some nightmares */
5868 sanity_blast(NULL, FALSE);
5871 set_paralyzed(p_ptr->paralyzed + dam);
5881 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5882 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5889 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5890 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5897 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5899 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5900 if (!p_ptr->resist_shard || one_in_(13))
5902 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5903 inven_damage(set_cold_destroy, 2);
5909 /* Ice -- cold plus stun plus cuts */
5912 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5913 get_damage = cold_dam(dam, killer, monspell, FALSE);
5914 if (!CHECK_MULTISHADOW())
5916 if (!p_ptr->resist_shard)
5918 (void)set_cut(p_ptr->cut + damroll(5, 8));
5920 if (!p_ptr->resist_sound)
5922 (void)set_stun(p_ptr->stun + randint1(15));
5925 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5927 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5937 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5939 if (p_ptr->mimic_form)
5941 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5942 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5947 switch (p_ptr->prace)
5949 /* Some races are immune */
5963 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5975 if (CHECK_MULTISHADOW())
5977 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5979 else if (p_ptr->csp)
5983 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5985 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5988 if (dam >= p_ptr->csp)
5992 p_ptr->csp_frac = 0;
6001 learn_spell(monspell);
6004 p_ptr->redraw |= (PR_MANA);
6007 p_ptr->window |= (PW_PLAYER);
6008 p_ptr->window |= (PW_SPELL);
6012 /* Heal the monster */
6013 if (m_ptr->hp < m_ptr->maxhp)
6017 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6019 /* Redraw (later) if needed */
6020 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6021 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6023 /* Special message */
6026 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6039 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6041 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6042 learn_spell(monspell);
6046 if (!CHECK_MULTISHADOW())
6048 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6050 if (!p_ptr->resist_conf)
6052 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6055 if (!p_ptr->resist_chaos && one_in_(3))
6057 (void)set_image(p_ptr->image + randint0(250) + 150);
6064 p_ptr->csp_frac = 0;
6066 p_ptr->redraw |= PR_MANA;
6069 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6075 case GF_BRAIN_SMASH:
6077 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6079 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6080 learn_spell(monspell);
6084 if (!CHECK_MULTISHADOW())
6086 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6092 p_ptr->csp_frac = 0;
6094 p_ptr->redraw |= PR_MANA;
6097 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6098 if (!CHECK_MULTISHADOW())
6100 if (!p_ptr->resist_blind)
6102 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6104 if (!p_ptr->resist_conf)
6106 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6108 if (!p_ptr->free_act)
6110 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6112 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6114 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6115 (void)do_dec_stat(A_INT);
6116 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6117 (void)do_dec_stat(A_WIS);
6119 if (!p_ptr->resist_chaos)
6121 (void)set_image(p_ptr->image + randint0(250) + 150);
6131 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6133 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6134 learn_spell(monspell);
6138 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6139 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6147 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6149 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6150 learn_spell(monspell);
6154 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6155 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6163 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6165 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6166 learn_spell(monspell);
6170 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6171 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6179 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6181 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6182 learn_spell(monspell);
6186 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6187 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6195 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6197 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6198 learn_spell(monspell);
6202 if (!CHECK_MULTISHADOW())
6204 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6205 curse_equipment(40, 20);
6208 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6210 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6225 /* Hex - revenge damage stored */
6226 revenge_store(get_damage);
6228 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6229 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6231 char m_name_self[80];
6234 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6236 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6237 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6238 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6241 if (p_ptr->riding && dam > 0)
6243 rakubadam_p = (dam > 200) ? 200 : dam;
6251 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6253 (void)kawarimi(FALSE);
6256 /* Return "Anything seen?" */
6262 * Find the distance from (x, y) to a line.
6264 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6266 /* Vector from (x, y) to (x1, y1) */
6267 POSITION py = y1 - y;
6268 POSITION px = x1 - x;
6271 POSITION ny = x2 - x1;
6272 POSITION nx = y1 - y2;
6275 POSITION pd = distance(y1, x1, y, x);
6276 POSITION nd = distance(y1, x1, y2, x2);
6278 if (pd > nd) return distance(y, x, y2, x2);
6280 /* Component of P on N */
6281 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6283 /* Absolute value */
6284 return((nd >= 0) ? nd : 0 - nd);
6291 * Modified version of los() for calculation of disintegration balls.
6292 * Disintegration effects are stopped by permanent walls.
6294 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6314 /* Slope, or 1/Slope, of LOS */
6318 /* Extract the offset */
6322 /* Extract the absolute offset */
6327 /* Handle adjacent (or identical) grids */
6328 if ((ax < 2) && (ay < 2)) return (TRUE);
6331 /* Paranoia -- require "safe" origin */
6332 /* if (!in_bounds(y1, x1)) return (FALSE); */
6335 /* Directly South/North */
6338 /* South -- check for walls */
6341 for (ty = y1 + 1; ty < y2; ty++)
6343 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6347 /* North -- check for walls */
6350 for (ty = y1 - 1; ty > y2; ty--)
6352 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6360 /* Directly East/West */
6363 /* East -- check for walls */
6366 for (tx = x1 + 1; tx < x2; tx++)
6368 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6372 /* West -- check for walls */
6375 for (tx = x1 - 1; tx > x2; tx--)
6377 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6386 /* Extract some signs */
6387 sx = (dx < 0) ? -1 : 1;
6388 sy = (dy < 0) ? -1 : 1;
6391 /* Vertical "knights" */
6396 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6400 /* Horizontal "knights" */
6405 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6410 /* Calculate scale factor div 2 */
6413 /* Calculate scale factor */
6417 /* Travel horizontally */
6420 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6426 /* Consider the special case where slope == 1. */
6437 /* Note (below) the case (qy == f2), where */
6438 /* the LOS exactly meets the corner of a tile. */
6441 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6452 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6465 /* Travel vertically */
6468 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6484 /* Note (below) the case (qx == f2), where */
6485 /* the LOS exactly meets the corner of a tile. */
6488 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6499 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6520 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)
6525 int brev = rad * rad / dist;
6529 int mdis = distance(y1, x1, y2, x2) + rad;
6531 while (bdis <= mdis)
6535 if ((0 < dist) && (path_n < dist))
6537 int ny = GRID_Y(path_g[path_n]);
6538 int nx = GRID_X(path_g[path_n]);
6539 int nd = distance(ny, nx, y1, x1);
6541 /* Get next base point */
6550 /* Travel from center outward */
6551 for (cdis = 0; cdis <= brad; cdis++)
6553 /* Scan the maximal blast area of radius "cdis" */
6554 for (y = by - cdis; y <= by + cdis; y++)
6556 for (x = bx - cdis; x <= bx + cdis; x++)
6558 /* Ignore "illegal" locations */
6559 if (!in_bounds(y, x)) continue;
6561 /* Enforce a circular "ripple" */
6562 if (distance(y1, x1, y, x) != bdis) continue;
6564 /* Enforce an arc */
6565 if (distance(by, bx, y, x) != cdis) continue;
6571 /* Lights are stopped by opaque terrains */
6572 if (!los(by, bx, y, x)) continue;
6574 case GF_DISINTEGRATE:
6575 /* Disintegration are stopped only by perma-walls */
6576 if (!in_disintegration_range(by, bx, y, x)) continue;
6579 /* Ball explosions are stopped by walls */
6580 if (!projectable(by, bx, y, x)) continue;
6584 /* Save this grid */
6592 /* Encode some more "radius" info */
6593 gm[bdis + 1] = *pgrids;
6595 /* Increase the size */
6596 brad = rad * (path_n + brev) / (dist + brev);
6598 /* Find the next ripple */
6602 /* Store the effect size */
6608 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6609 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6610 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6611 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6612 * @param x 目標X座標 / Target x location (or location to travel "towards")
6613 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6614 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6615 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6616 * @param monspell 効果元のモンスター魔法ID
6617 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6620 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6621 * towards a given location (optionally passing over the heads of interposing
6622 * monsters), and have it do a given amount of damage to the monsters (and
6623 * optionally objects) within the given radius of the final location.
6625 * A "bolt" travels from source to target and affects only the target grid.
6626 * A "beam" travels from source to target, affecting all grids passed through.
6627 * A "ball" travels from source to the target, exploding at the target, and
6628 * affecting everything within the given radius of the target location.
6630 * Traditionally, a "bolt" does not affect anything on the ground, and does
6631 * not pass over the heads of interposing monsters, much like a traditional
6632 * missile, and will "stop" abruptly at the "target" even if no monster is
6633 * positioned there, while a "ball", on the other hand, passes over the heads
6634 * of monsters between the source and target, and affects everything except
6635 * the source monster which lies within the final radius, while a "beam"
6636 * affects every monster between the source and target, except for the casting
6637 * monster (or player), and rarely affects things on the ground.
6639 * Two special flags allow us to use this function in special ways, the
6640 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6641 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6642 * actually projecting from the source monster (or player).
6644 * The player will only get "experience" for monsters killed by himself
6645 * Unique monsters can only be destroyed by attacks from the player
6647 * Only 256 grids can be affected per projection, limiting the effective
6648 * "radius" of standard ball attacks to nine units (diameter nineteen).
6650 * One can project in a given "direction" by combining PROJECT_THRU with small
6651 * offsets to the initial location (see "line_spell()"), or by calculating
6652 * "virtual targets" far away from the player.
6654 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6655 * continuing until it actually hits somethings (useful for "stone to mud").
6657 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6659 * Balls must explode BEFORE hitting walls, or they would affect monsters
6660 * on both sides of a wall. Some bug reports indicate that this is still
6661 * happening in 2.7.8 for Windows, though it appears to be impossible.
6663 * We "pre-calculate" the blast area only in part for efficiency.
6664 * More importantly, this lets us do "explosions" from the "inside" out.
6665 * This results in a more logical distribution of "blast" treasure.
6666 * It also produces a better (in my opinion) animation of the explosion.
6667 * It could be (but is not) used to have the treasure dropped by monsters
6668 * in the middle of the explosion fall "outwards", and then be damaged by
6669 * the blast as it spreads outwards towards the treasure drop location.
6671 * Walls and doors are included in the blast area, so that they can be
6672 * "burned" or "melted" in later versions.
6674 * This algorithm is intended to maximize simplicity, not necessarily
6675 * efficiency, since this function is not a bottleneck in the code.
6677 * We apply the blast effect from ground zero outwards, in several passes,
6678 * first affecting features, then objects, then monsters, then the player.
6679 * This allows walls to be removed before checking the object or monster
6680 * in the wall, and protects objects which are dropped by monsters killed
6681 * in the blast, and allows the player to see all affects before he is
6682 * killed or teleported away. The semantics of this method are open to
6683 * various interpretations, but they seem to work well in practice.
6685 * We process the blast area from ground-zero outwards to allow for better
6686 * distribution of treasure dropped by monsters, and because it provides a
6687 * pleasing visual effect at low cost.
6689 * Note that the damage done by "ball" explosions decreases with distance.
6690 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6692 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6693 * the target, and then the damage "flows" along this beam of destruction.
6694 * The damage at every grid is the same as at the "center" of a "ball"
6695 * explosion, since the "beam" grids are treated as if they ARE at the
6696 * center of a "ball" explosion.
6698 * Currently, specifying "beam" plus "ball" means that locations which are
6699 * covered by the initial "beam", and also covered by the final "ball", except
6700 * for the final grid (the epicenter of the ball), will be "hit twice", once
6701 * by the initial beam, and once by the exploding ball. For the grid right
6702 * next to the epicenter, this results in 150% damage being done. The center
6703 * does not have this problem, for the same reason the final grid in a "beam"
6704 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6705 * grids which are covered by the "ball" will NOT work, as then they will
6706 * receive LESS damage than they should. Do not combine "beam" with "ball".
6708 * The array "gy[],gx[]" with current size "grids" is used to hold the
6709 * collected locations of all grids in the "blast area" plus "beam path".
6711 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6712 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6713 * first blast grid (see above) with radius "N" from the blast center. Note
6714 * that only the first gm[1] grids in the blast area thus take full damage.
6715 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6716 * number of blast grids.
6718 * Note that once the projection is complete, (y2,x2) holds the final location
6719 * of bolts/beams, and the "epicenter" of balls.
6721 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6722 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6723 * implementation of the "distance" function. Also, a bolt can be properly
6724 * viewed as a "ball" with a "rad" of "zero".
6726 * Note that if no "target" is reached before the beam/bolt/ball travels the
6727 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6728 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6730 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6731 * to move from point A to point B, even if the player cannot see part of the
6732 * projection path. Note that in general, the player will *always* see part
6733 * of the path, since it either starts at the player or ends on the player.
6735 * Hack -- we assume that every "projection" is "self-illuminating".
6737 * Hack -- when only a single monster is affected, we automatically track
6738 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6740 * Note that all projections now "explode" at their final destination, even
6741 * if they were being projected at a more distant destination. This means
6742 * that "ball" spells will *always* explode.
6744 * Note that we must call "handle_stuff()" after affecting terrain features
6745 * in the blast radius, in case the "illumination" of the grid was changed,
6746 * and "update_view()" and "update_monsters()" need to be called.
6749 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6759 POSITION y_saver, x_saver; /* For reflecting monsters */
6761 int msec = delay_factor * delay_factor * delay_factor;
6763 /* Assume the player sees nothing */
6764 bool notice = FALSE;
6766 /* Assume the player has seen nothing */
6767 bool visual = FALSE;
6769 /* Assume the player has seen no blast grids */
6772 /* Assume to be a normal ball spell */
6773 bool breath = FALSE;
6775 /* Is the player blind? */
6776 bool blind = (p_ptr->blind ? TRUE : FALSE);
6778 bool old_hide = FALSE;
6780 /* Number of grids in the "path" */
6783 /* Actual grids in the "path" */
6786 /* Number of grids in the "blast area" (including the "beam" path) */
6789 /* Coordinates of the affected grids */
6790 POSITION gx[1024], gy[1024];
6792 /* Encoded "radius" info (see above) */
6795 /* Actual radius encoded in gm[] */
6796 POSITION gm_rad = rad;
6800 /* Attacker's name (prepared before polymorph)*/
6803 /* Can the player see the source of this effect? */
6804 bool see_s_msg = TRUE;
6806 /* Initialize by null string */
6812 /* Default target of monsterspell is player */
6813 monster_target_y=p_ptr->y;
6814 monster_target_x=p_ptr->x;
6816 /* Hack -- Jump to target */
6817 if (flg & (PROJECT_JUMP))
6822 /* Clear the flag */
6823 flg &= ~(PROJECT_JUMP);
6828 /* Start at player */
6835 /* Start at monster */
6838 x1 = m_list[who].fx;
6839 y1 = m_list[who].fy;
6840 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6853 /* Default "destination" */
6858 /* Hack -- verify stuff */
6859 if (flg & (PROJECT_THRU))
6861 if ((x1 == x2) && (y1 == y2))
6863 flg &= ~(PROJECT_THRU);
6867 /* Handle a breath attack */
6872 if (flg & PROJECT_HIDE) old_hide = TRUE;
6873 flg |= PROJECT_HIDE;
6877 /* Hack -- Assume there will be no blast (max radius 32) */
6878 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6886 /* Collect beam grids */
6887 if (flg & (PROJECT_BEAM))
6898 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6900 case GF_DISINTEGRATE:
6901 flg |= (PROJECT_GRID);
6902 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6906 /* Calculate the projection path */
6908 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6910 /* Hack -- Handle stuff */
6913 /* Giga-Hack SEEKER & SUPER_RAY */
6915 if( typ == GF_SEEKER )
6925 for (i = 0; i < path_n; ++i)
6930 int ny = GRID_Y(path_g[i]);
6931 int nx = GRID_X(path_g[i]);
6942 /* Only do visuals if requested */
6943 if (!blind && !(flg & (PROJECT_HIDE)))
6945 /* Only do visuals if the player can "see" the bolt */
6946 if (panel_contains(y, x) && player_has_los_bold(y, x))
6953 /* Obtain the bolt pict */
6954 p = bolt_pict(oy, ox, y, x, typ);
6956 /* Extract attr/char */
6960 /* Visual effects */
6961 print_rel(c, a, y, x);
6962 move_cursor_relative(y, x);
6963 /*if (fresh_before)*/ Term_fresh();
6964 Term_xtra(TERM_XTRA_DELAY, msec);
6966 /*if (fresh_before)*/ Term_fresh();
6968 /* Display "beam" grids */
6969 if (flg & (PROJECT_BEAM))
6971 /* Obtain the explosion pict */
6972 p = bolt_pict(y, x, y, x, typ);
6974 /* Extract attr/char */
6978 /* Visual effects */
6979 print_rel(c, a, y, x);
6982 /* Hack -- Activate delay */
6986 /* Hack -- delay anyway for consistency */
6989 /* Delay for consistency */
6990 Term_xtra(TERM_XTRA_DELAY, msec);
6993 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6994 if( is_mirror_grid(&cave[y][x]))
6996 /* The target of monsterspell becomes tha mirror(broken) */
6997 monster_target_y=(s16b)y;
6998 monster_target_x=(s16b)x;
7000 remove_mirror(y, x);
7001 next_mirror(&oy, &ox, y, x);
7003 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7004 for(j = last_i; j <= i; j++)
7006 y = GRID_Y(path_g[j]);
7007 x = GRID_X(path_g[j]);
7008 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7009 if(!who && (project_m_n==1) && !jump ){
7010 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,y,x,dam,GF_SEEKER);
7028 for(i = last_i ; i < path_n ; i++)
7031 py = GRID_Y(path_g[i]);
7032 px = GRID_X(path_g[i]);
7033 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7035 if(!who && (project_m_n==1) && !jump ){
7036 if(cave[project_m_y][project_m_x].m_idx > 0)
7038 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7042 /* Hack -- auto-recall */
7043 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7045 /* Hack - auto-track */
7046 health_track(cave[project_m_y][project_m_x].m_idx);
7050 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7054 else if(typ == GF_SUPER_RAY){
7056 int second_step = 0;
7063 for (i = 0; i < path_n; ++i)
7068 int ny = GRID_Y(path_g[i]);
7069 int nx = GRID_X(path_g[i]);
7080 /* Only do visuals if requested */
7081 if (!blind && !(flg & (PROJECT_HIDE)))
7083 /* Only do visuals if the player can "see" the bolt */
7084 if (panel_contains(y, x) && player_has_los_bold(y, x))
7091 /* Obtain the bolt pict */
7092 p = bolt_pict(oy, ox, y, x, typ);
7094 /* Extract attr/char */
7098 /* Visual effects */
7099 print_rel(c, a, y, x);
7100 move_cursor_relative(y, x);
7101 /*if (fresh_before)*/ Term_fresh();
7102 Term_xtra(TERM_XTRA_DELAY, msec);
7104 /*if (fresh_before)*/ Term_fresh();
7106 /* Display "beam" grids */
7107 if (flg & (PROJECT_BEAM))
7109 /* Obtain the explosion pict */
7110 p = bolt_pict(y, x, y, x, typ);
7112 /* Extract attr/char */
7116 /* Visual effects */
7117 print_rel(c, a, y, x);
7120 /* Hack -- Activate delay */
7124 /* Hack -- delay anyway for consistency */
7127 /* Delay for consistency */
7128 Term_xtra(TERM_XTRA_DELAY, msec);
7131 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7132 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7134 if( second_step )continue;
7137 if( is_mirror_grid(&cave[y][x]) && !second_step )
7139 /* The target of monsterspell becomes tha mirror(broken) */
7140 monster_target_y=(s16b)y;
7141 monster_target_x=(s16b)x;
7144 for( j = 0; j <=i ; j++ )
7146 y = GRID_Y(path_g[j]);
7147 x = GRID_X(path_g[j]);
7148 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7152 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7153 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7154 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7155 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7156 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7157 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7158 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7159 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7162 for( i = 0; i < path_n ; i++ )
7165 py = GRID_Y(path_g[i]);
7166 px = GRID_X(path_g[i]);
7167 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7168 if(!who && (project_m_n == 1) && !jump){
7169 if(cave[project_m_y][project_m_x].m_idx >0 ){
7170 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7174 /* Hack -- auto-recall */
7175 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7177 /* Hack - auto-track */
7178 health_track(cave[project_m_y][project_m_x].m_idx);
7182 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7187 /* Project along the path */
7188 for (i = 0; i < path_n; ++i)
7193 int ny = GRID_Y(path_g[i]);
7194 int nx = GRID_X(path_g[i]);
7196 if (flg & PROJECT_DISI)
7198 /* Hack -- Balls explode before reaching walls */
7199 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7201 else if (flg & PROJECT_LOS)
7203 /* Hack -- Balls explode before reaching walls */
7204 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7208 /* Hack -- Balls explode before reaching walls */
7209 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7216 /* Collect beam grids */
7217 if (flg & (PROJECT_BEAM))
7224 /* Only do visuals if requested */
7225 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7227 /* Only do visuals if the player can "see" the bolt */
7228 if (panel_contains(y, x) && player_has_los_bold(y, x))
7235 /* Obtain the bolt pict */
7236 p = bolt_pict(oy, ox, y, x, typ);
7238 /* Extract attr/char */
7242 /* Visual effects */
7243 print_rel(c, a, y, x);
7244 move_cursor_relative(y, x);
7245 /*if (fresh_before)*/ Term_fresh();
7246 Term_xtra(TERM_XTRA_DELAY, msec);
7248 /*if (fresh_before)*/ Term_fresh();
7250 /* Display "beam" grids */
7251 if (flg & (PROJECT_BEAM))
7253 /* Obtain the explosion pict */
7254 p = bolt_pict(y, x, y, x, typ);
7256 /* Extract attr/char */
7260 /* Visual effects */
7261 print_rel(c, a, y, x);
7264 /* Hack -- Activate delay */
7268 /* Hack -- delay anyway for consistency */
7271 /* Delay for consistency */
7272 Term_xtra(TERM_XTRA_DELAY, msec);
7279 /* Save the "blast epicenter" */
7283 if (breath && !path_n)
7289 flg &= ~(PROJECT_HIDE);
7293 /* Start the "explosion" */
7296 /* Hack -- make sure beams get to "explode" */
7304 /* If we found a "target", explode there */
7305 if (dist <= MAX_RANGE)
7307 /* Mega-Hack -- remove the final "beam" grid */
7308 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7311 * Create a conical breath attack
7322 flg &= ~(PROJECT_HIDE);
7324 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7328 /* Determine the blast area, work from the inside out */
7329 for (dist = 0; dist <= rad; dist++)
7331 /* Scan the maximal blast area of radius "dist" */
7332 for (y = by - dist; y <= by + dist; y++)
7334 for (x = bx - dist; x <= bx + dist; x++)
7336 /* Ignore "illegal" locations */
7337 if (!in_bounds2(y, x)) continue;
7339 /* Enforce a "circular" explosion */
7340 if (distance(by, bx, y, x) != dist) continue;
7346 /* Lights are stopped by opaque terrains */
7347 if (!los(by, bx, y, x)) continue;
7349 case GF_DISINTEGRATE:
7350 /* Disintegration are stopped only by perma-walls */
7351 if (!in_disintegration_range(by, bx, y, x)) continue;
7354 /* Ball explosions are stopped by walls */
7355 if (!projectable(by, bx, y, x)) continue;
7359 /* Save this grid */
7366 /* Encode some more "radius" info */
7372 /* Speed -- ignore "non-explosions" */
7373 if (!grids) return (FALSE);
7376 /* Display the "blast area" if requested */
7377 if (!blind && !(flg & (PROJECT_HIDE)))
7379 /* Then do the "blast", from inside out */
7380 for (t = 0; t <= gm_rad; t++)
7382 /* Dump everything with this radius */
7383 for (i = gm[t]; i < gm[t+1]; i++)
7385 /* Extract the location */
7389 /* Only do visuals if the player can "see" the blast */
7390 if (panel_contains(y, x) && player_has_los_bold(y, x))
7399 /* Obtain the explosion pict */
7400 p = bolt_pict(y, x, y, x, typ);
7402 /* Extract attr/char */
7406 /* Visual effects -- Display */
7407 print_rel(c, a, y, x);
7411 /* Hack -- center the cursor */
7412 move_cursor_relative(by, bx);
7414 /* Flush each "radius" seperately */
7415 /*if (fresh_before)*/ Term_fresh();
7417 /* Delay (efficiently) */
7418 if (visual || drawn)
7420 Term_xtra(TERM_XTRA_DELAY, msec);
7424 /* Flush the erasing */
7427 /* Erase the explosion drawn above */
7428 for (i = 0; i < grids; i++)
7430 /* Extract the location */
7434 /* Hack -- Erase if needed */
7435 if (panel_contains(y, x) && player_has_los_bold(y, x))
7441 /* Hack -- center the cursor */
7442 move_cursor_relative(by, bx);
7444 /* Flush the explosion */
7445 /*if (fresh_before)*/ Term_fresh();
7450 /* Update stuff if needed */
7451 if (p_ptr->update) update_stuff();
7454 if (flg & PROJECT_KILL)
7456 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7457 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7461 /* Check features */
7462 if (flg & (PROJECT_GRID))
7464 /* Start with "dist" of zero */
7467 /* Scan for features */
7468 for (i = 0; i < grids; i++)
7470 /* Hack -- Notice new "dist" values */
7471 if (gm[dist+1] == i) dist++;
7473 /* Get the grid location */
7477 /* Find the closest point in the blast */
7480 int d = dist_to_line(y, x, y1, x1, by, bx);
7482 /* Affect the grid */
7483 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7487 /* Affect the grid */
7488 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7493 /* Update stuff if needed */
7494 if (p_ptr->update) update_stuff();
7497 if (flg & (PROJECT_ITEM))
7499 /* Start with "dist" of zero */
7502 /* Scan for objects */
7503 for (i = 0; i < grids; i++)
7505 /* Hack -- Notice new "dist" values */
7506 if (gm[dist+1] == i) dist++;
7508 /* Get the grid location */
7512 /* Find the closest point in the blast */
7515 int d = dist_to_line(y, x, y1, x1, by, bx);
7517 /* Affect the object in the grid */
7518 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7522 /* Affect the object in the grid */
7523 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7529 /* Check monsters */
7530 if (flg & (PROJECT_KILL))
7537 /* Start with "dist" of zero */
7540 /* Scan for monsters */
7541 for (i = 0; i < grids; i++)
7545 /* Hack -- Notice new "dist" values */
7546 if (gm[dist + 1] == i) dist++;
7548 /* Get the grid location */
7552 /* A single bolt may be reflected */
7555 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7556 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7558 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7559 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7560 (!who || dist_hack > 1) && !one_in_(10))
7563 int max_attempts = 10;
7565 /* Choose 'new' target */
7568 t_y = y_saver - 1 + randint1(3);
7569 t_x = x_saver - 1 + randint1(3);
7572 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7574 if (max_attempts < 1)
7580 sound(SOUND_REFLECT);
7583 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7584 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7585 else if (m_ptr->r_idx == MON_DIO)
7586 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7588 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7590 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7592 /* Reflected bolts randomly target either one */
7593 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7594 else flg |= PROJECT_PLAYER;
7596 /* The bolt is reflected */
7597 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7599 /* Don't affect the monster any longer */
7605 /* Find the closest point in the blast */
7608 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7612 effective_dist = dist;
7616 /* There is the riding player on this monster */
7617 if (p_ptr->riding && player_bold(y, x))
7619 /* Aimed on the player */
7620 if (flg & PROJECT_PLAYER)
7622 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7625 * A beam or bolt is well aimed
7627 * So don't affects the mount.
7634 * The spell is not well aimed,
7635 * So partly affect the mount too.
7642 * This grid is the original target.
7643 * Or aimed on your horse.
7645 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7647 /* Hit the mount with full damage */
7651 * Otherwise this grid is not the
7652 * original target, it means that line
7653 * of fire is obstructed by this
7657 * A beam or bolt will hit either
7658 * player or mount. Choose randomly.
7660 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7664 /* Hit the mount with full damage */
7668 /* Hit the player later */
7669 flg |= PROJECT_PLAYER;
7671 /* Don't affect the mount */
7677 * The spell is not well aimed, so
7678 * partly affect both player and
7687 /* Affect the monster in the grid */
7688 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7692 /* Player affected one monster (without "jumping") */
7693 if (!who && (project_m_n == 1) && !jump)
7699 /* Track if possible */
7700 if (cave[y][x].m_idx > 0)
7702 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7706 /* Hack -- auto-recall */
7707 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7709 /* Hack - auto-track */
7710 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7718 if (flg & (PROJECT_KILL))
7720 /* Start with "dist" of zero */
7723 /* Scan for player */
7724 for (i = 0; i < grids; i++)
7728 /* Hack -- Notice new "dist" values */
7729 if (gm[dist+1] == i) dist++;
7731 /* Get the grid location */
7735 /* Affect the player? */
7736 if (!player_bold(y, x)) continue;
7738 /* Find the closest point in the blast */
7741 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7745 effective_dist = dist;
7748 /* Target may be your horse */
7751 /* Aimed on the player */
7752 if (flg & PROJECT_PLAYER)
7754 /* Hit the player with full damage */
7758 * Hack -- When this grid was not the
7759 * original target, a beam or bolt
7760 * would hit either player or mount,
7761 * and should be choosen randomly.
7763 * But already choosen to hit the
7764 * mount at this point.
7766 * Or aimed on your horse.
7768 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7771 * A beam or bolt is well aimed
7773 * So don't affects the player.
7780 * The spell is not well aimed,
7781 * So partly affect the player too.
7787 /* Affect the player */
7788 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7796 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7798 if (rakubadam_m > 0)
7800 if (rakuba(rakubadam_m, FALSE))
7802 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7805 if (p_ptr->riding && rakubadam_p > 0)
7807 if(rakuba(rakubadam_p, FALSE))
7809 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7814 /* Return "something was noticed" */
7819 * @brief 鏡魔法「封魔結界」の効果処理
7821 * @return 効果があったらTRUEを返す
7823 bool binding_field( HIT_POINT dam )
7825 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7826 int mirror_num=0; /* 鏡の数 */
7831 int msec= delay_factor*delay_factor*delay_factor;
7837 /* Default target of monsterspell is player */
7838 monster_target_y=p_ptr->y;
7839 monster_target_x=p_ptr->x;
7841 for( x=0 ; x < cur_wid ; x++ )
7843 for( y=0 ; y < cur_hgt ; y++ )
7845 if( is_mirror_grid(&cave[y][x]) &&
7846 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7847 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7848 player_has_los_bold(y,x) &&
7849 projectable(p_ptr->y, p_ptr->x, y, x)
7851 mirror_y[mirror_num]=y;
7852 mirror_x[mirror_num]=x;
7858 if( mirror_num < 2 )return FALSE;
7860 point_x[0] = randint0( mirror_num );
7862 point_x[1] = randint0( mirror_num );
7864 while( point_x[0] == point_x[1] );
7866 point_y[0]=mirror_y[point_x[0]];
7867 point_x[0]=mirror_x[point_x[0]];
7868 point_y[1]=mirror_y[point_x[1]];
7869 point_x[1]=mirror_x[point_x[1]];
7870 point_y[2]=p_ptr->y;
7871 point_x[2]=p_ptr->x;
7873 x=point_x[0]+point_x[1]+point_x[2];
7874 y=point_y[0]+point_y[1]+point_y[2];
7876 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7877 - (point_y[0]*3-y)*(point_x[1]*3-x);
7878 if( centersign == 0 )return FALSE;
7880 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7881 x1 = x1 < point_x[2] ? x1 : point_x[2];
7882 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7883 y1 = y1 < point_y[2] ? y1 : point_y[2];
7885 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7886 x2 = x2 > point_x[2] ? x2 : point_x[2];
7887 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7888 y2 = y2 > point_y[2] ? y2 : point_y[2];
7890 for( y=y1 ; y <=y2 ; y++ ){
7891 for( x=x1 ; x <=x2 ; x++ ){
7892 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7893 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7894 centersign*( (point_x[1]-x)*(point_y[2]-y)
7895 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7896 centersign*( (point_x[2]-x)*(point_y[0]-y)
7897 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7899 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7900 /* Visual effects */
7902 && panel_contains(y,x)){
7903 p = bolt_pict(y,x,y,x, GF_MANA );
7904 print_rel(PICT_C(p), PICT_A(p),y,x);
7905 move_cursor_relative(y, x);
7906 /*if (fresh_before)*/ Term_fresh();
7907 Term_xtra(TERM_XTRA_DELAY, msec);
7913 for( y=y1 ; y <=y2 ; y++ ){
7914 for( x=x1 ; x <=x2 ; x++ ){
7915 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7916 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7917 centersign*( (point_x[1]-x)*(point_y[2]-y)
7918 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7919 centersign*( (point_x[2]-x)*(point_y[0]-y)
7920 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7922 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7923 (void)project_f(0,0,y,x,dam,GF_MANA);
7928 for( y=y1 ; y <=y2 ; y++ ){
7929 for( x=x1 ; x <=x2 ; x++ ){
7930 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7931 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7932 centersign*( (point_x[1]-x)*(point_y[2]-y)
7933 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7934 centersign*( (point_x[2]-x)*(point_y[0]-y)
7935 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7937 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7938 (void)project_o(0,0,y,x,dam,GF_MANA);
7943 for( y=y1 ; y <=y2 ; y++ ){
7944 for( x=x1 ; x <=x2 ; x++ ){
7945 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7946 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7947 centersign*( (point_x[1]-x)*(point_y[2]-y)
7948 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7949 centersign*( (point_x[2]-x)*(point_y[0]-y)
7950 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7952 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7953 (void)project_m(0,0,y,x,dam,GF_MANA,
7954 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7960 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7961 remove_mirror(point_y[0],point_x[0]);
7968 * @brief 鏡魔法「鏡の封印」の効果処理
7970 * @return 効果があったらTRUEを返す
7972 void seal_of_mirror( HIT_POINT dam )
7976 for( x = 0 ; x < cur_wid ; x++ )
7978 for( y = 0 ; y < cur_hgt ; y++ )
7980 if( is_mirror_grid(&cave[y][x]))
7982 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
7983 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
7985 if( !cave[y][x].m_idx )