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.
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);
84 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
87 * ハードコーティングによる実装が行われている。
88 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
92 if (p_ptr->pclass == CLASS_MAGE)
94 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
95 return p_ptr->lev + 10;
97 return p_ptr->lev / 2;
102 * @brief 配置した鏡リストの次を取得する /
103 * Get another mirror. for SEEKER
104 * @param next_y 次の鏡のy座標を返す参照ポインタ
105 * @param next_x 次の鏡のx座標を返す参照ポインタ
106 * @param cury 現在の鏡のy座標
107 * @param curx 現在の鏡のx座標
109 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
111 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
112 int mirror_num = 0; /* 鏡の数 */
116 for (x = 0; x < cur_wid; x++)
118 for (y = 0; y < cur_hgt; y++)
120 if (is_mirror_grid(&cave[y][x])) {
121 mirror_y[mirror_num] = y;
122 mirror_x[mirror_num] = x;
129 num = randint0(mirror_num);
130 *next_y = mirror_y[num];
131 *next_x = mirror_x[num];
134 *next_y = cury + randint0(5) - 2;
135 *next_x = curx + randint0(5) - 2;
140 * @brief 万色表現用にランダムな色を選択する関数 /
141 * Get a legal "multi-hued" color for drawing "spells"
145 static byte mh_attr(int max)
147 switch (randint1(max))
149 case 1: return (TERM_RED);
150 case 2: return (TERM_GREEN);
151 case 3: return (TERM_BLUE);
152 case 4: return (TERM_YELLOW);
153 case 5: return (TERM_ORANGE);
154 case 6: return (TERM_VIOLET);
155 case 7: return (TERM_L_RED);
156 case 8: return (TERM_L_GREEN);
157 case 9: return (TERM_L_BLUE);
158 case 10: return (TERM_UMBER);
159 case 11: return (TERM_L_UMBER);
160 case 12: return (TERM_SLATE);
161 case 13: return (TERM_WHITE);
162 case 14: return (TERM_L_WHITE);
163 case 15: return (TERM_L_DARK);
171 * @brief 魔法属性に応じたエフェクトの色を返す /
172 * Return a color to use for the bolt/ball spells
176 static byte spell_color(int type)
178 /* Check if A.B.'s new graphics should be used (rr9) */
179 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
184 case GF_PSY_SPEAR: return (0x06);
185 case GF_MISSILE: return (0x0F);
186 case GF_ACID: return (0x04);
187 case GF_ELEC: return (0x02);
188 case GF_FIRE: return (0x00);
189 case GF_COLD: return (0x01);
190 case GF_POIS: return (0x03);
191 case GF_HOLY_FIRE: return (0x00);
192 case GF_HELL_FIRE: return (0x00);
193 case GF_MANA: return (0x0E);
195 case GF_SEEKER: return (0x0E);
196 case GF_SUPER_RAY: return (0x0E);
198 case GF_ARROW: return (0x0F);
199 case GF_WATER: return (0x04);
200 case GF_NETHER: return (0x07);
201 case GF_CHAOS: return (mh_attr(15));
202 case GF_DISENCHANT: return (0x05);
203 case GF_NEXUS: return (0x0C);
204 case GF_CONFUSION: return (mh_attr(4));
205 case GF_SOUND: return (0x09);
206 case GF_SHARDS: return (0x08);
207 case GF_FORCE: return (0x09);
208 case GF_INERTIAL: return (0x09);
209 case GF_GRAVITY: return (0x09);
210 case GF_TIME: return (0x09);
211 case GF_LITE_WEAK: return (0x06);
212 case GF_LITE: return (0x06);
213 case GF_DARK_WEAK: return (0x07);
214 case GF_DARK: return (0x07);
215 case GF_PLASMA: return (0x0B);
216 case GF_METEOR: return (0x00);
217 case GF_ICE: return (0x01);
218 case GF_ROCKET: return (0x0F);
219 case GF_DEATH_RAY: return (0x07);
220 case GF_NUKE: return (mh_attr(2));
221 case GF_DISINTEGRATE: return (0x05);
233 case GF_CAUSE_4: return (0x0E);
234 case GF_HAND_DOOM: return (0x07);
235 case GF_CAPTURE : return (0x0E);
236 case GF_IDENTIFY: return (0x01);
237 case GF_ATTACK: return (0x0F);
238 case GF_PHOTO : return (0x06);
241 /* Normal tiles or ASCII */
247 /* Lookup the default colors for this type */
248 cptr s = quark_str(gf_color[type]);
251 if (!s) return (TERM_WHITE);
253 /* Pick a random color */
254 c = s[randint0(strlen(s))];
256 /* Lookup this color */
257 a = my_strchr(color_char, c) - color_char;
259 /* Invalid color (note check for < 0 removed, gave a silly
260 * warning because bytes are always >= 0 -- RG) */
261 if (a > 15) return (TERM_WHITE);
267 /* Standard "color" */
273 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
274 * Find the attr/char pair to use for a spell effect
283 * It is moving (or has moved) from (x,y) to (nx,ny).
284 * If the distance is not "one", we (may) return "*".
287 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
297 if ((ny == y) && (nx == x)) base = 0x30;
300 else if (nx == x) base = 0x40;
303 else if (ny == y) base = 0x50;
306 else if ((ny - y) == (x - nx)) base = 0x60;
309 else if ((ny - y) == (nx - x)) base = 0x70;
314 /* Basic spell color */
315 k = spell_color(typ);
317 /* Obtain attr/char */
318 a = misc_to_attr[base + k];
319 c = misc_to_char[base + k];
327 * @brief 始点から終点への経路を返す /
328 * Determine the path taken by a projection.
329 * @param gp 経路座標リストを返す参照ポインタ
339 * The projection will always start from the grid (y1,x1), and will travel
340 * towards the grid (y2,x2), touching one grid per unit of distance along
341 * the major axis, and stopping when it enters the destination grid or a
342 * wall grid, or has travelled the maximum legal distance of "range".
344 * Note that "distance" in this function (as in the "update_view()" code)
345 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
346 * actually has an "octagon of projection" not a "circle of projection".
348 * The path grids are saved into the grid array pointed to by "gp", and
349 * there should be room for at least "range" grids in "gp". Note that
350 * due to the way in which distance is calculated, this function normally
351 * uses fewer than "range" grids for the projection path, so the result
352 * of this function should never be compared directly to "range". Note
353 * that the initial grid (y1,x1) is never saved into the grid array, not
354 * even if the initial grid is also the final grid. XXX XXX XXX
356 * The "flg" flags can be used to modify the behavior of this function.
358 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
359 * semantics as they do for the "project" function, namely, that the path
360 * will stop as soon as it hits a monster, or that the path will continue
361 * through the destination grid, respectively.
363 * The "PROJECT_JUMP" flag, which for the "project()" function means to
364 * start at a special grid (which makes no sense in this function), means
365 * that the path should be "angled" slightly if needed to avoid any wall
366 * grids, allowing the player to "target" any grid which is in "view".
367 * This flag is non-trivial and has not yet been implemented, but could
368 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
370 * This function returns the number of grids (if any) in the path. This
371 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
373 * This algorithm is similar to, but slightly different from, the one used
374 * by "update_view_los()", and very different from the one used by "los()".
377 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
399 /* No path necessary (or allowed) */
400 if ((x1 == x2) && (y1 == y2)) return (0);
428 /* Number of "units" in one "half" grid */
431 /* Number of "units" in one "full" grid */
437 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
448 /* Advance (X) part 2 */
451 /* Advance (X) part 3 */
458 /* Create the projection path */
462 gp[n++] = GRID(y, x);
464 /* Hack -- Check maximum range */
465 if ((n + (k >> 1)) >= range) break;
467 /* Sometimes stop at destination grid */
468 if (!(flg & (PROJECT_THRU)))
470 if ((x == x2) && (y == y2)) break;
473 if (flg & (PROJECT_DISI))
475 if ((n > 0) && cave_stop_disintegration(y, x)) break;
477 else if (flg & (PROJECT_LOS))
479 if ((n > 0) && !cave_los_bold(y, x)) break;
481 else if (!(flg & (PROJECT_PATH)))
483 /* Always stop at non-initial wall grids */
484 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
487 /* Sometimes stop at non-initial monsters/players */
488 if (flg & (PROJECT_STOP))
491 (player_bold(y, x) || cave[y][x].m_idx != 0))
495 if (!in_bounds(y, x)) break;
500 /* Advance (X) part 1 */
503 /* Horizontal change */
506 /* Advance (X) part 2 */
509 /* Advance (X) part 3 */
525 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
534 /* Vertical change */
537 /* Advance (Y) part 2 */
540 /* Advance (Y) part 3 */
547 /* Create the projection path */
551 gp[n++] = GRID(y, x);
553 /* Hack -- Check maximum range */
554 if ((n + (k >> 1)) >= range) break;
556 /* Sometimes stop at destination grid */
557 if (!(flg & (PROJECT_THRU)))
559 if ((x == x2) && (y == y2)) break;
562 if (flg & (PROJECT_DISI))
564 if ((n > 0) && cave_stop_disintegration(y, x)) break;
566 else if (flg & (PROJECT_LOS))
568 if ((n > 0) && !cave_los_bold(y, x)) break;
570 else if (!(flg & (PROJECT_PATH)))
572 /* Always stop at non-initial wall grids */
573 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
576 /* Sometimes stop at non-initial monsters/players */
577 if (flg & (PROJECT_STOP))
580 (player_bold(y, x) || cave[y][x].m_idx != 0))
584 if (!in_bounds(y, x)) break;
589 /* Advance (Y) part 1 */
592 /* Vertical change */
595 /* Advance (Y) part 2 */
598 /* Advance (Y) part 3 */
618 /* Create the projection path */
622 gp[n++] = GRID(y, x);
624 /* Hack -- Check maximum range */
625 if ((n + (n >> 1)) >= range) break;
627 /* Sometimes stop at destination grid */
628 if (!(flg & (PROJECT_THRU)))
630 if ((x == x2) && (y == y2)) break;
633 if (flg & (PROJECT_DISI))
635 if ((n > 0) && cave_stop_disintegration(y, x)) break;
637 else if (flg & (PROJECT_LOS))
639 if ((n > 0) && !cave_los_bold(y, x)) break;
641 else if (!(flg & (PROJECT_PATH)))
643 /* Always stop at non-initial wall grids */
644 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
647 /* Sometimes stop at non-initial monsters/players */
648 if (flg & (PROJECT_STOP))
651 (player_bold(y, x) || cave[y][x].m_idx != 0))
655 if (!in_bounds(y, x)) break;
672 * Mega-Hack -- track "affected" monsters (see "project()" comments)
674 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
675 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
676 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
677 /* Mega-Hack -- monsters target */
678 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
679 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
683 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
684 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
685 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
686 * @param y 目標Y座標 / Target y location (or location to travel "towards")
687 * @param x 目標X座標 / Target x location (or location to travel "towards")
688 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
689 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
690 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
693 * We are called both for "beam" effects and "ball" effects.
695 * The "r" parameter is the "distance from ground zero".
697 * Note that we determine if the player can "see" anything that happens
698 * by taking into account: blindness, line-of-sight, and illumination.
700 * We return "TRUE" if the effect of the projection is "obvious".
702 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
704 * XXX XXX XXX Perhaps we should affect doors?
707 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
709 cave_type *c_ptr = &cave[y][x];
710 feature_type *f_ptr = &f_info[c_ptr->feat];
712 bool obvious = FALSE;
713 bool known = player_has_los_bold(y, x);
719 /* Reduce damage by distance */
720 dam = (dam + r) / (r + 1);
723 if (have_flag(f_ptr->flags, FF_TREE))
731 message = _("枯れた", "was blasted."); break;
733 message = _("縮んだ", "shrank."); break;
735 message = _("溶けた", "melted."); break;
738 message = _("凍り、砕け散った", "was frozen and smashed."); break;
742 message = _("燃えた", "burns up!"); break;
754 message = _("粉砕された", "was crushed."); break;
756 message = NULL;break;
760 msg_format(_("木は%s。", "A tree %s"), message);
761 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
764 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
768 /* Analyze the type */
771 /* Ignore most effects */
806 /* Destroy Traps (and Locks) */
809 /* Reveal secret doors */
810 if (is_hidden_door(c_ptr))
815 /* Check line of sight */
823 if (is_trap(c_ptr->feat))
825 /* Check line of sight */
828 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
832 /* Destroy the trap */
833 cave_alter_feat(y, x, FF_DISARM);
836 /* Locked doors are unlocked */
837 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
839 s16b old_feat = c_ptr->feat;
841 /* Unlock the door */
842 cave_alter_feat(y, x, FF_DISARM);
844 /* Check line of sound */
845 if (known && (old_feat != c_ptr->feat))
847 msg_print(_("カチッと音がした!", "Click!"));
852 /* Remove "unsafe" flag if player is not blind */
853 if (!p_ptr->blind && player_has_los_bold(y, x))
855 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
876 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
880 /* Destroy the feature */
881 cave_alter_feat(y, x, FF_TUNNEL);
884 /* Remove "unsafe" flag if player is not blind */
885 if (!p_ptr->blind && player_has_los_bold(y, x))
887 c_ptr->info &= ~(CAVE_UNSAFE);
898 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
900 if (have_flag(f_ptr->flags, FF_SPIKE))
902 s16b old_mimic = c_ptr->mimic;
903 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
905 cave_alter_feat(y, x, FF_SPIKE);
907 c_ptr->mimic = old_mimic;
915 /* Check line of sight */
916 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
919 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
926 /* Destroy walls (and doors) */
929 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
932 if (known && (c_ptr->info & (CAVE_MARK)))
934 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
938 /* Destroy the wall */
939 cave_alter_feat(y, x, FF_HURT_ROCK);
941 /* Update some things */
942 p_ptr->update |= (PU_FLOW);
951 /* Require a "naked" floor grid */
952 if (!cave_naked_bold(y, x)) break;
954 /* Not on the player */
955 if (player_bold(y, x)) break;
957 /* Create a closed door */
958 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
961 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
978 /* Require a "naked" floor grid */
979 if (!cave_naked_bold(y, x)) break;
981 /* Not on the player */
982 if (player_bold(y, x)) break;
984 /* Create a closed door */
985 cave_set_feat(y, x, feat_tree);
988 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
996 /* Require a "naked" floor grid */
997 if (!cave_naked_bold(y, x)) break;
1000 c_ptr->info |= CAVE_OBJECT;
1001 c_ptr->mimic = feat_glyph;
1014 /* Require a "naked" floor grid */
1015 if (!cave_naked_bold(y, x)) break;
1017 /* Not on the player */
1018 if (player_bold(y, x)) break;
1021 cave_set_feat(y, x, feat_granite);
1029 /* Ignore permanent grid */
1030 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1035 /* Ignore grid without enough space */
1036 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1038 /* Place a shallow lava */
1039 cave_set_feat(y, x, feat_shallow_lava);
1044 /* Place a deep lava */
1045 cave_set_feat(y, x, feat_deep_lava);
1052 /* Ignore permanent grid */
1053 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1058 /* Ignore grid without enough space */
1059 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1061 /* Place a shallow water */
1062 cave_set_feat(y, x, feat_shallow_water);
1067 /* Place a deep water */
1068 cave_set_feat(y, x, feat_deep_water);
1073 /* Lite up the grid */
1077 /* Turn on the light */
1078 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1080 c_ptr->info |= (CAVE_GLOW);
1088 update_local_illumination(y, x);
1091 if (player_can_see_bold(y, x)) obvious = TRUE;
1093 /* Mega-Hack -- Update the monster in the affected grid */
1094 /* This allows "spear of light" (etc) to work "correctly" */
1095 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1097 if (p_ptr->special_defense & NINJA_S_STEALTH)
1099 if (player_bold(y, x)) set_superstealth(FALSE);
1106 /* Darken the grid */
1110 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1113 /* Turn off the light. */
1116 if (dun_level || !is_daytime())
1118 for (j = 0; j < 9; j++)
1120 int by = y + ddy_ddd[j];
1121 int bx = x + ddx_ddd[j];
1123 if (in_bounds2(by, bx))
1125 cave_type *cc_ptr = &cave[by][bx];
1127 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1135 if (!do_dark) break;
1138 c_ptr->info &= ~(CAVE_GLOW);
1140 /* Hack -- Forget "boring" grids */
1141 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1144 c_ptr->info &= ~(CAVE_MARK);
1153 update_local_illumination(y, x);
1156 if (player_can_see_bold(y, x)) obvious = TRUE;
1158 /* Mega-Hack -- Update the monster in the affected grid */
1159 /* This allows "spear of light" (etc) to work "correctly" */
1160 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1170 if (is_mirror_grid(c_ptr))
1172 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1174 remove_mirror(y, x);
1175 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1178 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1181 if (known && (c_ptr->info & CAVE_MARK))
1183 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1187 /* Destroy the wall */
1188 cave_alter_feat(y, x, FF_HURT_ROCK);
1190 /* Update some things */
1191 p_ptr->update |= (PU_FLOW);
1198 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1200 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1202 remove_mirror(y, x);
1203 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1206 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1209 if (known && (c_ptr->info & CAVE_MARK))
1211 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1215 /* Destroy the wall */
1216 cave_alter_feat(y, x, FF_HURT_ROCK);
1218 /* Update some things */
1219 p_ptr->update |= (PU_FLOW);
1224 case GF_DISINTEGRATE:
1226 /* Destroy mirror/glyph */
1227 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1228 remove_mirror(y, x);
1230 /* Permanent features don't get effect */
1231 /* But not protect monsters and other objects */
1232 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1234 cave_alter_feat(y, x, FF_HURT_DISI);
1236 /* Update some things -- similar to GF_KILL_WALL */
1237 p_ptr->update |= (PU_FLOW);
1244 /* Return "Anything seen?" */
1251 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1252 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1253 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1254 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1255 * @param x 目標X座標 / Target x location (or location to travel "towards")
1256 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1257 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1258 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1261 * We are called from "project()" to "damage" objects
1263 * We are called both for "beam" effects and "ball" effects.
1265 * Perhaps we should only SOMETIMES damage things on the ground.
1267 * The "r" parameter is the "distance from ground zero".
1269 * Note that we determine if the player can "see" anything that happens
1270 * by taking into account: blindness, line-of-sight, and illumination.
1272 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1274 * We return "TRUE" if the effect of the projection is "obvious".
1277 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1279 cave_type *c_ptr = &cave[y][x];
1281 OBJECT_IDX this_o_idx, next_o_idx = 0;
1283 bool obvious = FALSE;
1284 bool known = player_has_los_bold(y, x);
1286 BIT_FLAGS flgs[TR_FLAG_SIZE];
1288 char o_name[MAX_NLEN];
1290 KIND_OBJECT_IDX k_idx = 0;
1291 bool is_potion = FALSE;
1295 who = who ? who : 0;
1297 /* Reduce damage by distance */
1298 dam = (dam + r) / (r + 1);
1301 /* Scan all objects in the grid */
1302 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1304 /* Acquire object */
1305 object_type *o_ptr = &o_list[this_o_idx];
1307 bool is_art = FALSE;
1308 bool ignore = FALSE;
1309 bool do_kill = FALSE;
1311 cptr note_kill = NULL;
1314 /* Get the "plural"-ness */
1315 bool plural = (o_ptr->number > 1);
1318 /* Acquire next object */
1319 next_o_idx = o_ptr->next_o_idx;
1321 /* Extract the flags */
1322 object_flags(o_ptr, flgs);
1324 /* Check for artifact */
1325 if (object_is_artifact(o_ptr)) is_art = TRUE;
1327 /* Analyze the type */
1330 /* Acid -- Lots of things */
1333 if (hates_acid(o_ptr))
1336 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1337 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1342 /* Elec -- Rings and Wands */
1345 if (hates_elec(o_ptr))
1348 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1349 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1354 /* Fire -- Flammable objects */
1357 if (hates_fire(o_ptr))
1360 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1361 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1366 /* Cold -- potions and flasks */
1369 if (hates_cold(o_ptr))
1371 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1373 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1381 if (hates_fire(o_ptr))
1384 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1385 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1387 if (hates_elec(o_ptr))
1391 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1392 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1400 if (hates_fire(o_ptr))
1403 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1404 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1406 if (hates_cold(o_ptr))
1410 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1411 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1416 /* Hack -- break potions and such */
1422 if (hates_cold(o_ptr))
1424 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1430 /* Mana and Chaos -- destroy everything */
1436 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1440 case GF_DISINTEGRATE:
1443 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1450 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1451 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1452 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1456 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1460 if (object_is_cursed(o_ptr))
1463 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1470 identify_item(o_ptr);
1472 /* Auto-inscription */
1473 autopick_alter_item((-this_o_idx), FALSE);
1481 /* Chests are noticed only if trapped or locked */
1482 if (o_ptr->tval == TV_CHEST)
1484 /* Disarm/Unlock traps */
1485 if (o_ptr->pval > 0)
1487 /* Disarm or Unlock */
1488 o_ptr->pval = (0 - o_ptr->pval);
1491 object_known(o_ptr);
1494 if (known && (o_ptr->marked & OM_FOUND))
1496 msg_print(_("カチッと音がした!", "Click!"));
1506 if (o_ptr->tval == TV_CORPSE)
1509 BIT_FLAGS mode = 0L;
1511 if (!who || is_pet(&m_list[who]))
1512 mode |= PM_FORCE_PET;
1514 for (i = 0; i < o_ptr->number ; i++)
1516 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1517 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1521 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1525 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1527 note_kill = _("生き返った。", " revived.");
1529 else if (!note_kill)
1531 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1542 /* Attempt to destroy the object */
1545 /* Effect "observed" */
1546 if (known && (o_ptr->marked & OM_FOUND))
1549 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1552 /* Artifacts, and other objects, get to resist */
1553 if (is_art || ignore)
1555 /* Observe the resist */
1556 if (known && (o_ptr->marked & OM_FOUND))
1558 msg_format(_("%sは影響を受けない!",
1559 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1566 /* Describe if needed */
1567 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1569 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1572 k_idx = o_ptr->k_idx;
1573 is_potion = object_is_potion(o_ptr);
1576 /* Delete the object */
1577 delete_object_idx(this_o_idx);
1579 /* Potions produce effects when 'shattered' */
1582 (void)potion_smash_effect(who, y, x, k_idx);
1591 /* Return "Anything seen?" */
1597 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1598 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1599 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1600 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1601 * @param x 目標X座標 / Target x location (or location to travel "towards")
1602 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1603 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1605 * @param see_s_msg TRUEならばメッセージを表示する
1606 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1609 * This routine takes a "source monster" (by index) which is mostly used to
1610 * determine if the player is causing the damage, and a "radius" (see below),
1611 * which is used to decrease the power of explosions with distance, and a
1612 * location, via integers which are modified by certain types of attacks
1613 * (polymorph and teleport being the obvious ones), a default damage, which
1614 * is modified as needed based on various properties, and finally a "damage
1615 * type" (see below).
1618 * Note that this routine can handle "no damage" attacks (like teleport) by
1619 * taking a "zero" damage, and can even take "parameters" to attacks (like
1620 * confuse) by accepting a "damage", using it to calculate the effect, and
1621 * then setting the damage to zero. Note that the "damage" parameter is
1622 * divided by the radius, so monsters not at the "epicenter" will not take
1623 * as much damage (or whatever)...
1626 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1627 * may result in a dereference of an invalid pointer. XXX XXX XXX
1630 * Various messages are produced, and damage is applied.
1633 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1634 * actually be "made" of that substance, or "breathe" big balls of it.
1635 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1637 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1638 * and hurts evil less. If can breath nether, then it resists it as well.
1641 * Damage reductions use the following formulas:
1642 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1643 * gives avg damage of .655, ranging from .858 to .500
1644 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1645 * gives avg damage of .544, ranging from .714 to .417
1646 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1647 * gives avg damage of .444, ranging from .556 to .333
1648 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1649 * gives avg damage of .327, ranging from .427 to .250
1650 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1651 * gives something simple.
1654 * In this function, "result" messages are postponed until the end, where
1655 * the "note" string is appended to the monster name, if not NULL. So,
1656 * to make a spell have "no effect" just set "note" to NULL. You should
1657 * also set "notice" to FALSE, or the player will learn what the spell does.
1660 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1664 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)
1668 cave_type *c_ptr = &cave[y][x];
1670 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1671 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1673 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1677 /* Is the monster "seen"? */
1678 bool seen = m_ptr->ml;
1679 bool seen_msg = is_seen(m_ptr);
1681 bool slept = (bool)MON_CSLEEP(m_ptr);
1683 /* Were the effects "obvious" (if seen)? */
1684 bool obvious = FALSE;
1686 /* Can the player know about this effect? */
1687 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1689 /* Were the effects "irrelevant"? */
1690 bool skipped = FALSE;
1692 /* Gets the monster angry at the source of the effect? */
1693 bool get_angry = FALSE;
1695 /* Polymorph setting (true or false) */
1696 bool do_poly = FALSE;
1698 /* Teleport setting (max distance) */
1701 /* Confusion setting (amount to confuse) */
1704 /* Stunning setting (amount to stun) */
1707 /* Sleep amount (amount to sleep) */
1710 /* Fear amount (amount to fear) */
1713 /* Time amount (amount to time) */
1716 bool heal_leper = FALSE;
1718 /* Hold the monster name */
1722 PARAMETER_VALUE photo = 0;
1724 /* Assume no note */
1727 /* Assume a default death */
1728 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1733 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1736 if (!c_ptr->m_idx) return (FALSE);
1738 /* Never affect projector */
1739 if (who && (c_ptr->m_idx == who)) return (FALSE);
1740 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1741 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1743 /* Don't affect already death monsters */
1744 /* Prevents problems with chain reactions of exploding monsters */
1745 if (m_ptr->hp < 0) return (FALSE);
1747 /* Reduce damage by distance */
1748 dam = (dam + r) / (r + 1);
1751 /* Get the monster name (BEFORE polymorphing) */
1752 monster_desc(m_name, m_ptr, 0);
1754 /* Get the monster possessive ("his"/"her"/"its") */
1755 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1757 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1759 /* Analyze the damage type */
1762 /* Magic Missile -- pure damage */
1765 if (seen) obvious = TRUE;
1767 if (r_ptr->flagsr & RFR_RES_ALL)
1769 note = _("には完全な耐性がある!", " is immune.");
1771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1780 if (seen) obvious = TRUE;
1782 if (r_ptr->flagsr & RFR_RES_ALL)
1784 note = _("には完全な耐性がある!", " is immune.");
1786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1789 if (r_ptr->flagsr & RFR_IM_ACID)
1791 note = _("にはかなり耐性がある!", " resists a lot.");
1793 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1801 if (seen) obvious = TRUE;
1803 if (r_ptr->flagsr & RFR_RES_ALL)
1805 note = _("には完全な耐性がある!", " is immune.");
1807 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1810 if (r_ptr->flagsr & RFR_IM_ELEC)
1812 note = _("にはかなり耐性がある!", " resists a lot.");
1814 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1822 if (seen) obvious = TRUE;
1824 if (r_ptr->flagsr & RFR_RES_ALL)
1826 note = _("には完全な耐性がある!", " is immune.");
1828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1831 if (r_ptr->flagsr & RFR_IM_FIRE)
1833 note = _("にはかなり耐性がある!", " resists a lot.");
1835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1837 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1839 note = _("はひどい痛手をうけた。", " is hit hard.");
1841 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1849 if (seen) obvious = TRUE;
1851 if (r_ptr->flagsr & RFR_RES_ALL)
1853 note = _("には完全な耐性がある!", " is immune.");
1855 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1858 if (r_ptr->flagsr & RFR_IM_COLD)
1860 note = _("にはかなり耐性がある!", " resists a lot.");
1862 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1864 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1866 note = _("はひどい痛手をうけた。", " is hit hard.");
1868 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1876 if (seen) obvious = TRUE;
1878 if (r_ptr->flagsr & RFR_RES_ALL)
1880 note = _("には完全な耐性がある!", " is immune.");
1882 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1885 if (r_ptr->flagsr & RFR_IM_POIS)
1887 note = _("にはかなり耐性がある!", " resists a lot.");
1889 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1897 if (seen) obvious = TRUE;
1899 if (r_ptr->flagsr & RFR_RES_ALL)
1901 note = _("には完全な耐性がある!", " is immune.");
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1906 if (r_ptr->flagsr & RFR_IM_POIS)
1908 note = _("には耐性がある。", " resists.");
1909 dam *= 3; dam /= randint1(6) + 6;
1910 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1912 else if (one_in_(3)) do_poly = TRUE;
1916 /* Hellfire -- hurts Evil */
1919 if (seen) obvious = TRUE;
1921 if (r_ptr->flagsr & RFR_RES_ALL)
1923 note = _("には完全な耐性がある!", " is immune.");
1925 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1928 if (r_ptr->flags3 & RF3_GOOD)
1930 note = _("はひどい痛手をうけた。", " is hit hard.");
1932 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1937 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1940 if (seen) obvious = TRUE;
1942 if (r_ptr->flagsr & RFR_RES_ALL)
1944 note = _("には完全な耐性がある!", " is immune.");
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1949 if (r_ptr->flags3 & RF3_GOOD)
1951 note = _("には完全な耐性がある!", " is immune.");
1953 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1955 else if (r_ptr->flags3 & RF3_EVIL)
1958 note = _("はひどい痛手をうけた。", " is hit hard.");
1959 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1963 note = _("には耐性がある。", " resists.");
1964 dam *= 3; dam /= randint1(6) + 6;
1969 /* Arrow -- XXX no defense */
1972 if (seen) obvious = TRUE;
1974 if (r_ptr->flagsr & RFR_RES_ALL)
1976 note = _("には完全な耐性がある!", " is immune.");
1978 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1984 /* Plasma -- XXX perhaps check ELEC or FIRE */
1987 if (seen) obvious = TRUE;
1989 if (r_ptr->flagsr & RFR_RES_ALL)
1991 note = _("には完全な耐性がある!", " is immune.");
1993 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1996 if (r_ptr->flagsr & RFR_RES_PLAS)
1998 note = _("には耐性がある。", " resists.");
1999 dam *= 3; dam /= randint1(6) + 6;
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2005 /* Nether -- see above */
2008 if (seen) obvious = TRUE;
2010 if (r_ptr->flagsr & RFR_RES_ALL)
2012 note = _("には完全な耐性がある!", " is immune.");
2014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2017 if (r_ptr->flagsr & RFR_RES_NETH)
2019 if (r_ptr->flags3 & RF3_UNDEAD)
2021 note = _("には完全な耐性がある!", " is immune.");
2023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2027 note = _("には耐性がある。", " resists.");
2028 dam *= 3; dam /= randint1(6) + 6;
2030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2032 else if (r_ptr->flags3 & RF3_EVIL)
2034 note = _("はいくらか耐性を示した。", " resists somewhat.");
2036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2041 /* Water (acid) damage -- Water spirits/elementals are immune */
2044 if (seen) obvious = TRUE;
2046 if (r_ptr->flagsr & RFR_RES_ALL)
2048 note = _("には完全な耐性がある!", " is immune.");
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2053 if (r_ptr->flagsr & RFR_RES_WATE)
2055 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2057 note = _("には完全な耐性がある!", " is immune.");
2062 note = _("には耐性がある。", " resists.");
2063 dam *= 3; dam /= randint1(6) + 6;
2065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2070 /* Chaos -- Chaos breathers resist */
2073 if (seen) obvious = TRUE;
2075 if (r_ptr->flagsr & RFR_RES_ALL)
2077 note = _("には完全な耐性がある!", " is immune.");
2079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2082 if (r_ptr->flagsr & RFR_RES_CHAO)
2084 note = _("には耐性がある。", " resists.");
2085 dam *= 3; dam /= randint1(6) + 6;
2086 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2088 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2090 note = _("はいくらか耐性を示した。", " resists somewhat.");
2091 dam *= 3; dam /= randint1(6) + 6;
2092 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2097 do_conf = (5 + randint1(11) + r) / (r + 1);
2102 /* Shards -- Shard breathers resist */
2105 if (seen) obvious = TRUE;
2107 if (r_ptr->flagsr & RFR_RES_ALL)
2109 note = _("には完全な耐性がある!", " is immune.");
2111 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2114 if (r_ptr->flagsr & RFR_RES_SHAR)
2116 note = _("には耐性がある。", " resists.");
2117 dam *= 3; dam /= randint1(6) + 6;
2118 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2123 /* Rocket: Shard resistance helps */
2126 if (seen) obvious = TRUE;
2128 if (r_ptr->flagsr & RFR_RES_ALL)
2130 note = _("には完全な耐性がある!", " is immune.");
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2135 if (r_ptr->flagsr & RFR_RES_SHAR)
2137 note = _("はいくらか耐性を示した。", " resists somewhat.");
2139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2145 /* Sound -- Sound breathers resist */
2148 if (seen) obvious = TRUE;
2150 if (r_ptr->flagsr & RFR_RES_ALL)
2152 note = _("には完全な耐性がある!", " is immune.");
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2157 if (r_ptr->flagsr & RFR_RES_SOUN)
2159 note = _("には耐性がある。", " resists.");
2160 dam *= 2; dam /= randint1(6) + 6;
2161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2163 else do_stun = (10 + randint1(15) + r) / (r + 1);
2170 if (seen) obvious = TRUE;
2172 if (r_ptr->flagsr & RFR_RES_ALL)
2174 note = _("には完全な耐性がある!", " is immune.");
2176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2179 if (r_ptr->flags3 & RF3_NO_CONF)
2181 note = _("には耐性がある。", " resists.");
2182 dam *= 3; dam /= randint1(6) + 6;
2183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2185 else do_conf = (10 + randint1(15) + r) / (r + 1);
2189 /* Disenchantment -- Breathers and Disenchanters resist */
2192 if (seen) obvious = TRUE;
2194 if (r_ptr->flagsr & RFR_RES_ALL)
2196 note = _("には完全な耐性がある!", " is immune.");
2198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2201 if (r_ptr->flagsr & RFR_RES_DISE)
2203 note = _("には耐性がある。", " resists.");
2204 dam *= 3; dam /= randint1(6) + 6;
2205 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2210 /* Nexus -- Breathers and Existers resist */
2213 if (seen) obvious = TRUE;
2215 if (r_ptr->flagsr & RFR_RES_ALL)
2217 note = _("には完全な耐性がある!", " is immune.");
2219 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2222 if (r_ptr->flagsr & RFR_RES_NEXU)
2224 note = _("には耐性がある。", " resists.");
2225 dam *= 3; dam /= randint1(6) + 6;
2226 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2234 if (seen) obvious = TRUE;
2236 if (r_ptr->flagsr & RFR_RES_ALL)
2238 note = _("には完全な耐性がある!", " is immune.");
2240 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2243 if (r_ptr->flagsr & RFR_RES_WALL)
2245 note = _("には耐性がある。", " resists.");
2246 dam *= 3; dam /= randint1(6) + 6;
2247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2249 else do_stun = (randint1(15) + r) / (r + 1);
2253 /* Inertia -- breathers resist */
2256 if (seen) obvious = TRUE;
2258 if (r_ptr->flagsr & RFR_RES_ALL)
2260 note = _("には完全な耐性がある!", " is immune.");
2262 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2265 if (r_ptr->flagsr & RFR_RES_INER)
2267 note = _("には耐性がある。", " resists.");
2268 dam *= 3; dam /= randint1(6) + 6;
2269 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2273 /* Powerful monsters can resist */
2274 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2275 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2279 /* Normal monsters slow down */
2282 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2284 note = _("の動きが遅くなった。", " starts moving slower.");
2291 /* Time -- breathers resist */
2294 if (seen) obvious = TRUE;
2296 if (r_ptr->flagsr & RFR_RES_ALL)
2298 note = _("には完全な耐性がある!", " is immune.");
2300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2303 if (r_ptr->flagsr & RFR_RES_TIME)
2305 note = _("には耐性がある。", " resists.");
2306 dam *= 3; dam /= randint1(6) + 6;
2307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2309 else do_time = (dam + 1) / 2;
2313 /* Gravity -- breathers resist */
2316 bool resist_tele = FALSE;
2318 if (seen) obvious = TRUE;
2320 if (r_ptr->flagsr & RFR_RES_ALL)
2322 note = _("には完全な耐性がある!", " is immune.");
2324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2327 if (r_ptr->flagsr & RFR_RES_TELE)
2329 if (r_ptr->flags1 & (RF1_UNIQUE))
2331 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2332 note = _("には効果がなかった。", " is unaffected!");
2335 else if (r_ptr->level > randint1(100))
2337 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2338 note = _("には耐性がある!", " resists!");
2343 if (!resist_tele) do_dist = 10;
2345 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2347 if (r_ptr->flagsr & RFR_RES_GRAV)
2349 note = _("には耐性がある!", " resists!");
2350 dam *= 3; dam /= randint1(6) + 6;
2352 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2357 /* Powerful monsters can resist */
2358 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2359 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2363 /* Normal monsters slow down */
2366 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2368 note = _("の動きが遅くなった。", " starts moving slower.");
2373 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2375 /* Attempt a saving throw */
2376 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2377 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2381 /* No obvious effect */
2382 note = _("には効果がなかった。", " is unaffected!");
2394 if (seen) obvious = TRUE;
2396 if (r_ptr->flagsr & RFR_RES_ALL)
2398 note = _("には完全な耐性がある!", " is immune.");
2400 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2408 case GF_DISINTEGRATE:
2410 if (seen) obvious = TRUE;
2412 if (r_ptr->flagsr & RFR_RES_ALL)
2414 note = _("には完全な耐性がある!", " is immune.");
2416 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2419 if (r_ptr->flags3 & RF3_HURT_ROCK)
2421 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2422 note = _("の皮膚がただれた!", " loses some skin!");
2423 note_dies = _("は蒸発した!", " evaporates!");
2431 if (seen) obvious = TRUE;
2433 /* PSI only works if the monster can see you! -- RG */
2434 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2437 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2442 if (r_ptr->flagsr & RFR_RES_ALL)
2444 note = _("には完全な耐性がある!", " is immune.");
2446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2449 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2452 note = _("には完全な耐性がある!", " is immune.");
2453 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2456 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2457 (r_ptr->flags3 & RF3_ANIMAL) ||
2458 (r_ptr->level > randint1(3 * dam)))
2460 note = _("には耐性がある!", " resists!");
2464 * Powerful demons & undead can turn a mindcrafter's
2465 * attacks back on them
2467 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2468 (r_ptr->level > p_ptr->lev / 2) &&
2472 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2473 (seen ? "%^s's corrupted mind backlashes your attack!" :
2474 "%^ss corrupted mind backlashes your attack!")), m_name);
2477 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2479 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2483 /* Injure +/- confusion */
2484 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2485 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2486 if (one_in_(4) && !CHECK_MULTISHADOW())
2488 switch (randint1(4))
2491 set_confused(p_ptr->confused + 3 + randint1(dam));
2494 set_stun(p_ptr->stun + randint1(dam));
2498 if (r_ptr->flags3 & RF3_NO_FEAR)
2499 note = _("には効果がなかった。", " is unaffected.");
2501 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2505 if (!p_ptr->free_act)
2506 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2515 if ((dam > 0) && one_in_(4))
2517 switch (randint1(4))
2520 do_conf = 3 + randint1(dam);
2523 do_stun = 3 + randint1(dam);
2526 do_fear = 3 + randint1(dam);
2529 note = _("は眠り込んでしまった!", " falls asleep!");
2530 do_sleep = 3 + randint1(dam);
2535 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2541 if (seen) obvious = TRUE;
2543 if (r_ptr->flagsr & RFR_RES_ALL)
2545 note = _("には完全な耐性がある!", " is immune.");
2547 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2550 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2553 note = _("には完全な耐性がある!", " is immune.");
2555 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2556 (r_ptr->flags3 & RF3_ANIMAL) ||
2557 (r_ptr->level > randint1(3 * dam)))
2559 note = _("には耐性がある!", " resists!");
2563 * Powerful demons & undead can turn a mindcrafter's
2564 * attacks back on them
2566 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2567 (r_ptr->level > p_ptr->lev / 2) &&
2571 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2572 (seen ? "%^s's corrupted mind backlashes your attack!" :
2573 "%^ss corrupted mind backlashes your attack!")), m_name);
2575 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2577 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2581 /* Injure + mana drain */
2582 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2583 if (!CHECK_MULTISHADOW())
2585 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2586 p_ptr->csp -= damroll(5, dam) / 2;
2587 if (p_ptr->csp < 0) p_ptr->csp = 0;
2588 p_ptr->redraw |= PR_MANA;
2589 p_ptr->window |= (PW_SPELL);
2591 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2598 int b = damroll(5, dam) / 4;
2599 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2600 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2601 (seen ? "You convert %s's pain into %s!" :
2602 "You convert %ss pain into %s!"));
2603 msg_format(msg, m_name, str);
2605 b = MIN(p_ptr->msp, p_ptr->csp + b);
2607 p_ptr->redraw |= PR_MANA;
2608 p_ptr->window |= (PW_SPELL);
2610 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2614 case GF_TELEKINESIS:
2616 if (seen) obvious = TRUE;
2618 if (r_ptr->flagsr & RFR_RES_ALL)
2620 note = _("には完全な耐性がある!", " is immune.");
2622 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2627 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2632 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2634 /* Attempt a saving throw */
2635 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2636 (r_ptr->level > 5 + randint1(dam)))
2640 /* No obvious effect */
2646 /* Psycho-spear -- powerful magic missile */
2649 if (seen) obvious = TRUE;
2651 if (r_ptr->flagsr & RFR_RES_ALL)
2653 note = _("には完全な耐性がある!", " is immune.");
2655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2661 /* Meteor -- powerful magic missile */
2664 if (seen) obvious = TRUE;
2666 if (r_ptr->flagsr & RFR_RES_ALL)
2668 note = _("には完全な耐性がある!", " is immune.");
2670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2678 if (!is_hostile(m_ptr)) break;
2680 if (seen) obvious = TRUE;
2682 if (r_ptr->flagsr & RFR_RES_ALL)
2684 note = _("には効果がなかった!", " is immune.");
2686 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2689 /* Attempt a saving throw */
2690 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2691 (r_ptr->flags3 & RF3_NO_CONF) ||
2692 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2694 /* Memorize a flag */
2695 if (r_ptr->flags3 & RF3_NO_CONF)
2697 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2704 * Powerful demons & undead can turn a mindcrafter's
2705 * attacks back on them
2707 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2708 (r_ptr->level > p_ptr->lev / 2) &&
2712 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2713 (seen ? "%^s's corrupted mind backlashes your attack!" :
2714 "%^ss corrupted mind backlashes your attack!")), m_name);
2717 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2719 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2723 /* Confuse, stun, terrify */
2724 switch (randint1(4))
2727 set_stun(p_ptr->stun + dam / 2);
2730 set_confused(p_ptr->confused + dam / 2);
2734 if (r_ptr->flags3 & RF3_NO_FEAR)
2735 note = _("には効果がなかった。", " is unaffected.");
2737 set_afraid(p_ptr->afraid + dam);
2744 /* No obvious effect */
2745 note = _("には効果がなかった。", " is unaffected.");
2751 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2753 note = _("があなたに隷属した。", " is in your thrall!");
2758 switch (randint1(4))
2772 /* No "real" damage */
2779 /* Ice -- Cold + Cuts + Stun */
2782 if (seen) obvious = TRUE;
2784 if (r_ptr->flagsr & RFR_RES_ALL)
2786 note = _("には完全な耐性がある!", " is immune.");
2788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2791 do_stun = (randint1(15) + 1) / (r + 1);
2792 if (r_ptr->flagsr & RFR_IM_COLD)
2794 note = _("にはかなり耐性がある!", " resists a lot.");
2796 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2798 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2800 note = _("はひどい痛手をうけた。", " is hit hard.");
2802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2809 case GF_HYPODYNAMIA:
2811 if (seen) obvious = TRUE;
2813 if (r_ptr->flagsr & RFR_RES_ALL)
2815 note = _("には完全な耐性がある!", " is immune.");
2817 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2820 if (!monster_living(r_ptr))
2822 if (is_original_ap_and_seen(m_ptr))
2824 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2825 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2826 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2828 note = _("には効果がなかった。", " is unaffected.");
2832 else do_time = (dam+7)/8;
2840 if (seen) obvious = TRUE;
2842 if (r_ptr->flagsr & RFR_RES_ALL)
2844 note = _("には完全な耐性がある!", " is immune.");
2846 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2849 if (!monster_living(r_ptr))
2851 if (is_original_ap_and_seen(m_ptr))
2853 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2854 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2855 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2857 note = _("には完全な耐性がある!", " is immune.");
2861 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2862 (randint1(888) != 666)) ||
2863 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2864 randint1(100) != 66))
2866 note = _("には耐性がある!", " resists!");
2874 /* Polymorph monster (Use "dam" as "power") */
2877 if (seen) obvious = TRUE;
2879 if (r_ptr->flagsr & RFR_RES_ALL)
2881 note = _("には効果がなかった。", " is unaffected.");
2883 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2886 /* Attempt to polymorph (see below) */
2889 /* Powerful monsters can resist */
2890 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2891 (r_ptr->flags1 & RF1_QUESTOR) ||
2892 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2894 note = _("には効果がなかった。", " is unaffected.");
2899 /* No "real" damage */
2906 /* Clone monsters (Ignore "dam") */
2909 if (seen) obvious = TRUE;
2911 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2913 note = _("には効果がなかった。", " is unaffected.");
2918 m_ptr->hp = m_ptr->maxhp;
2920 /* Attempt to clone. */
2921 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2923 note = _("が分裂した!", " spawns!");
2927 /* No "real" damage */
2934 /* Heal Monster (use "dam" as amount of healing) */
2937 if (seen) obvious = TRUE;
2940 (void)set_monster_csleep(c_ptr->m_idx, 0);
2942 if (m_ptr->maxhp < m_ptr->max_maxhp)
2944 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2945 m_ptr->maxhp = m_ptr->max_maxhp;
2950 /* Redraw (later) if needed */
2951 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2952 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2960 if (seen) obvious = TRUE;
2963 (void)set_monster_csleep(c_ptr->m_idx, 0);
2964 if (MON_STUNNED(m_ptr))
2966 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2967 (void)set_monster_stunned(c_ptr->m_idx, 0);
2969 if (MON_CONFUSED(m_ptr))
2971 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2972 (void)set_monster_confused(c_ptr->m_idx, 0);
2974 if (MON_MONFEAR(m_ptr))
2976 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2977 (void)set_monster_monfear(c_ptr->m_idx, 0);
2981 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2984 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2988 chg_virtue(V_VITALITY, 1);
2990 if (r_ptr->flags1 & RF1_UNIQUE)
2991 chg_virtue(V_INDIVIDUALISM, 1);
2993 if (is_friendly(m_ptr))
2994 chg_virtue(V_HONOUR, 1);
2995 else if (!(r_ptr->flags3 & RF3_EVIL))
2997 if (r_ptr->flags3 & RF3_GOOD)
2998 chg_virtue(V_COMPASSION, 2);
3000 chg_virtue(V_COMPASSION, 1);
3003 if (r_ptr->flags3 & RF3_ANIMAL)
3004 chg_virtue(V_NATURE, 1);
3007 if (m_ptr->r_idx == MON_LEPER)
3010 if (!who) chg_virtue(V_COMPASSION, 5);
3013 /* Redraw (later) if needed */
3014 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3015 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3018 note = _("は体力を回復したようだ。", " looks healthier.");
3020 /* No "real" damage */
3026 /* Speed Monster (Ignore "dam") */
3029 if (seen) obvious = TRUE;
3032 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3034 note = _("の動きが速くなった。", " starts moving faster.");
3039 if (r_ptr->flags1 & RF1_UNIQUE)
3040 chg_virtue(V_INDIVIDUALISM, 1);
3041 if (is_friendly(m_ptr))
3042 chg_virtue(V_HONOUR, 1);
3045 /* No "real" damage */
3051 /* Slow Monster (Use "dam" as "power") */
3054 if (seen) obvious = TRUE;
3056 if (r_ptr->flagsr & RFR_RES_ALL)
3058 note = _("には効果がなかった。", " is unaffected.");
3060 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3063 /* Powerful monsters can resist */
3064 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3065 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3067 note = _("には効果がなかった。", " is unaffected.");
3071 /* Normal monsters slow down */
3074 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3076 note = _("の動きが遅くなった。", " starts moving slower.");
3080 /* No "real" damage */
3086 /* Sleep (Use "dam" as "power") */
3089 if (seen) obvious = TRUE;
3091 if (r_ptr->flagsr & RFR_RES_ALL)
3093 note = _("には効果がなかった。", " is unaffected.");
3095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3098 /* Attempt a saving throw */
3099 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3100 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3101 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3103 /* Memorize a flag */
3104 if (r_ptr->flags3 & RF3_NO_SLEEP)
3106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3108 /* No obvious effect */
3109 note = _("には効果がなかった。", " is unaffected.");
3114 /* Go to sleep (much) later */
3115 note = _("は眠り込んでしまった!", " falls asleep!");
3119 /* No "real" damage */
3125 /* Sleep (Use "dam" as "power") */
3126 case GF_STASIS_EVIL:
3128 if (seen) obvious = TRUE;
3130 if (r_ptr->flagsr & RFR_RES_ALL)
3132 note = _("には効果がなかった!", " is immune.");
3134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3137 /* Attempt a saving throw */
3138 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3139 !(r_ptr->flags3 & RF3_EVIL) ||
3140 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3142 note = _("には効果がなかった。", " is unaffected.");
3147 /* Go to sleep (much) later */
3148 note = _("は動けなくなった!", " is suspended!");
3152 /* No "real" damage */
3157 /* Sleep (Use "dam" as "power") */
3160 if (seen) obvious = TRUE;
3162 if (r_ptr->flagsr & RFR_RES_ALL)
3164 note = _("には効果がなかった。", " is unaffected.");
3166 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3169 /* Attempt a saving throw */
3170 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3171 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3173 note = _("には効果がなかった。", " is unaffected.");
3178 /* Go to sleep (much) later */
3179 note = _("は動けなくなった!", " is suspended!");
3183 /* No "real" damage */
3192 vir = virtue_number(V_HARMONY);
3195 dam += p_ptr->virtues[vir-1]/10;
3198 vir = virtue_number(V_INDIVIDUALISM);
3201 dam -= p_ptr->virtues[vir-1]/20;
3204 if (seen) obvious = TRUE;
3206 /* Attempt a saving throw */
3207 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3211 /* No obvious effect */
3212 note = _("には効果がなかった。", " is unaffected.");
3215 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3217 else if (p_ptr->cursed & TRC_AGGRAVATE)
3219 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3220 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3224 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3227 chg_virtue(V_INDIVIDUALISM, -1);
3228 if (r_ptr->flags3 & RF3_ANIMAL)
3229 chg_virtue(V_NATURE, 1);
3232 /* No "real" damage */
3237 /* Control undead */
3238 case GF_CONTROL_UNDEAD:
3241 if (seen) obvious = TRUE;
3243 vir = virtue_number(V_UNLIFE);
3246 dam += p_ptr->virtues[vir-1]/10;
3249 vir = virtue_number(V_INDIVIDUALISM);
3252 dam -= p_ptr->virtues[vir-1]/20;
3255 /* Attempt a saving throw */
3256 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3257 !(r_ptr->flags3 & RF3_UNDEAD))
3259 /* No obvious effect */
3260 note = _("には効果がなかった。", " is unaffected.");
3262 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3264 else if (p_ptr->cursed & TRC_AGGRAVATE)
3266 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3267 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3271 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3275 /* No "real" damage */
3281 case GF_CONTROL_DEMON:
3284 if (seen) obvious = TRUE;
3286 vir = virtue_number(V_UNLIFE);
3289 dam += p_ptr->virtues[vir-1]/10;
3292 vir = virtue_number(V_INDIVIDUALISM);
3295 dam -= p_ptr->virtues[vir-1]/20;
3298 /* Attempt a saving throw */
3299 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3300 !(r_ptr->flags3 & RF3_DEMON))
3302 /* No obvious effect */
3303 note = _("には効果がなかった。", " is unaffected.");
3305 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3307 else if (p_ptr->cursed & TRC_AGGRAVATE)
3309 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3310 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3314 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3318 /* No "real" damage */
3324 case GF_CONTROL_ANIMAL:
3327 if (seen) obvious = TRUE;
3329 vir = virtue_number(V_NATURE);
3332 dam += p_ptr->virtues[vir-1]/10;
3335 vir = virtue_number(V_INDIVIDUALISM);
3338 dam -= p_ptr->virtues[vir-1]/20;
3341 /* Attempt a saving throw */
3342 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3343 !(r_ptr->flags3 & RF3_ANIMAL))
3346 /* No obvious effect */
3347 note = _("には効果がなかった。", " is unaffected.");
3349 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3351 else if (p_ptr->cursed & TRC_AGGRAVATE)
3353 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3354 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3358 note = _("はなついた。", " is tamed!");
3360 if (r_ptr->flags3 & RF3_ANIMAL)
3361 chg_virtue(V_NATURE, 1);
3364 /* No "real" damage */
3370 case GF_CHARM_LIVING:
3374 vir = virtue_number(V_UNLIFE);
3375 if (seen) obvious = TRUE;
3377 vir = virtue_number(V_UNLIFE);
3380 dam -= p_ptr->virtues[vir-1]/10;
3383 vir = virtue_number(V_INDIVIDUALISM);
3386 dam -= p_ptr->virtues[vir-1]/20;
3389 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3391 /* Attempt a saving throw */
3392 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3393 !monster_living(r_ptr))
3396 /* No obvious effect */
3397 note = _("には効果がなかった。", " is unaffected.");
3399 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3401 else if (p_ptr->cursed & TRC_AGGRAVATE)
3403 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3404 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3408 note = _("を支配した。", " is tamed!");
3410 if (r_ptr->flags3 & RF3_ANIMAL)
3411 chg_virtue(V_NATURE, 1);
3414 /* No "real" damage */
3419 /* Confusion (Use "dam" as "power") */
3422 if (seen) obvious = TRUE;
3424 if (r_ptr->flagsr & RFR_RES_ALL)
3426 note = _("には効果がなかった。", " is unaffected.");
3428 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3431 /* Get confused later */
3432 do_conf = damroll(3, (dam / 2)) + 1;
3434 /* Attempt a saving throw */
3435 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3436 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3437 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3439 /* Memorize a flag */
3440 if (r_ptr->flags3 & (RF3_NO_CONF))
3442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3448 /* No obvious effect */
3449 note = _("には効果がなかった。", " is unaffected.");
3453 /* No "real" damage */
3460 if (seen) obvious = TRUE;
3462 if (r_ptr->flagsr & RFR_RES_ALL)
3464 note = _("には効果がなかった。", " is unaffected.");
3466 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3469 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3471 /* Attempt a saving throw */
3472 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3473 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3478 /* No obvious effect */
3479 note = _("には効果がなかった。", " is unaffected.");
3483 /* No "real" damage */
3491 /* Lite, but only hurts susceptible creatures */
3499 if (r_ptr->flagsr & RFR_RES_ALL)
3505 if (r_ptr->flags3 & (RF3_HURT_LITE))
3507 /* Obvious effect */
3508 if (seen) obvious = TRUE;
3510 /* Memorize the effects */
3511 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3513 /* Special effect */
3514 note = _("は光に身をすくめた!", " cringes from the light!");
3515 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3518 /* Normally no damage */
3530 /* Lite -- opposite of Dark */
3533 if (seen) obvious = TRUE;
3535 if (r_ptr->flagsr & RFR_RES_ALL)
3537 note = _("には完全な耐性がある!", " is immune.");
3539 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3542 if (r_ptr->flagsr & RFR_RES_LITE)
3544 note = _("には耐性がある!", " resists!");
3545 dam *= 2; dam /= (randint1(6)+6);
3546 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3548 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3551 note = _("は光に身をすくめた!", " cringes from the light!");
3552 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3559 /* Dark -- opposite of Lite */
3562 if (seen) obvious = TRUE;
3564 if (r_ptr->flagsr & RFR_RES_ALL)
3566 note = _("には完全な耐性がある!", " is immune.");
3568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3571 if (r_ptr->flagsr & RFR_RES_DARK)
3573 note = _("には耐性がある!", " resists!");
3574 dam *= 2; dam /= (randint1(6)+6);
3575 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3584 if (r_ptr->flagsr & RFR_RES_ALL)
3589 /* Hurt by rock remover */
3590 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3593 if (seen) obvious = TRUE;
3595 /* Memorize the effects */
3596 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3598 /* Cute little message */
3599 note = _("の皮膚がただれた!", " loses some skin!");
3600 note_dies = _("はドロドロに溶けた!", " dissolves!");
3603 /* Usually, ignore the effects */
3614 /* Teleport undead (Use "dam" as "power") */
3615 case GF_AWAY_UNDEAD:
3617 /* Only affect undead */
3618 if (r_ptr->flags3 & (RF3_UNDEAD))
3620 bool resists_tele = FALSE;
3622 if (r_ptr->flagsr & RFR_RES_TELE)
3624 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3627 note = _("には効果がなかった。", " is unaffected.");
3628 resists_tele = TRUE;
3630 else if (r_ptr->level > randint1(100))
3632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3633 note = _("には耐性がある!", " resists!");
3634 resists_tele = TRUE;
3640 if (seen) obvious = TRUE;
3641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3653 /* No "real" damage */
3659 /* Teleport evil (Use "dam" as "power") */
3662 /* Only affect evil */
3663 if (r_ptr->flags3 & (RF3_EVIL))
3665 bool resists_tele = FALSE;
3667 if (r_ptr->flagsr & RFR_RES_TELE)
3669 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3671 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3672 note = _("には効果がなかった。", " is unaffected.");
3673 resists_tele = TRUE;
3675 else if (r_ptr->level > randint1(100))
3677 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3678 note = _("には耐性がある!", " resists!");
3679 resists_tele = TRUE;
3685 if (seen) obvious = TRUE;
3686 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3698 /* No "real" damage */
3704 /* Teleport monster (Use "dam" as "power") */
3707 bool resists_tele = FALSE;
3708 if (r_ptr->flagsr & RFR_RES_TELE)
3710 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3712 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3713 note = _("には効果がなかった。", " is unaffected.");
3714 resists_tele = TRUE;
3716 else if (r_ptr->level > randint1(100))
3718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3719 note = _("には耐性がある!", " resists!");
3720 resists_tele = TRUE;
3727 if (seen) obvious = TRUE;
3729 /* Prepare to teleport */
3733 /* No "real" damage */
3739 /* Turn undead (Use "dam" as "power") */
3740 case GF_TURN_UNDEAD:
3742 if (r_ptr->flagsr & RFR_RES_ALL)
3747 /* Only affect undead */
3748 if (r_ptr->flags3 & (RF3_UNDEAD))
3751 if (seen) obvious = TRUE;
3753 /* Learn about type */
3754 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3756 /* Apply some fear */
3757 do_fear = damroll(3, (dam / 2)) + 1;
3759 /* Attempt a saving throw */
3760 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3762 /* No obvious effect */
3763 note = _("には効果がなかった。", " is unaffected.");
3776 /* No "real" damage */
3782 /* Turn evil (Use "dam" as "power") */
3785 if (r_ptr->flagsr & RFR_RES_ALL)
3790 /* Only affect evil */
3791 if (r_ptr->flags3 & (RF3_EVIL))
3794 if (seen) obvious = TRUE;
3796 /* Learn about type */
3797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3799 /* Apply some fear */
3800 do_fear = damroll(3, (dam / 2)) + 1;
3802 /* Attempt a saving throw */
3803 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3805 /* No obvious effect */
3806 note = _("には効果がなかった。", " is unaffected.");
3819 /* No "real" damage */
3825 /* Turn monster (Use "dam" as "power") */
3828 if (r_ptr->flagsr & RFR_RES_ALL)
3834 if (seen) obvious = TRUE;
3836 /* Apply some fear */
3837 do_fear = damroll(3, (dam / 2)) + 1;
3839 /* Attempt a saving throw */
3840 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3841 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3842 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3844 /* No obvious effect */
3845 note = _("には効果がなかった。", " is unaffected.");
3850 /* No "real" damage */
3857 case GF_DISP_UNDEAD:
3859 if (r_ptr->flagsr & RFR_RES_ALL)
3865 /* Only affect undead */
3866 if (r_ptr->flags3 & (RF3_UNDEAD))
3869 if (seen) obvious = TRUE;
3871 /* Learn about type */
3872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3875 note = _("は身震いした。", " shudders.");
3876 note_dies = _("はドロドロに溶けた!", " dissolves!");
3896 if (r_ptr->flagsr & RFR_RES_ALL)
3902 /* Only affect evil */
3903 if (r_ptr->flags3 & (RF3_EVIL))
3906 if (seen) obvious = TRUE;
3908 /* Learn about type */
3909 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3912 note = _("は身震いした。", " shudders.");
3913 note_dies = _("はドロドロに溶けた!", " dissolves!");
3932 if (r_ptr->flagsr & RFR_RES_ALL)
3938 /* Only affect good */
3939 if (r_ptr->flags3 & (RF3_GOOD))
3942 if (seen) obvious = TRUE;
3944 /* Learn about type */
3945 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3948 note = _("は身震いした。", " shudders.");
3949 note_dies = _("はドロドロに溶けた!", " dissolves!");
3966 case GF_DISP_LIVING:
3968 if (r_ptr->flagsr & RFR_RES_ALL)
3974 /* Only affect non-undead */
3975 if (monster_living(r_ptr))
3978 if (seen) obvious = TRUE;
3981 note = _("は身震いした。", " shudders.");
3982 note_dies = _("はドロドロに溶けた!", " dissolves!");
4001 if (r_ptr->flagsr & RFR_RES_ALL)
4007 /* Only affect demons */
4008 if (r_ptr->flags3 & (RF3_DEMON))
4011 if (seen) obvious = TRUE;
4013 /* Learn about type */
4014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4017 note = _("は身震いした。", " shudders.");
4018 note_dies = _("はドロドロに溶けた!", " dissolves!");
4034 /* Dispel monster */
4037 if (r_ptr->flagsr & RFR_RES_ALL)
4044 if (seen) obvious = TRUE;
4047 note = _("は身震いした。", " shudders.");
4048 note_dies = _("はドロドロに溶けた!", " dissolves!");
4055 if (seen) obvious = TRUE;
4057 if (r_ptr->flagsr & RFR_RES_ALL)
4059 note = _("には完全な耐性がある!", " is immune.");
4061 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4065 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4069 /* Heal the monster */
4070 if (caster_ptr->hp < caster_ptr->maxhp)
4073 caster_ptr->hp += dam;
4074 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4076 /* Redraw (later) if needed */
4077 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4078 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4080 /* Special message */
4083 /* Get the monster name */
4084 monster_desc(killer, caster_ptr, 0);
4085 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4092 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4093 (void)hp_player(dam);
4098 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4107 if (seen) obvious = TRUE;
4109 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4111 if (r_ptr->flagsr & RFR_RES_ALL)
4113 note = _("には完全な耐性がある!", " is immune.");
4115 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4119 /* Attempt a saving throw */
4120 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4121 (r_ptr->flags3 & RF3_NO_CONF) ||
4122 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4124 /* Memorize a flag */
4125 if (r_ptr->flags3 & (RF3_NO_CONF))
4127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4129 note = _("には効果がなかった。", " is unaffected.");
4132 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4135 note = _("には完全な耐性がある!", " is immune.");
4138 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4140 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4141 note = _("には耐性がある。", " resists.");
4146 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4147 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4149 if (who > 0) do_conf = randint0(4) + 4;
4150 else do_conf = randint0(8) + 8;
4156 case GF_BRAIN_SMASH:
4158 if (seen) obvious = TRUE;
4160 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4162 if (r_ptr->flagsr & RFR_RES_ALL)
4164 note = _("には完全な耐性がある!", " is immune.");
4166 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4170 /* Attempt a saving throw */
4171 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4172 (r_ptr->flags3 & RF3_NO_CONF) ||
4173 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4175 /* Memorize a flag */
4176 if (r_ptr->flags3 & (RF3_NO_CONF))
4178 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4180 note = _("には効果がなかった。", " is unaffected.");
4183 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4185 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4186 note = _("には完全な耐性がある!", " is immune.");
4189 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4192 note = _("には耐性がある!", " resists!");
4197 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4198 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4202 do_conf = randint0(4) + 4;
4203 do_stun = randint0(4) + 4;
4207 do_conf = randint0(8) + 8;
4208 do_stun = randint0(8) + 8;
4210 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4218 if (seen) obvious = TRUE;
4220 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4222 if (r_ptr->flagsr & RFR_RES_ALL)
4224 note = _("には完全な耐性がある!", " is immune.");
4226 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4230 /* Attempt a saving throw */
4231 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4233 note = _("には効果がなかった。", " is unaffected.");
4242 if (seen) obvious = TRUE;
4244 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4246 if (r_ptr->flagsr & RFR_RES_ALL)
4248 note = _("には完全な耐性がある!", " is immune.");
4250 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4254 /* Attempt a saving throw */
4255 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4257 note = _("には効果がなかった。", " is unaffected.");
4266 if (seen) obvious = TRUE;
4268 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4270 if (r_ptr->flagsr & RFR_RES_ALL)
4272 note = _("には完全な耐性がある!", " is immune.");
4274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4278 /* Attempt a saving throw */
4279 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4281 note = _("には効果がなかった。", " is unaffected.");
4290 if (seen) obvious = TRUE;
4293 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4294 "You point at %s, screaming the word, 'DIE!'."), m_name);
4296 if (r_ptr->flagsr & RFR_RES_ALL)
4298 note = _("には完全な耐性がある!", " is immune.");
4300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4304 /* Attempt a saving throw */
4305 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4307 note = _("には効果がなかった。", " is unaffected.");
4316 if (seen) obvious = TRUE;
4318 if (r_ptr->flagsr & RFR_RES_ALL)
4320 note = _("には完全な耐性がある!", " is immune.");
4322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4326 if (r_ptr->flags1 & RF1_UNIQUE)
4328 note = _("には効果がなかった。", " is unaffected.");
4333 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4334 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4336 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4338 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4342 note = _("は耐性を持っている!", "resists!");
4349 /* Capture monster */
4353 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4354 (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)
4356 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4361 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4362 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4363 nokori_hp = m_ptr->maxhp * 3 / 10;
4365 nokori_hp = m_ptr->maxhp * 3 / 20;
4367 if (m_ptr->hp >= nokori_hp)
4369 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4372 else if (m_ptr->hp < randint0(nokori_hp))
4374 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4375 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4376 cap_mon = m_ptr->r_idx;
4377 cap_mspeed = m_ptr->mspeed;
4379 cap_maxhp = m_ptr->max_maxhp;
4380 cap_nickname = m_ptr->nickname; /* Quark transfer */
4381 if (c_ptr->m_idx == p_ptr->riding)
4383 if (rakuba(-1, FALSE))
4385 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4389 delete_monster_idx(c_ptr->m_idx);
4395 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4401 /* Attack (Use "dam" as attack type) */
4404 /* Return this monster's death */
4405 return py_attack(y, x, dam);
4408 /* Sleep (Use "dam" as "power") */
4414 if (seen) obvious = TRUE;
4416 if (r_ptr->flagsr & RFR_RES_ALL)
4418 note = _("には効果がなかった。", " is unaffected.");
4420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4423 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4425 note = _("には効果がなかった。", " is unaffected.");
4428 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4431 if (MON_CSLEEP(m_ptr))
4433 note = _("には効果がなかった。", " is unaffected.");
4439 if (one_in_(5)) effect = 1;
4440 else if (one_in_(4)) effect = 2;
4441 else if (one_in_(3)) effect = 3;
4446 /* Powerful monsters can resist */
4447 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4448 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4450 note = _("には効果がなかった。", " is unaffected.");
4454 /* Normal monsters slow down */
4457 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4459 note = _("の動きが遅くなった。", " starts moving slower.");
4464 else if (effect == 2)
4466 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4468 /* Attempt a saving throw */
4469 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4470 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4475 /* No obvious effect */
4476 note = _("には効果がなかった。", " is unaffected.");
4481 else if (effect == 3)
4483 /* Attempt a saving throw */
4484 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4485 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4486 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4488 /* Memorize a flag */
4489 if (r_ptr->flags3 & RF3_NO_SLEEP)
4491 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4494 /* No obvious effect */
4495 note = _("には効果がなかった。", " is unaffected.");
4500 /* Go to sleep (much) later */
4501 note = _("は眠り込んでしまった!", " falls asleep!");
4508 note = _("には効果がなかった。", " is unaffected.");
4511 /* No "real" damage */
4519 if (seen) obvious = TRUE;
4521 if (r_ptr->flagsr & RFR_RES_ALL)
4523 note = _("には効果がなかった。", " is unaffected.");
4525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4529 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4531 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4532 chg_virtue(V_VITALITY, -1);
4542 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4544 if (r_ptr->flags3 & (RF3_HURT_LITE))
4546 /* Obvious effect */
4547 if (seen) obvious = TRUE;
4549 /* Memorize the effects */
4550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4552 /* Special effect */
4553 note = _("は光に身をすくめた!", " cringes from the light!");
4554 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4557 /* Normally no damage */
4564 photo = m_ptr->r_idx;
4571 case GF_BLOOD_CURSE:
4573 if (seen) obvious = TRUE;
4575 if (r_ptr->flagsr & RFR_RES_ALL)
4577 note = _("には完全な耐性がある!", " is immune.");
4579 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4587 bool success = FALSE;
4588 if (seen) obvious = TRUE;
4590 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4592 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4593 if (dam < 1) dam = 1;
4595 /* No need to tame your pet */
4598 note = _("の動きが速くなった。", " starts moving faster.");
4599 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4603 /* Attempt a saving throw */
4604 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4605 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4606 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4607 (p_ptr->cursed & TRC_AGGRAVATE) ||
4608 ((r_ptr->level+10) > randint1(dam)))
4611 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4615 note = _("を支配した。", " is tamed!");
4617 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4619 /* Learn about type */
4620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4627 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4629 do_fear = randint1(90)+10;
4631 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4634 /* No "real" damage */
4641 if (seen) obvious = TRUE;
4643 if (r_ptr->flagsr & RFR_RES_ALL)
4645 note = _("には完全な耐性がある!", " is immune.");
4647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4651 /* Attempt a saving throw */
4652 if (randint0(100 + dam) < (r_ptr->level + 50))
4654 note = _("には効果がなかった。", " is unaffected.");
4674 /* Absolutely no effect */
4675 if (skipped) return (FALSE);
4677 /* "Unique" monsters cannot be polymorphed */
4678 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4680 /* Quest monsters cannot be polymorphed */
4681 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4683 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4685 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4686 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4688 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4693 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4694 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4697 /* Modify the damage */
4699 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4700 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4702 /* Check for death */
4703 if (dam > m_ptr->hp)
4705 /* Extract method of death */
4710 /* Sound and Impact resisters never stun */
4712 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4713 !(r_ptr->flags3 & RF3_NO_STUN))
4716 if (seen) obvious = TRUE;
4719 if (MON_STUNNED(m_ptr))
4721 note = _("はひどくもうろうとした。", " is more dazed.");
4722 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4726 note = _("はもうろうとした。", " is dazed.");
4731 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4737 /* Confusion and Chaos resisters (and sleepers) never confuse */
4739 !(r_ptr->flags3 & RF3_NO_CONF) &&
4740 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4743 if (seen) obvious = TRUE;
4745 /* Already partially confused */
4746 if (MON_CONFUSED(m_ptr))
4748 note = _("はさらに混乱したようだ。", " looks more confused.");
4749 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4752 /* Was not confused */
4755 note = _("は混乱したようだ。", " looks confused.");
4759 /* Apply confusion */
4760 (void)set_monster_confused(c_ptr->m_idx, tmp);
4769 if (seen) obvious = TRUE;
4771 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4775 note = _("は弱くなったようだ。", " seems weakened.");
4776 m_ptr->maxhp -= do_time;
4777 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4782 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4783 if (do_poly && (randint1(90) > r_ptr->level))
4785 if (polymorph_monster(y, x))
4788 if (seen) obvious = TRUE;
4790 /* Monster polymorphs */
4791 note = _("が変身した!", " changes!");
4793 /* Turn off the damage */
4799 note = _("には効果がなかった。", " is unaffected.");
4802 /* Hack -- Get new monster */
4803 m_ptr = &m_list[c_ptr->m_idx];
4805 /* Hack -- Get new race */
4806 r_ptr = &r_info[m_ptr->r_idx];
4809 /* Handle "teleport" */
4813 if (seen) obvious = TRUE;
4816 note = _("が消え去った!", " disappears!");
4818 if (!who) chg_virtue(V_VALOUR, -1);
4821 teleport_away(c_ptr->m_idx, do_dist,
4822 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4824 /* Hack -- get new location */
4828 /* Hack -- get new grid */
4829 c_ptr = &cave[y][x];
4836 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4843 if (typ == GF_DRAIN_MANA)
4845 /* Drain mana does nothing */
4848 /* If another monster did the damage, hurt the monster by hand */
4851 /* Redraw (later) if needed */
4852 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4853 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4855 /* Wake the monster up */
4856 (void)set_monster_csleep(c_ptr->m_idx, 0);
4858 /* Hurt the monster */
4866 if (is_pet(m_ptr) && !(m_ptr->ml))
4869 /* Give detailed messages if destroyed */
4872 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4875 msg_format("%^s%s", m_name, note);
4883 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4885 /* Generate treasure, etc */
4886 monster_death(c_ptr->m_idx, FALSE);
4888 /* Delete the monster */
4889 delete_monster_idx(c_ptr->m_idx);
4893 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4897 /* Damaged monster */
4900 /* Give detailed messages if visible or destroyed */
4901 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4903 /* Hack -- Pain message */
4906 message_pain(c_ptr->m_idx, dam);
4913 /* Hack -- handle sleep */
4914 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4918 else if (heal_leper)
4920 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4922 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4926 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4927 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4930 delete_monster_idx(c_ptr->m_idx);
4933 /* If the player did it, give him experience, check fear */
4938 /* Hurt the monster, check for fear and death */
4939 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4944 /* Damaged monster */
4947 /* HACK - anger the monster before showing the sleep message */
4948 if (do_sleep) anger_monster(m_ptr);
4950 /* Give detailed messages if visible or destroyed */
4951 if (note && seen_msg)
4952 msg_format(_("%s%s", "%^s%s"), m_name, note);
4954 /* Hack -- Pain message */
4955 else if (known && (dam || !do_fear))
4957 message_pain(c_ptr->m_idx, dam);
4960 /* Anger monsters */
4961 if (((dam > 0) || get_angry) && !do_sleep)
4962 anger_monster(m_ptr);
4965 if ((fear || do_fear) && seen)
4971 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4974 /* Hack -- handle sleep */
4975 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4979 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4981 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4985 switch (randint1(28))
4990 msg_print(_("地面が揺れた...", "The ground trembles..."));
4991 earthquake(ty, tx, 4 + randint0(4));
4992 if (!one_in_(6)) break;
4994 case 3: case 4: case 5: case 6:
4997 int extra_dam = damroll(10, 10);
4998 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
5000 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
5001 if (!one_in_(6)) break;
5006 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5008 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5009 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5010 if (!one_in_(6)) break;
5012 case 9: case 10: case 11:
5013 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5014 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5015 if (!one_in_(6)) break;
5016 case 12: case 13: case 14: case 15: case 16:
5017 aggravate_monsters(0);
5018 if (!one_in_(6)) break;
5020 count += activate_hi_summon(ty, tx, TRUE);
5021 if (!one_in_(6)) break;
5022 case 19: case 20: case 21: case 22:
5024 bool pet = !one_in_(3);
5025 BIT_FLAGS mode = PM_ALLOW_GROUP;
5027 if (pet) mode |= PM_FORCE_PET;
5028 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5030 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);
5031 if (!one_in_(6)) break;
5033 case 23: case 24: case 25:
5034 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5035 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5037 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5038 else lose_exp(p_ptr->exp / 16);
5039 if (!one_in_(6)) break;
5040 case 26: case 27: case 28:
5049 (void)do_dec_stat(i);
5058 (void)do_dec_stat(randint0(6));
5067 if (p_ptr->inside_battle)
5069 p_ptr->health_who = c_ptr->m_idx;
5070 p_ptr->redraw |= (PR_HEALTH);
5074 /* XXX XXX XXX Verify this code */
5076 /* Update the monster */
5077 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5079 /* Redraw the monster grid */
5083 /* Update monster recall window */
5084 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5087 p_ptr->window |= (PW_MONSTER);
5090 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5094 if (!(flg & PROJECT_NO_HANGEKI))
5096 set_target(m_ptr, monster_target_y, monster_target_x);
5099 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5101 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5105 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5107 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5108 rakubadam_m = (dam > 200) ? 200 : dam;
5117 /* Get local object */
5120 /* Prepare to make a Blade of Chaos */
5121 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5123 q_ptr->pval = photo;
5125 /* Mark the item as fully known */
5126 q_ptr->ident |= (IDENT_MENTAL);
5128 /* Drop it in the dungeon */
5129 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5137 /* Return "Anything seen?" */
5142 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5143 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5144 * @param who_name 効果を起こしたモンスターの名前
5145 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5146 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5147 * @param x 目標X座標 / Target x location (or location to travel "towards")
5148 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5149 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5151 * @param monspell 効果元のモンスター魔法ID
5152 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5154 * Handle a beam/bolt/ball causing damage to the player.
5155 * This routine takes a "source monster" (by index), a "distance", a default
5156 * "damage", and a "damage type". See "project_m()" above.
5157 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5158 * is reduced (see "project_m()" above). This can happen if a monster breathes
5159 * at the player and hits a wall instead.
5160 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5161 * to know if this is actually a ball or a bolt spell
5162 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5163 * we just assume that the effects were obvious, for historical reasons.
5165 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)
5170 /* Hack -- assume obvious */
5171 bool obvious = TRUE;
5173 /* Player blind-ness */
5174 bool blind = (p_ptr->blind ? TRUE : FALSE);
5176 /* Player needs a "description" (he is blind) */
5179 /* Source monster */
5180 monster_type *m_ptr = NULL;
5182 /* Monster name (for attacks) */
5185 /* Monster name (for damage) */
5188 /* Hack -- messages */
5194 /* Player is not here */
5195 if (!player_bold(y, x)) return (FALSE);
5197 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5199 if (kawarimi(TRUE)) return FALSE;
5202 /* Player cannot hurt himself */
5203 if (!who) return (FALSE);
5204 if (who == p_ptr->riding) return (FALSE);
5206 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5209 int max_attempts = 10;
5210 sound(SOUND_REFLECT);
5213 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5214 else if (p_ptr->special_defense & KATA_FUUJIN)
5215 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5217 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5220 /* Choose 'new' target */
5225 t_y = m_list[who].fy - 1 + randint1(3);
5226 t_x = m_list[who].fx - 1 + randint1(3);
5229 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5231 if (max_attempts < 1)
5233 t_y = m_list[who].fy;
5234 t_x = m_list[who].fx;
5239 t_y = p_ptr->y - 1 + randint1(3);
5240 t_x = p_ptr->x - 1 + randint1(3);
5243 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5250 /* Limit maximum damage */
5251 if (dam > 1600) dam = 1600;
5253 /* Reduce damage by distance */
5254 dam = (dam + r) / (r + 1);
5257 /* If the player is blind, be more descriptive */
5258 if (blind) fuzzy = TRUE;
5263 /* Get the source monster */
5264 m_ptr = &m_list[who];
5265 /* Extract the monster level */
5266 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5268 /* Get the monster name */
5269 monster_desc(m_name, m_ptr, 0);
5271 /* Get the monster's real name (gotten before polymorph!) */
5272 strcpy(killer, who_name);
5278 case PROJECT_WHO_UNCTRL_POWER:
5279 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5282 case PROJECT_WHO_GLASS_SHARDS:
5283 strcpy(killer, _("ガラスの破片", "shards of glass"));
5287 strcpy(killer, _("罠", "a trap"));
5292 strcpy(m_name, killer);
5295 /* Analyze the damage */
5298 /* Standard damage -- hurts inventory too */
5301 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5302 get_damage = acid_dam(dam, killer, monspell, FALSE);
5306 /* Standard damage -- hurts inventory too */
5309 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5310 get_damage = fire_dam(dam, killer, monspell, FALSE);
5314 /* Standard damage -- hurts inventory too */
5317 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5318 get_damage = cold_dam(dam, killer, monspell, FALSE);
5322 /* Standard damage -- hurts inventory too */
5325 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5326 get_damage = elec_dam(dam, killer, monspell, FALSE);
5330 /* Standard damage -- also poisons player */
5333 bool double_resist = IS_OPPOSE_POIS();
5334 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5336 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5337 if (double_resist) dam = (dam + 2) / 3;
5339 if ((!(double_resist || p_ptr->resist_pois)) &&
5340 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5345 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5347 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5349 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5354 /* Standard damage -- also poisons / mutates player */
5357 bool double_resist = IS_OPPOSE_POIS();
5358 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5360 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5361 if (double_resist) dam = (2 * dam + 2) / 5;
5362 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5363 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5365 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5367 if (one_in_(5)) /* 6 */
5369 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5370 if (one_in_(4)) /* 4 */
5378 inven_damage(set_acid_destroy, 2);
5384 /* Standard damage */
5387 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5388 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5392 /* Holy Orb -- Player only takes partial damage */
5395 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5396 if (p_ptr->align > 10)
5398 else if (p_ptr->align < -10)
5400 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5406 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5407 if (p_ptr->align > 10)
5409 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5413 /* Arrow -- XXX no dodging */
5418 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5420 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5422 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5425 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5429 /* Plasma -- XXX No resist */
5432 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5433 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5435 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5437 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5438 (void)set_stun(p_ptr->stun + plus_stun);
5441 if (!(p_ptr->resist_fire ||
5443 p_ptr->immune_fire))
5445 inven_damage(set_acid_destroy, 3);
5451 /* Nether -- drain experience */
5454 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5455 if (p_ptr->resist_neth)
5457 if (!prace_is_(RACE_SPECTRE))
5459 dam *= 6; dam /= (randint1(4) + 7);
5462 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5464 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5466 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5468 learn_spell(monspell);
5472 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5478 /* Water -- stun/confuse */
5481 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5482 if (!CHECK_MULTISHADOW())
5484 if (!p_ptr->resist_sound)
5486 set_stun(p_ptr->stun + randint1(40));
5488 if (!p_ptr->resist_conf)
5490 set_confused(p_ptr->confused + randint1(5) + 5);
5495 inven_damage(set_cold_destroy, 3);
5499 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5503 /* Chaos -- many effects */
5506 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5507 if (p_ptr->resist_chaos)
5509 dam *= 6; dam /= (randint1(4) + 7);
5512 if (!CHECK_MULTISHADOW())
5514 if (!p_ptr->resist_conf)
5516 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5518 if (!p_ptr->resist_chaos)
5520 (void)set_image(p_ptr->image + randint1(10));
5523 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5524 (void)gain_random_mutation(0);
5527 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5529 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5532 if (!p_ptr->resist_chaos || one_in_(9))
5534 inven_damage(set_elec_destroy, 2);
5535 inven_damage(set_fire_destroy, 2);
5539 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5543 /* Shards -- mostly cutting */
5546 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5547 if (p_ptr->resist_shard)
5549 dam *= 6; dam /= (randint1(4) + 7);
5551 else if (!CHECK_MULTISHADOW())
5553 (void)set_cut(p_ptr->cut + dam);
5556 if (!p_ptr->resist_shard || one_in_(13))
5558 inven_damage(set_cold_destroy, 2);
5561 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5565 /* Sound -- mostly stunning */
5568 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5569 if (p_ptr->resist_sound)
5571 dam *= 5; dam /= (randint1(4) + 7);
5573 else if (!CHECK_MULTISHADOW())
5575 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5576 (void)set_stun(p_ptr->stun + plus_stun);
5579 if (!p_ptr->resist_sound || one_in_(13))
5581 inven_damage(set_cold_destroy, 2);
5584 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5588 /* Pure confusion */
5591 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5592 if (p_ptr->resist_conf)
5594 dam *= 5; dam /= (randint1(4) + 7);
5596 else if (!CHECK_MULTISHADOW())
5598 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5600 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5604 /* Disenchantment -- see above */
5607 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5608 if (p_ptr->resist_disen)
5610 dam *= 6; dam /= (randint1(4) + 7);
5612 else if (!CHECK_MULTISHADOW())
5614 (void)apply_disenchant(0);
5616 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5620 /* Nexus -- see above */
5623 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5624 if (p_ptr->resist_nexus)
5626 dam *= 6; dam /= (randint1(4) + 7);
5628 else if (!CHECK_MULTISHADOW())
5632 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5636 /* Force -- mostly stun */
5639 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5640 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5642 (void)set_stun(p_ptr->stun + randint1(20));
5644 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5649 /* Rocket -- stun, cut */
5652 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5653 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5655 (void)set_stun(p_ptr->stun + randint1(20));
5658 if (p_ptr->resist_shard)
5662 else if (!CHECK_MULTISHADOW())
5664 (void)set_cut(p_ptr->cut + (dam / 2));
5667 if (!p_ptr->resist_shard || one_in_(12))
5669 inven_damage(set_cold_destroy, 3);
5672 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5676 /* Inertia -- slowness */
5679 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5680 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5681 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5685 /* Lite -- blinding */
5688 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5689 if (p_ptr->resist_lite)
5691 dam *= 4; dam /= (randint1(4) + 7);
5693 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5695 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5698 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5700 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5703 else if (prace_is_(RACE_S_FAIRY))
5708 if (p_ptr->wraith_form) dam *= 2;
5709 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5711 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5713 p_ptr->wraith_form = 0;
5714 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5715 "The light forces you out of your incorporeal shadow form."));
5717 p_ptr->redraw |= PR_MAP;
5718 /* Update monsters */
5719 p_ptr->update |= (PU_MONSTERS);
5721 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5723 /* Redraw status bar */
5724 p_ptr->redraw |= (PR_STATUS);
5731 /* Dark -- blinding */
5734 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5735 if (p_ptr->resist_dark)
5737 dam *= 4; dam /= (randint1(4) + 7);
5739 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5741 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5743 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5745 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5749 /* Time -- bolt fewer effects XXX */
5752 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5753 if (p_ptr->resist_time)
5756 dam /= (randint1(4) + 7);
5757 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5759 else if (!CHECK_MULTISHADOW())
5761 switch (randint1(10))
5763 case 1: case 2: case 3: case 4: case 5:
5765 if (p_ptr->prace == RACE_ANDROID) break;
5766 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5767 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5771 case 6: case 7: case 8: case 9:
5773 switch (randint1(6))
5775 case 1: k = A_STR; act = _("強く", "strong"); break;
5776 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5777 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5778 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5779 case 5: k = A_CON; act = _("健康で", "hale"); break;
5780 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5783 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5784 "You're not as %s as you used to be..."), act);
5786 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5787 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5788 p_ptr->update |= (PU_BONUS);
5794 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5795 "You're not as powerful as you used to be..."));
5797 for (k = 0; k < 6; k++)
5799 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5800 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5802 p_ptr->update |= (PU_BONUS);
5808 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5812 /* Gravity -- stun plus slowness plus teleport */
5815 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5816 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5818 if (!CHECK_MULTISHADOW())
5820 teleport_player(5, TELEPORT_PASSIVE);
5821 if (!p_ptr->levitation)
5822 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5823 if (!(p_ptr->resist_sound || p_ptr->levitation))
5825 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5826 (void)set_stun(p_ptr->stun + plus_stun);
5829 if (p_ptr->levitation)
5831 dam = (dam * 2) / 3;
5834 if (!p_ptr->levitation || one_in_(13))
5836 inven_damage(set_cold_destroy, 2);
5839 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5843 /* Standard damage */
5844 case GF_DISINTEGRATE:
5846 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5848 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5854 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5856 (void)hp_player(dam);
5863 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5864 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5871 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5872 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5878 if (p_ptr->free_act) break;
5879 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5881 if (ironman_nightmare)
5883 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5884 /* Have some nightmares */
5885 sanity_blast(NULL, FALSE);
5888 set_paralyzed(p_ptr->paralyzed + dam);
5898 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5899 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5906 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5907 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5914 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5916 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5917 if (!p_ptr->resist_shard || one_in_(13))
5919 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5920 inven_damage(set_cold_destroy, 2);
5926 /* Ice -- cold plus stun plus cuts */
5929 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5930 get_damage = cold_dam(dam, killer, monspell, FALSE);
5931 if (!CHECK_MULTISHADOW())
5933 if (!p_ptr->resist_shard)
5935 (void)set_cut(p_ptr->cut + damroll(5, 8));
5937 if (!p_ptr->resist_sound)
5939 (void)set_stun(p_ptr->stun + randint1(15));
5942 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5944 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5954 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5956 if (p_ptr->mimic_form)
5958 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5959 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5964 switch (p_ptr->prace)
5966 /* Some races are immune */
5980 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5992 if (CHECK_MULTISHADOW())
5994 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5996 else if (p_ptr->csp)
6000 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6002 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6005 if (dam >= p_ptr->csp)
6009 p_ptr->csp_frac = 0;
6018 learn_spell(monspell);
6021 p_ptr->redraw |= (PR_MANA);
6024 p_ptr->window |= (PW_PLAYER);
6025 p_ptr->window |= (PW_SPELL);
6029 /* Heal the monster */
6030 if (m_ptr->hp < m_ptr->maxhp)
6034 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6036 /* Redraw (later) if needed */
6037 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6038 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6040 /* Special message */
6043 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6056 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6058 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6059 learn_spell(monspell);
6063 if (!CHECK_MULTISHADOW())
6065 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6067 if (!p_ptr->resist_conf)
6069 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6072 if (!p_ptr->resist_chaos && one_in_(3))
6074 (void)set_image(p_ptr->image + randint0(250) + 150);
6081 p_ptr->csp_frac = 0;
6083 p_ptr->redraw |= PR_MANA;
6086 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6092 case GF_BRAIN_SMASH:
6094 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6096 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6097 learn_spell(monspell);
6101 if (!CHECK_MULTISHADOW())
6103 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6109 p_ptr->csp_frac = 0;
6111 p_ptr->redraw |= PR_MANA;
6114 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6115 if (!CHECK_MULTISHADOW())
6117 if (!p_ptr->resist_blind)
6119 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6121 if (!p_ptr->resist_conf)
6123 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6125 if (!p_ptr->free_act)
6127 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6129 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6131 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6132 (void)do_dec_stat(A_INT);
6133 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6134 (void)do_dec_stat(A_WIS);
6136 if (!p_ptr->resist_chaos)
6138 (void)set_image(p_ptr->image + randint0(250) + 150);
6148 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6150 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6151 learn_spell(monspell);
6155 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6156 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6164 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6166 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6167 learn_spell(monspell);
6171 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6172 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6180 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6182 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6183 learn_spell(monspell);
6187 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6188 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6196 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6198 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6199 learn_spell(monspell);
6203 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6204 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6212 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6214 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6215 learn_spell(monspell);
6219 if (!CHECK_MULTISHADOW())
6221 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6222 curse_equipment(40, 20);
6225 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6227 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6242 /* Hex - revenge damage stored */
6243 revenge_store(get_damage);
6245 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6246 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6248 char m_name_self[80];
6251 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6253 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6254 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6255 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6258 if (p_ptr->riding && dam > 0)
6260 rakubadam_p = (dam > 200) ? 200 : dam;
6268 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6270 (void)kawarimi(FALSE);
6273 /* Return "Anything seen?" */
6279 * Find the distance from (x, y) to a line.
6281 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6283 /* Vector from (x, y) to (x1, y1) */
6284 POSITION py = y1 - y;
6285 POSITION px = x1 - x;
6288 POSITION ny = x2 - x1;
6289 POSITION nx = y1 - y2;
6292 POSITION pd = distance(y1, x1, y, x);
6293 POSITION nd = distance(y1, x1, y2, x2);
6295 if (pd > nd) return distance(y, x, y2, x2);
6297 /* Component of P on N */
6298 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6300 /* Absolute value */
6301 return((nd >= 0) ? nd : 0 - nd);
6308 * Modified version of los() for calculation of disintegration balls.
6309 * Disintegration effects are stopped by permanent walls.
6311 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6331 /* Slope, or 1/Slope, of LOS */
6335 /* Extract the offset */
6339 /* Extract the absolute offset */
6344 /* Handle adjacent (or identical) grids */
6345 if ((ax < 2) && (ay < 2)) return (TRUE);
6348 /* Paranoia -- require "safe" origin */
6349 /* if (!in_bounds(y1, x1)) return (FALSE); */
6352 /* Directly South/North */
6355 /* South -- check for walls */
6358 for (ty = y1 + 1; ty < y2; ty++)
6360 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6364 /* North -- check for walls */
6367 for (ty = y1 - 1; ty > y2; ty--)
6369 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6377 /* Directly East/West */
6380 /* East -- check for walls */
6383 for (tx = x1 + 1; tx < x2; tx++)
6385 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6389 /* West -- check for walls */
6392 for (tx = x1 - 1; tx > x2; tx--)
6394 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6403 /* Extract some signs */
6404 sx = (dx < 0) ? -1 : 1;
6405 sy = (dy < 0) ? -1 : 1;
6408 /* Vertical "knights" */
6413 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6417 /* Horizontal "knights" */
6422 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6427 /* Calculate scale factor div 2 */
6430 /* Calculate scale factor */
6434 /* Travel horizontally */
6437 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6443 /* Consider the special case where slope == 1. */
6454 /* Note (below) the case (qy == f2), where */
6455 /* the LOS exactly meets the corner of a tile. */
6458 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6469 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6482 /* Travel vertically */
6485 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6501 /* Note (below) the case (qx == f2), where */
6502 /* the LOS exactly meets the corner of a tile. */
6505 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6516 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6537 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)
6542 int brev = rad * rad / dist;
6546 int mdis = distance(y1, x1, y2, x2) + rad;
6548 while (bdis <= mdis)
6552 if ((0 < dist) && (path_n < dist))
6554 int ny = GRID_Y(path_g[path_n]);
6555 int nx = GRID_X(path_g[path_n]);
6556 int nd = distance(ny, nx, y1, x1);
6558 /* Get next base point */
6567 /* Travel from center outward */
6568 for (cdis = 0; cdis <= brad; cdis++)
6570 /* Scan the maximal blast area of radius "cdis" */
6571 for (y = by - cdis; y <= by + cdis; y++)
6573 for (x = bx - cdis; x <= bx + cdis; x++)
6575 /* Ignore "illegal" locations */
6576 if (!in_bounds(y, x)) continue;
6578 /* Enforce a circular "ripple" */
6579 if (distance(y1, x1, y, x) != bdis) continue;
6581 /* Enforce an arc */
6582 if (distance(by, bx, y, x) != cdis) continue;
6588 /* Lights are stopped by opaque terrains */
6589 if (!los(by, bx, y, x)) continue;
6591 case GF_DISINTEGRATE:
6592 /* Disintegration are stopped only by perma-walls */
6593 if (!in_disintegration_range(by, bx, y, x)) continue;
6596 /* Ball explosions are stopped by walls */
6597 if (!projectable(by, bx, y, x)) continue;
6601 /* Save this grid */
6609 /* Encode some more "radius" info */
6610 gm[bdis + 1] = *pgrids;
6612 /* Increase the size */
6613 brad = rad * (path_n + brev) / (dist + brev);
6615 /* Find the next ripple */
6619 /* Store the effect size */
6625 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6626 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6627 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6628 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6629 * @param x 目標X座標 / Target x location (or location to travel "towards")
6630 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6631 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6632 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6633 * @param monspell 効果元のモンスター魔法ID
6634 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6637 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6638 * towards a given location (optionally passing over the heads of interposing
6639 * monsters), and have it do a given amount of damage to the monsters (and
6640 * optionally objects) within the given radius of the final location.
6642 * A "bolt" travels from source to target and affects only the target grid.
6643 * A "beam" travels from source to target, affecting all grids passed through.
6644 * A "ball" travels from source to the target, exploding at the target, and
6645 * affecting everything within the given radius of the target location.
6647 * Traditionally, a "bolt" does not affect anything on the ground, and does
6648 * not pass over the heads of interposing monsters, much like a traditional
6649 * missile, and will "stop" abruptly at the "target" even if no monster is
6650 * positioned there, while a "ball", on the other hand, passes over the heads
6651 * of monsters between the source and target, and affects everything except
6652 * the source monster which lies within the final radius, while a "beam"
6653 * affects every monster between the source and target, except for the casting
6654 * monster (or player), and rarely affects things on the ground.
6656 * Two special flags allow us to use this function in special ways, the
6657 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6658 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6659 * actually projecting from the source monster (or player).
6661 * The player will only get "experience" for monsters killed by himself
6662 * Unique monsters can only be destroyed by attacks from the player
6664 * Only 256 grids can be affected per projection, limiting the effective
6665 * "radius" of standard ball attacks to nine units (diameter nineteen).
6667 * One can project in a given "direction" by combining PROJECT_THRU with small
6668 * offsets to the initial location (see "line_spell()"), or by calculating
6669 * "virtual targets" far away from the player.
6671 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6672 * continuing until it actually hits somethings (useful for "stone to mud").
6674 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6676 * Balls must explode BEFORE hitting walls, or they would affect monsters
6677 * on both sides of a wall. Some bug reports indicate that this is still
6678 * happening in 2.7.8 for Windows, though it appears to be impossible.
6680 * We "pre-calculate" the blast area only in part for efficiency.
6681 * More importantly, this lets us do "explosions" from the "inside" out.
6682 * This results in a more logical distribution of "blast" treasure.
6683 * It also produces a better (in my opinion) animation of the explosion.
6684 * It could be (but is not) used to have the treasure dropped by monsters
6685 * in the middle of the explosion fall "outwards", and then be damaged by
6686 * the blast as it spreads outwards towards the treasure drop location.
6688 * Walls and doors are included in the blast area, so that they can be
6689 * "burned" or "melted" in later versions.
6691 * This algorithm is intended to maximize simplicity, not necessarily
6692 * efficiency, since this function is not a bottleneck in the code.
6694 * We apply the blast effect from ground zero outwards, in several passes,
6695 * first affecting features, then objects, then monsters, then the player.
6696 * This allows walls to be removed before checking the object or monster
6697 * in the wall, and protects objects which are dropped by monsters killed
6698 * in the blast, and allows the player to see all affects before he is
6699 * killed or teleported away. The semantics of this method are open to
6700 * various interpretations, but they seem to work well in practice.
6702 * We process the blast area from ground-zero outwards to allow for better
6703 * distribution of treasure dropped by monsters, and because it provides a
6704 * pleasing visual effect at low cost.
6706 * Note that the damage done by "ball" explosions decreases with distance.
6707 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6709 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6710 * the target, and then the damage "flows" along this beam of destruction.
6711 * The damage at every grid is the same as at the "center" of a "ball"
6712 * explosion, since the "beam" grids are treated as if they ARE at the
6713 * center of a "ball" explosion.
6715 * Currently, specifying "beam" plus "ball" means that locations which are
6716 * covered by the initial "beam", and also covered by the final "ball", except
6717 * for the final grid (the epicenter of the ball), will be "hit twice", once
6718 * by the initial beam, and once by the exploding ball. For the grid right
6719 * next to the epicenter, this results in 150% damage being done. The center
6720 * does not have this problem, for the same reason the final grid in a "beam"
6721 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6722 * grids which are covered by the "ball" will NOT work, as then they will
6723 * receive LESS damage than they should. Do not combine "beam" with "ball".
6725 * The array "gy[],gx[]" with current size "grids" is used to hold the
6726 * collected locations of all grids in the "blast area" plus "beam path".
6728 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6729 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6730 * first blast grid (see above) with radius "N" from the blast center. Note
6731 * that only the first gm[1] grids in the blast area thus take full damage.
6732 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6733 * number of blast grids.
6735 * Note that once the projection is complete, (y2,x2) holds the final location
6736 * of bolts/beams, and the "epicenter" of balls.
6738 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6739 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6740 * implementation of the "distance" function. Also, a bolt can be properly
6741 * viewed as a "ball" with a "rad" of "zero".
6743 * Note that if no "target" is reached before the beam/bolt/ball travels the
6744 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6745 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6747 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6748 * to move from point A to point B, even if the player cannot see part of the
6749 * projection path. Note that in general, the player will *always* see part
6750 * of the path, since it either starts at the player or ends on the player.
6752 * Hack -- we assume that every "projection" is "self-illuminating".
6754 * Hack -- when only a single monster is affected, we automatically track
6755 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6757 * Note that all projections now "explode" at their final destination, even
6758 * if they were being projected at a more distant destination. This means
6759 * that "ball" spells will *always* explode.
6761 * Note that we must call "handle_stuff()" after affecting terrain features
6762 * in the blast radius, in case the "illumination" of the grid was changed,
6763 * and "update_view()" and "update_monsters()" need to be called.
6766 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6776 POSITION y_saver, x_saver; /* For reflecting monsters */
6778 int msec = delay_factor * delay_factor * delay_factor;
6780 /* Assume the player sees nothing */
6781 bool notice = FALSE;
6783 /* Assume the player has seen nothing */
6784 bool visual = FALSE;
6786 /* Assume the player has seen no blast grids */
6789 /* Assume to be a normal ball spell */
6790 bool breath = FALSE;
6792 /* Is the player blind? */
6793 bool blind = (p_ptr->blind ? TRUE : FALSE);
6795 bool old_hide = FALSE;
6797 /* Number of grids in the "path" */
6800 /* Actual grids in the "path" */
6803 /* Number of grids in the "blast area" (including the "beam" path) */
6806 /* Coordinates of the affected grids */
6807 POSITION gx[1024], gy[1024];
6809 /* Encoded "radius" info (see above) */
6812 /* Actual radius encoded in gm[] */
6813 POSITION gm_rad = rad;
6817 /* Attacker's name (prepared before polymorph)*/
6820 /* Can the player see the source of this effect? */
6821 bool see_s_msg = TRUE;
6823 /* Initialize by null string */
6829 /* Default target of monsterspell is player */
6830 monster_target_y = p_ptr->y;
6831 monster_target_x = p_ptr->x;
6833 /* Hack -- Jump to target */
6834 if (flg & (PROJECT_JUMP))
6839 /* Clear the flag */
6840 flg &= ~(PROJECT_JUMP);
6845 /* Start at player */
6852 /* Start at monster */
6855 x1 = m_list[who].fx;
6856 y1 = m_list[who].fy;
6857 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6870 /* Default "destination" */
6875 /* Hack -- verify stuff */
6876 if (flg & (PROJECT_THRU))
6878 if ((x1 == x2) && (y1 == y2))
6880 flg &= ~(PROJECT_THRU);
6884 /* Handle a breath attack */
6889 if (flg & PROJECT_HIDE) old_hide = TRUE;
6890 flg |= PROJECT_HIDE;
6894 /* Hack -- Assume there will be no blast (max radius 32) */
6895 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6903 /* Collect beam grids */
6904 if (flg & (PROJECT_BEAM))
6915 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6917 case GF_DISINTEGRATE:
6918 flg |= (PROJECT_GRID);
6919 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6923 /* Calculate the projection path */
6925 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6927 /* Hack -- Handle stuff */
6930 /* Giga-Hack SEEKER & SUPER_RAY */
6932 if( typ == GF_SEEKER )
6942 for (i = 0; i < path_n; ++i)
6947 int ny = GRID_Y(path_g[i]);
6948 int nx = GRID_X(path_g[i]);
6959 /* Only do visuals if requested */
6960 if (!blind && !(flg & (PROJECT_HIDE)))
6962 /* Only do visuals if the player can "see" the bolt */
6963 if (panel_contains(y, x) && player_has_los_bold(y, x))
6970 /* Obtain the bolt pict */
6971 p = bolt_pict(oy, ox, y, x, typ);
6973 /* Extract attr/char */
6977 /* Visual effects */
6978 print_rel(c, a, y, x);
6979 move_cursor_relative(y, x);
6980 /*if (fresh_before)*/ Term_fresh();
6981 Term_xtra(TERM_XTRA_DELAY, msec);
6983 /*if (fresh_before)*/ Term_fresh();
6985 /* Display "beam" grids */
6986 if (flg & (PROJECT_BEAM))
6988 /* Obtain the explosion pict */
6989 p = bolt_pict(y, x, y, x, typ);
6991 /* Extract attr/char */
6995 /* Visual effects */
6996 print_rel(c, a, y, x);
6999 /* Hack -- Activate delay */
7003 /* Hack -- delay anyway for consistency */
7006 /* Delay for consistency */
7007 Term_xtra(TERM_XTRA_DELAY, msec);
7010 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7011 if( is_mirror_grid(&cave[y][x]))
7013 /* The target of monsterspell becomes tha mirror(broken) */
7014 monster_target_y=(s16b)y;
7015 monster_target_x=(s16b)x;
7017 remove_mirror(y, x);
7018 next_mirror(&oy, &ox, y, x);
7020 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7021 for(j = last_i; j <= i; j++)
7023 y = GRID_Y(path_g[j]);
7024 x = GRID_X(path_g[j]);
7025 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7026 if(!who && (project_m_n==1) && !jump ){
7027 if(cave[project_m_y][project_m_x].m_idx >0 ){
7028 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7032 /* Hack -- auto-recall */
7033 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7035 /* Hack - auto-track */
7036 health_track(cave[project_m_y][project_m_x].m_idx);
7040 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7045 for(i = last_i ; i < path_n ; i++)
7048 py = GRID_Y(path_g[i]);
7049 px = GRID_X(path_g[i]);
7050 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7052 if(!who && (project_m_n==1) && !jump ){
7053 if(cave[project_m_y][project_m_x].m_idx > 0)
7055 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7059 /* Hack -- auto-recall */
7060 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7062 /* Hack - auto-track */
7063 health_track(cave[project_m_y][project_m_x].m_idx);
7067 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7071 else if(typ == GF_SUPER_RAY){
7073 int second_step = 0;
7080 for (i = 0; i < path_n; ++i)
7085 int ny = GRID_Y(path_g[i]);
7086 int nx = GRID_X(path_g[i]);
7097 /* Only do visuals if requested */
7098 if (!blind && !(flg & (PROJECT_HIDE)))
7100 /* Only do visuals if the player can "see" the bolt */
7101 if (panel_contains(y, x) && player_has_los_bold(y, x))
7108 /* Obtain the bolt pict */
7109 p = bolt_pict(oy, ox, y, x, typ);
7111 /* Extract attr/char */
7115 /* Visual effects */
7116 print_rel(c, a, y, x);
7117 move_cursor_relative(y, x);
7118 /*if (fresh_before)*/ Term_fresh();
7119 Term_xtra(TERM_XTRA_DELAY, msec);
7121 /*if (fresh_before)*/ Term_fresh();
7123 /* Display "beam" grids */
7124 if (flg & (PROJECT_BEAM))
7126 /* Obtain the explosion pict */
7127 p = bolt_pict(y, x, y, x, typ);
7129 /* Extract attr/char */
7133 /* Visual effects */
7134 print_rel(c, a, y, x);
7137 /* Hack -- Activate delay */
7141 /* Hack -- delay anyway for consistency */
7144 /* Delay for consistency */
7145 Term_xtra(TERM_XTRA_DELAY, msec);
7148 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7149 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7151 if( second_step )continue;
7154 if( is_mirror_grid(&cave[y][x]) && !second_step )
7156 /* The target of monsterspell becomes tha mirror(broken) */
7157 monster_target_y=(s16b)y;
7158 monster_target_x=(s16b)x;
7161 for( j = 0; j <=i ; j++ )
7163 y = GRID_Y(path_g[j]);
7164 x = GRID_X(path_g[j]);
7165 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7169 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7170 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7171 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7172 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7173 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7174 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7175 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7176 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7179 for( i = 0; i < path_n ; i++ )
7182 py = GRID_Y(path_g[i]);
7183 px = GRID_X(path_g[i]);
7184 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7185 if(!who && (project_m_n == 1) && !jump){
7186 if(cave[project_m_y][project_m_x].m_idx >0 ){
7187 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7191 /* Hack -- auto-recall */
7192 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7194 /* Hack - auto-track */
7195 health_track(cave[project_m_y][project_m_x].m_idx);
7199 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7204 /* Project along the path */
7205 for (i = 0; i < path_n; ++i)
7210 int ny = GRID_Y(path_g[i]);
7211 int nx = GRID_X(path_g[i]);
7213 if (flg & PROJECT_DISI)
7215 /* Hack -- Balls explode before reaching walls */
7216 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7218 else if (flg & PROJECT_LOS)
7220 /* Hack -- Balls explode before reaching walls */
7221 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7225 /* Hack -- Balls explode before reaching walls */
7226 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7233 /* Collect beam grids */
7234 if (flg & (PROJECT_BEAM))
7241 /* Only do visuals if requested */
7242 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7244 /* Only do visuals if the player can "see" the bolt */
7245 if (panel_contains(y, x) && player_has_los_bold(y, x))
7252 /* Obtain the bolt pict */
7253 p = bolt_pict(oy, ox, y, x, typ);
7255 /* Extract attr/char */
7259 /* Visual effects */
7260 print_rel(c, a, y, x);
7261 move_cursor_relative(y, x);
7262 /*if (fresh_before)*/ Term_fresh();
7263 Term_xtra(TERM_XTRA_DELAY, msec);
7265 /*if (fresh_before)*/ Term_fresh();
7267 /* Display "beam" grids */
7268 if (flg & (PROJECT_BEAM))
7270 /* Obtain the explosion pict */
7271 p = bolt_pict(y, x, y, x, typ);
7273 /* Extract attr/char */
7277 /* Visual effects */
7278 print_rel(c, a, y, x);
7281 /* Hack -- Activate delay */
7285 /* Hack -- delay anyway for consistency */
7288 /* Delay for consistency */
7289 Term_xtra(TERM_XTRA_DELAY, msec);
7296 /* Save the "blast epicenter" */
7300 if (breath && !path_n)
7306 flg &= ~(PROJECT_HIDE);
7310 /* Start the "explosion" */
7313 /* Hack -- make sure beams get to "explode" */
7321 /* If we found a "target", explode there */
7322 if (dist <= MAX_RANGE)
7324 /* Mega-Hack -- remove the final "beam" grid */
7325 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7328 * Create a conical breath attack
7339 flg &= ~(PROJECT_HIDE);
7341 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7345 /* Determine the blast area, work from the inside out */
7346 for (dist = 0; dist <= rad; dist++)
7348 /* Scan the maximal blast area of radius "dist" */
7349 for (y = by - dist; y <= by + dist; y++)
7351 for (x = bx - dist; x <= bx + dist; x++)
7353 /* Ignore "illegal" locations */
7354 if (!in_bounds2(y, x)) continue;
7356 /* Enforce a "circular" explosion */
7357 if (distance(by, bx, y, x) != dist) continue;
7363 /* Lights are stopped by opaque terrains */
7364 if (!los(by, bx, y, x)) continue;
7366 case GF_DISINTEGRATE:
7367 /* Disintegration are stopped only by perma-walls */
7368 if (!in_disintegration_range(by, bx, y, x)) continue;
7371 /* Ball explosions are stopped by walls */
7372 if (!projectable(by, bx, y, x)) continue;
7376 /* Save this grid */
7383 /* Encode some more "radius" info */
7389 /* Speed -- ignore "non-explosions" */
7390 if (!grids) return (FALSE);
7393 /* Display the "blast area" if requested */
7394 if (!blind && !(flg & (PROJECT_HIDE)))
7396 /* Then do the "blast", from inside out */
7397 for (t = 0; t <= gm_rad; t++)
7399 /* Dump everything with this radius */
7400 for (i = gm[t]; i < gm[t+1]; i++)
7402 /* Extract the location */
7406 /* Only do visuals if the player can "see" the blast */
7407 if (panel_contains(y, x) && player_has_los_bold(y, x))
7416 /* Obtain the explosion pict */
7417 p = bolt_pict(y, x, y, x, typ);
7419 /* Extract attr/char */
7423 /* Visual effects -- Display */
7424 print_rel(c, a, y, x);
7428 /* Hack -- center the cursor */
7429 move_cursor_relative(by, bx);
7431 /* Flush each "radius" seperately */
7432 /*if (fresh_before)*/ Term_fresh();
7434 /* Delay (efficiently) */
7435 if (visual || drawn)
7437 Term_xtra(TERM_XTRA_DELAY, msec);
7441 /* Flush the erasing */
7444 /* Erase the explosion drawn above */
7445 for (i = 0; i < grids; i++)
7447 /* Extract the location */
7451 /* Hack -- Erase if needed */
7452 if (panel_contains(y, x) && player_has_los_bold(y, x))
7458 /* Hack -- center the cursor */
7459 move_cursor_relative(by, bx);
7461 /* Flush the explosion */
7462 /*if (fresh_before)*/ Term_fresh();
7467 /* Update stuff if needed */
7468 if (p_ptr->update) update_stuff();
7471 if (flg & PROJECT_KILL)
7473 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7474 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7478 /* Check features */
7479 if (flg & (PROJECT_GRID))
7481 /* Start with "dist" of zero */
7484 /* Scan for features */
7485 for (i = 0; i < grids; i++)
7487 /* Hack -- Notice new "dist" values */
7488 if (gm[dist+1] == i) dist++;
7490 /* Get the grid location */
7494 /* Find the closest point in the blast */
7497 int d = dist_to_line(y, x, y1, x1, by, bx);
7499 /* Affect the grid */
7500 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7504 /* Affect the grid */
7505 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7510 /* Update stuff if needed */
7511 if (p_ptr->update) update_stuff();
7514 if (flg & (PROJECT_ITEM))
7516 /* Start with "dist" of zero */
7519 /* Scan for objects */
7520 for (i = 0; i < grids; i++)
7522 /* Hack -- Notice new "dist" values */
7523 if (gm[dist+1] == i) dist++;
7525 /* Get the grid location */
7529 /* Find the closest point in the blast */
7532 int d = dist_to_line(y, x, y1, x1, by, bx);
7534 /* Affect the object in the grid */
7535 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7539 /* Affect the object in the grid */
7540 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7546 /* Check monsters */
7547 if (flg & (PROJECT_KILL))
7554 /* Start with "dist" of zero */
7557 /* Scan for monsters */
7558 for (i = 0; i < grids; i++)
7562 /* Hack -- Notice new "dist" values */
7563 if (gm[dist + 1] == i) dist++;
7565 /* Get the grid location */
7569 /* A single bolt may be reflected */
7572 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7573 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7575 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7576 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7577 (!who || dist_hack > 1) && !one_in_(10))
7580 int max_attempts = 10;
7582 /* Choose 'new' target */
7585 t_y = y_saver - 1 + randint1(3);
7586 t_x = x_saver - 1 + randint1(3);
7589 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7591 if (max_attempts < 1)
7597 sound(SOUND_REFLECT);
7600 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7601 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7602 else if (m_ptr->r_idx == MON_DIO)
7603 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7605 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7607 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7609 /* Reflected bolts randomly target either one */
7610 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7611 else flg |= PROJECT_PLAYER;
7613 /* The bolt is reflected */
7614 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7616 /* Don't affect the monster any longer */
7622 /* Find the closest point in the blast */
7625 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7629 effective_dist = dist;
7633 /* There is the riding player on this monster */
7634 if (p_ptr->riding && player_bold(y, x))
7636 /* Aimed on the player */
7637 if (flg & PROJECT_PLAYER)
7639 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7642 * A beam or bolt is well aimed
7644 * So don't affects the mount.
7651 * The spell is not well aimed,
7652 * So partly affect the mount too.
7659 * This grid is the original target.
7660 * Or aimed on your horse.
7662 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7664 /* Hit the mount with full damage */
7668 * Otherwise this grid is not the
7669 * original target, it means that line
7670 * of fire is obstructed by this
7674 * A beam or bolt will hit either
7675 * player or mount. Choose randomly.
7677 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7681 /* Hit the mount with full damage */
7685 /* Hit the player later */
7686 flg |= PROJECT_PLAYER;
7688 /* Don't affect the mount */
7694 * The spell is not well aimed, so
7695 * partly affect both player and
7704 /* Affect the monster in the grid */
7705 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7709 /* Player affected one monster (without "jumping") */
7710 if (!who && (project_m_n == 1) && !jump)
7716 /* Track if possible */
7717 if (cave[y][x].m_idx > 0)
7719 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7723 /* Hack -- auto-recall */
7724 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7726 /* Hack - auto-track */
7727 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7735 if (flg & (PROJECT_KILL))
7737 /* Start with "dist" of zero */
7740 /* Scan for player */
7741 for (i = 0; i < grids; i++)
7745 /* Hack -- Notice new "dist" values */
7746 if (gm[dist+1] == i) dist++;
7748 /* Get the grid location */
7752 /* Affect the player? */
7753 if (!player_bold(y, x)) continue;
7755 /* Find the closest point in the blast */
7758 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7762 effective_dist = dist;
7765 /* Target may be your horse */
7768 /* Aimed on the player */
7769 if (flg & PROJECT_PLAYER)
7771 /* Hit the player with full damage */
7775 * Hack -- When this grid was not the
7776 * original target, a beam or bolt
7777 * would hit either player or mount,
7778 * and should be choosen randomly.
7780 * But already choosen to hit the
7781 * mount at this point.
7783 * Or aimed on your horse.
7785 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7788 * A beam or bolt is well aimed
7790 * So don't affects the player.
7797 * The spell is not well aimed,
7798 * So partly affect the player too.
7804 /* Affect the player */
7805 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7813 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7815 if (rakubadam_m > 0)
7817 if (rakuba(rakubadam_m, FALSE))
7819 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7822 if (p_ptr->riding && rakubadam_p > 0)
7824 if(rakuba(rakubadam_p, FALSE))
7826 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7831 /* Return "something was noticed" */
7836 * @brief 鏡魔法「封魔結界」の効果処理
7838 * @return 効果があったらTRUEを返す
7840 bool binding_field( HIT_POINT dam )
7842 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7843 int mirror_num=0; /* 鏡の数 */
7848 int msec= delay_factor*delay_factor*delay_factor;
7854 /* Default target of monsterspell is player */
7855 monster_target_y=p_ptr->y;
7856 monster_target_x=p_ptr->x;
7858 for( x=0 ; x < cur_wid ; x++ )
7860 for( y=0 ; y < cur_hgt ; y++ )
7862 if( is_mirror_grid(&cave[y][x]) &&
7863 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7864 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7865 player_has_los_bold(y,x) &&
7866 projectable(p_ptr->y, p_ptr->x, y, x)
7868 mirror_y[mirror_num]=y;
7869 mirror_x[mirror_num]=x;
7875 if( mirror_num < 2 )return FALSE;
7877 point_x[0] = randint0( mirror_num );
7879 point_x[1] = randint0( mirror_num );
7881 while( point_x[0] == point_x[1] );
7883 point_y[0]=mirror_y[point_x[0]];
7884 point_x[0]=mirror_x[point_x[0]];
7885 point_y[1]=mirror_y[point_x[1]];
7886 point_x[1]=mirror_x[point_x[1]];
7887 point_y[2]=p_ptr->y;
7888 point_x[2]=p_ptr->x;
7890 x=point_x[0]+point_x[1]+point_x[2];
7891 y=point_y[0]+point_y[1]+point_y[2];
7893 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7894 - (point_y[0]*3-y)*(point_x[1]*3-x);
7895 if( centersign == 0 )return FALSE;
7897 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7898 x1 = x1 < point_x[2] ? x1 : point_x[2];
7899 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7900 y1 = y1 < point_y[2] ? y1 : point_y[2];
7902 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7903 x2 = x2 > point_x[2] ? x2 : point_x[2];
7904 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7905 y2 = y2 > point_y[2] ? y2 : point_y[2];
7907 for( y=y1 ; y <=y2 ; y++ ){
7908 for( x=x1 ; x <=x2 ; x++ ){
7909 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7910 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7911 centersign*( (point_x[1]-x)*(point_y[2]-y)
7912 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7913 centersign*( (point_x[2]-x)*(point_y[0]-y)
7914 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7916 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7917 /* Visual effects */
7919 && panel_contains(y,x)){
7920 p = bolt_pict(y,x,y,x, GF_MANA );
7921 print_rel(PICT_C(p), PICT_A(p),y,x);
7922 move_cursor_relative(y, x);
7923 /*if (fresh_before)*/ Term_fresh();
7924 Term_xtra(TERM_XTRA_DELAY, msec);
7930 for( y=y1 ; y <=y2 ; y++ ){
7931 for( x=x1 ; x <=x2 ; x++ ){
7932 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7933 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7934 centersign*( (point_x[1]-x)*(point_y[2]-y)
7935 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7936 centersign*( (point_x[2]-x)*(point_y[0]-y)
7937 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7939 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7940 (void)project_f(0,0,y,x,dam,GF_MANA);
7945 for( y=y1 ; y <=y2 ; y++ ){
7946 for( x=x1 ; x <=x2 ; x++ ){
7947 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7948 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7949 centersign*( (point_x[1]-x)*(point_y[2]-y)
7950 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7951 centersign*( (point_x[2]-x)*(point_y[0]-y)
7952 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7954 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7955 (void)project_o(0,0,y,x,dam,GF_MANA);
7960 for( y=y1 ; y <=y2 ; y++ ){
7961 for( x=x1 ; x <=x2 ; x++ ){
7962 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7963 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7964 centersign*( (point_x[1]-x)*(point_y[2]-y)
7965 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7966 centersign*( (point_x[2]-x)*(point_y[0]-y)
7967 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7969 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7970 (void)project_m(0,0,y,x,dam,GF_MANA,
7971 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7977 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7978 remove_mirror(point_y[0],point_x[0]);
7985 * @brief 鏡魔法「鏡の封印」の効果処理
7987 * @return 効果があったらTRUEを返す
7989 void seal_of_mirror( HIT_POINT dam )
7993 for( x = 0 ; x < cur_wid ; x++ )
7995 for( y = 0 ; y < cur_hgt ; y++ )
7997 if( is_mirror_grid(&cave[y][x]))
7999 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8000 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8002 if( !cave[y][x].m_idx )