3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
21 #include "monster-status.h"
22 #include "spells-summon.h"
23 #include "monsterrace-hook.h"
27 #include "projection.h"
32 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
33 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
35 int project_length = 0; /*!< 投射の射程距離 */
39 * @brief モンスター魅了用セービングスロー共通部(汎用系)
41 * @param m_ptr 対象モンスター
42 * @return 魅了に抵抗したらTRUE
44 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
46 monster_race *r_ptr = &r_info[m_ptr->r_idx];
48 if(p_ptr->inside_arena) return TRUE;
51 if (r_ptr->flagsr & RFR_RES_ALL)
53 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
57 if (r_ptr->flags3 & RF3_NO_CONF)
59 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
63 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
65 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
66 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
67 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
71 * @brief モンスター服従用セービングスロー共通部(部族依存系)
73 * @param m_ptr 対象モンスター
74 * @return 服従に抵抗したらTRUE
76 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
78 monster_race *r_ptr = &r_info[m_ptr->r_idx];
80 if (p_ptr->inside_arena) return TRUE;
83 if (r_ptr->flagsr & RFR_RES_ALL)
85 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
89 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
91 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
92 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
93 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
97 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
100 * ハードコーティングによる実装が行われている。
101 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
103 PERCENTAGE beam_chance(void)
105 if (p_ptr->pclass == CLASS_MAGE)
106 return (PERCENTAGE)(p_ptr->lev);
107 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
108 return (PERCENTAGE)(p_ptr->lev + 10);
110 return (PERCENTAGE)(p_ptr->lev / 2);
115 * @brief 配置した鏡リストの次を取得する /
116 * Get another mirror. for SEEKER
117 * @param next_y 次の鏡のy座標を返す参照ポインタ
118 * @param next_x 次の鏡のx座標を返す参照ポインタ
119 * @param cury 現在の鏡のy座標
120 * @param curx 現在の鏡のx座標
122 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
124 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
125 int mirror_num = 0; /* 鏡の数 */
129 for (x = 0; x < cur_wid; x++)
131 for (y = 0; y < cur_hgt; y++)
133 if (is_mirror_grid(&cave[y][x])) {
134 mirror_y[mirror_num] = y;
135 mirror_x[mirror_num] = x;
142 num = randint0(mirror_num);
143 *next_y = mirror_y[num];
144 *next_x = mirror_x[num];
147 *next_y = cury + randint0(5) - 2;
148 *next_x = curx + randint0(5) - 2;
153 * @brief 万色表現用にランダムな色を選択する関数 /
154 * Get a legal "multi-hued" color for drawing "spells"
158 static TERM_COLOR mh_attr(int max)
160 switch (randint1(max))
162 case 1: return (TERM_RED);
163 case 2: return (TERM_GREEN);
164 case 3: return (TERM_BLUE);
165 case 4: return (TERM_YELLOW);
166 case 5: return (TERM_ORANGE);
167 case 6: return (TERM_VIOLET);
168 case 7: return (TERM_L_RED);
169 case 8: return (TERM_L_GREEN);
170 case 9: return (TERM_L_BLUE);
171 case 10: return (TERM_UMBER);
172 case 11: return (TERM_L_UMBER);
173 case 12: return (TERM_SLATE);
174 case 13: return (TERM_WHITE);
175 case 14: return (TERM_L_WHITE);
176 case 15: return (TERM_L_DARK);
184 * @brief 魔法属性に応じたエフェクトの色を返す /
185 * Return a color to use for the bolt/ball spells
189 static TERM_COLOR spell_color(int type)
191 /* Check if A.B.'s new graphics should be used (rr9) */
192 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
197 case GF_PSY_SPEAR: return (0x06);
198 case GF_MISSILE: return (0x0F);
199 case GF_ACID: return (0x04);
200 case GF_ELEC: return (0x02);
201 case GF_FIRE: return (0x00);
202 case GF_COLD: return (0x01);
203 case GF_POIS: return (0x03);
204 case GF_HOLY_FIRE: return (0x00);
205 case GF_HELL_FIRE: return (0x00);
206 case GF_MANA: return (0x0E);
208 case GF_SEEKER: return (0x0E);
209 case GF_SUPER_RAY: return (0x0E);
211 case GF_ARROW: return (0x0F);
212 case GF_WATER: return (0x04);
213 case GF_NETHER: return (0x07);
214 case GF_CHAOS: return (mh_attr(15));
215 case GF_DISENCHANT: return (0x05);
216 case GF_NEXUS: return (0x0C);
217 case GF_CONFUSION: return (mh_attr(4));
218 case GF_SOUND: return (0x09);
219 case GF_SHARDS: return (0x08);
220 case GF_FORCE: return (0x09);
221 case GF_INERTIAL: return (0x09);
222 case GF_GRAVITY: return (0x09);
223 case GF_TIME: return (0x09);
224 case GF_LITE_WEAK: return (0x06);
225 case GF_LITE: return (0x06);
226 case GF_DARK_WEAK: return (0x07);
227 case GF_DARK: return (0x07);
228 case GF_PLASMA: return (0x0B);
229 case GF_METEOR: return (0x00);
230 case GF_ICE: return (0x01);
231 case GF_ROCKET: return (0x0F);
232 case GF_DEATH_RAY: return (0x07);
233 case GF_NUKE: return (mh_attr(2));
234 case GF_DISINTEGRATE: return (0x05);
246 case GF_CAUSE_4: return (0x0E);
247 case GF_HAND_DOOM: return (0x07);
248 case GF_CAPTURE : return (0x0E);
249 case GF_IDENTIFY: return (0x01);
250 case GF_ATTACK: return (0x0F);
251 case GF_PHOTO : return (0x06);
254 /* Normal tiles or ASCII */
260 /* Lookup the default colors for this type */
261 concptr s = quark_str(gf_color[type]);
263 if (!s) return (TERM_WHITE);
265 /* Pick a random color */
266 c = s[randint0(strlen(s))];
268 /* Lookup this color */
269 a = my_strchr(color_char, c) - color_char;
271 /* Invalid color (note check for < 0 removed, gave a silly
272 * warning because bytes are always >= 0 -- RG) */
273 if (a > 15) return (TERM_WHITE);
279 /* Standard "color" */
285 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
286 * Find the attr/char pair to use for a spell effect
295 * It is moving (or has moved) from (x,y) to (nx,ny).
296 * If the distance is not "one", we (may) return "*".
299 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
309 if ((ny == y) && (nx == x)) base = 0x30;
312 else if (nx == x) base = 0x40;
315 else if (ny == y) base = 0x50;
318 else if ((ny - y) == (x - nx)) base = 0x60;
321 else if ((ny - y) == (nx - x)) base = 0x70;
326 /* Basic spell color */
327 k = spell_color(typ);
329 /* Obtain attr/char */
330 a = misc_to_attr[base + k];
331 c = misc_to_char[base + k];
339 * @brief 始点から終点への経路を返す /
340 * Determine the path taken by a projection.
341 * @param gp 経路座標リストを返す参照ポインタ
351 * The projection will always start from the grid (y1,x1), and will travel
352 * towards the grid (y2,x2), touching one grid per unit of distance along
353 * the major axis, and stopping when it enters the destination grid or a
354 * wall grid, or has travelled the maximum legal distance of "range".
356 * Note that "distance" in this function (as in the "update_view()" code)
357 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
358 * actually has an "octagon of projection" not a "circle of projection".
360 * The path grids are saved into the grid array pointed to by "gp", and
361 * there should be room for at least "range" grids in "gp". Note that
362 * due to the way in which distance is calculated, this function normally
363 * uses fewer than "range" grids for the projection path, so the result
364 * of this function should never be compared directly to "range". Note
365 * that the initial grid (y1,x1) is never saved into the grid array, not
366 * even if the initial grid is also the final grid.
368 * The "flg" flags can be used to modify the behavior of this function.
370 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
371 * semantics as they do for the "project" function, namely, that the path
372 * will stop as soon as it hits a monster, or that the path will continue
373 * through the destination grid, respectively.
375 * The "PROJECT_JUMP" flag, which for the "project()" function means to
376 * start at a special grid (which makes no sense in this function), means
377 * that the path should be "angled" slightly if needed to avoid any wall
378 * grids, allowing the player to "target" any grid which is in "view".
379 * This flag is non-trivial and has not yet been implemented, but could
380 * perhaps make use of the "vinfo" array (above).
382 * This function returns the number of grids (if any) in the path. This
383 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
385 * This algorithm is similar to, but slightly different from, the one used
386 * by "update_view_los()", and very different from the one used by "los()".
389 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
411 /* No path necessary (or allowed) */
412 if ((x1 == x2) && (y1 == y2)) return (0);
440 /* Number of "units" in one "half" grid */
443 /* Number of "units" in one "full" grid */
449 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
460 /* Advance (X) part 2 */
463 /* Advance (X) part 3 */
470 /* Create the projection path */
474 gp[n++] = GRID(y, x);
476 /* Hack -- Check maximum range */
477 if ((n + (k >> 1)) >= range) break;
479 /* Sometimes stop at destination grid */
480 if (!(flg & (PROJECT_THRU)))
482 if ((x == x2) && (y == y2)) break;
485 if (flg & (PROJECT_DISI))
487 if ((n > 0) && cave_stop_disintegration(y, x)) break;
489 else if (flg & (PROJECT_LOS))
491 if ((n > 0) && !cave_los_bold(y, x)) break;
493 else if (!(flg & (PROJECT_PATH)))
495 /* Always stop at non-initial wall grids */
496 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
499 /* Sometimes stop at non-initial monsters/players */
500 if (flg & (PROJECT_STOP))
503 (player_bold(y, x) || cave[y][x].m_idx != 0))
507 if (!in_bounds(y, x)) break;
512 /* Advance (X) part 1 */
515 /* Horizontal change */
518 /* Advance (X) part 2 */
521 /* Advance (X) part 3 */
537 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
546 /* Vertical change */
549 /* Advance (Y) part 2 */
552 /* Advance (Y) part 3 */
559 /* Create the projection path */
563 gp[n++] = GRID(y, x);
565 /* Hack -- Check maximum range */
566 if ((n + (k >> 1)) >= range) break;
568 /* Sometimes stop at destination grid */
569 if (!(flg & (PROJECT_THRU)))
571 if ((x == x2) && (y == y2)) break;
574 if (flg & (PROJECT_DISI))
576 if ((n > 0) && cave_stop_disintegration(y, x)) break;
578 else if (flg & (PROJECT_LOS))
580 if ((n > 0) && !cave_los_bold(y, x)) break;
582 else if (!(flg & (PROJECT_PATH)))
584 /* Always stop at non-initial wall grids */
585 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
588 /* Sometimes stop at non-initial monsters/players */
589 if (flg & (PROJECT_STOP))
592 (player_bold(y, x) || cave[y][x].m_idx != 0))
596 if (!in_bounds(y, x)) break;
601 /* Advance (Y) part 1 */
604 /* Vertical change */
607 /* Advance (Y) part 2 */
610 /* Advance (Y) part 3 */
630 /* Create the projection path */
634 gp[n++] = GRID(y, x);
636 /* Hack -- Check maximum range */
637 if ((n + (n >> 1)) >= range) break;
639 /* Sometimes stop at destination grid */
640 if (!(flg & (PROJECT_THRU)))
642 if ((x == x2) && (y == y2)) break;
645 if (flg & (PROJECT_DISI))
647 if ((n > 0) && cave_stop_disintegration(y, x)) break;
649 else if (flg & (PROJECT_LOS))
651 if ((n > 0) && !cave_los_bold(y, x)) break;
653 else if (!(flg & (PROJECT_PATH)))
655 /* Always stop at non-initial wall grids */
656 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
659 /* Sometimes stop at non-initial monsters/players */
660 if (flg & (PROJECT_STOP))
663 (player_bold(y, x) || cave[y][x].m_idx != 0))
667 if (!in_bounds(y, x)) break;
684 * Mega-Hack -- track "affected" monsters (see "project()" comments)
686 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
687 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
688 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
689 /* Mega-Hack -- monsters target */
690 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
691 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
695 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
696 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
697 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
698 * @param y 目標Y座標 / Target y location (or location to travel "towards")
699 * @param x 目標X座標 / Target x location (or location to travel "towards")
700 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
701 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
702 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
705 * We are called both for "beam" effects and "ball" effects.
707 * The "r" parameter is the "distance from ground zero".
709 * Note that we determine if the player can "see" anything that happens
710 * by taking into account: blindness, line-of-sight, and illumination.
712 * We return "TRUE" if the effect of the projection is "obvious".
714 * We also "see" grids which are "memorized", probably a hack
716 * Perhaps we should affect doors?
719 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
721 cave_type *c_ptr = &cave[y][x];
722 feature_type *f_ptr = &f_info[c_ptr->feat];
724 bool obvious = FALSE;
725 bool known = player_has_los_bold(y, x);
730 /* Reduce damage by distance */
731 dam = (dam + r) / (r + 1);
734 if (have_flag(f_ptr->flags, FF_TREE))
742 message = _("枯れた", "was blasted."); break;
744 message = _("縮んだ", "shrank."); break;
746 message = _("溶けた", "melted."); break;
749 message = _("凍り、砕け散った", "was frozen and smashed."); break;
753 message = _("燃えた", "burns up!"); break;
765 message = _("粉砕された", "was crushed."); break;
767 message = NULL; break;
771 msg_format(_("木は%s。", "A tree %s"), message);
772 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
775 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
779 /* Analyze the type */
782 /* Ignore most effects */
817 /* Destroy Traps (and Locks) */
820 /* Reveal secret doors */
821 if (is_hidden_door(c_ptr))
826 /* Check line of sight */
834 if (is_trap(c_ptr->feat))
836 /* Check line of sight */
839 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
843 /* Destroy the trap */
844 cave_alter_feat(y, x, FF_DISARM);
847 /* Locked doors are unlocked */
848 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
850 s16b old_feat = c_ptr->feat;
852 /* Unlock the door */
853 cave_alter_feat(y, x, FF_DISARM);
855 /* Check line of sound */
856 if (known && (old_feat != c_ptr->feat))
858 msg_print(_("カチッと音がした!", "Click!"));
863 /* Remove "unsafe" flag if player is not blind */
864 if (!p_ptr->blind && player_has_los_bold(y, x))
866 c_ptr->info &= ~(CAVE_UNSAFE);
874 /* Destroy Doors (and traps) */
877 /* Destroy all doors and traps */
878 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
880 /* Check line of sight */
883 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
887 /* Destroy the feature */
888 cave_alter_feat(y, x, FF_TUNNEL);
891 /* Remove "unsafe" flag if player is not blind */
892 if (!p_ptr->blind && player_has_los_bold(y, x))
894 c_ptr->info &= ~(CAVE_UNSAFE);
902 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
904 if (have_flag(f_ptr->flags, FF_SPIKE))
906 s16b old_mimic = c_ptr->mimic;
907 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
909 cave_alter_feat(y, x, FF_SPIKE);
910 c_ptr->mimic = old_mimic;
915 /* Check line of sight */
916 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
918 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
925 /* Destroy walls (and doors) */
928 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
930 if (known && (c_ptr->info & (CAVE_MARK)))
932 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
936 /* Destroy the wall */
937 cave_alter_feat(y, x, FF_HURT_ROCK);
939 /* Update some things */
940 p_ptr->update |= (PU_FLOW);
949 /* Require a "naked" floor grid */
950 if (!cave_naked_bold(y, x)) break;
952 /* Not on the player */
953 if (player_bold(y, x)) break;
955 /* Create a closed door */
956 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
959 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
976 /* Require a "naked" floor grid */
977 if (!cave_naked_bold(y, x)) break;
979 /* Not on the player */
980 if (player_bold(y, x)) break;
982 /* Create a closed door */
983 cave_set_feat(y, x, feat_tree);
986 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
994 /* Require a "naked" floor grid */
995 if (!cave_naked_bold(y, x)) break;
998 c_ptr->info |= CAVE_OBJECT;
999 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);
1079 update_local_illumination(y, x);
1082 if (player_can_see_bold(y, x)) obvious = TRUE;
1084 /* Mega-Hack -- Update the monster in the affected grid */
1085 /* This allows "spear of light" (etc) to work "correctly" */
1086 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1088 if (p_ptr->special_defense & NINJA_S_STEALTH)
1090 if (player_bold(y, x)) set_superstealth(FALSE);
1097 /* Darken the grid */
1101 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1104 /* Turn off the light. */
1107 if (dun_level || !is_daytime())
1109 for (j = 0; j < 9; j++)
1111 int by = y + ddy_ddd[j];
1112 int bx = x + ddx_ddd[j];
1114 if (in_bounds2(by, bx))
1116 cave_type *cc_ptr = &cave[by][bx];
1118 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1126 if (!do_dark) break;
1129 c_ptr->info &= ~(CAVE_GLOW);
1131 /* Hack -- Forget "boring" grids */
1132 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1135 c_ptr->info &= ~(CAVE_MARK);
1142 update_local_illumination(y, x);
1144 if (player_can_see_bold(y, x)) obvious = TRUE;
1146 /* Mega-Hack -- Update the monster in the affected grid */
1147 /* This allows "spear of light" (etc) to work "correctly" */
1148 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1158 if (is_mirror_grid(c_ptr))
1160 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1162 remove_mirror(y, x);
1163 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1166 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1168 if (known && (c_ptr->info & CAVE_MARK))
1170 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1174 /* Destroy the wall */
1175 cave_alter_feat(y, x, FF_HURT_ROCK);
1177 /* Update some things */
1178 p_ptr->update |= (PU_FLOW);
1185 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1187 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1189 remove_mirror(y, x);
1190 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1193 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1195 if (known && (c_ptr->info & CAVE_MARK))
1197 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1201 /* Destroy the wall */
1202 cave_alter_feat(y, x, FF_HURT_ROCK);
1204 /* Update some things */
1205 p_ptr->update |= (PU_FLOW);
1210 case GF_DISINTEGRATE:
1212 /* Destroy mirror/glyph */
1213 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1214 remove_mirror(y, x);
1216 /* Permanent features don't get effect */
1217 /* But not protect monsters and other objects */
1218 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1220 cave_alter_feat(y, x, FF_HURT_DISI);
1222 /* Update some things -- similar to GF_KILL_WALL */
1223 p_ptr->update |= (PU_FLOW);
1230 /* Return "Anything seen?" */
1237 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1238 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1239 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1240 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1241 * @param x 目標X座標 / Target x location (or location to travel "towards")
1242 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1243 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1244 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1247 * We are called from "project()" to "damage" objects
1249 * We are called both for "beam" effects and "ball" effects.
1251 * Perhaps we should only SOMETIMES damage things on the ground.
1253 * The "r" parameter is the "distance from ground zero".
1255 * Note that we determine if the player can "see" anything that happens
1256 * by taking into account: blindness, line-of-sight, and illumination.
1258 * We also "see" grids which are "memorized", probably a hack
1260 * We return "TRUE" if the effect of the projection is "obvious".
1263 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1265 cave_type *c_ptr = &cave[y][x];
1267 OBJECT_IDX this_o_idx, next_o_idx = 0;
1269 bool obvious = FALSE;
1270 bool known = player_has_los_bold(y, x);
1272 BIT_FLAGS flgs[TR_FLAG_SIZE];
1274 GAME_TEXT o_name[MAX_NLEN];
1276 KIND_OBJECT_IDX k_idx = 0;
1277 bool is_potion = FALSE;
1280 who = who ? who : 0;
1282 /* Reduce damage by distance */
1283 dam = (dam + r) / (r + 1);
1286 /* Scan all objects in the grid */
1287 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1289 object_type *o_ptr = &o_list[this_o_idx];
1291 bool is_art = FALSE;
1292 bool ignore = FALSE;
1293 bool do_kill = FALSE;
1295 concptr note_kill = NULL;
1298 /* Get the "plural"-ness */
1299 bool plural = (o_ptr->number > 1);
1302 /* Acquire next object */
1303 next_o_idx = o_ptr->next_o_idx;
1304 object_flags(o_ptr, flgs);
1306 /* Check for artifact */
1307 if (object_is_artifact(o_ptr)) is_art = TRUE;
1309 /* Analyze the type */
1312 /* Acid -- Lots of things */
1315 if (hates_acid(o_ptr))
1318 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1319 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1324 /* Elec -- Rings and Wands */
1327 if (hates_elec(o_ptr))
1330 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1331 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1336 /* Fire -- Flammable objects */
1339 if (hates_fire(o_ptr))
1342 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1343 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1348 /* Cold -- potions and flasks */
1351 if (hates_cold(o_ptr))
1353 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1355 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1363 if (hates_fire(o_ptr))
1366 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1367 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1369 if (hates_elec(o_ptr))
1373 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1374 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1382 if (hates_fire(o_ptr))
1385 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1386 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1388 if (hates_cold(o_ptr))
1392 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1393 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1398 /* Hack -- break potions and such */
1404 if (hates_cold(o_ptr))
1406 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1412 /* Mana and Chaos -- destroy everything */
1418 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1422 case GF_DISINTEGRATE:
1425 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1432 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1433 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1434 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1438 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1442 if (object_is_cursed(o_ptr))
1445 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1452 identify_item(o_ptr);
1454 /* Auto-inscription */
1455 autopick_alter_item((-this_o_idx), FALSE);
1463 /* Chests are noticed only if trapped or locked */
1464 if (o_ptr->tval == TV_CHEST)
1466 /* Disarm/Unlock traps */
1467 if (o_ptr->pval > 0)
1469 /* Disarm or Unlock */
1470 o_ptr->pval = (0 - o_ptr->pval);
1473 object_known(o_ptr);
1475 if (known && (o_ptr->marked & OM_FOUND))
1477 msg_print(_("カチッと音がした!", "Click!"));
1487 if (o_ptr->tval == TV_CORPSE)
1490 BIT_FLAGS mode = 0L;
1492 if (!who || is_pet(&m_list[who]))
1493 mode |= PM_FORCE_PET;
1495 for (i = 0; i < o_ptr->number ; i++)
1497 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1498 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1502 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1506 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1508 note_kill = _("生き返った。", " revived.");
1510 else if (!note_kill)
1512 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1523 /* Attempt to destroy the object */
1526 /* Effect "observed" */
1527 if (known && (o_ptr->marked & OM_FOUND))
1530 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1533 /* Artifacts, and other objects, get to resist */
1534 if (is_art || ignore)
1536 /* Observe the resist */
1537 if (known && (o_ptr->marked & OM_FOUND))
1539 msg_format(_("%sは影響を受けない!",
1540 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1547 /* Describe if needed */
1548 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1550 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1553 k_idx = o_ptr->k_idx;
1554 is_potion = object_is_potion(o_ptr);
1555 delete_object_idx(this_o_idx);
1557 /* Potions produce effects when 'shattered' */
1560 (void)potion_smash_effect(who, y, x, k_idx);
1568 /* Return "Anything seen?" */
1574 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1575 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1576 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1577 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1578 * @param x 目標X座標 / Target x location (or location to travel "towards")
1579 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1580 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1582 * @param see_s_msg TRUEならばメッセージを表示する
1583 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1586 * This routine takes a "source monster" (by index) which is mostly used to
1587 * determine if the player is causing the damage, and a "radius" (see below),
1588 * which is used to decrease the power of explosions with distance, and a
1589 * location, via integers which are modified by certain types of attacks
1590 * (polymorph and teleport being the obvious ones), a default damage, which
1591 * is modified as needed based on various properties, and finally a "damage
1592 * type" (see below).
1595 * Note that this routine can handle "no damage" attacks (like teleport) by
1596 * taking a "zero" damage, and can even take "parameters" to attacks (like
1597 * confuse) by accepting a "damage", using it to calculate the effect, and
1598 * then setting the damage to zero. Note that the "damage" parameter is
1599 * divided by the radius, so monsters not at the "epicenter" will not take
1600 * as much damage (or whatever)...
1603 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1604 * may result in a dereference of an invalid pointer.
1607 * Various messages are produced, and damage is applied.
1610 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1611 * actually be "made" of that substance, or "breathe" big balls of it.
1612 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1614 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1615 * and hurts evil less. If can breath nether, then it resists it as well.
1618 * Damage reductions use the following formulas:
1619 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1620 * gives avg damage of .655, ranging from .858 to .500
1621 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1622 * gives avg damage of .544, ranging from .714 to .417
1623 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1624 * gives avg damage of .444, ranging from .556 to .333
1625 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1626 * gives avg damage of .327, ranging from .427 to .250
1627 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1628 * gives something simple.
1631 * In this function, "result" messages are postponed until the end, where
1632 * the "note" string is appended to the monster name, if not NULL. So,
1633 * to make a spell have "no effect" just set "note" to NULL. You should
1634 * also set "notice" to FALSE, or the player will learn what the spell does.
1637 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1641 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)
1645 cave_type *c_ptr = &cave[y][x];
1647 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1648 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1650 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1654 /* Is the monster "seen"? */
1655 bool seen = m_ptr->ml;
1656 bool seen_msg = is_seen(m_ptr);
1658 bool slept = (bool)MON_CSLEEP(m_ptr);
1660 /* Were the effects "obvious" (if seen)? */
1661 bool obvious = FALSE;
1663 /* Can the player know about this effect? */
1664 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1666 /* Were the effects "irrelevant"? */
1667 bool skipped = FALSE;
1669 /* Gets the monster angry at the source of the effect? */
1670 bool get_angry = FALSE;
1672 /* Polymorph setting (true or false) */
1673 bool do_poly = FALSE;
1675 /* Teleport setting (max distance) */
1678 /* Confusion setting (amount to confuse) */
1681 /* Stunning setting (amount to stun) */
1684 /* Sleep amount (amount to sleep) */
1687 /* Fear amount (amount to fear) */
1690 /* Time amount (amount to time) */
1693 bool heal_leper = FALSE;
1695 /* Hold the monster name */
1696 GAME_TEXT m_name[MAX_NLEN];
1699 PARAMETER_VALUE photo = 0;
1701 /* Assume no note */
1702 concptr note = NULL;
1704 /* Assume a default death */
1705 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1707 POSITION ty = m_ptr->fy;
1708 POSITION tx = m_ptr->fx;
1710 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1713 if (!c_ptr->m_idx) return (FALSE);
1715 /* Never affect projector */
1716 if (who && (c_ptr->m_idx == who)) return (FALSE);
1717 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1718 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1720 /* Don't affect already death monsters */
1721 /* Prevents problems with chain reactions of exploding monsters */
1722 if (m_ptr->hp < 0) return (FALSE);
1724 /* Reduce damage by distance */
1725 dam = (dam + r) / (r + 1);
1728 /* Get the monster name (BEFORE polymorphing) */
1729 monster_desc(m_name, m_ptr, 0);
1731 /* Get the monster possessive ("his"/"her"/"its") */
1732 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1734 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1736 /* Analyze the damage type */
1739 /* Magic Missile -- pure damage */
1742 if (seen) obvious = TRUE;
1744 if (r_ptr->flagsr & RFR_RES_ALL)
1746 note = _("には完全な耐性がある!", " is immune.");
1748 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1757 if (seen) obvious = TRUE;
1759 if (r_ptr->flagsr & RFR_RES_ALL)
1761 note = _("には完全な耐性がある!", " is immune.");
1763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1766 if (r_ptr->flagsr & RFR_IM_ACID)
1768 note = _("にはかなり耐性がある!", " resists a lot.");
1770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1778 if (seen) obvious = TRUE;
1780 if (r_ptr->flagsr & RFR_RES_ALL)
1782 note = _("には完全な耐性がある!", " is immune.");
1784 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1787 if (r_ptr->flagsr & RFR_IM_ELEC)
1789 note = _("にはかなり耐性がある!", " resists a lot.");
1791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1799 if (seen) obvious = TRUE;
1801 if (r_ptr->flagsr & RFR_RES_ALL)
1803 note = _("には完全な耐性がある!", " is immune.");
1805 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1808 if (r_ptr->flagsr & RFR_IM_FIRE)
1810 note = _("にはかなり耐性がある!", " resists a lot.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1814 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1816 note = _("はひどい痛手をうけた。", " is hit hard.");
1818 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1826 if (seen) obvious = TRUE;
1828 if (r_ptr->flagsr & RFR_RES_ALL)
1830 note = _("には完全な耐性がある!", " is immune.");
1832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1835 if (r_ptr->flagsr & RFR_IM_COLD)
1837 note = _("にはかなり耐性がある!", " resists a lot.");
1839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1841 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1843 note = _("はひどい痛手をうけた。", " is hit hard.");
1845 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1853 if (seen) obvious = TRUE;
1855 if (r_ptr->flagsr & RFR_RES_ALL)
1857 note = _("には完全な耐性がある!", " is immune.");
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1862 if (r_ptr->flagsr & RFR_IM_POIS)
1864 note = _("にはかなり耐性がある!", " resists a lot.");
1866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1874 if (seen) obvious = TRUE;
1876 if (r_ptr->flagsr & RFR_RES_ALL)
1878 note = _("には完全な耐性がある!", " is immune.");
1880 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1883 if (r_ptr->flagsr & RFR_IM_POIS)
1885 note = _("には耐性がある。", " resists.");
1886 dam *= 3; dam /= randint1(6) + 6;
1887 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1889 else if (one_in_(3)) do_poly = TRUE;
1893 /* Hellfire -- hurts Evil */
1896 if (seen) obvious = TRUE;
1898 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = _("には完全な耐性がある!", " is immune.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1905 if (r_ptr->flags3 & RF3_GOOD)
1907 note = _("はひどい痛手をうけた。", " is hit hard.");
1909 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1914 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1917 if (seen) obvious = TRUE;
1919 if (r_ptr->flagsr & RFR_RES_ALL)
1921 note = _("には完全な耐性がある!", " is immune.");
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1926 if (r_ptr->flags3 & RF3_GOOD)
1928 note = _("には完全な耐性がある!", " is immune.");
1930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1932 else if (r_ptr->flags3 & RF3_EVIL)
1935 note = _("はひどい痛手をうけた。", " is hit hard.");
1936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1940 note = _("には耐性がある。", " resists.");
1941 dam *= 3; dam /= randint1(6) + 6;
1946 /* Arrow -- XXX no defense */
1949 if (seen) obvious = TRUE;
1951 if (r_ptr->flagsr & RFR_RES_ALL)
1953 note = _("には完全な耐性がある!", " is immune.");
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1961 /* Plasma -- XXX perhaps check ELEC or FIRE */
1964 if (seen) obvious = TRUE;
1966 if (r_ptr->flagsr & RFR_RES_ALL)
1968 note = _("には完全な耐性がある!", " is immune.");
1970 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1973 if (r_ptr->flagsr & RFR_RES_PLAS)
1975 note = _("には耐性がある。", " resists.");
1976 dam *= 3; dam /= randint1(6) + 6;
1977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1982 /* Nether -- see above */
1985 if (seen) obvious = TRUE;
1987 if (r_ptr->flagsr & RFR_RES_ALL)
1989 note = _("には完全な耐性がある!", " is immune.");
1991 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1994 if (r_ptr->flagsr & RFR_RES_NETH)
1996 if (r_ptr->flags3 & RF3_UNDEAD)
1998 note = _("には完全な耐性がある!", " is immune.");
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2004 note = _("には耐性がある。", " resists.");
2005 dam *= 3; dam /= randint1(6) + 6;
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2009 else if (r_ptr->flags3 & RF3_EVIL)
2011 note = _("はいくらか耐性を示した。", " resists somewhat.");
2013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2018 /* Water (acid) damage -- Water spirits/elementals are immune */
2021 if (seen) obvious = TRUE;
2023 if (r_ptr->flagsr & RFR_RES_ALL)
2025 note = _("には完全な耐性がある!", " is immune.");
2027 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2030 if (r_ptr->flagsr & RFR_RES_WATE)
2032 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2034 note = _("には完全な耐性がある!", " is immune.");
2039 note = _("には耐性がある。", " resists.");
2040 dam *= 3; dam /= randint1(6) + 6;
2042 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2047 /* Chaos -- Chaos breathers resist */
2050 if (seen) obvious = TRUE;
2052 if (r_ptr->flagsr & RFR_RES_ALL)
2054 note = _("には完全な耐性がある!", " is immune.");
2056 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2059 if (r_ptr->flagsr & RFR_RES_CHAO)
2061 note = _("には耐性がある。", " resists.");
2062 dam *= 3; dam /= randint1(6) + 6;
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2065 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2067 note = _("はいくらか耐性を示した。", " resists somewhat.");
2068 dam *= 3; dam /= randint1(6) + 6;
2069 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2074 do_conf = (5 + randint1(11) + r) / (r + 1);
2079 /* Shards -- Shard breathers resist */
2082 if (seen) obvious = TRUE;
2084 if (r_ptr->flagsr & RFR_RES_ALL)
2086 note = _("には完全な耐性がある!", " is immune.");
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2091 if (r_ptr->flagsr & RFR_RES_SHAR)
2093 note = _("には耐性がある。", " resists.");
2094 dam *= 3; dam /= randint1(6) + 6;
2095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2100 /* Rocket: Shard resistance helps */
2103 if (seen) obvious = TRUE;
2105 if (r_ptr->flagsr & RFR_RES_ALL)
2107 note = _("には完全な耐性がある!", " is immune.");
2109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2112 if (r_ptr->flagsr & RFR_RES_SHAR)
2114 note = _("はいくらか耐性を示した。", " resists somewhat.");
2116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2122 /* Sound -- Sound breathers resist */
2125 if (seen) obvious = TRUE;
2127 if (r_ptr->flagsr & RFR_RES_ALL)
2129 note = _("には完全な耐性がある!", " is immune.");
2131 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2134 if (r_ptr->flagsr & RFR_RES_SOUN)
2136 note = _("には耐性がある。", " resists.");
2137 dam *= 2; dam /= randint1(6) + 6;
2138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2140 else do_stun = (10 + randint1(15) + r) / (r + 1);
2147 if (seen) obvious = TRUE;
2149 if (r_ptr->flagsr & RFR_RES_ALL)
2151 note = _("には完全な耐性がある!", " is immune.");
2153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2156 if (r_ptr->flags3 & RF3_NO_CONF)
2158 note = _("には耐性がある。", " resists.");
2159 dam *= 3; dam /= randint1(6) + 6;
2160 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2162 else do_conf = (10 + randint1(15) + r) / (r + 1);
2166 /* Disenchantment -- Breathers and Disenchanters resist */
2169 if (seen) obvious = TRUE;
2171 if (r_ptr->flagsr & RFR_RES_ALL)
2173 note = _("には完全な耐性がある!", " is immune.");
2175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2178 if (r_ptr->flagsr & RFR_RES_DISE)
2180 note = _("には耐性がある。", " resists.");
2181 dam *= 3; dam /= randint1(6) + 6;
2182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2187 /* Nexus -- Breathers and Existers resist */
2190 if (seen) obvious = TRUE;
2192 if (r_ptr->flagsr & RFR_RES_ALL)
2194 note = _("には完全な耐性がある!", " is immune.");
2196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2199 if (r_ptr->flagsr & RFR_RES_NEXU)
2201 note = _("には耐性がある。", " resists.");
2202 dam *= 3; dam /= randint1(6) + 6;
2203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2211 if (seen) obvious = TRUE;
2213 if (r_ptr->flagsr & RFR_RES_ALL)
2215 note = _("には完全な耐性がある!", " is immune.");
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2220 if (r_ptr->flagsr & RFR_RES_WALL)
2222 note = _("には耐性がある。", " resists.");
2223 dam *= 3; dam /= randint1(6) + 6;
2224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2226 else do_stun = (randint1(15) + r) / (r + 1);
2230 /* Inertia -- breathers resist */
2233 if (seen) obvious = TRUE;
2235 if (r_ptr->flagsr & RFR_RES_ALL)
2237 note = _("には完全な耐性がある!", " is immune.");
2239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2242 if (r_ptr->flagsr & RFR_RES_INER)
2244 note = _("には耐性がある。", " resists.");
2245 dam *= 3; dam /= randint1(6) + 6;
2246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2250 /* Powerful monsters can resist */
2251 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2252 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2256 /* Normal monsters slow down */
2259 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2261 note = _("の動きが遅くなった。", " starts moving slower.");
2268 /* Time -- breathers resist */
2271 if (seen) obvious = TRUE;
2273 if (r_ptr->flagsr & RFR_RES_ALL)
2275 note = _("には完全な耐性がある!", " is immune.");
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2280 if (r_ptr->flagsr & RFR_RES_TIME)
2282 note = _("には耐性がある。", " resists.");
2283 dam *= 3; dam /= randint1(6) + 6;
2284 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2286 else do_time = (dam + 1) / 2;
2290 /* Gravity -- breathers resist */
2293 bool resist_tele = FALSE;
2295 if (seen) obvious = TRUE;
2297 if (r_ptr->flagsr & RFR_RES_ALL)
2299 note = _("には完全な耐性がある!", " is immune.");
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2304 if (r_ptr->flagsr & RFR_RES_TELE)
2306 if (r_ptr->flags1 & (RF1_UNIQUE))
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2309 note = _("には効果がなかった。", " is unaffected!");
2312 else if (r_ptr->level > randint1(100))
2314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2315 note = _("には耐性がある!", " resists!");
2320 if (!resist_tele) do_dist = 10;
2322 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2324 if (r_ptr->flagsr & RFR_RES_GRAV)
2326 note = _("には耐性がある!", " resists!");
2327 dam *= 3; dam /= randint1(6) + 6;
2329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2334 /* Powerful monsters can resist */
2335 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2336 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2340 /* Normal monsters slow down */
2343 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2345 note = _("の動きが遅くなった。", " starts moving slower.");
2350 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2352 /* Attempt a saving throw */
2353 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2354 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2358 /* No obvious effect */
2359 note = _("には効果がなかった。", " is unaffected!");
2371 if (seen) obvious = TRUE;
2373 if (r_ptr->flagsr & RFR_RES_ALL)
2375 note = _("には完全な耐性がある!", " is immune.");
2377 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2385 case GF_DISINTEGRATE:
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);
2396 if (r_ptr->flags3 & RF3_HURT_ROCK)
2398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2399 note = _("の皮膚がただれた!", " loses some skin!");
2400 note_dies = _("は蒸発した!", " evaporates!");
2408 if (seen) obvious = TRUE;
2410 /* PSI only works if the monster can see you! -- RG */
2411 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2414 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2419 if (r_ptr->flagsr & RFR_RES_ALL)
2421 note = _("には完全な耐性がある!", " is immune.");
2423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2426 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2429 note = _("には完全な耐性がある!", " is immune.");
2430 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2433 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2434 (r_ptr->flags3 & RF3_ANIMAL) ||
2435 (r_ptr->level > randint1(3 * dam)))
2437 note = _("には耐性がある!", " resists!");
2441 * Powerful demons & undead can turn a mindcrafter's
2442 * attacks back on them
2444 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2445 (r_ptr->level > p_ptr->lev / 2) &&
2449 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2450 (seen ? "%^s's corrupted mind backlashes your attack!" :
2451 "%^ss corrupted mind backlashes your attack!")), m_name);
2454 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2456 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2460 /* Injure +/- confusion */
2461 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2462 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2463 if (one_in_(4) && !CHECK_MULTISHADOW())
2465 switch (randint1(4))
2468 set_confused(p_ptr->confused + 3 + randint1(dam));
2471 set_stun(p_ptr->stun + randint1(dam));
2475 if (r_ptr->flags3 & RF3_NO_FEAR)
2476 note = _("には効果がなかった。", " is unaffected.");
2478 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2482 if (!p_ptr->free_act)
2483 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2492 if ((dam > 0) && one_in_(4))
2494 switch (randint1(4))
2497 do_conf = 3 + randint1(dam);
2500 do_stun = 3 + randint1(dam);
2503 do_fear = 3 + randint1(dam);
2506 note = _("は眠り込んでしまった!", " falls asleep!");
2507 do_sleep = 3 + randint1(dam);
2512 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2518 if (seen) obvious = TRUE;
2520 if (r_ptr->flagsr & RFR_RES_ALL)
2522 note = _("には完全な耐性がある!", " is immune.");
2524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2527 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2530 note = _("には完全な耐性がある!", " is immune.");
2532 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2533 (r_ptr->flags3 & RF3_ANIMAL) ||
2534 (r_ptr->level > randint1(3 * dam)))
2536 note = _("には耐性がある!", " resists!");
2540 * Powerful demons & undead can turn a mindcrafter's
2541 * attacks back on them
2543 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2544 (r_ptr->level > p_ptr->lev / 2) &&
2548 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2549 (seen ? "%^s's corrupted mind backlashes your attack!" :
2550 "%^ss corrupted mind backlashes your attack!")), m_name);
2552 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2554 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2558 /* Injure + mana drain */
2559 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2560 if (!CHECK_MULTISHADOW())
2562 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2563 p_ptr->csp -= damroll(5, dam) / 2;
2564 if (p_ptr->csp < 0) p_ptr->csp = 0;
2565 p_ptr->redraw |= PR_MANA;
2566 p_ptr->window |= (PW_SPELL);
2568 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2575 int b = damroll(5, dam) / 4;
2576 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2577 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2578 (seen ? "You convert %s's pain into %s!" :
2579 "You convert %ss pain into %s!"));
2580 msg_format(msg, m_name, str);
2582 b = MIN(p_ptr->msp, p_ptr->csp + b);
2584 p_ptr->redraw |= PR_MANA;
2585 p_ptr->window |= (PW_SPELL);
2587 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2591 case GF_TELEKINESIS:
2593 if (seen) obvious = TRUE;
2595 if (r_ptr->flagsr & RFR_RES_ALL)
2597 note = _("には完全な耐性がある!", " is immune.");
2599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2604 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2609 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2611 /* Attempt a saving throw */
2612 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2613 (r_ptr->level > 5 + randint1(dam)))
2617 /* No obvious effect */
2623 /* Psycho-spear -- powerful magic missile */
2626 if (seen) obvious = TRUE;
2628 if (r_ptr->flagsr & RFR_RES_ALL)
2630 note = _("には完全な耐性がある!", " is immune.");
2632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2638 /* Meteor -- powerful magic missile */
2641 if (seen) obvious = TRUE;
2643 if (r_ptr->flagsr & RFR_RES_ALL)
2645 note = _("には完全な耐性がある!", " is immune.");
2647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2655 if (!is_hostile(m_ptr)) break;
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);
2666 /* Attempt a saving throw */
2667 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2668 (r_ptr->flags3 & RF3_NO_CONF) ||
2669 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2671 /* Memorize a flag */
2672 if (r_ptr->flags3 & RF3_NO_CONF)
2674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2681 * Powerful demons & undead can turn a mindcrafter's
2682 * attacks back on them
2684 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2685 (r_ptr->level > p_ptr->lev / 2) &&
2689 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2690 (seen ? "%^s's corrupted mind backlashes your attack!" :
2691 "%^ss corrupted mind backlashes your attack!")), m_name);
2694 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2696 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2700 /* Confuse, stun, terrify */
2701 switch (randint1(4))
2704 set_stun(p_ptr->stun + dam / 2);
2707 set_confused(p_ptr->confused + dam / 2);
2711 if (r_ptr->flags3 & RF3_NO_FEAR)
2712 note = _("には効果がなかった。", " is unaffected.");
2714 set_afraid(p_ptr->afraid + dam);
2721 /* No obvious effect */
2722 note = _("には効果がなかった。", " is unaffected.");
2728 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2730 note = _("があなたに隷属した。", " is in your thrall!");
2735 switch (randint1(4))
2749 /* No "real" damage */
2756 /* Ice -- Cold + Cuts + Stun */
2759 if (seen) obvious = TRUE;
2761 if (r_ptr->flagsr & RFR_RES_ALL)
2763 note = _("には完全な耐性がある!", " is immune.");
2765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2768 do_stun = (randint1(15) + 1) / (r + 1);
2769 if (r_ptr->flagsr & RFR_IM_COLD)
2771 note = _("にはかなり耐性がある!", " resists a lot.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2775 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2777 note = _("はひどい痛手をうけた。", " is hit hard.");
2779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2786 case GF_HYPODYNAMIA:
2788 if (seen) obvious = TRUE;
2790 if (r_ptr->flagsr & RFR_RES_ALL)
2792 note = _("には完全な耐性がある!", " is immune.");
2794 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2797 if (!monster_living(m_ptr->r_idx))
2799 if (is_original_ap_and_seen(m_ptr))
2801 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2802 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2803 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2805 note = _("には効果がなかった。", " is unaffected.");
2809 else do_time = (dam+7)/8;
2817 if (seen) obvious = TRUE;
2819 if (r_ptr->flagsr & RFR_RES_ALL)
2821 note = _("には完全な耐性がある!", " is immune.");
2823 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2826 if (!monster_living(m_ptr->r_idx))
2828 if (is_original_ap_and_seen(m_ptr))
2830 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2831 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2832 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2834 note = _("には完全な耐性がある!", " is immune.");
2838 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2839 (randint1(888) != 666)) ||
2840 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2841 randint1(100) != 66))
2843 note = _("には耐性がある!", " resists!");
2851 /* Polymorph monster (Use "dam" as "power") */
2854 if (seen) obvious = TRUE;
2856 if (r_ptr->flagsr & RFR_RES_ALL)
2858 note = _("には効果がなかった。", " is unaffected.");
2860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2863 /* Attempt to polymorph (see below) */
2866 /* Powerful monsters can resist */
2867 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2868 (r_ptr->flags1 & RF1_QUESTOR) ||
2869 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2871 note = _("には効果がなかった。", " is unaffected.");
2876 /* No "real" damage */
2883 /* Clone monsters (Ignore "dam") */
2886 if (seen) obvious = TRUE;
2888 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2890 note = _("には効果がなかった。", " is unaffected.");
2895 m_ptr->hp = m_ptr->maxhp;
2897 /* Attempt to clone. */
2898 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2900 note = _("が分裂した!", " spawns!");
2904 /* No "real" damage */
2911 /* Heal Monster (use "dam" as amount of healing) */
2914 if (seen) obvious = TRUE;
2917 (void)set_monster_csleep(c_ptr->m_idx, 0);
2919 if (m_ptr->maxhp < m_ptr->max_maxhp)
2921 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2922 m_ptr->maxhp = m_ptr->max_maxhp;
2927 /* Redraw (later) if needed */
2928 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2929 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2937 if (seen) obvious = TRUE;
2940 (void)set_monster_csleep(c_ptr->m_idx, 0);
2941 if (MON_STUNNED(m_ptr))
2943 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2944 (void)set_monster_stunned(c_ptr->m_idx, 0);
2946 if (MON_CONFUSED(m_ptr))
2948 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2949 (void)set_monster_confused(c_ptr->m_idx, 0);
2951 if (MON_MONFEAR(m_ptr))
2953 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2954 (void)set_monster_monfear(c_ptr->m_idx, 0);
2958 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2961 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2965 chg_virtue(V_VITALITY, 1);
2967 if (r_ptr->flags1 & RF1_UNIQUE)
2968 chg_virtue(V_INDIVIDUALISM, 1);
2970 if (is_friendly(m_ptr))
2971 chg_virtue(V_HONOUR, 1);
2972 else if (!(r_ptr->flags3 & RF3_EVIL))
2974 if (r_ptr->flags3 & RF3_GOOD)
2975 chg_virtue(V_COMPASSION, 2);
2977 chg_virtue(V_COMPASSION, 1);
2980 if (r_ptr->flags3 & RF3_ANIMAL)
2981 chg_virtue(V_NATURE, 1);
2984 if (m_ptr->r_idx == MON_LEPER)
2987 if (!who) chg_virtue(V_COMPASSION, 5);
2990 /* Redraw (later) if needed */
2991 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2992 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2994 note = _("は体力を回復したようだ。", " looks healthier.");
2996 /* No "real" damage */
3002 /* Speed Monster (Ignore "dam") */
3005 if (seen) obvious = TRUE;
3008 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3010 note = _("の動きが速くなった。", " starts moving faster.");
3015 if (r_ptr->flags1 & RF1_UNIQUE)
3016 chg_virtue(V_INDIVIDUALISM, 1);
3017 if (is_friendly(m_ptr))
3018 chg_virtue(V_HONOUR, 1);
3021 /* No "real" damage */
3027 /* Slow Monster (Use "dam" as "power") */
3030 if (seen) obvious = TRUE;
3032 if (r_ptr->flagsr & RFR_RES_ALL)
3034 note = _("には効果がなかった。", " is unaffected.");
3036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3039 /* Powerful monsters can resist */
3040 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3041 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3043 note = _("には効果がなかった。", " is unaffected.");
3047 /* Normal monsters slow down */
3050 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3052 note = _("の動きが遅くなった。", " starts moving slower.");
3056 /* No "real" damage */
3062 /* Sleep (Use "dam" as "power") */
3065 if (seen) obvious = TRUE;
3067 if (r_ptr->flagsr & RFR_RES_ALL)
3069 note = _("には効果がなかった。", " is unaffected.");
3071 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3074 /* Attempt a saving throw */
3075 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3076 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3077 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3079 /* Memorize a flag */
3080 if (r_ptr->flags3 & RF3_NO_SLEEP)
3082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3084 /* No obvious effect */
3085 note = _("には効果がなかった。", " is unaffected.");
3090 /* Go to sleep (much) later */
3091 note = _("は眠り込んでしまった!", " falls asleep!");
3095 /* No "real" damage */
3101 /* Sleep (Use "dam" as "power") */
3102 case GF_STASIS_EVIL:
3104 if (seen) obvious = TRUE;
3106 if (r_ptr->flagsr & RFR_RES_ALL)
3108 note = _("には効果がなかった!", " is immune.");
3110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3113 /* Attempt a saving throw */
3114 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3115 !(r_ptr->flags3 & RF3_EVIL) ||
3116 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3118 note = _("には効果がなかった。", " is unaffected.");
3123 /* Go to sleep (much) later */
3124 note = _("は動けなくなった!", " is suspended!");
3128 /* No "real" damage */
3133 /* Sleep (Use "dam" as "power") */
3136 if (seen) obvious = TRUE;
3138 if (r_ptr->flagsr & RFR_RES_ALL)
3140 note = _("には効果がなかった。", " is unaffected.");
3142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3145 /* Attempt a saving throw */
3146 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3147 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3149 note = _("には効果がなかった。", " is unaffected.");
3154 /* Go to sleep (much) later */
3155 note = _("は動けなくなった!", " is suspended!");
3159 /* No "real" damage */
3168 vir = virtue_number(V_HARMONY);
3171 dam += p_ptr->virtues[vir-1]/10;
3174 vir = virtue_number(V_INDIVIDUALISM);
3177 dam -= p_ptr->virtues[vir-1]/20;
3180 if (seen) obvious = TRUE;
3182 /* Attempt a saving throw */
3183 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3187 /* No obvious effect */
3188 note = _("には効果がなかった。", " is unaffected.");
3191 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3193 else if (p_ptr->cursed & TRC_AGGRAVATE)
3195 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3196 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3200 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3203 chg_virtue(V_INDIVIDUALISM, -1);
3204 if (r_ptr->flags3 & RF3_ANIMAL)
3205 chg_virtue(V_NATURE, 1);
3208 /* No "real" damage */
3213 /* Control undead */
3214 case GF_CONTROL_UNDEAD:
3217 if (seen) obvious = TRUE;
3219 vir = virtue_number(V_UNLIFE);
3222 dam += p_ptr->virtues[vir-1]/10;
3225 vir = virtue_number(V_INDIVIDUALISM);
3228 dam -= p_ptr->virtues[vir-1]/20;
3231 /* Attempt a saving throw */
3232 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3233 !(r_ptr->flags3 & RF3_UNDEAD))
3235 /* No obvious effect */
3236 note = _("には効果がなかった。", " is unaffected.");
3238 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3240 else if (p_ptr->cursed & TRC_AGGRAVATE)
3242 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3243 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3247 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3251 /* No "real" damage */
3257 case GF_CONTROL_DEMON:
3260 if (seen) obvious = TRUE;
3262 vir = virtue_number(V_UNLIFE);
3265 dam += p_ptr->virtues[vir-1]/10;
3268 vir = virtue_number(V_INDIVIDUALISM);
3271 dam -= p_ptr->virtues[vir-1]/20;
3274 /* Attempt a saving throw */
3275 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3276 !(r_ptr->flags3 & RF3_DEMON))
3278 /* No obvious effect */
3279 note = _("には効果がなかった。", " is unaffected.");
3281 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3283 else if (p_ptr->cursed & TRC_AGGRAVATE)
3285 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3286 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3290 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3294 /* No "real" damage */
3300 case GF_CONTROL_ANIMAL:
3303 if (seen) obvious = TRUE;
3305 vir = virtue_number(V_NATURE);
3308 dam += p_ptr->virtues[vir-1]/10;
3311 vir = virtue_number(V_INDIVIDUALISM);
3314 dam -= p_ptr->virtues[vir-1]/20;
3317 /* Attempt a saving throw */
3318 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3319 !(r_ptr->flags3 & RF3_ANIMAL))
3322 /* No obvious effect */
3323 note = _("には効果がなかった。", " is unaffected.");
3325 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3327 else if (p_ptr->cursed & TRC_AGGRAVATE)
3329 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3330 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3334 note = _("はなついた。", " is tamed!");
3336 if (r_ptr->flags3 & RF3_ANIMAL)
3337 chg_virtue(V_NATURE, 1);
3340 /* No "real" damage */
3346 case GF_CHARM_LIVING:
3350 vir = virtue_number(V_UNLIFE);
3351 if (seen) obvious = TRUE;
3353 vir = virtue_number(V_UNLIFE);
3356 dam -= p_ptr->virtues[vir-1]/10;
3359 vir = virtue_number(V_INDIVIDUALISM);
3362 dam -= p_ptr->virtues[vir-1]/20;
3365 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3367 /* Attempt a saving throw */
3368 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3369 !monster_living(m_ptr->r_idx))
3372 /* No obvious effect */
3373 note = _("には効果がなかった。", " is unaffected.");
3375 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3377 else if (p_ptr->cursed & TRC_AGGRAVATE)
3379 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3380 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3384 note = _("を支配した。", " is tamed!");
3386 if (r_ptr->flags3 & RF3_ANIMAL)
3387 chg_virtue(V_NATURE, 1);
3390 /* No "real" damage */
3395 /* Confusion (Use "dam" as "power") */
3398 if (seen) obvious = TRUE;
3400 if (r_ptr->flagsr & RFR_RES_ALL)
3402 note = _("には効果がなかった。", " is unaffected.");
3404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3407 /* Get confused later */
3408 do_conf = damroll(3, (dam / 2)) + 1;
3410 /* Attempt a saving throw */
3411 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3412 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3413 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3415 /* Memorize a flag */
3416 if (r_ptr->flags3 & (RF3_NO_CONF))
3418 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3424 /* No obvious effect */
3425 note = _("には効果がなかった。", " is unaffected.");
3429 /* No "real" damage */
3436 if (seen) obvious = TRUE;
3438 if (r_ptr->flagsr & RFR_RES_ALL)
3440 note = _("には効果がなかった。", " is unaffected.");
3442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3445 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3447 /* Attempt a saving throw */
3448 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3449 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3454 /* No obvious effect */
3455 note = _("には効果がなかった。", " is unaffected.");
3459 /* No "real" damage */
3467 /* Lite, but only hurts susceptible creatures */
3475 if (r_ptr->flagsr & RFR_RES_ALL)
3481 if (r_ptr->flags3 & (RF3_HURT_LITE))
3483 /* Obvious effect */
3484 if (seen) obvious = TRUE;
3486 /* Memorize the effects */
3487 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3489 /* Special effect */
3490 note = _("は光に身をすくめた!", " cringes from the light!");
3491 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3494 /* Normally no damage */
3506 /* Lite -- opposite of Dark */
3509 if (seen) obvious = TRUE;
3511 if (r_ptr->flagsr & RFR_RES_ALL)
3513 note = _("には完全な耐性がある!", " is immune.");
3515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3518 if (r_ptr->flagsr & RFR_RES_LITE)
3520 note = _("には耐性がある!", " resists!");
3521 dam *= 2; dam /= (randint1(6)+6);
3522 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3524 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3527 note = _("は光に身をすくめた!", " cringes from the light!");
3528 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3535 /* Dark -- opposite of Lite */
3538 if (seen) obvious = TRUE;
3540 if (r_ptr->flagsr & RFR_RES_ALL)
3542 note = _("には完全な耐性がある!", " is immune.");
3544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3547 if (r_ptr->flagsr & RFR_RES_DARK)
3549 note = _("には耐性がある!", " resists!");
3550 dam *= 2; dam /= (randint1(6)+6);
3551 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3560 if (r_ptr->flagsr & RFR_RES_ALL)
3565 /* Hurt by rock remover */
3566 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3569 if (seen) obvious = TRUE;
3571 /* Memorize the effects */
3572 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3574 /* Cute little message */
3575 note = _("の皮膚がただれた!", " loses some skin!");
3576 note_dies = _("はドロドロに溶けた!", " dissolves!");
3579 /* Usually, ignore the effects */
3590 /* Teleport undead (Use "dam" as "power") */
3591 case GF_AWAY_UNDEAD:
3593 /* Only affect undead */
3594 if (r_ptr->flags3 & (RF3_UNDEAD))
3596 bool resists_tele = FALSE;
3598 if (r_ptr->flagsr & RFR_RES_TELE)
3600 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3603 note = _("には効果がなかった。", " is unaffected.");
3604 resists_tele = TRUE;
3606 else if (r_ptr->level > randint1(100))
3608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3609 note = _("には耐性がある!", " resists!");
3610 resists_tele = TRUE;
3616 if (seen) obvious = TRUE;
3617 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3629 /* No "real" damage */
3635 /* Teleport evil (Use "dam" as "power") */
3638 /* Only affect evil */
3639 if (r_ptr->flags3 & (RF3_EVIL))
3641 bool resists_tele = FALSE;
3643 if (r_ptr->flagsr & RFR_RES_TELE)
3645 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3648 note = _("には効果がなかった。", " is unaffected.");
3649 resists_tele = TRUE;
3651 else if (r_ptr->level > randint1(100))
3653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3654 note = _("には耐性がある!", " resists!");
3655 resists_tele = TRUE;
3661 if (seen) obvious = TRUE;
3662 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3674 /* No "real" damage */
3680 /* Teleport monster (Use "dam" as "power") */
3683 bool resists_tele = FALSE;
3684 if (r_ptr->flagsr & RFR_RES_TELE)
3686 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3689 note = _("には効果がなかった。", " is unaffected.");
3690 resists_tele = TRUE;
3692 else if (r_ptr->level > randint1(100))
3694 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3695 note = _("には耐性がある!", " resists!");
3696 resists_tele = TRUE;
3702 if (seen) obvious = TRUE;
3704 /* Prepare to teleport */
3708 /* No "real" damage */
3714 /* Turn undead (Use "dam" as "power") */
3715 case GF_TURN_UNDEAD:
3717 if (r_ptr->flagsr & RFR_RES_ALL)
3722 /* Only affect undead */
3723 if (r_ptr->flags3 & (RF3_UNDEAD))
3725 if (seen) obvious = TRUE;
3727 /* Learn about type */
3728 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3730 /* Apply some fear */
3731 do_fear = damroll(3, (dam / 2)) + 1;
3733 /* Attempt a saving throw */
3734 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3736 /* No obvious effect */
3737 note = _("には効果がなかった。", " is unaffected.");
3750 /* No "real" damage */
3756 /* Turn evil (Use "dam" as "power") */
3759 if (r_ptr->flagsr & RFR_RES_ALL)
3764 /* Only affect evil */
3765 if (r_ptr->flags3 & (RF3_EVIL))
3767 if (seen) obvious = TRUE;
3769 /* Learn about type */
3770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3772 /* Apply some fear */
3773 do_fear = damroll(3, (dam / 2)) + 1;
3775 /* Attempt a saving throw */
3776 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3778 /* No obvious effect */
3779 note = _("には効果がなかった。", " is unaffected.");
3792 /* No "real" damage */
3798 /* Turn monster (Use "dam" as "power") */
3801 if (r_ptr->flagsr & RFR_RES_ALL)
3806 if (seen) obvious = TRUE;
3808 /* Apply some fear */
3809 do_fear = damroll(3, (dam / 2)) + 1;
3811 /* Attempt a saving throw */
3812 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3813 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3814 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3816 /* No obvious effect */
3817 note = _("には効果がなかった。", " is unaffected.");
3822 /* No "real" damage */
3829 case GF_DISP_UNDEAD:
3831 if (r_ptr->flagsr & RFR_RES_ALL)
3837 /* Only affect undead */
3838 if (r_ptr->flags3 & (RF3_UNDEAD))
3840 if (seen) obvious = TRUE;
3842 /* Learn about type */
3843 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3845 note = _("は身震いした。", " shudders.");
3846 note_dies = _("はドロドロに溶けた!", " dissolves!");
3866 if (r_ptr->flagsr & RFR_RES_ALL)
3872 /* Only affect evil */
3873 if (r_ptr->flags3 & (RF3_EVIL))
3875 if (seen) obvious = TRUE;
3877 /* Learn about type */
3878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3880 note = _("は身震いした。", " shudders.");
3881 note_dies = _("はドロドロに溶けた!", " dissolves!");
3900 if (r_ptr->flagsr & RFR_RES_ALL)
3906 /* Only affect good */
3907 if (r_ptr->flags3 & (RF3_GOOD))
3909 if (seen) obvious = TRUE;
3911 /* Learn about type */
3912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3914 note = _("は身震いした。", " shudders.");
3915 note_dies = _("はドロドロに溶けた!", " dissolves!");
3932 case GF_DISP_LIVING:
3934 if (r_ptr->flagsr & RFR_RES_ALL)
3940 /* Only affect non-undead */
3941 if (monster_living(m_ptr->r_idx))
3943 if (seen) obvious = TRUE;
3945 note = _("は身震いした。", " shudders.");
3946 note_dies = _("はドロドロに溶けた!", " dissolves!");
3965 if (r_ptr->flagsr & RFR_RES_ALL)
3971 /* Only affect demons */
3972 if (r_ptr->flags3 & (RF3_DEMON))
3974 if (seen) obvious = TRUE;
3976 /* Learn about type */
3977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3979 note = _("は身震いした。", " shudders.");
3980 note_dies = _("はドロドロに溶けた!", " dissolves!");
3996 /* Dispel monster */
3999 if (r_ptr->flagsr & RFR_RES_ALL)
4005 if (seen) obvious = TRUE;
4007 note = _("は身震いした。", " shudders.");
4008 note_dies = _("はドロドロに溶けた!", " dissolves!");
4015 if (seen) obvious = TRUE;
4017 if (r_ptr->flagsr & RFR_RES_ALL)
4019 note = _("には完全な耐性がある!", " is immune.");
4021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4025 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4029 /* Heal the monster */
4030 if (caster_ptr->hp < caster_ptr->maxhp)
4033 caster_ptr->hp += dam;
4034 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4036 /* Redraw (later) if needed */
4037 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4038 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4040 /* Special message */
4043 monster_desc(killer, caster_ptr, 0);
4044 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4050 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4051 (void)hp_player(dam);
4056 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4065 if (seen) obvious = TRUE;
4066 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4068 if (r_ptr->flagsr & RFR_RES_ALL)
4070 note = _("には完全な耐性がある!", " is immune.");
4072 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4076 /* Attempt a saving throw */
4077 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4078 (r_ptr->flags3 & RF3_NO_CONF) ||
4079 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4081 /* Memorize a flag */
4082 if (r_ptr->flags3 & (RF3_NO_CONF))
4084 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4086 note = _("には効果がなかった。", " is unaffected.");
4089 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4092 note = _("には完全な耐性がある!", " is immune.");
4095 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4097 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4098 note = _("には耐性がある。", " resists.");
4103 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4104 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4106 if (who > 0) do_conf = randint0(4) + 4;
4107 else do_conf = randint0(8) + 8;
4113 case GF_BRAIN_SMASH:
4115 if (seen) obvious = TRUE;
4116 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4118 if (r_ptr->flagsr & RFR_RES_ALL)
4120 note = _("には完全な耐性がある!", " is immune.");
4122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4126 /* Attempt a saving throw */
4127 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4128 (r_ptr->flags3 & RF3_NO_CONF) ||
4129 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4131 /* Memorize a flag */
4132 if (r_ptr->flags3 & (RF3_NO_CONF))
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4136 note = _("には効果がなかった。", " is unaffected.");
4139 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4142 note = _("には完全な耐性がある!", " is immune.");
4145 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4148 note = _("には耐性がある!", " resists!");
4153 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4154 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4158 do_conf = randint0(4) + 4;
4159 do_stun = randint0(4) + 4;
4163 do_conf = randint0(8) + 8;
4164 do_stun = randint0(8) + 8;
4166 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4174 if (seen) obvious = TRUE;
4175 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4177 if (r_ptr->flagsr & RFR_RES_ALL)
4179 note = _("には完全な耐性がある!", " is immune.");
4181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4185 /* Attempt a saving throw */
4186 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4188 note = _("には効果がなかった。", " is unaffected.");
4197 if (seen) obvious = TRUE;
4198 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4200 if (r_ptr->flagsr & RFR_RES_ALL)
4202 note = _("には完全な耐性がある!", " is immune.");
4204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4208 /* Attempt a saving throw */
4209 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4211 note = _("には効果がなかった。", " is unaffected.");
4220 if (seen) obvious = TRUE;
4221 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4223 if (r_ptr->flagsr & RFR_RES_ALL)
4225 note = _("には完全な耐性がある!", " is immune.");
4227 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4231 /* Attempt a saving throw */
4232 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4234 note = _("には効果がなかった。", " is unaffected.");
4243 if (seen) obvious = TRUE;
4245 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4246 "You point at %s, screaming the word, 'DIE!'."), m_name);
4248 if (r_ptr->flagsr & RFR_RES_ALL)
4250 note = _("には完全な耐性がある!", " is immune.");
4252 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4256 /* Attempt a saving throw */
4257 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4259 note = _("には効果がなかった。", " is unaffected.");
4268 if (seen) obvious = TRUE;
4270 if (r_ptr->flagsr & RFR_RES_ALL)
4272 note = _("には完全な耐性がある!", " is immune.");
4274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4278 if (r_ptr->flags1 & RF1_UNIQUE)
4280 note = _("には効果がなかった。", " is unaffected.");
4285 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4286 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4288 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4290 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4294 note = _("は耐性を持っている!", "resists!");
4301 /* Capture monster */
4305 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4306 (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)
4308 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4313 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4314 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4315 nokori_hp = m_ptr->maxhp * 3 / 10;
4317 nokori_hp = m_ptr->maxhp * 3 / 20;
4319 if (m_ptr->hp >= nokori_hp)
4321 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4324 else if (m_ptr->hp < randint0(nokori_hp))
4326 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4327 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4328 cap_mon = m_ptr->r_idx;
4329 cap_mspeed = m_ptr->mspeed;
4331 cap_maxhp = m_ptr->max_maxhp;
4332 cap_nickname = m_ptr->nickname; /* Quark transfer */
4333 if (c_ptr->m_idx == p_ptr->riding)
4335 if (rakuba(-1, FALSE))
4337 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4341 delete_monster_idx(c_ptr->m_idx);
4347 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4353 /* Attack (Use "dam" as attack type) */
4356 /* Return this monster's death */
4357 return py_attack(y, x, dam);
4360 /* Sleep (Use "dam" as "power") */
4366 if (seen) obvious = TRUE;
4368 if (r_ptr->flagsr & RFR_RES_ALL)
4370 note = _("には効果がなかった。", " is unaffected.");
4372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4375 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4377 note = _("には効果がなかった。", " is unaffected.");
4380 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4383 if (MON_CSLEEP(m_ptr))
4385 note = _("には効果がなかった。", " is unaffected.");
4391 if (one_in_(5)) effect = 1;
4392 else if (one_in_(4)) effect = 2;
4393 else if (one_in_(3)) effect = 3;
4398 /* Powerful monsters can resist */
4399 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4400 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4402 note = _("には効果がなかった。", " is unaffected.");
4406 /* Normal monsters slow down */
4409 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4411 note = _("の動きが遅くなった。", " starts moving slower.");
4416 else if (effect == 2)
4418 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4420 /* Attempt a saving throw */
4421 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4422 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4427 /* No obvious effect */
4428 note = _("には効果がなかった。", " is unaffected.");
4433 else if (effect == 3)
4435 /* Attempt a saving throw */
4436 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4437 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4438 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4440 /* Memorize a flag */
4441 if (r_ptr->flags3 & RF3_NO_SLEEP)
4443 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4446 /* No obvious effect */
4447 note = _("には効果がなかった。", " is unaffected.");
4452 /* Go to sleep (much) later */
4453 note = _("は眠り込んでしまった!", " falls asleep!");
4460 note = _("には効果がなかった。", " is unaffected.");
4463 /* No "real" damage */
4471 if (seen) obvious = TRUE;
4473 if (r_ptr->flagsr & RFR_RES_ALL)
4475 note = _("には効果がなかった。", " is unaffected.");
4477 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4481 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4483 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4484 chg_virtue(V_VITALITY, -1);
4494 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4496 if (r_ptr->flags3 & (RF3_HURT_LITE))
4498 /* Obvious effect */
4499 if (seen) obvious = TRUE;
4501 /* Memorize the effects */
4502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4504 /* Special effect */
4505 note = _("は光に身をすくめた!", " cringes from the light!");
4506 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4509 /* Normally no damage */
4516 photo = m_ptr->r_idx;
4523 case GF_BLOOD_CURSE:
4525 if (seen) obvious = TRUE;
4527 if (r_ptr->flagsr & RFR_RES_ALL)
4529 note = _("には完全な耐性がある!", " is immune.");
4531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4539 bool success = FALSE;
4540 if (seen) obvious = TRUE;
4542 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4544 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4545 if (dam < 1) dam = 1;
4547 /* No need to tame your pet */
4550 note = _("の動きが速くなった。", " starts moving faster.");
4551 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4555 /* Attempt a saving throw */
4556 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4557 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4558 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4559 (p_ptr->cursed & TRC_AGGRAVATE) ||
4560 ((r_ptr->level+10) > randint1(dam)))
4563 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4567 note = _("を支配した。", " is tamed!");
4569 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4571 /* Learn about type */
4572 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4579 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4581 do_fear = randint1(90)+10;
4583 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4586 /* No "real" damage */
4593 if (seen) obvious = TRUE;
4595 if (r_ptr->flagsr & RFR_RES_ALL)
4597 note = _("には完全な耐性がある!", " is immune.");
4599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4603 /* Attempt a saving throw */
4604 if (randint0(100 + dam) < (r_ptr->level + 50))
4606 note = _("には効果がなかった。", " is unaffected.");
4626 /* Absolutely no effect */
4627 if (skipped) return (FALSE);
4629 /* "Unique" monsters cannot be polymorphed */
4630 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4632 /* Quest monsters cannot be polymorphed */
4633 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4635 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4637 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4638 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4640 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4645 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4646 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4649 /* Modify the damage */
4651 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4652 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4654 /* Check for death */
4655 if (dam > m_ptr->hp)
4657 /* Extract method of death */
4662 /* Sound and Impact resisters never stun */
4664 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4665 !(r_ptr->flags3 & RF3_NO_STUN))
4667 if (seen) obvious = TRUE;
4670 if (MON_STUNNED(m_ptr))
4672 note = _("はひどくもうろうとした。", " is more dazed.");
4673 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4677 note = _("はもうろうとした。", " is dazed.");
4682 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4688 /* Confusion and Chaos resisters (and sleepers) never confuse */
4690 !(r_ptr->flags3 & RF3_NO_CONF) &&
4691 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4693 if (seen) obvious = TRUE;
4695 /* Already partially confused */
4696 if (MON_CONFUSED(m_ptr))
4698 note = _("はさらに混乱したようだ。", " looks more confused.");
4699 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4702 /* Was not confused */
4705 note = _("は混乱したようだ。", " looks confused.");
4709 /* Apply confusion */
4710 (void)set_monster_confused(c_ptr->m_idx, tmp);
4718 if (seen) obvious = TRUE;
4720 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4724 note = _("は弱くなったようだ。", " seems weakened.");
4725 m_ptr->maxhp -= do_time;
4726 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4731 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4732 if (do_poly && (randint1(90) > r_ptr->level))
4734 if (polymorph_monster(y, x))
4736 if (seen) obvious = TRUE;
4738 /* Monster polymorphs */
4739 note = _("が変身した!", " changes!");
4741 /* Turn off the damage */
4747 note = _("には効果がなかった。", " is unaffected.");
4750 /* Hack -- Get new monster */
4751 m_ptr = &m_list[c_ptr->m_idx];
4753 /* Hack -- Get new race */
4754 r_ptr = &r_info[m_ptr->r_idx];
4757 /* Handle "teleport" */
4760 if (seen) obvious = TRUE;
4762 note = _("が消え去った!", " disappears!");
4764 if (!who) chg_virtue(V_VALOUR, -1);
4767 teleport_away(c_ptr->m_idx, do_dist,
4768 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4770 /* Hack -- get new location */
4774 /* Hack -- get new grid */
4775 c_ptr = &cave[y][x];
4782 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4789 if (typ == GF_DRAIN_MANA)
4791 /* Drain mana does nothing */
4794 /* If another monster did the damage, hurt the monster by hand */
4797 /* Redraw (later) if needed */
4798 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4799 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4801 /* Wake the monster up */
4802 (void)set_monster_csleep(c_ptr->m_idx, 0);
4804 /* Hurt the monster */
4812 if (is_pet(m_ptr) && !(m_ptr->ml))
4815 /* Give detailed messages if destroyed */
4818 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4821 msg_format("%^s%s", m_name, note);
4829 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4831 /* Generate treasure, etc */
4832 monster_death(c_ptr->m_idx, FALSE);
4835 delete_monster_idx(c_ptr->m_idx);
4839 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4843 /* Damaged monster */
4846 /* Give detailed messages if visible or destroyed */
4847 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4849 /* Hack -- Pain message */
4852 message_pain(c_ptr->m_idx, dam);
4859 /* Hack -- handle sleep */
4860 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4864 else if (heal_leper)
4866 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4868 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4870 char m2_name[MAX_NLEN];
4872 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4873 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4876 delete_monster_idx(c_ptr->m_idx);
4879 /* If the player did it, give him experience, check fear */
4884 /* Hurt the monster, check for fear and death */
4885 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4890 /* Damaged monster */
4893 /* HACK - anger the monster before showing the sleep message */
4894 if (do_sleep) anger_monster(m_ptr);
4896 /* Give detailed messages if visible or destroyed */
4897 if (note && seen_msg)
4898 msg_format(_("%s%s", "%^s%s"), m_name, note);
4900 /* Hack -- Pain message */
4901 else if (known && (dam || !do_fear))
4903 message_pain(c_ptr->m_idx, dam);
4906 /* Anger monsters */
4907 if (((dam > 0) || get_angry) && !do_sleep)
4908 anger_monster(m_ptr);
4910 if ((fear || do_fear) && seen)
4913 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4916 /* Hack -- handle sleep */
4917 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4921 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4923 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4927 switch (randint1(28))
4932 msg_print(_("地面が揺れた...", "The ground trembles..."));
4933 earthquake(ty, tx, 4 + randint0(4));
4934 if (!one_in_(6)) break;
4936 case 3: case 4: case 5: case 6:
4939 int extra_dam = damroll(10, 10);
4940 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4942 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4943 if (!one_in_(6)) break;
4948 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4950 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4951 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4952 if (!one_in_(6)) break;
4954 case 9: case 10: case 11:
4955 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4956 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4957 if (!one_in_(6)) break;
4958 case 12: case 13: case 14: case 15: case 16:
4959 aggravate_monsters(0);
4960 if (!one_in_(6)) break;
4962 count += activate_hi_summon(ty, tx, TRUE);
4963 if (!one_in_(6)) break;
4964 case 19: case 20: case 21: case 22:
4966 bool pet = !one_in_(3);
4967 BIT_FLAGS mode = PM_ALLOW_GROUP;
4969 if (pet) mode |= PM_FORCE_PET;
4970 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4972 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, '\0');
4973 if (!one_in_(6)) break;
4975 case 23: case 24: case 25:
4976 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4977 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4979 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4980 else lose_exp(p_ptr->exp / 16);
4981 if (!one_in_(6)) break;
4982 case 26: case 27: case 28:
4991 (void)do_dec_stat(i);
5000 (void)do_dec_stat(randint0(6));
5009 if (p_ptr->inside_battle)
5011 p_ptr->health_who = c_ptr->m_idx;
5012 p_ptr->redraw |= (PR_HEALTH);
5016 /* Verify this code */
5017 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5019 /* Redraw the monster grid */
5023 /* Update monster recall window */
5024 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5026 p_ptr->window |= (PW_MONSTER);
5029 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5033 if (!(flg & PROJECT_NO_HANGEKI))
5035 set_target(m_ptr, monster_target_y, monster_target_x);
5038 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5040 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5044 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5046 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5047 rakubadam_m = (dam > 200) ? 200 : dam;
5057 /* Prepare to make a Blade of Chaos */
5058 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5060 q_ptr->pval = photo;
5062 /* Mark the item as fully known */
5063 q_ptr->ident |= (IDENT_MENTAL);
5064 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5072 /* Return "Anything seen?" */
5077 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5078 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5079 * @param who_name 効果を起こしたモンスターの名前
5080 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5081 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5082 * @param x 目標X座標 / Target x location (or location to travel "towards")
5083 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5084 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5086 * @param monspell 効果元のモンスター魔法ID
5087 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5089 * Handle a beam/bolt/ball causing damage to the player.
5090 * This routine takes a "source monster" (by index), a "distance", a default
5091 * "damage", and a "damage type". See "project_m()" above.
5092 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5093 * is reduced (see "project_m()" above). This can happen if a monster breathes
5094 * at the player and hits a wall instead.
5095 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5096 * to know if this is actually a ball or a bolt spell
5097 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5098 * we just assume that the effects were obvious, for historical reasons.
5100 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5105 /* Hack -- assume obvious */
5106 bool obvious = TRUE;
5108 /* Player blind-ness */
5109 bool blind = (p_ptr->blind ? TRUE : FALSE);
5111 /* Player needs a "description" (he is blind) */
5114 /* Source monster */
5115 monster_type *m_ptr = NULL;
5117 /* Monster name (for attacks) */
5118 GAME_TEXT m_name[MAX_NLEN];
5120 /* Monster name (for damage) */
5123 /* Hack -- messages */
5129 /* Player is not here */
5130 if (!player_bold(y, x)) return (FALSE);
5132 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5134 if (kawarimi(TRUE)) return FALSE;
5137 /* Player cannot hurt himself */
5138 if (!who) return (FALSE);
5139 if (who == p_ptr->riding) return (FALSE);
5141 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5144 int max_attempts = 10;
5145 sound(SOUND_REFLECT);
5148 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5149 else if (p_ptr->special_defense & KATA_FUUJIN)
5150 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5152 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5155 /* Choose 'new' target */
5160 t_y = m_list[who].fy - 1 + randint1(3);
5161 t_x = m_list[who].fx - 1 + randint1(3);
5164 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5166 if (max_attempts < 1)
5168 t_y = m_list[who].fy;
5169 t_x = m_list[who].fx;
5174 t_y = p_ptr->y - 1 + randint1(3);
5175 t_x = p_ptr->x - 1 + randint1(3);
5178 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5180 disturb(TRUE, TRUE);
5184 /* Limit maximum damage */
5185 if (dam > 1600) dam = 1600;
5187 /* Reduce damage by distance */
5188 dam = (dam + r) / (r + 1);
5191 /* If the player is blind, be more descriptive */
5192 if (blind) fuzzy = TRUE;
5197 m_ptr = &m_list[who];
5198 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5199 monster_desc(m_name, m_ptr, 0);
5201 /* Get the monster's real name (gotten before polymorph!) */
5202 strcpy(killer, who_name);
5208 case PROJECT_WHO_UNCTRL_POWER:
5209 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5212 case PROJECT_WHO_GLASS_SHARDS:
5213 strcpy(killer, _("ガラスの破片", "shards of glass"));
5217 strcpy(killer, _("罠", "a trap"));
5222 strcpy(m_name, killer);
5225 /* Analyze the damage */
5228 /* Standard damage -- hurts inventory too */
5231 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5232 get_damage = acid_dam(dam, killer, monspell, FALSE);
5236 /* Standard damage -- hurts inventory too */
5239 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5240 get_damage = fire_dam(dam, killer, monspell, FALSE);
5244 /* Standard damage -- hurts inventory too */
5247 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5248 get_damage = cold_dam(dam, killer, monspell, FALSE);
5252 /* Standard damage -- hurts inventory too */
5255 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5256 get_damage = elec_dam(dam, killer, monspell, FALSE);
5260 /* Standard damage -- also poisons player */
5263 bool double_resist = IS_OPPOSE_POIS();
5264 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5266 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5267 if (double_resist) dam = (dam + 2) / 3;
5269 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5274 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5276 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5278 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5283 /* Standard damage -- also poisons / mutates player */
5286 bool double_resist = IS_OPPOSE_POIS();
5287 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5289 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5290 if (double_resist) dam = (2 * dam + 2) / 5;
5291 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5292 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5294 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5296 if (one_in_(5)) /* 6 */
5298 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5299 if (one_in_(4)) /* 4 */
5307 inven_damage(set_acid_destroy, 2);
5313 /* Standard damage */
5316 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5317 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5321 /* Holy Orb -- Player only takes partial damage */
5324 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5325 if (p_ptr->align > 10)
5327 else if (p_ptr->align < -10)
5329 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5335 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5336 if (p_ptr->align > 10)
5338 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5342 /* Arrow -- XXX no dodging */
5347 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5349 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5351 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5354 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5358 /* Plasma -- XXX No resist */
5361 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5362 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5364 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5366 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5367 (void)set_stun(p_ptr->stun + plus_stun);
5370 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5372 inven_damage(set_acid_destroy, 3);
5378 /* Nether -- drain experience */
5381 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5382 if (p_ptr->resist_neth)
5384 if (!prace_is_(RACE_SPECTRE))
5386 dam *= 6; dam /= (randint1(4) + 7);
5389 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5391 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5393 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5395 learn_spell(monspell);
5399 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5405 /* Water -- stun/confuse */
5408 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5409 if (!CHECK_MULTISHADOW())
5411 if (!p_ptr->resist_sound && !p_ptr->resist_water)
5413 set_stun(p_ptr->stun + randint1(40));
5415 if (!p_ptr->resist_conf && !p_ptr->resist_water)
5417 set_confused(p_ptr->confused + randint1(5) + 5);
5420 if (one_in_(5) && !p_ptr->resist_water)
5422 inven_damage(set_cold_destroy, 3);
5425 if (p_ptr->resist_water) get_damage /= 4;
5428 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5432 /* Chaos -- many effects */
5435 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5436 if (p_ptr->resist_chaos)
5438 dam *= 6; dam /= (randint1(4) + 7);
5441 if (!CHECK_MULTISHADOW())
5443 if (!p_ptr->resist_conf)
5445 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5447 if (!p_ptr->resist_chaos)
5449 (void)set_image(p_ptr->image + randint1(10));
5452 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5453 (void)gain_random_mutation(0);
5456 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5458 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5461 if (!p_ptr->resist_chaos || one_in_(9))
5463 inven_damage(set_elec_destroy, 2);
5464 inven_damage(set_fire_destroy, 2);
5468 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5472 /* Shards -- mostly cutting */
5475 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5476 if (p_ptr->resist_shard)
5478 dam *= 6; dam /= (randint1(4) + 7);
5480 else if (!CHECK_MULTISHADOW())
5482 (void)set_cut(p_ptr->cut + dam);
5485 if (!p_ptr->resist_shard || one_in_(13))
5487 inven_damage(set_cold_destroy, 2);
5490 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5494 /* Sound -- mostly stunning */
5497 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5498 if (p_ptr->resist_sound)
5500 dam *= 5; dam /= (randint1(4) + 7);
5502 else if (!CHECK_MULTISHADOW())
5504 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5505 (void)set_stun(p_ptr->stun + plus_stun);
5508 if (!p_ptr->resist_sound || one_in_(13))
5510 inven_damage(set_cold_destroy, 2);
5513 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5517 /* Pure confusion */
5520 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5521 if (p_ptr->resist_conf)
5523 dam *= 5; dam /= (randint1(4) + 7);
5525 else if (!CHECK_MULTISHADOW())
5527 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5529 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5533 /* Disenchantment -- see above */
5536 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5537 if (p_ptr->resist_disen)
5539 dam *= 6; dam /= (randint1(4) + 7);
5541 else if (!CHECK_MULTISHADOW())
5543 (void)apply_disenchant(0);
5545 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5549 /* Nexus -- see above */
5552 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5553 if (p_ptr->resist_nexus)
5555 dam *= 6; dam /= (randint1(4) + 7);
5557 else if (!CHECK_MULTISHADOW())
5561 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5565 /* Force -- mostly stun */
5568 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5569 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5571 (void)set_stun(p_ptr->stun + randint1(20));
5573 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5578 /* Rocket -- stun, cut */
5581 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5582 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5584 (void)set_stun(p_ptr->stun + randint1(20));
5587 if (p_ptr->resist_shard)
5591 else if (!CHECK_MULTISHADOW())
5593 (void)set_cut(p_ptr->cut + (dam / 2));
5596 if (!p_ptr->resist_shard || one_in_(12))
5598 inven_damage(set_cold_destroy, 3);
5601 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5605 /* Inertia -- slowness */
5608 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5609 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5610 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5614 /* Lite -- blinding */
5617 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5618 if (p_ptr->resist_lite)
5620 dam *= 4; dam /= (randint1(4) + 7);
5622 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5624 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5627 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5629 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5632 else if (prace_is_(RACE_S_FAIRY))
5637 if (p_ptr->wraith_form) dam *= 2;
5638 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5640 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5642 p_ptr->wraith_form = 0;
5643 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5644 "The light forces you out of your incorporeal shadow form."));
5646 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5647 p_ptr->update |= (PU_MONSTERS);
5648 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5654 /* Dark -- blinding */
5657 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5658 if (p_ptr->resist_dark)
5660 dam *= 4; dam /= (randint1(4) + 7);
5662 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5664 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5666 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5668 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5672 /* Time -- bolt fewer effects XXX */
5675 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5676 if (p_ptr->resist_time)
5679 dam /= (randint1(4) + 7);
5680 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5682 else if (!CHECK_MULTISHADOW())
5684 switch (randint1(10))
5686 case 1: case 2: case 3: case 4: case 5:
5688 if (p_ptr->prace == RACE_ANDROID) break;
5689 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5690 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5694 case 6: case 7: case 8: case 9:
5696 switch (randint1(6))
5698 case 1: k = A_STR; act = _("強く", "strong"); break;
5699 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5700 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5701 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5702 case 5: k = A_CON; act = _("健康で", "hale"); break;
5703 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5706 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5707 "You're not as %s as you used to be..."), act);
5709 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5710 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5711 p_ptr->update |= (PU_BONUS);
5717 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5718 "You're not as powerful as you used to be..."));
5720 for (k = 0; k < A_MAX; k++)
5722 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5723 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5725 p_ptr->update |= (PU_BONUS);
5731 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5735 /* Gravity -- stun plus slowness plus teleport */
5738 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5739 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5741 if (!CHECK_MULTISHADOW())
5743 teleport_player(5, TELEPORT_PASSIVE);
5744 if (!p_ptr->levitation)
5745 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5746 if (!(p_ptr->resist_sound || p_ptr->levitation))
5748 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5749 (void)set_stun(p_ptr->stun + plus_stun);
5752 if (p_ptr->levitation)
5754 dam = (dam * 2) / 3;
5757 if (!p_ptr->levitation || one_in_(13))
5759 inven_damage(set_cold_destroy, 2);
5762 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5766 /* Standard damage */
5767 case GF_DISINTEGRATE:
5769 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5771 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5777 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5779 (void)hp_player(dam);
5786 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5787 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5794 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5795 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5801 if (p_ptr->free_act) break;
5802 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5804 if (ironman_nightmare)
5806 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5807 /* Have some nightmares */
5808 sanity_blast(NULL, FALSE);
5811 set_paralyzed(p_ptr->paralyzed + dam);
5821 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5822 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5829 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5830 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5837 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5839 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5840 if (!p_ptr->resist_shard || one_in_(13))
5842 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5843 inven_damage(set_cold_destroy, 2);
5849 /* Ice -- cold plus stun plus cuts */
5852 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5853 get_damage = cold_dam(dam, killer, monspell, FALSE);
5854 if (!CHECK_MULTISHADOW())
5856 if (!p_ptr->resist_shard)
5858 (void)set_cut(p_ptr->cut + damroll(5, 8));
5860 if (!p_ptr->resist_sound)
5862 (void)set_stun(p_ptr->stun + randint1(15));
5865 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5867 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5877 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5879 if (p_ptr->mimic_form)
5881 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5882 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5887 switch (p_ptr->prace)
5889 /* Some races are immune */
5903 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5915 if (CHECK_MULTISHADOW())
5917 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5919 else if (p_ptr->csp)
5923 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5925 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5928 if (dam >= p_ptr->csp)
5932 p_ptr->csp_frac = 0;
5941 learn_spell(monspell);
5942 p_ptr->redraw |= (PR_MANA);
5943 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5947 /* Heal the monster */
5948 if (m_ptr->hp < m_ptr->maxhp)
5952 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5954 /* Redraw (later) if needed */
5955 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5956 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5958 /* Special message */
5961 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5974 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5976 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5977 learn_spell(monspell);
5981 if (!CHECK_MULTISHADOW())
5983 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5985 if (!p_ptr->resist_conf)
5987 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5990 if (!p_ptr->resist_chaos && one_in_(3))
5992 (void)set_image(p_ptr->image + randint0(250) + 150);
5999 p_ptr->csp_frac = 0;
6001 p_ptr->redraw |= PR_MANA;
6004 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6010 case GF_BRAIN_SMASH:
6012 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6014 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6015 learn_spell(monspell);
6019 if (!CHECK_MULTISHADOW())
6021 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6027 p_ptr->csp_frac = 0;
6029 p_ptr->redraw |= PR_MANA;
6032 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6033 if (!CHECK_MULTISHADOW())
6035 if (!p_ptr->resist_blind)
6037 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6039 if (!p_ptr->resist_conf)
6041 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6043 if (!p_ptr->free_act)
6045 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6047 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6049 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6050 (void)do_dec_stat(A_INT);
6051 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6052 (void)do_dec_stat(A_WIS);
6054 if (!p_ptr->resist_chaos)
6056 (void)set_image(p_ptr->image + randint0(250) + 150);
6066 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6068 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6069 learn_spell(monspell);
6073 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6074 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6082 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6084 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6085 learn_spell(monspell);
6089 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6090 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6098 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6100 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6101 learn_spell(monspell);
6105 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6106 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6114 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6116 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6117 learn_spell(monspell);
6121 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6122 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6130 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6132 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6133 learn_spell(monspell);
6137 if (!CHECK_MULTISHADOW())
6139 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6140 curse_equipment(40, 20);
6143 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6145 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6160 /* Hex - revenge damage stored */
6161 revenge_store(get_damage);
6163 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6164 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6166 GAME_TEXT m_name_self[80];
6169 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6171 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6172 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6173 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6176 if (p_ptr->riding && dam > 0)
6178 rakubadam_p = (dam > 200) ? 200 : dam;
6182 disturb(TRUE, TRUE);
6185 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6187 (void)kawarimi(FALSE);
6190 /* Return "Anything seen?" */
6196 * Find the distance from (x, y) to a line.
6198 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6200 /* Vector from (x, y) to (x1, y1) */
6201 POSITION py = y1 - y;
6202 POSITION px = x1 - x;
6205 POSITION ny = x2 - x1;
6206 POSITION nx = y1 - y2;
6209 POSITION pd = distance(y1, x1, y, x);
6210 POSITION nd = distance(y1, x1, y2, x2);
6212 if (pd > nd) return distance(y, x, y2, x2);
6214 /* Component of P on N */
6215 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6217 /* Absolute value */
6218 return((nd >= 0) ? nd : 0 - nd);
6225 * Modified version of los() for calculation of disintegration balls.
6226 * Disintegration effects are stopped by permanent walls.
6228 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6230 POSITION dx, dy; /* Delta */
6231 POSITION ax, ay; /* Absolute */
6232 POSITION sx, sy; /* Signs */
6233 POSITION qx, qy; /* Fractions */
6234 POSITION tx, ty; /* Scanners */
6235 POSITION f1, f2; /* Scale factors */
6236 POSITION m; /* Slope, or 1/Slope, of LOS */
6238 /* Extract the offset */
6242 /* Extract the absolute offset */
6246 /* Handle adjacent (or identical) grids */
6247 if ((ax < 2) && (ay < 2)) return (TRUE);
6249 /* Paranoia -- require "safe" origin */
6250 /* if (!in_bounds(y1, x1)) return (FALSE); */
6252 /* Directly South/North */
6255 /* South -- check for walls */
6258 for (ty = y1 + 1; ty < y2; ty++)
6260 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6264 /* North -- check for walls */
6267 for (ty = y1 - 1; ty > y2; ty--)
6269 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6277 /* Directly East/West */
6280 /* East -- check for walls */
6283 for (tx = x1 + 1; tx < x2; tx++)
6285 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6289 /* West -- check for walls */
6292 for (tx = x1 - 1; tx > x2; tx--)
6294 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6302 /* Extract some signs */
6303 sx = (dx < 0) ? -1 : 1;
6304 sy = (dy < 0) ? -1 : 1;
6306 /* Vertical "knights" */
6311 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6315 /* Horizontal "knights" */
6320 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6324 /* Calculate scale factor div 2 */
6327 /* Calculate scale factor */
6331 /* Travel horizontally */
6334 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6340 /* Consider the special case where slope == 1. */
6351 /* Note (below) the case (qy == f2), where */
6352 /* the LOS exactly meets the corner of a tile. */
6355 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6366 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6379 /* Travel vertically */
6382 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6398 /* Note (below) the case (qx == f2), where */
6399 /* the LOS exactly meets the corner of a tile. */
6402 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6413 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6434 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
6439 int brev = rad * rad / dist;
6443 int mdis = distance(y1, x1, y2, x2) + rad;
6445 while (bdis <= mdis)
6449 if ((0 < dist) && (path_n < dist))
6451 POSITION ny = GRID_Y(path_g[path_n]);
6452 POSITION nx = GRID_X(path_g[path_n]);
6453 POSITION nd = distance(ny, nx, y1, x1);
6455 /* Get next base point */
6464 /* Travel from center outward */
6465 for (cdis = 0; cdis <= brad; cdis++)
6467 /* Scan the maximal blast area of radius "cdis" */
6468 for (y = by - cdis; y <= by + cdis; y++)
6470 for (x = bx - cdis; x <= bx + cdis; x++)
6472 /* Ignore "illegal" locations */
6473 if (!in_bounds(y, x)) continue;
6475 /* Enforce a circular "ripple" */
6476 if (distance(y1, x1, y, x) != bdis) continue;
6478 /* Enforce an arc */
6479 if (distance(by, bx, y, x) != cdis) continue;
6485 /* Lights are stopped by opaque terrains */
6486 if (!los(by, bx, y, x)) continue;
6488 case GF_DISINTEGRATE:
6489 /* Disintegration are stopped only by perma-walls */
6490 if (!in_disintegration_range(by, bx, y, x)) continue;
6493 /* Ball explosions are stopped by walls */
6494 if (!projectable(by, bx, y, x)) continue;
6498 /* Save this grid */
6506 /* Encode some more "radius" info */
6507 gm[bdis + 1] = *pgrids;
6509 /* Increase the size */
6510 brad = rad * (path_n + brev) / (dist + brev);
6512 /* Find the next ripple */
6516 /* Store the effect size */
6522 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6523 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6524 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6525 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6526 * @param x 目標X座標 / Target x location (or location to travel "towards")
6527 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6528 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6529 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6530 * @param monspell 効果元のモンスター魔法ID
6531 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6534 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6535 * towards a given location (optionally passing over the heads of interposing
6536 * monsters), and have it do a given amount of damage to the monsters (and
6537 * optionally objects) within the given radius of the final location.
6539 * A "bolt" travels from source to target and affects only the target grid.
6540 * A "beam" travels from source to target, affecting all grids passed through.
6541 * A "ball" travels from source to the target, exploding at the target, and
6542 * affecting everything within the given radius of the target location.
6544 * Traditionally, a "bolt" does not affect anything on the ground, and does
6545 * not pass over the heads of interposing monsters, much like a traditional
6546 * missile, and will "stop" abruptly at the "target" even if no monster is
6547 * positioned there, while a "ball", on the other hand, passes over the heads
6548 * of monsters between the source and target, and affects everything except
6549 * the source monster which lies within the final radius, while a "beam"
6550 * affects every monster between the source and target, except for the casting
6551 * monster (or player), and rarely affects things on the ground.
6553 * Two special flags allow us to use this function in special ways, the
6554 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6555 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6556 * actually projecting from the source monster (or player).
6558 * The player will only get "experience" for monsters killed by himself
6559 * Unique monsters can only be destroyed by attacks from the player
6561 * Only 256 grids can be affected per projection, limiting the effective
6562 * "radius" of standard ball attacks to nine units (diameter nineteen).
6564 * One can project in a given "direction" by combining PROJECT_THRU with small
6565 * offsets to the initial location (see "line_spell()"), or by calculating
6566 * "virtual targets" far away from the player.
6568 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6569 * continuing until it actually hits somethings (useful for "stone to mud").
6571 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6573 * Balls must explode BEFORE hitting walls, or they would affect monsters
6574 * on both sides of a wall. Some bug reports indicate that this is still
6575 * happening in 2.7.8 for Windows, though it appears to be impossible.
6577 * We "pre-calculate" the blast area only in part for efficiency.
6578 * More importantly, this lets us do "explosions" from the "inside" out.
6579 * This results in a more logical distribution of "blast" treasure.
6580 * It also produces a better (in my opinion) animation of the explosion.
6581 * It could be (but is not) used to have the treasure dropped by monsters
6582 * in the middle of the explosion fall "outwards", and then be damaged by
6583 * the blast as it spreads outwards towards the treasure drop location.
6585 * Walls and doors are included in the blast area, so that they can be
6586 * "burned" or "melted" in later versions.
6588 * This algorithm is intended to maximize simplicity, not necessarily
6589 * efficiency, since this function is not a bottleneck in the code.
6591 * We apply the blast effect from ground zero outwards, in several passes,
6592 * first affecting features, then objects, then monsters, then the player.
6593 * This allows walls to be removed before checking the object or monster
6594 * in the wall, and protects objects which are dropped by monsters killed
6595 * in the blast, and allows the player to see all affects before he is
6596 * killed or teleported away. The semantics of this method are open to
6597 * various interpretations, but they seem to work well in practice.
6599 * We process the blast area from ground-zero outwards to allow for better
6600 * distribution of treasure dropped by monsters, and because it provides a
6601 * pleasing visual effect at low cost.
6603 * Note that the damage done by "ball" explosions decreases with distance.
6604 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6606 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6607 * the target, and then the damage "flows" along this beam of destruction.
6608 * The damage at every grid is the same as at the "center" of a "ball"
6609 * explosion, since the "beam" grids are treated as if they ARE at the
6610 * center of a "ball" explosion.
6612 * Currently, specifying "beam" plus "ball" means that locations which are
6613 * covered by the initial "beam", and also covered by the final "ball", except
6614 * for the final grid (the epicenter of the ball), will be "hit twice", once
6615 * by the initial beam, and once by the exploding ball. For the grid right
6616 * next to the epicenter, this results in 150% damage being done. The center
6617 * does not have this problem, for the same reason the final grid in a "beam"
6618 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6619 * grids which are covered by the "ball" will NOT work, as then they will
6620 * receive LESS damage than they should. Do not combine "beam" with "ball".
6622 * The array "gy[],gx[]" with current size "grids" is used to hold the
6623 * collected locations of all grids in the "blast area" plus "beam path".
6625 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6626 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6627 * first blast grid (see above) with radius "N" from the blast center. Note
6628 * that only the first gm[1] grids in the blast area thus take full damage.
6629 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6630 * number of blast grids.
6632 * Note that once the projection is complete, (y2,x2) holds the final location
6633 * of bolts/beams, and the "epicenter" of balls.
6635 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6636 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6637 * implementation of the "distance" function. Also, a bolt can be properly
6638 * viewed as a "ball" with a "rad" of "zero".
6640 * Note that if no "target" is reached before the beam/bolt/ball travels the
6641 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6642 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6644 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6645 * to move from point A to point B, even if the player cannot see part of the
6646 * projection path. Note that in general, the player will *always* see part
6647 * of the path, since it either starts at the player or ends on the player.
6649 * Hack -- we assume that every "projection" is "self-illuminating".
6651 * Hack -- when only a single monster is affected, we automatically track
6652 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6654 * Note that all projections now "explode" at their final destination, even
6655 * if they were being projected at a more distant destination. This means
6656 * that "ball" spells will *always* explode.
6658 * Note that we must call "handle_stuff()" after affecting terrain features
6659 * in the blast radius, in case the "illumination" of the grid was changed,
6660 * and "update_view()" and "update_monsters()" need to be called.
6663 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6673 POSITION y_saver, x_saver; /* For reflecting monsters */
6675 int msec = delay_factor * delay_factor * delay_factor;
6677 /* Assume the player sees nothing */
6678 bool notice = FALSE;
6680 /* Assume the player has seen nothing */
6681 bool visual = FALSE;
6683 /* Assume the player has seen no blast grids */
6686 /* Assume to be a normal ball spell */
6687 bool breath = FALSE;
6689 /* Is the player blind? */
6690 bool blind = (p_ptr->blind ? TRUE : FALSE);
6692 bool old_hide = FALSE;
6694 /* Number of grids in the "path" */
6697 /* Actual grids in the "path" */
6700 /* Number of grids in the "blast area" (including the "beam" path) */
6703 /* Coordinates of the affected grids */
6704 POSITION gx[1024], gy[1024];
6706 /* Encoded "radius" info (see above) */
6709 /* Actual radius encoded in gm[] */
6710 POSITION gm_rad = rad;
6714 /* Attacker's name (prepared before polymorph)*/
6715 GAME_TEXT who_name[MAX_NLEN];
6717 /* Can the player see the source of this effect? */
6718 bool see_s_msg = TRUE;
6720 /* Initialize by null string */
6726 /* Default target of monsterspell is player */
6727 monster_target_y = p_ptr->y;
6728 monster_target_x = p_ptr->x;
6730 /* Hack -- Jump to target */
6731 if (flg & (PROJECT_JUMP))
6736 /* Clear the flag */
6737 flg &= ~(PROJECT_JUMP);
6742 /* Start at player */
6749 /* Start at monster */
6752 x1 = m_list[who].fx;
6753 y1 = m_list[who].fy;
6754 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6766 /* Default "destination" */
6771 /* Hack -- verify stuff */
6772 if (flg & (PROJECT_THRU))
6774 if ((x1 == x2) && (y1 == y2))
6776 flg &= ~(PROJECT_THRU);
6780 /* Handle a breath attack */
6785 if (flg & PROJECT_HIDE) old_hide = TRUE;
6786 flg |= PROJECT_HIDE;
6790 /* Hack -- Assume there will be no blast (max radius 32) */
6791 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6799 /* Collect beam grids */
6800 if (flg & (PROJECT_BEAM))
6811 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6813 case GF_DISINTEGRATE:
6814 flg |= (PROJECT_GRID);
6815 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6819 /* Calculate the projection path */
6821 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6824 /* Giga-Hack SEEKER & SUPER_RAY */
6826 if( typ == GF_SEEKER )
6836 for (i = 0; i < path_n; ++i)
6841 int ny = GRID_Y(path_g[i]);
6842 int nx = GRID_X(path_g[i]);
6853 /* Only do visuals if requested */
6854 if (!blind && !(flg & (PROJECT_HIDE)))
6856 /* Only do visuals if the player can "see" the bolt */
6857 if (panel_contains(y, x) && player_has_los_bold(y, x))
6864 /* Obtain the bolt pict */
6865 p = bolt_pict(oy, ox, y, x, typ);
6867 /* Extract attr/char */
6871 /* Visual effects */
6872 print_rel(c, a, y, x);
6873 move_cursor_relative(y, x);
6874 /*if (fresh_before)*/ Term_fresh();
6875 Term_xtra(TERM_XTRA_DELAY, msec);
6877 /*if (fresh_before)*/ Term_fresh();
6879 /* Display "beam" grids */
6880 if (flg & (PROJECT_BEAM))
6882 /* Obtain the explosion pict */
6883 p = bolt_pict(y, x, y, x, typ);
6885 /* Extract attr/char */
6889 /* Visual effects */
6890 print_rel(c, a, y, x);
6893 /* Hack -- Activate delay */
6897 /* Hack -- delay anyway for consistency */
6900 /* Delay for consistency */
6901 Term_xtra(TERM_XTRA_DELAY, msec);
6904 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6905 if (is_mirror_grid(&cave[y][x]))
6907 /* The target of monsterspell becomes tha mirror(broken) */
6908 monster_target_y = y;
6909 monster_target_x = x;
6911 remove_mirror(y, x);
6912 next_mirror(&oy, &ox, y, x);
6914 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6915 for (j = last_i; j <= i; j++)
6917 y = GRID_Y(path_g[j]);
6918 x = GRID_X(path_g[j]);
6919 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6920 if (!who && (project_m_n == 1) && !jump) {
6921 if (cave[project_m_y][project_m_x].m_idx > 0) {
6922 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6926 /* Hack -- auto-recall */
6927 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6929 /* Hack - auto-track */
6930 health_track(cave[project_m_y][project_m_x].m_idx);
6934 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6939 for(i = last_i ; i < path_n ; i++)
6942 py = GRID_Y(path_g[i]);
6943 px = GRID_X(path_g[i]);
6944 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6946 if (!who && (project_m_n == 1) && !jump) {
6947 if (cave[project_m_y][project_m_x].m_idx > 0)
6949 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6953 /* Hack -- auto-recall */
6954 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6956 /* Hack - auto-track */
6957 health_track(cave[project_m_y][project_m_x].m_idx);
6961 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6965 else if(typ == GF_SUPER_RAY){
6967 int second_step = 0;
6974 for (i = 0; i < path_n; ++i)
6979 POSITION ny = GRID_Y(path_g[i]);
6980 POSITION nx = GRID_X(path_g[i]);
6991 /* Only do visuals if requested */
6992 if (!blind && !(flg & (PROJECT_HIDE)))
6994 /* Only do visuals if the player can "see" the bolt */
6995 if (panel_contains(y, x) && player_has_los_bold(y, x))
7002 /* Obtain the bolt pict */
7003 p = bolt_pict(oy, ox, y, x, typ);
7005 /* Extract attr/char */
7009 /* Visual effects */
7010 print_rel(c, a, y, x);
7011 move_cursor_relative(y, x);
7012 /*if (fresh_before)*/ Term_fresh();
7013 Term_xtra(TERM_XTRA_DELAY, msec);
7015 /*if (fresh_before)*/ Term_fresh();
7017 /* Display "beam" grids */
7018 if (flg & (PROJECT_BEAM))
7020 /* Obtain the explosion pict */
7021 p = bolt_pict(y, x, y, x, typ);
7023 /* Extract attr/char */
7027 /* Visual effects */
7028 print_rel(c, a, y, x);
7031 /* Hack -- Activate delay */
7035 /* Hack -- delay anyway for consistency */
7038 /* Delay for consistency */
7039 Term_xtra(TERM_XTRA_DELAY, msec);
7042 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7043 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7045 if( second_step )continue;
7048 if( is_mirror_grid(&cave[y][x]) && !second_step )
7050 /* The target of monsterspell becomes tha mirror(broken) */
7051 monster_target_y=(s16b)y;
7052 monster_target_x=(s16b)x;
7055 for( j = 0; j <=i ; j++ )
7057 y = GRID_Y(path_g[j]);
7058 x = GRID_X(path_g[j]);
7059 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7063 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7064 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7065 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7066 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7067 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7068 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7069 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7070 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7073 for( i = 0; i < path_n ; i++ )
7076 py = GRID_Y(path_g[i]);
7077 px = GRID_X(path_g[i]);
7078 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7079 if(!who && (project_m_n == 1) && !jump){
7080 if(cave[project_m_y][project_m_x].m_idx >0 ){
7081 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7085 /* Hack -- auto-recall */
7086 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7088 /* Hack - auto-track */
7089 health_track(cave[project_m_y][project_m_x].m_idx);
7093 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7098 /* Project along the path */
7099 for (i = 0; i < path_n; ++i)
7104 POSITION ny = GRID_Y(path_g[i]);
7105 POSITION nx = GRID_X(path_g[i]);
7107 if (flg & PROJECT_DISI)
7109 /* Hack -- Balls explode before reaching walls */
7110 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7112 else if (flg & PROJECT_LOS)
7114 /* Hack -- Balls explode before reaching walls */
7115 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7119 /* Hack -- Balls explode before reaching walls */
7120 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7127 /* Collect beam grids */
7128 if (flg & (PROJECT_BEAM))
7135 /* Only do visuals if requested */
7136 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7138 /* Only do visuals if the player can "see" the bolt */
7139 if (panel_contains(y, x) && player_has_los_bold(y, x))
7146 /* Obtain the bolt pict */
7147 p = bolt_pict(oy, ox, y, x, typ);
7149 /* Extract attr/char */
7153 /* Visual effects */
7154 print_rel(c, a, y, x);
7155 move_cursor_relative(y, x);
7156 /*if (fresh_before)*/ Term_fresh();
7157 Term_xtra(TERM_XTRA_DELAY, msec);
7159 /*if (fresh_before)*/ Term_fresh();
7161 /* Display "beam" grids */
7162 if (flg & (PROJECT_BEAM))
7164 /* Obtain the explosion pict */
7165 p = bolt_pict(y, x, y, x, typ);
7167 /* Extract attr/char */
7171 /* Visual effects */
7172 print_rel(c, a, y, x);
7175 /* Hack -- Activate delay */
7179 /* Hack -- delay anyway for consistency */
7182 /* Delay for consistency */
7183 Term_xtra(TERM_XTRA_DELAY, msec);
7190 /* Save the "blast epicenter" */
7194 if (breath && !path_n)
7200 flg &= ~(PROJECT_HIDE);
7204 /* Start the "explosion" */
7207 /* Hack -- make sure beams get to "explode" */
7215 /* If we found a "target", explode there */
7216 if (dist <= MAX_RANGE)
7218 /* Mega-Hack -- remove the final "beam" grid */
7219 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7222 * Create a conical breath attack
7233 flg &= ~(PROJECT_HIDE);
7235 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7239 /* Determine the blast area, work from the inside out */
7240 for (dist = 0; dist <= rad; dist++)
7242 /* Scan the maximal blast area of radius "dist" */
7243 for (y = by - dist; y <= by + dist; y++)
7245 for (x = bx - dist; x <= bx + dist; x++)
7247 /* Ignore "illegal" locations */
7248 if (!in_bounds2(y, x)) continue;
7250 /* Enforce a "circular" explosion */
7251 if (distance(by, bx, y, x) != dist) continue;
7257 /* Lights are stopped by opaque terrains */
7258 if (!los(by, bx, y, x)) continue;
7260 case GF_DISINTEGRATE:
7261 /* Disintegration are stopped only by perma-walls */
7262 if (!in_disintegration_range(by, bx, y, x)) continue;
7265 /* Ball explosions are stopped by walls */
7266 if (!projectable(by, bx, y, x)) continue;
7270 /* Save this grid */
7277 /* Encode some more "radius" info */
7283 /* Speed -- ignore "non-explosions" */
7284 if (!grids) return (FALSE);
7287 /* Display the "blast area" if requested */
7288 if (!blind && !(flg & (PROJECT_HIDE)))
7290 /* Then do the "blast", from inside out */
7291 for (t = 0; t <= gm_rad; t++)
7293 /* Dump everything with this radius */
7294 for (i = gm[t]; i < gm[t+1]; i++)
7296 /* Extract the location */
7300 /* Only do visuals if the player can "see" the blast */
7301 if (panel_contains(y, x) && player_has_los_bold(y, x))
7310 /* Obtain the explosion pict */
7311 p = bolt_pict(y, x, y, x, typ);
7313 /* Extract attr/char */
7317 /* Visual effects -- Display */
7318 print_rel(c, a, y, x);
7322 /* Hack -- center the cursor */
7323 move_cursor_relative(by, bx);
7325 /* Flush each "radius" seperately */
7326 /*if (fresh_before)*/ Term_fresh();
7328 /* Delay (efficiently) */
7329 if (visual || drawn)
7331 Term_xtra(TERM_XTRA_DELAY, msec);
7335 /* Flush the erasing */
7338 /* Erase the explosion drawn above */
7339 for (i = 0; i < grids; i++)
7341 /* Extract the location */
7345 /* Hack -- Erase if needed */
7346 if (panel_contains(y, x) && player_has_los_bold(y, x))
7352 /* Hack -- center the cursor */
7353 move_cursor_relative(by, bx);
7355 /* Flush the explosion */
7356 /*if (fresh_before)*/ Term_fresh();
7360 update_creature(p_ptr);
7362 if (flg & PROJECT_KILL)
7364 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7365 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7369 /* Check features */
7370 if (flg & (PROJECT_GRID))
7372 /* Start with "dist" of zero */
7375 /* Scan for features */
7376 for (i = 0; i < grids; i++)
7378 /* Hack -- Notice new "dist" values */
7379 if (gm[dist+1] == i) dist++;
7381 /* Get the grid location */
7385 /* Find the closest point in the blast */
7388 int d = dist_to_line(y, x, y1, x1, by, bx);
7390 /* Affect the grid */
7391 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7395 /* Affect the grid */
7396 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7401 update_creature(p_ptr);
7404 if (flg & (PROJECT_ITEM))
7406 /* Start with "dist" of zero */
7409 /* Scan for objects */
7410 for (i = 0; i < grids; i++)
7412 /* Hack -- Notice new "dist" values */
7413 if (gm[dist+1] == i) dist++;
7415 /* Get the grid location */
7419 /* Find the closest point in the blast */
7422 int d = dist_to_line(y, x, y1, x1, by, bx);
7424 /* Affect the object in the grid */
7425 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7429 /* Affect the object in the grid */
7430 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7436 /* Check monsters */
7437 if (flg & (PROJECT_KILL))
7444 /* Start with "dist" of zero */
7447 /* Scan for monsters */
7448 for (i = 0; i < grids; i++)
7452 /* Hack -- Notice new "dist" values */
7453 if (gm[dist + 1] == i) dist++;
7455 /* Get the grid location */
7459 /* A single bolt may be reflected */
7462 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7463 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7465 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7466 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7467 (!who || dist_hack > 1) && !one_in_(10))
7470 int max_attempts = 10;
7472 /* Choose 'new' target */
7475 t_y = y_saver - 1 + randint1(3);
7476 t_x = x_saver - 1 + randint1(3);
7479 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7481 if (max_attempts < 1)
7487 sound(SOUND_REFLECT);
7490 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7491 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7492 else if (m_ptr->r_idx == MON_DIO)
7493 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7495 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7497 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7499 /* Reflected bolts randomly target either one */
7500 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7501 else flg |= PROJECT_PLAYER;
7503 /* The bolt is reflected */
7504 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7506 /* Don't affect the monster any longer */
7512 /* Find the closest point in the blast */
7515 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7519 effective_dist = dist;
7523 /* There is the riding player on this monster */
7524 if (p_ptr->riding && player_bold(y, x))
7526 /* Aimed on the player */
7527 if (flg & PROJECT_PLAYER)
7529 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7532 * A beam or bolt is well aimed
7534 * So don't affects the mount.
7541 * The spell is not well aimed,
7542 * So partly affect the mount too.
7549 * This grid is the original target.
7550 * Or aimed on your horse.
7552 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7554 /* Hit the mount with full damage */
7558 * Otherwise this grid is not the
7559 * original target, it means that line
7560 * of fire is obstructed by this
7564 * A beam or bolt will hit either
7565 * player or mount. Choose randomly.
7567 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7571 /* Hit the mount with full damage */
7575 /* Hit the player later */
7576 flg |= PROJECT_PLAYER;
7578 /* Don't affect the mount */
7584 * The spell is not well aimed, so
7585 * partly affect both player and
7594 /* Affect the monster in the grid */
7595 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7599 /* Player affected one monster (without "jumping") */
7600 if (!who && (project_m_n == 1) && !jump)
7605 /* Track if possible */
7606 if (cave[y][x].m_idx > 0)
7608 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7612 /* Hack -- auto-recall */
7613 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7615 /* Hack - auto-track */
7616 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7624 if (flg & (PROJECT_KILL))
7626 /* Start with "dist" of zero */
7629 /* Scan for player */
7630 for (i = 0; i < grids; i++)
7634 /* Hack -- Notice new "dist" values */
7635 if (gm[dist+1] == i) dist++;
7637 /* Get the grid location */
7641 /* Affect the player? */
7642 if (!player_bold(y, x)) continue;
7644 /* Find the closest point in the blast */
7647 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7651 effective_dist = dist;
7654 /* Target may be your horse */
7657 /* Aimed on the player */
7658 if (flg & PROJECT_PLAYER)
7660 /* Hit the player with full damage */
7664 * Hack -- When this grid was not the
7665 * original target, a beam or bolt
7666 * would hit either player or mount,
7667 * and should be choosen randomly.
7669 * But already choosen to hit the
7670 * mount at this point.
7672 * Or aimed on your horse.
7674 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7677 * A beam or bolt is well aimed
7679 * So don't affects the player.
7686 * The spell is not well aimed,
7687 * So partly affect the player too.
7693 /* Affect the player */
7694 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7700 GAME_TEXT m_name[MAX_NLEN];
7702 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7704 if (rakubadam_m > 0)
7706 if (rakuba(rakubadam_m, FALSE))
7708 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7711 if (p_ptr->riding && rakubadam_p > 0)
7713 if(rakuba(rakubadam_p, FALSE))
7715 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7720 /* Return "something was noticed" */
7725 * @brief 鏡魔法「封魔結界」の効果処理
7727 * @return 効果があったらTRUEを返す
7729 bool binding_field(HIT_POINT dam)
7731 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7732 int mirror_num = 0; /* 鏡の数 */
7734 POSITION centersign;
7735 POSITION x1, x2, y1, y2;
7737 int msec = delay_factor*delay_factor*delay_factor;
7740 POSITION point_x[3];
7741 POSITION point_y[3];
7743 /* Default target of monsterspell is player */
7744 monster_target_y = p_ptr->y;
7745 monster_target_x = p_ptr->x;
7747 for (x = 0; x < cur_wid; x++)
7749 for (y = 0; y < cur_hgt; y++)
7751 if (is_mirror_grid(&cave[y][x]) &&
7752 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7753 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7754 player_has_los_bold(y, x) &&
7755 projectable(p_ptr->y, p_ptr->x, y, x)
7757 mirror_y[mirror_num] = y;
7758 mirror_x[mirror_num] = x;
7764 if (mirror_num < 2)return FALSE;
7766 point_x[0] = randint0(mirror_num);
7768 point_x[1] = randint0(mirror_num);
7769 } while (point_x[0] == point_x[1]);
7771 point_y[0] = mirror_y[point_x[0]];
7772 point_x[0] = mirror_x[point_x[0]];
7773 point_y[1] = mirror_y[point_x[1]];
7774 point_x[1] = mirror_x[point_x[1]];
7775 point_y[2] = p_ptr->y;
7776 point_x[2] = p_ptr->x;
7778 x = point_x[0] + point_x[1] + point_x[2];
7779 y = point_y[0] + point_y[1] + point_y[2];
7781 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7782 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7783 if (centersign == 0)return FALSE;
7785 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7786 x1 = x1 < point_x[2] ? x1 : point_x[2];
7787 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7788 y1 = y1 < point_y[2] ? y1 : point_y[2];
7790 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7791 x2 = x2 > point_x[2] ? x2 : point_x[2];
7792 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7793 y2 = y2 > point_y[2] ? y2 : point_y[2];
7795 for (y = y1; y <= y2; y++) {
7796 for (x = x1; x <= x2; x++) {
7797 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7798 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7799 centersign*((point_x[1] - x)*(point_y[2] - y)
7800 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7801 centersign*((point_x[2] - x)*(point_y[0] - y)
7802 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7804 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7805 /* Visual effects */
7807 && panel_contains(y, x)) {
7808 p = bolt_pict(y, x, y, x, GF_MANA);
7809 print_rel(PICT_C(p), PICT_A(p), y, x);
7810 move_cursor_relative(y, x);
7811 /*if (fresh_before)*/ Term_fresh();
7812 Term_xtra(TERM_XTRA_DELAY, msec);
7818 for (y = y1; y <= y2; y++) {
7819 for (x = x1; x <= x2; x++) {
7820 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7821 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7822 centersign*((point_x[1] - x)*(point_y[2] - y)
7823 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7824 centersign*((point_x[2] - x)*(point_y[0] - y)
7825 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7827 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7828 (void)project_f(0, 0, y, x, dam, GF_MANA);
7833 for (y = y1; y <= y2; y++) {
7834 for (x = x1; x <= x2; x++) {
7835 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7836 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7837 centersign*((point_x[1] - x)*(point_y[2] - y)
7838 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7839 centersign*((point_x[2] - x)*(point_y[0] - y)
7840 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7842 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7843 (void)project_o(0, 0, y, x, dam, GF_MANA);
7848 for (y = y1; y <= y2; y++) {
7849 for (x = x1; x <= x2; x++) {
7850 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7851 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7852 centersign*((point_x[1] - x)*(point_y[2] - y)
7853 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7854 centersign*((point_x[2] - x)*(point_y[0] - y)
7855 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7857 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7858 (void)project_m(0, 0, y, x, dam, GF_MANA,
7859 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7865 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7866 remove_mirror(point_y[0], point_x[0]);
7873 * @brief 鏡魔法「鏡の封印」の効果処理
7875 * @return 効果があったらTRUEを返す
7877 void seal_of_mirror(HIT_POINT dam)
7881 for (x = 0; x < cur_wid; x++)
7883 for (y = 0; y < cur_hgt; y++)
7885 if (is_mirror_grid(&cave[y][x]))
7887 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7888 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7890 if (!cave[y][x].m_idx)
7892 remove_mirror(y, x);