3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
19 #include "monsterrace-hook.h"
24 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
25 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
27 int project_length = 0; /*!< 投射の射程距離 */
31 * @brief モンスター魅了用セービングスロー共通部(汎用系)
33 * @param m_ptr 対象モンスター
34 * @return 魅了に抵抗したらTRUE
36 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
38 monster_race *r_ptr = &r_info[m_ptr->r_idx];
40 if(p_ptr->inside_arena) return TRUE;
43 if (r_ptr->flagsr & RFR_RES_ALL)
45 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
49 if (r_ptr->flags3 & RF3_NO_CONF)
51 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
55 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
57 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
58 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
59 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
63 * @brief モンスター服従用セービングスロー共通部(部族依存系)
65 * @param m_ptr 対象モンスター
66 * @return 服従に抵抗したらTRUE
68 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
70 monster_race *r_ptr = &r_info[m_ptr->r_idx];
72 if (p_ptr->inside_arena) return TRUE;
75 if (r_ptr->flagsr & RFR_RES_ALL)
77 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
81 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
83 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
84 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
85 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
89 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
92 * ハードコーティングによる実装が行われている。
93 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
95 PERCENTAGE beam_chance(void)
97 if (p_ptr->pclass == CLASS_MAGE)
98 return (PERCENTAGE)(p_ptr->lev);
99 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
100 return (PERCENTAGE)(p_ptr->lev + 10);
102 return (PERCENTAGE)(p_ptr->lev / 2);
107 * @brief 配置した鏡リストの次を取得する /
108 * Get another mirror. for SEEKER
109 * @param next_y 次の鏡のy座標を返す参照ポインタ
110 * @param next_x 次の鏡のx座標を返す参照ポインタ
111 * @param cury 現在の鏡のy座標
112 * @param curx 現在の鏡のx座標
114 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
116 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
117 int mirror_num = 0; /* 鏡の数 */
121 for (x = 0; x < cur_wid; x++)
123 for (y = 0; y < cur_hgt; y++)
125 if (is_mirror_grid(&cave[y][x])) {
126 mirror_y[mirror_num] = y;
127 mirror_x[mirror_num] = x;
134 num = randint0(mirror_num);
135 *next_y = mirror_y[num];
136 *next_x = mirror_x[num];
139 *next_y = cury + randint0(5) - 2;
140 *next_x = curx + randint0(5) - 2;
145 * @brief 万色表現用にランダムな色を選択する関数 /
146 * Get a legal "multi-hued" color for drawing "spells"
150 static TERM_COLOR mh_attr(int max)
152 switch (randint1(max))
154 case 1: return (TERM_RED);
155 case 2: return (TERM_GREEN);
156 case 3: return (TERM_BLUE);
157 case 4: return (TERM_YELLOW);
158 case 5: return (TERM_ORANGE);
159 case 6: return (TERM_VIOLET);
160 case 7: return (TERM_L_RED);
161 case 8: return (TERM_L_GREEN);
162 case 9: return (TERM_L_BLUE);
163 case 10: return (TERM_UMBER);
164 case 11: return (TERM_L_UMBER);
165 case 12: return (TERM_SLATE);
166 case 13: return (TERM_WHITE);
167 case 14: return (TERM_L_WHITE);
168 case 15: return (TERM_L_DARK);
176 * @brief 魔法属性に応じたエフェクトの色を返す /
177 * Return a color to use for the bolt/ball spells
181 static TERM_COLOR spell_color(int type)
183 /* Check if A.B.'s new graphics should be used (rr9) */
184 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
189 case GF_PSY_SPEAR: return (0x06);
190 case GF_MISSILE: return (0x0F);
191 case GF_ACID: return (0x04);
192 case GF_ELEC: return (0x02);
193 case GF_FIRE: return (0x00);
194 case GF_COLD: return (0x01);
195 case GF_POIS: return (0x03);
196 case GF_HOLY_FIRE: return (0x00);
197 case GF_HELL_FIRE: return (0x00);
198 case GF_MANA: return (0x0E);
200 case GF_SEEKER: return (0x0E);
201 case GF_SUPER_RAY: return (0x0E);
203 case GF_ARROW: return (0x0F);
204 case GF_WATER: return (0x04);
205 case GF_NETHER: return (0x07);
206 case GF_CHAOS: return (mh_attr(15));
207 case GF_DISENCHANT: return (0x05);
208 case GF_NEXUS: return (0x0C);
209 case GF_CONFUSION: return (mh_attr(4));
210 case GF_SOUND: return (0x09);
211 case GF_SHARDS: return (0x08);
212 case GF_FORCE: return (0x09);
213 case GF_INERTIAL: return (0x09);
214 case GF_GRAVITY: return (0x09);
215 case GF_TIME: return (0x09);
216 case GF_LITE_WEAK: return (0x06);
217 case GF_LITE: return (0x06);
218 case GF_DARK_WEAK: return (0x07);
219 case GF_DARK: return (0x07);
220 case GF_PLASMA: return (0x0B);
221 case GF_METEOR: return (0x00);
222 case GF_ICE: return (0x01);
223 case GF_ROCKET: return (0x0F);
224 case GF_DEATH_RAY: return (0x07);
225 case GF_NUKE: return (mh_attr(2));
226 case GF_DISINTEGRATE: return (0x05);
238 case GF_CAUSE_4: return (0x0E);
239 case GF_HAND_DOOM: return (0x07);
240 case GF_CAPTURE : return (0x0E);
241 case GF_IDENTIFY: return (0x01);
242 case GF_ATTACK: return (0x0F);
243 case GF_PHOTO : return (0x06);
246 /* Normal tiles or ASCII */
252 /* Lookup the default colors for this type */
253 cptr s = quark_str(gf_color[type]);
255 if (!s) return (TERM_WHITE);
257 /* Pick a random color */
258 c = s[randint0(strlen(s))];
260 /* Lookup this color */
261 a = my_strchr(color_char, c) - color_char;
263 /* Invalid color (note check for < 0 removed, gave a silly
264 * warning because bytes are always >= 0 -- RG) */
265 if (a > 15) return (TERM_WHITE);
271 /* Standard "color" */
277 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
278 * Find the attr/char pair to use for a spell effect
287 * It is moving (or has moved) from (x,y) to (nx,ny).
288 * If the distance is not "one", we (may) return "*".
291 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
301 if ((ny == y) && (nx == x)) base = 0x30;
304 else if (nx == x) base = 0x40;
307 else if (ny == y) base = 0x50;
310 else if ((ny - y) == (x - nx)) base = 0x60;
313 else if ((ny - y) == (nx - x)) base = 0x70;
318 /* Basic spell color */
319 k = spell_color(typ);
321 /* Obtain attr/char */
322 a = misc_to_attr[base + k];
323 c = misc_to_char[base + k];
331 * @brief 始点から終点への経路を返す /
332 * Determine the path taken by a projection.
333 * @param gp 経路座標リストを返す参照ポインタ
343 * The projection will always start from the grid (y1,x1), and will travel
344 * towards the grid (y2,x2), touching one grid per unit of distance along
345 * the major axis, and stopping when it enters the destination grid or a
346 * wall grid, or has travelled the maximum legal distance of "range".
348 * Note that "distance" in this function (as in the "update_view()" code)
349 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
350 * actually has an "octagon of projection" not a "circle of projection".
352 * The path grids are saved into the grid array pointed to by "gp", and
353 * there should be room for at least "range" grids in "gp". Note that
354 * due to the way in which distance is calculated, this function normally
355 * uses fewer than "range" grids for the projection path, so the result
356 * of this function should never be compared directly to "range". Note
357 * that the initial grid (y1,x1) is never saved into the grid array, not
358 * even if the initial grid is also the final grid.
360 * The "flg" flags can be used to modify the behavior of this function.
362 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
363 * semantics as they do for the "project" function, namely, that the path
364 * will stop as soon as it hits a monster, or that the path will continue
365 * through the destination grid, respectively.
367 * The "PROJECT_JUMP" flag, which for the "project()" function means to
368 * start at a special grid (which makes no sense in this function), means
369 * that the path should be "angled" slightly if needed to avoid any wall
370 * grids, allowing the player to "target" any grid which is in "view".
371 * This flag is non-trivial and has not yet been implemented, but could
372 * perhaps make use of the "vinfo" array (above).
374 * This function returns the number of grids (if any) in the path. This
375 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
377 * This algorithm is similar to, but slightly different from, the one used
378 * by "update_view_los()", and very different from the one used by "los()".
381 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
403 /* No path necessary (or allowed) */
404 if ((x1 == x2) && (y1 == y2)) return (0);
432 /* Number of "units" in one "half" grid */
435 /* Number of "units" in one "full" grid */
441 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
452 /* Advance (X) part 2 */
455 /* Advance (X) part 3 */
462 /* Create the projection path */
466 gp[n++] = GRID(y, x);
468 /* Hack -- Check maximum range */
469 if ((n + (k >> 1)) >= range) break;
471 /* Sometimes stop at destination grid */
472 if (!(flg & (PROJECT_THRU)))
474 if ((x == x2) && (y == y2)) break;
477 if (flg & (PROJECT_DISI))
479 if ((n > 0) && cave_stop_disintegration(y, x)) break;
481 else if (flg & (PROJECT_LOS))
483 if ((n > 0) && !cave_los_bold(y, x)) break;
485 else if (!(flg & (PROJECT_PATH)))
487 /* Always stop at non-initial wall grids */
488 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
491 /* Sometimes stop at non-initial monsters/players */
492 if (flg & (PROJECT_STOP))
495 (player_bold(y, x) || cave[y][x].m_idx != 0))
499 if (!in_bounds(y, x)) break;
504 /* Advance (X) part 1 */
507 /* Horizontal change */
510 /* Advance (X) part 2 */
513 /* Advance (X) part 3 */
529 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
538 /* Vertical change */
541 /* Advance (Y) part 2 */
544 /* Advance (Y) part 3 */
551 /* Create the projection path */
555 gp[n++] = GRID(y, x);
557 /* Hack -- Check maximum range */
558 if ((n + (k >> 1)) >= range) break;
560 /* Sometimes stop at destination grid */
561 if (!(flg & (PROJECT_THRU)))
563 if ((x == x2) && (y == y2)) break;
566 if (flg & (PROJECT_DISI))
568 if ((n > 0) && cave_stop_disintegration(y, x)) break;
570 else if (flg & (PROJECT_LOS))
572 if ((n > 0) && !cave_los_bold(y, x)) break;
574 else if (!(flg & (PROJECT_PATH)))
576 /* Always stop at non-initial wall grids */
577 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
580 /* Sometimes stop at non-initial monsters/players */
581 if (flg & (PROJECT_STOP))
584 (player_bold(y, x) || cave[y][x].m_idx != 0))
588 if (!in_bounds(y, x)) break;
593 /* Advance (Y) part 1 */
596 /* Vertical change */
599 /* Advance (Y) part 2 */
602 /* Advance (Y) part 3 */
622 /* Create the projection path */
626 gp[n++] = GRID(y, x);
628 /* Hack -- Check maximum range */
629 if ((n + (n >> 1)) >= range) break;
631 /* Sometimes stop at destination grid */
632 if (!(flg & (PROJECT_THRU)))
634 if ((x == x2) && (y == y2)) break;
637 if (flg & (PROJECT_DISI))
639 if ((n > 0) && cave_stop_disintegration(y, x)) break;
641 else if (flg & (PROJECT_LOS))
643 if ((n > 0) && !cave_los_bold(y, x)) break;
645 else if (!(flg & (PROJECT_PATH)))
647 /* Always stop at non-initial wall grids */
648 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
651 /* Sometimes stop at non-initial monsters/players */
652 if (flg & (PROJECT_STOP))
655 (player_bold(y, x) || cave[y][x].m_idx != 0))
659 if (!in_bounds(y, x)) break;
676 * Mega-Hack -- track "affected" monsters (see "project()" comments)
678 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
679 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
680 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
681 /* Mega-Hack -- monsters target */
682 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
683 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
687 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
688 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
689 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
690 * @param y 目標Y座標 / Target y location (or location to travel "towards")
691 * @param x 目標X座標 / Target x location (or location to travel "towards")
692 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
693 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
694 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
697 * We are called both for "beam" effects and "ball" effects.
699 * The "r" parameter is the "distance from ground zero".
701 * Note that we determine if the player can "see" anything that happens
702 * by taking into account: blindness, line-of-sight, and illumination.
704 * We return "TRUE" if the effect of the projection is "obvious".
706 * We also "see" grids which are "memorized", probably a hack
708 * Perhaps we should affect doors?
711 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
713 cave_type *c_ptr = &cave[y][x];
714 feature_type *f_ptr = &f_info[c_ptr->feat];
716 bool obvious = FALSE;
717 bool known = player_has_los_bold(y, x);
722 /* Reduce damage by distance */
723 dam = (dam + r) / (r + 1);
726 if (have_flag(f_ptr->flags, FF_TREE))
734 message = _("枯れた", "was blasted."); break;
736 message = _("縮んだ", "shrank."); break;
738 message = _("溶けた", "melted."); break;
741 message = _("凍り、砕け散った", "was frozen and smashed."); break;
745 message = _("燃えた", "burns up!"); break;
757 message = _("粉砕された", "was crushed."); break;
759 message = NULL; break;
763 msg_format(_("木は%s。", "A tree %s"), message);
764 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
767 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
771 /* Analyze the type */
774 /* Ignore most effects */
809 /* Destroy Traps (and Locks) */
812 /* Reveal secret doors */
813 if (is_hidden_door(c_ptr))
818 /* Check line of sight */
826 if (is_trap(c_ptr->feat))
828 /* Check line of sight */
831 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
835 /* Destroy the trap */
836 cave_alter_feat(y, x, FF_DISARM);
839 /* Locked doors are unlocked */
840 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
842 s16b old_feat = c_ptr->feat;
844 /* Unlock the door */
845 cave_alter_feat(y, x, FF_DISARM);
847 /* Check line of sound */
848 if (known && (old_feat != c_ptr->feat))
850 msg_print(_("カチッと音がした!", "Click!"));
855 /* Remove "unsafe" flag if player is not blind */
856 if (!p_ptr->blind && player_has_los_bold(y, x))
858 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
894 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
896 if (have_flag(f_ptr->flags, FF_SPIKE))
898 s16b old_mimic = c_ptr->mimic;
899 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
901 cave_alter_feat(y, x, FF_SPIKE);
902 c_ptr->mimic = old_mimic;
907 /* Check line of sight */
908 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
910 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
917 /* Destroy walls (and doors) */
920 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
922 if (known && (c_ptr->info & (CAVE_MARK)))
924 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
928 /* Destroy the wall */
929 cave_alter_feat(y, x, FF_HURT_ROCK);
931 /* Update some things */
932 p_ptr->update |= (PU_FLOW);
941 /* Require a "naked" floor grid */
942 if (!cave_naked_bold(y, x)) break;
944 /* Not on the player */
945 if (player_bold(y, x)) break;
947 /* Create a closed door */
948 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
951 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
968 /* Require a "naked" floor grid */
969 if (!cave_naked_bold(y, x)) break;
971 /* Not on the player */
972 if (player_bold(y, x)) break;
974 /* Create a closed door */
975 cave_set_feat(y, x, feat_tree);
978 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
986 /* Require a "naked" floor grid */
987 if (!cave_naked_bold(y, x)) break;
990 c_ptr->info |= CAVE_OBJECT;
991 c_ptr->mimic = feat_glyph;
1002 /* Require a "naked" floor grid */
1003 if (!cave_naked_bold(y, x)) break;
1005 /* Not on the player */
1006 if (player_bold(y, x)) break;
1009 cave_set_feat(y, x, feat_granite);
1017 /* Ignore permanent grid */
1018 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1023 /* Ignore grid without enough space */
1024 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1026 /* Place a shallow lava */
1027 cave_set_feat(y, x, feat_shallow_lava);
1032 /* Place a deep lava */
1033 cave_set_feat(y, x, feat_deep_lava);
1040 /* Ignore permanent grid */
1041 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1046 /* Ignore grid without enough space */
1047 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1049 /* Place a shallow water */
1050 cave_set_feat(y, x, feat_shallow_water);
1055 /* Place a deep water */
1056 cave_set_feat(y, x, feat_deep_water);
1061 /* Lite up the grid */
1065 /* Turn on the light */
1066 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1068 c_ptr->info |= (CAVE_GLOW);
1071 update_local_illumination(y, x);
1074 if (player_can_see_bold(y, x)) obvious = TRUE;
1076 /* Mega-Hack -- Update the monster in the affected grid */
1077 /* This allows "spear of light" (etc) to work "correctly" */
1078 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1080 if (p_ptr->special_defense & NINJA_S_STEALTH)
1082 if (player_bold(y, x)) set_superstealth(FALSE);
1089 /* Darken the grid */
1093 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1096 /* Turn off the light. */
1099 if (dun_level || !is_daytime())
1101 for (j = 0; j < 9; j++)
1103 int by = y + ddy_ddd[j];
1104 int bx = x + ddx_ddd[j];
1106 if (in_bounds2(by, bx))
1108 cave_type *cc_ptr = &cave[by][bx];
1110 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1118 if (!do_dark) break;
1121 c_ptr->info &= ~(CAVE_GLOW);
1123 /* Hack -- Forget "boring" grids */
1124 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1127 c_ptr->info &= ~(CAVE_MARK);
1134 update_local_illumination(y, x);
1136 if (player_can_see_bold(y, x)) obvious = TRUE;
1138 /* Mega-Hack -- Update the monster in the affected grid */
1139 /* This allows "spear of light" (etc) to work "correctly" */
1140 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1150 if (is_mirror_grid(c_ptr))
1152 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1154 remove_mirror(y, x);
1155 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1158 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1160 if (known && (c_ptr->info & CAVE_MARK))
1162 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1166 /* Destroy the wall */
1167 cave_alter_feat(y, x, FF_HURT_ROCK);
1169 /* Update some things */
1170 p_ptr->update |= (PU_FLOW);
1177 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1179 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1181 remove_mirror(y, x);
1182 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1185 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1187 if (known && (c_ptr->info & CAVE_MARK))
1189 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1193 /* Destroy the wall */
1194 cave_alter_feat(y, x, FF_HURT_ROCK);
1196 /* Update some things */
1197 p_ptr->update |= (PU_FLOW);
1202 case GF_DISINTEGRATE:
1204 /* Destroy mirror/glyph */
1205 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1206 remove_mirror(y, x);
1208 /* Permanent features don't get effect */
1209 /* But not protect monsters and other objects */
1210 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1212 cave_alter_feat(y, x, FF_HURT_DISI);
1214 /* Update some things -- similar to GF_KILL_WALL */
1215 p_ptr->update |= (PU_FLOW);
1222 /* Return "Anything seen?" */
1229 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1230 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1231 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1232 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1233 * @param x 目標X座標 / Target x location (or location to travel "towards")
1234 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1235 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1236 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1239 * We are called from "project()" to "damage" objects
1241 * We are called both for "beam" effects and "ball" effects.
1243 * Perhaps we should only SOMETIMES damage things on the ground.
1245 * The "r" parameter is the "distance from ground zero".
1247 * Note that we determine if the player can "see" anything that happens
1248 * by taking into account: blindness, line-of-sight, and illumination.
1250 * We also "see" grids which are "memorized", probably a hack
1252 * We return "TRUE" if the effect of the projection is "obvious".
1255 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1257 cave_type *c_ptr = &cave[y][x];
1259 OBJECT_IDX this_o_idx, next_o_idx = 0;
1261 bool obvious = FALSE;
1262 bool known = player_has_los_bold(y, x);
1264 BIT_FLAGS flgs[TR_FLAG_SIZE];
1266 GAME_TEXT o_name[MAX_NLEN];
1268 KIND_OBJECT_IDX k_idx = 0;
1269 bool is_potion = FALSE;
1272 who = who ? who : 0;
1274 /* Reduce damage by distance */
1275 dam = (dam + r) / (r + 1);
1278 /* Scan all objects in the grid */
1279 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1281 object_type *o_ptr = &o_list[this_o_idx];
1283 bool is_art = FALSE;
1284 bool ignore = FALSE;
1285 bool do_kill = FALSE;
1287 cptr note_kill = NULL;
1290 /* Get the "plural"-ness */
1291 bool plural = (o_ptr->number > 1);
1294 /* Acquire next object */
1295 next_o_idx = o_ptr->next_o_idx;
1297 /* Extract the flags */
1298 object_flags(o_ptr, flgs);
1300 /* Check for artifact */
1301 if (object_is_artifact(o_ptr)) is_art = TRUE;
1303 /* Analyze the type */
1306 /* Acid -- Lots of things */
1309 if (hates_acid(o_ptr))
1312 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1313 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1318 /* Elec -- Rings and Wands */
1321 if (hates_elec(o_ptr))
1324 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1325 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1330 /* Fire -- Flammable objects */
1333 if (hates_fire(o_ptr))
1336 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1337 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1342 /* Cold -- potions and flasks */
1345 if (hates_cold(o_ptr))
1347 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1349 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1357 if (hates_fire(o_ptr))
1360 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1361 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1363 if (hates_elec(o_ptr))
1367 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1368 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1376 if (hates_fire(o_ptr))
1379 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1380 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1382 if (hates_cold(o_ptr))
1386 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1387 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1392 /* Hack -- break potions and such */
1398 if (hates_cold(o_ptr))
1400 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1406 /* Mana and Chaos -- destroy everything */
1412 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1416 case GF_DISINTEGRATE:
1419 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1426 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1427 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1428 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1432 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1436 if (object_is_cursed(o_ptr))
1439 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1446 identify_item(o_ptr);
1448 /* Auto-inscription */
1449 autopick_alter_item((-this_o_idx), FALSE);
1457 /* Chests are noticed only if trapped or locked */
1458 if (o_ptr->tval == TV_CHEST)
1460 /* Disarm/Unlock traps */
1461 if (o_ptr->pval > 0)
1463 /* Disarm or Unlock */
1464 o_ptr->pval = (0 - o_ptr->pval);
1467 object_known(o_ptr);
1469 if (known && (o_ptr->marked & OM_FOUND))
1471 msg_print(_("カチッと音がした!", "Click!"));
1481 if (o_ptr->tval == TV_CORPSE)
1484 BIT_FLAGS mode = 0L;
1486 if (!who || is_pet(&m_list[who]))
1487 mode |= PM_FORCE_PET;
1489 for (i = 0; i < o_ptr->number ; i++)
1491 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1492 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1496 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1500 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1502 note_kill = _("生き返った。", " revived.");
1504 else if (!note_kill)
1506 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1517 /* Attempt to destroy the object */
1520 /* Effect "observed" */
1521 if (known && (o_ptr->marked & OM_FOUND))
1524 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1527 /* Artifacts, and other objects, get to resist */
1528 if (is_art || ignore)
1530 /* Observe the resist */
1531 if (known && (o_ptr->marked & OM_FOUND))
1533 msg_format(_("%sは影響を受けない!",
1534 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1541 /* Describe if needed */
1542 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1544 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1547 k_idx = o_ptr->k_idx;
1548 is_potion = object_is_potion(o_ptr);
1549 delete_object_idx(this_o_idx);
1551 /* Potions produce effects when 'shattered' */
1554 (void)potion_smash_effect(who, y, x, k_idx);
1562 /* Return "Anything seen?" */
1568 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1569 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1570 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1571 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1572 * @param x 目標X座標 / Target x location (or location to travel "towards")
1573 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1574 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1576 * @param see_s_msg TRUEならばメッセージを表示する
1577 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1580 * This routine takes a "source monster" (by index) which is mostly used to
1581 * determine if the player is causing the damage, and a "radius" (see below),
1582 * which is used to decrease the power of explosions with distance, and a
1583 * location, via integers which are modified by certain types of attacks
1584 * (polymorph and teleport being the obvious ones), a default damage, which
1585 * is modified as needed based on various properties, and finally a "damage
1586 * type" (see below).
1589 * Note that this routine can handle "no damage" attacks (like teleport) by
1590 * taking a "zero" damage, and can even take "parameters" to attacks (like
1591 * confuse) by accepting a "damage", using it to calculate the effect, and
1592 * then setting the damage to zero. Note that the "damage" parameter is
1593 * divided by the radius, so monsters not at the "epicenter" will not take
1594 * as much damage (or whatever)...
1597 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1598 * may result in a dereference of an invalid pointer.
1601 * Various messages are produced, and damage is applied.
1604 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1605 * actually be "made" of that substance, or "breathe" big balls of it.
1606 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1608 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1609 * and hurts evil less. If can breath nether, then it resists it as well.
1612 * Damage reductions use the following formulas:
1613 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1614 * gives avg damage of .655, ranging from .858 to .500
1615 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1616 * gives avg damage of .544, ranging from .714 to .417
1617 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1618 * gives avg damage of .444, ranging from .556 to .333
1619 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1620 * gives avg damage of .327, ranging from .427 to .250
1621 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1622 * gives something simple.
1625 * In this function, "result" messages are postponed until the end, where
1626 * the "note" string is appended to the monster name, if not NULL. So,
1627 * to make a spell have "no effect" just set "note" to NULL. You should
1628 * also set "notice" to FALSE, or the player will learn what the spell does.
1631 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1635 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)
1639 cave_type *c_ptr = &cave[y][x];
1641 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1642 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1644 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1648 /* Is the monster "seen"? */
1649 bool seen = m_ptr->ml;
1650 bool seen_msg = is_seen(m_ptr);
1652 bool slept = (bool)MON_CSLEEP(m_ptr);
1654 /* Were the effects "obvious" (if seen)? */
1655 bool obvious = FALSE;
1657 /* Can the player know about this effect? */
1658 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1660 /* Were the effects "irrelevant"? */
1661 bool skipped = FALSE;
1663 /* Gets the monster angry at the source of the effect? */
1664 bool get_angry = FALSE;
1666 /* Polymorph setting (true or false) */
1667 bool do_poly = FALSE;
1669 /* Teleport setting (max distance) */
1672 /* Confusion setting (amount to confuse) */
1675 /* Stunning setting (amount to stun) */
1678 /* Sleep amount (amount to sleep) */
1681 /* Fear amount (amount to fear) */
1684 /* Time amount (amount to time) */
1687 bool heal_leper = FALSE;
1689 /* Hold the monster name */
1690 GAME_TEXT m_name[MAX_NLEN];
1693 PARAMETER_VALUE photo = 0;
1695 /* Assume no note */
1698 /* Assume a default death */
1699 cptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1701 POSITION ty = m_ptr->fy;
1702 POSITION tx = m_ptr->fx;
1704 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1707 if (!c_ptr->m_idx) return (FALSE);
1709 /* Never affect projector */
1710 if (who && (c_ptr->m_idx == who)) return (FALSE);
1711 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1712 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1714 /* Don't affect already death monsters */
1715 /* Prevents problems with chain reactions of exploding monsters */
1716 if (m_ptr->hp < 0) return (FALSE);
1718 /* Reduce damage by distance */
1719 dam = (dam + r) / (r + 1);
1722 /* Get the monster name (BEFORE polymorphing) */
1723 monster_desc(m_name, m_ptr, 0);
1725 /* Get the monster possessive ("his"/"her"/"its") */
1726 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1728 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1730 /* Analyze the damage type */
1733 /* Magic Missile -- pure damage */
1736 if (seen) obvious = TRUE;
1738 if (r_ptr->flagsr & RFR_RES_ALL)
1740 note = _("には完全な耐性がある!", " is immune.");
1742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1751 if (seen) obvious = TRUE;
1753 if (r_ptr->flagsr & RFR_RES_ALL)
1755 note = _("には完全な耐性がある!", " is immune.");
1757 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1760 if (r_ptr->flagsr & RFR_IM_ACID)
1762 note = _("にはかなり耐性がある!", " resists a lot.");
1764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1772 if (seen) obvious = TRUE;
1774 if (r_ptr->flagsr & RFR_RES_ALL)
1776 note = _("には完全な耐性がある!", " is immune.");
1778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1781 if (r_ptr->flagsr & RFR_IM_ELEC)
1783 note = _("にはかなり耐性がある!", " resists a lot.");
1785 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1793 if (seen) obvious = TRUE;
1795 if (r_ptr->flagsr & RFR_RES_ALL)
1797 note = _("には完全な耐性がある!", " is immune.");
1799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1802 if (r_ptr->flagsr & RFR_IM_FIRE)
1804 note = _("にはかなり耐性がある!", " resists a lot.");
1806 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1808 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1810 note = _("はひどい痛手をうけた。", " is hit hard.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1820 if (seen) obvious = TRUE;
1822 if (r_ptr->flagsr & RFR_RES_ALL)
1824 note = _("には完全な耐性がある!", " is immune.");
1826 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1829 if (r_ptr->flagsr & RFR_IM_COLD)
1831 note = _("にはかなり耐性がある!", " resists a lot.");
1833 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1835 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1837 note = _("はひどい痛手をうけた。", " is hit hard.");
1839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1847 if (seen) obvious = TRUE;
1849 if (r_ptr->flagsr & RFR_RES_ALL)
1851 note = _("には完全な耐性がある!", " is immune.");
1853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1856 if (r_ptr->flagsr & RFR_IM_POIS)
1858 note = _("にはかなり耐性がある!", " resists a lot.");
1860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1868 if (seen) obvious = TRUE;
1870 if (r_ptr->flagsr & RFR_RES_ALL)
1872 note = _("には完全な耐性がある!", " is immune.");
1874 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1877 if (r_ptr->flagsr & RFR_IM_POIS)
1879 note = _("には耐性がある。", " resists.");
1880 dam *= 3; dam /= randint1(6) + 6;
1881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1883 else if (one_in_(3)) do_poly = TRUE;
1887 /* Hellfire -- hurts Evil */
1890 if (seen) obvious = TRUE;
1892 if (r_ptr->flagsr & RFR_RES_ALL)
1894 note = _("には完全な耐性がある!", " is immune.");
1896 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1899 if (r_ptr->flags3 & RF3_GOOD)
1901 note = _("はひどい痛手をうけた。", " is hit hard.");
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1908 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1911 if (seen) obvious = TRUE;
1913 if (r_ptr->flagsr & RFR_RES_ALL)
1915 note = _("には完全な耐性がある!", " is immune.");
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1920 if (r_ptr->flags3 & RF3_GOOD)
1922 note = _("には完全な耐性がある!", " is immune.");
1924 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1926 else if (r_ptr->flags3 & RF3_EVIL)
1929 note = _("はひどい痛手をうけた。", " is hit hard.");
1930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1934 note = _("には耐性がある。", " resists.");
1935 dam *= 3; dam /= randint1(6) + 6;
1940 /* Arrow -- XXX no defense */
1943 if (seen) obvious = TRUE;
1945 if (r_ptr->flagsr & RFR_RES_ALL)
1947 note = _("には完全な耐性がある!", " is immune.");
1949 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1955 /* Plasma -- XXX perhaps check ELEC or FIRE */
1958 if (seen) obvious = TRUE;
1960 if (r_ptr->flagsr & RFR_RES_ALL)
1962 note = _("には完全な耐性がある!", " is immune.");
1964 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1967 if (r_ptr->flagsr & RFR_RES_PLAS)
1969 note = _("には耐性がある。", " resists.");
1970 dam *= 3; dam /= randint1(6) + 6;
1971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1976 /* Nether -- see above */
1979 if (seen) obvious = TRUE;
1981 if (r_ptr->flagsr & RFR_RES_ALL)
1983 note = _("には完全な耐性がある!", " is immune.");
1985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1988 if (r_ptr->flagsr & RFR_RES_NETH)
1990 if (r_ptr->flags3 & RF3_UNDEAD)
1992 note = _("には完全な耐性がある!", " is immune.");
1994 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1998 note = _("には耐性がある。", " resists.");
1999 dam *= 3; dam /= randint1(6) + 6;
2001 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2003 else if (r_ptr->flags3 & RF3_EVIL)
2005 note = _("はいくらか耐性を示した。", " resists somewhat.");
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2012 /* Water (acid) damage -- Water spirits/elementals are immune */
2015 if (seen) obvious = TRUE;
2017 if (r_ptr->flagsr & RFR_RES_ALL)
2019 note = _("には完全な耐性がある!", " is immune.");
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2024 if (r_ptr->flagsr & RFR_RES_WATE)
2026 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2028 note = _("には完全な耐性がある!", " is immune.");
2033 note = _("には耐性がある。", " resists.");
2034 dam *= 3; dam /= randint1(6) + 6;
2036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2041 /* Chaos -- Chaos breathers resist */
2044 if (seen) obvious = TRUE;
2046 if (r_ptr->flagsr & RFR_RES_ALL)
2048 note = _("には完全な耐性がある!", " is immune.");
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2053 if (r_ptr->flagsr & RFR_RES_CHAO)
2055 note = _("には耐性がある。", " resists.");
2056 dam *= 3; dam /= randint1(6) + 6;
2057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2059 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2061 note = _("はいくらか耐性を示した。", " resists somewhat.");
2062 dam *= 3; dam /= randint1(6) + 6;
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2068 do_conf = (5 + randint1(11) + r) / (r + 1);
2073 /* Shards -- Shard breathers resist */
2076 if (seen) obvious = TRUE;
2078 if (r_ptr->flagsr & RFR_RES_ALL)
2080 note = _("には完全な耐性がある!", " is immune.");
2082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2085 if (r_ptr->flagsr & RFR_RES_SHAR)
2087 note = _("には耐性がある。", " resists.");
2088 dam *= 3; dam /= randint1(6) + 6;
2089 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2094 /* Rocket: Shard resistance helps */
2097 if (seen) obvious = TRUE;
2099 if (r_ptr->flagsr & RFR_RES_ALL)
2101 note = _("には完全な耐性がある!", " is immune.");
2103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2106 if (r_ptr->flagsr & RFR_RES_SHAR)
2108 note = _("はいくらか耐性を示した。", " resists somewhat.");
2110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2116 /* Sound -- Sound breathers resist */
2119 if (seen) obvious = TRUE;
2121 if (r_ptr->flagsr & RFR_RES_ALL)
2123 note = _("には完全な耐性がある!", " is immune.");
2125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2128 if (r_ptr->flagsr & RFR_RES_SOUN)
2130 note = _("には耐性がある。", " resists.");
2131 dam *= 2; dam /= randint1(6) + 6;
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2134 else do_stun = (10 + randint1(15) + r) / (r + 1);
2141 if (seen) obvious = TRUE;
2143 if (r_ptr->flagsr & RFR_RES_ALL)
2145 note = _("には完全な耐性がある!", " is immune.");
2147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2150 if (r_ptr->flags3 & RF3_NO_CONF)
2152 note = _("には耐性がある。", " resists.");
2153 dam *= 3; dam /= randint1(6) + 6;
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2156 else do_conf = (10 + randint1(15) + r) / (r + 1);
2160 /* Disenchantment -- Breathers and Disenchanters resist */
2163 if (seen) obvious = TRUE;
2165 if (r_ptr->flagsr & RFR_RES_ALL)
2167 note = _("には完全な耐性がある!", " is immune.");
2169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2172 if (r_ptr->flagsr & RFR_RES_DISE)
2174 note = _("には耐性がある。", " resists.");
2175 dam *= 3; dam /= randint1(6) + 6;
2176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2181 /* Nexus -- Breathers and Existers resist */
2184 if (seen) obvious = TRUE;
2186 if (r_ptr->flagsr & RFR_RES_ALL)
2188 note = _("には完全な耐性がある!", " is immune.");
2190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2193 if (r_ptr->flagsr & RFR_RES_NEXU)
2195 note = _("には耐性がある。", " resists.");
2196 dam *= 3; dam /= randint1(6) + 6;
2197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2205 if (seen) obvious = TRUE;
2207 if (r_ptr->flagsr & RFR_RES_ALL)
2209 note = _("には完全な耐性がある!", " is immune.");
2211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2214 if (r_ptr->flagsr & RFR_RES_WALL)
2216 note = _("には耐性がある。", " resists.");
2217 dam *= 3; dam /= randint1(6) + 6;
2218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2220 else do_stun = (randint1(15) + r) / (r + 1);
2224 /* Inertia -- breathers resist */
2227 if (seen) obvious = TRUE;
2229 if (r_ptr->flagsr & RFR_RES_ALL)
2231 note = _("には完全な耐性がある!", " is immune.");
2233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2236 if (r_ptr->flagsr & RFR_RES_INER)
2238 note = _("には耐性がある。", " resists.");
2239 dam *= 3; dam /= randint1(6) + 6;
2240 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2244 /* Powerful monsters can resist */
2245 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2246 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2250 /* Normal monsters slow down */
2253 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2255 note = _("の動きが遅くなった。", " starts moving slower.");
2262 /* Time -- breathers resist */
2265 if (seen) obvious = TRUE;
2267 if (r_ptr->flagsr & RFR_RES_ALL)
2269 note = _("には完全な耐性がある!", " is immune.");
2271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2274 if (r_ptr->flagsr & RFR_RES_TIME)
2276 note = _("には耐性がある。", " resists.");
2277 dam *= 3; dam /= randint1(6) + 6;
2278 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2280 else do_time = (dam + 1) / 2;
2284 /* Gravity -- breathers resist */
2287 bool resist_tele = FALSE;
2289 if (seen) obvious = TRUE;
2291 if (r_ptr->flagsr & RFR_RES_ALL)
2293 note = _("には完全な耐性がある!", " is immune.");
2295 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2298 if (r_ptr->flagsr & RFR_RES_TELE)
2300 if (r_ptr->flags1 & (RF1_UNIQUE))
2302 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2303 note = _("には効果がなかった。", " is unaffected!");
2306 else if (r_ptr->level > randint1(100))
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2309 note = _("には耐性がある!", " resists!");
2314 if (!resist_tele) do_dist = 10;
2316 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2318 if (r_ptr->flagsr & RFR_RES_GRAV)
2320 note = _("には耐性がある!", " resists!");
2321 dam *= 3; dam /= randint1(6) + 6;
2323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2328 /* Powerful monsters can resist */
2329 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2330 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2334 /* Normal monsters slow down */
2337 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2339 note = _("の動きが遅くなった。", " starts moving slower.");
2344 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2346 /* Attempt a saving throw */
2347 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2348 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2352 /* No obvious effect */
2353 note = _("には効果がなかった。", " is unaffected!");
2365 if (seen) obvious = TRUE;
2367 if (r_ptr->flagsr & RFR_RES_ALL)
2369 note = _("には完全な耐性がある!", " is immune.");
2371 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2379 case GF_DISINTEGRATE:
2381 if (seen) obvious = TRUE;
2383 if (r_ptr->flagsr & RFR_RES_ALL)
2385 note = _("には完全な耐性がある!", " is immune.");
2387 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2390 if (r_ptr->flags3 & RF3_HURT_ROCK)
2392 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2393 note = _("の皮膚がただれた!", " loses some skin!");
2394 note_dies = _("は蒸発した!", " evaporates!");
2402 if (seen) obvious = TRUE;
2404 /* PSI only works if the monster can see you! -- RG */
2405 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2408 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2413 if (r_ptr->flagsr & RFR_RES_ALL)
2415 note = _("には完全な耐性がある!", " is immune.");
2417 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2420 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2423 note = _("には完全な耐性がある!", " is immune.");
2424 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2427 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2428 (r_ptr->flags3 & RF3_ANIMAL) ||
2429 (r_ptr->level > randint1(3 * dam)))
2431 note = _("には耐性がある!", " resists!");
2435 * Powerful demons & undead can turn a mindcrafter's
2436 * attacks back on them
2438 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2439 (r_ptr->level > p_ptr->lev / 2) &&
2443 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2444 (seen ? "%^s's corrupted mind backlashes your attack!" :
2445 "%^ss corrupted mind backlashes your attack!")), m_name);
2448 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2450 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2454 /* Injure +/- confusion */
2455 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2456 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2457 if (one_in_(4) && !CHECK_MULTISHADOW())
2459 switch (randint1(4))
2462 set_confused(p_ptr->confused + 3 + randint1(dam));
2465 set_stun(p_ptr->stun + randint1(dam));
2469 if (r_ptr->flags3 & RF3_NO_FEAR)
2470 note = _("には効果がなかった。", " is unaffected.");
2472 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2476 if (!p_ptr->free_act)
2477 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2486 if ((dam > 0) && one_in_(4))
2488 switch (randint1(4))
2491 do_conf = 3 + randint1(dam);
2494 do_stun = 3 + randint1(dam);
2497 do_fear = 3 + randint1(dam);
2500 note = _("は眠り込んでしまった!", " falls asleep!");
2501 do_sleep = 3 + randint1(dam);
2506 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2512 if (seen) obvious = TRUE;
2514 if (r_ptr->flagsr & RFR_RES_ALL)
2516 note = _("には完全な耐性がある!", " is immune.");
2518 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2521 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2524 note = _("には完全な耐性がある!", " is immune.");
2526 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2527 (r_ptr->flags3 & RF3_ANIMAL) ||
2528 (r_ptr->level > randint1(3 * dam)))
2530 note = _("には耐性がある!", " resists!");
2534 * Powerful demons & undead can turn a mindcrafter's
2535 * attacks back on them
2537 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2538 (r_ptr->level > p_ptr->lev / 2) &&
2542 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2543 (seen ? "%^s's corrupted mind backlashes your attack!" :
2544 "%^ss corrupted mind backlashes your attack!")), m_name);
2546 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2548 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2552 /* Injure + mana drain */
2553 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2554 if (!CHECK_MULTISHADOW())
2556 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2557 p_ptr->csp -= damroll(5, dam) / 2;
2558 if (p_ptr->csp < 0) p_ptr->csp = 0;
2559 p_ptr->redraw |= PR_MANA;
2560 p_ptr->window |= (PW_SPELL);
2562 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2569 int b = damroll(5, dam) / 4;
2570 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2571 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2572 (seen ? "You convert %s's pain into %s!" :
2573 "You convert %ss pain into %s!"));
2574 msg_format(msg, m_name, str);
2576 b = MIN(p_ptr->msp, p_ptr->csp + b);
2578 p_ptr->redraw |= PR_MANA;
2579 p_ptr->window |= (PW_SPELL);
2581 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2585 case GF_TELEKINESIS:
2587 if (seen) obvious = TRUE;
2589 if (r_ptr->flagsr & RFR_RES_ALL)
2591 note = _("には完全な耐性がある!", " is immune.");
2593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2598 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2603 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2605 /* Attempt a saving throw */
2606 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2607 (r_ptr->level > 5 + randint1(dam)))
2611 /* No obvious effect */
2617 /* Psycho-spear -- powerful magic missile */
2620 if (seen) obvious = TRUE;
2622 if (r_ptr->flagsr & RFR_RES_ALL)
2624 note = _("には完全な耐性がある!", " is immune.");
2626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2632 /* Meteor -- powerful magic missile */
2635 if (seen) obvious = TRUE;
2637 if (r_ptr->flagsr & RFR_RES_ALL)
2639 note = _("には完全な耐性がある!", " is immune.");
2641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2649 if (!is_hostile(m_ptr)) break;
2651 if (seen) obvious = TRUE;
2653 if (r_ptr->flagsr & RFR_RES_ALL)
2655 note = _("には効果がなかった!", " is immune.");
2657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2660 /* Attempt a saving throw */
2661 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2662 (r_ptr->flags3 & RF3_NO_CONF) ||
2663 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2665 /* Memorize a flag */
2666 if (r_ptr->flags3 & RF3_NO_CONF)
2668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2675 * Powerful demons & undead can turn a mindcrafter's
2676 * attacks back on them
2678 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2679 (r_ptr->level > p_ptr->lev / 2) &&
2683 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2684 (seen ? "%^s's corrupted mind backlashes your attack!" :
2685 "%^ss corrupted mind backlashes your attack!")), m_name);
2688 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2690 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2694 /* Confuse, stun, terrify */
2695 switch (randint1(4))
2698 set_stun(p_ptr->stun + dam / 2);
2701 set_confused(p_ptr->confused + dam / 2);
2705 if (r_ptr->flags3 & RF3_NO_FEAR)
2706 note = _("には効果がなかった。", " is unaffected.");
2708 set_afraid(p_ptr->afraid + dam);
2715 /* No obvious effect */
2716 note = _("には効果がなかった。", " is unaffected.");
2722 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2724 note = _("があなたに隷属した。", " is in your thrall!");
2729 switch (randint1(4))
2743 /* No "real" damage */
2750 /* Ice -- Cold + Cuts + Stun */
2753 if (seen) obvious = TRUE;
2755 if (r_ptr->flagsr & RFR_RES_ALL)
2757 note = _("には完全な耐性がある!", " is immune.");
2759 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2762 do_stun = (randint1(15) + 1) / (r + 1);
2763 if (r_ptr->flagsr & RFR_IM_COLD)
2765 note = _("にはかなり耐性がある!", " resists a lot.");
2767 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2769 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2771 note = _("はひどい痛手をうけた。", " is hit hard.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2780 case GF_HYPODYNAMIA:
2782 if (seen) obvious = TRUE;
2784 if (r_ptr->flagsr & RFR_RES_ALL)
2786 note = _("には完全な耐性がある!", " is immune.");
2788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2791 if (!monster_living(m_ptr->r_idx))
2793 if (is_original_ap_and_seen(m_ptr))
2795 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2796 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2797 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2799 note = _("には効果がなかった。", " is unaffected.");
2803 else do_time = (dam+7)/8;
2811 if (seen) obvious = TRUE;
2813 if (r_ptr->flagsr & RFR_RES_ALL)
2815 note = _("には完全な耐性がある!", " is immune.");
2817 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2820 if (!monster_living(m_ptr->r_idx))
2822 if (is_original_ap_and_seen(m_ptr))
2824 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2825 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2826 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2828 note = _("には完全な耐性がある!", " is immune.");
2832 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2833 (randint1(888) != 666)) ||
2834 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2835 randint1(100) != 66))
2837 note = _("には耐性がある!", " resists!");
2845 /* Polymorph monster (Use "dam" as "power") */
2848 if (seen) obvious = TRUE;
2850 if (r_ptr->flagsr & RFR_RES_ALL)
2852 note = _("には効果がなかった。", " is unaffected.");
2854 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2857 /* Attempt to polymorph (see below) */
2860 /* Powerful monsters can resist */
2861 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2862 (r_ptr->flags1 & RF1_QUESTOR) ||
2863 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2865 note = _("には効果がなかった。", " is unaffected.");
2870 /* No "real" damage */
2877 /* Clone monsters (Ignore "dam") */
2880 if (seen) obvious = TRUE;
2882 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2884 note = _("には効果がなかった。", " is unaffected.");
2889 m_ptr->hp = m_ptr->maxhp;
2891 /* Attempt to clone. */
2892 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2894 note = _("が分裂した!", " spawns!");
2898 /* No "real" damage */
2905 /* Heal Monster (use "dam" as amount of healing) */
2908 if (seen) obvious = TRUE;
2911 (void)set_monster_csleep(c_ptr->m_idx, 0);
2913 if (m_ptr->maxhp < m_ptr->max_maxhp)
2915 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2916 m_ptr->maxhp = m_ptr->max_maxhp;
2921 /* Redraw (later) if needed */
2922 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2923 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2931 if (seen) obvious = TRUE;
2934 (void)set_monster_csleep(c_ptr->m_idx, 0);
2935 if (MON_STUNNED(m_ptr))
2937 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2938 (void)set_monster_stunned(c_ptr->m_idx, 0);
2940 if (MON_CONFUSED(m_ptr))
2942 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2943 (void)set_monster_confused(c_ptr->m_idx, 0);
2945 if (MON_MONFEAR(m_ptr))
2947 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2948 (void)set_monster_monfear(c_ptr->m_idx, 0);
2952 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2955 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2959 chg_virtue(V_VITALITY, 1);
2961 if (r_ptr->flags1 & RF1_UNIQUE)
2962 chg_virtue(V_INDIVIDUALISM, 1);
2964 if (is_friendly(m_ptr))
2965 chg_virtue(V_HONOUR, 1);
2966 else if (!(r_ptr->flags3 & RF3_EVIL))
2968 if (r_ptr->flags3 & RF3_GOOD)
2969 chg_virtue(V_COMPASSION, 2);
2971 chg_virtue(V_COMPASSION, 1);
2974 if (r_ptr->flags3 & RF3_ANIMAL)
2975 chg_virtue(V_NATURE, 1);
2978 if (m_ptr->r_idx == MON_LEPER)
2981 if (!who) chg_virtue(V_COMPASSION, 5);
2984 /* Redraw (later) if needed */
2985 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2986 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2988 note = _("は体力を回復したようだ。", " looks healthier.");
2990 /* No "real" damage */
2996 /* Speed Monster (Ignore "dam") */
2999 if (seen) obvious = TRUE;
3002 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3004 note = _("の動きが速くなった。", " starts moving faster.");
3009 if (r_ptr->flags1 & RF1_UNIQUE)
3010 chg_virtue(V_INDIVIDUALISM, 1);
3011 if (is_friendly(m_ptr))
3012 chg_virtue(V_HONOUR, 1);
3015 /* No "real" damage */
3021 /* Slow Monster (Use "dam" as "power") */
3024 if (seen) obvious = TRUE;
3026 if (r_ptr->flagsr & RFR_RES_ALL)
3028 note = _("には効果がなかった。", " is unaffected.");
3030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3033 /* Powerful monsters can resist */
3034 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3035 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3037 note = _("には効果がなかった。", " is unaffected.");
3041 /* Normal monsters slow down */
3044 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3046 note = _("の動きが遅くなった。", " starts moving slower.");
3050 /* No "real" damage */
3056 /* Sleep (Use "dam" as "power") */
3059 if (seen) obvious = TRUE;
3061 if (r_ptr->flagsr & RFR_RES_ALL)
3063 note = _("には効果がなかった。", " is unaffected.");
3065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3068 /* Attempt a saving throw */
3069 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3070 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3071 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3073 /* Memorize a flag */
3074 if (r_ptr->flags3 & RF3_NO_SLEEP)
3076 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3078 /* No obvious effect */
3079 note = _("には効果がなかった。", " is unaffected.");
3084 /* Go to sleep (much) later */
3085 note = _("は眠り込んでしまった!", " falls asleep!");
3089 /* No "real" damage */
3095 /* Sleep (Use "dam" as "power") */
3096 case GF_STASIS_EVIL:
3098 if (seen) obvious = TRUE;
3100 if (r_ptr->flagsr & RFR_RES_ALL)
3102 note = _("には効果がなかった!", " is immune.");
3104 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3107 /* Attempt a saving throw */
3108 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3109 !(r_ptr->flags3 & RF3_EVIL) ||
3110 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3112 note = _("には効果がなかった。", " is unaffected.");
3117 /* Go to sleep (much) later */
3118 note = _("は動けなくなった!", " is suspended!");
3122 /* No "real" damage */
3127 /* Sleep (Use "dam" as "power") */
3130 if (seen) obvious = TRUE;
3132 if (r_ptr->flagsr & RFR_RES_ALL)
3134 note = _("には効果がなかった。", " is unaffected.");
3136 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3139 /* Attempt a saving throw */
3140 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3141 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3143 note = _("には効果がなかった。", " is unaffected.");
3148 /* Go to sleep (much) later */
3149 note = _("は動けなくなった!", " is suspended!");
3153 /* No "real" damage */
3162 vir = virtue_number(V_HARMONY);
3165 dam += p_ptr->virtues[vir-1]/10;
3168 vir = virtue_number(V_INDIVIDUALISM);
3171 dam -= p_ptr->virtues[vir-1]/20;
3174 if (seen) obvious = TRUE;
3176 /* Attempt a saving throw */
3177 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3181 /* No obvious effect */
3182 note = _("には効果がなかった。", " is unaffected.");
3185 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3187 else if (p_ptr->cursed & TRC_AGGRAVATE)
3189 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3190 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3194 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3197 chg_virtue(V_INDIVIDUALISM, -1);
3198 if (r_ptr->flags3 & RF3_ANIMAL)
3199 chg_virtue(V_NATURE, 1);
3202 /* No "real" damage */
3207 /* Control undead */
3208 case GF_CONTROL_UNDEAD:
3211 if (seen) obvious = TRUE;
3213 vir = virtue_number(V_UNLIFE);
3216 dam += p_ptr->virtues[vir-1]/10;
3219 vir = virtue_number(V_INDIVIDUALISM);
3222 dam -= p_ptr->virtues[vir-1]/20;
3225 /* Attempt a saving throw */
3226 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3227 !(r_ptr->flags3 & RF3_UNDEAD))
3229 /* No obvious effect */
3230 note = _("には効果がなかった。", " is unaffected.");
3232 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3234 else if (p_ptr->cursed & TRC_AGGRAVATE)
3236 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3237 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3241 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3245 /* No "real" damage */
3251 case GF_CONTROL_DEMON:
3254 if (seen) obvious = TRUE;
3256 vir = virtue_number(V_UNLIFE);
3259 dam += p_ptr->virtues[vir-1]/10;
3262 vir = virtue_number(V_INDIVIDUALISM);
3265 dam -= p_ptr->virtues[vir-1]/20;
3268 /* Attempt a saving throw */
3269 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3270 !(r_ptr->flags3 & RF3_DEMON))
3272 /* No obvious effect */
3273 note = _("には効果がなかった。", " is unaffected.");
3275 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3277 else if (p_ptr->cursed & TRC_AGGRAVATE)
3279 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3280 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3284 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3288 /* No "real" damage */
3294 case GF_CONTROL_ANIMAL:
3297 if (seen) obvious = TRUE;
3299 vir = virtue_number(V_NATURE);
3302 dam += p_ptr->virtues[vir-1]/10;
3305 vir = virtue_number(V_INDIVIDUALISM);
3308 dam -= p_ptr->virtues[vir-1]/20;
3311 /* Attempt a saving throw */
3312 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3313 !(r_ptr->flags3 & RF3_ANIMAL))
3316 /* No obvious effect */
3317 note = _("には効果がなかった。", " is unaffected.");
3319 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3321 else if (p_ptr->cursed & TRC_AGGRAVATE)
3323 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3324 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3328 note = _("はなついた。", " is tamed!");
3330 if (r_ptr->flags3 & RF3_ANIMAL)
3331 chg_virtue(V_NATURE, 1);
3334 /* No "real" damage */
3340 case GF_CHARM_LIVING:
3344 vir = virtue_number(V_UNLIFE);
3345 if (seen) obvious = TRUE;
3347 vir = virtue_number(V_UNLIFE);
3350 dam -= p_ptr->virtues[vir-1]/10;
3353 vir = virtue_number(V_INDIVIDUALISM);
3356 dam -= p_ptr->virtues[vir-1]/20;
3359 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3361 /* Attempt a saving throw */
3362 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3363 !monster_living(m_ptr->r_idx))
3366 /* No obvious effect */
3367 note = _("には効果がなかった。", " is unaffected.");
3369 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3371 else if (p_ptr->cursed & TRC_AGGRAVATE)
3373 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3374 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3378 note = _("を支配した。", " is tamed!");
3380 if (r_ptr->flags3 & RF3_ANIMAL)
3381 chg_virtue(V_NATURE, 1);
3384 /* No "real" damage */
3389 /* Confusion (Use "dam" as "power") */
3392 if (seen) obvious = TRUE;
3394 if (r_ptr->flagsr & RFR_RES_ALL)
3396 note = _("には効果がなかった。", " is unaffected.");
3398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3401 /* Get confused later */
3402 do_conf = damroll(3, (dam / 2)) + 1;
3404 /* Attempt a saving throw */
3405 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3406 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3407 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3409 /* Memorize a flag */
3410 if (r_ptr->flags3 & (RF3_NO_CONF))
3412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3418 /* No obvious effect */
3419 note = _("には効果がなかった。", " is unaffected.");
3423 /* No "real" damage */
3430 if (seen) obvious = TRUE;
3432 if (r_ptr->flagsr & RFR_RES_ALL)
3434 note = _("には効果がなかった。", " is unaffected.");
3436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3439 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3441 /* Attempt a saving throw */
3442 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3443 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3448 /* No obvious effect */
3449 note = _("には効果がなかった。", " is unaffected.");
3453 /* No "real" damage */
3461 /* Lite, but only hurts susceptible creatures */
3469 if (r_ptr->flagsr & RFR_RES_ALL)
3475 if (r_ptr->flags3 & (RF3_HURT_LITE))
3477 /* Obvious effect */
3478 if (seen) obvious = TRUE;
3480 /* Memorize the effects */
3481 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3483 /* Special effect */
3484 note = _("は光に身をすくめた!", " cringes from the light!");
3485 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3488 /* Normally no damage */
3500 /* Lite -- opposite of Dark */
3503 if (seen) obvious = TRUE;
3505 if (r_ptr->flagsr & RFR_RES_ALL)
3507 note = _("には完全な耐性がある!", " is immune.");
3509 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3512 if (r_ptr->flagsr & RFR_RES_LITE)
3514 note = _("には耐性がある!", " resists!");
3515 dam *= 2; dam /= (randint1(6)+6);
3516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3518 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3520 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3521 note = _("は光に身をすくめた!", " cringes from the light!");
3522 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3529 /* Dark -- opposite of Lite */
3532 if (seen) obvious = TRUE;
3534 if (r_ptr->flagsr & RFR_RES_ALL)
3536 note = _("には完全な耐性がある!", " is immune.");
3538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3541 if (r_ptr->flagsr & RFR_RES_DARK)
3543 note = _("には耐性がある!", " resists!");
3544 dam *= 2; dam /= (randint1(6)+6);
3545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3554 if (r_ptr->flagsr & RFR_RES_ALL)
3559 /* Hurt by rock remover */
3560 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3563 if (seen) obvious = TRUE;
3565 /* Memorize the effects */
3566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3568 /* Cute little message */
3569 note = _("の皮膚がただれた!", " loses some skin!");
3570 note_dies = _("はドロドロに溶けた!", " dissolves!");
3573 /* Usually, ignore the effects */
3584 /* Teleport undead (Use "dam" as "power") */
3585 case GF_AWAY_UNDEAD:
3587 /* Only affect undead */
3588 if (r_ptr->flags3 & (RF3_UNDEAD))
3590 bool resists_tele = FALSE;
3592 if (r_ptr->flagsr & RFR_RES_TELE)
3594 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3596 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3597 note = _("には効果がなかった。", " is unaffected.");
3598 resists_tele = TRUE;
3600 else if (r_ptr->level > randint1(100))
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3603 note = _("には耐性がある!", " resists!");
3604 resists_tele = TRUE;
3610 if (seen) obvious = TRUE;
3611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3623 /* No "real" damage */
3629 /* Teleport evil (Use "dam" as "power") */
3632 /* Only affect evil */
3633 if (r_ptr->flags3 & (RF3_EVIL))
3635 bool resists_tele = FALSE;
3637 if (r_ptr->flagsr & RFR_RES_TELE)
3639 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3642 note = _("には効果がなかった。", " is unaffected.");
3643 resists_tele = TRUE;
3645 else if (r_ptr->level > randint1(100))
3647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3648 note = _("には耐性がある!", " resists!");
3649 resists_tele = TRUE;
3655 if (seen) obvious = TRUE;
3656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3668 /* No "real" damage */
3674 /* Teleport monster (Use "dam" as "power") */
3677 bool resists_tele = FALSE;
3678 if (r_ptr->flagsr & RFR_RES_TELE)
3680 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3683 note = _("には効果がなかった。", " is unaffected.");
3684 resists_tele = TRUE;
3686 else if (r_ptr->level > randint1(100))
3688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3689 note = _("には耐性がある!", " resists!");
3690 resists_tele = TRUE;
3696 if (seen) obvious = TRUE;
3698 /* Prepare to teleport */
3702 /* No "real" damage */
3708 /* Turn undead (Use "dam" as "power") */
3709 case GF_TURN_UNDEAD:
3711 if (r_ptr->flagsr & RFR_RES_ALL)
3716 /* Only affect undead */
3717 if (r_ptr->flags3 & (RF3_UNDEAD))
3719 if (seen) obvious = TRUE;
3721 /* Learn about type */
3722 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3724 /* Apply some fear */
3725 do_fear = damroll(3, (dam / 2)) + 1;
3727 /* Attempt a saving throw */
3728 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3730 /* No obvious effect */
3731 note = _("には効果がなかった。", " is unaffected.");
3744 /* No "real" damage */
3750 /* Turn evil (Use "dam" as "power") */
3753 if (r_ptr->flagsr & RFR_RES_ALL)
3758 /* Only affect evil */
3759 if (r_ptr->flags3 & (RF3_EVIL))
3761 if (seen) obvious = TRUE;
3763 /* Learn about type */
3764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3766 /* Apply some fear */
3767 do_fear = damroll(3, (dam / 2)) + 1;
3769 /* Attempt a saving throw */
3770 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3772 /* No obvious effect */
3773 note = _("には効果がなかった。", " is unaffected.");
3786 /* No "real" damage */
3792 /* Turn monster (Use "dam" as "power") */
3795 if (r_ptr->flagsr & RFR_RES_ALL)
3800 if (seen) obvious = TRUE;
3802 /* Apply some fear */
3803 do_fear = damroll(3, (dam / 2)) + 1;
3805 /* Attempt a saving throw */
3806 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3807 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3808 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3810 /* No obvious effect */
3811 note = _("には効果がなかった。", " is unaffected.");
3816 /* No "real" damage */
3823 case GF_DISP_UNDEAD:
3825 if (r_ptr->flagsr & RFR_RES_ALL)
3831 /* Only affect undead */
3832 if (r_ptr->flags3 & (RF3_UNDEAD))
3834 if (seen) obvious = TRUE;
3836 /* Learn about type */
3837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3839 note = _("は身震いした。", " shudders.");
3840 note_dies = _("はドロドロに溶けた!", " dissolves!");
3860 if (r_ptr->flagsr & RFR_RES_ALL)
3866 /* Only affect evil */
3867 if (r_ptr->flags3 & (RF3_EVIL))
3869 if (seen) obvious = TRUE;
3871 /* Learn about type */
3872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3874 note = _("は身震いした。", " shudders.");
3875 note_dies = _("はドロドロに溶けた!", " dissolves!");
3894 if (r_ptr->flagsr & RFR_RES_ALL)
3900 /* Only affect good */
3901 if (r_ptr->flags3 & (RF3_GOOD))
3903 if (seen) obvious = TRUE;
3905 /* Learn about type */
3906 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3908 note = _("は身震いした。", " shudders.");
3909 note_dies = _("はドロドロに溶けた!", " dissolves!");
3926 case GF_DISP_LIVING:
3928 if (r_ptr->flagsr & RFR_RES_ALL)
3934 /* Only affect non-undead */
3935 if (monster_living(m_ptr->r_idx))
3937 if (seen) obvious = TRUE;
3939 note = _("は身震いした。", " shudders.");
3940 note_dies = _("はドロドロに溶けた!", " dissolves!");
3959 if (r_ptr->flagsr & RFR_RES_ALL)
3965 /* Only affect demons */
3966 if (r_ptr->flags3 & (RF3_DEMON))
3968 if (seen) obvious = TRUE;
3970 /* Learn about type */
3971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3973 note = _("は身震いした。", " shudders.");
3974 note_dies = _("はドロドロに溶けた!", " dissolves!");
3990 /* Dispel monster */
3993 if (r_ptr->flagsr & RFR_RES_ALL)
3999 if (seen) obvious = TRUE;
4001 note = _("は身震いした。", " shudders.");
4002 note_dies = _("はドロドロに溶けた!", " dissolves!");
4009 if (seen) obvious = TRUE;
4011 if (r_ptr->flagsr & RFR_RES_ALL)
4013 note = _("には完全な耐性がある!", " is immune.");
4015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4019 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4023 /* Heal the monster */
4024 if (caster_ptr->hp < caster_ptr->maxhp)
4027 caster_ptr->hp += dam;
4028 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4030 /* Redraw (later) if needed */
4031 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4032 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4034 /* Special message */
4037 monster_desc(killer, caster_ptr, 0);
4038 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4044 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4045 (void)hp_player(dam);
4050 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4059 if (seen) obvious = TRUE;
4060 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4062 if (r_ptr->flagsr & RFR_RES_ALL)
4064 note = _("には完全な耐性がある!", " is immune.");
4066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4070 /* Attempt a saving throw */
4071 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4072 (r_ptr->flags3 & RF3_NO_CONF) ||
4073 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4075 /* Memorize a flag */
4076 if (r_ptr->flags3 & (RF3_NO_CONF))
4078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4080 note = _("には効果がなかった。", " is unaffected.");
4083 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4086 note = _("には完全な耐性がある!", " is immune.");
4089 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4092 note = _("には耐性がある。", " resists.");
4097 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4098 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4100 if (who > 0) do_conf = randint0(4) + 4;
4101 else do_conf = randint0(8) + 8;
4107 case GF_BRAIN_SMASH:
4109 if (seen) obvious = TRUE;
4110 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4112 if (r_ptr->flagsr & RFR_RES_ALL)
4114 note = _("には完全な耐性がある!", " is immune.");
4116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4120 /* Attempt a saving throw */
4121 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4122 (r_ptr->flags3 & RF3_NO_CONF) ||
4123 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4125 /* Memorize a flag */
4126 if (r_ptr->flags3 & (RF3_NO_CONF))
4128 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4130 note = _("には効果がなかった。", " is unaffected.");
4133 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4136 note = _("には完全な耐性がある!", " is immune.");
4139 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4142 note = _("には耐性がある!", " resists!");
4147 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4148 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4152 do_conf = randint0(4) + 4;
4153 do_stun = randint0(4) + 4;
4157 do_conf = randint0(8) + 8;
4158 do_stun = randint0(8) + 8;
4160 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4168 if (seen) obvious = TRUE;
4169 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4171 if (r_ptr->flagsr & RFR_RES_ALL)
4173 note = _("には完全な耐性がある!", " is immune.");
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4179 /* Attempt a saving throw */
4180 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4182 note = _("には効果がなかった。", " is unaffected.");
4191 if (seen) obvious = TRUE;
4192 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4194 if (r_ptr->flagsr & RFR_RES_ALL)
4196 note = _("には完全な耐性がある!", " is immune.");
4198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4202 /* Attempt a saving throw */
4203 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4205 note = _("には効果がなかった。", " is unaffected.");
4214 if (seen) obvious = TRUE;
4215 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4217 if (r_ptr->flagsr & RFR_RES_ALL)
4219 note = _("には完全な耐性がある!", " is immune.");
4221 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4225 /* Attempt a saving throw */
4226 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4228 note = _("には効果がなかった。", " is unaffected.");
4237 if (seen) obvious = TRUE;
4239 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4240 "You point at %s, screaming the word, 'DIE!'."), m_name);
4242 if (r_ptr->flagsr & RFR_RES_ALL)
4244 note = _("には完全な耐性がある!", " is immune.");
4246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4250 /* Attempt a saving throw */
4251 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4253 note = _("には効果がなかった。", " is unaffected.");
4262 if (seen) obvious = TRUE;
4264 if (r_ptr->flagsr & RFR_RES_ALL)
4266 note = _("には完全な耐性がある!", " is immune.");
4268 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4272 if (r_ptr->flags1 & RF1_UNIQUE)
4274 note = _("には効果がなかった。", " is unaffected.");
4279 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4280 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4282 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4284 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4288 note = _("は耐性を持っている!", "resists!");
4295 /* Capture monster */
4299 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4300 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
4302 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4307 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4308 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4309 nokori_hp = m_ptr->maxhp * 3 / 10;
4311 nokori_hp = m_ptr->maxhp * 3 / 20;
4313 if (m_ptr->hp >= nokori_hp)
4315 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4318 else if (m_ptr->hp < randint0(nokori_hp))
4320 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4321 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4322 cap_mon = m_ptr->r_idx;
4323 cap_mspeed = m_ptr->mspeed;
4325 cap_maxhp = m_ptr->max_maxhp;
4326 cap_nickname = m_ptr->nickname; /* Quark transfer */
4327 if (c_ptr->m_idx == p_ptr->riding)
4329 if (rakuba(-1, FALSE))
4331 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4335 delete_monster_idx(c_ptr->m_idx);
4341 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4347 /* Attack (Use "dam" as attack type) */
4350 /* Return this monster's death */
4351 return py_attack(y, x, dam);
4354 /* Sleep (Use "dam" as "power") */
4360 if (seen) obvious = TRUE;
4362 if (r_ptr->flagsr & RFR_RES_ALL)
4364 note = _("には効果がなかった。", " is unaffected.");
4366 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4369 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4371 note = _("には効果がなかった。", " is unaffected.");
4374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4377 if (MON_CSLEEP(m_ptr))
4379 note = _("には効果がなかった。", " is unaffected.");
4385 if (one_in_(5)) effect = 1;
4386 else if (one_in_(4)) effect = 2;
4387 else if (one_in_(3)) effect = 3;
4392 /* Powerful monsters can resist */
4393 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4394 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4396 note = _("には効果がなかった。", " is unaffected.");
4400 /* Normal monsters slow down */
4403 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4405 note = _("の動きが遅くなった。", " starts moving slower.");
4410 else if (effect == 2)
4412 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4414 /* Attempt a saving throw */
4415 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4416 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4421 /* No obvious effect */
4422 note = _("には効果がなかった。", " is unaffected.");
4427 else if (effect == 3)
4429 /* Attempt a saving throw */
4430 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4431 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4434 /* Memorize a flag */
4435 if (r_ptr->flags3 & RF3_NO_SLEEP)
4437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4440 /* No obvious effect */
4441 note = _("には効果がなかった。", " is unaffected.");
4446 /* Go to sleep (much) later */
4447 note = _("は眠り込んでしまった!", " falls asleep!");
4454 note = _("には効果がなかった。", " is unaffected.");
4457 /* No "real" damage */
4465 if (seen) obvious = TRUE;
4467 if (r_ptr->flagsr & RFR_RES_ALL)
4469 note = _("には効果がなかった。", " is unaffected.");
4471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4475 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4477 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4478 chg_virtue(V_VITALITY, -1);
4488 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4490 if (r_ptr->flags3 & (RF3_HURT_LITE))
4492 /* Obvious effect */
4493 if (seen) obvious = TRUE;
4495 /* Memorize the effects */
4496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4498 /* Special effect */
4499 note = _("は光に身をすくめた!", " cringes from the light!");
4500 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4503 /* Normally no damage */
4510 photo = m_ptr->r_idx;
4517 case GF_BLOOD_CURSE:
4519 if (seen) obvious = TRUE;
4521 if (r_ptr->flagsr & RFR_RES_ALL)
4523 note = _("には完全な耐性がある!", " is immune.");
4525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4533 bool success = FALSE;
4534 if (seen) obvious = TRUE;
4536 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4538 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4539 if (dam < 1) dam = 1;
4541 /* No need to tame your pet */
4544 note = _("の動きが速くなった。", " starts moving faster.");
4545 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4549 /* Attempt a saving throw */
4550 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4551 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4552 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4553 (p_ptr->cursed & TRC_AGGRAVATE) ||
4554 ((r_ptr->level+10) > randint1(dam)))
4557 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4561 note = _("を支配した。", " is tamed!");
4563 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4565 /* Learn about type */
4566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4573 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4575 do_fear = randint1(90)+10;
4577 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4580 /* No "real" damage */
4587 if (seen) obvious = TRUE;
4589 if (r_ptr->flagsr & RFR_RES_ALL)
4591 note = _("には完全な耐性がある!", " is immune.");
4593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4597 /* Attempt a saving throw */
4598 if (randint0(100 + dam) < (r_ptr->level + 50))
4600 note = _("には効果がなかった。", " is unaffected.");
4620 /* Absolutely no effect */
4621 if (skipped) return (FALSE);
4623 /* "Unique" monsters cannot be polymorphed */
4624 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4626 /* Quest monsters cannot be polymorphed */
4627 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4629 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4631 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4632 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4634 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4639 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4640 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4643 /* Modify the damage */
4645 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4646 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4648 /* Check for death */
4649 if (dam > m_ptr->hp)
4651 /* Extract method of death */
4656 /* Sound and Impact resisters never stun */
4658 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4659 !(r_ptr->flags3 & RF3_NO_STUN))
4661 if (seen) obvious = TRUE;
4664 if (MON_STUNNED(m_ptr))
4666 note = _("はひどくもうろうとした。", " is more dazed.");
4667 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4671 note = _("はもうろうとした。", " is dazed.");
4676 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4682 /* Confusion and Chaos resisters (and sleepers) never confuse */
4684 !(r_ptr->flags3 & RF3_NO_CONF) &&
4685 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4687 if (seen) obvious = TRUE;
4689 /* Already partially confused */
4690 if (MON_CONFUSED(m_ptr))
4692 note = _("はさらに混乱したようだ。", " looks more confused.");
4693 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4696 /* Was not confused */
4699 note = _("は混乱したようだ。", " looks confused.");
4703 /* Apply confusion */
4704 (void)set_monster_confused(c_ptr->m_idx, tmp);
4712 if (seen) obvious = TRUE;
4714 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4718 note = _("は弱くなったようだ。", " seems weakened.");
4719 m_ptr->maxhp -= do_time;
4720 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4725 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4726 if (do_poly && (randint1(90) > r_ptr->level))
4728 if (polymorph_monster(y, x))
4730 if (seen) obvious = TRUE;
4732 /* Monster polymorphs */
4733 note = _("が変身した!", " changes!");
4735 /* Turn off the damage */
4741 note = _("には効果がなかった。", " is unaffected.");
4744 /* Hack -- Get new monster */
4745 m_ptr = &m_list[c_ptr->m_idx];
4747 /* Hack -- Get new race */
4748 r_ptr = &r_info[m_ptr->r_idx];
4751 /* Handle "teleport" */
4754 if (seen) obvious = TRUE;
4756 note = _("が消え去った!", " disappears!");
4758 if (!who) chg_virtue(V_VALOUR, -1);
4761 teleport_away(c_ptr->m_idx, do_dist,
4762 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4764 /* Hack -- get new location */
4768 /* Hack -- get new grid */
4769 c_ptr = &cave[y][x];
4776 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4783 if (typ == GF_DRAIN_MANA)
4785 /* Drain mana does nothing */
4788 /* If another monster did the damage, hurt the monster by hand */
4791 /* Redraw (later) if needed */
4792 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4793 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4795 /* Wake the monster up */
4796 (void)set_monster_csleep(c_ptr->m_idx, 0);
4798 /* Hurt the monster */
4806 if (is_pet(m_ptr) && !(m_ptr->ml))
4809 /* Give detailed messages if destroyed */
4812 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4815 msg_format("%^s%s", m_name, note);
4823 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4825 /* Generate treasure, etc */
4826 monster_death(c_ptr->m_idx, FALSE);
4829 delete_monster_idx(c_ptr->m_idx);
4833 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4837 /* Damaged monster */
4840 /* Give detailed messages if visible or destroyed */
4841 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4843 /* Hack -- Pain message */
4846 message_pain(c_ptr->m_idx, dam);
4853 /* Hack -- handle sleep */
4854 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4858 else if (heal_leper)
4860 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4862 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4864 char m2_name[MAX_NLEN];
4866 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4867 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4870 delete_monster_idx(c_ptr->m_idx);
4873 /* If the player did it, give him experience, check fear */
4878 /* Hurt the monster, check for fear and death */
4879 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4884 /* Damaged monster */
4887 /* HACK - anger the monster before showing the sleep message */
4888 if (do_sleep) anger_monster(m_ptr);
4890 /* Give detailed messages if visible or destroyed */
4891 if (note && seen_msg)
4892 msg_format(_("%s%s", "%^s%s"), m_name, note);
4894 /* Hack -- Pain message */
4895 else if (known && (dam || !do_fear))
4897 message_pain(c_ptr->m_idx, dam);
4900 /* Anger monsters */
4901 if (((dam > 0) || get_angry) && !do_sleep)
4902 anger_monster(m_ptr);
4904 if ((fear || do_fear) && seen)
4907 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4910 /* Hack -- handle sleep */
4911 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4915 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4917 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4921 switch (randint1(28))
4926 msg_print(_("地面が揺れた...", "The ground trembles..."));
4927 earthquake(ty, tx, 4 + randint0(4));
4928 if (!one_in_(6)) break;
4930 case 3: case 4: case 5: case 6:
4933 int extra_dam = damroll(10, 10);
4934 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4936 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4937 if (!one_in_(6)) break;
4942 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4944 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4945 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4946 if (!one_in_(6)) break;
4948 case 9: case 10: case 11:
4949 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4950 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4951 if (!one_in_(6)) break;
4952 case 12: case 13: case 14: case 15: case 16:
4953 aggravate_monsters(0);
4954 if (!one_in_(6)) break;
4956 count += activate_hi_summon(ty, tx, TRUE);
4957 if (!one_in_(6)) break;
4958 case 19: case 20: case 21: case 22:
4960 bool pet = !one_in_(3);
4961 BIT_FLAGS mode = PM_ALLOW_GROUP;
4963 if (pet) mode |= PM_FORCE_PET;
4964 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4966 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');
4967 if (!one_in_(6)) break;
4969 case 23: case 24: case 25:
4970 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4971 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4973 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4974 else lose_exp(p_ptr->exp / 16);
4975 if (!one_in_(6)) break;
4976 case 26: case 27: case 28:
4985 (void)do_dec_stat(i);
4994 (void)do_dec_stat(randint0(6));
5003 if (p_ptr->inside_battle)
5005 p_ptr->health_who = c_ptr->m_idx;
5006 p_ptr->redraw |= (PR_HEALTH);
5010 /* Verify this code */
5011 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5013 /* Redraw the monster grid */
5017 /* Update monster recall window */
5018 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5020 p_ptr->window |= (PW_MONSTER);
5023 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5027 if (!(flg & PROJECT_NO_HANGEKI))
5029 set_target(m_ptr, monster_target_y, monster_target_x);
5032 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5034 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5038 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5040 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5041 rakubadam_m = (dam > 200) ? 200 : dam;
5051 /* Prepare to make a Blade of Chaos */
5052 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5054 q_ptr->pval = photo;
5056 /* Mark the item as fully known */
5057 q_ptr->ident |= (IDENT_MENTAL);
5058 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5066 /* Return "Anything seen?" */
5071 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5072 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5073 * @param who_name 効果を起こしたモンスターの名前
5074 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5075 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5076 * @param x 目標X座標 / Target x location (or location to travel "towards")
5077 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5078 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5080 * @param monspell 効果元のモンスター魔法ID
5081 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5083 * Handle a beam/bolt/ball causing damage to the player.
5084 * This routine takes a "source monster" (by index), a "distance", a default
5085 * "damage", and a "damage type". See "project_m()" above.
5086 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5087 * is reduced (see "project_m()" above). This can happen if a monster breathes
5088 * at the player and hits a wall instead.
5089 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5090 * to know if this is actually a ball or a bolt spell
5091 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5092 * we just assume that the effects were obvious, for historical reasons.
5094 static bool project_p(MONSTER_IDX who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5099 /* Hack -- assume obvious */
5100 bool obvious = TRUE;
5102 /* Player blind-ness */
5103 bool blind = (p_ptr->blind ? TRUE : FALSE);
5105 /* Player needs a "description" (he is blind) */
5108 /* Source monster */
5109 monster_type *m_ptr = NULL;
5111 /* Monster name (for attacks) */
5112 GAME_TEXT m_name[MAX_NLEN];
5114 /* Monster name (for damage) */
5117 /* Hack -- messages */
5123 /* Player is not here */
5124 if (!player_bold(y, x)) return (FALSE);
5126 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5128 if (kawarimi(TRUE)) return FALSE;
5131 /* Player cannot hurt himself */
5132 if (!who) return (FALSE);
5133 if (who == p_ptr->riding) return (FALSE);
5135 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5138 int max_attempts = 10;
5139 sound(SOUND_REFLECT);
5142 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5143 else if (p_ptr->special_defense & KATA_FUUJIN)
5144 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5146 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5149 /* Choose 'new' target */
5154 t_y = m_list[who].fy - 1 + randint1(3);
5155 t_x = m_list[who].fx - 1 + randint1(3);
5158 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5160 if (max_attempts < 1)
5162 t_y = m_list[who].fy;
5163 t_x = m_list[who].fx;
5168 t_y = p_ptr->y - 1 + randint1(3);
5169 t_x = p_ptr->x - 1 + randint1(3);
5172 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5174 disturb(TRUE, TRUE);
5178 /* Limit maximum damage */
5179 if (dam > 1600) dam = 1600;
5181 /* Reduce damage by distance */
5182 dam = (dam + r) / (r + 1);
5185 /* If the player is blind, be more descriptive */
5186 if (blind) fuzzy = TRUE;
5191 m_ptr = &m_list[who];
5192 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5193 monster_desc(m_name, m_ptr, 0);
5195 /* Get the monster's real name (gotten before polymorph!) */
5196 strcpy(killer, who_name);
5202 case PROJECT_WHO_UNCTRL_POWER:
5203 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5206 case PROJECT_WHO_GLASS_SHARDS:
5207 strcpy(killer, _("ガラスの破片", "shards of glass"));
5211 strcpy(killer, _("罠", "a trap"));
5216 strcpy(m_name, killer);
5219 /* Analyze the damage */
5222 /* Standard damage -- hurts inventory too */
5225 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5226 get_damage = acid_dam(dam, killer, monspell, FALSE);
5230 /* Standard damage -- hurts inventory too */
5233 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5234 get_damage = fire_dam(dam, killer, monspell, FALSE);
5238 /* Standard damage -- hurts inventory too */
5241 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5242 get_damage = cold_dam(dam, killer, monspell, FALSE);
5246 /* Standard damage -- hurts inventory too */
5249 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5250 get_damage = elec_dam(dam, killer, monspell, FALSE);
5254 /* Standard damage -- also poisons player */
5257 bool double_resist = IS_OPPOSE_POIS();
5258 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5260 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5261 if (double_resist) dam = (dam + 2) / 3;
5263 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5268 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5270 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5272 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5277 /* Standard damage -- also poisons / mutates player */
5280 bool double_resist = IS_OPPOSE_POIS();
5281 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5283 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5284 if (double_resist) dam = (2 * dam + 2) / 5;
5285 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5286 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5288 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5290 if (one_in_(5)) /* 6 */
5292 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5293 if (one_in_(4)) /* 4 */
5301 inven_damage(set_acid_destroy, 2);
5307 /* Standard damage */
5310 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5311 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5315 /* Holy Orb -- Player only takes partial damage */
5318 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5319 if (p_ptr->align > 10)
5321 else if (p_ptr->align < -10)
5323 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5329 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5330 if (p_ptr->align > 10)
5332 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5336 /* Arrow -- XXX no dodging */
5341 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5343 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5345 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5348 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5352 /* Plasma -- XXX No resist */
5355 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5358 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5360 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5361 (void)set_stun(p_ptr->stun + plus_stun);
5364 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5366 inven_damage(set_acid_destroy, 3);
5372 /* Nether -- drain experience */
5375 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5376 if (p_ptr->resist_neth)
5378 if (!prace_is_(RACE_SPECTRE))
5380 dam *= 6; dam /= (randint1(4) + 7);
5383 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5385 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5387 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5389 learn_spell(monspell);
5393 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5399 /* Water -- stun/confuse */
5402 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5403 if (!CHECK_MULTISHADOW())
5405 if (!p_ptr->resist_sound)
5407 set_stun(p_ptr->stun + randint1(40));
5409 if (!p_ptr->resist_conf)
5411 set_confused(p_ptr->confused + randint1(5) + 5);
5416 inven_damage(set_cold_destroy, 3);
5420 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5424 /* Chaos -- many effects */
5427 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5428 if (p_ptr->resist_chaos)
5430 dam *= 6; dam /= (randint1(4) + 7);
5433 if (!CHECK_MULTISHADOW())
5435 if (!p_ptr->resist_conf)
5437 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5439 if (!p_ptr->resist_chaos)
5441 (void)set_image(p_ptr->image + randint1(10));
5444 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5445 (void)gain_random_mutation(0);
5448 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5450 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5453 if (!p_ptr->resist_chaos || one_in_(9))
5455 inven_damage(set_elec_destroy, 2);
5456 inven_damage(set_fire_destroy, 2);
5460 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5464 /* Shards -- mostly cutting */
5467 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5468 if (p_ptr->resist_shard)
5470 dam *= 6; dam /= (randint1(4) + 7);
5472 else if (!CHECK_MULTISHADOW())
5474 (void)set_cut(p_ptr->cut + dam);
5477 if (!p_ptr->resist_shard || one_in_(13))
5479 inven_damage(set_cold_destroy, 2);
5482 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5486 /* Sound -- mostly stunning */
5489 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5490 if (p_ptr->resist_sound)
5492 dam *= 5; dam /= (randint1(4) + 7);
5494 else if (!CHECK_MULTISHADOW())
5496 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5497 (void)set_stun(p_ptr->stun + plus_stun);
5500 if (!p_ptr->resist_sound || one_in_(13))
5502 inven_damage(set_cold_destroy, 2);
5505 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5509 /* Pure confusion */
5512 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5513 if (p_ptr->resist_conf)
5515 dam *= 5; dam /= (randint1(4) + 7);
5517 else if (!CHECK_MULTISHADOW())
5519 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5521 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5525 /* Disenchantment -- see above */
5528 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5529 if (p_ptr->resist_disen)
5531 dam *= 6; dam /= (randint1(4) + 7);
5533 else if (!CHECK_MULTISHADOW())
5535 (void)apply_disenchant(0);
5537 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5541 /* Nexus -- see above */
5544 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5545 if (p_ptr->resist_nexus)
5547 dam *= 6; dam /= (randint1(4) + 7);
5549 else if (!CHECK_MULTISHADOW())
5553 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5557 /* Force -- mostly stun */
5560 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5561 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5563 (void)set_stun(p_ptr->stun + randint1(20));
5565 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5570 /* Rocket -- stun, cut */
5573 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5574 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5576 (void)set_stun(p_ptr->stun + randint1(20));
5579 if (p_ptr->resist_shard)
5583 else if (!CHECK_MULTISHADOW())
5585 (void)set_cut(p_ptr->cut + (dam / 2));
5588 if (!p_ptr->resist_shard || one_in_(12))
5590 inven_damage(set_cold_destroy, 3);
5593 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5597 /* Inertia -- slowness */
5600 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5601 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5602 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5606 /* Lite -- blinding */
5609 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5610 if (p_ptr->resist_lite)
5612 dam *= 4; dam /= (randint1(4) + 7);
5614 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5616 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5619 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5621 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5624 else if (prace_is_(RACE_S_FAIRY))
5629 if (p_ptr->wraith_form) dam *= 2;
5630 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5632 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5634 p_ptr->wraith_form = 0;
5635 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5636 "The light forces you out of your incorporeal shadow form."));
5638 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5639 p_ptr->update |= (PU_MONSTERS);
5640 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5646 /* Dark -- blinding */
5649 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5650 if (p_ptr->resist_dark)
5652 dam *= 4; dam /= (randint1(4) + 7);
5654 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5656 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5658 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5660 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5664 /* Time -- bolt fewer effects XXX */
5667 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5668 if (p_ptr->resist_time)
5671 dam /= (randint1(4) + 7);
5672 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5674 else if (!CHECK_MULTISHADOW())
5676 switch (randint1(10))
5678 case 1: case 2: case 3: case 4: case 5:
5680 if (p_ptr->prace == RACE_ANDROID) break;
5681 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5682 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5686 case 6: case 7: case 8: case 9:
5688 switch (randint1(6))
5690 case 1: k = A_STR; act = _("強く", "strong"); break;
5691 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5692 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5693 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5694 case 5: k = A_CON; act = _("健康で", "hale"); break;
5695 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5698 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5699 "You're not as %s as you used to be..."), act);
5701 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5702 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5703 p_ptr->update |= (PU_BONUS);
5709 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5710 "You're not as powerful as you used to be..."));
5712 for (k = 0; k < A_MAX; k++)
5714 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5715 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5717 p_ptr->update |= (PU_BONUS);
5723 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5727 /* Gravity -- stun plus slowness plus teleport */
5730 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5731 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5733 if (!CHECK_MULTISHADOW())
5735 teleport_player(5, TELEPORT_PASSIVE);
5736 if (!p_ptr->levitation)
5737 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5738 if (!(p_ptr->resist_sound || p_ptr->levitation))
5740 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5741 (void)set_stun(p_ptr->stun + plus_stun);
5744 if (p_ptr->levitation)
5746 dam = (dam * 2) / 3;
5749 if (!p_ptr->levitation || one_in_(13))
5751 inven_damage(set_cold_destroy, 2);
5754 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5758 /* Standard damage */
5759 case GF_DISINTEGRATE:
5761 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5763 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5769 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5771 (void)hp_player(dam);
5778 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5779 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5786 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5787 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5793 if (p_ptr->free_act) break;
5794 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5796 if (ironman_nightmare)
5798 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5799 /* Have some nightmares */
5800 sanity_blast(NULL, FALSE);
5803 set_paralyzed(p_ptr->paralyzed + dam);
5813 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5814 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5821 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5822 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5829 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5831 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5832 if (!p_ptr->resist_shard || one_in_(13))
5834 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5835 inven_damage(set_cold_destroy, 2);
5841 /* Ice -- cold plus stun plus cuts */
5844 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5845 get_damage = cold_dam(dam, killer, monspell, FALSE);
5846 if (!CHECK_MULTISHADOW())
5848 if (!p_ptr->resist_shard)
5850 (void)set_cut(p_ptr->cut + damroll(5, 8));
5852 if (!p_ptr->resist_sound)
5854 (void)set_stun(p_ptr->stun + randint1(15));
5857 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5859 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5869 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5871 if (p_ptr->mimic_form)
5873 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5874 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5879 switch (p_ptr->prace)
5881 /* Some races are immune */
5895 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5907 if (CHECK_MULTISHADOW())
5909 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5911 else if (p_ptr->csp)
5915 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5917 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5920 if (dam >= p_ptr->csp)
5924 p_ptr->csp_frac = 0;
5933 learn_spell(monspell);
5934 p_ptr->redraw |= (PR_MANA);
5935 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5939 /* Heal the monster */
5940 if (m_ptr->hp < m_ptr->maxhp)
5944 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5946 /* Redraw (later) if needed */
5947 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5948 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5950 /* Special message */
5953 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5966 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5968 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5969 learn_spell(monspell);
5973 if (!CHECK_MULTISHADOW())
5975 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5977 if (!p_ptr->resist_conf)
5979 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5982 if (!p_ptr->resist_chaos && one_in_(3))
5984 (void)set_image(p_ptr->image + randint0(250) + 150);
5991 p_ptr->csp_frac = 0;
5993 p_ptr->redraw |= PR_MANA;
5996 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6002 case GF_BRAIN_SMASH:
6004 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6006 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6007 learn_spell(monspell);
6011 if (!CHECK_MULTISHADOW())
6013 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6019 p_ptr->csp_frac = 0;
6021 p_ptr->redraw |= PR_MANA;
6024 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6025 if (!CHECK_MULTISHADOW())
6027 if (!p_ptr->resist_blind)
6029 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6031 if (!p_ptr->resist_conf)
6033 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6035 if (!p_ptr->free_act)
6037 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6039 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6041 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6042 (void)do_dec_stat(A_INT);
6043 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6044 (void)do_dec_stat(A_WIS);
6046 if (!p_ptr->resist_chaos)
6048 (void)set_image(p_ptr->image + randint0(250) + 150);
6058 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6060 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6061 learn_spell(monspell);
6065 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6066 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6074 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6076 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6077 learn_spell(monspell);
6081 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6082 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6090 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6092 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6093 learn_spell(monspell);
6097 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6098 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6106 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6108 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6109 learn_spell(monspell);
6113 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6114 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6122 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6124 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6125 learn_spell(monspell);
6129 if (!CHECK_MULTISHADOW())
6131 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6132 curse_equipment(40, 20);
6135 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6137 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6152 /* Hex - revenge damage stored */
6153 revenge_store(get_damage);
6155 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6156 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6158 GAME_TEXT m_name_self[80];
6161 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6163 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6164 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6165 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6168 if (p_ptr->riding && dam > 0)
6170 rakubadam_p = (dam > 200) ? 200 : dam;
6174 disturb(TRUE, TRUE);
6177 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6179 (void)kawarimi(FALSE);
6182 /* Return "Anything seen?" */
6188 * Find the distance from (x, y) to a line.
6190 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6192 /* Vector from (x, y) to (x1, y1) */
6193 POSITION py = y1 - y;
6194 POSITION px = x1 - x;
6197 POSITION ny = x2 - x1;
6198 POSITION nx = y1 - y2;
6201 POSITION pd = distance(y1, x1, y, x);
6202 POSITION nd = distance(y1, x1, y2, x2);
6204 if (pd > nd) return distance(y, x, y2, x2);
6206 /* Component of P on N */
6207 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6209 /* Absolute value */
6210 return((nd >= 0) ? nd : 0 - nd);
6217 * Modified version of los() for calculation of disintegration balls.
6218 * Disintegration effects are stopped by permanent walls.
6220 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6222 POSITION dx, dy; /* Delta */
6223 POSITION ax, ay; /* Absolute */
6224 POSITION sx, sy; /* Signs */
6225 POSITION qx, qy; /* Fractions */
6226 POSITION tx, ty; /* Scanners */
6227 POSITION f1, f2; /* Scale factors */
6228 POSITION m; /* Slope, or 1/Slope, of LOS */
6230 /* Extract the offset */
6234 /* Extract the absolute offset */
6238 /* Handle adjacent (or identical) grids */
6239 if ((ax < 2) && (ay < 2)) return (TRUE);
6241 /* Paranoia -- require "safe" origin */
6242 /* if (!in_bounds(y1, x1)) return (FALSE); */
6244 /* Directly South/North */
6247 /* South -- check for walls */
6250 for (ty = y1 + 1; ty < y2; ty++)
6252 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6256 /* North -- check for walls */
6259 for (ty = y1 - 1; ty > y2; ty--)
6261 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6269 /* Directly East/West */
6272 /* East -- check for walls */
6275 for (tx = x1 + 1; tx < x2; tx++)
6277 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6281 /* West -- check for walls */
6284 for (tx = x1 - 1; tx > x2; tx--)
6286 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6294 /* Extract some signs */
6295 sx = (dx < 0) ? -1 : 1;
6296 sy = (dy < 0) ? -1 : 1;
6298 /* Vertical "knights" */
6303 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6307 /* Horizontal "knights" */
6312 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6316 /* Calculate scale factor div 2 */
6319 /* Calculate scale factor */
6323 /* Travel horizontally */
6326 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6332 /* Consider the special case where slope == 1. */
6343 /* Note (below) the case (qy == f2), where */
6344 /* the LOS exactly meets the corner of a tile. */
6347 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6358 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6371 /* Travel vertically */
6374 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6390 /* Note (below) the case (qx == f2), where */
6391 /* the LOS exactly meets the corner of a tile. */
6394 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6405 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6426 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)
6431 int brev = rad * rad / dist;
6435 int mdis = distance(y1, x1, y2, x2) + rad;
6437 while (bdis <= mdis)
6441 if ((0 < dist) && (path_n < dist))
6443 POSITION ny = GRID_Y(path_g[path_n]);
6444 POSITION nx = GRID_X(path_g[path_n]);
6445 POSITION nd = distance(ny, nx, y1, x1);
6447 /* Get next base point */
6456 /* Travel from center outward */
6457 for (cdis = 0; cdis <= brad; cdis++)
6459 /* Scan the maximal blast area of radius "cdis" */
6460 for (y = by - cdis; y <= by + cdis; y++)
6462 for (x = bx - cdis; x <= bx + cdis; x++)
6464 /* Ignore "illegal" locations */
6465 if (!in_bounds(y, x)) continue;
6467 /* Enforce a circular "ripple" */
6468 if (distance(y1, x1, y, x) != bdis) continue;
6470 /* Enforce an arc */
6471 if (distance(by, bx, y, x) != cdis) continue;
6477 /* Lights are stopped by opaque terrains */
6478 if (!los(by, bx, y, x)) continue;
6480 case GF_DISINTEGRATE:
6481 /* Disintegration are stopped only by perma-walls */
6482 if (!in_disintegration_range(by, bx, y, x)) continue;
6485 /* Ball explosions are stopped by walls */
6486 if (!projectable(by, bx, y, x)) continue;
6490 /* Save this grid */
6498 /* Encode some more "radius" info */
6499 gm[bdis + 1] = *pgrids;
6501 /* Increase the size */
6502 brad = rad * (path_n + brev) / (dist + brev);
6504 /* Find the next ripple */
6508 /* Store the effect size */
6514 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6515 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6516 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6517 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6518 * @param x 目標X座標 / Target x location (or location to travel "towards")
6519 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6520 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6521 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6522 * @param monspell 効果元のモンスター魔法ID
6523 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6526 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6527 * towards a given location (optionally passing over the heads of interposing
6528 * monsters), and have it do a given amount of damage to the monsters (and
6529 * optionally objects) within the given radius of the final location.
6531 * A "bolt" travels from source to target and affects only the target grid.
6532 * A "beam" travels from source to target, affecting all grids passed through.
6533 * A "ball" travels from source to the target, exploding at the target, and
6534 * affecting everything within the given radius of the target location.
6536 * Traditionally, a "bolt" does not affect anything on the ground, and does
6537 * not pass over the heads of interposing monsters, much like a traditional
6538 * missile, and will "stop" abruptly at the "target" even if no monster is
6539 * positioned there, while a "ball", on the other hand, passes over the heads
6540 * of monsters between the source and target, and affects everything except
6541 * the source monster which lies within the final radius, while a "beam"
6542 * affects every monster between the source and target, except for the casting
6543 * monster (or player), and rarely affects things on the ground.
6545 * Two special flags allow us to use this function in special ways, the
6546 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6547 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6548 * actually projecting from the source monster (or player).
6550 * The player will only get "experience" for monsters killed by himself
6551 * Unique monsters can only be destroyed by attacks from the player
6553 * Only 256 grids can be affected per projection, limiting the effective
6554 * "radius" of standard ball attacks to nine units (diameter nineteen).
6556 * One can project in a given "direction" by combining PROJECT_THRU with small
6557 * offsets to the initial location (see "line_spell()"), or by calculating
6558 * "virtual targets" far away from the player.
6560 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6561 * continuing until it actually hits somethings (useful for "stone to mud").
6563 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6565 * Balls must explode BEFORE hitting walls, or they would affect monsters
6566 * on both sides of a wall. Some bug reports indicate that this is still
6567 * happening in 2.7.8 for Windows, though it appears to be impossible.
6569 * We "pre-calculate" the blast area only in part for efficiency.
6570 * More importantly, this lets us do "explosions" from the "inside" out.
6571 * This results in a more logical distribution of "blast" treasure.
6572 * It also produces a better (in my opinion) animation of the explosion.
6573 * It could be (but is not) used to have the treasure dropped by monsters
6574 * in the middle of the explosion fall "outwards", and then be damaged by
6575 * the blast as it spreads outwards towards the treasure drop location.
6577 * Walls and doors are included in the blast area, so that they can be
6578 * "burned" or "melted" in later versions.
6580 * This algorithm is intended to maximize simplicity, not necessarily
6581 * efficiency, since this function is not a bottleneck in the code.
6583 * We apply the blast effect from ground zero outwards, in several passes,
6584 * first affecting features, then objects, then monsters, then the player.
6585 * This allows walls to be removed before checking the object or monster
6586 * in the wall, and protects objects which are dropped by monsters killed
6587 * in the blast, and allows the player to see all affects before he is
6588 * killed or teleported away. The semantics of this method are open to
6589 * various interpretations, but they seem to work well in practice.
6591 * We process the blast area from ground-zero outwards to allow for better
6592 * distribution of treasure dropped by monsters, and because it provides a
6593 * pleasing visual effect at low cost.
6595 * Note that the damage done by "ball" explosions decreases with distance.
6596 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6598 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6599 * the target, and then the damage "flows" along this beam of destruction.
6600 * The damage at every grid is the same as at the "center" of a "ball"
6601 * explosion, since the "beam" grids are treated as if they ARE at the
6602 * center of a "ball" explosion.
6604 * Currently, specifying "beam" plus "ball" means that locations which are
6605 * covered by the initial "beam", and also covered by the final "ball", except
6606 * for the final grid (the epicenter of the ball), will be "hit twice", once
6607 * by the initial beam, and once by the exploding ball. For the grid right
6608 * next to the epicenter, this results in 150% damage being done. The center
6609 * does not have this problem, for the same reason the final grid in a "beam"
6610 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6611 * grids which are covered by the "ball" will NOT work, as then they will
6612 * receive LESS damage than they should. Do not combine "beam" with "ball".
6614 * The array "gy[],gx[]" with current size "grids" is used to hold the
6615 * collected locations of all grids in the "blast area" plus "beam path".
6617 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6618 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6619 * first blast grid (see above) with radius "N" from the blast center. Note
6620 * that only the first gm[1] grids in the blast area thus take full damage.
6621 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6622 * number of blast grids.
6624 * Note that once the projection is complete, (y2,x2) holds the final location
6625 * of bolts/beams, and the "epicenter" of balls.
6627 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6628 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6629 * implementation of the "distance" function. Also, a bolt can be properly
6630 * viewed as a "ball" with a "rad" of "zero".
6632 * Note that if no "target" is reached before the beam/bolt/ball travels the
6633 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6634 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6636 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6637 * to move from point A to point B, even if the player cannot see part of the
6638 * projection path. Note that in general, the player will *always* see part
6639 * of the path, since it either starts at the player or ends on the player.
6641 * Hack -- we assume that every "projection" is "self-illuminating".
6643 * Hack -- when only a single monster is affected, we automatically track
6644 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6646 * Note that all projections now "explode" at their final destination, even
6647 * if they were being projected at a more distant destination. This means
6648 * that "ball" spells will *always* explode.
6650 * Note that we must call "handle_stuff()" after affecting terrain features
6651 * in the blast radius, in case the "illumination" of the grid was changed,
6652 * and "update_view()" and "update_monsters()" need to be called.
6655 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6665 POSITION y_saver, x_saver; /* For reflecting monsters */
6667 int msec = delay_factor * delay_factor * delay_factor;
6669 /* Assume the player sees nothing */
6670 bool notice = FALSE;
6672 /* Assume the player has seen nothing */
6673 bool visual = FALSE;
6675 /* Assume the player has seen no blast grids */
6678 /* Assume to be a normal ball spell */
6679 bool breath = FALSE;
6681 /* Is the player blind? */
6682 bool blind = (p_ptr->blind ? TRUE : FALSE);
6684 bool old_hide = FALSE;
6686 /* Number of grids in the "path" */
6689 /* Actual grids in the "path" */
6692 /* Number of grids in the "blast area" (including the "beam" path) */
6695 /* Coordinates of the affected grids */
6696 POSITION gx[1024], gy[1024];
6698 /* Encoded "radius" info (see above) */
6701 /* Actual radius encoded in gm[] */
6702 POSITION gm_rad = rad;
6706 /* Attacker's name (prepared before polymorph)*/
6707 GAME_TEXT who_name[MAX_NLEN];
6709 /* Can the player see the source of this effect? */
6710 bool see_s_msg = TRUE;
6712 /* Initialize by null string */
6718 /* Default target of monsterspell is player */
6719 monster_target_y = p_ptr->y;
6720 monster_target_x = p_ptr->x;
6722 /* Hack -- Jump to target */
6723 if (flg & (PROJECT_JUMP))
6728 /* Clear the flag */
6729 flg &= ~(PROJECT_JUMP);
6734 /* Start at player */
6741 /* Start at monster */
6744 x1 = m_list[who].fx;
6745 y1 = m_list[who].fy;
6746 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6758 /* Default "destination" */
6763 /* Hack -- verify stuff */
6764 if (flg & (PROJECT_THRU))
6766 if ((x1 == x2) && (y1 == y2))
6768 flg &= ~(PROJECT_THRU);
6772 /* Handle a breath attack */
6777 if (flg & PROJECT_HIDE) old_hide = TRUE;
6778 flg |= PROJECT_HIDE;
6782 /* Hack -- Assume there will be no blast (max radius 32) */
6783 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6791 /* Collect beam grids */
6792 if (flg & (PROJECT_BEAM))
6803 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6805 case GF_DISINTEGRATE:
6806 flg |= (PROJECT_GRID);
6807 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6811 /* Calculate the projection path */
6813 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6816 /* Giga-Hack SEEKER & SUPER_RAY */
6818 if( typ == GF_SEEKER )
6828 for (i = 0; i < path_n; ++i)
6833 int ny = GRID_Y(path_g[i]);
6834 int nx = GRID_X(path_g[i]);
6845 /* Only do visuals if requested */
6846 if (!blind && !(flg & (PROJECT_HIDE)))
6848 /* Only do visuals if the player can "see" the bolt */
6849 if (panel_contains(y, x) && player_has_los_bold(y, x))
6856 /* Obtain the bolt pict */
6857 p = bolt_pict(oy, ox, y, x, typ);
6859 /* Extract attr/char */
6863 /* Visual effects */
6864 print_rel(c, a, y, x);
6865 move_cursor_relative(y, x);
6866 /*if (fresh_before)*/ Term_fresh();
6867 Term_xtra(TERM_XTRA_DELAY, msec);
6869 /*if (fresh_before)*/ Term_fresh();
6871 /* Display "beam" grids */
6872 if (flg & (PROJECT_BEAM))
6874 /* Obtain the explosion pict */
6875 p = bolt_pict(y, x, y, x, typ);
6877 /* Extract attr/char */
6881 /* Visual effects */
6882 print_rel(c, a, y, x);
6885 /* Hack -- Activate delay */
6889 /* Hack -- delay anyway for consistency */
6892 /* Delay for consistency */
6893 Term_xtra(TERM_XTRA_DELAY, msec);
6896 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6897 if (is_mirror_grid(&cave[y][x]))
6899 /* The target of monsterspell becomes tha mirror(broken) */
6900 monster_target_y = y;
6901 monster_target_x = x;
6903 remove_mirror(y, x);
6904 next_mirror(&oy, &ox, y, x);
6906 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6907 for (j = last_i; j <= i; j++)
6909 y = GRID_Y(path_g[j]);
6910 x = GRID_X(path_g[j]);
6911 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6912 if (!who && (project_m_n == 1) && !jump) {
6913 if (cave[project_m_y][project_m_x].m_idx > 0) {
6914 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6918 /* Hack -- auto-recall */
6919 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6921 /* Hack - auto-track */
6922 health_track(cave[project_m_y][project_m_x].m_idx);
6926 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6931 for(i = last_i ; i < path_n ; i++)
6934 py = GRID_Y(path_g[i]);
6935 px = GRID_X(path_g[i]);
6936 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6938 if (!who && (project_m_n == 1) && !jump) {
6939 if (cave[project_m_y][project_m_x].m_idx > 0)
6941 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6945 /* Hack -- auto-recall */
6946 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6948 /* Hack - auto-track */
6949 health_track(cave[project_m_y][project_m_x].m_idx);
6953 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6957 else if(typ == GF_SUPER_RAY){
6959 int second_step = 0;
6966 for (i = 0; i < path_n; ++i)
6971 POSITION ny = GRID_Y(path_g[i]);
6972 POSITION nx = GRID_X(path_g[i]);
6983 /* Only do visuals if requested */
6984 if (!blind && !(flg & (PROJECT_HIDE)))
6986 /* Only do visuals if the player can "see" the bolt */
6987 if (panel_contains(y, x) && player_has_los_bold(y, x))
6994 /* Obtain the bolt pict */
6995 p = bolt_pict(oy, ox, y, x, typ);
6997 /* Extract attr/char */
7001 /* Visual effects */
7002 print_rel(c, a, y, x);
7003 move_cursor_relative(y, x);
7004 /*if (fresh_before)*/ Term_fresh();
7005 Term_xtra(TERM_XTRA_DELAY, msec);
7007 /*if (fresh_before)*/ Term_fresh();
7009 /* Display "beam" grids */
7010 if (flg & (PROJECT_BEAM))
7012 /* Obtain the explosion pict */
7013 p = bolt_pict(y, x, y, x, typ);
7015 /* Extract attr/char */
7019 /* Visual effects */
7020 print_rel(c, a, y, x);
7023 /* Hack -- Activate delay */
7027 /* Hack -- delay anyway for consistency */
7030 /* Delay for consistency */
7031 Term_xtra(TERM_XTRA_DELAY, msec);
7034 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7035 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7037 if( second_step )continue;
7040 if( is_mirror_grid(&cave[y][x]) && !second_step )
7042 /* The target of monsterspell becomes tha mirror(broken) */
7043 monster_target_y=(s16b)y;
7044 monster_target_x=(s16b)x;
7047 for( j = 0; j <=i ; j++ )
7049 y = GRID_Y(path_g[j]);
7050 x = GRID_X(path_g[j]);
7051 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7055 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7056 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7057 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7058 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7059 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7060 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7061 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7062 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7065 for( i = 0; i < path_n ; i++ )
7068 py = GRID_Y(path_g[i]);
7069 px = GRID_X(path_g[i]);
7070 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7071 if(!who && (project_m_n == 1) && !jump){
7072 if(cave[project_m_y][project_m_x].m_idx >0 ){
7073 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7077 /* Hack -- auto-recall */
7078 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7080 /* Hack - auto-track */
7081 health_track(cave[project_m_y][project_m_x].m_idx);
7085 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7090 /* Project along the path */
7091 for (i = 0; i < path_n; ++i)
7096 POSITION ny = GRID_Y(path_g[i]);
7097 POSITION nx = GRID_X(path_g[i]);
7099 if (flg & PROJECT_DISI)
7101 /* Hack -- Balls explode before reaching walls */
7102 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7104 else if (flg & PROJECT_LOS)
7106 /* Hack -- Balls explode before reaching walls */
7107 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7111 /* Hack -- Balls explode before reaching walls */
7112 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7119 /* Collect beam grids */
7120 if (flg & (PROJECT_BEAM))
7127 /* Only do visuals if requested */
7128 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7130 /* Only do visuals if the player can "see" the bolt */
7131 if (panel_contains(y, x) && player_has_los_bold(y, x))
7138 /* Obtain the bolt pict */
7139 p = bolt_pict(oy, ox, y, x, typ);
7141 /* Extract attr/char */
7145 /* Visual effects */
7146 print_rel(c, a, y, x);
7147 move_cursor_relative(y, x);
7148 /*if (fresh_before)*/ Term_fresh();
7149 Term_xtra(TERM_XTRA_DELAY, msec);
7151 /*if (fresh_before)*/ Term_fresh();
7153 /* Display "beam" grids */
7154 if (flg & (PROJECT_BEAM))
7156 /* Obtain the explosion pict */
7157 p = bolt_pict(y, x, y, x, typ);
7159 /* Extract attr/char */
7163 /* Visual effects */
7164 print_rel(c, a, y, x);
7167 /* Hack -- Activate delay */
7171 /* Hack -- delay anyway for consistency */
7174 /* Delay for consistency */
7175 Term_xtra(TERM_XTRA_DELAY, msec);
7182 /* Save the "blast epicenter" */
7186 if (breath && !path_n)
7192 flg &= ~(PROJECT_HIDE);
7196 /* Start the "explosion" */
7199 /* Hack -- make sure beams get to "explode" */
7207 /* If we found a "target", explode there */
7208 if (dist <= MAX_RANGE)
7210 /* Mega-Hack -- remove the final "beam" grid */
7211 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7214 * Create a conical breath attack
7225 flg &= ~(PROJECT_HIDE);
7227 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7231 /* Determine the blast area, work from the inside out */
7232 for (dist = 0; dist <= rad; dist++)
7234 /* Scan the maximal blast area of radius "dist" */
7235 for (y = by - dist; y <= by + dist; y++)
7237 for (x = bx - dist; x <= bx + dist; x++)
7239 /* Ignore "illegal" locations */
7240 if (!in_bounds2(y, x)) continue;
7242 /* Enforce a "circular" explosion */
7243 if (distance(by, bx, y, x) != dist) continue;
7249 /* Lights are stopped by opaque terrains */
7250 if (!los(by, bx, y, x)) continue;
7252 case GF_DISINTEGRATE:
7253 /* Disintegration are stopped only by perma-walls */
7254 if (!in_disintegration_range(by, bx, y, x)) continue;
7257 /* Ball explosions are stopped by walls */
7258 if (!projectable(by, bx, y, x)) continue;
7262 /* Save this grid */
7269 /* Encode some more "radius" info */
7275 /* Speed -- ignore "non-explosions" */
7276 if (!grids) return (FALSE);
7279 /* Display the "blast area" if requested */
7280 if (!blind && !(flg & (PROJECT_HIDE)))
7282 /* Then do the "blast", from inside out */
7283 for (t = 0; t <= gm_rad; t++)
7285 /* Dump everything with this radius */
7286 for (i = gm[t]; i < gm[t+1]; i++)
7288 /* Extract the location */
7292 /* Only do visuals if the player can "see" the blast */
7293 if (panel_contains(y, x) && player_has_los_bold(y, x))
7302 /* Obtain the explosion pict */
7303 p = bolt_pict(y, x, y, x, typ);
7305 /* Extract attr/char */
7309 /* Visual effects -- Display */
7310 print_rel(c, a, y, x);
7314 /* Hack -- center the cursor */
7315 move_cursor_relative(by, bx);
7317 /* Flush each "radius" seperately */
7318 /*if (fresh_before)*/ Term_fresh();
7320 /* Delay (efficiently) */
7321 if (visual || drawn)
7323 Term_xtra(TERM_XTRA_DELAY, msec);
7327 /* Flush the erasing */
7330 /* Erase the explosion drawn above */
7331 for (i = 0; i < grids; i++)
7333 /* Extract the location */
7337 /* Hack -- Erase if needed */
7338 if (panel_contains(y, x) && player_has_los_bold(y, x))
7344 /* Hack -- center the cursor */
7345 move_cursor_relative(by, bx);
7347 /* Flush the explosion */
7348 /*if (fresh_before)*/ Term_fresh();
7352 update_creature(p_ptr);
7354 if (flg & PROJECT_KILL)
7356 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7357 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7361 /* Check features */
7362 if (flg & (PROJECT_GRID))
7364 /* Start with "dist" of zero */
7367 /* Scan for features */
7368 for (i = 0; i < grids; i++)
7370 /* Hack -- Notice new "dist" values */
7371 if (gm[dist+1] == i) dist++;
7373 /* Get the grid location */
7377 /* Find the closest point in the blast */
7380 int d = dist_to_line(y, x, y1, x1, by, bx);
7382 /* Affect the grid */
7383 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7387 /* Affect the grid */
7388 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7393 update_creature(p_ptr);
7396 if (flg & (PROJECT_ITEM))
7398 /* Start with "dist" of zero */
7401 /* Scan for objects */
7402 for (i = 0; i < grids; i++)
7404 /* Hack -- Notice new "dist" values */
7405 if (gm[dist+1] == i) dist++;
7407 /* Get the grid location */
7411 /* Find the closest point in the blast */
7414 int d = dist_to_line(y, x, y1, x1, by, bx);
7416 /* Affect the object in the grid */
7417 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7421 /* Affect the object in the grid */
7422 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7428 /* Check monsters */
7429 if (flg & (PROJECT_KILL))
7436 /* Start with "dist" of zero */
7439 /* Scan for monsters */
7440 for (i = 0; i < grids; i++)
7444 /* Hack -- Notice new "dist" values */
7445 if (gm[dist + 1] == i) dist++;
7447 /* Get the grid location */
7451 /* A single bolt may be reflected */
7454 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7455 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7457 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7458 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7459 (!who || dist_hack > 1) && !one_in_(10))
7462 int max_attempts = 10;
7464 /* Choose 'new' target */
7467 t_y = y_saver - 1 + randint1(3);
7468 t_x = x_saver - 1 + randint1(3);
7471 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7473 if (max_attempts < 1)
7479 sound(SOUND_REFLECT);
7482 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7483 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7484 else if (m_ptr->r_idx == MON_DIO)
7485 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7487 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7489 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7491 /* Reflected bolts randomly target either one */
7492 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7493 else flg |= PROJECT_PLAYER;
7495 /* The bolt is reflected */
7496 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7498 /* Don't affect the monster any longer */
7504 /* Find the closest point in the blast */
7507 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7511 effective_dist = dist;
7515 /* There is the riding player on this monster */
7516 if (p_ptr->riding && player_bold(y, x))
7518 /* Aimed on the player */
7519 if (flg & PROJECT_PLAYER)
7521 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7524 * A beam or bolt is well aimed
7526 * So don't affects the mount.
7533 * The spell is not well aimed,
7534 * So partly affect the mount too.
7541 * This grid is the original target.
7542 * Or aimed on your horse.
7544 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7546 /* Hit the mount with full damage */
7550 * Otherwise this grid is not the
7551 * original target, it means that line
7552 * of fire is obstructed by this
7556 * A beam or bolt will hit either
7557 * player or mount. Choose randomly.
7559 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7563 /* Hit the mount with full damage */
7567 /* Hit the player later */
7568 flg |= PROJECT_PLAYER;
7570 /* Don't affect the mount */
7576 * The spell is not well aimed, so
7577 * partly affect both player and
7586 /* Affect the monster in the grid */
7587 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7591 /* Player affected one monster (without "jumping") */
7592 if (!who && (project_m_n == 1) && !jump)
7597 /* Track if possible */
7598 if (cave[y][x].m_idx > 0)
7600 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7604 /* Hack -- auto-recall */
7605 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7607 /* Hack - auto-track */
7608 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7616 if (flg & (PROJECT_KILL))
7618 /* Start with "dist" of zero */
7621 /* Scan for player */
7622 for (i = 0; i < grids; i++)
7626 /* Hack -- Notice new "dist" values */
7627 if (gm[dist+1] == i) dist++;
7629 /* Get the grid location */
7633 /* Affect the player? */
7634 if (!player_bold(y, x)) continue;
7636 /* Find the closest point in the blast */
7639 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7643 effective_dist = dist;
7646 /* Target may be your horse */
7649 /* Aimed on the player */
7650 if (flg & PROJECT_PLAYER)
7652 /* Hit the player with full damage */
7656 * Hack -- When this grid was not the
7657 * original target, a beam or bolt
7658 * would hit either player or mount,
7659 * and should be choosen randomly.
7661 * But already choosen to hit the
7662 * mount at this point.
7664 * Or aimed on your horse.
7666 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7669 * A beam or bolt is well aimed
7671 * So don't affects the player.
7678 * The spell is not well aimed,
7679 * So partly affect the player too.
7685 /* Affect the player */
7686 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7692 GAME_TEXT m_name[MAX_NLEN];
7694 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7696 if (rakubadam_m > 0)
7698 if (rakuba(rakubadam_m, FALSE))
7700 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7703 if (p_ptr->riding && rakubadam_p > 0)
7705 if(rakuba(rakubadam_p, FALSE))
7707 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7712 /* Return "something was noticed" */
7717 * @brief 鏡魔法「封魔結界」の効果処理
7719 * @return 効果があったらTRUEを返す
7721 bool binding_field(HIT_POINT dam)
7723 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7724 int mirror_num = 0; /* 鏡の数 */
7726 POSITION centersign;
7727 POSITION x1, x2, y1, y2;
7729 int msec = delay_factor*delay_factor*delay_factor;
7732 POSITION point_x[3];
7733 POSITION point_y[3];
7735 /* Default target of monsterspell is player */
7736 monster_target_y = p_ptr->y;
7737 monster_target_x = p_ptr->x;
7739 for (x = 0; x < cur_wid; x++)
7741 for (y = 0; y < cur_hgt; y++)
7743 if (is_mirror_grid(&cave[y][x]) &&
7744 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7745 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7746 player_has_los_bold(y, x) &&
7747 projectable(p_ptr->y, p_ptr->x, y, x)
7749 mirror_y[mirror_num] = y;
7750 mirror_x[mirror_num] = x;
7756 if (mirror_num < 2)return FALSE;
7758 point_x[0] = randint0(mirror_num);
7760 point_x[1] = randint0(mirror_num);
7761 } while (point_x[0] == point_x[1]);
7763 point_y[0] = mirror_y[point_x[0]];
7764 point_x[0] = mirror_x[point_x[0]];
7765 point_y[1] = mirror_y[point_x[1]];
7766 point_x[1] = mirror_x[point_x[1]];
7767 point_y[2] = p_ptr->y;
7768 point_x[2] = p_ptr->x;
7770 x = point_x[0] + point_x[1] + point_x[2];
7771 y = point_y[0] + point_y[1] + point_y[2];
7773 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7774 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7775 if (centersign == 0)return FALSE;
7777 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7778 x1 = x1 < point_x[2] ? x1 : point_x[2];
7779 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7780 y1 = y1 < point_y[2] ? y1 : point_y[2];
7782 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7783 x2 = x2 > point_x[2] ? x2 : point_x[2];
7784 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7785 y2 = y2 > point_y[2] ? y2 : point_y[2];
7787 for (y = y1; y <= y2; y++) {
7788 for (x = x1; x <= x2; x++) {
7789 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7790 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7791 centersign*((point_x[1] - x)*(point_y[2] - y)
7792 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7793 centersign*((point_x[2] - x)*(point_y[0] - y)
7794 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7796 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7797 /* Visual effects */
7799 && panel_contains(y, x)) {
7800 p = bolt_pict(y, x, y, x, GF_MANA);
7801 print_rel(PICT_C(p), PICT_A(p), y, x);
7802 move_cursor_relative(y, x);
7803 /*if (fresh_before)*/ Term_fresh();
7804 Term_xtra(TERM_XTRA_DELAY, msec);
7810 for (y = y1; y <= y2; y++) {
7811 for (x = x1; x <= x2; x++) {
7812 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7813 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7814 centersign*((point_x[1] - x)*(point_y[2] - y)
7815 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7816 centersign*((point_x[2] - x)*(point_y[0] - y)
7817 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7819 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7820 (void)project_f(0, 0, y, x, dam, GF_MANA);
7825 for (y = y1; y <= y2; y++) {
7826 for (x = x1; x <= x2; x++) {
7827 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7828 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7829 centersign*((point_x[1] - x)*(point_y[2] - y)
7830 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7831 centersign*((point_x[2] - x)*(point_y[0] - y)
7832 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7834 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7835 (void)project_o(0, 0, y, x, dam, GF_MANA);
7840 for (y = y1; y <= y2; y++) {
7841 for (x = x1; x <= x2; x++) {
7842 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7843 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7844 centersign*((point_x[1] - x)*(point_y[2] - y)
7845 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7846 centersign*((point_x[2] - x)*(point_y[0] - y)
7847 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7849 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7850 (void)project_m(0, 0, y, x, dam, GF_MANA,
7851 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7857 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7858 remove_mirror(point_y[0], point_x[0]);
7865 * @brief 鏡魔法「鏡の封印」の効果処理
7867 * @return 効果があったらTRUEを返す
7869 void seal_of_mirror(HIT_POINT dam)
7873 for (x = 0; x < cur_wid; x++)
7875 for (y = 0; y < cur_hgt; y++)
7877 if (is_mirror_grid(&cave[y][x]))
7879 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7880 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7882 if (!cave[y][x].m_idx)
7884 remove_mirror(y, x);