3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
19 #include "monsterrace-hook.h"
23 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
24 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
26 int project_length = 0; /*!< 投射の射程距離 */
30 * @brief モンスター魅了用セービングスロー共通部(汎用系)
32 * @param m_ptr 対象モンスター
33 * @return 魅了に抵抗したらTRUE
35 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
37 monster_race *r_ptr = &r_info[m_ptr->r_idx];
39 if(p_ptr->inside_arena) return TRUE;
42 if (r_ptr->flagsr & RFR_RES_ALL)
44 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
48 if (r_ptr->flags3 & RF3_NO_CONF)
50 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
54 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
56 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
57 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
58 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
62 * @brief モンスター服従用セービングスロー共通部(部族依存系)
64 * @param m_ptr 対象モンスター
65 * @return 服従に抵抗したらTRUE
67 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
69 monster_race *r_ptr = &r_info[m_ptr->r_idx];
71 if (p_ptr->inside_arena) return TRUE;
74 if (r_ptr->flagsr & RFR_RES_ALL)
76 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
80 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
82 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
83 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
84 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
88 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
91 * ハードコーティングによる実装が行われている。
92 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
94 PERCENTAGE beam_chance(void)
96 if (p_ptr->pclass == CLASS_MAGE)
97 return (PERCENTAGE)(p_ptr->lev);
98 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
99 return (PERCENTAGE)(p_ptr->lev + 10);
101 return (PERCENTAGE)(p_ptr->lev / 2);
106 * @brief 配置した鏡リストの次を取得する /
107 * Get another mirror. for SEEKER
108 * @param next_y 次の鏡のy座標を返す参照ポインタ
109 * @param next_x 次の鏡のx座標を返す参照ポインタ
110 * @param cury 現在の鏡のy座標
111 * @param curx 現在の鏡のx座標
113 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
115 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
116 int mirror_num = 0; /* 鏡の数 */
120 for (x = 0; x < cur_wid; x++)
122 for (y = 0; y < cur_hgt; y++)
124 if (is_mirror_grid(&cave[y][x])) {
125 mirror_y[mirror_num] = y;
126 mirror_x[mirror_num] = x;
133 num = randint0(mirror_num);
134 *next_y = mirror_y[num];
135 *next_x = mirror_x[num];
138 *next_y = cury + randint0(5) - 2;
139 *next_x = curx + randint0(5) - 2;
144 * @brief 万色表現用にランダムな色を選択する関数 /
145 * Get a legal "multi-hued" color for drawing "spells"
149 static TERM_COLOR mh_attr(int max)
151 switch (randint1(max))
153 case 1: return (TERM_RED);
154 case 2: return (TERM_GREEN);
155 case 3: return (TERM_BLUE);
156 case 4: return (TERM_YELLOW);
157 case 5: return (TERM_ORANGE);
158 case 6: return (TERM_VIOLET);
159 case 7: return (TERM_L_RED);
160 case 8: return (TERM_L_GREEN);
161 case 9: return (TERM_L_BLUE);
162 case 10: return (TERM_UMBER);
163 case 11: return (TERM_L_UMBER);
164 case 12: return (TERM_SLATE);
165 case 13: return (TERM_WHITE);
166 case 14: return (TERM_L_WHITE);
167 case 15: return (TERM_L_DARK);
175 * @brief 魔法属性に応じたエフェクトの色を返す /
176 * Return a color to use for the bolt/ball spells
180 static TERM_COLOR spell_color(int type)
182 /* Check if A.B.'s new graphics should be used (rr9) */
183 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
188 case GF_PSY_SPEAR: return (0x06);
189 case GF_MISSILE: return (0x0F);
190 case GF_ACID: return (0x04);
191 case GF_ELEC: return (0x02);
192 case GF_FIRE: return (0x00);
193 case GF_COLD: return (0x01);
194 case GF_POIS: return (0x03);
195 case GF_HOLY_FIRE: return (0x00);
196 case GF_HELL_FIRE: return (0x00);
197 case GF_MANA: return (0x0E);
199 case GF_SEEKER: return (0x0E);
200 case GF_SUPER_RAY: return (0x0E);
202 case GF_ARROW: return (0x0F);
203 case GF_WATER: return (0x04);
204 case GF_NETHER: return (0x07);
205 case GF_CHAOS: return (mh_attr(15));
206 case GF_DISENCHANT: return (0x05);
207 case GF_NEXUS: return (0x0C);
208 case GF_CONFUSION: return (mh_attr(4));
209 case GF_SOUND: return (0x09);
210 case GF_SHARDS: return (0x08);
211 case GF_FORCE: return (0x09);
212 case GF_INERTIAL: return (0x09);
213 case GF_GRAVITY: return (0x09);
214 case GF_TIME: return (0x09);
215 case GF_LITE_WEAK: return (0x06);
216 case GF_LITE: return (0x06);
217 case GF_DARK_WEAK: return (0x07);
218 case GF_DARK: return (0x07);
219 case GF_PLASMA: return (0x0B);
220 case GF_METEOR: return (0x00);
221 case GF_ICE: return (0x01);
222 case GF_ROCKET: return (0x0F);
223 case GF_DEATH_RAY: return (0x07);
224 case GF_NUKE: return (mh_attr(2));
225 case GF_DISINTEGRATE: return (0x05);
237 case GF_CAUSE_4: return (0x0E);
238 case GF_HAND_DOOM: return (0x07);
239 case GF_CAPTURE : return (0x0E);
240 case GF_IDENTIFY: return (0x01);
241 case GF_ATTACK: return (0x0F);
242 case GF_PHOTO : return (0x06);
245 /* Normal tiles or ASCII */
251 /* Lookup the default colors for this type */
252 cptr s = quark_str(gf_color[type]);
254 if (!s) return (TERM_WHITE);
256 /* Pick a random color */
257 c = s[randint0(strlen(s))];
259 /* Lookup this color */
260 a = my_strchr(color_char, c) - color_char;
262 /* Invalid color (note check for < 0 removed, gave a silly
263 * warning because bytes are always >= 0 -- RG) */
264 if (a > 15) return (TERM_WHITE);
270 /* Standard "color" */
276 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
277 * Find the attr/char pair to use for a spell effect
286 * It is moving (or has moved) from (x,y) to (nx,ny).
287 * If the distance is not "one", we (may) return "*".
290 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
300 if ((ny == y) && (nx == x)) base = 0x30;
303 else if (nx == x) base = 0x40;
306 else if (ny == y) base = 0x50;
309 else if ((ny - y) == (x - nx)) base = 0x60;
312 else if ((ny - y) == (nx - x)) base = 0x70;
317 /* Basic spell color */
318 k = spell_color(typ);
320 /* Obtain attr/char */
321 a = misc_to_attr[base + k];
322 c = misc_to_char[base + k];
330 * @brief 始点から終点への経路を返す /
331 * Determine the path taken by a projection.
332 * @param gp 経路座標リストを返す参照ポインタ
342 * The projection will always start from the grid (y1,x1), and will travel
343 * towards the grid (y2,x2), touching one grid per unit of distance along
344 * the major axis, and stopping when it enters the destination grid or a
345 * wall grid, or has travelled the maximum legal distance of "range".
347 * Note that "distance" in this function (as in the "update_view()" code)
348 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
349 * actually has an "octagon of projection" not a "circle of projection".
351 * The path grids are saved into the grid array pointed to by "gp", and
352 * there should be room for at least "range" grids in "gp". Note that
353 * due to the way in which distance is calculated, this function normally
354 * uses fewer than "range" grids for the projection path, so the result
355 * of this function should never be compared directly to "range". Note
356 * that the initial grid (y1,x1) is never saved into the grid array, not
357 * even if the initial grid is also the final grid.
359 * The "flg" flags can be used to modify the behavior of this function.
361 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
362 * semantics as they do for the "project" function, namely, that the path
363 * will stop as soon as it hits a monster, or that the path will continue
364 * through the destination grid, respectively.
366 * The "PROJECT_JUMP" flag, which for the "project()" function means to
367 * start at a special grid (which makes no sense in this function), means
368 * that the path should be "angled" slightly if needed to avoid any wall
369 * grids, allowing the player to "target" any grid which is in "view".
370 * This flag is non-trivial and has not yet been implemented, but could
371 * perhaps make use of the "vinfo" array (above).
373 * This function returns the number of grids (if any) in the path. This
374 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
376 * This algorithm is similar to, but slightly different from, the one used
377 * by "update_view_los()", and very different from the one used by "los()".
380 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
402 /* No path necessary (or allowed) */
403 if ((x1 == x2) && (y1 == y2)) return (0);
431 /* Number of "units" in one "half" grid */
434 /* Number of "units" in one "full" grid */
440 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
451 /* Advance (X) part 2 */
454 /* Advance (X) part 3 */
461 /* Create the projection path */
465 gp[n++] = GRID(y, x);
467 /* Hack -- Check maximum range */
468 if ((n + (k >> 1)) >= range) break;
470 /* Sometimes stop at destination grid */
471 if (!(flg & (PROJECT_THRU)))
473 if ((x == x2) && (y == y2)) break;
476 if (flg & (PROJECT_DISI))
478 if ((n > 0) && cave_stop_disintegration(y, x)) break;
480 else if (flg & (PROJECT_LOS))
482 if ((n > 0) && !cave_los_bold(y, x)) break;
484 else if (!(flg & (PROJECT_PATH)))
486 /* Always stop at non-initial wall grids */
487 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
490 /* Sometimes stop at non-initial monsters/players */
491 if (flg & (PROJECT_STOP))
494 (player_bold(y, x) || cave[y][x].m_idx != 0))
498 if (!in_bounds(y, x)) break;
503 /* Advance (X) part 1 */
506 /* Horizontal change */
509 /* Advance (X) part 2 */
512 /* Advance (X) part 3 */
528 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
537 /* Vertical change */
540 /* Advance (Y) part 2 */
543 /* Advance (Y) part 3 */
550 /* Create the projection path */
554 gp[n++] = GRID(y, x);
556 /* Hack -- Check maximum range */
557 if ((n + (k >> 1)) >= range) break;
559 /* Sometimes stop at destination grid */
560 if (!(flg & (PROJECT_THRU)))
562 if ((x == x2) && (y == y2)) break;
565 if (flg & (PROJECT_DISI))
567 if ((n > 0) && cave_stop_disintegration(y, x)) break;
569 else if (flg & (PROJECT_LOS))
571 if ((n > 0) && !cave_los_bold(y, x)) break;
573 else if (!(flg & (PROJECT_PATH)))
575 /* Always stop at non-initial wall grids */
576 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
579 /* Sometimes stop at non-initial monsters/players */
580 if (flg & (PROJECT_STOP))
583 (player_bold(y, x) || cave[y][x].m_idx != 0))
587 if (!in_bounds(y, x)) break;
592 /* Advance (Y) part 1 */
595 /* Vertical change */
598 /* Advance (Y) part 2 */
601 /* Advance (Y) part 3 */
621 /* Create the projection path */
625 gp[n++] = GRID(y, x);
627 /* Hack -- Check maximum range */
628 if ((n + (n >> 1)) >= range) break;
630 /* Sometimes stop at destination grid */
631 if (!(flg & (PROJECT_THRU)))
633 if ((x == x2) && (y == y2)) break;
636 if (flg & (PROJECT_DISI))
638 if ((n > 0) && cave_stop_disintegration(y, x)) break;
640 else if (flg & (PROJECT_LOS))
642 if ((n > 0) && !cave_los_bold(y, x)) break;
644 else if (!(flg & (PROJECT_PATH)))
646 /* Always stop at non-initial wall grids */
647 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
650 /* Sometimes stop at non-initial monsters/players */
651 if (flg & (PROJECT_STOP))
654 (player_bold(y, x) || cave[y][x].m_idx != 0))
658 if (!in_bounds(y, x)) break;
675 * Mega-Hack -- track "affected" monsters (see "project()" comments)
677 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
678 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
679 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
680 /* Mega-Hack -- monsters target */
681 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
682 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
686 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
687 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
688 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
689 * @param y 目標Y座標 / Target y location (or location to travel "towards")
690 * @param x 目標X座標 / Target x location (or location to travel "towards")
691 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
692 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
693 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
696 * We are called both for "beam" effects and "ball" effects.
698 * The "r" parameter is the "distance from ground zero".
700 * Note that we determine if the player can "see" anything that happens
701 * by taking into account: blindness, line-of-sight, and illumination.
703 * We return "TRUE" if the effect of the projection is "obvious".
705 * We also "see" grids which are "memorized", probably a hack
707 * Perhaps we should affect doors?
710 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
712 cave_type *c_ptr = &cave[y][x];
713 feature_type *f_ptr = &f_info[c_ptr->feat];
715 bool obvious = FALSE;
716 bool known = player_has_los_bold(y, x);
721 /* Reduce damage by distance */
722 dam = (dam + r) / (r + 1);
725 if (have_flag(f_ptr->flags, FF_TREE))
733 message = _("枯れた", "was blasted."); break;
735 message = _("縮んだ", "shrank."); break;
737 message = _("溶けた", "melted."); break;
740 message = _("凍り、砕け散った", "was frozen and smashed."); break;
744 message = _("燃えた", "burns up!"); break;
756 message = _("粉砕された", "was crushed."); break;
758 message = NULL; break;
762 msg_format(_("木は%s。", "A tree %s"), message);
763 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
766 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
770 /* Analyze the type */
773 /* Ignore most effects */
808 /* Destroy Traps (and Locks) */
811 /* Reveal secret doors */
812 if (is_hidden_door(c_ptr))
817 /* Check line of sight */
825 if (is_trap(c_ptr->feat))
827 /* Check line of sight */
830 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
834 /* Destroy the trap */
835 cave_alter_feat(y, x, FF_DISARM);
838 /* Locked doors are unlocked */
839 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
841 s16b old_feat = c_ptr->feat;
843 /* Unlock the door */
844 cave_alter_feat(y, x, FF_DISARM);
846 /* Check line of sound */
847 if (known && (old_feat != c_ptr->feat))
849 msg_print(_("カチッと音がした!", "Click!"));
854 /* Remove "unsafe" flag if player is not blind */
855 if (!p_ptr->blind && player_has_los_bold(y, x))
857 c_ptr->info &= ~(CAVE_UNSAFE);
865 /* Destroy Doors (and traps) */
868 /* Destroy all doors and traps */
869 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
871 /* Check line of sight */
874 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
878 /* Destroy the feature */
879 cave_alter_feat(y, x, FF_TUNNEL);
882 /* Remove "unsafe" flag if player is not blind */
883 if (!p_ptr->blind && player_has_los_bold(y, x))
885 c_ptr->info &= ~(CAVE_UNSAFE);
893 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
895 if (have_flag(f_ptr->flags, FF_SPIKE))
897 s16b old_mimic = c_ptr->mimic;
898 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
900 cave_alter_feat(y, x, FF_SPIKE);
901 c_ptr->mimic = old_mimic;
906 /* Check line of sight */
907 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
909 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
916 /* Destroy walls (and doors) */
919 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
921 if (known && (c_ptr->info & (CAVE_MARK)))
923 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
927 /* Destroy the wall */
928 cave_alter_feat(y, x, FF_HURT_ROCK);
930 /* Update some things */
931 p_ptr->update |= (PU_FLOW);
940 /* Require a "naked" floor grid */
941 if (!cave_naked_bold(y, x)) break;
943 /* Not on the player */
944 if (player_bold(y, x)) break;
946 /* Create a closed door */
947 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
950 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
967 /* Require a "naked" floor grid */
968 if (!cave_naked_bold(y, x)) break;
970 /* Not on the player */
971 if (player_bold(y, x)) break;
973 /* Create a closed door */
974 cave_set_feat(y, x, feat_tree);
977 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
985 /* Require a "naked" floor grid */
986 if (!cave_naked_bold(y, x)) break;
989 c_ptr->info |= CAVE_OBJECT;
990 c_ptr->mimic = feat_glyph;
1001 /* Require a "naked" floor grid */
1002 if (!cave_naked_bold(y, x)) break;
1004 /* Not on the player */
1005 if (player_bold(y, x)) break;
1008 cave_set_feat(y, x, feat_granite);
1016 /* Ignore permanent grid */
1017 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1022 /* Ignore grid without enough space */
1023 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1025 /* Place a shallow lava */
1026 cave_set_feat(y, x, feat_shallow_lava);
1031 /* Place a deep lava */
1032 cave_set_feat(y, x, feat_deep_lava);
1039 /* Ignore permanent grid */
1040 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1045 /* Ignore grid without enough space */
1046 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1048 /* Place a shallow water */
1049 cave_set_feat(y, x, feat_shallow_water);
1054 /* Place a deep water */
1055 cave_set_feat(y, x, feat_deep_water);
1060 /* Lite up the grid */
1064 /* Turn on the light */
1065 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1067 c_ptr->info |= (CAVE_GLOW);
1070 update_local_illumination(y, x);
1073 if (player_can_see_bold(y, x)) obvious = TRUE;
1075 /* Mega-Hack -- Update the monster in the affected grid */
1076 /* This allows "spear of light" (etc) to work "correctly" */
1077 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1079 if (p_ptr->special_defense & NINJA_S_STEALTH)
1081 if (player_bold(y, x)) set_superstealth(FALSE);
1088 /* Darken the grid */
1092 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1095 /* Turn off the light. */
1098 if (dun_level || !is_daytime())
1100 for (j = 0; j < 9; j++)
1102 int by = y + ddy_ddd[j];
1103 int bx = x + ddx_ddd[j];
1105 if (in_bounds2(by, bx))
1107 cave_type *cc_ptr = &cave[by][bx];
1109 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1117 if (!do_dark) break;
1120 c_ptr->info &= ~(CAVE_GLOW);
1122 /* Hack -- Forget "boring" grids */
1123 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1126 c_ptr->info &= ~(CAVE_MARK);
1133 update_local_illumination(y, x);
1135 if (player_can_see_bold(y, x)) obvious = TRUE;
1137 /* Mega-Hack -- Update the monster in the affected grid */
1138 /* This allows "spear of light" (etc) to work "correctly" */
1139 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1149 if (is_mirror_grid(c_ptr))
1151 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1153 remove_mirror(y, x);
1154 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1157 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1159 if (known && (c_ptr->info & CAVE_MARK))
1161 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1165 /* Destroy the wall */
1166 cave_alter_feat(y, x, FF_HURT_ROCK);
1168 /* Update some things */
1169 p_ptr->update |= (PU_FLOW);
1176 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1178 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1180 remove_mirror(y, x);
1181 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1184 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1186 if (known && (c_ptr->info & CAVE_MARK))
1188 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1192 /* Destroy the wall */
1193 cave_alter_feat(y, x, FF_HURT_ROCK);
1195 /* Update some things */
1196 p_ptr->update |= (PU_FLOW);
1201 case GF_DISINTEGRATE:
1203 /* Destroy mirror/glyph */
1204 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1205 remove_mirror(y, x);
1207 /* Permanent features don't get effect */
1208 /* But not protect monsters and other objects */
1209 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1211 cave_alter_feat(y, x, FF_HURT_DISI);
1213 /* Update some things -- similar to GF_KILL_WALL */
1214 p_ptr->update |= (PU_FLOW);
1221 /* Return "Anything seen?" */
1228 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1229 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1230 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1231 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1232 * @param x 目標X座標 / Target x location (or location to travel "towards")
1233 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1234 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1235 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1238 * We are called from "project()" to "damage" objects
1240 * We are called both for "beam" effects and "ball" effects.
1242 * Perhaps we should only SOMETIMES damage things on the ground.
1244 * The "r" parameter is the "distance from ground zero".
1246 * Note that we determine if the player can "see" anything that happens
1247 * by taking into account: blindness, line-of-sight, and illumination.
1249 * We also "see" grids which are "memorized", probably a hack
1251 * We return "TRUE" if the effect of the projection is "obvious".
1254 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1256 cave_type *c_ptr = &cave[y][x];
1258 OBJECT_IDX this_o_idx, next_o_idx = 0;
1260 bool obvious = FALSE;
1261 bool known = player_has_los_bold(y, x);
1263 BIT_FLAGS flgs[TR_FLAG_SIZE];
1265 char o_name[MAX_NLEN];
1267 KIND_OBJECT_IDX k_idx = 0;
1268 bool is_potion = FALSE;
1271 who = who ? who : 0;
1273 /* Reduce damage by distance */
1274 dam = (dam + r) / (r + 1);
1277 /* Scan all objects in the grid */
1278 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1280 object_type *o_ptr = &o_list[this_o_idx];
1282 bool is_art = FALSE;
1283 bool ignore = FALSE;
1284 bool do_kill = FALSE;
1286 cptr note_kill = NULL;
1289 /* Get the "plural"-ness */
1290 bool plural = (o_ptr->number > 1);
1293 /* Acquire next object */
1294 next_o_idx = o_ptr->next_o_idx;
1296 /* Extract the flags */
1297 object_flags(o_ptr, flgs);
1299 /* Check for artifact */
1300 if (object_is_artifact(o_ptr)) is_art = TRUE;
1302 /* Analyze the type */
1305 /* Acid -- Lots of things */
1308 if (hates_acid(o_ptr))
1311 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1312 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1317 /* Elec -- Rings and Wands */
1320 if (hates_elec(o_ptr))
1323 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1324 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1329 /* Fire -- Flammable objects */
1332 if (hates_fire(o_ptr))
1335 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1336 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1341 /* Cold -- potions and flasks */
1344 if (hates_cold(o_ptr))
1346 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1348 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1356 if (hates_fire(o_ptr))
1359 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1360 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1362 if (hates_elec(o_ptr))
1366 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1367 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1375 if (hates_fire(o_ptr))
1378 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1379 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1381 if (hates_cold(o_ptr))
1385 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1386 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1391 /* Hack -- break potions and such */
1397 if (hates_cold(o_ptr))
1399 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1405 /* Mana and Chaos -- destroy everything */
1411 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1415 case GF_DISINTEGRATE:
1418 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1425 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1426 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1427 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1431 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1435 if (object_is_cursed(o_ptr))
1438 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1445 identify_item(o_ptr);
1447 /* Auto-inscription */
1448 autopick_alter_item((-this_o_idx), FALSE);
1456 /* Chests are noticed only if trapped or locked */
1457 if (o_ptr->tval == TV_CHEST)
1459 /* Disarm/Unlock traps */
1460 if (o_ptr->pval > 0)
1462 /* Disarm or Unlock */
1463 o_ptr->pval = (0 - o_ptr->pval);
1466 object_known(o_ptr);
1468 if (known && (o_ptr->marked & OM_FOUND))
1470 msg_print(_("カチッと音がした!", "Click!"));
1480 if (o_ptr->tval == TV_CORPSE)
1483 BIT_FLAGS mode = 0L;
1485 if (!who || is_pet(&m_list[who]))
1486 mode |= PM_FORCE_PET;
1488 for (i = 0; i < o_ptr->number ; i++)
1490 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1491 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1495 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1499 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1501 note_kill = _("生き返った。", " revived.");
1503 else if (!note_kill)
1505 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1516 /* Attempt to destroy the object */
1519 /* Effect "observed" */
1520 if (known && (o_ptr->marked & OM_FOUND))
1523 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1526 /* Artifacts, and other objects, get to resist */
1527 if (is_art || ignore)
1529 /* Observe the resist */
1530 if (known && (o_ptr->marked & OM_FOUND))
1532 msg_format(_("%sは影響を受けない!",
1533 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1540 /* Describe if needed */
1541 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1543 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1546 k_idx = o_ptr->k_idx;
1547 is_potion = object_is_potion(o_ptr);
1548 delete_object_idx(this_o_idx);
1550 /* Potions produce effects when 'shattered' */
1553 (void)potion_smash_effect(who, y, x, k_idx);
1561 /* Return "Anything seen?" */
1567 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1568 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1569 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1570 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1571 * @param x 目標X座標 / Target x location (or location to travel "towards")
1572 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1573 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1575 * @param see_s_msg TRUEならばメッセージを表示する
1576 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1579 * This routine takes a "source monster" (by index) which is mostly used to
1580 * determine if the player is causing the damage, and a "radius" (see below),
1581 * which is used to decrease the power of explosions with distance, and a
1582 * location, via integers which are modified by certain types of attacks
1583 * (polymorph and teleport being the obvious ones), a default damage, which
1584 * is modified as needed based on various properties, and finally a "damage
1585 * type" (see below).
1588 * Note that this routine can handle "no damage" attacks (like teleport) by
1589 * taking a "zero" damage, and can even take "parameters" to attacks (like
1590 * confuse) by accepting a "damage", using it to calculate the effect, and
1591 * then setting the damage to zero. Note that the "damage" parameter is
1592 * divided by the radius, so monsters not at the "epicenter" will not take
1593 * as much damage (or whatever)...
1596 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1597 * may result in a dereference of an invalid pointer.
1600 * Various messages are produced, and damage is applied.
1603 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1604 * actually be "made" of that substance, or "breathe" big balls of it.
1605 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1607 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1608 * and hurts evil less. If can breath nether, then it resists it as well.
1611 * Damage reductions use the following formulas:
1612 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1613 * gives avg damage of .655, ranging from .858 to .500
1614 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1615 * gives avg damage of .544, ranging from .714 to .417
1616 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1617 * gives avg damage of .444, ranging from .556 to .333
1618 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1619 * gives avg damage of .327, ranging from .427 to .250
1620 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1621 * gives something simple.
1624 * In this function, "result" messages are postponed until the end, where
1625 * the "note" string is appended to the monster name, if not NULL. So,
1626 * to make a spell have "no effect" just set "note" to NULL. You should
1627 * also set "notice" to FALSE, or the player will learn what the spell does.
1630 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1634 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1638 cave_type *c_ptr = &cave[y][x];
1640 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1641 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1643 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1647 /* Is the monster "seen"? */
1648 bool seen = m_ptr->ml;
1649 bool seen_msg = is_seen(m_ptr);
1651 bool slept = (bool)MON_CSLEEP(m_ptr);
1653 /* Were the effects "obvious" (if seen)? */
1654 bool obvious = FALSE;
1656 /* Can the player know about this effect? */
1657 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1659 /* Were the effects "irrelevant"? */
1660 bool skipped = FALSE;
1662 /* Gets the monster angry at the source of the effect? */
1663 bool get_angry = FALSE;
1665 /* Polymorph setting (true or false) */
1666 bool do_poly = FALSE;
1668 /* Teleport setting (max distance) */
1671 /* Confusion setting (amount to confuse) */
1674 /* Stunning setting (amount to stun) */
1677 /* Sleep amount (amount to sleep) */
1680 /* Fear amount (amount to fear) */
1683 /* Time amount (amount to time) */
1686 bool heal_leper = FALSE;
1688 /* Hold the monster name */
1692 PARAMETER_VALUE photo = 0;
1694 /* Assume no note */
1697 /* Assume a default death */
1698 cptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1700 POSITION ty = m_ptr->fy;
1701 POSITION tx = m_ptr->fx;
1703 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1706 if (!c_ptr->m_idx) return (FALSE);
1708 /* Never affect projector */
1709 if (who && (c_ptr->m_idx == who)) return (FALSE);
1710 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1711 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1713 /* Don't affect already death monsters */
1714 /* Prevents problems with chain reactions of exploding monsters */
1715 if (m_ptr->hp < 0) return (FALSE);
1717 /* Reduce damage by distance */
1718 dam = (dam + r) / (r + 1);
1721 /* Get the monster name (BEFORE polymorphing) */
1722 monster_desc(m_name, m_ptr, 0);
1724 /* Get the monster possessive ("his"/"her"/"its") */
1725 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1727 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1729 /* Analyze the damage type */
1732 /* Magic Missile -- pure damage */
1735 if (seen) obvious = TRUE;
1737 if (r_ptr->flagsr & RFR_RES_ALL)
1739 note = _("には完全な耐性がある!", " is immune.");
1741 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1750 if (seen) obvious = TRUE;
1752 if (r_ptr->flagsr & RFR_RES_ALL)
1754 note = _("には完全な耐性がある!", " is immune.");
1756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1759 if (r_ptr->flagsr & RFR_IM_ACID)
1761 note = _("にはかなり耐性がある!", " resists a lot.");
1763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1771 if (seen) obvious = TRUE;
1773 if (r_ptr->flagsr & RFR_RES_ALL)
1775 note = _("には完全な耐性がある!", " is immune.");
1777 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1780 if (r_ptr->flagsr & RFR_IM_ELEC)
1782 note = _("にはかなり耐性がある!", " resists a lot.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1792 if (seen) obvious = TRUE;
1794 if (r_ptr->flagsr & RFR_RES_ALL)
1796 note = _("には完全な耐性がある!", " is immune.");
1798 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1801 if (r_ptr->flagsr & RFR_IM_FIRE)
1803 note = _("にはかなり耐性がある!", " resists a lot.");
1805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1807 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1809 note = _("はひどい痛手をうけた。", " is hit hard.");
1811 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1819 if (seen) obvious = TRUE;
1821 if (r_ptr->flagsr & RFR_RES_ALL)
1823 note = _("には完全な耐性がある!", " is immune.");
1825 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1828 if (r_ptr->flagsr & RFR_IM_COLD)
1830 note = _("にはかなり耐性がある!", " resists a lot.");
1832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1834 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1836 note = _("はひどい痛手をうけた。", " is hit hard.");
1838 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1846 if (seen) obvious = TRUE;
1848 if (r_ptr->flagsr & RFR_RES_ALL)
1850 note = _("には完全な耐性がある!", " is immune.");
1852 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1855 if (r_ptr->flagsr & RFR_IM_POIS)
1857 note = _("にはかなり耐性がある!", " resists a lot.");
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1867 if (seen) obvious = TRUE;
1869 if (r_ptr->flagsr & RFR_RES_ALL)
1871 note = _("には完全な耐性がある!", " is immune.");
1873 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1876 if (r_ptr->flagsr & RFR_IM_POIS)
1878 note = _("には耐性がある。", " resists.");
1879 dam *= 3; dam /= randint1(6) + 6;
1880 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1882 else if (one_in_(3)) do_poly = TRUE;
1886 /* Hellfire -- hurts Evil */
1889 if (seen) obvious = TRUE;
1891 if (r_ptr->flagsr & RFR_RES_ALL)
1893 note = _("には完全な耐性がある!", " is immune.");
1895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1898 if (r_ptr->flags3 & RF3_GOOD)
1900 note = _("はひどい痛手をうけた。", " is hit hard.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1907 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1910 if (seen) obvious = TRUE;
1912 if (r_ptr->flagsr & RFR_RES_ALL)
1914 note = _("には完全な耐性がある!", " is immune.");
1916 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1919 if (r_ptr->flags3 & RF3_GOOD)
1921 note = _("には完全な耐性がある!", " is immune.");
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1925 else if (r_ptr->flags3 & RF3_EVIL)
1928 note = _("はひどい痛手をうけた。", " is hit hard.");
1929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1933 note = _("には耐性がある。", " resists.");
1934 dam *= 3; dam /= randint1(6) + 6;
1939 /* Arrow -- XXX no defense */
1942 if (seen) obvious = TRUE;
1944 if (r_ptr->flagsr & RFR_RES_ALL)
1946 note = _("には完全な耐性がある!", " is immune.");
1948 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1954 /* Plasma -- XXX perhaps check ELEC or FIRE */
1957 if (seen) obvious = TRUE;
1959 if (r_ptr->flagsr & RFR_RES_ALL)
1961 note = _("には完全な耐性がある!", " is immune.");
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1966 if (r_ptr->flagsr & RFR_RES_PLAS)
1968 note = _("には耐性がある。", " resists.");
1969 dam *= 3; dam /= randint1(6) + 6;
1970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1975 /* Nether -- see above */
1978 if (seen) obvious = TRUE;
1980 if (r_ptr->flagsr & RFR_RES_ALL)
1982 note = _("には完全な耐性がある!", " is immune.");
1984 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1987 if (r_ptr->flagsr & RFR_RES_NETH)
1989 if (r_ptr->flags3 & RF3_UNDEAD)
1991 note = _("には完全な耐性がある!", " is immune.");
1993 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1997 note = _("には耐性がある。", " resists.");
1998 dam *= 3; dam /= randint1(6) + 6;
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2002 else if (r_ptr->flags3 & RF3_EVIL)
2004 note = _("はいくらか耐性を示した。", " resists somewhat.");
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2011 /* Water (acid) damage -- Water spirits/elementals are immune */
2014 if (seen) obvious = TRUE;
2016 if (r_ptr->flagsr & RFR_RES_ALL)
2018 note = _("には完全な耐性がある!", " is immune.");
2020 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2023 if (r_ptr->flagsr & RFR_RES_WATE)
2025 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2027 note = _("には完全な耐性がある!", " is immune.");
2032 note = _("には耐性がある。", " resists.");
2033 dam *= 3; dam /= randint1(6) + 6;
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2040 /* Chaos -- Chaos breathers resist */
2043 if (seen) obvious = TRUE;
2045 if (r_ptr->flagsr & RFR_RES_ALL)
2047 note = _("には完全な耐性がある!", " is immune.");
2049 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2052 if (r_ptr->flagsr & RFR_RES_CHAO)
2054 note = _("には耐性がある。", " resists.");
2055 dam *= 3; dam /= randint1(6) + 6;
2056 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2058 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2060 note = _("はいくらか耐性を示した。", " resists somewhat.");
2061 dam *= 3; dam /= randint1(6) + 6;
2062 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2067 do_conf = (5 + randint1(11) + r) / (r + 1);
2072 /* Shards -- Shard breathers resist */
2075 if (seen) obvious = TRUE;
2077 if (r_ptr->flagsr & RFR_RES_ALL)
2079 note = _("には完全な耐性がある!", " is immune.");
2081 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2084 if (r_ptr->flagsr & RFR_RES_SHAR)
2086 note = _("には耐性がある。", " resists.");
2087 dam *= 3; dam /= randint1(6) + 6;
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2093 /* Rocket: Shard resistance helps */
2096 if (seen) obvious = TRUE;
2098 if (r_ptr->flagsr & RFR_RES_ALL)
2100 note = _("には完全な耐性がある!", " is immune.");
2102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2105 if (r_ptr->flagsr & RFR_RES_SHAR)
2107 note = _("はいくらか耐性を示した。", " resists somewhat.");
2109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2115 /* Sound -- Sound breathers resist */
2118 if (seen) obvious = TRUE;
2120 if (r_ptr->flagsr & RFR_RES_ALL)
2122 note = _("には完全な耐性がある!", " is immune.");
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2127 if (r_ptr->flagsr & RFR_RES_SOUN)
2129 note = _("には耐性がある。", " resists.");
2130 dam *= 2; dam /= randint1(6) + 6;
2131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2133 else do_stun = (10 + randint1(15) + r) / (r + 1);
2140 if (seen) obvious = TRUE;
2142 if (r_ptr->flagsr & RFR_RES_ALL)
2144 note = _("には完全な耐性がある!", " is immune.");
2146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2149 if (r_ptr->flags3 & RF3_NO_CONF)
2151 note = _("には耐性がある。", " resists.");
2152 dam *= 3; dam /= randint1(6) + 6;
2153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2155 else do_conf = (10 + randint1(15) + r) / (r + 1);
2159 /* Disenchantment -- Breathers and Disenchanters resist */
2162 if (seen) obvious = TRUE;
2164 if (r_ptr->flagsr & RFR_RES_ALL)
2166 note = _("には完全な耐性がある!", " is immune.");
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2171 if (r_ptr->flagsr & RFR_RES_DISE)
2173 note = _("には耐性がある。", " resists.");
2174 dam *= 3; dam /= randint1(6) + 6;
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2180 /* Nexus -- Breathers and Existers resist */
2183 if (seen) obvious = TRUE;
2185 if (r_ptr->flagsr & RFR_RES_ALL)
2187 note = _("には完全な耐性がある!", " is immune.");
2189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2192 if (r_ptr->flagsr & RFR_RES_NEXU)
2194 note = _("には耐性がある。", " resists.");
2195 dam *= 3; dam /= randint1(6) + 6;
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2204 if (seen) obvious = TRUE;
2206 if (r_ptr->flagsr & RFR_RES_ALL)
2208 note = _("には完全な耐性がある!", " is immune.");
2210 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2213 if (r_ptr->flagsr & RFR_RES_WALL)
2215 note = _("には耐性がある。", " resists.");
2216 dam *= 3; dam /= randint1(6) + 6;
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2219 else do_stun = (randint1(15) + r) / (r + 1);
2223 /* Inertia -- breathers resist */
2226 if (seen) obvious = TRUE;
2228 if (r_ptr->flagsr & RFR_RES_ALL)
2230 note = _("には完全な耐性がある!", " is immune.");
2232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2235 if (r_ptr->flagsr & RFR_RES_INER)
2237 note = _("には耐性がある。", " resists.");
2238 dam *= 3; dam /= randint1(6) + 6;
2239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2243 /* Powerful monsters can resist */
2244 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2245 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2249 /* Normal monsters slow down */
2252 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2254 note = _("の動きが遅くなった。", " starts moving slower.");
2261 /* Time -- breathers resist */
2264 if (seen) obvious = TRUE;
2266 if (r_ptr->flagsr & RFR_RES_ALL)
2268 note = _("には完全な耐性がある!", " is immune.");
2270 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2273 if (r_ptr->flagsr & RFR_RES_TIME)
2275 note = _("には耐性がある。", " resists.");
2276 dam *= 3; dam /= randint1(6) + 6;
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2279 else do_time = (dam + 1) / 2;
2283 /* Gravity -- breathers resist */
2286 bool resist_tele = FALSE;
2288 if (seen) obvious = TRUE;
2290 if (r_ptr->flagsr & RFR_RES_ALL)
2292 note = _("には完全な耐性がある!", " is immune.");
2294 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2297 if (r_ptr->flagsr & RFR_RES_TELE)
2299 if (r_ptr->flags1 & (RF1_UNIQUE))
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2302 note = _("には効果がなかった。", " is unaffected!");
2305 else if (r_ptr->level > randint1(100))
2307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2308 note = _("には耐性がある!", " resists!");
2313 if (!resist_tele) do_dist = 10;
2315 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2317 if (r_ptr->flagsr & RFR_RES_GRAV)
2319 note = _("には耐性がある!", " resists!");
2320 dam *= 3; dam /= randint1(6) + 6;
2322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2327 /* Powerful monsters can resist */
2328 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2329 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2333 /* Normal monsters slow down */
2336 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2338 note = _("の動きが遅くなった。", " starts moving slower.");
2343 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2345 /* Attempt a saving throw */
2346 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2347 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2351 /* No obvious effect */
2352 note = _("には効果がなかった。", " is unaffected!");
2364 if (seen) obvious = TRUE;
2366 if (r_ptr->flagsr & RFR_RES_ALL)
2368 note = _("には完全な耐性がある!", " is immune.");
2370 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2378 case GF_DISINTEGRATE:
2380 if (seen) obvious = TRUE;
2382 if (r_ptr->flagsr & RFR_RES_ALL)
2384 note = _("には完全な耐性がある!", " is immune.");
2386 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2389 if (r_ptr->flags3 & RF3_HURT_ROCK)
2391 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2392 note = _("の皮膚がただれた!", " loses some skin!");
2393 note_dies = _("は蒸発した!", " evaporates!");
2401 if (seen) obvious = TRUE;
2403 /* PSI only works if the monster can see you! -- RG */
2404 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2407 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2412 if (r_ptr->flagsr & RFR_RES_ALL)
2414 note = _("には完全な耐性がある!", " is immune.");
2416 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2419 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2422 note = _("には完全な耐性がある!", " is immune.");
2423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2426 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2427 (r_ptr->flags3 & RF3_ANIMAL) ||
2428 (r_ptr->level > randint1(3 * dam)))
2430 note = _("には耐性がある!", " resists!");
2434 * Powerful demons & undead can turn a mindcrafter's
2435 * attacks back on them
2437 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2438 (r_ptr->level > p_ptr->lev / 2) &&
2442 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2443 (seen ? "%^s's corrupted mind backlashes your attack!" :
2444 "%^ss corrupted mind backlashes your attack!")), m_name);
2447 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2449 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2453 /* Injure +/- confusion */
2454 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2455 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2456 if (one_in_(4) && !CHECK_MULTISHADOW())
2458 switch (randint1(4))
2461 set_confused(p_ptr->confused + 3 + randint1(dam));
2464 set_stun(p_ptr->stun + randint1(dam));
2468 if (r_ptr->flags3 & RF3_NO_FEAR)
2469 note = _("には効果がなかった。", " is unaffected.");
2471 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2475 if (!p_ptr->free_act)
2476 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2485 if ((dam > 0) && one_in_(4))
2487 switch (randint1(4))
2490 do_conf = 3 + randint1(dam);
2493 do_stun = 3 + randint1(dam);
2496 do_fear = 3 + randint1(dam);
2499 note = _("は眠り込んでしまった!", " falls asleep!");
2500 do_sleep = 3 + randint1(dam);
2505 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2511 if (seen) obvious = TRUE;
2513 if (r_ptr->flagsr & RFR_RES_ALL)
2515 note = _("には完全な耐性がある!", " is immune.");
2517 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2520 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2523 note = _("には完全な耐性がある!", " is immune.");
2525 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2526 (r_ptr->flags3 & RF3_ANIMAL) ||
2527 (r_ptr->level > randint1(3 * dam)))
2529 note = _("には耐性がある!", " resists!");
2533 * Powerful demons & undead can turn a mindcrafter's
2534 * attacks back on them
2536 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2537 (r_ptr->level > p_ptr->lev / 2) &&
2541 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2542 (seen ? "%^s's corrupted mind backlashes your attack!" :
2543 "%^ss corrupted mind backlashes your attack!")), m_name);
2545 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2547 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2551 /* Injure + mana drain */
2552 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2553 if (!CHECK_MULTISHADOW())
2555 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2556 p_ptr->csp -= damroll(5, dam) / 2;
2557 if (p_ptr->csp < 0) p_ptr->csp = 0;
2558 p_ptr->redraw |= PR_MANA;
2559 p_ptr->window |= (PW_SPELL);
2561 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2568 int b = damroll(5, dam) / 4;
2569 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2570 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2571 (seen ? "You convert %s's pain into %s!" :
2572 "You convert %ss pain into %s!"));
2573 msg_format(msg, m_name, str);
2575 b = MIN(p_ptr->msp, p_ptr->csp + b);
2577 p_ptr->redraw |= PR_MANA;
2578 p_ptr->window |= (PW_SPELL);
2580 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2584 case GF_TELEKINESIS:
2586 if (seen) obvious = TRUE;
2588 if (r_ptr->flagsr & RFR_RES_ALL)
2590 note = _("には完全な耐性がある!", " is immune.");
2592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2597 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2602 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2604 /* Attempt a saving throw */
2605 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2606 (r_ptr->level > 5 + randint1(dam)))
2610 /* No obvious effect */
2616 /* Psycho-spear -- powerful magic missile */
2619 if (seen) obvious = TRUE;
2621 if (r_ptr->flagsr & RFR_RES_ALL)
2623 note = _("には完全な耐性がある!", " is immune.");
2625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2631 /* Meteor -- powerful magic missile */
2634 if (seen) obvious = TRUE;
2636 if (r_ptr->flagsr & RFR_RES_ALL)
2638 note = _("には完全な耐性がある!", " is immune.");
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2648 if (!is_hostile(m_ptr)) break;
2650 if (seen) obvious = TRUE;
2652 if (r_ptr->flagsr & RFR_RES_ALL)
2654 note = _("には効果がなかった!", " is immune.");
2656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2659 /* Attempt a saving throw */
2660 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2661 (r_ptr->flags3 & RF3_NO_CONF) ||
2662 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2664 /* Memorize a flag */
2665 if (r_ptr->flags3 & RF3_NO_CONF)
2667 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2674 * Powerful demons & undead can turn a mindcrafter's
2675 * attacks back on them
2677 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2678 (r_ptr->level > p_ptr->lev / 2) &&
2682 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2683 (seen ? "%^s's corrupted mind backlashes your attack!" :
2684 "%^ss corrupted mind backlashes your attack!")), m_name);
2687 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2689 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2693 /* Confuse, stun, terrify */
2694 switch (randint1(4))
2697 set_stun(p_ptr->stun + dam / 2);
2700 set_confused(p_ptr->confused + dam / 2);
2704 if (r_ptr->flags3 & RF3_NO_FEAR)
2705 note = _("には効果がなかった。", " is unaffected.");
2707 set_afraid(p_ptr->afraid + dam);
2714 /* No obvious effect */
2715 note = _("には効果がなかった。", " is unaffected.");
2721 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2723 note = _("があなたに隷属した。", " is in your thrall!");
2728 switch (randint1(4))
2742 /* No "real" damage */
2749 /* Ice -- Cold + Cuts + Stun */
2752 if (seen) obvious = TRUE;
2754 if (r_ptr->flagsr & RFR_RES_ALL)
2756 note = _("には完全な耐性がある!", " is immune.");
2758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2761 do_stun = (randint1(15) + 1) / (r + 1);
2762 if (r_ptr->flagsr & RFR_IM_COLD)
2764 note = _("にはかなり耐性がある!", " resists a lot.");
2766 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2768 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2770 note = _("はひどい痛手をうけた。", " is hit hard.");
2772 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2779 case GF_HYPODYNAMIA:
2781 if (seen) obvious = TRUE;
2783 if (r_ptr->flagsr & RFR_RES_ALL)
2785 note = _("には完全な耐性がある!", " is immune.");
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2790 if (!monster_living(m_ptr->r_idx))
2792 if (is_original_ap_and_seen(m_ptr))
2794 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2795 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2796 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2798 note = _("には効果がなかった。", " is unaffected.");
2802 else do_time = (dam+7)/8;
2810 if (seen) obvious = TRUE;
2812 if (r_ptr->flagsr & RFR_RES_ALL)
2814 note = _("には完全な耐性がある!", " is immune.");
2816 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2819 if (!monster_living(m_ptr->r_idx))
2821 if (is_original_ap_and_seen(m_ptr))
2823 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2824 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2825 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2827 note = _("には完全な耐性がある!", " is immune.");
2831 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2832 (randint1(888) != 666)) ||
2833 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2834 randint1(100) != 66))
2836 note = _("には耐性がある!", " resists!");
2844 /* Polymorph monster (Use "dam" as "power") */
2847 if (seen) obvious = TRUE;
2849 if (r_ptr->flagsr & RFR_RES_ALL)
2851 note = _("には効果がなかった。", " is unaffected.");
2853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2856 /* Attempt to polymorph (see below) */
2859 /* Powerful monsters can resist */
2860 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2861 (r_ptr->flags1 & RF1_QUESTOR) ||
2862 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2864 note = _("には効果がなかった。", " is unaffected.");
2869 /* No "real" damage */
2876 /* Clone monsters (Ignore "dam") */
2879 if (seen) obvious = TRUE;
2881 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2883 note = _("には効果がなかった。", " is unaffected.");
2888 m_ptr->hp = m_ptr->maxhp;
2890 /* Attempt to clone. */
2891 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2893 note = _("が分裂した!", " spawns!");
2897 /* No "real" damage */
2904 /* Heal Monster (use "dam" as amount of healing) */
2907 if (seen) obvious = TRUE;
2910 (void)set_monster_csleep(c_ptr->m_idx, 0);
2912 if (m_ptr->maxhp < m_ptr->max_maxhp)
2914 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2915 m_ptr->maxhp = m_ptr->max_maxhp;
2920 /* Redraw (later) if needed */
2921 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2922 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2930 if (seen) obvious = TRUE;
2933 (void)set_monster_csleep(c_ptr->m_idx, 0);
2934 if (MON_STUNNED(m_ptr))
2936 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2937 (void)set_monster_stunned(c_ptr->m_idx, 0);
2939 if (MON_CONFUSED(m_ptr))
2941 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2942 (void)set_monster_confused(c_ptr->m_idx, 0);
2944 if (MON_MONFEAR(m_ptr))
2946 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2947 (void)set_monster_monfear(c_ptr->m_idx, 0);
2951 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2954 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2958 chg_virtue(V_VITALITY, 1);
2960 if (r_ptr->flags1 & RF1_UNIQUE)
2961 chg_virtue(V_INDIVIDUALISM, 1);
2963 if (is_friendly(m_ptr))
2964 chg_virtue(V_HONOUR, 1);
2965 else if (!(r_ptr->flags3 & RF3_EVIL))
2967 if (r_ptr->flags3 & RF3_GOOD)
2968 chg_virtue(V_COMPASSION, 2);
2970 chg_virtue(V_COMPASSION, 1);
2973 if (r_ptr->flags3 & RF3_ANIMAL)
2974 chg_virtue(V_NATURE, 1);
2977 if (m_ptr->r_idx == MON_LEPER)
2980 if (!who) chg_virtue(V_COMPASSION, 5);
2983 /* Redraw (later) if needed */
2984 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2985 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2987 note = _("は体力を回復したようだ。", " looks healthier.");
2989 /* No "real" damage */
2995 /* Speed Monster (Ignore "dam") */
2998 if (seen) obvious = TRUE;
3001 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3003 note = _("の動きが速くなった。", " starts moving faster.");
3008 if (r_ptr->flags1 & RF1_UNIQUE)
3009 chg_virtue(V_INDIVIDUALISM, 1);
3010 if (is_friendly(m_ptr))
3011 chg_virtue(V_HONOUR, 1);
3014 /* No "real" damage */
3020 /* Slow Monster (Use "dam" as "power") */
3023 if (seen) obvious = TRUE;
3025 if (r_ptr->flagsr & RFR_RES_ALL)
3027 note = _("には効果がなかった。", " is unaffected.");
3029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3032 /* Powerful monsters can resist */
3033 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3034 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3036 note = _("には効果がなかった。", " is unaffected.");
3040 /* Normal monsters slow down */
3043 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3045 note = _("の動きが遅くなった。", " starts moving slower.");
3049 /* No "real" damage */
3055 /* Sleep (Use "dam" as "power") */
3058 if (seen) obvious = TRUE;
3060 if (r_ptr->flagsr & RFR_RES_ALL)
3062 note = _("には効果がなかった。", " is unaffected.");
3064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3067 /* Attempt a saving throw */
3068 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3069 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3070 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3072 /* Memorize a flag */
3073 if (r_ptr->flags3 & RF3_NO_SLEEP)
3075 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3077 /* No obvious effect */
3078 note = _("には効果がなかった。", " is unaffected.");
3083 /* Go to sleep (much) later */
3084 note = _("は眠り込んでしまった!", " falls asleep!");
3088 /* No "real" damage */
3094 /* Sleep (Use "dam" as "power") */
3095 case GF_STASIS_EVIL:
3097 if (seen) obvious = TRUE;
3099 if (r_ptr->flagsr & RFR_RES_ALL)
3101 note = _("には効果がなかった!", " is immune.");
3103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3106 /* Attempt a saving throw */
3107 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3108 !(r_ptr->flags3 & RF3_EVIL) ||
3109 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3111 note = _("には効果がなかった。", " is unaffected.");
3116 /* Go to sleep (much) later */
3117 note = _("は動けなくなった!", " is suspended!");
3121 /* No "real" damage */
3126 /* Sleep (Use "dam" as "power") */
3129 if (seen) obvious = TRUE;
3131 if (r_ptr->flagsr & RFR_RES_ALL)
3133 note = _("には効果がなかった。", " is unaffected.");
3135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3138 /* Attempt a saving throw */
3139 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3140 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3142 note = _("には効果がなかった。", " is unaffected.");
3147 /* Go to sleep (much) later */
3148 note = _("は動けなくなった!", " is suspended!");
3152 /* No "real" damage */
3161 vir = virtue_number(V_HARMONY);
3164 dam += p_ptr->virtues[vir-1]/10;
3167 vir = virtue_number(V_INDIVIDUALISM);
3170 dam -= p_ptr->virtues[vir-1]/20;
3173 if (seen) obvious = TRUE;
3175 /* Attempt a saving throw */
3176 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3180 /* No obvious effect */
3181 note = _("には効果がなかった。", " is unaffected.");
3184 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3186 else if (p_ptr->cursed & TRC_AGGRAVATE)
3188 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3189 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3193 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3196 chg_virtue(V_INDIVIDUALISM, -1);
3197 if (r_ptr->flags3 & RF3_ANIMAL)
3198 chg_virtue(V_NATURE, 1);
3201 /* No "real" damage */
3206 /* Control undead */
3207 case GF_CONTROL_UNDEAD:
3210 if (seen) obvious = TRUE;
3212 vir = virtue_number(V_UNLIFE);
3215 dam += p_ptr->virtues[vir-1]/10;
3218 vir = virtue_number(V_INDIVIDUALISM);
3221 dam -= p_ptr->virtues[vir-1]/20;
3224 /* Attempt a saving throw */
3225 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3226 !(r_ptr->flags3 & RF3_UNDEAD))
3228 /* No obvious effect */
3229 note = _("には効果がなかった。", " is unaffected.");
3231 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3233 else if (p_ptr->cursed & TRC_AGGRAVATE)
3235 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3236 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3240 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3244 /* No "real" damage */
3250 case GF_CONTROL_DEMON:
3253 if (seen) obvious = TRUE;
3255 vir = virtue_number(V_UNLIFE);
3258 dam += p_ptr->virtues[vir-1]/10;
3261 vir = virtue_number(V_INDIVIDUALISM);
3264 dam -= p_ptr->virtues[vir-1]/20;
3267 /* Attempt a saving throw */
3268 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3269 !(r_ptr->flags3 & RF3_DEMON))
3271 /* No obvious effect */
3272 note = _("には効果がなかった。", " is unaffected.");
3274 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3276 else if (p_ptr->cursed & TRC_AGGRAVATE)
3278 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3279 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3283 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3287 /* No "real" damage */
3293 case GF_CONTROL_ANIMAL:
3296 if (seen) obvious = TRUE;
3298 vir = virtue_number(V_NATURE);
3301 dam += p_ptr->virtues[vir-1]/10;
3304 vir = virtue_number(V_INDIVIDUALISM);
3307 dam -= p_ptr->virtues[vir-1]/20;
3310 /* Attempt a saving throw */
3311 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3312 !(r_ptr->flags3 & RF3_ANIMAL))
3315 /* No obvious effect */
3316 note = _("には効果がなかった。", " is unaffected.");
3318 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3320 else if (p_ptr->cursed & TRC_AGGRAVATE)
3322 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3323 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3327 note = _("はなついた。", " is tamed!");
3329 if (r_ptr->flags3 & RF3_ANIMAL)
3330 chg_virtue(V_NATURE, 1);
3333 /* No "real" damage */
3339 case GF_CHARM_LIVING:
3343 vir = virtue_number(V_UNLIFE);
3344 if (seen) obvious = TRUE;
3346 vir = virtue_number(V_UNLIFE);
3349 dam -= p_ptr->virtues[vir-1]/10;
3352 vir = virtue_number(V_INDIVIDUALISM);
3355 dam -= p_ptr->virtues[vir-1]/20;
3358 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3360 /* Attempt a saving throw */
3361 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3362 !monster_living(m_ptr->r_idx))
3365 /* No obvious effect */
3366 note = _("には効果がなかった。", " is unaffected.");
3368 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3370 else if (p_ptr->cursed & TRC_AGGRAVATE)
3372 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3373 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3377 note = _("を支配した。", " is tamed!");
3379 if (r_ptr->flags3 & RF3_ANIMAL)
3380 chg_virtue(V_NATURE, 1);
3383 /* No "real" damage */
3388 /* Confusion (Use "dam" as "power") */
3391 if (seen) obvious = TRUE;
3393 if (r_ptr->flagsr & RFR_RES_ALL)
3395 note = _("には効果がなかった。", " is unaffected.");
3397 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3400 /* Get confused later */
3401 do_conf = damroll(3, (dam / 2)) + 1;
3403 /* Attempt a saving throw */
3404 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3405 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3406 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3408 /* Memorize a flag */
3409 if (r_ptr->flags3 & (RF3_NO_CONF))
3411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3417 /* No obvious effect */
3418 note = _("には効果がなかった。", " is unaffected.");
3422 /* No "real" damage */
3429 if (seen) obvious = TRUE;
3431 if (r_ptr->flagsr & RFR_RES_ALL)
3433 note = _("には効果がなかった。", " is unaffected.");
3435 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3438 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3440 /* Attempt a saving throw */
3441 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3442 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3447 /* No obvious effect */
3448 note = _("には効果がなかった。", " is unaffected.");
3452 /* No "real" damage */
3460 /* Lite, but only hurts susceptible creatures */
3468 if (r_ptr->flagsr & RFR_RES_ALL)
3474 if (r_ptr->flags3 & (RF3_HURT_LITE))
3476 /* Obvious effect */
3477 if (seen) obvious = TRUE;
3479 /* Memorize the effects */
3480 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3482 /* Special effect */
3483 note = _("は光に身をすくめた!", " cringes from the light!");
3484 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3487 /* Normally no damage */
3499 /* Lite -- opposite of Dark */
3502 if (seen) obvious = TRUE;
3504 if (r_ptr->flagsr & RFR_RES_ALL)
3506 note = _("には完全な耐性がある!", " is immune.");
3508 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3511 if (r_ptr->flagsr & RFR_RES_LITE)
3513 note = _("には耐性がある!", " resists!");
3514 dam *= 2; dam /= (randint1(6)+6);
3515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3517 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3519 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3520 note = _("は光に身をすくめた!", " cringes from the light!");
3521 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3528 /* Dark -- opposite of Lite */
3531 if (seen) obvious = TRUE;
3533 if (r_ptr->flagsr & RFR_RES_ALL)
3535 note = _("には完全な耐性がある!", " is immune.");
3537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3540 if (r_ptr->flagsr & RFR_RES_DARK)
3542 note = _("には耐性がある!", " resists!");
3543 dam *= 2; dam /= (randint1(6)+6);
3544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3553 if (r_ptr->flagsr & RFR_RES_ALL)
3558 /* Hurt by rock remover */
3559 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3562 if (seen) obvious = TRUE;
3564 /* Memorize the effects */
3565 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3567 /* Cute little message */
3568 note = _("の皮膚がただれた!", " loses some skin!");
3569 note_dies = _("はドロドロに溶けた!", " dissolves!");
3572 /* Usually, ignore the effects */
3583 /* Teleport undead (Use "dam" as "power") */
3584 case GF_AWAY_UNDEAD:
3586 /* Only affect undead */
3587 if (r_ptr->flags3 & (RF3_UNDEAD))
3589 bool resists_tele = FALSE;
3591 if (r_ptr->flagsr & RFR_RES_TELE)
3593 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3596 note = _("には効果がなかった。", " is unaffected.");
3597 resists_tele = TRUE;
3599 else if (r_ptr->level > randint1(100))
3601 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3602 note = _("には耐性がある!", " resists!");
3603 resists_tele = TRUE;
3609 if (seen) obvious = TRUE;
3610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3622 /* No "real" damage */
3628 /* Teleport evil (Use "dam" as "power") */
3631 /* Only affect evil */
3632 if (r_ptr->flags3 & (RF3_EVIL))
3634 bool resists_tele = FALSE;
3636 if (r_ptr->flagsr & RFR_RES_TELE)
3638 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3641 note = _("には効果がなかった。", " is unaffected.");
3642 resists_tele = TRUE;
3644 else if (r_ptr->level > randint1(100))
3646 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3647 note = _("には耐性がある!", " resists!");
3648 resists_tele = TRUE;
3654 if (seen) obvious = TRUE;
3655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3667 /* No "real" damage */
3673 /* Teleport monster (Use "dam" as "power") */
3676 bool resists_tele = FALSE;
3677 if (r_ptr->flagsr & RFR_RES_TELE)
3679 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3681 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3682 note = _("には効果がなかった。", " is unaffected.");
3683 resists_tele = TRUE;
3685 else if (r_ptr->level > randint1(100))
3687 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3688 note = _("には耐性がある!", " resists!");
3689 resists_tele = TRUE;
3695 if (seen) obvious = TRUE;
3697 /* Prepare to teleport */
3701 /* No "real" damage */
3707 /* Turn undead (Use "dam" as "power") */
3708 case GF_TURN_UNDEAD:
3710 if (r_ptr->flagsr & RFR_RES_ALL)
3715 /* Only affect undead */
3716 if (r_ptr->flags3 & (RF3_UNDEAD))
3718 if (seen) obvious = TRUE;
3720 /* Learn about type */
3721 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3723 /* Apply some fear */
3724 do_fear = damroll(3, (dam / 2)) + 1;
3726 /* Attempt a saving throw */
3727 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3729 /* No obvious effect */
3730 note = _("には効果がなかった。", " is unaffected.");
3743 /* No "real" damage */
3749 /* Turn evil (Use "dam" as "power") */
3752 if (r_ptr->flagsr & RFR_RES_ALL)
3757 /* Only affect evil */
3758 if (r_ptr->flags3 & (RF3_EVIL))
3760 if (seen) obvious = TRUE;
3762 /* Learn about type */
3763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3765 /* Apply some fear */
3766 do_fear = damroll(3, (dam / 2)) + 1;
3768 /* Attempt a saving throw */
3769 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3771 /* No obvious effect */
3772 note = _("には効果がなかった。", " is unaffected.");
3785 /* No "real" damage */
3791 /* Turn monster (Use "dam" as "power") */
3794 if (r_ptr->flagsr & RFR_RES_ALL)
3799 if (seen) obvious = TRUE;
3801 /* Apply some fear */
3802 do_fear = damroll(3, (dam / 2)) + 1;
3804 /* Attempt a saving throw */
3805 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3806 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3807 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3809 /* No obvious effect */
3810 note = _("には効果がなかった。", " is unaffected.");
3815 /* No "real" damage */
3822 case GF_DISP_UNDEAD:
3824 if (r_ptr->flagsr & RFR_RES_ALL)
3830 /* Only affect undead */
3831 if (r_ptr->flags3 & (RF3_UNDEAD))
3833 if (seen) obvious = TRUE;
3835 /* Learn about type */
3836 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3838 note = _("は身震いした。", " shudders.");
3839 note_dies = _("はドロドロに溶けた!", " dissolves!");
3859 if (r_ptr->flagsr & RFR_RES_ALL)
3865 /* Only affect evil */
3866 if (r_ptr->flags3 & (RF3_EVIL))
3868 if (seen) obvious = TRUE;
3870 /* Learn about type */
3871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3873 note = _("は身震いした。", " shudders.");
3874 note_dies = _("はドロドロに溶けた!", " dissolves!");
3893 if (r_ptr->flagsr & RFR_RES_ALL)
3899 /* Only affect good */
3900 if (r_ptr->flags3 & (RF3_GOOD))
3902 if (seen) obvious = TRUE;
3904 /* Learn about type */
3905 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3907 note = _("は身震いした。", " shudders.");
3908 note_dies = _("はドロドロに溶けた!", " dissolves!");
3925 case GF_DISP_LIVING:
3927 if (r_ptr->flagsr & RFR_RES_ALL)
3933 /* Only affect non-undead */
3934 if (monster_living(m_ptr->r_idx))
3936 if (seen) obvious = TRUE;
3938 note = _("は身震いした。", " shudders.");
3939 note_dies = _("はドロドロに溶けた!", " dissolves!");
3958 if (r_ptr->flagsr & RFR_RES_ALL)
3964 /* Only affect demons */
3965 if (r_ptr->flags3 & (RF3_DEMON))
3967 if (seen) obvious = TRUE;
3969 /* Learn about type */
3970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3972 note = _("は身震いした。", " shudders.");
3973 note_dies = _("はドロドロに溶けた!", " dissolves!");
3989 /* Dispel monster */
3992 if (r_ptr->flagsr & RFR_RES_ALL)
3998 if (seen) obvious = TRUE;
4000 note = _("は身震いした。", " shudders.");
4001 note_dies = _("はドロドロに溶けた!", " dissolves!");
4008 if (seen) obvious = TRUE;
4010 if (r_ptr->flagsr & RFR_RES_ALL)
4012 note = _("には完全な耐性がある!", " is immune.");
4014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4018 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4022 /* Heal the monster */
4023 if (caster_ptr->hp < caster_ptr->maxhp)
4026 caster_ptr->hp += dam;
4027 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4029 /* Redraw (later) if needed */
4030 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4031 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4033 /* Special message */
4036 /* Get the monster name */
4037 monster_desc(killer, caster_ptr, 0);
4038 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4044 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4045 (void)hp_player(dam);
4050 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4059 if (seen) obvious = TRUE;
4060 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4062 if (r_ptr->flagsr & RFR_RES_ALL)
4064 note = _("には完全な耐性がある!", " is immune.");
4066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4070 /* Attempt a saving throw */
4071 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4072 (r_ptr->flags3 & RF3_NO_CONF) ||
4073 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4075 /* Memorize a flag */
4076 if (r_ptr->flags3 & (RF3_NO_CONF))
4078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4080 note = _("には効果がなかった。", " is unaffected.");
4083 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4086 note = _("には完全な耐性がある!", " is immune.");
4089 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4092 note = _("には耐性がある。", " resists.");
4097 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4098 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4100 if (who > 0) do_conf = randint0(4) + 4;
4101 else do_conf = randint0(8) + 8;
4107 case GF_BRAIN_SMASH:
4109 if (seen) obvious = TRUE;
4110 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4112 if (r_ptr->flagsr & RFR_RES_ALL)
4114 note = _("には完全な耐性がある!", " is immune.");
4116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4120 /* Attempt a saving throw */
4121 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4122 (r_ptr->flags3 & RF3_NO_CONF) ||
4123 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4125 /* Memorize a flag */
4126 if (r_ptr->flags3 & (RF3_NO_CONF))
4128 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4130 note = _("には効果がなかった。", " is unaffected.");
4133 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4136 note = _("には完全な耐性がある!", " is immune.");
4139 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4142 note = _("には耐性がある!", " resists!");
4147 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4148 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4152 do_conf = randint0(4) + 4;
4153 do_stun = randint0(4) + 4;
4157 do_conf = randint0(8) + 8;
4158 do_stun = randint0(8) + 8;
4160 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4168 if (seen) obvious = TRUE;
4169 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4171 if (r_ptr->flagsr & RFR_RES_ALL)
4173 note = _("には完全な耐性がある!", " is immune.");
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4179 /* Attempt a saving throw */
4180 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4182 note = _("には効果がなかった。", " is unaffected.");
4191 if (seen) obvious = TRUE;
4192 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4194 if (r_ptr->flagsr & RFR_RES_ALL)
4196 note = _("には完全な耐性がある!", " is immune.");
4198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4202 /* Attempt a saving throw */
4203 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4205 note = _("には効果がなかった。", " is unaffected.");
4214 if (seen) obvious = TRUE;
4215 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4217 if (r_ptr->flagsr & RFR_RES_ALL)
4219 note = _("には完全な耐性がある!", " is immune.");
4221 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4225 /* Attempt a saving throw */
4226 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4228 note = _("には効果がなかった。", " is unaffected.");
4237 if (seen) obvious = TRUE;
4239 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4240 "You point at %s, screaming the word, 'DIE!'."), m_name);
4242 if (r_ptr->flagsr & RFR_RES_ALL)
4244 note = _("には完全な耐性がある!", " is immune.");
4246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4250 /* Attempt a saving throw */
4251 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4253 note = _("には効果がなかった。", " is unaffected.");
4262 if (seen) obvious = TRUE;
4264 if (r_ptr->flagsr & RFR_RES_ALL)
4266 note = _("には完全な耐性がある!", " is immune.");
4268 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4272 if (r_ptr->flags1 & RF1_UNIQUE)
4274 note = _("には効果がなかった。", " is unaffected.");
4279 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4280 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4282 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4284 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4288 note = _("は耐性を持っている!", "resists!");
4295 /* Capture monster */
4299 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4300 (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)
4302 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4307 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4308 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4309 nokori_hp = m_ptr->maxhp * 3 / 10;
4311 nokori_hp = m_ptr->maxhp * 3 / 20;
4313 if (m_ptr->hp >= nokori_hp)
4315 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4318 else if (m_ptr->hp < randint0(nokori_hp))
4320 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4321 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4322 cap_mon = m_ptr->r_idx;
4323 cap_mspeed = m_ptr->mspeed;
4325 cap_maxhp = m_ptr->max_maxhp;
4326 cap_nickname = m_ptr->nickname; /* Quark transfer */
4327 if (c_ptr->m_idx == p_ptr->riding)
4329 if (rakuba(-1, FALSE))
4331 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4335 delete_monster_idx(c_ptr->m_idx);
4341 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4347 /* Attack (Use "dam" as attack type) */
4350 /* Return this monster's death */
4351 return py_attack(y, x, dam);
4354 /* Sleep (Use "dam" as "power") */
4360 if (seen) obvious = TRUE;
4362 if (r_ptr->flagsr & RFR_RES_ALL)
4364 note = _("には効果がなかった。", " is unaffected.");
4366 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4369 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4371 note = _("には効果がなかった。", " is unaffected.");
4374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4377 if (MON_CSLEEP(m_ptr))
4379 note = _("には効果がなかった。", " is unaffected.");
4385 if (one_in_(5)) effect = 1;
4386 else if (one_in_(4)) effect = 2;
4387 else if (one_in_(3)) effect = 3;
4392 /* Powerful monsters can resist */
4393 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4394 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4396 note = _("には効果がなかった。", " is unaffected.");
4400 /* Normal monsters slow down */
4403 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4405 note = _("の動きが遅くなった。", " starts moving slower.");
4410 else if (effect == 2)
4412 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4414 /* Attempt a saving throw */
4415 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4416 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4421 /* No obvious effect */
4422 note = _("には効果がなかった。", " is unaffected.");
4427 else if (effect == 3)
4429 /* Attempt a saving throw */
4430 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4431 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4434 /* Memorize a flag */
4435 if (r_ptr->flags3 & RF3_NO_SLEEP)
4437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4440 /* No obvious effect */
4441 note = _("には効果がなかった。", " is unaffected.");
4446 /* Go to sleep (much) later */
4447 note = _("は眠り込んでしまった!", " falls asleep!");
4454 note = _("には効果がなかった。", " is unaffected.");
4457 /* No "real" damage */
4465 if (seen) obvious = TRUE;
4467 if (r_ptr->flagsr & RFR_RES_ALL)
4469 note = _("には効果がなかった。", " is unaffected.");
4471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4475 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4477 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4478 chg_virtue(V_VITALITY, -1);
4488 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4490 if (r_ptr->flags3 & (RF3_HURT_LITE))
4492 /* Obvious effect */
4493 if (seen) obvious = TRUE;
4495 /* Memorize the effects */
4496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4498 /* Special effect */
4499 note = _("は光に身をすくめた!", " cringes from the light!");
4500 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4503 /* Normally no damage */
4510 photo = m_ptr->r_idx;
4517 case GF_BLOOD_CURSE:
4519 if (seen) obvious = TRUE;
4521 if (r_ptr->flagsr & RFR_RES_ALL)
4523 note = _("には完全な耐性がある!", " is immune.");
4525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4533 bool success = FALSE;
4534 if (seen) obvious = TRUE;
4536 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4538 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4539 if (dam < 1) dam = 1;
4541 /* No need to tame your pet */
4544 note = _("の動きが速くなった。", " starts moving faster.");
4545 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4549 /* Attempt a saving throw */
4550 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4551 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4552 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4553 (p_ptr->cursed & TRC_AGGRAVATE) ||
4554 ((r_ptr->level+10) > randint1(dam)))
4557 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4561 note = _("を支配した。", " is tamed!");
4563 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4565 /* Learn about type */
4566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4573 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4575 do_fear = randint1(90)+10;
4577 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4580 /* No "real" damage */
4587 if (seen) obvious = TRUE;
4589 if (r_ptr->flagsr & RFR_RES_ALL)
4591 note = _("には完全な耐性がある!", " is immune.");
4593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4597 /* Attempt a saving throw */
4598 if (randint0(100 + dam) < (r_ptr->level + 50))
4600 note = _("には効果がなかった。", " is unaffected.");
4620 /* Absolutely no effect */
4621 if (skipped) return (FALSE);
4623 /* "Unique" monsters cannot be polymorphed */
4624 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4626 /* Quest monsters cannot be polymorphed */
4627 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4629 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4631 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4632 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4634 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4639 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4640 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4643 /* Modify the damage */
4645 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4646 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4648 /* Check for death */
4649 if (dam > m_ptr->hp)
4651 /* Extract method of death */
4656 /* Sound and Impact resisters never stun */
4658 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4659 !(r_ptr->flags3 & RF3_NO_STUN))
4661 if (seen) obvious = TRUE;
4664 if (MON_STUNNED(m_ptr))
4666 note = _("はひどくもうろうとした。", " is more dazed.");
4667 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4671 note = _("はもうろうとした。", " is dazed.");
4676 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4682 /* Confusion and Chaos resisters (and sleepers) never confuse */
4684 !(r_ptr->flags3 & RF3_NO_CONF) &&
4685 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4687 if (seen) obvious = TRUE;
4689 /* Already partially confused */
4690 if (MON_CONFUSED(m_ptr))
4692 note = _("はさらに混乱したようだ。", " looks more confused.");
4693 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4696 /* Was not confused */
4699 note = _("は混乱したようだ。", " looks confused.");
4703 /* Apply confusion */
4704 (void)set_monster_confused(c_ptr->m_idx, tmp);
4712 if (seen) obvious = TRUE;
4714 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4718 note = _("は弱くなったようだ。", " seems weakened.");
4719 m_ptr->maxhp -= do_time;
4720 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4725 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4726 if (do_poly && (randint1(90) > r_ptr->level))
4728 if (polymorph_monster(y, x))
4730 if (seen) obvious = TRUE;
4732 /* Monster polymorphs */
4733 note = _("が変身した!", " changes!");
4735 /* Turn off the damage */
4741 note = _("には効果がなかった。", " is unaffected.");
4744 /* Hack -- Get new monster */
4745 m_ptr = &m_list[c_ptr->m_idx];
4747 /* Hack -- Get new race */
4748 r_ptr = &r_info[m_ptr->r_idx];
4751 /* Handle "teleport" */
4754 if (seen) obvious = TRUE;
4756 note = _("が消え去った!", " disappears!");
4758 if (!who) chg_virtue(V_VALOUR, -1);
4761 teleport_away(c_ptr->m_idx, do_dist,
4762 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4764 /* Hack -- get new location */
4768 /* Hack -- get new grid */
4769 c_ptr = &cave[y][x];
4776 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4783 if (typ == GF_DRAIN_MANA)
4785 /* Drain mana does nothing */
4788 /* If another monster did the damage, hurt the monster by hand */
4791 /* Redraw (later) if needed */
4792 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4793 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4795 /* Wake the monster up */
4796 (void)set_monster_csleep(c_ptr->m_idx, 0);
4798 /* Hurt the monster */
4806 if (is_pet(m_ptr) && !(m_ptr->ml))
4809 /* Give detailed messages if destroyed */
4812 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4815 msg_format("%^s%s", m_name, note);
4823 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4825 /* Generate treasure, etc */
4826 monster_death(c_ptr->m_idx, FALSE);
4829 delete_monster_idx(c_ptr->m_idx);
4833 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4837 /* Damaged monster */
4840 /* Give detailed messages if visible or destroyed */
4841 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4843 /* Hack -- Pain message */
4846 message_pain(c_ptr->m_idx, dam);
4853 /* Hack -- handle sleep */
4854 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4858 else if (heal_leper)
4860 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4862 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4866 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4867 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4870 delete_monster_idx(c_ptr->m_idx);
4873 /* If the player did it, give him experience, check fear */
4878 /* Hurt the monster, check for fear and death */
4879 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4884 /* Damaged monster */
4887 /* HACK - anger the monster before showing the sleep message */
4888 if (do_sleep) anger_monster(m_ptr);
4890 /* Give detailed messages if visible or destroyed */
4891 if (note && seen_msg)
4892 msg_format(_("%s%s", "%^s%s"), m_name, note);
4894 /* Hack -- Pain message */
4895 else if (known && (dam || !do_fear))
4897 message_pain(c_ptr->m_idx, dam);
4900 /* Anger monsters */
4901 if (((dam > 0) || get_angry) && !do_sleep)
4902 anger_monster(m_ptr);
4905 if ((fear || do_fear) && seen)
4909 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4912 /* Hack -- handle sleep */
4913 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4917 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4919 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4923 switch (randint1(28))
4928 msg_print(_("地面が揺れた...", "The ground trembles..."));
4929 earthquake(ty, tx, 4 + randint0(4));
4930 if (!one_in_(6)) break;
4932 case 3: case 4: case 5: case 6:
4935 int extra_dam = damroll(10, 10);
4936 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4938 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4939 if (!one_in_(6)) break;
4944 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4946 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4947 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4948 if (!one_in_(6)) break;
4950 case 9: case 10: case 11:
4951 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4952 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4953 if (!one_in_(6)) break;
4954 case 12: case 13: case 14: case 15: case 16:
4955 aggravate_monsters(0);
4956 if (!one_in_(6)) break;
4958 count += activate_hi_summon(ty, tx, TRUE);
4959 if (!one_in_(6)) break;
4960 case 19: case 20: case 21: case 22:
4962 bool pet = !one_in_(3);
4963 BIT_FLAGS mode = PM_ALLOW_GROUP;
4965 if (pet) mode |= PM_FORCE_PET;
4966 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4968 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);
4969 if (!one_in_(6)) break;
4971 case 23: case 24: case 25:
4972 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4973 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4975 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4976 else lose_exp(p_ptr->exp / 16);
4977 if (!one_in_(6)) break;
4978 case 26: case 27: case 28:
4987 (void)do_dec_stat(i);
4996 (void)do_dec_stat(randint0(6));
5005 if (p_ptr->inside_battle)
5007 p_ptr->health_who = c_ptr->m_idx;
5008 p_ptr->redraw |= (PR_HEALTH);
5012 /* Verify this code */
5013 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5015 /* Redraw the monster grid */
5019 /* Update monster recall window */
5020 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5022 p_ptr->window |= (PW_MONSTER);
5025 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5029 if (!(flg & PROJECT_NO_HANGEKI))
5031 set_target(m_ptr, monster_target_y, monster_target_x);
5034 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5036 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5040 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5042 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5043 rakubadam_m = (dam > 200) ? 200 : dam;
5053 /* Prepare to make a Blade of Chaos */
5054 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5056 q_ptr->pval = photo;
5058 /* Mark the item as fully known */
5059 q_ptr->ident |= (IDENT_MENTAL);
5061 /* Drop it in the dungeon */
5062 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5070 /* Return "Anything seen?" */
5075 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5076 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5077 * @param who_name 効果を起こしたモンスターの名前
5078 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5079 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5080 * @param x 目標X座標 / Target x location (or location to travel "towards")
5081 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5082 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5084 * @param monspell 効果元のモンスター魔法ID
5085 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5087 * Handle a beam/bolt/ball causing damage to the player.
5088 * This routine takes a "source monster" (by index), a "distance", a default
5089 * "damage", and a "damage type". See "project_m()" above.
5090 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5091 * is reduced (see "project_m()" above). This can happen if a monster breathes
5092 * at the player and hits a wall instead.
5093 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5094 * to know if this is actually a ball or a bolt spell
5095 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5096 * we just assume that the effects were obvious, for historical reasons.
5098 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)
5103 /* Hack -- assume obvious */
5104 bool obvious = TRUE;
5106 /* Player blind-ness */
5107 bool blind = (p_ptr->blind ? TRUE : FALSE);
5109 /* Player needs a "description" (he is blind) */
5112 /* Source monster */
5113 monster_type *m_ptr = NULL;
5115 /* Monster name (for attacks) */
5118 /* Monster name (for damage) */
5121 /* Hack -- messages */
5127 /* Player is not here */
5128 if (!player_bold(y, x)) return (FALSE);
5130 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5132 if (kawarimi(TRUE)) return FALSE;
5135 /* Player cannot hurt himself */
5136 if (!who) return (FALSE);
5137 if (who == p_ptr->riding) return (FALSE);
5139 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5142 int max_attempts = 10;
5143 sound(SOUND_REFLECT);
5146 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5147 else if (p_ptr->special_defense & KATA_FUUJIN)
5148 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5150 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5153 /* Choose 'new' target */
5158 t_y = m_list[who].fy - 1 + randint1(3);
5159 t_x = m_list[who].fx - 1 + randint1(3);
5162 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5164 if (max_attempts < 1)
5166 t_y = m_list[who].fy;
5167 t_x = m_list[who].fx;
5172 t_y = p_ptr->y - 1 + randint1(3);
5173 t_x = p_ptr->x - 1 + randint1(3);
5176 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5178 disturb(TRUE, TRUE);
5182 /* Limit maximum damage */
5183 if (dam > 1600) dam = 1600;
5185 /* Reduce damage by distance */
5186 dam = (dam + r) / (r + 1);
5189 /* If the player is blind, be more descriptive */
5190 if (blind) fuzzy = TRUE;
5195 /* Get the source monster */
5196 m_ptr = &m_list[who];
5197 /* Extract the monster level */
5198 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5200 /* Get the monster name */
5201 monster_desc(m_name, m_ptr, 0);
5203 /* Get the monster's real name (gotten before polymorph!) */
5204 strcpy(killer, who_name);
5210 case PROJECT_WHO_UNCTRL_POWER:
5211 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5214 case PROJECT_WHO_GLASS_SHARDS:
5215 strcpy(killer, _("ガラスの破片", "shards of glass"));
5219 strcpy(killer, _("罠", "a trap"));
5224 strcpy(m_name, killer);
5227 /* Analyze the damage */
5230 /* Standard damage -- hurts inventory too */
5233 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5234 get_damage = acid_dam(dam, killer, monspell, FALSE);
5238 /* Standard damage -- hurts inventory too */
5241 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5242 get_damage = fire_dam(dam, killer, monspell, FALSE);
5246 /* Standard damage -- hurts inventory too */
5249 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5250 get_damage = cold_dam(dam, killer, monspell, FALSE);
5254 /* Standard damage -- hurts inventory too */
5257 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5258 get_damage = elec_dam(dam, killer, monspell, FALSE);
5262 /* Standard damage -- also poisons player */
5265 bool double_resist = IS_OPPOSE_POIS();
5266 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5268 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5269 if (double_resist) dam = (dam + 2) / 3;
5271 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5276 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5278 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5280 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5285 /* Standard damage -- also poisons / mutates player */
5288 bool double_resist = IS_OPPOSE_POIS();
5289 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5291 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5292 if (double_resist) dam = (2 * dam + 2) / 5;
5293 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5294 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5296 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5298 if (one_in_(5)) /* 6 */
5300 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5301 if (one_in_(4)) /* 4 */
5309 inven_damage(set_acid_destroy, 2);
5315 /* Standard damage */
5318 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5319 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5323 /* Holy Orb -- Player only takes partial damage */
5326 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5327 if (p_ptr->align > 10)
5329 else if (p_ptr->align < -10)
5331 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5337 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5338 if (p_ptr->align > 10)
5340 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5344 /* Arrow -- XXX no dodging */
5349 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5351 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5353 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5360 /* Plasma -- XXX No resist */
5363 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5364 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5366 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5368 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5369 (void)set_stun(p_ptr->stun + plus_stun);
5372 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5374 inven_damage(set_acid_destroy, 3);
5380 /* Nether -- drain experience */
5383 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5384 if (p_ptr->resist_neth)
5386 if (!prace_is_(RACE_SPECTRE))
5388 dam *= 6; dam /= (randint1(4) + 7);
5391 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5393 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5395 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5397 learn_spell(monspell);
5401 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5407 /* Water -- stun/confuse */
5410 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5411 if (!CHECK_MULTISHADOW())
5413 if (!p_ptr->resist_sound)
5415 set_stun(p_ptr->stun + randint1(40));
5417 if (!p_ptr->resist_conf)
5419 set_confused(p_ptr->confused + randint1(5) + 5);
5424 inven_damage(set_cold_destroy, 3);
5428 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5432 /* Chaos -- many effects */
5435 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5436 if (p_ptr->resist_chaos)
5438 dam *= 6; dam /= (randint1(4) + 7);
5441 if (!CHECK_MULTISHADOW())
5443 if (!p_ptr->resist_conf)
5445 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5447 if (!p_ptr->resist_chaos)
5449 (void)set_image(p_ptr->image + randint1(10));
5452 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5453 (void)gain_random_mutation(0);
5456 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5458 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5461 if (!p_ptr->resist_chaos || one_in_(9))
5463 inven_damage(set_elec_destroy, 2);
5464 inven_damage(set_fire_destroy, 2);
5468 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5472 /* Shards -- mostly cutting */
5475 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5476 if (p_ptr->resist_shard)
5478 dam *= 6; dam /= (randint1(4) + 7);
5480 else if (!CHECK_MULTISHADOW())
5482 (void)set_cut(p_ptr->cut + dam);
5485 if (!p_ptr->resist_shard || one_in_(13))
5487 inven_damage(set_cold_destroy, 2);
5490 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5494 /* Sound -- mostly stunning */
5497 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5498 if (p_ptr->resist_sound)
5500 dam *= 5; dam /= (randint1(4) + 7);
5502 else if (!CHECK_MULTISHADOW())
5504 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5505 (void)set_stun(p_ptr->stun + plus_stun);
5508 if (!p_ptr->resist_sound || one_in_(13))
5510 inven_damage(set_cold_destroy, 2);
5513 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5517 /* Pure confusion */
5520 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5521 if (p_ptr->resist_conf)
5523 dam *= 5; dam /= (randint1(4) + 7);
5525 else if (!CHECK_MULTISHADOW())
5527 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5529 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5533 /* Disenchantment -- see above */
5536 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5537 if (p_ptr->resist_disen)
5539 dam *= 6; dam /= (randint1(4) + 7);
5541 else if (!CHECK_MULTISHADOW())
5543 (void)apply_disenchant(0);
5545 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5549 /* Nexus -- see above */
5552 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5553 if (p_ptr->resist_nexus)
5555 dam *= 6; dam /= (randint1(4) + 7);
5557 else if (!CHECK_MULTISHADOW())
5561 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5565 /* Force -- mostly stun */
5568 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5569 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5571 (void)set_stun(p_ptr->stun + randint1(20));
5573 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5578 /* Rocket -- stun, cut */
5581 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5582 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5584 (void)set_stun(p_ptr->stun + randint1(20));
5587 if (p_ptr->resist_shard)
5591 else if (!CHECK_MULTISHADOW())
5593 (void)set_cut(p_ptr->cut + (dam / 2));
5596 if (!p_ptr->resist_shard || one_in_(12))
5598 inven_damage(set_cold_destroy, 3);
5601 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5605 /* Inertia -- slowness */
5608 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5609 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5610 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5614 /* Lite -- blinding */
5617 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5618 if (p_ptr->resist_lite)
5620 dam *= 4; dam /= (randint1(4) + 7);
5622 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5624 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5627 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5629 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5632 else if (prace_is_(RACE_S_FAIRY))
5637 if (p_ptr->wraith_form) dam *= 2;
5638 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5640 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5642 p_ptr->wraith_form = 0;
5643 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5644 "The light forces you out of your incorporeal shadow form."));
5646 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5647 p_ptr->update |= (PU_MONSTERS);
5648 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5654 /* Dark -- blinding */
5657 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5658 if (p_ptr->resist_dark)
5660 dam *= 4; dam /= (randint1(4) + 7);
5662 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5664 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5666 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5668 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5672 /* Time -- bolt fewer effects XXX */
5675 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5676 if (p_ptr->resist_time)
5679 dam /= (randint1(4) + 7);
5680 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5682 else if (!CHECK_MULTISHADOW())
5684 switch (randint1(10))
5686 case 1: case 2: case 3: case 4: case 5:
5688 if (p_ptr->prace == RACE_ANDROID) break;
5689 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5690 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5694 case 6: case 7: case 8: case 9:
5696 switch (randint1(6))
5698 case 1: k = A_STR; act = _("強く", "strong"); break;
5699 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5700 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5701 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5702 case 5: k = A_CON; act = _("健康で", "hale"); break;
5703 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5706 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5707 "You're not as %s as you used to be..."), act);
5709 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5710 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5711 p_ptr->update |= (PU_BONUS);
5717 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5718 "You're not as powerful as you used to be..."));
5720 for (k = 0; k < 6; k++)
5722 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5723 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5725 p_ptr->update |= (PU_BONUS);
5731 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5735 /* Gravity -- stun plus slowness plus teleport */
5738 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5739 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5741 if (!CHECK_MULTISHADOW())
5743 teleport_player(5, TELEPORT_PASSIVE);
5744 if (!p_ptr->levitation)
5745 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5746 if (!(p_ptr->resist_sound || p_ptr->levitation))
5748 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5749 (void)set_stun(p_ptr->stun + plus_stun);
5752 if (p_ptr->levitation)
5754 dam = (dam * 2) / 3;
5757 if (!p_ptr->levitation || one_in_(13))
5759 inven_damage(set_cold_destroy, 2);
5762 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5766 /* Standard damage */
5767 case GF_DISINTEGRATE:
5769 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5771 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5777 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5779 (void)hp_player(dam);
5786 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5787 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5794 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5795 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5801 if (p_ptr->free_act) break;
5802 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5804 if (ironman_nightmare)
5806 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5807 /* Have some nightmares */
5808 sanity_blast(NULL, FALSE);
5811 set_paralyzed(p_ptr->paralyzed + dam);
5821 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5822 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5829 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5830 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5837 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5839 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5840 if (!p_ptr->resist_shard || one_in_(13))
5842 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5843 inven_damage(set_cold_destroy, 2);
5849 /* Ice -- cold plus stun plus cuts */
5852 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5853 get_damage = cold_dam(dam, killer, monspell, FALSE);
5854 if (!CHECK_MULTISHADOW())
5856 if (!p_ptr->resist_shard)
5858 (void)set_cut(p_ptr->cut + damroll(5, 8));
5860 if (!p_ptr->resist_sound)
5862 (void)set_stun(p_ptr->stun + randint1(15));
5865 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5867 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5877 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5879 if (p_ptr->mimic_form)
5881 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5882 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5887 switch (p_ptr->prace)
5889 /* Some races are immune */
5903 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5915 if (CHECK_MULTISHADOW())
5917 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5919 else if (p_ptr->csp)
5923 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5925 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5928 if (dam >= p_ptr->csp)
5932 p_ptr->csp_frac = 0;
5941 learn_spell(monspell);
5942 p_ptr->redraw |= (PR_MANA);
5943 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5947 /* Heal the monster */
5948 if (m_ptr->hp < m_ptr->maxhp)
5952 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5954 /* Redraw (later) if needed */
5955 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5956 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5958 /* Special message */
5961 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5974 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5976 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5977 learn_spell(monspell);
5981 if (!CHECK_MULTISHADOW())
5983 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5985 if (!p_ptr->resist_conf)
5987 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5990 if (!p_ptr->resist_chaos && one_in_(3))
5992 (void)set_image(p_ptr->image + randint0(250) + 150);
5999 p_ptr->csp_frac = 0;
6001 p_ptr->redraw |= PR_MANA;
6004 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6010 case GF_BRAIN_SMASH:
6012 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6014 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6015 learn_spell(monspell);
6019 if (!CHECK_MULTISHADOW())
6021 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6027 p_ptr->csp_frac = 0;
6029 p_ptr->redraw |= PR_MANA;
6032 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6033 if (!CHECK_MULTISHADOW())
6035 if (!p_ptr->resist_blind)
6037 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6039 if (!p_ptr->resist_conf)
6041 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6043 if (!p_ptr->free_act)
6045 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6047 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6049 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6050 (void)do_dec_stat(A_INT);
6051 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6052 (void)do_dec_stat(A_WIS);
6054 if (!p_ptr->resist_chaos)
6056 (void)set_image(p_ptr->image + randint0(250) + 150);
6066 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6068 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6069 learn_spell(monspell);
6073 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6074 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6082 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6084 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6085 learn_spell(monspell);
6089 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6090 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6098 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6100 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6101 learn_spell(monspell);
6105 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6106 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6114 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6116 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6117 learn_spell(monspell);
6121 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6122 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6130 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6132 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6133 learn_spell(monspell);
6137 if (!CHECK_MULTISHADOW())
6139 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6140 curse_equipment(40, 20);
6143 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6145 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6160 /* Hex - revenge damage stored */
6161 revenge_store(get_damage);
6163 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6164 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6166 char m_name_self[80];
6169 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6171 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6172 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6173 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6176 if (p_ptr->riding && dam > 0)
6178 rakubadam_p = (dam > 200) ? 200 : dam;
6182 disturb(TRUE, TRUE);
6185 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6187 (void)kawarimi(FALSE);
6190 /* Return "Anything seen?" */
6196 * Find the distance from (x, y) to a line.
6198 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6200 /* Vector from (x, y) to (x1, y1) */
6201 POSITION py = y1 - y;
6202 POSITION px = x1 - x;
6205 POSITION ny = x2 - x1;
6206 POSITION nx = y1 - y2;
6209 POSITION pd = distance(y1, x1, y, x);
6210 POSITION nd = distance(y1, x1, y2, x2);
6212 if (pd > nd) return distance(y, x, y2, x2);
6214 /* Component of P on N */
6215 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6217 /* Absolute value */
6218 return((nd >= 0) ? nd : 0 - nd);
6225 * Modified version of los() for calculation of disintegration balls.
6226 * Disintegration effects are stopped by permanent walls.
6228 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6230 POSITION dx, dy; /* Delta */
6231 POSITION ax, ay; /* Absolute */
6232 POSITION sx, sy; /* Signs */
6233 POSITION qx, qy; /* Fractions */
6234 POSITION tx, ty; /* Scanners */
6235 POSITION f1, f2; /* Scale factors */
6236 POSITION m; /* Slope, or 1/Slope, of LOS */
6238 /* Extract the offset */
6242 /* Extract the absolute offset */
6246 /* Handle adjacent (or identical) grids */
6247 if ((ax < 2) && (ay < 2)) return (TRUE);
6249 /* Paranoia -- require "safe" origin */
6250 /* if (!in_bounds(y1, x1)) return (FALSE); */
6252 /* Directly South/North */
6255 /* South -- check for walls */
6258 for (ty = y1 + 1; ty < y2; ty++)
6260 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6264 /* North -- check for walls */
6267 for (ty = y1 - 1; ty > y2; ty--)
6269 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6277 /* Directly East/West */
6280 /* East -- check for walls */
6283 for (tx = x1 + 1; tx < x2; tx++)
6285 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6289 /* West -- check for walls */
6292 for (tx = x1 - 1; tx > x2; tx--)
6294 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6302 /* Extract some signs */
6303 sx = (dx < 0) ? -1 : 1;
6304 sy = (dy < 0) ? -1 : 1;
6306 /* Vertical "knights" */
6311 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6315 /* Horizontal "knights" */
6320 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6324 /* Calculate scale factor div 2 */
6327 /* Calculate scale factor */
6331 /* Travel horizontally */
6334 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6340 /* Consider the special case where slope == 1. */
6351 /* Note (below) the case (qy == f2), where */
6352 /* the LOS exactly meets the corner of a tile. */
6355 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6366 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6379 /* Travel vertically */
6382 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6398 /* Note (below) the case (qx == f2), where */
6399 /* the LOS exactly meets the corner of a tile. */
6402 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6413 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6434 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)
6439 int brev = rad * rad / dist;
6443 int mdis = distance(y1, x1, y2, x2) + rad;
6445 while (bdis <= mdis)
6449 if ((0 < dist) && (path_n < dist))
6451 POSITION ny = GRID_Y(path_g[path_n]);
6452 POSITION nx = GRID_X(path_g[path_n]);
6453 POSITION nd = distance(ny, nx, y1, x1);
6455 /* Get next base point */
6464 /* Travel from center outward */
6465 for (cdis = 0; cdis <= brad; cdis++)
6467 /* Scan the maximal blast area of radius "cdis" */
6468 for (y = by - cdis; y <= by + cdis; y++)
6470 for (x = bx - cdis; x <= bx + cdis; x++)
6472 /* Ignore "illegal" locations */
6473 if (!in_bounds(y, x)) continue;
6475 /* Enforce a circular "ripple" */
6476 if (distance(y1, x1, y, x) != bdis) continue;
6478 /* Enforce an arc */
6479 if (distance(by, bx, y, x) != cdis) continue;
6485 /* Lights are stopped by opaque terrains */
6486 if (!los(by, bx, y, x)) continue;
6488 case GF_DISINTEGRATE:
6489 /* Disintegration are stopped only by perma-walls */
6490 if (!in_disintegration_range(by, bx, y, x)) continue;
6493 /* Ball explosions are stopped by walls */
6494 if (!projectable(by, bx, y, x)) continue;
6498 /* Save this grid */
6506 /* Encode some more "radius" info */
6507 gm[bdis + 1] = *pgrids;
6509 /* Increase the size */
6510 brad = rad * (path_n + brev) / (dist + brev);
6512 /* Find the next ripple */
6516 /* Store the effect size */
6522 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6523 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6524 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6525 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6526 * @param x 目標X座標 / Target x location (or location to travel "towards")
6527 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6528 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6529 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6530 * @param monspell 効果元のモンスター魔法ID
6531 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6534 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6535 * towards a given location (optionally passing over the heads of interposing
6536 * monsters), and have it do a given amount of damage to the monsters (and
6537 * optionally objects) within the given radius of the final location.
6539 * A "bolt" travels from source to target and affects only the target grid.
6540 * A "beam" travels from source to target, affecting all grids passed through.
6541 * A "ball" travels from source to the target, exploding at the target, and
6542 * affecting everything within the given radius of the target location.
6544 * Traditionally, a "bolt" does not affect anything on the ground, and does
6545 * not pass over the heads of interposing monsters, much like a traditional
6546 * missile, and will "stop" abruptly at the "target" even if no monster is
6547 * positioned there, while a "ball", on the other hand, passes over the heads
6548 * of monsters between the source and target, and affects everything except
6549 * the source monster which lies within the final radius, while a "beam"
6550 * affects every monster between the source and target, except for the casting
6551 * monster (or player), and rarely affects things on the ground.
6553 * Two special flags allow us to use this function in special ways, the
6554 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6555 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6556 * actually projecting from the source monster (or player).
6558 * The player will only get "experience" for monsters killed by himself
6559 * Unique monsters can only be destroyed by attacks from the player
6561 * Only 256 grids can be affected per projection, limiting the effective
6562 * "radius" of standard ball attacks to nine units (diameter nineteen).
6564 * One can project in a given "direction" by combining PROJECT_THRU with small
6565 * offsets to the initial location (see "line_spell()"), or by calculating
6566 * "virtual targets" far away from the player.
6568 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6569 * continuing until it actually hits somethings (useful for "stone to mud").
6571 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6573 * Balls must explode BEFORE hitting walls, or they would affect monsters
6574 * on both sides of a wall. Some bug reports indicate that this is still
6575 * happening in 2.7.8 for Windows, though it appears to be impossible.
6577 * We "pre-calculate" the blast area only in part for efficiency.
6578 * More importantly, this lets us do "explosions" from the "inside" out.
6579 * This results in a more logical distribution of "blast" treasure.
6580 * It also produces a better (in my opinion) animation of the explosion.
6581 * It could be (but is not) used to have the treasure dropped by monsters
6582 * in the middle of the explosion fall "outwards", and then be damaged by
6583 * the blast as it spreads outwards towards the treasure drop location.
6585 * Walls and doors are included in the blast area, so that they can be
6586 * "burned" or "melted" in later versions.
6588 * This algorithm is intended to maximize simplicity, not necessarily
6589 * efficiency, since this function is not a bottleneck in the code.
6591 * We apply the blast effect from ground zero outwards, in several passes,
6592 * first affecting features, then objects, then monsters, then the player.
6593 * This allows walls to be removed before checking the object or monster
6594 * in the wall, and protects objects which are dropped by monsters killed
6595 * in the blast, and allows the player to see all affects before he is
6596 * killed or teleported away. The semantics of this method are open to
6597 * various interpretations, but they seem to work well in practice.
6599 * We process the blast area from ground-zero outwards to allow for better
6600 * distribution of treasure dropped by monsters, and because it provides a
6601 * pleasing visual effect at low cost.
6603 * Note that the damage done by "ball" explosions decreases with distance.
6604 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6606 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6607 * the target, and then the damage "flows" along this beam of destruction.
6608 * The damage at every grid is the same as at the "center" of a "ball"
6609 * explosion, since the "beam" grids are treated as if they ARE at the
6610 * center of a "ball" explosion.
6612 * Currently, specifying "beam" plus "ball" means that locations which are
6613 * covered by the initial "beam", and also covered by the final "ball", except
6614 * for the final grid (the epicenter of the ball), will be "hit twice", once
6615 * by the initial beam, and once by the exploding ball. For the grid right
6616 * next to the epicenter, this results in 150% damage being done. The center
6617 * does not have this problem, for the same reason the final grid in a "beam"
6618 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6619 * grids which are covered by the "ball" will NOT work, as then they will
6620 * receive LESS damage than they should. Do not combine "beam" with "ball".
6622 * The array "gy[],gx[]" with current size "grids" is used to hold the
6623 * collected locations of all grids in the "blast area" plus "beam path".
6625 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6626 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6627 * first blast grid (see above) with radius "N" from the blast center. Note
6628 * that only the first gm[1] grids in the blast area thus take full damage.
6629 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6630 * number of blast grids.
6632 * Note that once the projection is complete, (y2,x2) holds the final location
6633 * of bolts/beams, and the "epicenter" of balls.
6635 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6636 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6637 * implementation of the "distance" function. Also, a bolt can be properly
6638 * viewed as a "ball" with a "rad" of "zero".
6640 * Note that if no "target" is reached before the beam/bolt/ball travels the
6641 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6642 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6644 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6645 * to move from point A to point B, even if the player cannot see part of the
6646 * projection path. Note that in general, the player will *always* see part
6647 * of the path, since it either starts at the player or ends on the player.
6649 * Hack -- we assume that every "projection" is "self-illuminating".
6651 * Hack -- when only a single monster is affected, we automatically track
6652 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6654 * Note that all projections now "explode" at their final destination, even
6655 * if they were being projected at a more distant destination. This means
6656 * that "ball" spells will *always* explode.
6658 * Note that we must call "handle_stuff()" after affecting terrain features
6659 * in the blast radius, in case the "illumination" of the grid was changed,
6660 * and "update_view()" and "update_monsters()" need to be called.
6663 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6673 POSITION y_saver, x_saver; /* For reflecting monsters */
6675 int msec = delay_factor * delay_factor * delay_factor;
6677 /* Assume the player sees nothing */
6678 bool notice = FALSE;
6680 /* Assume the player has seen nothing */
6681 bool visual = FALSE;
6683 /* Assume the player has seen no blast grids */
6686 /* Assume to be a normal ball spell */
6687 bool breath = FALSE;
6689 /* Is the player blind? */
6690 bool blind = (p_ptr->blind ? TRUE : FALSE);
6692 bool old_hide = FALSE;
6694 /* Number of grids in the "path" */
6697 /* Actual grids in the "path" */
6700 /* Number of grids in the "blast area" (including the "beam" path) */
6703 /* Coordinates of the affected grids */
6704 POSITION gx[1024], gy[1024];
6706 /* Encoded "radius" info (see above) */
6709 /* Actual radius encoded in gm[] */
6710 POSITION gm_rad = rad;
6714 /* Attacker's name (prepared before polymorph)*/
6717 /* Can the player see the source of this effect? */
6718 bool see_s_msg = TRUE;
6720 /* Initialize by null string */
6726 /* Default target of monsterspell is player */
6727 monster_target_y = p_ptr->y;
6728 monster_target_x = p_ptr->x;
6730 /* Hack -- Jump to target */
6731 if (flg & (PROJECT_JUMP))
6736 /* Clear the flag */
6737 flg &= ~(PROJECT_JUMP);
6742 /* Start at player */
6749 /* Start at monster */
6752 x1 = m_list[who].fx;
6753 y1 = m_list[who].fy;
6754 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6766 /* Default "destination" */
6771 /* Hack -- verify stuff */
6772 if (flg & (PROJECT_THRU))
6774 if ((x1 == x2) && (y1 == y2))
6776 flg &= ~(PROJECT_THRU);
6780 /* Handle a breath attack */
6785 if (flg & PROJECT_HIDE) old_hide = TRUE;
6786 flg |= PROJECT_HIDE;
6790 /* Hack -- Assume there will be no blast (max radius 32) */
6791 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6799 /* Collect beam grids */
6800 if (flg & (PROJECT_BEAM))
6811 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6813 case GF_DISINTEGRATE:
6814 flg |= (PROJECT_GRID);
6815 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6819 /* Calculate the projection path */
6821 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6824 /* Giga-Hack SEEKER & SUPER_RAY */
6826 if( typ == GF_SEEKER )
6836 for (i = 0; i < path_n; ++i)
6841 int ny = GRID_Y(path_g[i]);
6842 int nx = GRID_X(path_g[i]);
6853 /* Only do visuals if requested */
6854 if (!blind && !(flg & (PROJECT_HIDE)))
6856 /* Only do visuals if the player can "see" the bolt */
6857 if (panel_contains(y, x) && player_has_los_bold(y, x))
6864 /* Obtain the bolt pict */
6865 p = bolt_pict(oy, ox, y, x, typ);
6867 /* Extract attr/char */
6871 /* Visual effects */
6872 print_rel(c, a, y, x);
6873 move_cursor_relative(y, x);
6874 /*if (fresh_before)*/ Term_fresh();
6875 Term_xtra(TERM_XTRA_DELAY, msec);
6877 /*if (fresh_before)*/ Term_fresh();
6879 /* Display "beam" grids */
6880 if (flg & (PROJECT_BEAM))
6882 /* Obtain the explosion pict */
6883 p = bolt_pict(y, x, y, x, typ);
6885 /* Extract attr/char */
6889 /* Visual effects */
6890 print_rel(c, a, y, x);
6893 /* Hack -- Activate delay */
6897 /* Hack -- delay anyway for consistency */
6900 /* Delay for consistency */
6901 Term_xtra(TERM_XTRA_DELAY, msec);
6904 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6905 if (is_mirror_grid(&cave[y][x]))
6907 /* The target of monsterspell becomes tha mirror(broken) */
6908 monster_target_y = y;
6909 monster_target_x = x;
6911 remove_mirror(y, x);
6912 next_mirror(&oy, &ox, y, x);
6914 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6915 for (j = last_i; j <= i; j++)
6917 y = GRID_Y(path_g[j]);
6918 x = GRID_X(path_g[j]);
6919 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6920 if (!who && (project_m_n == 1) && !jump) {
6921 if (cave[project_m_y][project_m_x].m_idx > 0) {
6922 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6926 /* Hack -- auto-recall */
6927 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6929 /* Hack - auto-track */
6930 health_track(cave[project_m_y][project_m_x].m_idx);
6934 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6939 for(i = last_i ; i < path_n ; i++)
6942 py = GRID_Y(path_g[i]);
6943 px = GRID_X(path_g[i]);
6944 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6946 if (!who && (project_m_n == 1) && !jump) {
6947 if (cave[project_m_y][project_m_x].m_idx > 0)
6949 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6953 /* Hack -- auto-recall */
6954 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6956 /* Hack - auto-track */
6957 health_track(cave[project_m_y][project_m_x].m_idx);
6961 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6965 else if(typ == GF_SUPER_RAY){
6967 int second_step = 0;
6974 for (i = 0; i < path_n; ++i)
6979 POSITION ny = GRID_Y(path_g[i]);
6980 POSITION nx = GRID_X(path_g[i]);
6991 /* Only do visuals if requested */
6992 if (!blind && !(flg & (PROJECT_HIDE)))
6994 /* Only do visuals if the player can "see" the bolt */
6995 if (panel_contains(y, x) && player_has_los_bold(y, x))
7002 /* Obtain the bolt pict */
7003 p = bolt_pict(oy, ox, y, x, typ);
7005 /* Extract attr/char */
7009 /* Visual effects */
7010 print_rel(c, a, y, x);
7011 move_cursor_relative(y, x);
7012 /*if (fresh_before)*/ Term_fresh();
7013 Term_xtra(TERM_XTRA_DELAY, msec);
7015 /*if (fresh_before)*/ Term_fresh();
7017 /* Display "beam" grids */
7018 if (flg & (PROJECT_BEAM))
7020 /* Obtain the explosion pict */
7021 p = bolt_pict(y, x, y, x, typ);
7023 /* Extract attr/char */
7027 /* Visual effects */
7028 print_rel(c, a, y, x);
7031 /* Hack -- Activate delay */
7035 /* Hack -- delay anyway for consistency */
7038 /* Delay for consistency */
7039 Term_xtra(TERM_XTRA_DELAY, msec);
7042 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7043 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7045 if( second_step )continue;
7048 if( is_mirror_grid(&cave[y][x]) && !second_step )
7050 /* The target of monsterspell becomes tha mirror(broken) */
7051 monster_target_y=(s16b)y;
7052 monster_target_x=(s16b)x;
7055 for( j = 0; j <=i ; j++ )
7057 y = GRID_Y(path_g[j]);
7058 x = GRID_X(path_g[j]);
7059 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7063 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7064 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7065 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7066 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7067 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7068 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7069 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7070 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7073 for( i = 0; i < path_n ; i++ )
7076 py = GRID_Y(path_g[i]);
7077 px = GRID_X(path_g[i]);
7078 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7079 if(!who && (project_m_n == 1) && !jump){
7080 if(cave[project_m_y][project_m_x].m_idx >0 ){
7081 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7085 /* Hack -- auto-recall */
7086 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7088 /* Hack - auto-track */
7089 health_track(cave[project_m_y][project_m_x].m_idx);
7093 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7098 /* Project along the path */
7099 for (i = 0; i < path_n; ++i)
7104 POSITION ny = GRID_Y(path_g[i]);
7105 POSITION nx = GRID_X(path_g[i]);
7107 if (flg & PROJECT_DISI)
7109 /* Hack -- Balls explode before reaching walls */
7110 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7112 else if (flg & PROJECT_LOS)
7114 /* Hack -- Balls explode before reaching walls */
7115 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7119 /* Hack -- Balls explode before reaching walls */
7120 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7127 /* Collect beam grids */
7128 if (flg & (PROJECT_BEAM))
7135 /* Only do visuals if requested */
7136 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7138 /* Only do visuals if the player can "see" the bolt */
7139 if (panel_contains(y, x) && player_has_los_bold(y, x))
7146 /* Obtain the bolt pict */
7147 p = bolt_pict(oy, ox, y, x, typ);
7149 /* Extract attr/char */
7153 /* Visual effects */
7154 print_rel(c, a, y, x);
7155 move_cursor_relative(y, x);
7156 /*if (fresh_before)*/ Term_fresh();
7157 Term_xtra(TERM_XTRA_DELAY, msec);
7159 /*if (fresh_before)*/ Term_fresh();
7161 /* Display "beam" grids */
7162 if (flg & (PROJECT_BEAM))
7164 /* Obtain the explosion pict */
7165 p = bolt_pict(y, x, y, x, typ);
7167 /* Extract attr/char */
7171 /* Visual effects */
7172 print_rel(c, a, y, x);
7175 /* Hack -- Activate delay */
7179 /* Hack -- delay anyway for consistency */
7182 /* Delay for consistency */
7183 Term_xtra(TERM_XTRA_DELAY, msec);
7190 /* Save the "blast epicenter" */
7194 if (breath && !path_n)
7200 flg &= ~(PROJECT_HIDE);
7204 /* Start the "explosion" */
7207 /* Hack -- make sure beams get to "explode" */
7215 /* If we found a "target", explode there */
7216 if (dist <= MAX_RANGE)
7218 /* Mega-Hack -- remove the final "beam" grid */
7219 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7222 * Create a conical breath attack
7233 flg &= ~(PROJECT_HIDE);
7235 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7239 /* Determine the blast area, work from the inside out */
7240 for (dist = 0; dist <= rad; dist++)
7242 /* Scan the maximal blast area of radius "dist" */
7243 for (y = by - dist; y <= by + dist; y++)
7245 for (x = bx - dist; x <= bx + dist; x++)
7247 /* Ignore "illegal" locations */
7248 if (!in_bounds2(y, x)) continue;
7250 /* Enforce a "circular" explosion */
7251 if (distance(by, bx, y, x) != dist) continue;
7257 /* Lights are stopped by opaque terrains */
7258 if (!los(by, bx, y, x)) continue;
7260 case GF_DISINTEGRATE:
7261 /* Disintegration are stopped only by perma-walls */
7262 if (!in_disintegration_range(by, bx, y, x)) continue;
7265 /* Ball explosions are stopped by walls */
7266 if (!projectable(by, bx, y, x)) continue;
7270 /* Save this grid */
7277 /* Encode some more "radius" info */
7283 /* Speed -- ignore "non-explosions" */
7284 if (!grids) return (FALSE);
7287 /* Display the "blast area" if requested */
7288 if (!blind && !(flg & (PROJECT_HIDE)))
7290 /* Then do the "blast", from inside out */
7291 for (t = 0; t <= gm_rad; t++)
7293 /* Dump everything with this radius */
7294 for (i = gm[t]; i < gm[t+1]; i++)
7296 /* Extract the location */
7300 /* Only do visuals if the player can "see" the blast */
7301 if (panel_contains(y, x) && player_has_los_bold(y, x))
7310 /* Obtain the explosion pict */
7311 p = bolt_pict(y, x, y, x, typ);
7313 /* Extract attr/char */
7317 /* Visual effects -- Display */
7318 print_rel(c, a, y, x);
7322 /* Hack -- center the cursor */
7323 move_cursor_relative(by, bx);
7325 /* Flush each "radius" seperately */
7326 /*if (fresh_before)*/ Term_fresh();
7328 /* Delay (efficiently) */
7329 if (visual || drawn)
7331 Term_xtra(TERM_XTRA_DELAY, msec);
7335 /* Flush the erasing */
7338 /* Erase the explosion drawn above */
7339 for (i = 0; i < grids; i++)
7341 /* Extract the location */
7345 /* Hack -- Erase if needed */
7346 if (panel_contains(y, x) && player_has_los_bold(y, x))
7352 /* Hack -- center the cursor */
7353 move_cursor_relative(by, bx);
7355 /* Flush the explosion */
7356 /*if (fresh_before)*/ Term_fresh();
7361 /* Update stuff if needed */
7362 if (p_ptr->update) handle_stuff();
7365 if (flg & PROJECT_KILL)
7367 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7368 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7372 /* Check features */
7373 if (flg & (PROJECT_GRID))
7375 /* Start with "dist" of zero */
7378 /* Scan for features */
7379 for (i = 0; i < grids; i++)
7381 /* Hack -- Notice new "dist" values */
7382 if (gm[dist+1] == i) dist++;
7384 /* Get the grid location */
7388 /* Find the closest point in the blast */
7391 int d = dist_to_line(y, x, y1, x1, by, bx);
7393 /* Affect the grid */
7394 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7398 /* Affect the grid */
7399 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7404 /* Update stuff if needed */
7405 if (p_ptr->update) handle_stuff();
7408 if (flg & (PROJECT_ITEM))
7410 /* Start with "dist" of zero */
7413 /* Scan for objects */
7414 for (i = 0; i < grids; i++)
7416 /* Hack -- Notice new "dist" values */
7417 if (gm[dist+1] == i) dist++;
7419 /* Get the grid location */
7423 /* Find the closest point in the blast */
7426 int d = dist_to_line(y, x, y1, x1, by, bx);
7428 /* Affect the object in the grid */
7429 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7433 /* Affect the object in the grid */
7434 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7440 /* Check monsters */
7441 if (flg & (PROJECT_KILL))
7448 /* Start with "dist" of zero */
7451 /* Scan for monsters */
7452 for (i = 0; i < grids; i++)
7456 /* Hack -- Notice new "dist" values */
7457 if (gm[dist + 1] == i) dist++;
7459 /* Get the grid location */
7463 /* A single bolt may be reflected */
7466 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7467 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7469 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7470 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7471 (!who || dist_hack > 1) && !one_in_(10))
7474 int max_attempts = 10;
7476 /* Choose 'new' target */
7479 t_y = y_saver - 1 + randint1(3);
7480 t_x = x_saver - 1 + randint1(3);
7483 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7485 if (max_attempts < 1)
7491 sound(SOUND_REFLECT);
7494 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7495 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7496 else if (m_ptr->r_idx == MON_DIO)
7497 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7499 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7501 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7503 /* Reflected bolts randomly target either one */
7504 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7505 else flg |= PROJECT_PLAYER;
7507 /* The bolt is reflected */
7508 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7510 /* Don't affect the monster any longer */
7516 /* Find the closest point in the blast */
7519 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7523 effective_dist = dist;
7527 /* There is the riding player on this monster */
7528 if (p_ptr->riding && player_bold(y, x))
7530 /* Aimed on the player */
7531 if (flg & PROJECT_PLAYER)
7533 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7536 * A beam or bolt is well aimed
7538 * So don't affects the mount.
7545 * The spell is not well aimed,
7546 * So partly affect the mount too.
7553 * This grid is the original target.
7554 * Or aimed on your horse.
7556 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7558 /* Hit the mount with full damage */
7562 * Otherwise this grid is not the
7563 * original target, it means that line
7564 * of fire is obstructed by this
7568 * A beam or bolt will hit either
7569 * player or mount. Choose randomly.
7571 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7575 /* Hit the mount with full damage */
7579 /* Hit the player later */
7580 flg |= PROJECT_PLAYER;
7582 /* Don't affect the mount */
7588 * The spell is not well aimed, so
7589 * partly affect both player and
7598 /* Affect the monster in the grid */
7599 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7603 /* Player affected one monster (without "jumping") */
7604 if (!who && (project_m_n == 1) && !jump)
7609 /* Track if possible */
7610 if (cave[y][x].m_idx > 0)
7612 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7616 /* Hack -- auto-recall */
7617 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7619 /* Hack - auto-track */
7620 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7628 if (flg & (PROJECT_KILL))
7630 /* Start with "dist" of zero */
7633 /* Scan for player */
7634 for (i = 0; i < grids; i++)
7638 /* Hack -- Notice new "dist" values */
7639 if (gm[dist+1] == i) dist++;
7641 /* Get the grid location */
7645 /* Affect the player? */
7646 if (!player_bold(y, x)) continue;
7648 /* Find the closest point in the blast */
7651 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7655 effective_dist = dist;
7658 /* Target may be your horse */
7661 /* Aimed on the player */
7662 if (flg & PROJECT_PLAYER)
7664 /* Hit the player with full damage */
7668 * Hack -- When this grid was not the
7669 * original target, a beam or bolt
7670 * would hit either player or mount,
7671 * and should be choosen randomly.
7673 * But already choosen to hit the
7674 * mount at this point.
7676 * Or aimed on your horse.
7678 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7681 * A beam or bolt is well aimed
7683 * So don't affects the player.
7690 * The spell is not well aimed,
7691 * So partly affect the player too.
7697 /* Affect the player */
7698 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7706 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7708 if (rakubadam_m > 0)
7710 if (rakuba(rakubadam_m, FALSE))
7712 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7715 if (p_ptr->riding && rakubadam_p > 0)
7717 if(rakuba(rakubadam_p, FALSE))
7719 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7724 /* Return "something was noticed" */
7729 * @brief 鏡魔法「封魔結界」の効果処理
7731 * @return 効果があったらTRUEを返す
7733 bool binding_field(HIT_POINT dam)
7735 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7736 int mirror_num = 0; /* 鏡の数 */
7738 POSITION centersign;
7739 POSITION x1, x2, y1, y2;
7741 int msec = delay_factor*delay_factor*delay_factor;
7744 POSITION point_x[3];
7745 POSITION point_y[3];
7747 /* Default target of monsterspell is player */
7748 monster_target_y = p_ptr->y;
7749 monster_target_x = p_ptr->x;
7751 for (x = 0; x < cur_wid; x++)
7753 for (y = 0; y < cur_hgt; y++)
7755 if (is_mirror_grid(&cave[y][x]) &&
7756 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7757 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7758 player_has_los_bold(y, x) &&
7759 projectable(p_ptr->y, p_ptr->x, y, x)
7761 mirror_y[mirror_num] = y;
7762 mirror_x[mirror_num] = x;
7768 if (mirror_num < 2)return FALSE;
7770 point_x[0] = randint0(mirror_num);
7772 point_x[1] = randint0(mirror_num);
7773 } while (point_x[0] == point_x[1]);
7775 point_y[0] = mirror_y[point_x[0]];
7776 point_x[0] = mirror_x[point_x[0]];
7777 point_y[1] = mirror_y[point_x[1]];
7778 point_x[1] = mirror_x[point_x[1]];
7779 point_y[2] = p_ptr->y;
7780 point_x[2] = p_ptr->x;
7782 x = point_x[0] + point_x[1] + point_x[2];
7783 y = point_y[0] + point_y[1] + point_y[2];
7785 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7786 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7787 if (centersign == 0)return FALSE;
7789 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7790 x1 = x1 < point_x[2] ? x1 : point_x[2];
7791 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7792 y1 = y1 < point_y[2] ? y1 : point_y[2];
7794 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7795 x2 = x2 > point_x[2] ? x2 : point_x[2];
7796 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7797 y2 = y2 > point_y[2] ? y2 : point_y[2];
7799 for (y = y1; y <= y2; y++) {
7800 for (x = x1; x <= x2; x++) {
7801 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7802 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7803 centersign*((point_x[1] - x)*(point_y[2] - y)
7804 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7805 centersign*((point_x[2] - x)*(point_y[0] - y)
7806 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7808 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7809 /* Visual effects */
7811 && panel_contains(y, x)) {
7812 p = bolt_pict(y, x, y, x, GF_MANA);
7813 print_rel(PICT_C(p), PICT_A(p), y, x);
7814 move_cursor_relative(y, x);
7815 /*if (fresh_before)*/ Term_fresh();
7816 Term_xtra(TERM_XTRA_DELAY, msec);
7822 for (y = y1; y <= y2; y++) {
7823 for (x = x1; x <= x2; x++) {
7824 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7825 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7826 centersign*((point_x[1] - x)*(point_y[2] - y)
7827 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7828 centersign*((point_x[2] - x)*(point_y[0] - y)
7829 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7831 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7832 (void)project_f(0, 0, y, x, dam, GF_MANA);
7837 for (y = y1; y <= y2; y++) {
7838 for (x = x1; x <= x2; x++) {
7839 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7840 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7841 centersign*((point_x[1] - x)*(point_y[2] - y)
7842 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7843 centersign*((point_x[2] - x)*(point_y[0] - y)
7844 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7846 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7847 (void)project_o(0, 0, y, x, dam, GF_MANA);
7852 for (y = y1; y <= y2; y++) {
7853 for (x = x1; x <= x2; x++) {
7854 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7855 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7856 centersign*((point_x[1] - x)*(point_y[2] - y)
7857 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7858 centersign*((point_x[2] - x)*(point_y[0] - y)
7859 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7861 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7862 (void)project_m(0, 0, y, x, dam, GF_MANA,
7863 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7869 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7870 remove_mirror(point_y[0], point_x[0]);
7877 * @brief 鏡魔法「鏡の封印」の効果処理
7879 * @return 効果があったらTRUEを返す
7881 void seal_of_mirror(HIT_POINT dam)
7885 for (x = 0; x < cur_wid; x++)
7887 for (y = 0; y < cur_hgt; y++)
7889 if (is_mirror_grid(&cave[y][x]))
7891 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7892 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7894 if (!cave[y][x].m_idx)
7896 remove_mirror(y, x);