3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
20 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
21 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
23 int project_length = 0; /*!< 投射の射程距離 */
27 * @brief モンスター魅了用セービングスロー共通部(汎用系)
29 * @param m_ptr 対象モンスター
30 * @return 魅了に抵抗したらTRUE
32 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
34 monster_race *r_ptr = &r_info[m_ptr->r_idx];
36 if(p_ptr->inside_arena) return TRUE;
39 if (r_ptr->flagsr & RFR_RES_ALL)
41 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
45 if (r_ptr->flags3 & RF3_NO_CONF)
47 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
51 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
53 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
54 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
55 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
59 * @brief モンスター服従用セービングスロー共通部(部族依存系)
61 * @param m_ptr 対象モンスター
62 * @return 服従に抵抗したらTRUE
64 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
66 monster_race *r_ptr = &r_info[m_ptr->r_idx];
68 if (p_ptr->inside_arena) return TRUE;
71 if (r_ptr->flagsr & RFR_RES_ALL)
73 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
77 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
79 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
80 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
81 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
85 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
88 * ハードコーティングによる実装が行われている。
89 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
91 PERCENTAGE beam_chance(void)
93 if (p_ptr->pclass == CLASS_MAGE)
94 return (PERCENTAGE)(p_ptr->lev);
95 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
96 return (PERCENTAGE)(p_ptr->lev + 10);
98 return (PERCENTAGE)(p_ptr->lev / 2);
103 * @brief 配置した鏡リストの次を取得する /
104 * Get another mirror. for SEEKER
105 * @param next_y 次の鏡のy座標を返す参照ポインタ
106 * @param next_x 次の鏡のx座標を返す参照ポインタ
107 * @param cury 現在の鏡のy座標
108 * @param curx 現在の鏡のx座標
110 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
112 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
113 int mirror_num = 0; /* 鏡の数 */
117 for (x = 0; x < cur_wid; x++)
119 for (y = 0; y < cur_hgt; y++)
121 if (is_mirror_grid(&cave[y][x])) {
122 mirror_y[mirror_num] = y;
123 mirror_x[mirror_num] = x;
130 num = randint0(mirror_num);
131 *next_y = mirror_y[num];
132 *next_x = mirror_x[num];
135 *next_y = cury + randint0(5) - 2;
136 *next_x = curx + randint0(5) - 2;
141 * @brief 万色表現用にランダムな色を選択する関数 /
142 * Get a legal "multi-hued" color for drawing "spells"
146 static byte mh_attr(int max)
148 switch (randint1(max))
150 case 1: return (TERM_RED);
151 case 2: return (TERM_GREEN);
152 case 3: return (TERM_BLUE);
153 case 4: return (TERM_YELLOW);
154 case 5: return (TERM_ORANGE);
155 case 6: return (TERM_VIOLET);
156 case 7: return (TERM_L_RED);
157 case 8: return (TERM_L_GREEN);
158 case 9: return (TERM_L_BLUE);
159 case 10: return (TERM_UMBER);
160 case 11: return (TERM_L_UMBER);
161 case 12: return (TERM_SLATE);
162 case 13: return (TERM_WHITE);
163 case 14: return (TERM_L_WHITE);
164 case 15: return (TERM_L_DARK);
172 * @brief 魔法属性に応じたエフェクトの色を返す /
173 * Return a color to use for the bolt/ball spells
177 static byte spell_color(int type)
179 /* Check if A.B.'s new graphics should be used (rr9) */
180 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
185 case GF_PSY_SPEAR: return (0x06);
186 case GF_MISSILE: return (0x0F);
187 case GF_ACID: return (0x04);
188 case GF_ELEC: return (0x02);
189 case GF_FIRE: return (0x00);
190 case GF_COLD: return (0x01);
191 case GF_POIS: return (0x03);
192 case GF_HOLY_FIRE: return (0x00);
193 case GF_HELL_FIRE: return (0x00);
194 case GF_MANA: return (0x0E);
196 case GF_SEEKER: return (0x0E);
197 case GF_SUPER_RAY: return (0x0E);
199 case GF_ARROW: return (0x0F);
200 case GF_WATER: return (0x04);
201 case GF_NETHER: return (0x07);
202 case GF_CHAOS: return (mh_attr(15));
203 case GF_DISENCHANT: return (0x05);
204 case GF_NEXUS: return (0x0C);
205 case GF_CONFUSION: return (mh_attr(4));
206 case GF_SOUND: return (0x09);
207 case GF_SHARDS: return (0x08);
208 case GF_FORCE: return (0x09);
209 case GF_INERTIAL: return (0x09);
210 case GF_GRAVITY: return (0x09);
211 case GF_TIME: return (0x09);
212 case GF_LITE_WEAK: return (0x06);
213 case GF_LITE: return (0x06);
214 case GF_DARK_WEAK: return (0x07);
215 case GF_DARK: return (0x07);
216 case GF_PLASMA: return (0x0B);
217 case GF_METEOR: return (0x00);
218 case GF_ICE: return (0x01);
219 case GF_ROCKET: return (0x0F);
220 case GF_DEATH_RAY: return (0x07);
221 case GF_NUKE: return (mh_attr(2));
222 case GF_DISINTEGRATE: return (0x05);
234 case GF_CAUSE_4: return (0x0E);
235 case GF_HAND_DOOM: return (0x07);
236 case GF_CAPTURE : return (0x0E);
237 case GF_IDENTIFY: return (0x01);
238 case GF_ATTACK: return (0x0F);
239 case GF_PHOTO : return (0x06);
242 /* Normal tiles or ASCII */
248 /* Lookup the default colors for this type */
249 cptr s = quark_str(gf_color[type]);
252 if (!s) return (TERM_WHITE);
254 /* Pick a random color */
255 c = s[randint0(strlen(s))];
257 /* Lookup this color */
258 a = my_strchr(color_char, c) - color_char;
260 /* Invalid color (note check for < 0 removed, gave a silly
261 * warning because bytes are always >= 0 -- RG) */
262 if (a > 15) return (TERM_WHITE);
268 /* Standard "color" */
274 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
275 * Find the attr/char pair to use for a spell effect
284 * It is moving (or has moved) from (x,y) to (nx,ny).
285 * If the distance is not "one", we (may) return "*".
288 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
298 if ((ny == y) && (nx == x)) base = 0x30;
301 else if (nx == x) base = 0x40;
304 else if (ny == y) base = 0x50;
307 else if ((ny - y) == (x - nx)) base = 0x60;
310 else if ((ny - y) == (nx - x)) base = 0x70;
315 /* Basic spell color */
316 k = spell_color(typ);
318 /* Obtain attr/char */
319 a = misc_to_attr[base + k];
320 c = misc_to_char[base + k];
328 * @brief 始点から終点への経路を返す /
329 * Determine the path taken by a projection.
330 * @param gp 経路座標リストを返す参照ポインタ
340 * The projection will always start from the grid (y1,x1), and will travel
341 * towards the grid (y2,x2), touching one grid per unit of distance along
342 * the major axis, and stopping when it enters the destination grid or a
343 * wall grid, or has travelled the maximum legal distance of "range".
345 * Note that "distance" in this function (as in the "update_view()" code)
346 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
347 * actually has an "octagon of projection" not a "circle of projection".
349 * The path grids are saved into the grid array pointed to by "gp", and
350 * there should be room for at least "range" grids in "gp". Note that
351 * due to the way in which distance is calculated, this function normally
352 * uses fewer than "range" grids for the projection path, so the result
353 * of this function should never be compared directly to "range". Note
354 * that the initial grid (y1,x1) is never saved into the grid array, not
355 * even if the initial grid is also the final grid. XXX XXX XXX
357 * The "flg" flags can be used to modify the behavior of this function.
359 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
360 * semantics as they do for the "project" function, namely, that the path
361 * will stop as soon as it hits a monster, or that the path will continue
362 * through the destination grid, respectively.
364 * The "PROJECT_JUMP" flag, which for the "project()" function means to
365 * start at a special grid (which makes no sense in this function), means
366 * that the path should be "angled" slightly if needed to avoid any wall
367 * grids, allowing the player to "target" any grid which is in "view".
368 * This flag is non-trivial and has not yet been implemented, but could
369 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
371 * This function returns the number of grids (if any) in the path. This
372 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
374 * This algorithm is similar to, but slightly different from, the one used
375 * by "update_view_los()", and very different from the one used by "los()".
378 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
400 /* No path necessary (or allowed) */
401 if ((x1 == x2) && (y1 == y2)) return (0);
429 /* Number of "units" in one "half" grid */
432 /* Number of "units" in one "full" grid */
438 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
449 /* Advance (X) part 2 */
452 /* Advance (X) part 3 */
459 /* Create the projection path */
463 gp[n++] = GRID(y, x);
465 /* Hack -- Check maximum range */
466 if ((n + (k >> 1)) >= range) break;
468 /* Sometimes stop at destination grid */
469 if (!(flg & (PROJECT_THRU)))
471 if ((x == x2) && (y == y2)) break;
474 if (flg & (PROJECT_DISI))
476 if ((n > 0) && cave_stop_disintegration(y, x)) break;
478 else if (flg & (PROJECT_LOS))
480 if ((n > 0) && !cave_los_bold(y, x)) break;
482 else if (!(flg & (PROJECT_PATH)))
484 /* Always stop at non-initial wall grids */
485 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
488 /* Sometimes stop at non-initial monsters/players */
489 if (flg & (PROJECT_STOP))
492 (player_bold(y, x) || cave[y][x].m_idx != 0))
496 if (!in_bounds(y, x)) break;
501 /* Advance (X) part 1 */
504 /* Horizontal change */
507 /* Advance (X) part 2 */
510 /* Advance (X) part 3 */
526 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
535 /* Vertical change */
538 /* Advance (Y) part 2 */
541 /* Advance (Y) part 3 */
548 /* Create the projection path */
552 gp[n++] = GRID(y, x);
554 /* Hack -- Check maximum range */
555 if ((n + (k >> 1)) >= range) break;
557 /* Sometimes stop at destination grid */
558 if (!(flg & (PROJECT_THRU)))
560 if ((x == x2) && (y == y2)) break;
563 if (flg & (PROJECT_DISI))
565 if ((n > 0) && cave_stop_disintegration(y, x)) break;
567 else if (flg & (PROJECT_LOS))
569 if ((n > 0) && !cave_los_bold(y, x)) break;
571 else if (!(flg & (PROJECT_PATH)))
573 /* Always stop at non-initial wall grids */
574 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
577 /* Sometimes stop at non-initial monsters/players */
578 if (flg & (PROJECT_STOP))
581 (player_bold(y, x) || cave[y][x].m_idx != 0))
585 if (!in_bounds(y, x)) break;
590 /* Advance (Y) part 1 */
593 /* Vertical change */
596 /* Advance (Y) part 2 */
599 /* Advance (Y) part 3 */
619 /* Create the projection path */
623 gp[n++] = GRID(y, x);
625 /* Hack -- Check maximum range */
626 if ((n + (n >> 1)) >= range) break;
628 /* Sometimes stop at destination grid */
629 if (!(flg & (PROJECT_THRU)))
631 if ((x == x2) && (y == y2)) break;
634 if (flg & (PROJECT_DISI))
636 if ((n > 0) && cave_stop_disintegration(y, x)) break;
638 else if (flg & (PROJECT_LOS))
640 if ((n > 0) && !cave_los_bold(y, x)) break;
642 else if (!(flg & (PROJECT_PATH)))
644 /* Always stop at non-initial wall grids */
645 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
648 /* Sometimes stop at non-initial monsters/players */
649 if (flg & (PROJECT_STOP))
652 (player_bold(y, x) || cave[y][x].m_idx != 0))
656 if (!in_bounds(y, x)) break;
673 * Mega-Hack -- track "affected" monsters (see "project()" comments)
675 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
676 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
677 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
678 /* Mega-Hack -- monsters target */
679 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
680 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
684 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
685 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
686 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
687 * @param y 目標Y座標 / Target y location (or location to travel "towards")
688 * @param x 目標X座標 / Target x location (or location to travel "towards")
689 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
690 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
691 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
694 * We are called both for "beam" effects and "ball" effects.
696 * The "r" parameter is the "distance from ground zero".
698 * Note that we determine if the player can "see" anything that happens
699 * by taking into account: blindness, line-of-sight, and illumination.
701 * We return "TRUE" if the effect of the projection is "obvious".
703 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
705 * XXX XXX XXX Perhaps we should affect doors?
708 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
710 cave_type *c_ptr = &cave[y][x];
711 feature_type *f_ptr = &f_info[c_ptr->feat];
713 bool obvious = FALSE;
714 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 */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
897 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
899 if (have_flag(f_ptr->flags, FF_SPIKE))
901 s16b old_mimic = c_ptr->mimic;
902 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
904 cave_alter_feat(y, x, FF_SPIKE);
906 c_ptr->mimic = old_mimic;
914 /* Check line of sight */
915 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
917 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
924 /* Destroy walls (and doors) */
927 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
929 if (known && (c_ptr->info & (CAVE_MARK)))
931 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
935 /* Destroy the wall */
936 cave_alter_feat(y, x, FF_HURT_ROCK);
938 /* Update some things */
939 p_ptr->update |= (PU_FLOW);
948 /* Require a "naked" floor grid */
949 if (!cave_naked_bold(y, x)) break;
951 /* Not on the player */
952 if (player_bold(y, x)) break;
954 /* Create a closed door */
955 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
958 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
975 /* Require a "naked" floor grid */
976 if (!cave_naked_bold(y, x)) break;
978 /* Not on the player */
979 if (player_bold(y, x)) break;
981 /* Create a closed door */
982 cave_set_feat(y, x, feat_tree);
985 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
993 /* Require a "naked" floor grid */
994 if (!cave_naked_bold(y, x)) break;
997 c_ptr->info |= CAVE_OBJECT;
998 c_ptr->mimic = feat_glyph;
1011 /* Require a "naked" floor grid */
1012 if (!cave_naked_bold(y, x)) break;
1014 /* Not on the player */
1015 if (player_bold(y, x)) break;
1018 cave_set_feat(y, x, feat_granite);
1026 /* Ignore permanent grid */
1027 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1032 /* Ignore grid without enough space */
1033 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1035 /* Place a shallow lava */
1036 cave_set_feat(y, x, feat_shallow_lava);
1041 /* Place a deep lava */
1042 cave_set_feat(y, x, feat_deep_lava);
1049 /* Ignore permanent grid */
1050 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1055 /* Ignore grid without enough space */
1056 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1058 /* Place a shallow water */
1059 cave_set_feat(y, x, feat_shallow_water);
1064 /* Place a deep water */
1065 cave_set_feat(y, x, feat_deep_water);
1070 /* Lite up the grid */
1074 /* Turn on the light */
1075 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1077 c_ptr->info |= (CAVE_GLOW);
1085 update_local_illumination(y, x);
1088 if (player_can_see_bold(y, x)) obvious = TRUE;
1090 /* Mega-Hack -- Update the monster in the affected grid */
1091 /* This allows "spear of light" (etc) to work "correctly" */
1092 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1094 if (p_ptr->special_defense & NINJA_S_STEALTH)
1096 if (player_bold(y, x)) set_superstealth(FALSE);
1103 /* Darken the grid */
1107 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1110 /* Turn off the light. */
1113 if (dun_level || !is_daytime())
1115 for (j = 0; j < 9; j++)
1117 int by = y + ddy_ddd[j];
1118 int bx = x + ddx_ddd[j];
1120 if (in_bounds2(by, bx))
1122 cave_type *cc_ptr = &cave[by][bx];
1124 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1132 if (!do_dark) break;
1135 c_ptr->info &= ~(CAVE_GLOW);
1137 /* Hack -- Forget "boring" grids */
1138 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1141 c_ptr->info &= ~(CAVE_MARK);
1150 update_local_illumination(y, x);
1153 if (player_can_see_bold(y, x)) obvious = TRUE;
1155 /* Mega-Hack -- Update the monster in the affected grid */
1156 /* This allows "spear of light" (etc) to work "correctly" */
1157 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1167 if (is_mirror_grid(c_ptr))
1169 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1171 remove_mirror(y, x);
1172 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1175 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1177 if (known && (c_ptr->info & CAVE_MARK))
1179 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1183 /* Destroy the wall */
1184 cave_alter_feat(y, x, FF_HURT_ROCK);
1186 /* Update some things */
1187 p_ptr->update |= (PU_FLOW);
1194 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1196 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1198 remove_mirror(y, x);
1199 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1202 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1204 if (known && (c_ptr->info & CAVE_MARK))
1206 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1210 /* Destroy the wall */
1211 cave_alter_feat(y, x, FF_HURT_ROCK);
1213 /* Update some things */
1214 p_ptr->update |= (PU_FLOW);
1219 case GF_DISINTEGRATE:
1221 /* Destroy mirror/glyph */
1222 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1223 remove_mirror(y, x);
1225 /* Permanent features don't get effect */
1226 /* But not protect monsters and other objects */
1227 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1229 cave_alter_feat(y, x, FF_HURT_DISI);
1231 /* Update some things -- similar to GF_KILL_WALL */
1232 p_ptr->update |= (PU_FLOW);
1239 /* Return "Anything seen?" */
1246 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1247 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1248 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1249 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1250 * @param x 目標X座標 / Target x location (or location to travel "towards")
1251 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1252 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1253 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1256 * We are called from "project()" to "damage" objects
1258 * We are called both for "beam" effects and "ball" effects.
1260 * Perhaps we should only SOMETIMES damage things on the ground.
1262 * The "r" parameter is the "distance from ground zero".
1264 * Note that we determine if the player can "see" anything that happens
1265 * by taking into account: blindness, line-of-sight, and illumination.
1267 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1269 * We return "TRUE" if the effect of the projection is "obvious".
1272 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1274 cave_type *c_ptr = &cave[y][x];
1276 OBJECT_IDX this_o_idx, next_o_idx = 0;
1278 bool obvious = FALSE;
1279 bool known = player_has_los_bold(y, x);
1281 BIT_FLAGS flgs[TR_FLAG_SIZE];
1283 char o_name[MAX_NLEN];
1285 KIND_OBJECT_IDX k_idx = 0;
1286 bool is_potion = FALSE;
1289 who = who ? who : 0;
1291 /* Reduce damage by distance */
1292 dam = (dam + r) / (r + 1);
1295 /* Scan all objects in the grid */
1296 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1298 /* Acquire object */
1299 object_type *o_ptr = &o_list[this_o_idx];
1301 bool is_art = FALSE;
1302 bool ignore = FALSE;
1303 bool do_kill = FALSE;
1305 cptr note_kill = NULL;
1308 /* Get the "plural"-ness */
1309 bool plural = (o_ptr->number > 1);
1312 /* Acquire next object */
1313 next_o_idx = o_ptr->next_o_idx;
1315 /* Extract the flags */
1316 object_flags(o_ptr, flgs);
1318 /* Check for artifact */
1319 if (object_is_artifact(o_ptr)) is_art = TRUE;
1321 /* Analyze the type */
1324 /* Acid -- Lots of things */
1327 if (hates_acid(o_ptr))
1330 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1331 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1336 /* Elec -- Rings and Wands */
1339 if (hates_elec(o_ptr))
1342 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1343 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1348 /* Fire -- Flammable objects */
1351 if (hates_fire(o_ptr))
1354 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1355 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1360 /* Cold -- potions and flasks */
1363 if (hates_cold(o_ptr))
1365 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1367 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1375 if (hates_fire(o_ptr))
1378 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1379 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1381 if (hates_elec(o_ptr))
1385 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1386 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1394 if (hates_fire(o_ptr))
1397 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1398 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1400 if (hates_cold(o_ptr))
1404 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1405 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1410 /* Hack -- break potions and such */
1416 if (hates_cold(o_ptr))
1418 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1424 /* Mana and Chaos -- destroy everything */
1430 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1434 case GF_DISINTEGRATE:
1437 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1444 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1445 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1446 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1450 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1454 if (object_is_cursed(o_ptr))
1457 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1464 identify_item(o_ptr);
1466 /* Auto-inscription */
1467 autopick_alter_item((-this_o_idx), FALSE);
1475 /* Chests are noticed only if trapped or locked */
1476 if (o_ptr->tval == TV_CHEST)
1478 /* Disarm/Unlock traps */
1479 if (o_ptr->pval > 0)
1481 /* Disarm or Unlock */
1482 o_ptr->pval = (0 - o_ptr->pval);
1485 object_known(o_ptr);
1488 if (known && (o_ptr->marked & OM_FOUND))
1490 msg_print(_("カチッと音がした!", "Click!"));
1500 if (o_ptr->tval == TV_CORPSE)
1503 BIT_FLAGS mode = 0L;
1505 if (!who || is_pet(&m_list[who]))
1506 mode |= PM_FORCE_PET;
1508 for (i = 0; i < o_ptr->number ; i++)
1510 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1511 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1515 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1519 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1521 note_kill = _("生き返った。", " revived.");
1523 else if (!note_kill)
1525 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1536 /* Attempt to destroy the object */
1539 /* Effect "observed" */
1540 if (known && (o_ptr->marked & OM_FOUND))
1543 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1546 /* Artifacts, and other objects, get to resist */
1547 if (is_art || ignore)
1549 /* Observe the resist */
1550 if (known && (o_ptr->marked & OM_FOUND))
1552 msg_format(_("%sは影響を受けない!",
1553 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1560 /* Describe if needed */
1561 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1563 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1566 k_idx = o_ptr->k_idx;
1567 is_potion = object_is_potion(o_ptr);
1570 /* Delete the object */
1571 delete_object_idx(this_o_idx);
1573 /* Potions produce effects when 'shattered' */
1576 (void)potion_smash_effect(who, y, x, k_idx);
1585 /* Return "Anything seen?" */
1591 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1592 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1593 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1594 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1595 * @param x 目標X座標 / Target x location (or location to travel "towards")
1596 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1597 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1599 * @param see_s_msg TRUEならばメッセージを表示する
1600 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1603 * This routine takes a "source monster" (by index) which is mostly used to
1604 * determine if the player is causing the damage, and a "radius" (see below),
1605 * which is used to decrease the power of explosions with distance, and a
1606 * location, via integers which are modified by certain types of attacks
1607 * (polymorph and teleport being the obvious ones), a default damage, which
1608 * is modified as needed based on various properties, and finally a "damage
1609 * type" (see below).
1612 * Note that this routine can handle "no damage" attacks (like teleport) by
1613 * taking a "zero" damage, and can even take "parameters" to attacks (like
1614 * confuse) by accepting a "damage", using it to calculate the effect, and
1615 * then setting the damage to zero. Note that the "damage" parameter is
1616 * divided by the radius, so monsters not at the "epicenter" will not take
1617 * as much damage (or whatever)...
1620 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1621 * may result in a dereference of an invalid pointer. XXX XXX XXX
1624 * Various messages are produced, and damage is applied.
1627 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1628 * actually be "made" of that substance, or "breathe" big balls of it.
1629 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1631 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1632 * and hurts evil less. If can breath nether, then it resists it as well.
1635 * Damage reductions use the following formulas:
1636 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1637 * gives avg damage of .655, ranging from .858 to .500
1638 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1639 * gives avg damage of .544, ranging from .714 to .417
1640 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1641 * gives avg damage of .444, ranging from .556 to .333
1642 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1643 * gives avg damage of .327, ranging from .427 to .250
1644 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1645 * gives something simple.
1648 * In this function, "result" messages are postponed until the end, where
1649 * the "note" string is appended to the monster name, if not NULL. So,
1650 * to make a spell have "no effect" just set "note" to NULL. You should
1651 * also set "notice" to FALSE, or the player will learn what the spell does.
1654 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1658 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1662 cave_type *c_ptr = &cave[y][x];
1664 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1665 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1667 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1671 /* Is the monster "seen"? */
1672 bool seen = m_ptr->ml;
1673 bool seen_msg = is_seen(m_ptr);
1675 bool slept = (bool)MON_CSLEEP(m_ptr);
1677 /* Were the effects "obvious" (if seen)? */
1678 bool obvious = FALSE;
1680 /* Can the player know about this effect? */
1681 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1683 /* Were the effects "irrelevant"? */
1684 bool skipped = FALSE;
1686 /* Gets the monster angry at the source of the effect? */
1687 bool get_angry = FALSE;
1689 /* Polymorph setting (true or false) */
1690 bool do_poly = FALSE;
1692 /* Teleport setting (max distance) */
1695 /* Confusion setting (amount to confuse) */
1698 /* Stunning setting (amount to stun) */
1701 /* Sleep amount (amount to sleep) */
1704 /* Fear amount (amount to fear) */
1707 /* Time amount (amount to time) */
1710 bool heal_leper = FALSE;
1712 /* Hold the monster name */
1716 PARAMETER_VALUE photo = 0;
1718 /* Assume no note */
1721 /* Assume a default death */
1722 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1727 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1730 if (!c_ptr->m_idx) return (FALSE);
1732 /* Never affect projector */
1733 if (who && (c_ptr->m_idx == who)) return (FALSE);
1734 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1735 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1737 /* Don't affect already death monsters */
1738 /* Prevents problems with chain reactions of exploding monsters */
1739 if (m_ptr->hp < 0) return (FALSE);
1741 /* Reduce damage by distance */
1742 dam = (dam + r) / (r + 1);
1745 /* Get the monster name (BEFORE polymorphing) */
1746 monster_desc(m_name, m_ptr, 0);
1748 /* Get the monster possessive ("his"/"her"/"its") */
1749 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1751 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1753 /* Analyze the damage type */
1756 /* Magic Missile -- pure damage */
1759 if (seen) obvious = TRUE;
1761 if (r_ptr->flagsr & RFR_RES_ALL)
1763 note = _("には完全な耐性がある!", " is immune.");
1765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1774 if (seen) obvious = TRUE;
1776 if (r_ptr->flagsr & RFR_RES_ALL)
1778 note = _("には完全な耐性がある!", " is immune.");
1780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1783 if (r_ptr->flagsr & RFR_IM_ACID)
1785 note = _("にはかなり耐性がある!", " resists a lot.");
1787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1795 if (seen) obvious = TRUE;
1797 if (r_ptr->flagsr & RFR_RES_ALL)
1799 note = _("には完全な耐性がある!", " is immune.");
1801 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1804 if (r_ptr->flagsr & RFR_IM_ELEC)
1806 note = _("にはかなり耐性がある!", " resists a lot.");
1808 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1816 if (seen) obvious = TRUE;
1818 if (r_ptr->flagsr & RFR_RES_ALL)
1820 note = _("には完全な耐性がある!", " is immune.");
1822 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1825 if (r_ptr->flagsr & RFR_IM_FIRE)
1827 note = _("にはかなり耐性がある!", " resists a lot.");
1829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1831 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1833 note = _("はひどい痛手をうけた。", " is hit hard.");
1835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1843 if (seen) obvious = TRUE;
1845 if (r_ptr->flagsr & RFR_RES_ALL)
1847 note = _("には完全な耐性がある!", " is immune.");
1849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1852 if (r_ptr->flagsr & RFR_IM_COLD)
1854 note = _("にはかなり耐性がある!", " resists a lot.");
1856 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1858 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1860 note = _("はひどい痛手をうけた。", " is hit hard.");
1862 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1870 if (seen) obvious = TRUE;
1872 if (r_ptr->flagsr & RFR_RES_ALL)
1874 note = _("には完全な耐性がある!", " is immune.");
1876 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1879 if (r_ptr->flagsr & RFR_IM_POIS)
1881 note = _("にはかなり耐性がある!", " resists a lot.");
1883 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1891 if (seen) obvious = TRUE;
1893 if (r_ptr->flagsr & RFR_RES_ALL)
1895 note = _("には完全な耐性がある!", " is immune.");
1897 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1900 if (r_ptr->flagsr & RFR_IM_POIS)
1902 note = _("には耐性がある。", " resists.");
1903 dam *= 3; dam /= randint1(6) + 6;
1904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1906 else if (one_in_(3)) do_poly = TRUE;
1910 /* Hellfire -- hurts Evil */
1913 if (seen) obvious = TRUE;
1915 if (r_ptr->flagsr & RFR_RES_ALL)
1917 note = _("には完全な耐性がある!", " is immune.");
1919 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1922 if (r_ptr->flags3 & RF3_GOOD)
1924 note = _("はひどい痛手をうけた。", " is hit hard.");
1926 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1931 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1934 if (seen) obvious = TRUE;
1936 if (r_ptr->flagsr & RFR_RES_ALL)
1938 note = _("には完全な耐性がある!", " is immune.");
1940 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1943 if (r_ptr->flags3 & RF3_GOOD)
1945 note = _("には完全な耐性がある!", " is immune.");
1947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1949 else if (r_ptr->flags3 & RF3_EVIL)
1952 note = _("はひどい痛手をうけた。", " is hit hard.");
1953 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1957 note = _("には耐性がある。", " resists.");
1958 dam *= 3; dam /= randint1(6) + 6;
1963 /* Arrow -- XXX no defense */
1966 if (seen) obvious = TRUE;
1968 if (r_ptr->flagsr & RFR_RES_ALL)
1970 note = _("には完全な耐性がある!", " is immune.");
1972 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1978 /* Plasma -- XXX perhaps check ELEC or FIRE */
1981 if (seen) obvious = TRUE;
1983 if (r_ptr->flagsr & RFR_RES_ALL)
1985 note = _("には完全な耐性がある!", " is immune.");
1987 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1990 if (r_ptr->flagsr & RFR_RES_PLAS)
1992 note = _("には耐性がある。", " resists.");
1993 dam *= 3; dam /= randint1(6) + 6;
1994 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1999 /* Nether -- see above */
2002 if (seen) obvious = TRUE;
2004 if (r_ptr->flagsr & RFR_RES_ALL)
2006 note = _("には完全な耐性がある!", " is immune.");
2008 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2011 if (r_ptr->flagsr & RFR_RES_NETH)
2013 if (r_ptr->flags3 & RF3_UNDEAD)
2015 note = _("には完全な耐性がある!", " is immune.");
2017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2021 note = _("には耐性がある。", " resists.");
2022 dam *= 3; dam /= randint1(6) + 6;
2024 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2026 else if (r_ptr->flags3 & RF3_EVIL)
2028 note = _("はいくらか耐性を示した。", " resists somewhat.");
2030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2035 /* Water (acid) damage -- Water spirits/elementals are immune */
2038 if (seen) obvious = TRUE;
2040 if (r_ptr->flagsr & RFR_RES_ALL)
2042 note = _("には完全な耐性がある!", " is immune.");
2044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2047 if (r_ptr->flagsr & RFR_RES_WATE)
2049 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2051 note = _("には完全な耐性がある!", " is immune.");
2056 note = _("には耐性がある。", " resists.");
2057 dam *= 3; dam /= randint1(6) + 6;
2059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2064 /* Chaos -- Chaos breathers resist */
2067 if (seen) obvious = TRUE;
2069 if (r_ptr->flagsr & RFR_RES_ALL)
2071 note = _("には完全な耐性がある!", " is immune.");
2073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2076 if (r_ptr->flagsr & RFR_RES_CHAO)
2078 note = _("には耐性がある。", " resists.");
2079 dam *= 3; dam /= randint1(6) + 6;
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2082 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2084 note = _("はいくらか耐性を示した。", " resists somewhat.");
2085 dam *= 3; dam /= randint1(6) + 6;
2086 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2091 do_conf = (5 + randint1(11) + r) / (r + 1);
2096 /* Shards -- Shard breathers resist */
2099 if (seen) obvious = TRUE;
2101 if (r_ptr->flagsr & RFR_RES_ALL)
2103 note = _("には完全な耐性がある!", " is immune.");
2105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2108 if (r_ptr->flagsr & RFR_RES_SHAR)
2110 note = _("には耐性がある。", " resists.");
2111 dam *= 3; dam /= randint1(6) + 6;
2112 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2117 /* Rocket: Shard resistance helps */
2120 if (seen) obvious = TRUE;
2122 if (r_ptr->flagsr & RFR_RES_ALL)
2124 note = _("には完全な耐性がある!", " is immune.");
2126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2129 if (r_ptr->flagsr & RFR_RES_SHAR)
2131 note = _("はいくらか耐性を示した。", " resists somewhat.");
2133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2139 /* Sound -- Sound breathers resist */
2142 if (seen) obvious = TRUE;
2144 if (r_ptr->flagsr & RFR_RES_ALL)
2146 note = _("には完全な耐性がある!", " is immune.");
2148 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2151 if (r_ptr->flagsr & RFR_RES_SOUN)
2153 note = _("には耐性がある。", " resists.");
2154 dam *= 2; dam /= randint1(6) + 6;
2155 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2157 else do_stun = (10 + randint1(15) + r) / (r + 1);
2164 if (seen) obvious = TRUE;
2166 if (r_ptr->flagsr & RFR_RES_ALL)
2168 note = _("には完全な耐性がある!", " is immune.");
2170 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2173 if (r_ptr->flags3 & RF3_NO_CONF)
2175 note = _("には耐性がある。", " resists.");
2176 dam *= 3; dam /= randint1(6) + 6;
2177 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2179 else do_conf = (10 + randint1(15) + r) / (r + 1);
2183 /* Disenchantment -- Breathers and Disenchanters resist */
2186 if (seen) obvious = TRUE;
2188 if (r_ptr->flagsr & RFR_RES_ALL)
2190 note = _("には完全な耐性がある!", " is immune.");
2192 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2195 if (r_ptr->flagsr & RFR_RES_DISE)
2197 note = _("には耐性がある。", " resists.");
2198 dam *= 3; dam /= randint1(6) + 6;
2199 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2204 /* Nexus -- Breathers and Existers resist */
2207 if (seen) obvious = TRUE;
2209 if (r_ptr->flagsr & RFR_RES_ALL)
2211 note = _("には完全な耐性がある!", " is immune.");
2213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2216 if (r_ptr->flagsr & RFR_RES_NEXU)
2218 note = _("には耐性がある。", " resists.");
2219 dam *= 3; dam /= randint1(6) + 6;
2220 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2228 if (seen) obvious = TRUE;
2230 if (r_ptr->flagsr & RFR_RES_ALL)
2232 note = _("には完全な耐性がある!", " is immune.");
2234 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2237 if (r_ptr->flagsr & RFR_RES_WALL)
2239 note = _("には耐性がある。", " resists.");
2240 dam *= 3; dam /= randint1(6) + 6;
2241 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2243 else do_stun = (randint1(15) + r) / (r + 1);
2247 /* Inertia -- breathers resist */
2250 if (seen) obvious = TRUE;
2252 if (r_ptr->flagsr & RFR_RES_ALL)
2254 note = _("には完全な耐性がある!", " is immune.");
2256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2259 if (r_ptr->flagsr & RFR_RES_INER)
2261 note = _("には耐性がある。", " resists.");
2262 dam *= 3; dam /= randint1(6) + 6;
2263 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2267 /* Powerful monsters can resist */
2268 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2269 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2273 /* Normal monsters slow down */
2276 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2278 note = _("の動きが遅くなった。", " starts moving slower.");
2285 /* Time -- breathers resist */
2288 if (seen) obvious = TRUE;
2290 if (r_ptr->flagsr & RFR_RES_ALL)
2292 note = _("には完全な耐性がある!", " is immune.");
2294 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2297 if (r_ptr->flagsr & RFR_RES_TIME)
2299 note = _("には耐性がある。", " resists.");
2300 dam *= 3; dam /= randint1(6) + 6;
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2303 else do_time = (dam + 1) / 2;
2307 /* Gravity -- breathers resist */
2310 bool resist_tele = FALSE;
2312 if (seen) obvious = TRUE;
2314 if (r_ptr->flagsr & RFR_RES_ALL)
2316 note = _("には完全な耐性がある!", " is immune.");
2318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2321 if (r_ptr->flagsr & RFR_RES_TELE)
2323 if (r_ptr->flags1 & (RF1_UNIQUE))
2325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2326 note = _("には効果がなかった。", " is unaffected!");
2329 else if (r_ptr->level > randint1(100))
2331 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2332 note = _("には耐性がある!", " resists!");
2337 if (!resist_tele) do_dist = 10;
2339 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2341 if (r_ptr->flagsr & RFR_RES_GRAV)
2343 note = _("には耐性がある!", " resists!");
2344 dam *= 3; dam /= randint1(6) + 6;
2346 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2351 /* Powerful monsters can resist */
2352 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2353 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2357 /* Normal monsters slow down */
2360 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2362 note = _("の動きが遅くなった。", " starts moving slower.");
2367 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2369 /* Attempt a saving throw */
2370 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2371 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2375 /* No obvious effect */
2376 note = _("には効果がなかった。", " is unaffected!");
2388 if (seen) obvious = TRUE;
2390 if (r_ptr->flagsr & RFR_RES_ALL)
2392 note = _("には完全な耐性がある!", " is immune.");
2394 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2402 case GF_DISINTEGRATE:
2404 if (seen) obvious = TRUE;
2406 if (r_ptr->flagsr & RFR_RES_ALL)
2408 note = _("には完全な耐性がある!", " is immune.");
2410 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2413 if (r_ptr->flags3 & RF3_HURT_ROCK)
2415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2416 note = _("の皮膚がただれた!", " loses some skin!");
2417 note_dies = _("は蒸発した!", " evaporates!");
2425 if (seen) obvious = TRUE;
2427 /* PSI only works if the monster can see you! -- RG */
2428 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2431 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2436 if (r_ptr->flagsr & RFR_RES_ALL)
2438 note = _("には完全な耐性がある!", " is immune.");
2440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2443 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2446 note = _("には完全な耐性がある!", " is immune.");
2447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2450 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2451 (r_ptr->flags3 & RF3_ANIMAL) ||
2452 (r_ptr->level > randint1(3 * dam)))
2454 note = _("には耐性がある!", " resists!");
2458 * Powerful demons & undead can turn a mindcrafter's
2459 * attacks back on them
2461 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2462 (r_ptr->level > p_ptr->lev / 2) &&
2466 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2467 (seen ? "%^s's corrupted mind backlashes your attack!" :
2468 "%^ss corrupted mind backlashes your attack!")), m_name);
2471 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2473 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2477 /* Injure +/- confusion */
2478 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2479 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2480 if (one_in_(4) && !CHECK_MULTISHADOW())
2482 switch (randint1(4))
2485 set_confused(p_ptr->confused + 3 + randint1(dam));
2488 set_stun(p_ptr->stun + randint1(dam));
2492 if (r_ptr->flags3 & RF3_NO_FEAR)
2493 note = _("には効果がなかった。", " is unaffected.");
2495 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2499 if (!p_ptr->free_act)
2500 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2509 if ((dam > 0) && one_in_(4))
2511 switch (randint1(4))
2514 do_conf = 3 + randint1(dam);
2517 do_stun = 3 + randint1(dam);
2520 do_fear = 3 + randint1(dam);
2523 note = _("は眠り込んでしまった!", " falls asleep!");
2524 do_sleep = 3 + randint1(dam);
2529 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2535 if (seen) obvious = TRUE;
2537 if (r_ptr->flagsr & RFR_RES_ALL)
2539 note = _("には完全な耐性がある!", " is immune.");
2541 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2544 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2547 note = _("には完全な耐性がある!", " is immune.");
2549 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2550 (r_ptr->flags3 & RF3_ANIMAL) ||
2551 (r_ptr->level > randint1(3 * dam)))
2553 note = _("には耐性がある!", " resists!");
2557 * Powerful demons & undead can turn a mindcrafter's
2558 * attacks back on them
2560 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2561 (r_ptr->level > p_ptr->lev / 2) &&
2565 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2566 (seen ? "%^s's corrupted mind backlashes your attack!" :
2567 "%^ss corrupted mind backlashes your attack!")), m_name);
2569 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2571 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2575 /* Injure + mana drain */
2576 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2577 if (!CHECK_MULTISHADOW())
2579 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2580 p_ptr->csp -= damroll(5, dam) / 2;
2581 if (p_ptr->csp < 0) p_ptr->csp = 0;
2582 p_ptr->redraw |= PR_MANA;
2583 p_ptr->window |= (PW_SPELL);
2585 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2592 int b = damroll(5, dam) / 4;
2593 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2594 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2595 (seen ? "You convert %s's pain into %s!" :
2596 "You convert %ss pain into %s!"));
2597 msg_format(msg, m_name, str);
2599 b = MIN(p_ptr->msp, p_ptr->csp + b);
2601 p_ptr->redraw |= PR_MANA;
2602 p_ptr->window |= (PW_SPELL);
2604 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2608 case GF_TELEKINESIS:
2610 if (seen) obvious = TRUE;
2612 if (r_ptr->flagsr & RFR_RES_ALL)
2614 note = _("には完全な耐性がある!", " is immune.");
2616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2621 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2626 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2628 /* Attempt a saving throw */
2629 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2630 (r_ptr->level > 5 + randint1(dam)))
2634 /* No obvious effect */
2640 /* Psycho-spear -- powerful magic missile */
2643 if (seen) obvious = TRUE;
2645 if (r_ptr->flagsr & RFR_RES_ALL)
2647 note = _("には完全な耐性がある!", " is immune.");
2649 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2655 /* Meteor -- powerful magic missile */
2658 if (seen) obvious = TRUE;
2660 if (r_ptr->flagsr & RFR_RES_ALL)
2662 note = _("には完全な耐性がある!", " is immune.");
2664 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2672 if (!is_hostile(m_ptr)) break;
2674 if (seen) obvious = TRUE;
2676 if (r_ptr->flagsr & RFR_RES_ALL)
2678 note = _("には効果がなかった!", " is immune.");
2680 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2683 /* Attempt a saving throw */
2684 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2685 (r_ptr->flags3 & RF3_NO_CONF) ||
2686 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2688 /* Memorize a flag */
2689 if (r_ptr->flags3 & RF3_NO_CONF)
2691 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2698 * Powerful demons & undead can turn a mindcrafter's
2699 * attacks back on them
2701 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2702 (r_ptr->level > p_ptr->lev / 2) &&
2706 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2707 (seen ? "%^s's corrupted mind backlashes your attack!" :
2708 "%^ss corrupted mind backlashes your attack!")), m_name);
2711 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2713 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2717 /* Confuse, stun, terrify */
2718 switch (randint1(4))
2721 set_stun(p_ptr->stun + dam / 2);
2724 set_confused(p_ptr->confused + dam / 2);
2728 if (r_ptr->flags3 & RF3_NO_FEAR)
2729 note = _("には効果がなかった。", " is unaffected.");
2731 set_afraid(p_ptr->afraid + dam);
2738 /* No obvious effect */
2739 note = _("には効果がなかった。", " is unaffected.");
2745 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2747 note = _("があなたに隷属した。", " is in your thrall!");
2752 switch (randint1(4))
2766 /* No "real" damage */
2773 /* Ice -- Cold + Cuts + Stun */
2776 if (seen) obvious = TRUE;
2778 if (r_ptr->flagsr & RFR_RES_ALL)
2780 note = _("には完全な耐性がある!", " is immune.");
2782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2785 do_stun = (randint1(15) + 1) / (r + 1);
2786 if (r_ptr->flagsr & RFR_IM_COLD)
2788 note = _("にはかなり耐性がある!", " resists a lot.");
2790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2792 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2794 note = _("はひどい痛手をうけた。", " is hit hard.");
2796 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2803 case GF_HYPODYNAMIA:
2805 if (seen) obvious = TRUE;
2807 if (r_ptr->flagsr & RFR_RES_ALL)
2809 note = _("には完全な耐性がある!", " is immune.");
2811 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2814 if (!monster_living(r_ptr))
2816 if (is_original_ap_and_seen(m_ptr))
2818 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2819 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2820 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2822 note = _("には効果がなかった。", " is unaffected.");
2826 else do_time = (dam+7)/8;
2834 if (seen) obvious = TRUE;
2836 if (r_ptr->flagsr & RFR_RES_ALL)
2838 note = _("には完全な耐性がある!", " is immune.");
2840 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2843 if (!monster_living(r_ptr))
2845 if (is_original_ap_and_seen(m_ptr))
2847 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2848 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2849 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2851 note = _("には完全な耐性がある!", " is immune.");
2855 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2856 (randint1(888) != 666)) ||
2857 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2858 randint1(100) != 66))
2860 note = _("には耐性がある!", " resists!");
2868 /* Polymorph monster (Use "dam" as "power") */
2871 if (seen) obvious = TRUE;
2873 if (r_ptr->flagsr & RFR_RES_ALL)
2875 note = _("には効果がなかった。", " is unaffected.");
2877 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2880 /* Attempt to polymorph (see below) */
2883 /* Powerful monsters can resist */
2884 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2885 (r_ptr->flags1 & RF1_QUESTOR) ||
2886 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2888 note = _("には効果がなかった。", " is unaffected.");
2893 /* No "real" damage */
2900 /* Clone monsters (Ignore "dam") */
2903 if (seen) obvious = TRUE;
2905 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2907 note = _("には効果がなかった。", " is unaffected.");
2912 m_ptr->hp = m_ptr->maxhp;
2914 /* Attempt to clone. */
2915 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2917 note = _("が分裂した!", " spawns!");
2921 /* No "real" damage */
2928 /* Heal Monster (use "dam" as amount of healing) */
2931 if (seen) obvious = TRUE;
2934 (void)set_monster_csleep(c_ptr->m_idx, 0);
2936 if (m_ptr->maxhp < m_ptr->max_maxhp)
2938 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2939 m_ptr->maxhp = m_ptr->max_maxhp;
2944 /* Redraw (later) if needed */
2945 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2946 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2954 if (seen) obvious = TRUE;
2957 (void)set_monster_csleep(c_ptr->m_idx, 0);
2958 if (MON_STUNNED(m_ptr))
2960 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2961 (void)set_monster_stunned(c_ptr->m_idx, 0);
2963 if (MON_CONFUSED(m_ptr))
2965 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2966 (void)set_monster_confused(c_ptr->m_idx, 0);
2968 if (MON_MONFEAR(m_ptr))
2970 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2971 (void)set_monster_monfear(c_ptr->m_idx, 0);
2975 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2978 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2982 chg_virtue(V_VITALITY, 1);
2984 if (r_ptr->flags1 & RF1_UNIQUE)
2985 chg_virtue(V_INDIVIDUALISM, 1);
2987 if (is_friendly(m_ptr))
2988 chg_virtue(V_HONOUR, 1);
2989 else if (!(r_ptr->flags3 & RF3_EVIL))
2991 if (r_ptr->flags3 & RF3_GOOD)
2992 chg_virtue(V_COMPASSION, 2);
2994 chg_virtue(V_COMPASSION, 1);
2997 if (r_ptr->flags3 & RF3_ANIMAL)
2998 chg_virtue(V_NATURE, 1);
3001 if (m_ptr->r_idx == MON_LEPER)
3004 if (!who) chg_virtue(V_COMPASSION, 5);
3007 /* Redraw (later) if needed */
3008 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3009 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3011 note = _("は体力を回復したようだ。", " looks healthier.");
3013 /* No "real" damage */
3019 /* Speed Monster (Ignore "dam") */
3022 if (seen) obvious = TRUE;
3025 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3027 note = _("の動きが速くなった。", " starts moving faster.");
3032 if (r_ptr->flags1 & RF1_UNIQUE)
3033 chg_virtue(V_INDIVIDUALISM, 1);
3034 if (is_friendly(m_ptr))
3035 chg_virtue(V_HONOUR, 1);
3038 /* No "real" damage */
3044 /* Slow Monster (Use "dam" as "power") */
3047 if (seen) obvious = TRUE;
3049 if (r_ptr->flagsr & RFR_RES_ALL)
3051 note = _("には効果がなかった。", " is unaffected.");
3053 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3056 /* Powerful monsters can resist */
3057 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3058 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3060 note = _("には効果がなかった。", " is unaffected.");
3064 /* Normal monsters slow down */
3067 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3069 note = _("の動きが遅くなった。", " starts moving slower.");
3073 /* No "real" damage */
3079 /* Sleep (Use "dam" as "power") */
3082 if (seen) obvious = TRUE;
3084 if (r_ptr->flagsr & RFR_RES_ALL)
3086 note = _("には効果がなかった。", " is unaffected.");
3088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3091 /* Attempt a saving throw */
3092 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3093 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3094 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3096 /* Memorize a flag */
3097 if (r_ptr->flags3 & RF3_NO_SLEEP)
3099 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3101 /* No obvious effect */
3102 note = _("には効果がなかった。", " is unaffected.");
3107 /* Go to sleep (much) later */
3108 note = _("は眠り込んでしまった!", " falls asleep!");
3112 /* No "real" damage */
3118 /* Sleep (Use "dam" as "power") */
3119 case GF_STASIS_EVIL:
3121 if (seen) obvious = TRUE;
3123 if (r_ptr->flagsr & RFR_RES_ALL)
3125 note = _("には効果がなかった!", " is immune.");
3127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3130 /* Attempt a saving throw */
3131 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3132 !(r_ptr->flags3 & RF3_EVIL) ||
3133 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3135 note = _("には効果がなかった。", " is unaffected.");
3140 /* Go to sleep (much) later */
3141 note = _("は動けなくなった!", " is suspended!");
3145 /* No "real" damage */
3150 /* Sleep (Use "dam" as "power") */
3153 if (seen) obvious = TRUE;
3155 if (r_ptr->flagsr & RFR_RES_ALL)
3157 note = _("には効果がなかった。", " is unaffected.");
3159 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3162 /* Attempt a saving throw */
3163 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3164 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3166 note = _("には効果がなかった。", " is unaffected.");
3171 /* Go to sleep (much) later */
3172 note = _("は動けなくなった!", " is suspended!");
3176 /* No "real" damage */
3185 vir = virtue_number(V_HARMONY);
3188 dam += p_ptr->virtues[vir-1]/10;
3191 vir = virtue_number(V_INDIVIDUALISM);
3194 dam -= p_ptr->virtues[vir-1]/20;
3197 if (seen) obvious = TRUE;
3199 /* Attempt a saving throw */
3200 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3204 /* No obvious effect */
3205 note = _("には効果がなかった。", " is unaffected.");
3208 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3210 else if (p_ptr->cursed & TRC_AGGRAVATE)
3212 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3213 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3217 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3220 chg_virtue(V_INDIVIDUALISM, -1);
3221 if (r_ptr->flags3 & RF3_ANIMAL)
3222 chg_virtue(V_NATURE, 1);
3225 /* No "real" damage */
3230 /* Control undead */
3231 case GF_CONTROL_UNDEAD:
3234 if (seen) obvious = TRUE;
3236 vir = virtue_number(V_UNLIFE);
3239 dam += p_ptr->virtues[vir-1]/10;
3242 vir = virtue_number(V_INDIVIDUALISM);
3245 dam -= p_ptr->virtues[vir-1]/20;
3248 /* Attempt a saving throw */
3249 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3250 !(r_ptr->flags3 & RF3_UNDEAD))
3252 /* No obvious effect */
3253 note = _("には効果がなかった。", " is unaffected.");
3255 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3257 else if (p_ptr->cursed & TRC_AGGRAVATE)
3259 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3260 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3264 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3268 /* No "real" damage */
3274 case GF_CONTROL_DEMON:
3277 if (seen) obvious = TRUE;
3279 vir = virtue_number(V_UNLIFE);
3282 dam += p_ptr->virtues[vir-1]/10;
3285 vir = virtue_number(V_INDIVIDUALISM);
3288 dam -= p_ptr->virtues[vir-1]/20;
3291 /* Attempt a saving throw */
3292 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3293 !(r_ptr->flags3 & RF3_DEMON))
3295 /* No obvious effect */
3296 note = _("には効果がなかった。", " is unaffected.");
3298 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3300 else if (p_ptr->cursed & TRC_AGGRAVATE)
3302 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3303 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3307 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3311 /* No "real" damage */
3317 case GF_CONTROL_ANIMAL:
3320 if (seen) obvious = TRUE;
3322 vir = virtue_number(V_NATURE);
3325 dam += p_ptr->virtues[vir-1]/10;
3328 vir = virtue_number(V_INDIVIDUALISM);
3331 dam -= p_ptr->virtues[vir-1]/20;
3334 /* Attempt a saving throw */
3335 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3336 !(r_ptr->flags3 & RF3_ANIMAL))
3339 /* No obvious effect */
3340 note = _("には効果がなかった。", " is unaffected.");
3342 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3344 else if (p_ptr->cursed & TRC_AGGRAVATE)
3346 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3347 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3351 note = _("はなついた。", " is tamed!");
3353 if (r_ptr->flags3 & RF3_ANIMAL)
3354 chg_virtue(V_NATURE, 1);
3357 /* No "real" damage */
3363 case GF_CHARM_LIVING:
3367 vir = virtue_number(V_UNLIFE);
3368 if (seen) obvious = TRUE;
3370 vir = virtue_number(V_UNLIFE);
3373 dam -= p_ptr->virtues[vir-1]/10;
3376 vir = virtue_number(V_INDIVIDUALISM);
3379 dam -= p_ptr->virtues[vir-1]/20;
3382 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3384 /* Attempt a saving throw */
3385 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3386 !monster_living(r_ptr))
3389 /* No obvious effect */
3390 note = _("には効果がなかった。", " is unaffected.");
3392 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3394 else if (p_ptr->cursed & TRC_AGGRAVATE)
3396 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3397 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3401 note = _("を支配した。", " is tamed!");
3403 if (r_ptr->flags3 & RF3_ANIMAL)
3404 chg_virtue(V_NATURE, 1);
3407 /* No "real" damage */
3412 /* Confusion (Use "dam" as "power") */
3415 if (seen) obvious = TRUE;
3417 if (r_ptr->flagsr & RFR_RES_ALL)
3419 note = _("には効果がなかった。", " is unaffected.");
3421 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3424 /* Get confused later */
3425 do_conf = damroll(3, (dam / 2)) + 1;
3427 /* Attempt a saving throw */
3428 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3429 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3430 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3432 /* Memorize a flag */
3433 if (r_ptr->flags3 & (RF3_NO_CONF))
3435 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3441 /* No obvious effect */
3442 note = _("には効果がなかった。", " is unaffected.");
3446 /* No "real" damage */
3453 if (seen) obvious = TRUE;
3455 if (r_ptr->flagsr & RFR_RES_ALL)
3457 note = _("には効果がなかった。", " is unaffected.");
3459 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3462 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3464 /* Attempt a saving throw */
3465 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3466 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3471 /* No obvious effect */
3472 note = _("には効果がなかった。", " is unaffected.");
3476 /* No "real" damage */
3484 /* Lite, but only hurts susceptible creatures */
3492 if (r_ptr->flagsr & RFR_RES_ALL)
3498 if (r_ptr->flags3 & (RF3_HURT_LITE))
3500 /* Obvious effect */
3501 if (seen) obvious = TRUE;
3503 /* Memorize the effects */
3504 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3506 /* Special effect */
3507 note = _("は光に身をすくめた!", " cringes from the light!");
3508 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3511 /* Normally no damage */
3523 /* Lite -- opposite of Dark */
3526 if (seen) obvious = TRUE;
3528 if (r_ptr->flagsr & RFR_RES_ALL)
3530 note = _("には完全な耐性がある!", " is immune.");
3532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3535 if (r_ptr->flagsr & RFR_RES_LITE)
3537 note = _("には耐性がある!", " resists!");
3538 dam *= 2; dam /= (randint1(6)+6);
3539 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3541 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3544 note = _("は光に身をすくめた!", " cringes from the light!");
3545 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3552 /* Dark -- opposite of Lite */
3555 if (seen) obvious = TRUE;
3557 if (r_ptr->flagsr & RFR_RES_ALL)
3559 note = _("には完全な耐性がある!", " is immune.");
3561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3564 if (r_ptr->flagsr & RFR_RES_DARK)
3566 note = _("には耐性がある!", " resists!");
3567 dam *= 2; dam /= (randint1(6)+6);
3568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3577 if (r_ptr->flagsr & RFR_RES_ALL)
3582 /* Hurt by rock remover */
3583 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3586 if (seen) obvious = TRUE;
3588 /* Memorize the effects */
3589 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3591 /* Cute little message */
3592 note = _("の皮膚がただれた!", " loses some skin!");
3593 note_dies = _("はドロドロに溶けた!", " dissolves!");
3596 /* Usually, ignore the effects */
3607 /* Teleport undead (Use "dam" as "power") */
3608 case GF_AWAY_UNDEAD:
3610 /* Only affect undead */
3611 if (r_ptr->flags3 & (RF3_UNDEAD))
3613 bool resists_tele = FALSE;
3615 if (r_ptr->flagsr & RFR_RES_TELE)
3617 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3619 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3620 note = _("には効果がなかった。", " is unaffected.");
3621 resists_tele = TRUE;
3623 else if (r_ptr->level > randint1(100))
3625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3626 note = _("には耐性がある!", " resists!");
3627 resists_tele = TRUE;
3633 if (seen) obvious = TRUE;
3634 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3646 /* No "real" damage */
3652 /* Teleport evil (Use "dam" as "power") */
3655 /* Only affect evil */
3656 if (r_ptr->flags3 & (RF3_EVIL))
3658 bool resists_tele = FALSE;
3660 if (r_ptr->flagsr & RFR_RES_TELE)
3662 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3664 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3665 note = _("には効果がなかった。", " is unaffected.");
3666 resists_tele = TRUE;
3668 else if (r_ptr->level > randint1(100))
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3671 note = _("には耐性がある!", " resists!");
3672 resists_tele = TRUE;
3678 if (seen) obvious = TRUE;
3679 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3691 /* No "real" damage */
3697 /* Teleport monster (Use "dam" as "power") */
3700 bool resists_tele = FALSE;
3701 if (r_ptr->flagsr & RFR_RES_TELE)
3703 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3705 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3706 note = _("には効果がなかった。", " is unaffected.");
3707 resists_tele = TRUE;
3709 else if (r_ptr->level > randint1(100))
3711 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3712 note = _("には耐性がある!", " resists!");
3713 resists_tele = TRUE;
3720 if (seen) obvious = TRUE;
3722 /* Prepare to teleport */
3726 /* No "real" damage */
3732 /* Turn undead (Use "dam" as "power") */
3733 case GF_TURN_UNDEAD:
3735 if (r_ptr->flagsr & RFR_RES_ALL)
3740 /* Only affect undead */
3741 if (r_ptr->flags3 & (RF3_UNDEAD))
3744 if (seen) obvious = TRUE;
3746 /* Learn about type */
3747 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3749 /* Apply some fear */
3750 do_fear = damroll(3, (dam / 2)) + 1;
3752 /* Attempt a saving throw */
3753 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3755 /* No obvious effect */
3756 note = _("には効果がなかった。", " is unaffected.");
3769 /* No "real" damage */
3775 /* Turn evil (Use "dam" as "power") */
3778 if (r_ptr->flagsr & RFR_RES_ALL)
3783 /* Only affect evil */
3784 if (r_ptr->flags3 & (RF3_EVIL))
3787 if (seen) obvious = TRUE;
3789 /* Learn about type */
3790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3792 /* Apply some fear */
3793 do_fear = damroll(3, (dam / 2)) + 1;
3795 /* Attempt a saving throw */
3796 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3798 /* No obvious effect */
3799 note = _("には効果がなかった。", " is unaffected.");
3812 /* No "real" damage */
3818 /* Turn monster (Use "dam" as "power") */
3821 if (r_ptr->flagsr & RFR_RES_ALL)
3827 if (seen) obvious = TRUE;
3829 /* Apply some fear */
3830 do_fear = damroll(3, (dam / 2)) + 1;
3832 /* Attempt a saving throw */
3833 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3834 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3835 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3837 /* No obvious effect */
3838 note = _("には効果がなかった。", " is unaffected.");
3843 /* No "real" damage */
3850 case GF_DISP_UNDEAD:
3852 if (r_ptr->flagsr & RFR_RES_ALL)
3858 /* Only affect undead */
3859 if (r_ptr->flags3 & (RF3_UNDEAD))
3862 if (seen) obvious = TRUE;
3864 /* Learn about type */
3865 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3867 note = _("は身震いした。", " shudders.");
3868 note_dies = _("はドロドロに溶けた!", " dissolves!");
3888 if (r_ptr->flagsr & RFR_RES_ALL)
3894 /* Only affect evil */
3895 if (r_ptr->flags3 & (RF3_EVIL))
3898 if (seen) obvious = TRUE;
3900 /* Learn about type */
3901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3903 note = _("は身震いした。", " shudders.");
3904 note_dies = _("はドロドロに溶けた!", " dissolves!");
3923 if (r_ptr->flagsr & RFR_RES_ALL)
3929 /* Only affect good */
3930 if (r_ptr->flags3 & (RF3_GOOD))
3933 if (seen) obvious = TRUE;
3935 /* Learn about type */
3936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3938 note = _("は身震いした。", " shudders.");
3939 note_dies = _("はドロドロに溶けた!", " dissolves!");
3956 case GF_DISP_LIVING:
3958 if (r_ptr->flagsr & RFR_RES_ALL)
3964 /* Only affect non-undead */
3965 if (monster_living(r_ptr))
3968 if (seen) obvious = TRUE;
3970 note = _("は身震いした。", " shudders.");
3971 note_dies = _("はドロドロに溶けた!", " dissolves!");
3990 if (r_ptr->flagsr & RFR_RES_ALL)
3996 /* Only affect demons */
3997 if (r_ptr->flags3 & (RF3_DEMON))
4000 if (seen) obvious = TRUE;
4002 /* Learn about type */
4003 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4005 note = _("は身震いした。", " shudders.");
4006 note_dies = _("はドロドロに溶けた!", " dissolves!");
4022 /* Dispel monster */
4025 if (r_ptr->flagsr & RFR_RES_ALL)
4032 if (seen) obvious = TRUE;
4034 note = _("は身震いした。", " shudders.");
4035 note_dies = _("はドロドロに溶けた!", " dissolves!");
4042 if (seen) obvious = TRUE;
4044 if (r_ptr->flagsr & RFR_RES_ALL)
4046 note = _("には完全な耐性がある!", " is immune.");
4048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4052 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4056 /* Heal the monster */
4057 if (caster_ptr->hp < caster_ptr->maxhp)
4060 caster_ptr->hp += dam;
4061 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4063 /* Redraw (later) if needed */
4064 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4065 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4067 /* Special message */
4070 /* Get the monster name */
4071 monster_desc(killer, caster_ptr, 0);
4072 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4078 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4079 (void)hp_player(dam);
4084 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4093 if (seen) obvious = TRUE;
4094 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4096 if (r_ptr->flagsr & RFR_RES_ALL)
4098 note = _("には完全な耐性がある!", " is immune.");
4100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4104 /* Attempt a saving throw */
4105 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4106 (r_ptr->flags3 & RF3_NO_CONF) ||
4107 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4109 /* Memorize a flag */
4110 if (r_ptr->flags3 & (RF3_NO_CONF))
4112 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4114 note = _("には効果がなかった。", " is unaffected.");
4117 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4119 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4120 note = _("には完全な耐性がある!", " is immune.");
4123 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4126 note = _("には耐性がある。", " resists.");
4131 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4132 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4134 if (who > 0) do_conf = randint0(4) + 4;
4135 else do_conf = randint0(8) + 8;
4141 case GF_BRAIN_SMASH:
4143 if (seen) obvious = TRUE;
4144 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4146 if (r_ptr->flagsr & RFR_RES_ALL)
4148 note = _("には完全な耐性がある!", " is immune.");
4150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4154 /* Attempt a saving throw */
4155 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4156 (r_ptr->flags3 & RF3_NO_CONF) ||
4157 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4159 /* Memorize a flag */
4160 if (r_ptr->flags3 & (RF3_NO_CONF))
4162 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4164 note = _("には効果がなかった。", " is unaffected.");
4167 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4170 note = _("には完全な耐性がある!", " is immune.");
4173 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4176 note = _("には耐性がある!", " resists!");
4181 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4182 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4186 do_conf = randint0(4) + 4;
4187 do_stun = randint0(4) + 4;
4191 do_conf = randint0(8) + 8;
4192 do_stun = randint0(8) + 8;
4194 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4202 if (seen) obvious = TRUE;
4203 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4205 if (r_ptr->flagsr & RFR_RES_ALL)
4207 note = _("には完全な耐性がある!", " is immune.");
4209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4213 /* Attempt a saving throw */
4214 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4216 note = _("には効果がなかった。", " is unaffected.");
4225 if (seen) obvious = TRUE;
4226 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4228 if (r_ptr->flagsr & RFR_RES_ALL)
4230 note = _("には完全な耐性がある!", " is immune.");
4232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4236 /* Attempt a saving throw */
4237 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4239 note = _("には効果がなかった。", " is unaffected.");
4248 if (seen) obvious = TRUE;
4249 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4251 if (r_ptr->flagsr & RFR_RES_ALL)
4253 note = _("には完全な耐性がある!", " is immune.");
4255 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4259 /* Attempt a saving throw */
4260 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4262 note = _("には効果がなかった。", " is unaffected.");
4271 if (seen) obvious = TRUE;
4273 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4274 "You point at %s, screaming the word, 'DIE!'."), m_name);
4276 if (r_ptr->flagsr & RFR_RES_ALL)
4278 note = _("には完全な耐性がある!", " is immune.");
4280 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4284 /* Attempt a saving throw */
4285 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4287 note = _("には効果がなかった。", " is unaffected.");
4296 if (seen) obvious = TRUE;
4298 if (r_ptr->flagsr & RFR_RES_ALL)
4300 note = _("には完全な耐性がある!", " is immune.");
4302 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4306 if (r_ptr->flags1 & RF1_UNIQUE)
4308 note = _("には効果がなかった。", " is unaffected.");
4313 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4314 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4316 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4318 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4322 note = _("は耐性を持っている!", "resists!");
4329 /* Capture monster */
4333 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4334 (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)
4336 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4341 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4342 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4343 nokori_hp = m_ptr->maxhp * 3 / 10;
4345 nokori_hp = m_ptr->maxhp * 3 / 20;
4347 if (m_ptr->hp >= nokori_hp)
4349 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4352 else if (m_ptr->hp < randint0(nokori_hp))
4354 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4355 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4356 cap_mon = m_ptr->r_idx;
4357 cap_mspeed = m_ptr->mspeed;
4359 cap_maxhp = m_ptr->max_maxhp;
4360 cap_nickname = m_ptr->nickname; /* Quark transfer */
4361 if (c_ptr->m_idx == p_ptr->riding)
4363 if (rakuba(-1, FALSE))
4365 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4369 delete_monster_idx(c_ptr->m_idx);
4375 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4381 /* Attack (Use "dam" as attack type) */
4384 /* Return this monster's death */
4385 return py_attack(y, x, dam);
4388 /* Sleep (Use "dam" as "power") */
4394 if (seen) obvious = TRUE;
4396 if (r_ptr->flagsr & RFR_RES_ALL)
4398 note = _("には効果がなかった。", " is unaffected.");
4400 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4403 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4405 note = _("には効果がなかった。", " is unaffected.");
4408 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4411 if (MON_CSLEEP(m_ptr))
4413 note = _("には効果がなかった。", " is unaffected.");
4419 if (one_in_(5)) effect = 1;
4420 else if (one_in_(4)) effect = 2;
4421 else if (one_in_(3)) effect = 3;
4426 /* Powerful monsters can resist */
4427 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4428 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4430 note = _("には効果がなかった。", " is unaffected.");
4434 /* Normal monsters slow down */
4437 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4439 note = _("の動きが遅くなった。", " starts moving slower.");
4444 else if (effect == 2)
4446 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4448 /* Attempt a saving throw */
4449 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4450 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4455 /* No obvious effect */
4456 note = _("には効果がなかった。", " is unaffected.");
4461 else if (effect == 3)
4463 /* Attempt a saving throw */
4464 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4465 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4466 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4468 /* Memorize a flag */
4469 if (r_ptr->flags3 & RF3_NO_SLEEP)
4471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4474 /* No obvious effect */
4475 note = _("には効果がなかった。", " is unaffected.");
4480 /* Go to sleep (much) later */
4481 note = _("は眠り込んでしまった!", " falls asleep!");
4488 note = _("には効果がなかった。", " is unaffected.");
4491 /* No "real" damage */
4499 if (seen) obvious = TRUE;
4501 if (r_ptr->flagsr & RFR_RES_ALL)
4503 note = _("には効果がなかった。", " is unaffected.");
4505 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4509 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4511 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4512 chg_virtue(V_VITALITY, -1);
4522 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4524 if (r_ptr->flags3 & (RF3_HURT_LITE))
4526 /* Obvious effect */
4527 if (seen) obvious = TRUE;
4529 /* Memorize the effects */
4530 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4532 /* Special effect */
4533 note = _("は光に身をすくめた!", " cringes from the light!");
4534 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4537 /* Normally no damage */
4544 photo = m_ptr->r_idx;
4551 case GF_BLOOD_CURSE:
4553 if (seen) obvious = TRUE;
4555 if (r_ptr->flagsr & RFR_RES_ALL)
4557 note = _("には完全な耐性がある!", " is immune.");
4559 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4567 bool success = FALSE;
4568 if (seen) obvious = TRUE;
4570 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4572 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4573 if (dam < 1) dam = 1;
4575 /* No need to tame your pet */
4578 note = _("の動きが速くなった。", " starts moving faster.");
4579 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4583 /* Attempt a saving throw */
4584 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4585 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4586 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4587 (p_ptr->cursed & TRC_AGGRAVATE) ||
4588 ((r_ptr->level+10) > randint1(dam)))
4591 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4595 note = _("を支配した。", " is tamed!");
4597 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4599 /* Learn about type */
4600 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4607 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4609 do_fear = randint1(90)+10;
4611 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4614 /* No "real" damage */
4621 if (seen) obvious = TRUE;
4623 if (r_ptr->flagsr & RFR_RES_ALL)
4625 note = _("には完全な耐性がある!", " is immune.");
4627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4631 /* Attempt a saving throw */
4632 if (randint0(100 + dam) < (r_ptr->level + 50))
4634 note = _("には効果がなかった。", " is unaffected.");
4654 /* Absolutely no effect */
4655 if (skipped) return (FALSE);
4657 /* "Unique" monsters cannot be polymorphed */
4658 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4660 /* Quest monsters cannot be polymorphed */
4661 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4663 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4665 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4666 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4668 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4673 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4674 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4677 /* Modify the damage */
4679 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4680 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4682 /* Check for death */
4683 if (dam > m_ptr->hp)
4685 /* Extract method of death */
4690 /* Sound and Impact resisters never stun */
4692 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4693 !(r_ptr->flags3 & RF3_NO_STUN))
4696 if (seen) obvious = TRUE;
4699 if (MON_STUNNED(m_ptr))
4701 note = _("はひどくもうろうとした。", " is more dazed.");
4702 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4706 note = _("はもうろうとした。", " is dazed.");
4711 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4717 /* Confusion and Chaos resisters (and sleepers) never confuse */
4719 !(r_ptr->flags3 & RF3_NO_CONF) &&
4720 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4723 if (seen) obvious = TRUE;
4725 /* Already partially confused */
4726 if (MON_CONFUSED(m_ptr))
4728 note = _("はさらに混乱したようだ。", " looks more confused.");
4729 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4732 /* Was not confused */
4735 note = _("は混乱したようだ。", " looks confused.");
4739 /* Apply confusion */
4740 (void)set_monster_confused(c_ptr->m_idx, tmp);
4749 if (seen) obvious = TRUE;
4751 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4755 note = _("は弱くなったようだ。", " seems weakened.");
4756 m_ptr->maxhp -= do_time;
4757 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4762 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4763 if (do_poly && (randint1(90) > r_ptr->level))
4765 if (polymorph_monster(y, x))
4768 if (seen) obvious = TRUE;
4770 /* Monster polymorphs */
4771 note = _("が変身した!", " changes!");
4773 /* Turn off the damage */
4779 note = _("には効果がなかった。", " is unaffected.");
4782 /* Hack -- Get new monster */
4783 m_ptr = &m_list[c_ptr->m_idx];
4785 /* Hack -- Get new race */
4786 r_ptr = &r_info[m_ptr->r_idx];
4789 /* Handle "teleport" */
4793 if (seen) obvious = TRUE;
4795 note = _("が消え去った!", " disappears!");
4797 if (!who) chg_virtue(V_VALOUR, -1);
4800 teleport_away(c_ptr->m_idx, do_dist,
4801 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4803 /* Hack -- get new location */
4807 /* Hack -- get new grid */
4808 c_ptr = &cave[y][x];
4815 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4822 if (typ == GF_DRAIN_MANA)
4824 /* Drain mana does nothing */
4827 /* If another monster did the damage, hurt the monster by hand */
4830 /* Redraw (later) if needed */
4831 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4832 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4834 /* Wake the monster up */
4835 (void)set_monster_csleep(c_ptr->m_idx, 0);
4837 /* Hurt the monster */
4845 if (is_pet(m_ptr) && !(m_ptr->ml))
4848 /* Give detailed messages if destroyed */
4851 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4854 msg_format("%^s%s", m_name, note);
4862 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4864 /* Generate treasure, etc */
4865 monster_death(c_ptr->m_idx, FALSE);
4867 /* Delete the monster */
4868 delete_monster_idx(c_ptr->m_idx);
4872 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4876 /* Damaged monster */
4879 /* Give detailed messages if visible or destroyed */
4880 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4882 /* Hack -- Pain message */
4885 message_pain(c_ptr->m_idx, dam);
4892 /* Hack -- handle sleep */
4893 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4897 else if (heal_leper)
4899 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4901 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4905 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4906 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4909 delete_monster_idx(c_ptr->m_idx);
4912 /* If the player did it, give him experience, check fear */
4917 /* Hurt the monster, check for fear and death */
4918 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4923 /* Damaged monster */
4926 /* HACK - anger the monster before showing the sleep message */
4927 if (do_sleep) anger_monster(m_ptr);
4929 /* Give detailed messages if visible or destroyed */
4930 if (note && seen_msg)
4931 msg_format(_("%s%s", "%^s%s"), m_name, note);
4933 /* Hack -- Pain message */
4934 else if (known && (dam || !do_fear))
4936 message_pain(c_ptr->m_idx, dam);
4939 /* Anger monsters */
4940 if (((dam > 0) || get_angry) && !do_sleep)
4941 anger_monster(m_ptr);
4944 if ((fear || do_fear) && seen)
4948 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4951 /* Hack -- handle sleep */
4952 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4956 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4958 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4962 switch (randint1(28))
4967 msg_print(_("地面が揺れた...", "The ground trembles..."));
4968 earthquake(ty, tx, 4 + randint0(4));
4969 if (!one_in_(6)) break;
4971 case 3: case 4: case 5: case 6:
4974 int extra_dam = damroll(10, 10);
4975 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4977 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4978 if (!one_in_(6)) break;
4983 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4985 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4986 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4987 if (!one_in_(6)) break;
4989 case 9: case 10: case 11:
4990 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4991 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4992 if (!one_in_(6)) break;
4993 case 12: case 13: case 14: case 15: case 16:
4994 aggravate_monsters(0);
4995 if (!one_in_(6)) break;
4997 count += activate_hi_summon(ty, tx, TRUE);
4998 if (!one_in_(6)) break;
4999 case 19: case 20: case 21: case 22:
5001 bool pet = !one_in_(3);
5002 BIT_FLAGS mode = PM_ALLOW_GROUP;
5004 if (pet) mode |= PM_FORCE_PET;
5005 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5007 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);
5008 if (!one_in_(6)) break;
5010 case 23: case 24: case 25:
5011 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5012 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5014 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5015 else lose_exp(p_ptr->exp / 16);
5016 if (!one_in_(6)) break;
5017 case 26: case 27: case 28:
5026 (void)do_dec_stat(i);
5035 (void)do_dec_stat(randint0(6));
5044 if (p_ptr->inside_battle)
5046 p_ptr->health_who = c_ptr->m_idx;
5047 p_ptr->redraw |= (PR_HEALTH);
5051 /* XXX XXX XXX Verify this code */
5053 /* Update the monster */
5054 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5056 /* Redraw the monster grid */
5060 /* Update monster recall window */
5061 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5063 p_ptr->window |= (PW_MONSTER);
5066 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5070 if (!(flg & PROJECT_NO_HANGEKI))
5072 set_target(m_ptr, monster_target_y, monster_target_x);
5075 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5077 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5081 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5083 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5084 rakubadam_m = (dam > 200) ? 200 : dam;
5093 /* Get local object */
5096 /* Prepare to make a Blade of Chaos */
5097 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5099 q_ptr->pval = photo;
5101 /* Mark the item as fully known */
5102 q_ptr->ident |= (IDENT_MENTAL);
5104 /* Drop it in the dungeon */
5105 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5113 /* Return "Anything seen?" */
5118 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5119 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5120 * @param who_name 効果を起こしたモンスターの名前
5121 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5122 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5123 * @param x 目標X座標 / Target x location (or location to travel "towards")
5124 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5125 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5127 * @param monspell 効果元のモンスター魔法ID
5128 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5130 * Handle a beam/bolt/ball causing damage to the player.
5131 * This routine takes a "source monster" (by index), a "distance", a default
5132 * "damage", and a "damage type". See "project_m()" above.
5133 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5134 * is reduced (see "project_m()" above). This can happen if a monster breathes
5135 * at the player and hits a wall instead.
5136 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5137 * to know if this is actually a ball or a bolt spell
5138 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5139 * we just assume that the effects were obvious, for historical reasons.
5141 static bool project_p(MONSTER_IDX who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5146 /* Hack -- assume obvious */
5147 bool obvious = TRUE;
5149 /* Player blind-ness */
5150 bool blind = (p_ptr->blind ? TRUE : FALSE);
5152 /* Player needs a "description" (he is blind) */
5155 /* Source monster */
5156 monster_type *m_ptr = NULL;
5158 /* Monster name (for attacks) */
5161 /* Monster name (for damage) */
5164 /* Hack -- messages */
5170 /* Player is not here */
5171 if (!player_bold(y, x)) return (FALSE);
5173 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5175 if (kawarimi(TRUE)) return FALSE;
5178 /* Player cannot hurt himself */
5179 if (!who) return (FALSE);
5180 if (who == p_ptr->riding) return (FALSE);
5182 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5185 int max_attempts = 10;
5186 sound(SOUND_REFLECT);
5189 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5190 else if (p_ptr->special_defense & KATA_FUUJIN)
5191 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5193 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5196 /* Choose 'new' target */
5201 t_y = m_list[who].fy - 1 + randint1(3);
5202 t_x = m_list[who].fx - 1 + randint1(3);
5205 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5207 if (max_attempts < 1)
5209 t_y = m_list[who].fy;
5210 t_x = m_list[who].fx;
5215 t_y = p_ptr->y - 1 + randint1(3);
5216 t_x = p_ptr->x - 1 + randint1(3);
5219 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5225 /* Limit maximum damage */
5226 if (dam > 1600) dam = 1600;
5228 /* Reduce damage by distance */
5229 dam = (dam + r) / (r + 1);
5232 /* If the player is blind, be more descriptive */
5233 if (blind) fuzzy = TRUE;
5238 /* Get the source monster */
5239 m_ptr = &m_list[who];
5240 /* Extract the monster level */
5241 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5243 /* Get the monster name */
5244 monster_desc(m_name, m_ptr, 0);
5246 /* Get the monster's real name (gotten before polymorph!) */
5247 strcpy(killer, who_name);
5253 case PROJECT_WHO_UNCTRL_POWER:
5254 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5257 case PROJECT_WHO_GLASS_SHARDS:
5258 strcpy(killer, _("ガラスの破片", "shards of glass"));
5262 strcpy(killer, _("罠", "a trap"));
5267 strcpy(m_name, killer);
5270 /* Analyze the damage */
5273 /* Standard damage -- hurts inventory too */
5276 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5277 get_damage = acid_dam(dam, killer, monspell, FALSE);
5281 /* Standard damage -- hurts inventory too */
5284 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5285 get_damage = fire_dam(dam, killer, monspell, FALSE);
5289 /* Standard damage -- hurts inventory too */
5292 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5293 get_damage = cold_dam(dam, killer, monspell, FALSE);
5297 /* Standard damage -- hurts inventory too */
5300 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5301 get_damage = elec_dam(dam, killer, monspell, FALSE);
5305 /* Standard damage -- also poisons player */
5308 bool double_resist = IS_OPPOSE_POIS();
5309 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5311 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5312 if (double_resist) dam = (dam + 2) / 3;
5314 if ((!(double_resist || p_ptr->resist_pois)) &&
5315 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5320 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5322 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5324 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5329 /* Standard damage -- also poisons / mutates player */
5332 bool double_resist = IS_OPPOSE_POIS();
5333 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5335 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5336 if (double_resist) dam = (2 * dam + 2) / 5;
5337 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5338 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5340 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5342 if (one_in_(5)) /* 6 */
5344 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5345 if (one_in_(4)) /* 4 */
5353 inven_damage(set_acid_destroy, 2);
5359 /* Standard damage */
5362 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5363 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5367 /* Holy Orb -- Player only takes partial damage */
5370 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5371 if (p_ptr->align > 10)
5373 else if (p_ptr->align < -10)
5375 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5381 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5382 if (p_ptr->align > 10)
5384 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5388 /* Arrow -- XXX no dodging */
5393 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5395 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5397 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5400 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5404 /* Plasma -- XXX No resist */
5407 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5408 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5410 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5412 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5413 (void)set_stun(p_ptr->stun + plus_stun);
5416 if (!(p_ptr->resist_fire ||
5418 p_ptr->immune_fire))
5420 inven_damage(set_acid_destroy, 3);
5426 /* Nether -- drain experience */
5429 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5430 if (p_ptr->resist_neth)
5432 if (!prace_is_(RACE_SPECTRE))
5434 dam *= 6; dam /= (randint1(4) + 7);
5437 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5439 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5441 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5443 learn_spell(monspell);
5447 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5453 /* Water -- stun/confuse */
5456 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5457 if (!CHECK_MULTISHADOW())
5459 if (!p_ptr->resist_sound)
5461 set_stun(p_ptr->stun + randint1(40));
5463 if (!p_ptr->resist_conf)
5465 set_confused(p_ptr->confused + randint1(5) + 5);
5470 inven_damage(set_cold_destroy, 3);
5474 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5478 /* Chaos -- many effects */
5481 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5482 if (p_ptr->resist_chaos)
5484 dam *= 6; dam /= (randint1(4) + 7);
5487 if (!CHECK_MULTISHADOW())
5489 if (!p_ptr->resist_conf)
5491 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5493 if (!p_ptr->resist_chaos)
5495 (void)set_image(p_ptr->image + randint1(10));
5498 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5499 (void)gain_random_mutation(0);
5502 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5504 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5507 if (!p_ptr->resist_chaos || one_in_(9))
5509 inven_damage(set_elec_destroy, 2);
5510 inven_damage(set_fire_destroy, 2);
5514 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5518 /* Shards -- mostly cutting */
5521 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5522 if (p_ptr->resist_shard)
5524 dam *= 6; dam /= (randint1(4) + 7);
5526 else if (!CHECK_MULTISHADOW())
5528 (void)set_cut(p_ptr->cut + dam);
5531 if (!p_ptr->resist_shard || one_in_(13))
5533 inven_damage(set_cold_destroy, 2);
5536 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5540 /* Sound -- mostly stunning */
5543 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5544 if (p_ptr->resist_sound)
5546 dam *= 5; dam /= (randint1(4) + 7);
5548 else if (!CHECK_MULTISHADOW())
5550 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5551 (void)set_stun(p_ptr->stun + plus_stun);
5554 if (!p_ptr->resist_sound || one_in_(13))
5556 inven_damage(set_cold_destroy, 2);
5559 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5563 /* Pure confusion */
5566 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5567 if (p_ptr->resist_conf)
5569 dam *= 5; dam /= (randint1(4) + 7);
5571 else if (!CHECK_MULTISHADOW())
5573 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5575 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5579 /* Disenchantment -- see above */
5582 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5583 if (p_ptr->resist_disen)
5585 dam *= 6; dam /= (randint1(4) + 7);
5587 else if (!CHECK_MULTISHADOW())
5589 (void)apply_disenchant(0);
5591 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5595 /* Nexus -- see above */
5598 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5599 if (p_ptr->resist_nexus)
5601 dam *= 6; dam /= (randint1(4) + 7);
5603 else if (!CHECK_MULTISHADOW())
5607 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5611 /* Force -- mostly stun */
5614 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5615 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5617 (void)set_stun(p_ptr->stun + randint1(20));
5619 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5624 /* Rocket -- stun, cut */
5627 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5628 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5630 (void)set_stun(p_ptr->stun + randint1(20));
5633 if (p_ptr->resist_shard)
5637 else if (!CHECK_MULTISHADOW())
5639 (void)set_cut(p_ptr->cut + (dam / 2));
5642 if (!p_ptr->resist_shard || one_in_(12))
5644 inven_damage(set_cold_destroy, 3);
5647 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5651 /* Inertia -- slowness */
5654 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5655 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5656 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5660 /* Lite -- blinding */
5663 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5664 if (p_ptr->resist_lite)
5666 dam *= 4; dam /= (randint1(4) + 7);
5668 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5670 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5673 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5675 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5678 else if (prace_is_(RACE_S_FAIRY))
5683 if (p_ptr->wraith_form) dam *= 2;
5684 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5686 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5688 p_ptr->wraith_form = 0;
5689 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5690 "The light forces you out of your incorporeal shadow form."));
5692 p_ptr->redraw |= PR_MAP;
5693 /* Update monsters */
5694 p_ptr->update |= (PU_MONSTERS);
5695 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5697 /* Redraw status bar */
5698 p_ptr->redraw |= (PR_STATUS);
5705 /* Dark -- blinding */
5708 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5709 if (p_ptr->resist_dark)
5711 dam *= 4; dam /= (randint1(4) + 7);
5713 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5715 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5717 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5719 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5723 /* Time -- bolt fewer effects XXX */
5726 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5727 if (p_ptr->resist_time)
5730 dam /= (randint1(4) + 7);
5731 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5733 else if (!CHECK_MULTISHADOW())
5735 switch (randint1(10))
5737 case 1: case 2: case 3: case 4: case 5:
5739 if (p_ptr->prace == RACE_ANDROID) break;
5740 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5741 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5745 case 6: case 7: case 8: case 9:
5747 switch (randint1(6))
5749 case 1: k = A_STR; act = _("強く", "strong"); break;
5750 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5751 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5752 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5753 case 5: k = A_CON; act = _("健康で", "hale"); break;
5754 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5757 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5758 "You're not as %s as you used to be..."), act);
5760 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5761 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5762 p_ptr->update |= (PU_BONUS);
5768 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5769 "You're not as powerful as you used to be..."));
5771 for (k = 0; k < 6; k++)
5773 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5774 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5776 p_ptr->update |= (PU_BONUS);
5782 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5786 /* Gravity -- stun plus slowness plus teleport */
5789 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5790 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5792 if (!CHECK_MULTISHADOW())
5794 teleport_player(5, TELEPORT_PASSIVE);
5795 if (!p_ptr->levitation)
5796 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5797 if (!(p_ptr->resist_sound || p_ptr->levitation))
5799 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5800 (void)set_stun(p_ptr->stun + plus_stun);
5803 if (p_ptr->levitation)
5805 dam = (dam * 2) / 3;
5808 if (!p_ptr->levitation || one_in_(13))
5810 inven_damage(set_cold_destroy, 2);
5813 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5817 /* Standard damage */
5818 case GF_DISINTEGRATE:
5820 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5822 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5828 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5830 (void)hp_player(dam);
5837 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5838 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5845 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5846 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5852 if (p_ptr->free_act) break;
5853 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5855 if (ironman_nightmare)
5857 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5858 /* Have some nightmares */
5859 sanity_blast(NULL, FALSE);
5862 set_paralyzed(p_ptr->paralyzed + dam);
5872 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5873 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5880 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5881 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5888 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5890 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5891 if (!p_ptr->resist_shard || one_in_(13))
5893 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5894 inven_damage(set_cold_destroy, 2);
5900 /* Ice -- cold plus stun plus cuts */
5903 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5904 get_damage = cold_dam(dam, killer, monspell, FALSE);
5905 if (!CHECK_MULTISHADOW())
5907 if (!p_ptr->resist_shard)
5909 (void)set_cut(p_ptr->cut + damroll(5, 8));
5911 if (!p_ptr->resist_sound)
5913 (void)set_stun(p_ptr->stun + randint1(15));
5916 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5918 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5928 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5930 if (p_ptr->mimic_form)
5932 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5933 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5938 switch (p_ptr->prace)
5940 /* Some races are immune */
5954 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5966 if (CHECK_MULTISHADOW())
5968 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5970 else if (p_ptr->csp)
5974 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5976 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5979 if (dam >= p_ptr->csp)
5983 p_ptr->csp_frac = 0;
5992 learn_spell(monspell);
5995 p_ptr->redraw |= (PR_MANA);
5997 p_ptr->window |= (PW_PLAYER);
5998 p_ptr->window |= (PW_SPELL);
6002 /* Heal the monster */
6003 if (m_ptr->hp < m_ptr->maxhp)
6007 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6009 /* Redraw (later) if needed */
6010 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6011 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6013 /* Special message */
6016 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6029 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6031 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6032 learn_spell(monspell);
6036 if (!CHECK_MULTISHADOW())
6038 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6040 if (!p_ptr->resist_conf)
6042 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6045 if (!p_ptr->resist_chaos && one_in_(3))
6047 (void)set_image(p_ptr->image + randint0(250) + 150);
6054 p_ptr->csp_frac = 0;
6056 p_ptr->redraw |= PR_MANA;
6059 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6065 case GF_BRAIN_SMASH:
6067 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6069 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6070 learn_spell(monspell);
6074 if (!CHECK_MULTISHADOW())
6076 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6082 p_ptr->csp_frac = 0;
6084 p_ptr->redraw |= PR_MANA;
6087 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6088 if (!CHECK_MULTISHADOW())
6090 if (!p_ptr->resist_blind)
6092 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6094 if (!p_ptr->resist_conf)
6096 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6098 if (!p_ptr->free_act)
6100 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6102 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6104 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6105 (void)do_dec_stat(A_INT);
6106 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6107 (void)do_dec_stat(A_WIS);
6109 if (!p_ptr->resist_chaos)
6111 (void)set_image(p_ptr->image + randint0(250) + 150);
6121 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6123 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6124 learn_spell(monspell);
6128 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6129 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6137 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6139 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6140 learn_spell(monspell);
6144 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6145 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6153 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6155 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6156 learn_spell(monspell);
6160 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6161 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6169 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6171 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6172 learn_spell(monspell);
6176 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6177 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6185 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6187 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6188 learn_spell(monspell);
6192 if (!CHECK_MULTISHADOW())
6194 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6195 curse_equipment(40, 20);
6198 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6200 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6215 /* Hex - revenge damage stored */
6216 revenge_store(get_damage);
6218 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6219 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6221 char m_name_self[80];
6224 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6226 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6227 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6228 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6231 if (p_ptr->riding && dam > 0)
6233 rakubadam_p = (dam > 200) ? 200 : dam;
6241 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6243 (void)kawarimi(FALSE);
6246 /* Return "Anything seen?" */
6252 * Find the distance from (x, y) to a line.
6254 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6256 /* Vector from (x, y) to (x1, y1) */
6257 POSITION py = y1 - y;
6258 POSITION px = x1 - x;
6261 POSITION ny = x2 - x1;
6262 POSITION nx = y1 - y2;
6265 POSITION pd = distance(y1, x1, y, x);
6266 POSITION nd = distance(y1, x1, y2, x2);
6268 if (pd > nd) return distance(y, x, y2, x2);
6270 /* Component of P on N */
6271 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6273 /* Absolute value */
6274 return((nd >= 0) ? nd : 0 - nd);
6281 * Modified version of los() for calculation of disintegration balls.
6282 * Disintegration effects are stopped by permanent walls.
6284 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6304 /* Slope, or 1/Slope, of LOS */
6308 /* Extract the offset */
6312 /* Extract the absolute offset */
6317 /* Handle adjacent (or identical) grids */
6318 if ((ax < 2) && (ay < 2)) return (TRUE);
6321 /* Paranoia -- require "safe" origin */
6322 /* if (!in_bounds(y1, x1)) return (FALSE); */
6325 /* Directly South/North */
6328 /* South -- check for walls */
6331 for (ty = y1 + 1; ty < y2; ty++)
6333 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6337 /* North -- check for walls */
6340 for (ty = y1 - 1; ty > y2; ty--)
6342 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6350 /* Directly East/West */
6353 /* East -- check for walls */
6356 for (tx = x1 + 1; tx < x2; tx++)
6358 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6362 /* West -- check for walls */
6365 for (tx = x1 - 1; tx > x2; tx--)
6367 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6376 /* Extract some signs */
6377 sx = (dx < 0) ? -1 : 1;
6378 sy = (dy < 0) ? -1 : 1;
6381 /* Vertical "knights" */
6386 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6390 /* Horizontal "knights" */
6395 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6400 /* Calculate scale factor div 2 */
6403 /* Calculate scale factor */
6407 /* Travel horizontally */
6410 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6416 /* Consider the special case where slope == 1. */
6427 /* Note (below) the case (qy == f2), where */
6428 /* the LOS exactly meets the corner of a tile. */
6431 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6442 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6455 /* Travel vertically */
6458 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6474 /* Note (below) the case (qx == f2), where */
6475 /* the LOS exactly meets the corner of a tile. */
6478 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6489 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6510 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
6515 int brev = rad * rad / dist;
6519 int mdis = distance(y1, x1, y2, x2) + rad;
6521 while (bdis <= mdis)
6525 if ((0 < dist) && (path_n < dist))
6527 POSITION ny = GRID_Y(path_g[path_n]);
6528 POSITION nx = GRID_X(path_g[path_n]);
6529 POSITION nd = distance(ny, nx, y1, x1);
6531 /* Get next base point */
6540 /* Travel from center outward */
6541 for (cdis = 0; cdis <= brad; cdis++)
6543 /* Scan the maximal blast area of radius "cdis" */
6544 for (y = by - cdis; y <= by + cdis; y++)
6546 for (x = bx - cdis; x <= bx + cdis; x++)
6548 /* Ignore "illegal" locations */
6549 if (!in_bounds(y, x)) continue;
6551 /* Enforce a circular "ripple" */
6552 if (distance(y1, x1, y, x) != bdis) continue;
6554 /* Enforce an arc */
6555 if (distance(by, bx, y, x) != cdis) continue;
6561 /* Lights are stopped by opaque terrains */
6562 if (!los(by, bx, y, x)) continue;
6564 case GF_DISINTEGRATE:
6565 /* Disintegration are stopped only by perma-walls */
6566 if (!in_disintegration_range(by, bx, y, x)) continue;
6569 /* Ball explosions are stopped by walls */
6570 if (!projectable(by, bx, y, x)) continue;
6574 /* Save this grid */
6582 /* Encode some more "radius" info */
6583 gm[bdis + 1] = *pgrids;
6585 /* Increase the size */
6586 brad = rad * (path_n + brev) / (dist + brev);
6588 /* Find the next ripple */
6592 /* Store the effect size */
6598 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6599 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6600 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6601 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6602 * @param x 目標X座標 / Target x location (or location to travel "towards")
6603 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6604 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6605 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6606 * @param monspell 効果元のモンスター魔法ID
6607 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6610 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6611 * towards a given location (optionally passing over the heads of interposing
6612 * monsters), and have it do a given amount of damage to the monsters (and
6613 * optionally objects) within the given radius of the final location.
6615 * A "bolt" travels from source to target and affects only the target grid.
6616 * A "beam" travels from source to target, affecting all grids passed through.
6617 * A "ball" travels from source to the target, exploding at the target, and
6618 * affecting everything within the given radius of the target location.
6620 * Traditionally, a "bolt" does not affect anything on the ground, and does
6621 * not pass over the heads of interposing monsters, much like a traditional
6622 * missile, and will "stop" abruptly at the "target" even if no monster is
6623 * positioned there, while a "ball", on the other hand, passes over the heads
6624 * of monsters between the source and target, and affects everything except
6625 * the source monster which lies within the final radius, while a "beam"
6626 * affects every monster between the source and target, except for the casting
6627 * monster (or player), and rarely affects things on the ground.
6629 * Two special flags allow us to use this function in special ways, the
6630 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6631 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6632 * actually projecting from the source monster (or player).
6634 * The player will only get "experience" for monsters killed by himself
6635 * Unique monsters can only be destroyed by attacks from the player
6637 * Only 256 grids can be affected per projection, limiting the effective
6638 * "radius" of standard ball attacks to nine units (diameter nineteen).
6640 * One can project in a given "direction" by combining PROJECT_THRU with small
6641 * offsets to the initial location (see "line_spell()"), or by calculating
6642 * "virtual targets" far away from the player.
6644 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6645 * continuing until it actually hits somethings (useful for "stone to mud").
6647 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6649 * Balls must explode BEFORE hitting walls, or they would affect monsters
6650 * on both sides of a wall. Some bug reports indicate that this is still
6651 * happening in 2.7.8 for Windows, though it appears to be impossible.
6653 * We "pre-calculate" the blast area only in part for efficiency.
6654 * More importantly, this lets us do "explosions" from the "inside" out.
6655 * This results in a more logical distribution of "blast" treasure.
6656 * It also produces a better (in my opinion) animation of the explosion.
6657 * It could be (but is not) used to have the treasure dropped by monsters
6658 * in the middle of the explosion fall "outwards", and then be damaged by
6659 * the blast as it spreads outwards towards the treasure drop location.
6661 * Walls and doors are included in the blast area, so that they can be
6662 * "burned" or "melted" in later versions.
6664 * This algorithm is intended to maximize simplicity, not necessarily
6665 * efficiency, since this function is not a bottleneck in the code.
6667 * We apply the blast effect from ground zero outwards, in several passes,
6668 * first affecting features, then objects, then monsters, then the player.
6669 * This allows walls to be removed before checking the object or monster
6670 * in the wall, and protects objects which are dropped by monsters killed
6671 * in the blast, and allows the player to see all affects before he is
6672 * killed or teleported away. The semantics of this method are open to
6673 * various interpretations, but they seem to work well in practice.
6675 * We process the blast area from ground-zero outwards to allow for better
6676 * distribution of treasure dropped by monsters, and because it provides a
6677 * pleasing visual effect at low cost.
6679 * Note that the damage done by "ball" explosions decreases with distance.
6680 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6682 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6683 * the target, and then the damage "flows" along this beam of destruction.
6684 * The damage at every grid is the same as at the "center" of a "ball"
6685 * explosion, since the "beam" grids are treated as if they ARE at the
6686 * center of a "ball" explosion.
6688 * Currently, specifying "beam" plus "ball" means that locations which are
6689 * covered by the initial "beam", and also covered by the final "ball", except
6690 * for the final grid (the epicenter of the ball), will be "hit twice", once
6691 * by the initial beam, and once by the exploding ball. For the grid right
6692 * next to the epicenter, this results in 150% damage being done. The center
6693 * does not have this problem, for the same reason the final grid in a "beam"
6694 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6695 * grids which are covered by the "ball" will NOT work, as then they will
6696 * receive LESS damage than they should. Do not combine "beam" with "ball".
6698 * The array "gy[],gx[]" with current size "grids" is used to hold the
6699 * collected locations of all grids in the "blast area" plus "beam path".
6701 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6702 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6703 * first blast grid (see above) with radius "N" from the blast center. Note
6704 * that only the first gm[1] grids in the blast area thus take full damage.
6705 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6706 * number of blast grids.
6708 * Note that once the projection is complete, (y2,x2) holds the final location
6709 * of bolts/beams, and the "epicenter" of balls.
6711 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6712 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6713 * implementation of the "distance" function. Also, a bolt can be properly
6714 * viewed as a "ball" with a "rad" of "zero".
6716 * Note that if no "target" is reached before the beam/bolt/ball travels the
6717 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6718 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6720 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6721 * to move from point A to point B, even if the player cannot see part of the
6722 * projection path. Note that in general, the player will *always* see part
6723 * of the path, since it either starts at the player or ends on the player.
6725 * Hack -- we assume that every "projection" is "self-illuminating".
6727 * Hack -- when only a single monster is affected, we automatically track
6728 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6730 * Note that all projections now "explode" at their final destination, even
6731 * if they were being projected at a more distant destination. This means
6732 * that "ball" spells will *always* explode.
6734 * Note that we must call "handle_stuff()" after affecting terrain features
6735 * in the blast radius, in case the "illumination" of the grid was changed,
6736 * and "update_view()" and "update_monsters()" need to be called.
6739 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6749 POSITION y_saver, x_saver; /* For reflecting monsters */
6751 int msec = delay_factor * delay_factor * delay_factor;
6753 /* Assume the player sees nothing */
6754 bool notice = FALSE;
6756 /* Assume the player has seen nothing */
6757 bool visual = FALSE;
6759 /* Assume the player has seen no blast grids */
6762 /* Assume to be a normal ball spell */
6763 bool breath = FALSE;
6765 /* Is the player blind? */
6766 bool blind = (p_ptr->blind ? TRUE : FALSE);
6768 bool old_hide = FALSE;
6770 /* Number of grids in the "path" */
6773 /* Actual grids in the "path" */
6776 /* Number of grids in the "blast area" (including the "beam" path) */
6779 /* Coordinates of the affected grids */
6780 POSITION gx[1024], gy[1024];
6782 /* Encoded "radius" info (see above) */
6785 /* Actual radius encoded in gm[] */
6786 POSITION gm_rad = rad;
6790 /* Attacker's name (prepared before polymorph)*/
6793 /* Can the player see the source of this effect? */
6794 bool see_s_msg = TRUE;
6796 /* Initialize by null string */
6802 /* Default target of monsterspell is player */
6803 monster_target_y = p_ptr->y;
6804 monster_target_x = p_ptr->x;
6806 /* Hack -- Jump to target */
6807 if (flg & (PROJECT_JUMP))
6812 /* Clear the flag */
6813 flg &= ~(PROJECT_JUMP);
6818 /* Start at player */
6825 /* Start at monster */
6828 x1 = m_list[who].fx;
6829 y1 = m_list[who].fy;
6830 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6843 /* Default "destination" */
6848 /* Hack -- verify stuff */
6849 if (flg & (PROJECT_THRU))
6851 if ((x1 == x2) && (y1 == y2))
6853 flg &= ~(PROJECT_THRU);
6857 /* Handle a breath attack */
6862 if (flg & PROJECT_HIDE) old_hide = TRUE;
6863 flg |= PROJECT_HIDE;
6867 /* Hack -- Assume there will be no blast (max radius 32) */
6868 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6876 /* Collect beam grids */
6877 if (flg & (PROJECT_BEAM))
6888 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6890 case GF_DISINTEGRATE:
6891 flg |= (PROJECT_GRID);
6892 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6896 /* Calculate the projection path */
6898 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6900 /* Hack -- Handle stuff */
6903 /* Giga-Hack SEEKER & SUPER_RAY */
6905 if( typ == GF_SEEKER )
6915 for (i = 0; i < path_n; ++i)
6920 int ny = GRID_Y(path_g[i]);
6921 int nx = GRID_X(path_g[i]);
6932 /* Only do visuals if requested */
6933 if (!blind && !(flg & (PROJECT_HIDE)))
6935 /* Only do visuals if the player can "see" the bolt */
6936 if (panel_contains(y, x) && player_has_los_bold(y, x))
6943 /* Obtain the bolt pict */
6944 p = bolt_pict(oy, ox, y, x, typ);
6946 /* Extract attr/char */
6950 /* Visual effects */
6951 print_rel(c, a, y, x);
6952 move_cursor_relative(y, x);
6953 /*if (fresh_before)*/ Term_fresh();
6954 Term_xtra(TERM_XTRA_DELAY, msec);
6956 /*if (fresh_before)*/ Term_fresh();
6958 /* Display "beam" grids */
6959 if (flg & (PROJECT_BEAM))
6961 /* Obtain the explosion pict */
6962 p = bolt_pict(y, x, y, x, typ);
6964 /* Extract attr/char */
6968 /* Visual effects */
6969 print_rel(c, a, y, x);
6972 /* Hack -- Activate delay */
6976 /* Hack -- delay anyway for consistency */
6979 /* Delay for consistency */
6980 Term_xtra(TERM_XTRA_DELAY, msec);
6983 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6984 if( is_mirror_grid(&cave[y][x]))
6986 /* The target of monsterspell becomes tha mirror(broken) */
6987 monster_target_y=(s16b)y;
6988 monster_target_x=(s16b)x;
6990 remove_mirror(y, x);
6991 next_mirror(&oy, &ox, y, x);
6993 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6994 for(j = last_i; j <= i; j++)
6996 y = GRID_Y(path_g[j]);
6997 x = GRID_X(path_g[j]);
6998 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6999 if(!who && (project_m_n==1) && !jump ){
7000 if(cave[project_m_y][project_m_x].m_idx >0 ){
7001 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7005 /* Hack -- auto-recall */
7006 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7008 /* Hack - auto-track */
7009 health_track(cave[project_m_y][project_m_x].m_idx);
7013 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7018 for(i = last_i ; i < path_n ; i++)
7021 py = GRID_Y(path_g[i]);
7022 px = GRID_X(path_g[i]);
7023 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7025 if(!who && (project_m_n==1) && !jump ){
7026 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, py, px, dam, GF_SEEKER);
7044 else if(typ == GF_SUPER_RAY){
7046 int second_step = 0;
7053 for (i = 0; i < path_n; ++i)
7058 int ny = GRID_Y(path_g[i]);
7059 int nx = GRID_X(path_g[i]);
7070 /* Only do visuals if requested */
7071 if (!blind && !(flg & (PROJECT_HIDE)))
7073 /* Only do visuals if the player can "see" the bolt */
7074 if (panel_contains(y, x) && player_has_los_bold(y, x))
7081 /* Obtain the bolt pict */
7082 p = bolt_pict(oy, ox, y, x, typ);
7084 /* Extract attr/char */
7088 /* Visual effects */
7089 print_rel(c, a, y, x);
7090 move_cursor_relative(y, x);
7091 /*if (fresh_before)*/ Term_fresh();
7092 Term_xtra(TERM_XTRA_DELAY, msec);
7094 /*if (fresh_before)*/ Term_fresh();
7096 /* Display "beam" grids */
7097 if (flg & (PROJECT_BEAM))
7099 /* Obtain the explosion pict */
7100 p = bolt_pict(y, x, y, x, typ);
7102 /* Extract attr/char */
7106 /* Visual effects */
7107 print_rel(c, a, y, x);
7110 /* Hack -- Activate delay */
7114 /* Hack -- delay anyway for consistency */
7117 /* Delay for consistency */
7118 Term_xtra(TERM_XTRA_DELAY, msec);
7121 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7122 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7124 if( second_step )continue;
7127 if( is_mirror_grid(&cave[y][x]) && !second_step )
7129 /* The target of monsterspell becomes tha mirror(broken) */
7130 monster_target_y=(s16b)y;
7131 monster_target_x=(s16b)x;
7134 for( j = 0; j <=i ; j++ )
7136 y = GRID_Y(path_g[j]);
7137 x = GRID_X(path_g[j]);
7138 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7142 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7143 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7144 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7145 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7146 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7147 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7148 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7149 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7152 for( i = 0; i < path_n ; i++ )
7155 py = GRID_Y(path_g[i]);
7156 px = GRID_X(path_g[i]);
7157 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7158 if(!who && (project_m_n == 1) && !jump){
7159 if(cave[project_m_y][project_m_x].m_idx >0 ){
7160 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7164 /* Hack -- auto-recall */
7165 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7167 /* Hack - auto-track */
7168 health_track(cave[project_m_y][project_m_x].m_idx);
7172 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7177 /* Project along the path */
7178 for (i = 0; i < path_n; ++i)
7183 int ny = GRID_Y(path_g[i]);
7184 int nx = GRID_X(path_g[i]);
7186 if (flg & PROJECT_DISI)
7188 /* Hack -- Balls explode before reaching walls */
7189 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7191 else if (flg & PROJECT_LOS)
7193 /* Hack -- Balls explode before reaching walls */
7194 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7198 /* Hack -- Balls explode before reaching walls */
7199 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7206 /* Collect beam grids */
7207 if (flg & (PROJECT_BEAM))
7214 /* Only do visuals if requested */
7215 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7217 /* Only do visuals if the player can "see" the bolt */
7218 if (panel_contains(y, x) && player_has_los_bold(y, x))
7225 /* Obtain the bolt pict */
7226 p = bolt_pict(oy, ox, y, x, typ);
7228 /* Extract attr/char */
7232 /* Visual effects */
7233 print_rel(c, a, y, x);
7234 move_cursor_relative(y, x);
7235 /*if (fresh_before)*/ Term_fresh();
7236 Term_xtra(TERM_XTRA_DELAY, msec);
7238 /*if (fresh_before)*/ Term_fresh();
7240 /* Display "beam" grids */
7241 if (flg & (PROJECT_BEAM))
7243 /* Obtain the explosion pict */
7244 p = bolt_pict(y, x, y, x, typ);
7246 /* Extract attr/char */
7250 /* Visual effects */
7251 print_rel(c, a, y, x);
7254 /* Hack -- Activate delay */
7258 /* Hack -- delay anyway for consistency */
7261 /* Delay for consistency */
7262 Term_xtra(TERM_XTRA_DELAY, msec);
7269 /* Save the "blast epicenter" */
7273 if (breath && !path_n)
7279 flg &= ~(PROJECT_HIDE);
7283 /* Start the "explosion" */
7286 /* Hack -- make sure beams get to "explode" */
7294 /* If we found a "target", explode there */
7295 if (dist <= MAX_RANGE)
7297 /* Mega-Hack -- remove the final "beam" grid */
7298 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7301 * Create a conical breath attack
7312 flg &= ~(PROJECT_HIDE);
7314 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7318 /* Determine the blast area, work from the inside out */
7319 for (dist = 0; dist <= rad; dist++)
7321 /* Scan the maximal blast area of radius "dist" */
7322 for (y = by - dist; y <= by + dist; y++)
7324 for (x = bx - dist; x <= bx + dist; x++)
7326 /* Ignore "illegal" locations */
7327 if (!in_bounds2(y, x)) continue;
7329 /* Enforce a "circular" explosion */
7330 if (distance(by, bx, y, x) != dist) continue;
7336 /* Lights are stopped by opaque terrains */
7337 if (!los(by, bx, y, x)) continue;
7339 case GF_DISINTEGRATE:
7340 /* Disintegration are stopped only by perma-walls */
7341 if (!in_disintegration_range(by, bx, y, x)) continue;
7344 /* Ball explosions are stopped by walls */
7345 if (!projectable(by, bx, y, x)) continue;
7349 /* Save this grid */
7356 /* Encode some more "radius" info */
7362 /* Speed -- ignore "non-explosions" */
7363 if (!grids) return (FALSE);
7366 /* Display the "blast area" if requested */
7367 if (!blind && !(flg & (PROJECT_HIDE)))
7369 /* Then do the "blast", from inside out */
7370 for (t = 0; t <= gm_rad; t++)
7372 /* Dump everything with this radius */
7373 for (i = gm[t]; i < gm[t+1]; i++)
7375 /* Extract the location */
7379 /* Only do visuals if the player can "see" the blast */
7380 if (panel_contains(y, x) && player_has_los_bold(y, x))
7389 /* Obtain the explosion pict */
7390 p = bolt_pict(y, x, y, x, typ);
7392 /* Extract attr/char */
7396 /* Visual effects -- Display */
7397 print_rel(c, a, y, x);
7401 /* Hack -- center the cursor */
7402 move_cursor_relative(by, bx);
7404 /* Flush each "radius" seperately */
7405 /*if (fresh_before)*/ Term_fresh();
7407 /* Delay (efficiently) */
7408 if (visual || drawn)
7410 Term_xtra(TERM_XTRA_DELAY, msec);
7414 /* Flush the erasing */
7417 /* Erase the explosion drawn above */
7418 for (i = 0; i < grids; i++)
7420 /* Extract the location */
7424 /* Hack -- Erase if needed */
7425 if (panel_contains(y, x) && player_has_los_bold(y, x))
7431 /* Hack -- center the cursor */
7432 move_cursor_relative(by, bx);
7434 /* Flush the explosion */
7435 /*if (fresh_before)*/ Term_fresh();
7440 /* Update stuff if needed */
7441 if (p_ptr->update) update_stuff();
7444 if (flg & PROJECT_KILL)
7446 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7447 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7451 /* Check features */
7452 if (flg & (PROJECT_GRID))
7454 /* Start with "dist" of zero */
7457 /* Scan for features */
7458 for (i = 0; i < grids; i++)
7460 /* Hack -- Notice new "dist" values */
7461 if (gm[dist+1] == i) dist++;
7463 /* Get the grid location */
7467 /* Find the closest point in the blast */
7470 int d = dist_to_line(y, x, y1, x1, by, bx);
7472 /* Affect the grid */
7473 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7477 /* Affect the grid */
7478 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7483 /* Update stuff if needed */
7484 if (p_ptr->update) update_stuff();
7487 if (flg & (PROJECT_ITEM))
7489 /* Start with "dist" of zero */
7492 /* Scan for objects */
7493 for (i = 0; i < grids; i++)
7495 /* Hack -- Notice new "dist" values */
7496 if (gm[dist+1] == i) dist++;
7498 /* Get the grid location */
7502 /* Find the closest point in the blast */
7505 int d = dist_to_line(y, x, y1, x1, by, bx);
7507 /* Affect the object in the grid */
7508 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7512 /* Affect the object in the grid */
7513 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7519 /* Check monsters */
7520 if (flg & (PROJECT_KILL))
7527 /* Start with "dist" of zero */
7530 /* Scan for monsters */
7531 for (i = 0; i < grids; i++)
7535 /* Hack -- Notice new "dist" values */
7536 if (gm[dist + 1] == i) dist++;
7538 /* Get the grid location */
7542 /* A single bolt may be reflected */
7545 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7546 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7548 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7549 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7550 (!who || dist_hack > 1) && !one_in_(10))
7553 int max_attempts = 10;
7555 /* Choose 'new' target */
7558 t_y = y_saver - 1 + randint1(3);
7559 t_x = x_saver - 1 + randint1(3);
7562 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7564 if (max_attempts < 1)
7570 sound(SOUND_REFLECT);
7573 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7574 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7575 else if (m_ptr->r_idx == MON_DIO)
7576 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7578 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7580 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7582 /* Reflected bolts randomly target either one */
7583 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7584 else flg |= PROJECT_PLAYER;
7586 /* The bolt is reflected */
7587 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7589 /* Don't affect the monster any longer */
7595 /* Find the closest point in the blast */
7598 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7602 effective_dist = dist;
7606 /* There is the riding player on this monster */
7607 if (p_ptr->riding && player_bold(y, x))
7609 /* Aimed on the player */
7610 if (flg & PROJECT_PLAYER)
7612 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7615 * A beam or bolt is well aimed
7617 * So don't affects the mount.
7624 * The spell is not well aimed,
7625 * So partly affect the mount too.
7632 * This grid is the original target.
7633 * Or aimed on your horse.
7635 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7637 /* Hit the mount with full damage */
7641 * Otherwise this grid is not the
7642 * original target, it means that line
7643 * of fire is obstructed by this
7647 * A beam or bolt will hit either
7648 * player or mount. Choose randomly.
7650 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7654 /* Hit the mount with full damage */
7658 /* Hit the player later */
7659 flg |= PROJECT_PLAYER;
7661 /* Don't affect the mount */
7667 * The spell is not well aimed, so
7668 * partly affect both player and
7677 /* Affect the monster in the grid */
7678 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7682 /* Player affected one monster (without "jumping") */
7683 if (!who && (project_m_n == 1) && !jump)
7688 /* Track if possible */
7689 if (cave[y][x].m_idx > 0)
7691 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7695 /* Hack -- auto-recall */
7696 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7698 /* Hack - auto-track */
7699 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7707 if (flg & (PROJECT_KILL))
7709 /* Start with "dist" of zero */
7712 /* Scan for player */
7713 for (i = 0; i < grids; i++)
7717 /* Hack -- Notice new "dist" values */
7718 if (gm[dist+1] == i) dist++;
7720 /* Get the grid location */
7724 /* Affect the player? */
7725 if (!player_bold(y, x)) continue;
7727 /* Find the closest point in the blast */
7730 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7734 effective_dist = dist;
7737 /* Target may be your horse */
7740 /* Aimed on the player */
7741 if (flg & PROJECT_PLAYER)
7743 /* Hit the player with full damage */
7747 * Hack -- When this grid was not the
7748 * original target, a beam or bolt
7749 * would hit either player or mount,
7750 * and should be choosen randomly.
7752 * But already choosen to hit the
7753 * mount at this point.
7755 * Or aimed on your horse.
7757 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7760 * A beam or bolt is well aimed
7762 * So don't affects the player.
7769 * The spell is not well aimed,
7770 * So partly affect the player too.
7776 /* Affect the player */
7777 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7785 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7787 if (rakubadam_m > 0)
7789 if (rakuba(rakubadam_m, FALSE))
7791 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7794 if (p_ptr->riding && rakubadam_p > 0)
7796 if(rakuba(rakubadam_p, FALSE))
7798 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7803 /* Return "something was noticed" */
7808 * @brief 鏡魔法「封魔結界」の効果処理
7810 * @return 効果があったらTRUEを返す
7812 bool binding_field(HIT_POINT dam)
7814 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7815 int mirror_num = 0; /* 鏡の数 */
7817 POSITION centersign;
7818 POSITION x1, x2, y1, y2;
7820 int msec = delay_factor*delay_factor*delay_factor;
7823 POSITION point_x[3];
7824 POSITION point_y[3];
7826 /* Default target of monsterspell is player */
7827 monster_target_y = p_ptr->y;
7828 monster_target_x = p_ptr->x;
7830 for (x = 0; x < cur_wid; x++)
7832 for (y = 0; y < cur_hgt; y++)
7834 if (is_mirror_grid(&cave[y][x]) &&
7835 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7836 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7837 player_has_los_bold(y, x) &&
7838 projectable(p_ptr->y, p_ptr->x, y, x)
7840 mirror_y[mirror_num] = y;
7841 mirror_x[mirror_num] = x;
7847 if (mirror_num < 2)return FALSE;
7849 point_x[0] = randint0(mirror_num);
7851 point_x[1] = randint0(mirror_num);
7852 } while (point_x[0] == point_x[1]);
7854 point_y[0] = mirror_y[point_x[0]];
7855 point_x[0] = mirror_x[point_x[0]];
7856 point_y[1] = mirror_y[point_x[1]];
7857 point_x[1] = mirror_x[point_x[1]];
7858 point_y[2] = p_ptr->y;
7859 point_x[2] = p_ptr->x;
7861 x = point_x[0] + point_x[1] + point_x[2];
7862 y = point_y[0] + point_y[1] + point_y[2];
7864 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7865 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7866 if (centersign == 0)return FALSE;
7868 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7869 x1 = x1 < point_x[2] ? x1 : point_x[2];
7870 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7871 y1 = y1 < point_y[2] ? y1 : point_y[2];
7873 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7874 x2 = x2 > point_x[2] ? x2 : point_x[2];
7875 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7876 y2 = y2 > point_y[2] ? y2 : point_y[2];
7878 for (y = y1; y <= y2; y++) {
7879 for (x = x1; x <= x2; x++) {
7880 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7881 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7882 centersign*((point_x[1] - x)*(point_y[2] - y)
7883 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7884 centersign*((point_x[2] - x)*(point_y[0] - y)
7885 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7887 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7888 /* Visual effects */
7890 && panel_contains(y, x)) {
7891 p = bolt_pict(y, x, y, x, GF_MANA);
7892 print_rel(PICT_C(p), PICT_A(p), y, x);
7893 move_cursor_relative(y, x);
7894 /*if (fresh_before)*/ Term_fresh();
7895 Term_xtra(TERM_XTRA_DELAY, msec);
7901 for (y = y1; y <= y2; y++) {
7902 for (x = x1; x <= x2; x++) {
7903 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7904 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7905 centersign*((point_x[1] - x)*(point_y[2] - y)
7906 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7907 centersign*((point_x[2] - x)*(point_y[0] - y)
7908 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7910 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7911 (void)project_f(0, 0, y, x, dam, GF_MANA);
7916 for (y = y1; y <= y2; y++) {
7917 for (x = x1; x <= x2; x++) {
7918 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7919 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7920 centersign*((point_x[1] - x)*(point_y[2] - y)
7921 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7922 centersign*((point_x[2] - x)*(point_y[0] - y)
7923 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7925 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7926 (void)project_o(0, 0, y, x, dam, GF_MANA);
7931 for (y = y1; y <= y2; y++) {
7932 for (x = x1; x <= x2; x++) {
7933 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7934 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7935 centersign*((point_x[1] - x)*(point_y[2] - y)
7936 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7937 centersign*((point_x[2] - x)*(point_y[0] - y)
7938 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7940 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7941 (void)project_m(0, 0, y, x, dam, GF_MANA,
7942 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7948 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7949 remove_mirror(point_y[0], point_x[0]);
7956 * @brief 鏡魔法「鏡の封印」の効果処理
7958 * @return 効果があったらTRUEを返す
7960 void seal_of_mirror(HIT_POINT dam)
7964 for (x = 0; x < cur_wid; x++)
7966 for (y = 0; y < cur_hgt; y++)
7968 if (is_mirror_grid(&cave[y][x]))
7970 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7971 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7973 if (!cave[y][x].m_idx)
7975 remove_mirror(y, x);