3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
20 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
21 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
23 int project_length = 0; /*!< 投射の射程距離 */
27 * @brief モンスター魅了用セービングスロー共通部(汎用系)
29 * @param m_ptr 対象モンスター
30 * @return 魅了に抵抗したらTRUE
32 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
34 monster_race *r_ptr = &r_info[m_ptr->r_idx];
36 if(p_ptr->inside_arena) return TRUE;
39 if (r_ptr->flagsr & RFR_RES_ALL)
41 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
45 if (r_ptr->flags3 & RF3_NO_CONF)
47 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
51 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
53 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
54 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
55 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
59 * @brief モンスター服従用セービングスロー共通部(部族依存系)
61 * @param m_ptr 対象モンスター
62 * @return 服従に抵抗したらTRUE
64 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
66 monster_race *r_ptr = &r_info[m_ptr->r_idx];
68 if (p_ptr->inside_arena) return TRUE;
71 if (r_ptr->flagsr & RFR_RES_ALL)
73 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
77 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
79 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
80 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
81 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
85 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
88 * ハードコーティングによる実装が行われている。
89 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
91 PERCENTAGE beam_chance(void)
93 if (p_ptr->pclass == CLASS_MAGE)
94 return (PERCENTAGE)(p_ptr->lev);
95 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
96 return (PERCENTAGE)(p_ptr->lev + 10);
98 return (PERCENTAGE)(p_ptr->lev / 2);
103 * @brief 配置した鏡リストの次を取得する /
104 * Get another mirror. for SEEKER
105 * @param next_y 次の鏡のy座標を返す参照ポインタ
106 * @param next_x 次の鏡のx座標を返す参照ポインタ
107 * @param cury 現在の鏡のy座標
108 * @param curx 現在の鏡のx座標
110 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
112 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
113 int mirror_num = 0; /* 鏡の数 */
117 for (x = 0; x < cur_wid; x++)
119 for (y = 0; y < cur_hgt; y++)
121 if (is_mirror_grid(&cave[y][x])) {
122 mirror_y[mirror_num] = y;
123 mirror_x[mirror_num] = x;
130 num = randint0(mirror_num);
131 *next_y = mirror_y[num];
132 *next_x = mirror_x[num];
135 *next_y = cury + randint0(5) - 2;
136 *next_x = curx + randint0(5) - 2;
141 * @brief 万色表現用にランダムな色を選択する関数 /
142 * Get a legal "multi-hued" color for drawing "spells"
146 static byte mh_attr(int max)
148 switch (randint1(max))
150 case 1: return (TERM_RED);
151 case 2: return (TERM_GREEN);
152 case 3: return (TERM_BLUE);
153 case 4: return (TERM_YELLOW);
154 case 5: return (TERM_ORANGE);
155 case 6: return (TERM_VIOLET);
156 case 7: return (TERM_L_RED);
157 case 8: return (TERM_L_GREEN);
158 case 9: return (TERM_L_BLUE);
159 case 10: return (TERM_UMBER);
160 case 11: return (TERM_L_UMBER);
161 case 12: return (TERM_SLATE);
162 case 13: return (TERM_WHITE);
163 case 14: return (TERM_L_WHITE);
164 case 15: return (TERM_L_DARK);
172 * @brief 魔法属性に応じたエフェクトの色を返す /
173 * Return a color to use for the bolt/ball spells
177 static byte spell_color(int type)
179 /* Check if A.B.'s new graphics should be used (rr9) */
180 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
185 case GF_PSY_SPEAR: return (0x06);
186 case GF_MISSILE: return (0x0F);
187 case GF_ACID: return (0x04);
188 case GF_ELEC: return (0x02);
189 case GF_FIRE: return (0x00);
190 case GF_COLD: return (0x01);
191 case GF_POIS: return (0x03);
192 case GF_HOLY_FIRE: return (0x00);
193 case GF_HELL_FIRE: return (0x00);
194 case GF_MANA: return (0x0E);
196 case GF_SEEKER: return (0x0E);
197 case GF_SUPER_RAY: return (0x0E);
199 case GF_ARROW: return (0x0F);
200 case GF_WATER: return (0x04);
201 case GF_NETHER: return (0x07);
202 case GF_CHAOS: return (mh_attr(15));
203 case GF_DISENCHANT: return (0x05);
204 case GF_NEXUS: return (0x0C);
205 case GF_CONFUSION: return (mh_attr(4));
206 case GF_SOUND: return (0x09);
207 case GF_SHARDS: return (0x08);
208 case GF_FORCE: return (0x09);
209 case GF_INERTIAL: return (0x09);
210 case GF_GRAVITY: return (0x09);
211 case GF_TIME: return (0x09);
212 case GF_LITE_WEAK: return (0x06);
213 case GF_LITE: return (0x06);
214 case GF_DARK_WEAK: return (0x07);
215 case GF_DARK: return (0x07);
216 case GF_PLASMA: return (0x0B);
217 case GF_METEOR: return (0x00);
218 case GF_ICE: return (0x01);
219 case GF_ROCKET: return (0x0F);
220 case GF_DEATH_RAY: return (0x07);
221 case GF_NUKE: return (mh_attr(2));
222 case GF_DISINTEGRATE: return (0x05);
234 case GF_CAUSE_4: return (0x0E);
235 case GF_HAND_DOOM: return (0x07);
236 case GF_CAPTURE : return (0x0E);
237 case GF_IDENTIFY: return (0x01);
238 case GF_ATTACK: return (0x0F);
239 case GF_PHOTO : return (0x06);
242 /* Normal tiles or ASCII */
248 /* Lookup the default colors for this type */
249 cptr s = quark_str(gf_color[type]);
251 if (!s) return (TERM_WHITE);
253 /* Pick a random color */
254 c = s[randint0(strlen(s))];
256 /* Lookup this color */
257 a = my_strchr(color_char, c) - color_char;
259 /* Invalid color (note check for < 0 removed, gave a silly
260 * warning because bytes are always >= 0 -- RG) */
261 if (a > 15) return (TERM_WHITE);
267 /* Standard "color" */
273 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
274 * Find the attr/char pair to use for a spell effect
283 * It is moving (or has moved) from (x,y) to (nx,ny).
284 * If the distance is not "one", we (may) return "*".
287 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
297 if ((ny == y) && (nx == x)) base = 0x30;
300 else if (nx == x) base = 0x40;
303 else if (ny == y) base = 0x50;
306 else if ((ny - y) == (x - nx)) base = 0x60;
309 else if ((ny - y) == (nx - x)) base = 0x70;
314 /* Basic spell color */
315 k = spell_color(typ);
317 /* Obtain attr/char */
318 a = misc_to_attr[base + k];
319 c = misc_to_char[base + k];
327 * @brief 始点から終点への経路を返す /
328 * Determine the path taken by a projection.
329 * @param gp 経路座標リストを返す参照ポインタ
339 * The projection will always start from the grid (y1,x1), and will travel
340 * towards the grid (y2,x2), touching one grid per unit of distance along
341 * the major axis, and stopping when it enters the destination grid or a
342 * wall grid, or has travelled the maximum legal distance of "range".
344 * Note that "distance" in this function (as in the "update_view()" code)
345 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
346 * actually has an "octagon of projection" not a "circle of projection".
348 * The path grids are saved into the grid array pointed to by "gp", and
349 * there should be room for at least "range" grids in "gp". Note that
350 * due to the way in which distance is calculated, this function normally
351 * uses fewer than "range" grids for the projection path, so the result
352 * of this function should never be compared directly to "range". Note
353 * that the initial grid (y1,x1) is never saved into the grid array, not
354 * even if the initial grid is also the final grid.
356 * The "flg" flags can be used to modify the behavior of this function.
358 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
359 * semantics as they do for the "project" function, namely, that the path
360 * will stop as soon as it hits a monster, or that the path will continue
361 * through the destination grid, respectively.
363 * The "PROJECT_JUMP" flag, which for the "project()" function means to
364 * start at a special grid (which makes no sense in this function), means
365 * that the path should be "angled" slightly if needed to avoid any wall
366 * grids, allowing the player to "target" any grid which is in "view".
367 * This flag is non-trivial and has not yet been implemented, but could
368 * perhaps make use of the "vinfo" array (above).
370 * This function returns the number of grids (if any) in the path. This
371 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
373 * This algorithm is similar to, but slightly different from, the one used
374 * by "update_view_los()", and very different from the one used by "los()".
377 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
399 /* No path necessary (or allowed) */
400 if ((x1 == x2) && (y1 == y2)) return (0);
428 /* Number of "units" in one "half" grid */
431 /* Number of "units" in one "full" grid */
437 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
448 /* Advance (X) part 2 */
451 /* Advance (X) part 3 */
458 /* Create the projection path */
462 gp[n++] = GRID(y, x);
464 /* Hack -- Check maximum range */
465 if ((n + (k >> 1)) >= range) break;
467 /* Sometimes stop at destination grid */
468 if (!(flg & (PROJECT_THRU)))
470 if ((x == x2) && (y == y2)) break;
473 if (flg & (PROJECT_DISI))
475 if ((n > 0) && cave_stop_disintegration(y, x)) break;
477 else if (flg & (PROJECT_LOS))
479 if ((n > 0) && !cave_los_bold(y, x)) break;
481 else if (!(flg & (PROJECT_PATH)))
483 /* Always stop at non-initial wall grids */
484 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
487 /* Sometimes stop at non-initial monsters/players */
488 if (flg & (PROJECT_STOP))
491 (player_bold(y, x) || cave[y][x].m_idx != 0))
495 if (!in_bounds(y, x)) break;
500 /* Advance (X) part 1 */
503 /* Horizontal change */
506 /* Advance (X) part 2 */
509 /* Advance (X) part 3 */
525 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
534 /* Vertical change */
537 /* Advance (Y) part 2 */
540 /* Advance (Y) part 3 */
547 /* Create the projection path */
551 gp[n++] = GRID(y, x);
553 /* Hack -- Check maximum range */
554 if ((n + (k >> 1)) >= range) break;
556 /* Sometimes stop at destination grid */
557 if (!(flg & (PROJECT_THRU)))
559 if ((x == x2) && (y == y2)) break;
562 if (flg & (PROJECT_DISI))
564 if ((n > 0) && cave_stop_disintegration(y, x)) break;
566 else if (flg & (PROJECT_LOS))
568 if ((n > 0) && !cave_los_bold(y, x)) break;
570 else if (!(flg & (PROJECT_PATH)))
572 /* Always stop at non-initial wall grids */
573 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
576 /* Sometimes stop at non-initial monsters/players */
577 if (flg & (PROJECT_STOP))
580 (player_bold(y, x) || cave[y][x].m_idx != 0))
584 if (!in_bounds(y, x)) break;
589 /* Advance (Y) part 1 */
592 /* Vertical change */
595 /* Advance (Y) part 2 */
598 /* Advance (Y) part 3 */
618 /* Create the projection path */
622 gp[n++] = GRID(y, x);
624 /* Hack -- Check maximum range */
625 if ((n + (n >> 1)) >= range) break;
627 /* Sometimes stop at destination grid */
628 if (!(flg & (PROJECT_THRU)))
630 if ((x == x2) && (y == y2)) break;
633 if (flg & (PROJECT_DISI))
635 if ((n > 0) && cave_stop_disintegration(y, x)) break;
637 else if (flg & (PROJECT_LOS))
639 if ((n > 0) && !cave_los_bold(y, x)) break;
641 else if (!(flg & (PROJECT_PATH)))
643 /* Always stop at non-initial wall grids */
644 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
647 /* Sometimes stop at non-initial monsters/players */
648 if (flg & (PROJECT_STOP))
651 (player_bold(y, x) || cave[y][x].m_idx != 0))
655 if (!in_bounds(y, x)) break;
672 * Mega-Hack -- track "affected" monsters (see "project()" comments)
674 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
675 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
676 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
677 /* Mega-Hack -- monsters target */
678 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
679 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
683 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
684 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
685 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
686 * @param y 目標Y座標 / Target y location (or location to travel "towards")
687 * @param x 目標X座標 / Target x location (or location to travel "towards")
688 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
689 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
690 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
693 * We are called both for "beam" effects and "ball" effects.
695 * The "r" parameter is the "distance from ground zero".
697 * Note that we determine if the player can "see" anything that happens
698 * by taking into account: blindness, line-of-sight, and illumination.
700 * We return "TRUE" if the effect of the projection is "obvious".
702 * We also "see" grids which are "memorized", probably a hack
704 * Perhaps we should affect doors?
707 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
709 cave_type *c_ptr = &cave[y][x];
710 feature_type *f_ptr = &f_info[c_ptr->feat];
712 bool obvious = FALSE;
713 bool known = player_has_los_bold(y, x);
718 /* Reduce damage by distance */
719 dam = (dam + r) / (r + 1);
722 if (have_flag(f_ptr->flags, FF_TREE))
730 message = _("枯れた", "was blasted."); break;
732 message = _("縮んだ", "shrank."); break;
734 message = _("溶けた", "melted."); break;
737 message = _("凍り、砕け散った", "was frozen and smashed."); break;
741 message = _("燃えた", "burns up!"); break;
753 message = _("粉砕された", "was crushed."); break;
755 message = NULL;break;
759 msg_format(_("木は%s。", "A tree %s"), message);
760 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
763 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
767 /* Analyze the type */
770 /* Ignore most effects */
805 /* Destroy Traps (and Locks) */
808 /* Reveal secret doors */
809 if (is_hidden_door(c_ptr))
814 /* Check line of sight */
822 if (is_trap(c_ptr->feat))
824 /* Check line of sight */
827 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
831 /* Destroy the trap */
832 cave_alter_feat(y, x, FF_DISARM);
835 /* Locked doors are unlocked */
836 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
838 s16b old_feat = c_ptr->feat;
840 /* Unlock the door */
841 cave_alter_feat(y, x, FF_DISARM);
843 /* Check line of sound */
844 if (known && (old_feat != c_ptr->feat))
846 msg_print(_("カチッと音がした!", "Click!"));
851 /* Remove "unsafe" flag if player is not blind */
852 if (!p_ptr->blind && player_has_los_bold(y, x))
854 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);
896 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
898 if (have_flag(f_ptr->flags, FF_SPIKE))
900 s16b old_mimic = c_ptr->mimic;
901 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
903 cave_alter_feat(y, x, FF_SPIKE);
905 c_ptr->mimic = old_mimic;
913 /* Check line of sight */
914 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
916 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
923 /* Destroy walls (and doors) */
926 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
928 if (known && (c_ptr->info & (CAVE_MARK)))
930 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
934 /* Destroy the wall */
935 cave_alter_feat(y, x, FF_HURT_ROCK);
937 /* Update some things */
938 p_ptr->update |= (PU_FLOW);
947 /* Require a "naked" floor grid */
948 if (!cave_naked_bold(y, x)) break;
950 /* Not on the player */
951 if (player_bold(y, x)) break;
953 /* Create a closed door */
954 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
957 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
974 /* Require a "naked" floor grid */
975 if (!cave_naked_bold(y, x)) break;
977 /* Not on the player */
978 if (player_bold(y, x)) break;
980 /* Create a closed door */
981 cave_set_feat(y, x, feat_tree);
984 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
992 /* Require a "naked" floor grid */
993 if (!cave_naked_bold(y, x)) break;
996 c_ptr->info |= CAVE_OBJECT;
997 c_ptr->mimic = feat_glyph;
1010 /* Require a "naked" floor grid */
1011 if (!cave_naked_bold(y, x)) break;
1013 /* Not on the player */
1014 if (player_bold(y, x)) break;
1017 cave_set_feat(y, x, feat_granite);
1025 /* Ignore permanent grid */
1026 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1031 /* Ignore grid without enough space */
1032 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1034 /* Place a shallow lava */
1035 cave_set_feat(y, x, feat_shallow_lava);
1040 /* Place a deep lava */
1041 cave_set_feat(y, x, feat_deep_lava);
1048 /* Ignore permanent grid */
1049 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1054 /* Ignore grid without enough space */
1055 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1057 /* Place a shallow water */
1058 cave_set_feat(y, x, feat_shallow_water);
1063 /* Place a deep water */
1064 cave_set_feat(y, x, feat_deep_water);
1069 /* Lite up the grid */
1073 /* Turn on the light */
1074 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1076 c_ptr->info |= (CAVE_GLOW);
1084 update_local_illumination(y, x);
1087 if (player_can_see_bold(y, x)) obvious = TRUE;
1089 /* Mega-Hack -- Update the monster in the affected grid */
1090 /* This allows "spear of light" (etc) to work "correctly" */
1091 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1093 if (p_ptr->special_defense & NINJA_S_STEALTH)
1095 if (player_bold(y, x)) set_superstealth(FALSE);
1102 /* Darken the grid */
1106 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1109 /* Turn off the light. */
1112 if (dun_level || !is_daytime())
1114 for (j = 0; j < 9; j++)
1116 int by = y + ddy_ddd[j];
1117 int bx = x + ddx_ddd[j];
1119 if (in_bounds2(by, bx))
1121 cave_type *cc_ptr = &cave[by][bx];
1123 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1131 if (!do_dark) break;
1134 c_ptr->info &= ~(CAVE_GLOW);
1136 /* Hack -- Forget "boring" grids */
1137 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1140 c_ptr->info &= ~(CAVE_MARK);
1149 update_local_illumination(y, x);
1152 if (player_can_see_bold(y, x)) obvious = TRUE;
1154 /* Mega-Hack -- Update the monster in the affected grid */
1155 /* This allows "spear of light" (etc) to work "correctly" */
1156 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1166 if (is_mirror_grid(c_ptr))
1168 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1170 remove_mirror(y, x);
1171 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1174 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1176 if (known && (c_ptr->info & CAVE_MARK))
1178 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1182 /* Destroy the wall */
1183 cave_alter_feat(y, x, FF_HURT_ROCK);
1185 /* Update some things */
1186 p_ptr->update |= (PU_FLOW);
1193 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1195 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1197 remove_mirror(y, x);
1198 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1201 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1203 if (known && (c_ptr->info & CAVE_MARK))
1205 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1209 /* Destroy the wall */
1210 cave_alter_feat(y, x, FF_HURT_ROCK);
1212 /* Update some things */
1213 p_ptr->update |= (PU_FLOW);
1218 case GF_DISINTEGRATE:
1220 /* Destroy mirror/glyph */
1221 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1222 remove_mirror(y, x);
1224 /* Permanent features don't get effect */
1225 /* But not protect monsters and other objects */
1226 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1228 cave_alter_feat(y, x, FF_HURT_DISI);
1230 /* Update some things -- similar to GF_KILL_WALL */
1231 p_ptr->update |= (PU_FLOW);
1238 /* Return "Anything seen?" */
1245 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1246 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1247 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1248 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1249 * @param x 目標X座標 / Target x location (or location to travel "towards")
1250 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1251 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1252 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1255 * We are called from "project()" to "damage" objects
1257 * We are called both for "beam" effects and "ball" effects.
1259 * Perhaps we should only SOMETIMES damage things on the ground.
1261 * The "r" parameter is the "distance from ground zero".
1263 * Note that we determine if the player can "see" anything that happens
1264 * by taking into account: blindness, line-of-sight, and illumination.
1266 * We also "see" grids which are "memorized", probably a hack
1268 * We return "TRUE" if the effect of the projection is "obvious".
1271 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1273 cave_type *c_ptr = &cave[y][x];
1275 OBJECT_IDX this_o_idx, next_o_idx = 0;
1277 bool obvious = FALSE;
1278 bool known = player_has_los_bold(y, x);
1280 BIT_FLAGS flgs[TR_FLAG_SIZE];
1282 char o_name[MAX_NLEN];
1284 KIND_OBJECT_IDX k_idx = 0;
1285 bool is_potion = FALSE;
1288 who = who ? who : 0;
1290 /* Reduce damage by distance */
1291 dam = (dam + r) / (r + 1);
1294 /* Scan all objects in the grid */
1295 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1297 /* Acquire object */
1298 object_type *o_ptr = &o_list[this_o_idx];
1300 bool is_art = FALSE;
1301 bool ignore = FALSE;
1302 bool do_kill = FALSE;
1304 cptr note_kill = NULL;
1307 /* Get the "plural"-ness */
1308 bool plural = (o_ptr->number > 1);
1311 /* Acquire next object */
1312 next_o_idx = o_ptr->next_o_idx;
1314 /* Extract the flags */
1315 object_flags(o_ptr, flgs);
1317 /* Check for artifact */
1318 if (object_is_artifact(o_ptr)) is_art = TRUE;
1320 /* Analyze the type */
1323 /* Acid -- Lots of things */
1326 if (hates_acid(o_ptr))
1329 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1330 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1335 /* Elec -- Rings and Wands */
1338 if (hates_elec(o_ptr))
1341 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1342 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1347 /* Fire -- Flammable objects */
1350 if (hates_fire(o_ptr))
1353 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1354 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1359 /* Cold -- potions and flasks */
1362 if (hates_cold(o_ptr))
1364 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1366 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1374 if (hates_fire(o_ptr))
1377 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1378 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1380 if (hates_elec(o_ptr))
1384 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1385 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1393 if (hates_fire(o_ptr))
1396 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1397 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1399 if (hates_cold(o_ptr))
1403 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1404 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1409 /* Hack -- break potions and such */
1415 if (hates_cold(o_ptr))
1417 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1423 /* Mana and Chaos -- destroy everything */
1429 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1433 case GF_DISINTEGRATE:
1436 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1443 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1444 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1445 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1449 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1453 if (object_is_cursed(o_ptr))
1456 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1463 identify_item(o_ptr);
1465 /* Auto-inscription */
1466 autopick_alter_item((-this_o_idx), FALSE);
1474 /* Chests are noticed only if trapped or locked */
1475 if (o_ptr->tval == TV_CHEST)
1477 /* Disarm/Unlock traps */
1478 if (o_ptr->pval > 0)
1480 /* Disarm or Unlock */
1481 o_ptr->pval = (0 - o_ptr->pval);
1484 object_known(o_ptr);
1487 if (known && (o_ptr->marked & OM_FOUND))
1489 msg_print(_("カチッと音がした!", "Click!"));
1499 if (o_ptr->tval == TV_CORPSE)
1502 BIT_FLAGS mode = 0L;
1504 if (!who || is_pet(&m_list[who]))
1505 mode |= PM_FORCE_PET;
1507 for (i = 0; i < o_ptr->number ; i++)
1509 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1510 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1514 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1518 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1520 note_kill = _("生き返った。", " revived.");
1522 else if (!note_kill)
1524 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1535 /* Attempt to destroy the object */
1538 /* Effect "observed" */
1539 if (known && (o_ptr->marked & OM_FOUND))
1542 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1545 /* Artifacts, and other objects, get to resist */
1546 if (is_art || ignore)
1548 /* Observe the resist */
1549 if (known && (o_ptr->marked & OM_FOUND))
1551 msg_format(_("%sは影響を受けない!",
1552 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1559 /* Describe if needed */
1560 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1562 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1565 k_idx = o_ptr->k_idx;
1566 is_potion = object_is_potion(o_ptr);
1569 /* Delete the object */
1570 delete_object_idx(this_o_idx);
1572 /* Potions produce effects when 'shattered' */
1575 (void)potion_smash_effect(who, y, x, k_idx);
1584 /* Return "Anything seen?" */
1590 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1591 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1592 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1593 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1594 * @param x 目標X座標 / Target x location (or location to travel "towards")
1595 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1596 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1598 * @param see_s_msg TRUEならばメッセージを表示する
1599 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1602 * This routine takes a "source monster" (by index) which is mostly used to
1603 * determine if the player is causing the damage, and a "radius" (see below),
1604 * which is used to decrease the power of explosions with distance, and a
1605 * location, via integers which are modified by certain types of attacks
1606 * (polymorph and teleport being the obvious ones), a default damage, which
1607 * is modified as needed based on various properties, and finally a "damage
1608 * type" (see below).
1611 * Note that this routine can handle "no damage" attacks (like teleport) by
1612 * taking a "zero" damage, and can even take "parameters" to attacks (like
1613 * confuse) by accepting a "damage", using it to calculate the effect, and
1614 * then setting the damage to zero. Note that the "damage" parameter is
1615 * divided by the radius, so monsters not at the "epicenter" will not take
1616 * as much damage (or whatever)...
1619 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1620 * may result in a dereference of an invalid pointer.
1623 * Various messages are produced, and damage is applied.
1626 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1627 * actually be "made" of that substance, or "breathe" big balls of it.
1628 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1630 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1631 * and hurts evil less. If can breath nether, then it resists it as well.
1634 * Damage reductions use the following formulas:
1635 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1636 * gives avg damage of .655, ranging from .858 to .500
1637 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1638 * gives avg damage of .544, ranging from .714 to .417
1639 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1640 * gives avg damage of .444, ranging from .556 to .333
1641 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1642 * gives avg damage of .327, ranging from .427 to .250
1643 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1644 * gives something simple.
1647 * In this function, "result" messages are postponed until the end, where
1648 * the "note" string is appended to the monster name, if not NULL. So,
1649 * to make a spell have "no effect" just set "note" to NULL. You should
1650 * also set "notice" to FALSE, or the player will learn what the spell does.
1653 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1657 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)
1661 cave_type *c_ptr = &cave[y][x];
1663 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1664 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1666 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1670 /* Is the monster "seen"? */
1671 bool seen = m_ptr->ml;
1672 bool seen_msg = is_seen(m_ptr);
1674 bool slept = (bool)MON_CSLEEP(m_ptr);
1676 /* Were the effects "obvious" (if seen)? */
1677 bool obvious = FALSE;
1679 /* Can the player know about this effect? */
1680 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1682 /* Were the effects "irrelevant"? */
1683 bool skipped = FALSE;
1685 /* Gets the monster angry at the source of the effect? */
1686 bool get_angry = FALSE;
1688 /* Polymorph setting (true or false) */
1689 bool do_poly = FALSE;
1691 /* Teleport setting (max distance) */
1694 /* Confusion setting (amount to confuse) */
1697 /* Stunning setting (amount to stun) */
1700 /* Sleep amount (amount to sleep) */
1703 /* Fear amount (amount to fear) */
1706 /* Time amount (amount to time) */
1709 bool heal_leper = FALSE;
1711 /* Hold the monster name */
1715 PARAMETER_VALUE photo = 0;
1717 /* Assume no note */
1720 /* Assume a default death */
1721 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1726 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1729 if (!c_ptr->m_idx) return (FALSE);
1731 /* Never affect projector */
1732 if (who && (c_ptr->m_idx == who)) return (FALSE);
1733 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1734 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1736 /* Don't affect already death monsters */
1737 /* Prevents problems with chain reactions of exploding monsters */
1738 if (m_ptr->hp < 0) return (FALSE);
1740 /* Reduce damage by distance */
1741 dam = (dam + r) / (r + 1);
1744 /* Get the monster name (BEFORE polymorphing) */
1745 monster_desc(m_name, m_ptr, 0);
1747 /* Get the monster possessive ("his"/"her"/"its") */
1748 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1750 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1752 /* Analyze the damage type */
1755 /* Magic Missile -- pure damage */
1758 if (seen) obvious = TRUE;
1760 if (r_ptr->flagsr & RFR_RES_ALL)
1762 note = _("には完全な耐性がある!", " is immune.");
1764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1773 if (seen) obvious = TRUE;
1775 if (r_ptr->flagsr & RFR_RES_ALL)
1777 note = _("には完全な耐性がある!", " is immune.");
1779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1782 if (r_ptr->flagsr & RFR_IM_ACID)
1784 note = _("にはかなり耐性がある!", " resists a lot.");
1786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1794 if (seen) obvious = TRUE;
1796 if (r_ptr->flagsr & RFR_RES_ALL)
1798 note = _("には完全な耐性がある!", " is immune.");
1800 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1803 if (r_ptr->flagsr & RFR_IM_ELEC)
1805 note = _("にはかなり耐性がある!", " resists a lot.");
1807 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1815 if (seen) obvious = TRUE;
1817 if (r_ptr->flagsr & RFR_RES_ALL)
1819 note = _("には完全な耐性がある!", " is immune.");
1821 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1824 if (r_ptr->flagsr & RFR_IM_FIRE)
1826 note = _("にはかなり耐性がある!", " resists a lot.");
1828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1830 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1832 note = _("はひどい痛手をうけた。", " is hit hard.");
1834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1842 if (seen) obvious = TRUE;
1844 if (r_ptr->flagsr & RFR_RES_ALL)
1846 note = _("には完全な耐性がある!", " is immune.");
1848 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1851 if (r_ptr->flagsr & RFR_IM_COLD)
1853 note = _("にはかなり耐性がある!", " resists a lot.");
1855 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1857 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1859 note = _("はひどい痛手をうけた。", " is hit hard.");
1861 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1869 if (seen) obvious = TRUE;
1871 if (r_ptr->flagsr & RFR_RES_ALL)
1873 note = _("には完全な耐性がある!", " is immune.");
1875 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1878 if (r_ptr->flagsr & RFR_IM_POIS)
1880 note = _("にはかなり耐性がある!", " resists a lot.");
1882 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1890 if (seen) obvious = TRUE;
1892 if (r_ptr->flagsr & RFR_RES_ALL)
1894 note = _("には完全な耐性がある!", " is immune.");
1896 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1899 if (r_ptr->flagsr & RFR_IM_POIS)
1901 note = _("には耐性がある。", " resists.");
1902 dam *= 3; dam /= randint1(6) + 6;
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1905 else if (one_in_(3)) do_poly = TRUE;
1909 /* Hellfire -- hurts Evil */
1912 if (seen) obvious = TRUE;
1914 if (r_ptr->flagsr & RFR_RES_ALL)
1916 note = _("には完全な耐性がある!", " is immune.");
1918 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1921 if (r_ptr->flags3 & RF3_GOOD)
1923 note = _("はひどい痛手をうけた。", " is hit hard.");
1925 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1930 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1933 if (seen) obvious = TRUE;
1935 if (r_ptr->flagsr & RFR_RES_ALL)
1937 note = _("には完全な耐性がある!", " is immune.");
1939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1942 if (r_ptr->flags3 & RF3_GOOD)
1944 note = _("には完全な耐性がある!", " is immune.");
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1948 else if (r_ptr->flags3 & RF3_EVIL)
1951 note = _("はひどい痛手をうけた。", " is hit hard.");
1952 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1956 note = _("には耐性がある。", " resists.");
1957 dam *= 3; dam /= randint1(6) + 6;
1962 /* Arrow -- XXX no defense */
1965 if (seen) obvious = TRUE;
1967 if (r_ptr->flagsr & RFR_RES_ALL)
1969 note = _("には完全な耐性がある!", " is immune.");
1971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1977 /* Plasma -- XXX perhaps check ELEC or FIRE */
1980 if (seen) obvious = TRUE;
1982 if (r_ptr->flagsr & RFR_RES_ALL)
1984 note = _("には完全な耐性がある!", " is immune.");
1986 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1989 if (r_ptr->flagsr & RFR_RES_PLAS)
1991 note = _("には耐性がある。", " resists.");
1992 dam *= 3; dam /= randint1(6) + 6;
1993 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1998 /* Nether -- see above */
2001 if (seen) obvious = TRUE;
2003 if (r_ptr->flagsr & RFR_RES_ALL)
2005 note = _("には完全な耐性がある!", " is immune.");
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2010 if (r_ptr->flagsr & RFR_RES_NETH)
2012 if (r_ptr->flags3 & RF3_UNDEAD)
2014 note = _("には完全な耐性がある!", " is immune.");
2016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2020 note = _("には耐性がある。", " resists.");
2021 dam *= 3; dam /= randint1(6) + 6;
2023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2025 else if (r_ptr->flags3 & RF3_EVIL)
2027 note = _("はいくらか耐性を示した。", " resists somewhat.");
2029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2034 /* Water (acid) damage -- Water spirits/elementals are immune */
2037 if (seen) obvious = TRUE;
2039 if (r_ptr->flagsr & RFR_RES_ALL)
2041 note = _("には完全な耐性がある!", " is immune.");
2043 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2046 if (r_ptr->flagsr & RFR_RES_WATE)
2048 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2050 note = _("には完全な耐性がある!", " is immune.");
2055 note = _("には耐性がある。", " resists.");
2056 dam *= 3; dam /= randint1(6) + 6;
2058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2063 /* Chaos -- Chaos breathers resist */
2066 if (seen) obvious = TRUE;
2068 if (r_ptr->flagsr & RFR_RES_ALL)
2070 note = _("には完全な耐性がある!", " is immune.");
2072 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2075 if (r_ptr->flagsr & RFR_RES_CHAO)
2077 note = _("には耐性がある。", " resists.");
2078 dam *= 3; dam /= randint1(6) + 6;
2079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2081 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2083 note = _("はいくらか耐性を示した。", " resists somewhat.");
2084 dam *= 3; dam /= randint1(6) + 6;
2085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2090 do_conf = (5 + randint1(11) + r) / (r + 1);
2095 /* Shards -- Shard breathers resist */
2098 if (seen) obvious = TRUE;
2100 if (r_ptr->flagsr & RFR_RES_ALL)
2102 note = _("には完全な耐性がある!", " is immune.");
2104 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2107 if (r_ptr->flagsr & RFR_RES_SHAR)
2109 note = _("には耐性がある。", " resists.");
2110 dam *= 3; dam /= randint1(6) + 6;
2111 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2116 /* Rocket: Shard resistance helps */
2119 if (seen) obvious = TRUE;
2121 if (r_ptr->flagsr & RFR_RES_ALL)
2123 note = _("には完全な耐性がある!", " is immune.");
2125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2128 if (r_ptr->flagsr & RFR_RES_SHAR)
2130 note = _("はいくらか耐性を示した。", " resists somewhat.");
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2138 /* Sound -- Sound breathers resist */
2141 if (seen) obvious = TRUE;
2143 if (r_ptr->flagsr & RFR_RES_ALL)
2145 note = _("には完全な耐性がある!", " is immune.");
2147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2150 if (r_ptr->flagsr & RFR_RES_SOUN)
2152 note = _("には耐性がある。", " resists.");
2153 dam *= 2; dam /= randint1(6) + 6;
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2156 else do_stun = (10 + randint1(15) + r) / (r + 1);
2163 if (seen) obvious = TRUE;
2165 if (r_ptr->flagsr & RFR_RES_ALL)
2167 note = _("には完全な耐性がある!", " is immune.");
2169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2172 if (r_ptr->flags3 & RF3_NO_CONF)
2174 note = _("には耐性がある。", " resists.");
2175 dam *= 3; dam /= randint1(6) + 6;
2176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2178 else do_conf = (10 + randint1(15) + r) / (r + 1);
2182 /* Disenchantment -- Breathers and Disenchanters resist */
2185 if (seen) obvious = TRUE;
2187 if (r_ptr->flagsr & RFR_RES_ALL)
2189 note = _("には完全な耐性がある!", " is immune.");
2191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2194 if (r_ptr->flagsr & RFR_RES_DISE)
2196 note = _("には耐性がある。", " resists.");
2197 dam *= 3; dam /= randint1(6) + 6;
2198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2203 /* Nexus -- Breathers and Existers resist */
2206 if (seen) obvious = TRUE;
2208 if (r_ptr->flagsr & RFR_RES_ALL)
2210 note = _("には完全な耐性がある!", " is immune.");
2212 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2215 if (r_ptr->flagsr & RFR_RES_NEXU)
2217 note = _("には耐性がある。", " resists.");
2218 dam *= 3; dam /= randint1(6) + 6;
2219 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2227 if (seen) obvious = TRUE;
2229 if (r_ptr->flagsr & RFR_RES_ALL)
2231 note = _("には完全な耐性がある!", " is immune.");
2233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2236 if (r_ptr->flagsr & RFR_RES_WALL)
2238 note = _("には耐性がある。", " resists.");
2239 dam *= 3; dam /= randint1(6) + 6;
2240 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2242 else do_stun = (randint1(15) + r) / (r + 1);
2246 /* Inertia -- breathers resist */
2249 if (seen) obvious = TRUE;
2251 if (r_ptr->flagsr & RFR_RES_ALL)
2253 note = _("には完全な耐性がある!", " is immune.");
2255 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2258 if (r_ptr->flagsr & RFR_RES_INER)
2260 note = _("には耐性がある。", " resists.");
2261 dam *= 3; dam /= randint1(6) + 6;
2262 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2266 /* Powerful monsters can resist */
2267 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2268 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2272 /* Normal monsters slow down */
2275 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2277 note = _("の動きが遅くなった。", " starts moving slower.");
2284 /* Time -- breathers resist */
2287 if (seen) obvious = TRUE;
2289 if (r_ptr->flagsr & RFR_RES_ALL)
2291 note = _("には完全な耐性がある!", " is immune.");
2293 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2296 if (r_ptr->flagsr & RFR_RES_TIME)
2298 note = _("には耐性がある。", " resists.");
2299 dam *= 3; dam /= randint1(6) + 6;
2300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2302 else do_time = (dam + 1) / 2;
2306 /* Gravity -- breathers resist */
2309 bool resist_tele = FALSE;
2311 if (seen) obvious = TRUE;
2313 if (r_ptr->flagsr & RFR_RES_ALL)
2315 note = _("には完全な耐性がある!", " is immune.");
2317 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2320 if (r_ptr->flagsr & RFR_RES_TELE)
2322 if (r_ptr->flags1 & (RF1_UNIQUE))
2324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2325 note = _("には効果がなかった。", " is unaffected!");
2328 else if (r_ptr->level > randint1(100))
2330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2331 note = _("には耐性がある!", " resists!");
2336 if (!resist_tele) do_dist = 10;
2338 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2340 if (r_ptr->flagsr & RFR_RES_GRAV)
2342 note = _("には耐性がある!", " resists!");
2343 dam *= 3; dam /= randint1(6) + 6;
2345 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2350 /* Powerful monsters can resist */
2351 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2352 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2356 /* Normal monsters slow down */
2359 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2361 note = _("の動きが遅くなった。", " starts moving slower.");
2366 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2368 /* Attempt a saving throw */
2369 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2370 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2374 /* No obvious effect */
2375 note = _("には効果がなかった。", " is unaffected!");
2387 if (seen) obvious = TRUE;
2389 if (r_ptr->flagsr & RFR_RES_ALL)
2391 note = _("には完全な耐性がある!", " is immune.");
2393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2401 case GF_DISINTEGRATE:
2403 if (seen) obvious = TRUE;
2405 if (r_ptr->flagsr & RFR_RES_ALL)
2407 note = _("には完全な耐性がある!", " is immune.");
2409 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2412 if (r_ptr->flags3 & RF3_HURT_ROCK)
2414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2415 note = _("の皮膚がただれた!", " loses some skin!");
2416 note_dies = _("は蒸発した!", " evaporates!");
2424 if (seen) obvious = TRUE;
2426 /* PSI only works if the monster can see you! -- RG */
2427 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2430 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2435 if (r_ptr->flagsr & RFR_RES_ALL)
2437 note = _("には完全な耐性がある!", " is immune.");
2439 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2442 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2445 note = _("には完全な耐性がある!", " is immune.");
2446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2449 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2450 (r_ptr->flags3 & RF3_ANIMAL) ||
2451 (r_ptr->level > randint1(3 * dam)))
2453 note = _("には耐性がある!", " resists!");
2457 * Powerful demons & undead can turn a mindcrafter's
2458 * attacks back on them
2460 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2461 (r_ptr->level > p_ptr->lev / 2) &&
2465 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2466 (seen ? "%^s's corrupted mind backlashes your attack!" :
2467 "%^ss corrupted mind backlashes your attack!")), m_name);
2470 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2472 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2476 /* Injure +/- confusion */
2477 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2478 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2479 if (one_in_(4) && !CHECK_MULTISHADOW())
2481 switch (randint1(4))
2484 set_confused(p_ptr->confused + 3 + randint1(dam));
2487 set_stun(p_ptr->stun + randint1(dam));
2491 if (r_ptr->flags3 & RF3_NO_FEAR)
2492 note = _("には効果がなかった。", " is unaffected.");
2494 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2498 if (!p_ptr->free_act)
2499 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2508 if ((dam > 0) && one_in_(4))
2510 switch (randint1(4))
2513 do_conf = 3 + randint1(dam);
2516 do_stun = 3 + randint1(dam);
2519 do_fear = 3 + randint1(dam);
2522 note = _("は眠り込んでしまった!", " falls asleep!");
2523 do_sleep = 3 + randint1(dam);
2528 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2534 if (seen) obvious = TRUE;
2536 if (r_ptr->flagsr & RFR_RES_ALL)
2538 note = _("には完全な耐性がある!", " is immune.");
2540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2543 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2546 note = _("には完全な耐性がある!", " is immune.");
2548 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2549 (r_ptr->flags3 & RF3_ANIMAL) ||
2550 (r_ptr->level > randint1(3 * dam)))
2552 note = _("には耐性がある!", " resists!");
2556 * Powerful demons & undead can turn a mindcrafter's
2557 * attacks back on them
2559 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2560 (r_ptr->level > p_ptr->lev / 2) &&
2564 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2565 (seen ? "%^s's corrupted mind backlashes your attack!" :
2566 "%^ss corrupted mind backlashes your attack!")), m_name);
2568 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2570 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2574 /* Injure + mana drain */
2575 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2576 if (!CHECK_MULTISHADOW())
2578 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2579 p_ptr->csp -= damroll(5, dam) / 2;
2580 if (p_ptr->csp < 0) p_ptr->csp = 0;
2581 p_ptr->redraw |= PR_MANA;
2582 p_ptr->window |= (PW_SPELL);
2584 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2591 int b = damroll(5, dam) / 4;
2592 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2593 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2594 (seen ? "You convert %s's pain into %s!" :
2595 "You convert %ss pain into %s!"));
2596 msg_format(msg, m_name, str);
2598 b = MIN(p_ptr->msp, p_ptr->csp + b);
2600 p_ptr->redraw |= PR_MANA;
2601 p_ptr->window |= (PW_SPELL);
2603 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2607 case GF_TELEKINESIS:
2609 if (seen) obvious = TRUE;
2611 if (r_ptr->flagsr & RFR_RES_ALL)
2613 note = _("には完全な耐性がある!", " is immune.");
2615 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2620 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2625 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2627 /* Attempt a saving throw */
2628 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2629 (r_ptr->level > 5 + randint1(dam)))
2633 /* No obvious effect */
2639 /* Psycho-spear -- powerful magic missile */
2642 if (seen) obvious = TRUE;
2644 if (r_ptr->flagsr & RFR_RES_ALL)
2646 note = _("には完全な耐性がある!", " is immune.");
2648 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2654 /* Meteor -- powerful magic missile */
2657 if (seen) obvious = TRUE;
2659 if (r_ptr->flagsr & RFR_RES_ALL)
2661 note = _("には完全な耐性がある!", " is immune.");
2663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2671 if (!is_hostile(m_ptr)) break;
2673 if (seen) obvious = TRUE;
2675 if (r_ptr->flagsr & RFR_RES_ALL)
2677 note = _("には効果がなかった!", " is immune.");
2679 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2682 /* Attempt a saving throw */
2683 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2684 (r_ptr->flags3 & RF3_NO_CONF) ||
2685 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2687 /* Memorize a flag */
2688 if (r_ptr->flags3 & RF3_NO_CONF)
2690 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2697 * Powerful demons & undead can turn a mindcrafter's
2698 * attacks back on them
2700 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2701 (r_ptr->level > p_ptr->lev / 2) &&
2705 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2706 (seen ? "%^s's corrupted mind backlashes your attack!" :
2707 "%^ss corrupted mind backlashes your attack!")), m_name);
2710 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2712 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2716 /* Confuse, stun, terrify */
2717 switch (randint1(4))
2720 set_stun(p_ptr->stun + dam / 2);
2723 set_confused(p_ptr->confused + dam / 2);
2727 if (r_ptr->flags3 & RF3_NO_FEAR)
2728 note = _("には効果がなかった。", " is unaffected.");
2730 set_afraid(p_ptr->afraid + dam);
2737 /* No obvious effect */
2738 note = _("には効果がなかった。", " is unaffected.");
2744 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2746 note = _("があなたに隷属した。", " is in your thrall!");
2751 switch (randint1(4))
2765 /* No "real" damage */
2772 /* Ice -- Cold + Cuts + Stun */
2775 if (seen) obvious = TRUE;
2777 if (r_ptr->flagsr & RFR_RES_ALL)
2779 note = _("には完全な耐性がある!", " is immune.");
2781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2784 do_stun = (randint1(15) + 1) / (r + 1);
2785 if (r_ptr->flagsr & RFR_IM_COLD)
2787 note = _("にはかなり耐性がある!", " resists a lot.");
2789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2791 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2793 note = _("はひどい痛手をうけた。", " is hit hard.");
2795 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2802 case GF_HYPODYNAMIA:
2804 if (seen) obvious = TRUE;
2806 if (r_ptr->flagsr & RFR_RES_ALL)
2808 note = _("には完全な耐性がある!", " is immune.");
2810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2813 if (!monster_living(r_ptr))
2815 if (is_original_ap_and_seen(m_ptr))
2817 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2818 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2819 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2821 note = _("には効果がなかった。", " is unaffected.");
2825 else do_time = (dam+7)/8;
2833 if (seen) obvious = TRUE;
2835 if (r_ptr->flagsr & RFR_RES_ALL)
2837 note = _("には完全な耐性がある!", " is immune.");
2839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2842 if (!monster_living(r_ptr))
2844 if (is_original_ap_and_seen(m_ptr))
2846 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2847 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2848 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2850 note = _("には完全な耐性がある!", " is immune.");
2854 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2855 (randint1(888) != 666)) ||
2856 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2857 randint1(100) != 66))
2859 note = _("には耐性がある!", " resists!");
2867 /* Polymorph monster (Use "dam" as "power") */
2870 if (seen) obvious = TRUE;
2872 if (r_ptr->flagsr & RFR_RES_ALL)
2874 note = _("には効果がなかった。", " is unaffected.");
2876 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2879 /* Attempt to polymorph (see below) */
2882 /* Powerful monsters can resist */
2883 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2884 (r_ptr->flags1 & RF1_QUESTOR) ||
2885 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2887 note = _("には効果がなかった。", " is unaffected.");
2892 /* No "real" damage */
2899 /* Clone monsters (Ignore "dam") */
2902 if (seen) obvious = TRUE;
2904 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2906 note = _("には効果がなかった。", " is unaffected.");
2911 m_ptr->hp = m_ptr->maxhp;
2913 /* Attempt to clone. */
2914 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2916 note = _("が分裂した!", " spawns!");
2920 /* No "real" damage */
2927 /* Heal Monster (use "dam" as amount of healing) */
2930 if (seen) obvious = TRUE;
2933 (void)set_monster_csleep(c_ptr->m_idx, 0);
2935 if (m_ptr->maxhp < m_ptr->max_maxhp)
2937 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2938 m_ptr->maxhp = m_ptr->max_maxhp;
2943 /* Redraw (later) if needed */
2944 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2945 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2953 if (seen) obvious = TRUE;
2956 (void)set_monster_csleep(c_ptr->m_idx, 0);
2957 if (MON_STUNNED(m_ptr))
2959 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2960 (void)set_monster_stunned(c_ptr->m_idx, 0);
2962 if (MON_CONFUSED(m_ptr))
2964 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2965 (void)set_monster_confused(c_ptr->m_idx, 0);
2967 if (MON_MONFEAR(m_ptr))
2969 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2970 (void)set_monster_monfear(c_ptr->m_idx, 0);
2974 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2977 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2981 chg_virtue(V_VITALITY, 1);
2983 if (r_ptr->flags1 & RF1_UNIQUE)
2984 chg_virtue(V_INDIVIDUALISM, 1);
2986 if (is_friendly(m_ptr))
2987 chg_virtue(V_HONOUR, 1);
2988 else if (!(r_ptr->flags3 & RF3_EVIL))
2990 if (r_ptr->flags3 & RF3_GOOD)
2991 chg_virtue(V_COMPASSION, 2);
2993 chg_virtue(V_COMPASSION, 1);
2996 if (r_ptr->flags3 & RF3_ANIMAL)
2997 chg_virtue(V_NATURE, 1);
3000 if (m_ptr->r_idx == MON_LEPER)
3003 if (!who) chg_virtue(V_COMPASSION, 5);
3006 /* Redraw (later) if needed */
3007 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3008 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3010 note = _("は体力を回復したようだ。", " looks healthier.");
3012 /* No "real" damage */
3018 /* Speed Monster (Ignore "dam") */
3021 if (seen) obvious = TRUE;
3024 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3026 note = _("の動きが速くなった。", " starts moving faster.");
3031 if (r_ptr->flags1 & RF1_UNIQUE)
3032 chg_virtue(V_INDIVIDUALISM, 1);
3033 if (is_friendly(m_ptr))
3034 chg_virtue(V_HONOUR, 1);
3037 /* No "real" damage */
3043 /* Slow Monster (Use "dam" as "power") */
3046 if (seen) obvious = TRUE;
3048 if (r_ptr->flagsr & RFR_RES_ALL)
3050 note = _("には効果がなかった。", " is unaffected.");
3052 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3055 /* Powerful monsters can resist */
3056 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3057 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3059 note = _("には効果がなかった。", " is unaffected.");
3063 /* Normal monsters slow down */
3066 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3068 note = _("の動きが遅くなった。", " starts moving slower.");
3072 /* No "real" damage */
3078 /* Sleep (Use "dam" as "power") */
3081 if (seen) obvious = TRUE;
3083 if (r_ptr->flagsr & RFR_RES_ALL)
3085 note = _("には効果がなかった。", " is unaffected.");
3087 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3090 /* Attempt a saving throw */
3091 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3092 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3093 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3095 /* Memorize a flag */
3096 if (r_ptr->flags3 & RF3_NO_SLEEP)
3098 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3100 /* No obvious effect */
3101 note = _("には効果がなかった。", " is unaffected.");
3106 /* Go to sleep (much) later */
3107 note = _("は眠り込んでしまった!", " falls asleep!");
3111 /* No "real" damage */
3117 /* Sleep (Use "dam" as "power") */
3118 case GF_STASIS_EVIL:
3120 if (seen) obvious = TRUE;
3122 if (r_ptr->flagsr & RFR_RES_ALL)
3124 note = _("には効果がなかった!", " is immune.");
3126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3129 /* Attempt a saving throw */
3130 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3131 !(r_ptr->flags3 & RF3_EVIL) ||
3132 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3134 note = _("には効果がなかった。", " is unaffected.");
3139 /* Go to sleep (much) later */
3140 note = _("は動けなくなった!", " is suspended!");
3144 /* No "real" damage */
3149 /* Sleep (Use "dam" as "power") */
3152 if (seen) obvious = TRUE;
3154 if (r_ptr->flagsr & RFR_RES_ALL)
3156 note = _("には効果がなかった。", " is unaffected.");
3158 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3161 /* Attempt a saving throw */
3162 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3163 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3165 note = _("には効果がなかった。", " is unaffected.");
3170 /* Go to sleep (much) later */
3171 note = _("は動けなくなった!", " is suspended!");
3175 /* No "real" damage */
3184 vir = virtue_number(V_HARMONY);
3187 dam += p_ptr->virtues[vir-1]/10;
3190 vir = virtue_number(V_INDIVIDUALISM);
3193 dam -= p_ptr->virtues[vir-1]/20;
3196 if (seen) obvious = TRUE;
3198 /* Attempt a saving throw */
3199 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3203 /* No obvious effect */
3204 note = _("には効果がなかった。", " is unaffected.");
3207 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3209 else if (p_ptr->cursed & TRC_AGGRAVATE)
3211 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3212 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3216 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3219 chg_virtue(V_INDIVIDUALISM, -1);
3220 if (r_ptr->flags3 & RF3_ANIMAL)
3221 chg_virtue(V_NATURE, 1);
3224 /* No "real" damage */
3229 /* Control undead */
3230 case GF_CONTROL_UNDEAD:
3233 if (seen) obvious = TRUE;
3235 vir = virtue_number(V_UNLIFE);
3238 dam += p_ptr->virtues[vir-1]/10;
3241 vir = virtue_number(V_INDIVIDUALISM);
3244 dam -= p_ptr->virtues[vir-1]/20;
3247 /* Attempt a saving throw */
3248 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3249 !(r_ptr->flags3 & RF3_UNDEAD))
3251 /* No obvious effect */
3252 note = _("には効果がなかった。", " is unaffected.");
3254 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3256 else if (p_ptr->cursed & TRC_AGGRAVATE)
3258 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3259 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3263 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3267 /* No "real" damage */
3273 case GF_CONTROL_DEMON:
3276 if (seen) obvious = TRUE;
3278 vir = virtue_number(V_UNLIFE);
3281 dam += p_ptr->virtues[vir-1]/10;
3284 vir = virtue_number(V_INDIVIDUALISM);
3287 dam -= p_ptr->virtues[vir-1]/20;
3290 /* Attempt a saving throw */
3291 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3292 !(r_ptr->flags3 & RF3_DEMON))
3294 /* No obvious effect */
3295 note = _("には効果がなかった。", " is unaffected.");
3297 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3299 else if (p_ptr->cursed & TRC_AGGRAVATE)
3301 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3302 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3306 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3310 /* No "real" damage */
3316 case GF_CONTROL_ANIMAL:
3319 if (seen) obvious = TRUE;
3321 vir = virtue_number(V_NATURE);
3324 dam += p_ptr->virtues[vir-1]/10;
3327 vir = virtue_number(V_INDIVIDUALISM);
3330 dam -= p_ptr->virtues[vir-1]/20;
3333 /* Attempt a saving throw */
3334 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3335 !(r_ptr->flags3 & RF3_ANIMAL))
3338 /* No obvious effect */
3339 note = _("には効果がなかった。", " is unaffected.");
3341 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3343 else if (p_ptr->cursed & TRC_AGGRAVATE)
3345 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3346 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3350 note = _("はなついた。", " is tamed!");
3352 if (r_ptr->flags3 & RF3_ANIMAL)
3353 chg_virtue(V_NATURE, 1);
3356 /* No "real" damage */
3362 case GF_CHARM_LIVING:
3366 vir = virtue_number(V_UNLIFE);
3367 if (seen) obvious = TRUE;
3369 vir = virtue_number(V_UNLIFE);
3372 dam -= p_ptr->virtues[vir-1]/10;
3375 vir = virtue_number(V_INDIVIDUALISM);
3378 dam -= p_ptr->virtues[vir-1]/20;
3381 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3383 /* Attempt a saving throw */
3384 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3385 !monster_living(r_ptr))
3388 /* No obvious effect */
3389 note = _("には効果がなかった。", " is unaffected.");
3391 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3393 else if (p_ptr->cursed & TRC_AGGRAVATE)
3395 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3396 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3400 note = _("を支配した。", " is tamed!");
3402 if (r_ptr->flags3 & RF3_ANIMAL)
3403 chg_virtue(V_NATURE, 1);
3406 /* No "real" damage */
3411 /* Confusion (Use "dam" as "power") */
3414 if (seen) obvious = TRUE;
3416 if (r_ptr->flagsr & RFR_RES_ALL)
3418 note = _("には効果がなかった。", " is unaffected.");
3420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3423 /* Get confused later */
3424 do_conf = damroll(3, (dam / 2)) + 1;
3426 /* Attempt a saving throw */
3427 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3428 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3429 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3431 /* Memorize a flag */
3432 if (r_ptr->flags3 & (RF3_NO_CONF))
3434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3440 /* No obvious effect */
3441 note = _("には効果がなかった。", " is unaffected.");
3445 /* No "real" damage */
3452 if (seen) obvious = TRUE;
3454 if (r_ptr->flagsr & RFR_RES_ALL)
3456 note = _("には効果がなかった。", " is unaffected.");
3458 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3461 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3463 /* Attempt a saving throw */
3464 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3465 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3470 /* No obvious effect */
3471 note = _("には効果がなかった。", " is unaffected.");
3475 /* No "real" damage */
3483 /* Lite, but only hurts susceptible creatures */
3491 if (r_ptr->flagsr & RFR_RES_ALL)
3497 if (r_ptr->flags3 & (RF3_HURT_LITE))
3499 /* Obvious effect */
3500 if (seen) obvious = TRUE;
3502 /* Memorize the effects */
3503 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3505 /* Special effect */
3506 note = _("は光に身をすくめた!", " cringes from the light!");
3507 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3510 /* Normally no damage */
3522 /* Lite -- opposite of Dark */
3525 if (seen) obvious = TRUE;
3527 if (r_ptr->flagsr & RFR_RES_ALL)
3529 note = _("には完全な耐性がある!", " is immune.");
3531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3534 if (r_ptr->flagsr & RFR_RES_LITE)
3536 note = _("には耐性がある!", " resists!");
3537 dam *= 2; dam /= (randint1(6)+6);
3538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3540 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3542 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3543 note = _("は光に身をすくめた!", " cringes from the light!");
3544 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3551 /* Dark -- opposite of Lite */
3554 if (seen) obvious = TRUE;
3556 if (r_ptr->flagsr & RFR_RES_ALL)
3558 note = _("には完全な耐性がある!", " is immune.");
3560 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3563 if (r_ptr->flagsr & RFR_RES_DARK)
3565 note = _("には耐性がある!", " resists!");
3566 dam *= 2; dam /= (randint1(6)+6);
3567 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3576 if (r_ptr->flagsr & RFR_RES_ALL)
3581 /* Hurt by rock remover */
3582 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3585 if (seen) obvious = TRUE;
3587 /* Memorize the effects */
3588 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3590 /* Cute little message */
3591 note = _("の皮膚がただれた!", " loses some skin!");
3592 note_dies = _("はドロドロに溶けた!", " dissolves!");
3595 /* Usually, ignore the effects */
3606 /* Teleport undead (Use "dam" as "power") */
3607 case GF_AWAY_UNDEAD:
3609 /* Only affect undead */
3610 if (r_ptr->flags3 & (RF3_UNDEAD))
3612 bool resists_tele = FALSE;
3614 if (r_ptr->flagsr & RFR_RES_TELE)
3616 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3619 note = _("には効果がなかった。", " is unaffected.");
3620 resists_tele = TRUE;
3622 else if (r_ptr->level > randint1(100))
3624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3625 note = _("には耐性がある!", " resists!");
3626 resists_tele = TRUE;
3632 if (seen) obvious = TRUE;
3633 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3645 /* No "real" damage */
3651 /* Teleport evil (Use "dam" as "power") */
3654 /* Only affect evil */
3655 if (r_ptr->flags3 & (RF3_EVIL))
3657 bool resists_tele = FALSE;
3659 if (r_ptr->flagsr & RFR_RES_TELE)
3661 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3664 note = _("には効果がなかった。", " is unaffected.");
3665 resists_tele = TRUE;
3667 else if (r_ptr->level > randint1(100))
3669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3670 note = _("には耐性がある!", " resists!");
3671 resists_tele = TRUE;
3677 if (seen) obvious = TRUE;
3678 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3690 /* No "real" damage */
3696 /* Teleport monster (Use "dam" as "power") */
3699 bool resists_tele = FALSE;
3700 if (r_ptr->flagsr & RFR_RES_TELE)
3702 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3704 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3705 note = _("には効果がなかった。", " is unaffected.");
3706 resists_tele = TRUE;
3708 else if (r_ptr->level > randint1(100))
3710 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3711 note = _("には耐性がある!", " resists!");
3712 resists_tele = TRUE;
3719 if (seen) obvious = TRUE;
3721 /* Prepare to teleport */
3725 /* No "real" damage */
3731 /* Turn undead (Use "dam" as "power") */
3732 case GF_TURN_UNDEAD:
3734 if (r_ptr->flagsr & RFR_RES_ALL)
3739 /* Only affect undead */
3740 if (r_ptr->flags3 & (RF3_UNDEAD))
3743 if (seen) obvious = TRUE;
3745 /* Learn about type */
3746 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3748 /* Apply some fear */
3749 do_fear = damroll(3, (dam / 2)) + 1;
3751 /* Attempt a saving throw */
3752 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3754 /* No obvious effect */
3755 note = _("には効果がなかった。", " is unaffected.");
3768 /* No "real" damage */
3774 /* Turn evil (Use "dam" as "power") */
3777 if (r_ptr->flagsr & RFR_RES_ALL)
3782 /* Only affect evil */
3783 if (r_ptr->flags3 & (RF3_EVIL))
3786 if (seen) obvious = TRUE;
3788 /* Learn about type */
3789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3791 /* Apply some fear */
3792 do_fear = damroll(3, (dam / 2)) + 1;
3794 /* Attempt a saving throw */
3795 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3797 /* No obvious effect */
3798 note = _("には効果がなかった。", " is unaffected.");
3811 /* No "real" damage */
3817 /* Turn monster (Use "dam" as "power") */
3820 if (r_ptr->flagsr & RFR_RES_ALL)
3826 if (seen) obvious = TRUE;
3828 /* Apply some fear */
3829 do_fear = damroll(3, (dam / 2)) + 1;
3831 /* Attempt a saving throw */
3832 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3833 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3834 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3836 /* No obvious effect */
3837 note = _("には効果がなかった。", " is unaffected.");
3842 /* No "real" damage */
3849 case GF_DISP_UNDEAD:
3851 if (r_ptr->flagsr & RFR_RES_ALL)
3857 /* Only affect undead */
3858 if (r_ptr->flags3 & (RF3_UNDEAD))
3861 if (seen) obvious = TRUE;
3863 /* Learn about type */
3864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3866 note = _("は身震いした。", " shudders.");
3867 note_dies = _("はドロドロに溶けた!", " dissolves!");
3887 if (r_ptr->flagsr & RFR_RES_ALL)
3893 /* Only affect evil */
3894 if (r_ptr->flags3 & (RF3_EVIL))
3897 if (seen) obvious = TRUE;
3899 /* Learn about type */
3900 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3902 note = _("は身震いした。", " shudders.");
3903 note_dies = _("はドロドロに溶けた!", " dissolves!");
3922 if (r_ptr->flagsr & RFR_RES_ALL)
3928 /* Only affect good */
3929 if (r_ptr->flags3 & (RF3_GOOD))
3932 if (seen) obvious = TRUE;
3934 /* Learn about type */
3935 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3937 note = _("は身震いした。", " shudders.");
3938 note_dies = _("はドロドロに溶けた!", " dissolves!");
3955 case GF_DISP_LIVING:
3957 if (r_ptr->flagsr & RFR_RES_ALL)
3963 /* Only affect non-undead */
3964 if (monster_living(r_ptr))
3967 if (seen) obvious = TRUE;
3969 note = _("は身震いした。", " shudders.");
3970 note_dies = _("はドロドロに溶けた!", " dissolves!");
3989 if (r_ptr->flagsr & RFR_RES_ALL)
3995 /* Only affect demons */
3996 if (r_ptr->flags3 & (RF3_DEMON))
3999 if (seen) obvious = TRUE;
4001 /* Learn about type */
4002 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4004 note = _("は身震いした。", " shudders.");
4005 note_dies = _("はドロドロに溶けた!", " dissolves!");
4021 /* Dispel monster */
4024 if (r_ptr->flagsr & RFR_RES_ALL)
4031 if (seen) obvious = TRUE;
4033 note = _("は身震いした。", " shudders.");
4034 note_dies = _("はドロドロに溶けた!", " dissolves!");
4041 if (seen) obvious = TRUE;
4043 if (r_ptr->flagsr & RFR_RES_ALL)
4045 note = _("には完全な耐性がある!", " is immune.");
4047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4051 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4055 /* Heal the monster */
4056 if (caster_ptr->hp < caster_ptr->maxhp)
4059 caster_ptr->hp += dam;
4060 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4062 /* Redraw (later) if needed */
4063 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4064 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4066 /* Special message */
4069 /* Get the monster name */
4070 monster_desc(killer, caster_ptr, 0);
4071 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4077 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4078 (void)hp_player(dam);
4083 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4092 if (seen) obvious = TRUE;
4093 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4095 if (r_ptr->flagsr & RFR_RES_ALL)
4097 note = _("には完全な耐性がある!", " is immune.");
4099 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4103 /* Attempt a saving throw */
4104 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4105 (r_ptr->flags3 & RF3_NO_CONF) ||
4106 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4108 /* Memorize a flag */
4109 if (r_ptr->flags3 & (RF3_NO_CONF))
4111 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4113 note = _("には効果がなかった。", " is unaffected.");
4116 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4118 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4119 note = _("には完全な耐性がある!", " is immune.");
4122 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4125 note = _("には耐性がある。", " resists.");
4130 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4131 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4133 if (who > 0) do_conf = randint0(4) + 4;
4134 else do_conf = randint0(8) + 8;
4140 case GF_BRAIN_SMASH:
4142 if (seen) obvious = TRUE;
4143 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4145 if (r_ptr->flagsr & RFR_RES_ALL)
4147 note = _("には完全な耐性がある!", " is immune.");
4149 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4153 /* Attempt a saving throw */
4154 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4155 (r_ptr->flags3 & RF3_NO_CONF) ||
4156 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4158 /* Memorize a flag */
4159 if (r_ptr->flags3 & (RF3_NO_CONF))
4161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4163 note = _("には効果がなかった。", " is unaffected.");
4166 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4169 note = _("には完全な耐性がある!", " is immune.");
4172 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4175 note = _("には耐性がある!", " resists!");
4180 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4181 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4185 do_conf = randint0(4) + 4;
4186 do_stun = randint0(4) + 4;
4190 do_conf = randint0(8) + 8;
4191 do_stun = randint0(8) + 8;
4193 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4201 if (seen) obvious = TRUE;
4202 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4204 if (r_ptr->flagsr & RFR_RES_ALL)
4206 note = _("には完全な耐性がある!", " is immune.");
4208 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4212 /* Attempt a saving throw */
4213 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4215 note = _("には効果がなかった。", " is unaffected.");
4224 if (seen) obvious = TRUE;
4225 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4227 if (r_ptr->flagsr & RFR_RES_ALL)
4229 note = _("には完全な耐性がある!", " is immune.");
4231 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4235 /* Attempt a saving throw */
4236 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4238 note = _("には効果がなかった。", " is unaffected.");
4247 if (seen) obvious = TRUE;
4248 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4250 if (r_ptr->flagsr & RFR_RES_ALL)
4252 note = _("には完全な耐性がある!", " is immune.");
4254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4258 /* Attempt a saving throw */
4259 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4261 note = _("には効果がなかった。", " is unaffected.");
4270 if (seen) obvious = TRUE;
4272 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4273 "You point at %s, screaming the word, 'DIE!'."), m_name);
4275 if (r_ptr->flagsr & RFR_RES_ALL)
4277 note = _("には完全な耐性がある!", " is immune.");
4279 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4283 /* Attempt a saving throw */
4284 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4286 note = _("には効果がなかった。", " is unaffected.");
4295 if (seen) obvious = TRUE;
4297 if (r_ptr->flagsr & RFR_RES_ALL)
4299 note = _("には完全な耐性がある!", " is immune.");
4301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4305 if (r_ptr->flags1 & RF1_UNIQUE)
4307 note = _("には効果がなかった。", " is unaffected.");
4312 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4313 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4315 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4317 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4321 note = _("は耐性を持っている!", "resists!");
4328 /* Capture monster */
4332 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4333 (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)
4335 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4340 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4341 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4342 nokori_hp = m_ptr->maxhp * 3 / 10;
4344 nokori_hp = m_ptr->maxhp * 3 / 20;
4346 if (m_ptr->hp >= nokori_hp)
4348 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4351 else if (m_ptr->hp < randint0(nokori_hp))
4353 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4354 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4355 cap_mon = m_ptr->r_idx;
4356 cap_mspeed = m_ptr->mspeed;
4358 cap_maxhp = m_ptr->max_maxhp;
4359 cap_nickname = m_ptr->nickname; /* Quark transfer */
4360 if (c_ptr->m_idx == p_ptr->riding)
4362 if (rakuba(-1, FALSE))
4364 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4368 delete_monster_idx(c_ptr->m_idx);
4374 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4380 /* Attack (Use "dam" as attack type) */
4383 /* Return this monster's death */
4384 return py_attack(y, x, dam);
4387 /* Sleep (Use "dam" as "power") */
4393 if (seen) obvious = TRUE;
4395 if (r_ptr->flagsr & RFR_RES_ALL)
4397 note = _("には効果がなかった。", " is unaffected.");
4399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4402 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4404 note = _("には効果がなかった。", " is unaffected.");
4407 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4410 if (MON_CSLEEP(m_ptr))
4412 note = _("には効果がなかった。", " is unaffected.");
4418 if (one_in_(5)) effect = 1;
4419 else if (one_in_(4)) effect = 2;
4420 else if (one_in_(3)) effect = 3;
4425 /* Powerful monsters can resist */
4426 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4427 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4429 note = _("には効果がなかった。", " is unaffected.");
4433 /* Normal monsters slow down */
4436 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4438 note = _("の動きが遅くなった。", " starts moving slower.");
4443 else if (effect == 2)
4445 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4447 /* Attempt a saving throw */
4448 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4449 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4454 /* No obvious effect */
4455 note = _("には効果がなかった。", " is unaffected.");
4460 else if (effect == 3)
4462 /* Attempt a saving throw */
4463 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4464 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4465 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4467 /* Memorize a flag */
4468 if (r_ptr->flags3 & RF3_NO_SLEEP)
4470 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4473 /* No obvious effect */
4474 note = _("には効果がなかった。", " is unaffected.");
4479 /* Go to sleep (much) later */
4480 note = _("は眠り込んでしまった!", " falls asleep!");
4487 note = _("には効果がなかった。", " is unaffected.");
4490 /* No "real" damage */
4498 if (seen) obvious = TRUE;
4500 if (r_ptr->flagsr & RFR_RES_ALL)
4502 note = _("には効果がなかった。", " is unaffected.");
4504 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4508 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4510 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4511 chg_virtue(V_VITALITY, -1);
4521 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4523 if (r_ptr->flags3 & (RF3_HURT_LITE))
4525 /* Obvious effect */
4526 if (seen) obvious = TRUE;
4528 /* Memorize the effects */
4529 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4531 /* Special effect */
4532 note = _("は光に身をすくめた!", " cringes from the light!");
4533 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4536 /* Normally no damage */
4543 photo = m_ptr->r_idx;
4550 case GF_BLOOD_CURSE:
4552 if (seen) obvious = TRUE;
4554 if (r_ptr->flagsr & RFR_RES_ALL)
4556 note = _("には完全な耐性がある!", " is immune.");
4558 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4566 bool success = FALSE;
4567 if (seen) obvious = TRUE;
4569 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4571 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4572 if (dam < 1) dam = 1;
4574 /* No need to tame your pet */
4577 note = _("の動きが速くなった。", " starts moving faster.");
4578 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4582 /* Attempt a saving throw */
4583 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4584 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4585 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4586 (p_ptr->cursed & TRC_AGGRAVATE) ||
4587 ((r_ptr->level+10) > randint1(dam)))
4590 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4594 note = _("を支配した。", " is tamed!");
4596 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4598 /* Learn about type */
4599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4606 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4608 do_fear = randint1(90)+10;
4610 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4613 /* No "real" damage */
4620 if (seen) obvious = TRUE;
4622 if (r_ptr->flagsr & RFR_RES_ALL)
4624 note = _("には完全な耐性がある!", " is immune.");
4626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4630 /* Attempt a saving throw */
4631 if (randint0(100 + dam) < (r_ptr->level + 50))
4633 note = _("には効果がなかった。", " is unaffected.");
4653 /* Absolutely no effect */
4654 if (skipped) return (FALSE);
4656 /* "Unique" monsters cannot be polymorphed */
4657 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4659 /* Quest monsters cannot be polymorphed */
4660 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4662 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4664 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4665 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4667 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4672 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4673 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4676 /* Modify the damage */
4678 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4679 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4681 /* Check for death */
4682 if (dam > m_ptr->hp)
4684 /* Extract method of death */
4689 /* Sound and Impact resisters never stun */
4691 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4692 !(r_ptr->flags3 & RF3_NO_STUN))
4695 if (seen) obvious = TRUE;
4698 if (MON_STUNNED(m_ptr))
4700 note = _("はひどくもうろうとした。", " is more dazed.");
4701 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4705 note = _("はもうろうとした。", " is dazed.");
4710 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4716 /* Confusion and Chaos resisters (and sleepers) never confuse */
4718 !(r_ptr->flags3 & RF3_NO_CONF) &&
4719 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4722 if (seen) obvious = TRUE;
4724 /* Already partially confused */
4725 if (MON_CONFUSED(m_ptr))
4727 note = _("はさらに混乱したようだ。", " looks more confused.");
4728 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4731 /* Was not confused */
4734 note = _("は混乱したようだ。", " looks confused.");
4738 /* Apply confusion */
4739 (void)set_monster_confused(c_ptr->m_idx, tmp);
4748 if (seen) obvious = TRUE;
4750 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4754 note = _("は弱くなったようだ。", " seems weakened.");
4755 m_ptr->maxhp -= do_time;
4756 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4761 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4762 if (do_poly && (randint1(90) > r_ptr->level))
4764 if (polymorph_monster(y, x))
4767 if (seen) obvious = TRUE;
4769 /* Monster polymorphs */
4770 note = _("が変身した!", " changes!");
4772 /* Turn off the damage */
4778 note = _("には効果がなかった。", " is unaffected.");
4781 /* Hack -- Get new monster */
4782 m_ptr = &m_list[c_ptr->m_idx];
4784 /* Hack -- Get new race */
4785 r_ptr = &r_info[m_ptr->r_idx];
4788 /* Handle "teleport" */
4792 if (seen) obvious = TRUE;
4794 note = _("が消え去った!", " disappears!");
4796 if (!who) chg_virtue(V_VALOUR, -1);
4799 teleport_away(c_ptr->m_idx, do_dist,
4800 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4802 /* Hack -- get new location */
4806 /* Hack -- get new grid */
4807 c_ptr = &cave[y][x];
4814 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4821 if (typ == GF_DRAIN_MANA)
4823 /* Drain mana does nothing */
4826 /* If another monster did the damage, hurt the monster by hand */
4829 /* Redraw (later) if needed */
4830 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4831 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4833 /* Wake the monster up */
4834 (void)set_monster_csleep(c_ptr->m_idx, 0);
4836 /* Hurt the monster */
4844 if (is_pet(m_ptr) && !(m_ptr->ml))
4847 /* Give detailed messages if destroyed */
4850 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4853 msg_format("%^s%s", m_name, note);
4861 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4863 /* Generate treasure, etc */
4864 monster_death(c_ptr->m_idx, FALSE);
4867 delete_monster_idx(c_ptr->m_idx);
4871 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4875 /* Damaged monster */
4878 /* Give detailed messages if visible or destroyed */
4879 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4881 /* Hack -- Pain message */
4884 message_pain(c_ptr->m_idx, dam);
4891 /* Hack -- handle sleep */
4892 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4896 else if (heal_leper)
4898 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4900 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4904 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4905 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4908 delete_monster_idx(c_ptr->m_idx);
4911 /* If the player did it, give him experience, check fear */
4916 /* Hurt the monster, check for fear and death */
4917 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4922 /* Damaged monster */
4925 /* HACK - anger the monster before showing the sleep message */
4926 if (do_sleep) anger_monster(m_ptr);
4928 /* Give detailed messages if visible or destroyed */
4929 if (note && seen_msg)
4930 msg_format(_("%s%s", "%^s%s"), m_name, note);
4932 /* Hack -- Pain message */
4933 else if (known && (dam || !do_fear))
4935 message_pain(c_ptr->m_idx, dam);
4938 /* Anger monsters */
4939 if (((dam > 0) || get_angry) && !do_sleep)
4940 anger_monster(m_ptr);
4943 if ((fear || do_fear) && seen)
4947 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4950 /* Hack -- handle sleep */
4951 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4955 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4957 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4961 switch (randint1(28))
4966 msg_print(_("地面が揺れた...", "The ground trembles..."));
4967 earthquake(ty, tx, 4 + randint0(4));
4968 if (!one_in_(6)) break;
4970 case 3: case 4: case 5: case 6:
4973 int extra_dam = damroll(10, 10);
4974 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4976 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4977 if (!one_in_(6)) break;
4982 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4984 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4985 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4986 if (!one_in_(6)) break;
4988 case 9: case 10: case 11:
4989 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4990 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4991 if (!one_in_(6)) break;
4992 case 12: case 13: case 14: case 15: case 16:
4993 aggravate_monsters(0);
4994 if (!one_in_(6)) break;
4996 count += activate_hi_summon(ty, tx, TRUE);
4997 if (!one_in_(6)) break;
4998 case 19: case 20: case 21: case 22:
5000 bool pet = !one_in_(3);
5001 BIT_FLAGS mode = PM_ALLOW_GROUP;
5003 if (pet) mode |= PM_FORCE_PET;
5004 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5006 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);
5007 if (!one_in_(6)) break;
5009 case 23: case 24: case 25:
5010 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5011 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5013 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5014 else lose_exp(p_ptr->exp / 16);
5015 if (!one_in_(6)) break;
5016 case 26: case 27: case 28:
5025 (void)do_dec_stat(i);
5034 (void)do_dec_stat(randint0(6));
5043 if (p_ptr->inside_battle)
5045 p_ptr->health_who = c_ptr->m_idx;
5046 p_ptr->redraw |= (PR_HEALTH);
5050 /* Verify this code */
5052 /* Update the monster */
5053 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5055 /* Redraw the monster grid */
5059 /* Update monster recall window */
5060 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5062 p_ptr->window |= (PW_MONSTER);
5065 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5069 if (!(flg & PROJECT_NO_HANGEKI))
5071 set_target(m_ptr, monster_target_y, monster_target_x);
5074 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5076 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5080 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5082 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5083 rakubadam_m = (dam > 200) ? 200 : dam;
5092 /* Get local object */
5095 /* Prepare to make a Blade of Chaos */
5096 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5098 q_ptr->pval = photo;
5100 /* Mark the item as fully known */
5101 q_ptr->ident |= (IDENT_MENTAL);
5103 /* Drop it in the dungeon */
5104 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5112 /* Return "Anything seen?" */
5117 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5118 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5119 * @param who_name 効果を起こしたモンスターの名前
5120 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5121 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5122 * @param x 目標X座標 / Target x location (or location to travel "towards")
5123 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5124 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5126 * @param monspell 効果元のモンスター魔法ID
5127 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5129 * Handle a beam/bolt/ball causing damage to the player.
5130 * This routine takes a "source monster" (by index), a "distance", a default
5131 * "damage", and a "damage type". See "project_m()" above.
5132 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5133 * is reduced (see "project_m()" above). This can happen if a monster breathes
5134 * at the player and hits a wall instead.
5135 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5136 * to know if this is actually a ball or a bolt spell
5137 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5138 * we just assume that the effects were obvious, for historical reasons.
5140 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)
5145 /* Hack -- assume obvious */
5146 bool obvious = TRUE;
5148 /* Player blind-ness */
5149 bool blind = (p_ptr->blind ? TRUE : FALSE);
5151 /* Player needs a "description" (he is blind) */
5154 /* Source monster */
5155 monster_type *m_ptr = NULL;
5157 /* Monster name (for attacks) */
5160 /* Monster name (for damage) */
5163 /* Hack -- messages */
5169 /* Player is not here */
5170 if (!player_bold(y, x)) return (FALSE);
5172 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5174 if (kawarimi(TRUE)) return FALSE;
5177 /* Player cannot hurt himself */
5178 if (!who) return (FALSE);
5179 if (who == p_ptr->riding) return (FALSE);
5181 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5184 int max_attempts = 10;
5185 sound(SOUND_REFLECT);
5188 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5189 else if (p_ptr->special_defense & KATA_FUUJIN)
5190 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5192 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5195 /* Choose 'new' target */
5200 t_y = m_list[who].fy - 1 + randint1(3);
5201 t_x = m_list[who].fx - 1 + randint1(3);
5204 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5206 if (max_attempts < 1)
5208 t_y = m_list[who].fy;
5209 t_x = m_list[who].fx;
5214 t_y = p_ptr->y - 1 + randint1(3);
5215 t_x = p_ptr->x - 1 + randint1(3);
5218 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5224 /* Limit maximum damage */
5225 if (dam > 1600) dam = 1600;
5227 /* Reduce damage by distance */
5228 dam = (dam + r) / (r + 1);
5231 /* If the player is blind, be more descriptive */
5232 if (blind) fuzzy = TRUE;
5237 /* Get the source monster */
5238 m_ptr = &m_list[who];
5239 /* Extract the monster level */
5240 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5242 /* Get the monster name */
5243 monster_desc(m_name, m_ptr, 0);
5245 /* Get the monster's real name (gotten before polymorph!) */
5246 strcpy(killer, who_name);
5252 case PROJECT_WHO_UNCTRL_POWER:
5253 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5256 case PROJECT_WHO_GLASS_SHARDS:
5257 strcpy(killer, _("ガラスの破片", "shards of glass"));
5261 strcpy(killer, _("罠", "a trap"));
5266 strcpy(m_name, killer);
5269 /* Analyze the damage */
5272 /* Standard damage -- hurts inventory too */
5275 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5276 get_damage = acid_dam(dam, killer, monspell, FALSE);
5280 /* Standard damage -- hurts inventory too */
5283 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5284 get_damage = fire_dam(dam, killer, monspell, FALSE);
5288 /* Standard damage -- hurts inventory too */
5291 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5292 get_damage = cold_dam(dam, killer, monspell, FALSE);
5296 /* Standard damage -- hurts inventory too */
5299 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5300 get_damage = elec_dam(dam, killer, monspell, FALSE);
5304 /* Standard damage -- also poisons player */
5307 bool double_resist = IS_OPPOSE_POIS();
5308 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5310 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5311 if (double_resist) dam = (dam + 2) / 3;
5313 if ((!(double_resist || p_ptr->resist_pois)) &&
5314 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5319 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5321 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5323 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5328 /* Standard damage -- also poisons / mutates player */
5331 bool double_resist = IS_OPPOSE_POIS();
5332 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5334 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5335 if (double_resist) dam = (2 * dam + 2) / 5;
5336 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5337 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5339 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5341 if (one_in_(5)) /* 6 */
5343 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5344 if (one_in_(4)) /* 4 */
5352 inven_damage(set_acid_destroy, 2);
5358 /* Standard damage */
5361 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5362 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5366 /* Holy Orb -- Player only takes partial damage */
5369 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5370 if (p_ptr->align > 10)
5372 else if (p_ptr->align < -10)
5374 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5380 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5381 if (p_ptr->align > 10)
5383 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5387 /* Arrow -- XXX no dodging */
5392 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5394 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5396 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5399 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5403 /* Plasma -- XXX No resist */
5406 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5407 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5409 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5411 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5412 (void)set_stun(p_ptr->stun + plus_stun);
5415 if (!(p_ptr->resist_fire ||
5417 p_ptr->immune_fire))
5419 inven_damage(set_acid_destroy, 3);
5425 /* Nether -- drain experience */
5428 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5429 if (p_ptr->resist_neth)
5431 if (!prace_is_(RACE_SPECTRE))
5433 dam *= 6; dam /= (randint1(4) + 7);
5436 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5438 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5440 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5442 learn_spell(monspell);
5446 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5452 /* Water -- stun/confuse */
5455 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5456 if (!CHECK_MULTISHADOW())
5458 if (!p_ptr->resist_sound)
5460 set_stun(p_ptr->stun + randint1(40));
5462 if (!p_ptr->resist_conf)
5464 set_confused(p_ptr->confused + randint1(5) + 5);
5469 inven_damage(set_cold_destroy, 3);
5473 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5477 /* Chaos -- many effects */
5480 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5481 if (p_ptr->resist_chaos)
5483 dam *= 6; dam /= (randint1(4) + 7);
5486 if (!CHECK_MULTISHADOW())
5488 if (!p_ptr->resist_conf)
5490 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5492 if (!p_ptr->resist_chaos)
5494 (void)set_image(p_ptr->image + randint1(10));
5497 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5498 (void)gain_random_mutation(0);
5501 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5503 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5506 if (!p_ptr->resist_chaos || one_in_(9))
5508 inven_damage(set_elec_destroy, 2);
5509 inven_damage(set_fire_destroy, 2);
5513 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5517 /* Shards -- mostly cutting */
5520 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5521 if (p_ptr->resist_shard)
5523 dam *= 6; dam /= (randint1(4) + 7);
5525 else if (!CHECK_MULTISHADOW())
5527 (void)set_cut(p_ptr->cut + dam);
5530 if (!p_ptr->resist_shard || one_in_(13))
5532 inven_damage(set_cold_destroy, 2);
5535 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5539 /* Sound -- mostly stunning */
5542 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5543 if (p_ptr->resist_sound)
5545 dam *= 5; dam /= (randint1(4) + 7);
5547 else if (!CHECK_MULTISHADOW())
5549 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5550 (void)set_stun(p_ptr->stun + plus_stun);
5553 if (!p_ptr->resist_sound || one_in_(13))
5555 inven_damage(set_cold_destroy, 2);
5558 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5562 /* Pure confusion */
5565 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5566 if (p_ptr->resist_conf)
5568 dam *= 5; dam /= (randint1(4) + 7);
5570 else if (!CHECK_MULTISHADOW())
5572 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5574 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5578 /* Disenchantment -- see above */
5581 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5582 if (p_ptr->resist_disen)
5584 dam *= 6; dam /= (randint1(4) + 7);
5586 else if (!CHECK_MULTISHADOW())
5588 (void)apply_disenchant(0);
5590 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5594 /* Nexus -- see above */
5597 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5598 if (p_ptr->resist_nexus)
5600 dam *= 6; dam /= (randint1(4) + 7);
5602 else if (!CHECK_MULTISHADOW())
5606 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5610 /* Force -- mostly stun */
5613 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5614 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5616 (void)set_stun(p_ptr->stun + randint1(20));
5618 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5623 /* Rocket -- stun, cut */
5626 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5627 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5629 (void)set_stun(p_ptr->stun + randint1(20));
5632 if (p_ptr->resist_shard)
5636 else if (!CHECK_MULTISHADOW())
5638 (void)set_cut(p_ptr->cut + (dam / 2));
5641 if (!p_ptr->resist_shard || one_in_(12))
5643 inven_damage(set_cold_destroy, 3);
5646 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5650 /* Inertia -- slowness */
5653 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5654 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5655 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5659 /* Lite -- blinding */
5662 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5663 if (p_ptr->resist_lite)
5665 dam *= 4; dam /= (randint1(4) + 7);
5667 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5669 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5672 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5674 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5677 else if (prace_is_(RACE_S_FAIRY))
5682 if (p_ptr->wraith_form) dam *= 2;
5683 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5685 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5687 p_ptr->wraith_form = 0;
5688 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5689 "The light forces you out of your incorporeal shadow form."));
5691 p_ptr->redraw |= PR_MAP;
5692 /* Update monsters */
5693 p_ptr->update |= (PU_MONSTERS);
5694 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5696 /* Redraw status bar */
5697 p_ptr->redraw |= (PR_STATUS);
5704 /* Dark -- blinding */
5707 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5708 if (p_ptr->resist_dark)
5710 dam *= 4; dam /= (randint1(4) + 7);
5712 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5714 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5716 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5718 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5722 /* Time -- bolt fewer effects XXX */
5725 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5726 if (p_ptr->resist_time)
5729 dam /= (randint1(4) + 7);
5730 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5732 else if (!CHECK_MULTISHADOW())
5734 switch (randint1(10))
5736 case 1: case 2: case 3: case 4: case 5:
5738 if (p_ptr->prace == RACE_ANDROID) break;
5739 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5740 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5744 case 6: case 7: case 8: case 9:
5746 switch (randint1(6))
5748 case 1: k = A_STR; act = _("強く", "strong"); break;
5749 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5750 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5751 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5752 case 5: k = A_CON; act = _("健康で", "hale"); break;
5753 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5756 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5757 "You're not as %s as you used to be..."), act);
5759 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5760 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5761 p_ptr->update |= (PU_BONUS);
5767 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5768 "You're not as powerful as you used to be..."));
5770 for (k = 0; k < 6; k++)
5772 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5773 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5775 p_ptr->update |= (PU_BONUS);
5781 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5785 /* Gravity -- stun plus slowness plus teleport */
5788 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5789 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5791 if (!CHECK_MULTISHADOW())
5793 teleport_player(5, TELEPORT_PASSIVE);
5794 if (!p_ptr->levitation)
5795 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5796 if (!(p_ptr->resist_sound || p_ptr->levitation))
5798 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5799 (void)set_stun(p_ptr->stun + plus_stun);
5802 if (p_ptr->levitation)
5804 dam = (dam * 2) / 3;
5807 if (!p_ptr->levitation || one_in_(13))
5809 inven_damage(set_cold_destroy, 2);
5812 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5816 /* Standard damage */
5817 case GF_DISINTEGRATE:
5819 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5821 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5827 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5829 (void)hp_player(dam);
5836 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5837 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5844 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5845 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5851 if (p_ptr->free_act) break;
5852 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5854 if (ironman_nightmare)
5856 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5857 /* Have some nightmares */
5858 sanity_blast(NULL, FALSE);
5861 set_paralyzed(p_ptr->paralyzed + dam);
5871 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5872 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5879 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5880 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5887 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5889 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5890 if (!p_ptr->resist_shard || one_in_(13))
5892 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5893 inven_damage(set_cold_destroy, 2);
5899 /* Ice -- cold plus stun plus cuts */
5902 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5903 get_damage = cold_dam(dam, killer, monspell, FALSE);
5904 if (!CHECK_MULTISHADOW())
5906 if (!p_ptr->resist_shard)
5908 (void)set_cut(p_ptr->cut + damroll(5, 8));
5910 if (!p_ptr->resist_sound)
5912 (void)set_stun(p_ptr->stun + randint1(15));
5915 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5917 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5927 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5929 if (p_ptr->mimic_form)
5931 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5932 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5937 switch (p_ptr->prace)
5939 /* Some races are immune */
5953 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5965 if (CHECK_MULTISHADOW())
5967 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5969 else if (p_ptr->csp)
5973 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5975 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5978 if (dam >= p_ptr->csp)
5982 p_ptr->csp_frac = 0;
5991 learn_spell(monspell);
5994 p_ptr->redraw |= (PR_MANA);
5996 p_ptr->window |= (PW_PLAYER);
5997 p_ptr->window |= (PW_SPELL);
6001 /* Heal the monster */
6002 if (m_ptr->hp < m_ptr->maxhp)
6006 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6008 /* Redraw (later) if needed */
6009 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6010 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6012 /* Special message */
6015 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6028 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6030 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6031 learn_spell(monspell);
6035 if (!CHECK_MULTISHADOW())
6037 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6039 if (!p_ptr->resist_conf)
6041 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6044 if (!p_ptr->resist_chaos && one_in_(3))
6046 (void)set_image(p_ptr->image + randint0(250) + 150);
6053 p_ptr->csp_frac = 0;
6055 p_ptr->redraw |= PR_MANA;
6058 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6064 case GF_BRAIN_SMASH:
6066 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6068 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6069 learn_spell(monspell);
6073 if (!CHECK_MULTISHADOW())
6075 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6081 p_ptr->csp_frac = 0;
6083 p_ptr->redraw |= PR_MANA;
6086 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6087 if (!CHECK_MULTISHADOW())
6089 if (!p_ptr->resist_blind)
6091 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6093 if (!p_ptr->resist_conf)
6095 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6097 if (!p_ptr->free_act)
6099 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6101 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6103 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6104 (void)do_dec_stat(A_INT);
6105 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6106 (void)do_dec_stat(A_WIS);
6108 if (!p_ptr->resist_chaos)
6110 (void)set_image(p_ptr->image + randint0(250) + 150);
6120 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6122 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6123 learn_spell(monspell);
6127 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6128 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6136 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6138 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6139 learn_spell(monspell);
6143 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6144 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6152 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6154 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6155 learn_spell(monspell);
6159 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6160 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6168 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6170 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6171 learn_spell(monspell);
6175 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6176 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6184 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6186 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6187 learn_spell(monspell);
6191 if (!CHECK_MULTISHADOW())
6193 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6194 curse_equipment(40, 20);
6197 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6199 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6214 /* Hex - revenge damage stored */
6215 revenge_store(get_damage);
6217 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6218 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6220 char m_name_self[80];
6223 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6225 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6226 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6227 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6230 if (p_ptr->riding && dam > 0)
6232 rakubadam_p = (dam > 200) ? 200 : dam;
6240 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6242 (void)kawarimi(FALSE);
6245 /* Return "Anything seen?" */
6251 * Find the distance from (x, y) to a line.
6253 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6255 /* Vector from (x, y) to (x1, y1) */
6256 POSITION py = y1 - y;
6257 POSITION px = x1 - x;
6260 POSITION ny = x2 - x1;
6261 POSITION nx = y1 - y2;
6264 POSITION pd = distance(y1, x1, y, x);
6265 POSITION nd = distance(y1, x1, y2, x2);
6267 if (pd > nd) return distance(y, x, y2, x2);
6269 /* Component of P on N */
6270 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6272 /* Absolute value */
6273 return((nd >= 0) ? nd : 0 - nd);
6280 * Modified version of los() for calculation of disintegration balls.
6281 * Disintegration effects are stopped by permanent walls.
6283 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6303 /* Slope, or 1/Slope, of LOS */
6307 /* Extract the offset */
6311 /* Extract the absolute offset */
6316 /* Handle adjacent (or identical) grids */
6317 if ((ax < 2) && (ay < 2)) return (TRUE);
6320 /* Paranoia -- require "safe" origin */
6321 /* if (!in_bounds(y1, x1)) return (FALSE); */
6324 /* Directly South/North */
6327 /* South -- check for walls */
6330 for (ty = y1 + 1; ty < y2; ty++)
6332 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6336 /* North -- check for walls */
6339 for (ty = y1 - 1; ty > y2; ty--)
6341 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6349 /* Directly East/West */
6352 /* East -- check for walls */
6355 for (tx = x1 + 1; tx < x2; tx++)
6357 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6361 /* West -- check for walls */
6364 for (tx = x1 - 1; tx > x2; tx--)
6366 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6375 /* Extract some signs */
6376 sx = (dx < 0) ? -1 : 1;
6377 sy = (dy < 0) ? -1 : 1;
6380 /* Vertical "knights" */
6385 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6389 /* Horizontal "knights" */
6394 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6399 /* Calculate scale factor div 2 */
6402 /* Calculate scale factor */
6406 /* Travel horizontally */
6409 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6415 /* Consider the special case where slope == 1. */
6426 /* Note (below) the case (qy == f2), where */
6427 /* the LOS exactly meets the corner of a tile. */
6430 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6441 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6454 /* Travel vertically */
6457 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6473 /* Note (below) the case (qx == f2), where */
6474 /* the LOS exactly meets the corner of a tile. */
6477 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6488 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6509 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)
6514 int brev = rad * rad / dist;
6518 int mdis = distance(y1, x1, y2, x2) + rad;
6520 while (bdis <= mdis)
6524 if ((0 < dist) && (path_n < dist))
6526 POSITION ny = GRID_Y(path_g[path_n]);
6527 POSITION nx = GRID_X(path_g[path_n]);
6528 POSITION nd = distance(ny, nx, y1, x1);
6530 /* Get next base point */
6539 /* Travel from center outward */
6540 for (cdis = 0; cdis <= brad; cdis++)
6542 /* Scan the maximal blast area of radius "cdis" */
6543 for (y = by - cdis; y <= by + cdis; y++)
6545 for (x = bx - cdis; x <= bx + cdis; x++)
6547 /* Ignore "illegal" locations */
6548 if (!in_bounds(y, x)) continue;
6550 /* Enforce a circular "ripple" */
6551 if (distance(y1, x1, y, x) != bdis) continue;
6553 /* Enforce an arc */
6554 if (distance(by, bx, y, x) != cdis) continue;
6560 /* Lights are stopped by opaque terrains */
6561 if (!los(by, bx, y, x)) continue;
6563 case GF_DISINTEGRATE:
6564 /* Disintegration are stopped only by perma-walls */
6565 if (!in_disintegration_range(by, bx, y, x)) continue;
6568 /* Ball explosions are stopped by walls */
6569 if (!projectable(by, bx, y, x)) continue;
6573 /* Save this grid */
6581 /* Encode some more "radius" info */
6582 gm[bdis + 1] = *pgrids;
6584 /* Increase the size */
6585 brad = rad * (path_n + brev) / (dist + brev);
6587 /* Find the next ripple */
6591 /* Store the effect size */
6597 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6598 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6599 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6600 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6601 * @param x 目標X座標 / Target x location (or location to travel "towards")
6602 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6603 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6604 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6605 * @param monspell 効果元のモンスター魔法ID
6606 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6609 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6610 * towards a given location (optionally passing over the heads of interposing
6611 * monsters), and have it do a given amount of damage to the monsters (and
6612 * optionally objects) within the given radius of the final location.
6614 * A "bolt" travels from source to target and affects only the target grid.
6615 * A "beam" travels from source to target, affecting all grids passed through.
6616 * A "ball" travels from source to the target, exploding at the target, and
6617 * affecting everything within the given radius of the target location.
6619 * Traditionally, a "bolt" does not affect anything on the ground, and does
6620 * not pass over the heads of interposing monsters, much like a traditional
6621 * missile, and will "stop" abruptly at the "target" even if no monster is
6622 * positioned there, while a "ball", on the other hand, passes over the heads
6623 * of monsters between the source and target, and affects everything except
6624 * the source monster which lies within the final radius, while a "beam"
6625 * affects every monster between the source and target, except for the casting
6626 * monster (or player), and rarely affects things on the ground.
6628 * Two special flags allow us to use this function in special ways, the
6629 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6630 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6631 * actually projecting from the source monster (or player).
6633 * The player will only get "experience" for monsters killed by himself
6634 * Unique monsters can only be destroyed by attacks from the player
6636 * Only 256 grids can be affected per projection, limiting the effective
6637 * "radius" of standard ball attacks to nine units (diameter nineteen).
6639 * One can project in a given "direction" by combining PROJECT_THRU with small
6640 * offsets to the initial location (see "line_spell()"), or by calculating
6641 * "virtual targets" far away from the player.
6643 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6644 * continuing until it actually hits somethings (useful for "stone to mud").
6646 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6648 * Balls must explode BEFORE hitting walls, or they would affect monsters
6649 * on both sides of a wall. Some bug reports indicate that this is still
6650 * happening in 2.7.8 for Windows, though it appears to be impossible.
6652 * We "pre-calculate" the blast area only in part for efficiency.
6653 * More importantly, this lets us do "explosions" from the "inside" out.
6654 * This results in a more logical distribution of "blast" treasure.
6655 * It also produces a better (in my opinion) animation of the explosion.
6656 * It could be (but is not) used to have the treasure dropped by monsters
6657 * in the middle of the explosion fall "outwards", and then be damaged by
6658 * the blast as it spreads outwards towards the treasure drop location.
6660 * Walls and doors are included in the blast area, so that they can be
6661 * "burned" or "melted" in later versions.
6663 * This algorithm is intended to maximize simplicity, not necessarily
6664 * efficiency, since this function is not a bottleneck in the code.
6666 * We apply the blast effect from ground zero outwards, in several passes,
6667 * first affecting features, then objects, then monsters, then the player.
6668 * This allows walls to be removed before checking the object or monster
6669 * in the wall, and protects objects which are dropped by monsters killed
6670 * in the blast, and allows the player to see all affects before he is
6671 * killed or teleported away. The semantics of this method are open to
6672 * various interpretations, but they seem to work well in practice.
6674 * We process the blast area from ground-zero outwards to allow for better
6675 * distribution of treasure dropped by monsters, and because it provides a
6676 * pleasing visual effect at low cost.
6678 * Note that the damage done by "ball" explosions decreases with distance.
6679 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6681 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6682 * the target, and then the damage "flows" along this beam of destruction.
6683 * The damage at every grid is the same as at the "center" of a "ball"
6684 * explosion, since the "beam" grids are treated as if they ARE at the
6685 * center of a "ball" explosion.
6687 * Currently, specifying "beam" plus "ball" means that locations which are
6688 * covered by the initial "beam", and also covered by the final "ball", except
6689 * for the final grid (the epicenter of the ball), will be "hit twice", once
6690 * by the initial beam, and once by the exploding ball. For the grid right
6691 * next to the epicenter, this results in 150% damage being done. The center
6692 * does not have this problem, for the same reason the final grid in a "beam"
6693 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6694 * grids which are covered by the "ball" will NOT work, as then they will
6695 * receive LESS damage than they should. Do not combine "beam" with "ball".
6697 * The array "gy[],gx[]" with current size "grids" is used to hold the
6698 * collected locations of all grids in the "blast area" plus "beam path".
6700 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6701 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6702 * first blast grid (see above) with radius "N" from the blast center. Note
6703 * that only the first gm[1] grids in the blast area thus take full damage.
6704 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6705 * number of blast grids.
6707 * Note that once the projection is complete, (y2,x2) holds the final location
6708 * of bolts/beams, and the "epicenter" of balls.
6710 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6711 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6712 * implementation of the "distance" function. Also, a bolt can be properly
6713 * viewed as a "ball" with a "rad" of "zero".
6715 * Note that if no "target" is reached before the beam/bolt/ball travels the
6716 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6717 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6719 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6720 * to move from point A to point B, even if the player cannot see part of the
6721 * projection path. Note that in general, the player will *always* see part
6722 * of the path, since it either starts at the player or ends on the player.
6724 * Hack -- we assume that every "projection" is "self-illuminating".
6726 * Hack -- when only a single monster is affected, we automatically track
6727 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6729 * Note that all projections now "explode" at their final destination, even
6730 * if they were being projected at a more distant destination. This means
6731 * that "ball" spells will *always* explode.
6733 * Note that we must call "handle_stuff()" after affecting terrain features
6734 * in the blast radius, in case the "illumination" of the grid was changed,
6735 * and "update_view()" and "update_monsters()" need to be called.
6738 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6748 POSITION y_saver, x_saver; /* For reflecting monsters */
6750 int msec = delay_factor * delay_factor * delay_factor;
6752 /* Assume the player sees nothing */
6753 bool notice = FALSE;
6755 /* Assume the player has seen nothing */
6756 bool visual = FALSE;
6758 /* Assume the player has seen no blast grids */
6761 /* Assume to be a normal ball spell */
6762 bool breath = FALSE;
6764 /* Is the player blind? */
6765 bool blind = (p_ptr->blind ? TRUE : FALSE);
6767 bool old_hide = FALSE;
6769 /* Number of grids in the "path" */
6772 /* Actual grids in the "path" */
6775 /* Number of grids in the "blast area" (including the "beam" path) */
6778 /* Coordinates of the affected grids */
6779 POSITION gx[1024], gy[1024];
6781 /* Encoded "radius" info (see above) */
6784 /* Actual radius encoded in gm[] */
6785 POSITION gm_rad = rad;
6789 /* Attacker's name (prepared before polymorph)*/
6792 /* Can the player see the source of this effect? */
6793 bool see_s_msg = TRUE;
6795 /* Initialize by null string */
6801 /* Default target of monsterspell is player */
6802 monster_target_y = p_ptr->y;
6803 monster_target_x = p_ptr->x;
6805 /* Hack -- Jump to target */
6806 if (flg & (PROJECT_JUMP))
6811 /* Clear the flag */
6812 flg &= ~(PROJECT_JUMP);
6817 /* Start at player */
6824 /* Start at monster */
6827 x1 = m_list[who].fx;
6828 y1 = m_list[who].fy;
6829 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6841 /* Default "destination" */
6846 /* Hack -- verify stuff */
6847 if (flg & (PROJECT_THRU))
6849 if ((x1 == x2) && (y1 == y2))
6851 flg &= ~(PROJECT_THRU);
6855 /* Handle a breath attack */
6860 if (flg & PROJECT_HIDE) old_hide = TRUE;
6861 flg |= PROJECT_HIDE;
6865 /* Hack -- Assume there will be no blast (max radius 32) */
6866 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6874 /* Collect beam grids */
6875 if (flg & (PROJECT_BEAM))
6886 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6888 case GF_DISINTEGRATE:
6889 flg |= (PROJECT_GRID);
6890 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6894 /* Calculate the projection path */
6896 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6898 /* Hack -- Handle stuff */
6901 /* Giga-Hack SEEKER & SUPER_RAY */
6903 if( typ == GF_SEEKER )
6913 for (i = 0; i < path_n; ++i)
6918 int ny = GRID_Y(path_g[i]);
6919 int nx = GRID_X(path_g[i]);
6930 /* Only do visuals if requested */
6931 if (!blind && !(flg & (PROJECT_HIDE)))
6933 /* Only do visuals if the player can "see" the bolt */
6934 if (panel_contains(y, x) && player_has_los_bold(y, x))
6941 /* Obtain the bolt pict */
6942 p = bolt_pict(oy, ox, y, x, typ);
6944 /* Extract attr/char */
6948 /* Visual effects */
6949 print_rel(c, a, y, x);
6950 move_cursor_relative(y, x);
6951 /*if (fresh_before)*/ Term_fresh();
6952 Term_xtra(TERM_XTRA_DELAY, msec);
6954 /*if (fresh_before)*/ Term_fresh();
6956 /* Display "beam" grids */
6957 if (flg & (PROJECT_BEAM))
6959 /* Obtain the explosion pict */
6960 p = bolt_pict(y, x, y, x, typ);
6962 /* Extract attr/char */
6966 /* Visual effects */
6967 print_rel(c, a, y, x);
6970 /* Hack -- Activate delay */
6974 /* Hack -- delay anyway for consistency */
6977 /* Delay for consistency */
6978 Term_xtra(TERM_XTRA_DELAY, msec);
6981 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
6982 if( is_mirror_grid(&cave[y][x]))
6984 /* The target of monsterspell becomes tha mirror(broken) */
6985 monster_target_y=(s16b)y;
6986 monster_target_x=(s16b)x;
6988 remove_mirror(y, x);
6989 next_mirror(&oy, &ox, y, x);
6991 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6992 for(j = last_i; j <= i; j++)
6994 y = GRID_Y(path_g[j]);
6995 x = GRID_X(path_g[j]);
6996 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
6997 if(!who && (project_m_n==1) && !jump ){
6998 if(cave[project_m_y][project_m_x].m_idx >0 ){
6999 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7003 /* Hack -- auto-recall */
7004 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7006 /* Hack - auto-track */
7007 health_track(cave[project_m_y][project_m_x].m_idx);
7011 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7016 for(i = last_i ; i < path_n ; i++)
7019 py = GRID_Y(path_g[i]);
7020 px = GRID_X(path_g[i]);
7021 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7023 if(!who && (project_m_n==1) && !jump ){
7024 if(cave[project_m_y][project_m_x].m_idx > 0)
7026 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7030 /* Hack -- auto-recall */
7031 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7033 /* Hack - auto-track */
7034 health_track(cave[project_m_y][project_m_x].m_idx);
7038 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7042 else if(typ == GF_SUPER_RAY){
7044 int second_step = 0;
7051 for (i = 0; i < path_n; ++i)
7056 int ny = GRID_Y(path_g[i]);
7057 int nx = GRID_X(path_g[i]);
7068 /* Only do visuals if requested */
7069 if (!blind && !(flg & (PROJECT_HIDE)))
7071 /* Only do visuals if the player can "see" the bolt */
7072 if (panel_contains(y, x) && player_has_los_bold(y, x))
7079 /* Obtain the bolt pict */
7080 p = bolt_pict(oy, ox, y, x, typ);
7082 /* Extract attr/char */
7086 /* Visual effects */
7087 print_rel(c, a, y, x);
7088 move_cursor_relative(y, x);
7089 /*if (fresh_before)*/ Term_fresh();
7090 Term_xtra(TERM_XTRA_DELAY, msec);
7092 /*if (fresh_before)*/ Term_fresh();
7094 /* Display "beam" grids */
7095 if (flg & (PROJECT_BEAM))
7097 /* Obtain the explosion pict */
7098 p = bolt_pict(y, x, y, x, typ);
7100 /* Extract attr/char */
7104 /* Visual effects */
7105 print_rel(c, a, y, x);
7108 /* Hack -- Activate delay */
7112 /* Hack -- delay anyway for consistency */
7115 /* Delay for consistency */
7116 Term_xtra(TERM_XTRA_DELAY, msec);
7119 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7120 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7122 if( second_step )continue;
7125 if( is_mirror_grid(&cave[y][x]) && !second_step )
7127 /* The target of monsterspell becomes tha mirror(broken) */
7128 monster_target_y=(s16b)y;
7129 monster_target_x=(s16b)x;
7132 for( j = 0; j <=i ; j++ )
7134 y = GRID_Y(path_g[j]);
7135 x = GRID_X(path_g[j]);
7136 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7140 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7141 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7142 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7143 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7144 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7145 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7146 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7147 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7150 for( i = 0; i < path_n ; i++ )
7153 py = GRID_Y(path_g[i]);
7154 px = GRID_X(path_g[i]);
7155 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7156 if(!who && (project_m_n == 1) && !jump){
7157 if(cave[project_m_y][project_m_x].m_idx >0 ){
7158 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7162 /* Hack -- auto-recall */
7163 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7165 /* Hack - auto-track */
7166 health_track(cave[project_m_y][project_m_x].m_idx);
7170 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7175 /* Project along the path */
7176 for (i = 0; i < path_n; ++i)
7181 int ny = GRID_Y(path_g[i]);
7182 int nx = GRID_X(path_g[i]);
7184 if (flg & PROJECT_DISI)
7186 /* Hack -- Balls explode before reaching walls */
7187 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7189 else if (flg & PROJECT_LOS)
7191 /* Hack -- Balls explode before reaching walls */
7192 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7196 /* Hack -- Balls explode before reaching walls */
7197 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7204 /* Collect beam grids */
7205 if (flg & (PROJECT_BEAM))
7212 /* Only do visuals if requested */
7213 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7215 /* Only do visuals if the player can "see" the bolt */
7216 if (panel_contains(y, x) && player_has_los_bold(y, x))
7223 /* Obtain the bolt pict */
7224 p = bolt_pict(oy, ox, y, x, typ);
7226 /* Extract attr/char */
7230 /* Visual effects */
7231 print_rel(c, a, y, x);
7232 move_cursor_relative(y, x);
7233 /*if (fresh_before)*/ Term_fresh();
7234 Term_xtra(TERM_XTRA_DELAY, msec);
7236 /*if (fresh_before)*/ Term_fresh();
7238 /* Display "beam" grids */
7239 if (flg & (PROJECT_BEAM))
7241 /* Obtain the explosion pict */
7242 p = bolt_pict(y, x, y, x, typ);
7244 /* Extract attr/char */
7248 /* Visual effects */
7249 print_rel(c, a, y, x);
7252 /* Hack -- Activate delay */
7256 /* Hack -- delay anyway for consistency */
7259 /* Delay for consistency */
7260 Term_xtra(TERM_XTRA_DELAY, msec);
7267 /* Save the "blast epicenter" */
7271 if (breath && !path_n)
7277 flg &= ~(PROJECT_HIDE);
7281 /* Start the "explosion" */
7284 /* Hack -- make sure beams get to "explode" */
7292 /* If we found a "target", explode there */
7293 if (dist <= MAX_RANGE)
7295 /* Mega-Hack -- remove the final "beam" grid */
7296 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7299 * Create a conical breath attack
7310 flg &= ~(PROJECT_HIDE);
7312 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7316 /* Determine the blast area, work from the inside out */
7317 for (dist = 0; dist <= rad; dist++)
7319 /* Scan the maximal blast area of radius "dist" */
7320 for (y = by - dist; y <= by + dist; y++)
7322 for (x = bx - dist; x <= bx + dist; x++)
7324 /* Ignore "illegal" locations */
7325 if (!in_bounds2(y, x)) continue;
7327 /* Enforce a "circular" explosion */
7328 if (distance(by, bx, y, x) != dist) continue;
7334 /* Lights are stopped by opaque terrains */
7335 if (!los(by, bx, y, x)) continue;
7337 case GF_DISINTEGRATE:
7338 /* Disintegration are stopped only by perma-walls */
7339 if (!in_disintegration_range(by, bx, y, x)) continue;
7342 /* Ball explosions are stopped by walls */
7343 if (!projectable(by, bx, y, x)) continue;
7347 /* Save this grid */
7354 /* Encode some more "radius" info */
7360 /* Speed -- ignore "non-explosions" */
7361 if (!grids) return (FALSE);
7364 /* Display the "blast area" if requested */
7365 if (!blind && !(flg & (PROJECT_HIDE)))
7367 /* Then do the "blast", from inside out */
7368 for (t = 0; t <= gm_rad; t++)
7370 /* Dump everything with this radius */
7371 for (i = gm[t]; i < gm[t+1]; i++)
7373 /* Extract the location */
7377 /* Only do visuals if the player can "see" the blast */
7378 if (panel_contains(y, x) && player_has_los_bold(y, x))
7387 /* Obtain the explosion pict */
7388 p = bolt_pict(y, x, y, x, typ);
7390 /* Extract attr/char */
7394 /* Visual effects -- Display */
7395 print_rel(c, a, y, x);
7399 /* Hack -- center the cursor */
7400 move_cursor_relative(by, bx);
7402 /* Flush each "radius" seperately */
7403 /*if (fresh_before)*/ Term_fresh();
7405 /* Delay (efficiently) */
7406 if (visual || drawn)
7408 Term_xtra(TERM_XTRA_DELAY, msec);
7412 /* Flush the erasing */
7415 /* Erase the explosion drawn above */
7416 for (i = 0; i < grids; i++)
7418 /* Extract the location */
7422 /* Hack -- Erase if needed */
7423 if (panel_contains(y, x) && player_has_los_bold(y, x))
7429 /* Hack -- center the cursor */
7430 move_cursor_relative(by, bx);
7432 /* Flush the explosion */
7433 /*if (fresh_before)*/ Term_fresh();
7438 /* Update stuff if needed */
7439 if (p_ptr->update) update_stuff();
7442 if (flg & PROJECT_KILL)
7444 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7445 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7449 /* Check features */
7450 if (flg & (PROJECT_GRID))
7452 /* Start with "dist" of zero */
7455 /* Scan for features */
7456 for (i = 0; i < grids; i++)
7458 /* Hack -- Notice new "dist" values */
7459 if (gm[dist+1] == i) dist++;
7461 /* Get the grid location */
7465 /* Find the closest point in the blast */
7468 int d = dist_to_line(y, x, y1, x1, by, bx);
7470 /* Affect the grid */
7471 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7475 /* Affect the grid */
7476 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7481 /* Update stuff if needed */
7482 if (p_ptr->update) update_stuff();
7485 if (flg & (PROJECT_ITEM))
7487 /* Start with "dist" of zero */
7490 /* Scan for objects */
7491 for (i = 0; i < grids; i++)
7493 /* Hack -- Notice new "dist" values */
7494 if (gm[dist+1] == i) dist++;
7496 /* Get the grid location */
7500 /* Find the closest point in the blast */
7503 int d = dist_to_line(y, x, y1, x1, by, bx);
7505 /* Affect the object in the grid */
7506 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7510 /* Affect the object in the grid */
7511 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7517 /* Check monsters */
7518 if (flg & (PROJECT_KILL))
7525 /* Start with "dist" of zero */
7528 /* Scan for monsters */
7529 for (i = 0; i < grids; i++)
7533 /* Hack -- Notice new "dist" values */
7534 if (gm[dist + 1] == i) dist++;
7536 /* Get the grid location */
7540 /* A single bolt may be reflected */
7543 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7544 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7546 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7547 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7548 (!who || dist_hack > 1) && !one_in_(10))
7551 int max_attempts = 10;
7553 /* Choose 'new' target */
7556 t_y = y_saver - 1 + randint1(3);
7557 t_x = x_saver - 1 + randint1(3);
7560 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7562 if (max_attempts < 1)
7568 sound(SOUND_REFLECT);
7571 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7572 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7573 else if (m_ptr->r_idx == MON_DIO)
7574 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7576 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7578 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7580 /* Reflected bolts randomly target either one */
7581 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7582 else flg |= PROJECT_PLAYER;
7584 /* The bolt is reflected */
7585 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7587 /* Don't affect the monster any longer */
7593 /* Find the closest point in the blast */
7596 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7600 effective_dist = dist;
7604 /* There is the riding player on this monster */
7605 if (p_ptr->riding && player_bold(y, x))
7607 /* Aimed on the player */
7608 if (flg & PROJECT_PLAYER)
7610 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7613 * A beam or bolt is well aimed
7615 * So don't affects the mount.
7622 * The spell is not well aimed,
7623 * So partly affect the mount too.
7630 * This grid is the original target.
7631 * Or aimed on your horse.
7633 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7635 /* Hit the mount with full damage */
7639 * Otherwise this grid is not the
7640 * original target, it means that line
7641 * of fire is obstructed by this
7645 * A beam or bolt will hit either
7646 * player or mount. Choose randomly.
7648 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7652 /* Hit the mount with full damage */
7656 /* Hit the player later */
7657 flg |= PROJECT_PLAYER;
7659 /* Don't affect the mount */
7665 * The spell is not well aimed, so
7666 * partly affect both player and
7675 /* Affect the monster in the grid */
7676 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7680 /* Player affected one monster (without "jumping") */
7681 if (!who && (project_m_n == 1) && !jump)
7686 /* Track if possible */
7687 if (cave[y][x].m_idx > 0)
7689 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7693 /* Hack -- auto-recall */
7694 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7696 /* Hack - auto-track */
7697 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7705 if (flg & (PROJECT_KILL))
7707 /* Start with "dist" of zero */
7710 /* Scan for player */
7711 for (i = 0; i < grids; i++)
7715 /* Hack -- Notice new "dist" values */
7716 if (gm[dist+1] == i) dist++;
7718 /* Get the grid location */
7722 /* Affect the player? */
7723 if (!player_bold(y, x)) continue;
7725 /* Find the closest point in the blast */
7728 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7732 effective_dist = dist;
7735 /* Target may be your horse */
7738 /* Aimed on the player */
7739 if (flg & PROJECT_PLAYER)
7741 /* Hit the player with full damage */
7745 * Hack -- When this grid was not the
7746 * original target, a beam or bolt
7747 * would hit either player or mount,
7748 * and should be choosen randomly.
7750 * But already choosen to hit the
7751 * mount at this point.
7753 * Or aimed on your horse.
7755 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7758 * A beam or bolt is well aimed
7760 * So don't affects the player.
7767 * The spell is not well aimed,
7768 * So partly affect the player too.
7774 /* Affect the player */
7775 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7783 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7785 if (rakubadam_m > 0)
7787 if (rakuba(rakubadam_m, FALSE))
7789 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7792 if (p_ptr->riding && rakubadam_p > 0)
7794 if(rakuba(rakubadam_p, FALSE))
7796 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7801 /* Return "something was noticed" */
7806 * @brief 鏡魔法「封魔結界」の効果処理
7808 * @return 効果があったらTRUEを返す
7810 bool binding_field(HIT_POINT dam)
7812 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7813 int mirror_num = 0; /* 鏡の数 */
7815 POSITION centersign;
7816 POSITION x1, x2, y1, y2;
7818 int msec = delay_factor*delay_factor*delay_factor;
7821 POSITION point_x[3];
7822 POSITION point_y[3];
7824 /* Default target of monsterspell is player */
7825 monster_target_y = p_ptr->y;
7826 monster_target_x = p_ptr->x;
7828 for (x = 0; x < cur_wid; x++)
7830 for (y = 0; y < cur_hgt; y++)
7832 if (is_mirror_grid(&cave[y][x]) &&
7833 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7834 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7835 player_has_los_bold(y, x) &&
7836 projectable(p_ptr->y, p_ptr->x, y, x)
7838 mirror_y[mirror_num] = y;
7839 mirror_x[mirror_num] = x;
7845 if (mirror_num < 2)return FALSE;
7847 point_x[0] = randint0(mirror_num);
7849 point_x[1] = randint0(mirror_num);
7850 } while (point_x[0] == point_x[1]);
7852 point_y[0] = mirror_y[point_x[0]];
7853 point_x[0] = mirror_x[point_x[0]];
7854 point_y[1] = mirror_y[point_x[1]];
7855 point_x[1] = mirror_x[point_x[1]];
7856 point_y[2] = p_ptr->y;
7857 point_x[2] = p_ptr->x;
7859 x = point_x[0] + point_x[1] + point_x[2];
7860 y = point_y[0] + point_y[1] + point_y[2];
7862 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7863 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7864 if (centersign == 0)return FALSE;
7866 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7867 x1 = x1 < point_x[2] ? x1 : point_x[2];
7868 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7869 y1 = y1 < point_y[2] ? y1 : point_y[2];
7871 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7872 x2 = x2 > point_x[2] ? x2 : point_x[2];
7873 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7874 y2 = y2 > point_y[2] ? y2 : point_y[2];
7876 for (y = y1; y <= y2; y++) {
7877 for (x = x1; x <= x2; x++) {
7878 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7879 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7880 centersign*((point_x[1] - x)*(point_y[2] - y)
7881 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7882 centersign*((point_x[2] - x)*(point_y[0] - y)
7883 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7885 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7886 /* Visual effects */
7888 && panel_contains(y, x)) {
7889 p = bolt_pict(y, x, y, x, GF_MANA);
7890 print_rel(PICT_C(p), PICT_A(p), y, x);
7891 move_cursor_relative(y, x);
7892 /*if (fresh_before)*/ Term_fresh();
7893 Term_xtra(TERM_XTRA_DELAY, msec);
7899 for (y = y1; y <= y2; y++) {
7900 for (x = x1; x <= x2; x++) {
7901 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7902 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7903 centersign*((point_x[1] - x)*(point_y[2] - y)
7904 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7905 centersign*((point_x[2] - x)*(point_y[0] - y)
7906 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7908 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7909 (void)project_f(0, 0, y, x, dam, GF_MANA);
7914 for (y = y1; y <= y2; y++) {
7915 for (x = x1; x <= x2; x++) {
7916 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7917 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7918 centersign*((point_x[1] - x)*(point_y[2] - y)
7919 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7920 centersign*((point_x[2] - x)*(point_y[0] - y)
7921 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7923 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7924 (void)project_o(0, 0, y, x, dam, GF_MANA);
7929 for (y = y1; y <= y2; y++) {
7930 for (x = x1; x <= x2; x++) {
7931 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7932 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7933 centersign*((point_x[1] - x)*(point_y[2] - y)
7934 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7935 centersign*((point_x[2] - x)*(point_y[0] - y)
7936 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7938 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7939 (void)project_m(0, 0, y, x, dam, GF_MANA,
7940 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7946 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7947 remove_mirror(point_y[0], point_x[0]);
7954 * @brief 鏡魔法「鏡の封印」の効果処理
7956 * @return 効果があったらTRUEを返す
7958 void seal_of_mirror(HIT_POINT dam)
7962 for (x = 0; x < cur_wid; x++)
7964 for (y = 0; y < cur_hgt; y++)
7966 if (is_mirror_grid(&cave[y][x]))
7968 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7969 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7971 if (!cave[y][x].m_idx)
7973 remove_mirror(y, x);