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 concptr 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 concptr 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;
1296 object_flags(o_ptr, flgs);
1298 /* Check for artifact */
1299 if (object_is_artifact(o_ptr)) is_art = TRUE;
1301 /* Analyze the type */
1304 /* Acid -- Lots of things */
1307 if (hates_acid(o_ptr))
1310 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1311 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1316 /* Elec -- Rings and Wands */
1319 if (hates_elec(o_ptr))
1322 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1323 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1328 /* Fire -- Flammable objects */
1331 if (hates_fire(o_ptr))
1334 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1335 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1340 /* Cold -- potions and flasks */
1343 if (hates_cold(o_ptr))
1345 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1347 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1355 if (hates_fire(o_ptr))
1358 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1359 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1361 if (hates_elec(o_ptr))
1365 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1366 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1374 if (hates_fire(o_ptr))
1377 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1378 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1380 if (hates_cold(o_ptr))
1384 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1385 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1390 /* Hack -- break potions and such */
1396 if (hates_cold(o_ptr))
1398 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1404 /* Mana and Chaos -- destroy everything */
1410 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1414 case GF_DISINTEGRATE:
1417 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1424 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1425 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1426 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1430 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1434 if (object_is_cursed(o_ptr))
1437 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1444 identify_item(o_ptr);
1446 /* Auto-inscription */
1447 autopick_alter_item((-this_o_idx), FALSE);
1455 /* Chests are noticed only if trapped or locked */
1456 if (o_ptr->tval == TV_CHEST)
1458 /* Disarm/Unlock traps */
1459 if (o_ptr->pval > 0)
1461 /* Disarm or Unlock */
1462 o_ptr->pval = (0 - o_ptr->pval);
1465 object_known(o_ptr);
1467 if (known && (o_ptr->marked & OM_FOUND))
1469 msg_print(_("カチッと音がした!", "Click!"));
1479 if (o_ptr->tval == TV_CORPSE)
1482 BIT_FLAGS mode = 0L;
1484 if (!who || is_pet(&m_list[who]))
1485 mode |= PM_FORCE_PET;
1487 for (i = 0; i < o_ptr->number ; i++)
1489 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1490 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1494 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1498 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1500 note_kill = _("生き返った。", " revived.");
1502 else if (!note_kill)
1504 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1515 /* Attempt to destroy the object */
1518 /* Effect "observed" */
1519 if (known && (o_ptr->marked & OM_FOUND))
1522 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1525 /* Artifacts, and other objects, get to resist */
1526 if (is_art || ignore)
1528 /* Observe the resist */
1529 if (known && (o_ptr->marked & OM_FOUND))
1531 msg_format(_("%sは影響を受けない!",
1532 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1539 /* Describe if needed */
1540 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1542 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1545 k_idx = o_ptr->k_idx;
1546 is_potion = object_is_potion(o_ptr);
1547 delete_object_idx(this_o_idx);
1549 /* Potions produce effects when 'shattered' */
1552 (void)potion_smash_effect(who, y, x, k_idx);
1560 /* Return "Anything seen?" */
1566 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1567 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1568 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1569 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1570 * @param x 目標X座標 / Target x location (or location to travel "towards")
1571 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1572 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1574 * @param see_s_msg TRUEならばメッセージを表示する
1575 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1578 * This routine takes a "source monster" (by index) which is mostly used to
1579 * determine if the player is causing the damage, and a "radius" (see below),
1580 * which is used to decrease the power of explosions with distance, and a
1581 * location, via integers which are modified by certain types of attacks
1582 * (polymorph and teleport being the obvious ones), a default damage, which
1583 * is modified as needed based on various properties, and finally a "damage
1584 * type" (see below).
1587 * Note that this routine can handle "no damage" attacks (like teleport) by
1588 * taking a "zero" damage, and can even take "parameters" to attacks (like
1589 * confuse) by accepting a "damage", using it to calculate the effect, and
1590 * then setting the damage to zero. Note that the "damage" parameter is
1591 * divided by the radius, so monsters not at the "epicenter" will not take
1592 * as much damage (or whatever)...
1595 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1596 * may result in a dereference of an invalid pointer.
1599 * Various messages are produced, and damage is applied.
1602 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1603 * actually be "made" of that substance, or "breathe" big balls of it.
1604 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1606 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1607 * and hurts evil less. If can breath nether, then it resists it as well.
1610 * Damage reductions use the following formulas:
1611 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1612 * gives avg damage of .655, ranging from .858 to .500
1613 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1614 * gives avg damage of .544, ranging from .714 to .417
1615 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1616 * gives avg damage of .444, ranging from .556 to .333
1617 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1618 * gives avg damage of .327, ranging from .427 to .250
1619 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1620 * gives something simple.
1623 * In this function, "result" messages are postponed until the end, where
1624 * the "note" string is appended to the monster name, if not NULL. So,
1625 * to make a spell have "no effect" just set "note" to NULL. You should
1626 * also set "notice" to FALSE, or the player will learn what the spell does.
1629 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1633 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)
1637 cave_type *c_ptr = &cave[y][x];
1639 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1640 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1642 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1646 /* Is the monster "seen"? */
1647 bool seen = m_ptr->ml;
1648 bool seen_msg = is_seen(m_ptr);
1650 bool slept = (bool)MON_CSLEEP(m_ptr);
1652 /* Were the effects "obvious" (if seen)? */
1653 bool obvious = FALSE;
1655 /* Can the player know about this effect? */
1656 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1658 /* Were the effects "irrelevant"? */
1659 bool skipped = FALSE;
1661 /* Gets the monster angry at the source of the effect? */
1662 bool get_angry = FALSE;
1664 /* Polymorph setting (true or false) */
1665 bool do_poly = FALSE;
1667 /* Teleport setting (max distance) */
1670 /* Confusion setting (amount to confuse) */
1673 /* Stunning setting (amount to stun) */
1676 /* Sleep amount (amount to sleep) */
1679 /* Fear amount (amount to fear) */
1682 /* Time amount (amount to time) */
1685 bool heal_leper = FALSE;
1687 /* Hold the monster name */
1688 GAME_TEXT m_name[MAX_NLEN];
1691 PARAMETER_VALUE photo = 0;
1693 /* Assume no note */
1694 concptr note = NULL;
1696 /* Assume a default death */
1697 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1699 POSITION ty = m_ptr->fy;
1700 POSITION tx = m_ptr->fx;
1702 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1705 if (!c_ptr->m_idx) return (FALSE);
1707 /* Never affect projector */
1708 if (who && (c_ptr->m_idx == who)) return (FALSE);
1709 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1710 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1712 /* Don't affect already death monsters */
1713 /* Prevents problems with chain reactions of exploding monsters */
1714 if (m_ptr->hp < 0) return (FALSE);
1716 /* Reduce damage by distance */
1717 dam = (dam + r) / (r + 1);
1720 /* Get the monster name (BEFORE polymorphing) */
1721 monster_desc(m_name, m_ptr, 0);
1723 /* Get the monster possessive ("his"/"her"/"its") */
1724 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1726 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1728 /* Analyze the damage type */
1731 /* Magic Missile -- pure damage */
1734 if (seen) obvious = TRUE;
1736 if (r_ptr->flagsr & RFR_RES_ALL)
1738 note = _("には完全な耐性がある!", " is immune.");
1740 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1749 if (seen) obvious = TRUE;
1751 if (r_ptr->flagsr & RFR_RES_ALL)
1753 note = _("には完全な耐性がある!", " is immune.");
1755 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1758 if (r_ptr->flagsr & RFR_IM_ACID)
1760 note = _("にはかなり耐性がある!", " resists a lot.");
1762 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1770 if (seen) obvious = TRUE;
1772 if (r_ptr->flagsr & RFR_RES_ALL)
1774 note = _("には完全な耐性がある!", " is immune.");
1776 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1779 if (r_ptr->flagsr & RFR_IM_ELEC)
1781 note = _("にはかなり耐性がある!", " resists a lot.");
1783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1791 if (seen) obvious = TRUE;
1793 if (r_ptr->flagsr & RFR_RES_ALL)
1795 note = _("には完全な耐性がある!", " is immune.");
1797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1800 if (r_ptr->flagsr & RFR_IM_FIRE)
1802 note = _("にはかなり耐性がある!", " resists a lot.");
1804 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1806 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1808 note = _("はひどい痛手をうけた。", " is hit hard.");
1810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1818 if (seen) obvious = TRUE;
1820 if (r_ptr->flagsr & RFR_RES_ALL)
1822 note = _("には完全な耐性がある!", " is immune.");
1824 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1827 if (r_ptr->flagsr & RFR_IM_COLD)
1829 note = _("にはかなり耐性がある!", " resists a lot.");
1831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1833 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1835 note = _("はひどい痛手をうけた。", " is hit hard.");
1837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1845 if (seen) obvious = TRUE;
1847 if (r_ptr->flagsr & RFR_RES_ALL)
1849 note = _("には完全な耐性がある!", " is immune.");
1851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1854 if (r_ptr->flagsr & RFR_IM_POIS)
1856 note = _("にはかなり耐性がある!", " resists a lot.");
1858 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1866 if (seen) obvious = TRUE;
1868 if (r_ptr->flagsr & RFR_RES_ALL)
1870 note = _("には完全な耐性がある!", " is immune.");
1872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1875 if (r_ptr->flagsr & RFR_IM_POIS)
1877 note = _("には耐性がある。", " resists.");
1878 dam *= 3; dam /= randint1(6) + 6;
1879 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1881 else if (one_in_(3)) do_poly = TRUE;
1885 /* Hellfire -- hurts Evil */
1888 if (seen) obvious = TRUE;
1890 if (r_ptr->flagsr & RFR_RES_ALL)
1892 note = _("には完全な耐性がある!", " is immune.");
1894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1897 if (r_ptr->flags3 & RF3_GOOD)
1899 note = _("はひどい痛手をうけた。", " is hit hard.");
1901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1906 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1909 if (seen) obvious = TRUE;
1911 if (r_ptr->flagsr & RFR_RES_ALL)
1913 note = _("には完全な耐性がある!", " is immune.");
1915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1918 if (r_ptr->flags3 & RF3_GOOD)
1920 note = _("には完全な耐性がある!", " is immune.");
1922 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1924 else if (r_ptr->flags3 & RF3_EVIL)
1927 note = _("はひどい痛手をうけた。", " is hit hard.");
1928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1932 note = _("には耐性がある。", " resists.");
1933 dam *= 3; dam /= randint1(6) + 6;
1938 /* Arrow -- XXX no defense */
1941 if (seen) obvious = TRUE;
1943 if (r_ptr->flagsr & RFR_RES_ALL)
1945 note = _("には完全な耐性がある!", " is immune.");
1947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1953 /* Plasma -- XXX perhaps check ELEC or FIRE */
1956 if (seen) obvious = TRUE;
1958 if (r_ptr->flagsr & RFR_RES_ALL)
1960 note = _("には完全な耐性がある!", " is immune.");
1962 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1965 if (r_ptr->flagsr & RFR_RES_PLAS)
1967 note = _("には耐性がある。", " resists.");
1968 dam *= 3; dam /= randint1(6) + 6;
1969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1974 /* Nether -- see above */
1977 if (seen) obvious = TRUE;
1979 if (r_ptr->flagsr & RFR_RES_ALL)
1981 note = _("には完全な耐性がある!", " is immune.");
1983 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1986 if (r_ptr->flagsr & RFR_RES_NETH)
1988 if (r_ptr->flags3 & RF3_UNDEAD)
1990 note = _("には完全な耐性がある!", " is immune.");
1992 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1996 note = _("には耐性がある。", " resists.");
1997 dam *= 3; dam /= randint1(6) + 6;
1999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2001 else if (r_ptr->flags3 & RF3_EVIL)
2003 note = _("はいくらか耐性を示した。", " resists somewhat.");
2005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2010 /* Water (acid) damage -- Water spirits/elementals are immune */
2013 if (seen) obvious = TRUE;
2015 if (r_ptr->flagsr & RFR_RES_ALL)
2017 note = _("には完全な耐性がある!", " is immune.");
2019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2022 if (r_ptr->flagsr & RFR_RES_WATE)
2024 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2026 note = _("には完全な耐性がある!", " is immune.");
2031 note = _("には耐性がある。", " resists.");
2032 dam *= 3; dam /= randint1(6) + 6;
2034 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2039 /* Chaos -- Chaos breathers resist */
2042 if (seen) obvious = TRUE;
2044 if (r_ptr->flagsr & RFR_RES_ALL)
2046 note = _("には完全な耐性がある!", " is immune.");
2048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2051 if (r_ptr->flagsr & RFR_RES_CHAO)
2053 note = _("には耐性がある。", " resists.");
2054 dam *= 3; dam /= randint1(6) + 6;
2055 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2057 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2059 note = _("はいくらか耐性を示した。", " resists somewhat.");
2060 dam *= 3; dam /= randint1(6) + 6;
2061 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2066 do_conf = (5 + randint1(11) + r) / (r + 1);
2071 /* Shards -- Shard breathers resist */
2074 if (seen) obvious = TRUE;
2076 if (r_ptr->flagsr & RFR_RES_ALL)
2078 note = _("には完全な耐性がある!", " is immune.");
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2083 if (r_ptr->flagsr & RFR_RES_SHAR)
2085 note = _("には耐性がある。", " resists.");
2086 dam *= 3; dam /= randint1(6) + 6;
2087 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2092 /* Rocket: Shard resistance helps */
2095 if (seen) obvious = TRUE;
2097 if (r_ptr->flagsr & RFR_RES_ALL)
2099 note = _("には完全な耐性がある!", " is immune.");
2101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2104 if (r_ptr->flagsr & RFR_RES_SHAR)
2106 note = _("はいくらか耐性を示した。", " resists somewhat.");
2108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2114 /* Sound -- Sound breathers resist */
2117 if (seen) obvious = TRUE;
2119 if (r_ptr->flagsr & RFR_RES_ALL)
2121 note = _("には完全な耐性がある!", " is immune.");
2123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2126 if (r_ptr->flagsr & RFR_RES_SOUN)
2128 note = _("には耐性がある。", " resists.");
2129 dam *= 2; dam /= randint1(6) + 6;
2130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2132 else do_stun = (10 + randint1(15) + r) / (r + 1);
2139 if (seen) obvious = TRUE;
2141 if (r_ptr->flagsr & RFR_RES_ALL)
2143 note = _("には完全な耐性がある!", " is immune.");
2145 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2148 if (r_ptr->flags3 & RF3_NO_CONF)
2150 note = _("には耐性がある。", " resists.");
2151 dam *= 3; dam /= randint1(6) + 6;
2152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2154 else do_conf = (10 + randint1(15) + r) / (r + 1);
2158 /* Disenchantment -- Breathers and Disenchanters resist */
2161 if (seen) obvious = TRUE;
2163 if (r_ptr->flagsr & RFR_RES_ALL)
2165 note = _("には完全な耐性がある!", " is immune.");
2167 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2170 if (r_ptr->flagsr & RFR_RES_DISE)
2172 note = _("には耐性がある。", " resists.");
2173 dam *= 3; dam /= randint1(6) + 6;
2174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2179 /* Nexus -- Breathers and Existers resist */
2182 if (seen) obvious = TRUE;
2184 if (r_ptr->flagsr & RFR_RES_ALL)
2186 note = _("には完全な耐性がある!", " is immune.");
2188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2191 if (r_ptr->flagsr & RFR_RES_NEXU)
2193 note = _("には耐性がある。", " resists.");
2194 dam *= 3; dam /= randint1(6) + 6;
2195 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2203 if (seen) obvious = TRUE;
2205 if (r_ptr->flagsr & RFR_RES_ALL)
2207 note = _("には完全な耐性がある!", " is immune.");
2209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2212 if (r_ptr->flagsr & RFR_RES_WALL)
2214 note = _("には耐性がある。", " resists.");
2215 dam *= 3; dam /= randint1(6) + 6;
2216 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2218 else do_stun = (randint1(15) + r) / (r + 1);
2222 /* Inertia -- breathers resist */
2225 if (seen) obvious = TRUE;
2227 if (r_ptr->flagsr & RFR_RES_ALL)
2229 note = _("には完全な耐性がある!", " is immune.");
2231 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2234 if (r_ptr->flagsr & RFR_RES_INER)
2236 note = _("には耐性がある。", " resists.");
2237 dam *= 3; dam /= randint1(6) + 6;
2238 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2242 /* Powerful monsters can resist */
2243 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2244 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2248 /* Normal monsters slow down */
2251 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2253 note = _("の動きが遅くなった。", " starts moving slower.");
2260 /* Time -- breathers resist */
2263 if (seen) obvious = TRUE;
2265 if (r_ptr->flagsr & RFR_RES_ALL)
2267 note = _("には完全な耐性がある!", " is immune.");
2269 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2272 if (r_ptr->flagsr & RFR_RES_TIME)
2274 note = _("には耐性がある。", " resists.");
2275 dam *= 3; dam /= randint1(6) + 6;
2276 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2278 else do_time = (dam + 1) / 2;
2282 /* Gravity -- breathers resist */
2285 bool resist_tele = FALSE;
2287 if (seen) obvious = TRUE;
2289 if (r_ptr->flagsr & RFR_RES_ALL)
2291 note = _("には完全な耐性がある!", " is immune.");
2293 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2296 if (r_ptr->flagsr & RFR_RES_TELE)
2298 if (r_ptr->flags1 & (RF1_UNIQUE))
2300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2301 note = _("には効果がなかった。", " is unaffected!");
2304 else if (r_ptr->level > randint1(100))
2306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2307 note = _("には耐性がある!", " resists!");
2312 if (!resist_tele) do_dist = 10;
2314 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2316 if (r_ptr->flagsr & RFR_RES_GRAV)
2318 note = _("には耐性がある!", " resists!");
2319 dam *= 3; dam /= randint1(6) + 6;
2321 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2326 /* Powerful monsters can resist */
2327 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2328 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2332 /* Normal monsters slow down */
2335 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2337 note = _("の動きが遅くなった。", " starts moving slower.");
2342 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2344 /* Attempt a saving throw */
2345 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2346 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2350 /* No obvious effect */
2351 note = _("には効果がなかった。", " is unaffected!");
2363 if (seen) obvious = TRUE;
2365 if (r_ptr->flagsr & RFR_RES_ALL)
2367 note = _("には完全な耐性がある!", " is immune.");
2369 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2377 case GF_DISINTEGRATE:
2379 if (seen) obvious = TRUE;
2381 if (r_ptr->flagsr & RFR_RES_ALL)
2383 note = _("には完全な耐性がある!", " is immune.");
2385 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2388 if (r_ptr->flags3 & RF3_HURT_ROCK)
2390 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2391 note = _("の皮膚がただれた!", " loses some skin!");
2392 note_dies = _("は蒸発した!", " evaporates!");
2400 if (seen) obvious = TRUE;
2402 /* PSI only works if the monster can see you! -- RG */
2403 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2406 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2411 if (r_ptr->flagsr & RFR_RES_ALL)
2413 note = _("には完全な耐性がある!", " is immune.");
2415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2418 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2421 note = _("には完全な耐性がある!", " is immune.");
2422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2425 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2426 (r_ptr->flags3 & RF3_ANIMAL) ||
2427 (r_ptr->level > randint1(3 * dam)))
2429 note = _("には耐性がある!", " resists!");
2433 * Powerful demons & undead can turn a mindcrafter's
2434 * attacks back on them
2436 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2437 (r_ptr->level > p_ptr->lev / 2) &&
2441 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2442 (seen ? "%^s's corrupted mind backlashes your attack!" :
2443 "%^ss corrupted mind backlashes your attack!")), m_name);
2446 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2448 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2452 /* Injure +/- confusion */
2453 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2454 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2455 if (one_in_(4) && !CHECK_MULTISHADOW())
2457 switch (randint1(4))
2460 set_confused(p_ptr->confused + 3 + randint1(dam));
2463 set_stun(p_ptr->stun + randint1(dam));
2467 if (r_ptr->flags3 & RF3_NO_FEAR)
2468 note = _("には効果がなかった。", " is unaffected.");
2470 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2474 if (!p_ptr->free_act)
2475 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2484 if ((dam > 0) && one_in_(4))
2486 switch (randint1(4))
2489 do_conf = 3 + randint1(dam);
2492 do_stun = 3 + randint1(dam);
2495 do_fear = 3 + randint1(dam);
2498 note = _("は眠り込んでしまった!", " falls asleep!");
2499 do_sleep = 3 + randint1(dam);
2504 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2510 if (seen) obvious = TRUE;
2512 if (r_ptr->flagsr & RFR_RES_ALL)
2514 note = _("には完全な耐性がある!", " is immune.");
2516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2519 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2522 note = _("には完全な耐性がある!", " is immune.");
2524 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2525 (r_ptr->flags3 & RF3_ANIMAL) ||
2526 (r_ptr->level > randint1(3 * dam)))
2528 note = _("には耐性がある!", " resists!");
2532 * Powerful demons & undead can turn a mindcrafter's
2533 * attacks back on them
2535 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2536 (r_ptr->level > p_ptr->lev / 2) &&
2540 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2541 (seen ? "%^s's corrupted mind backlashes your attack!" :
2542 "%^ss corrupted mind backlashes your attack!")), m_name);
2544 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2546 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2550 /* Injure + mana drain */
2551 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2552 if (!CHECK_MULTISHADOW())
2554 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2555 p_ptr->csp -= damroll(5, dam) / 2;
2556 if (p_ptr->csp < 0) p_ptr->csp = 0;
2557 p_ptr->redraw |= PR_MANA;
2558 p_ptr->window |= (PW_SPELL);
2560 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2567 int b = damroll(5, dam) / 4;
2568 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2569 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2570 (seen ? "You convert %s's pain into %s!" :
2571 "You convert %ss pain into %s!"));
2572 msg_format(msg, m_name, str);
2574 b = MIN(p_ptr->msp, p_ptr->csp + b);
2576 p_ptr->redraw |= PR_MANA;
2577 p_ptr->window |= (PW_SPELL);
2579 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2583 case GF_TELEKINESIS:
2585 if (seen) obvious = TRUE;
2587 if (r_ptr->flagsr & RFR_RES_ALL)
2589 note = _("には完全な耐性がある!", " is immune.");
2591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2596 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2601 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2603 /* Attempt a saving throw */
2604 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2605 (r_ptr->level > 5 + randint1(dam)))
2609 /* No obvious effect */
2615 /* Psycho-spear -- powerful magic missile */
2618 if (seen) obvious = TRUE;
2620 if (r_ptr->flagsr & RFR_RES_ALL)
2622 note = _("には完全な耐性がある!", " is immune.");
2624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2630 /* Meteor -- powerful magic missile */
2633 if (seen) obvious = TRUE;
2635 if (r_ptr->flagsr & RFR_RES_ALL)
2637 note = _("には完全な耐性がある!", " is immune.");
2639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2647 if (!is_hostile(m_ptr)) break;
2649 if (seen) obvious = TRUE;
2651 if (r_ptr->flagsr & RFR_RES_ALL)
2653 note = _("には効果がなかった!", " is immune.");
2655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2658 /* Attempt a saving throw */
2659 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2660 (r_ptr->flags3 & RF3_NO_CONF) ||
2661 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2663 /* Memorize a flag */
2664 if (r_ptr->flags3 & RF3_NO_CONF)
2666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2673 * Powerful demons & undead can turn a mindcrafter's
2674 * attacks back on them
2676 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2677 (r_ptr->level > p_ptr->lev / 2) &&
2681 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2682 (seen ? "%^s's corrupted mind backlashes your attack!" :
2683 "%^ss corrupted mind backlashes your attack!")), m_name);
2686 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2688 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2692 /* Confuse, stun, terrify */
2693 switch (randint1(4))
2696 set_stun(p_ptr->stun + dam / 2);
2699 set_confused(p_ptr->confused + dam / 2);
2703 if (r_ptr->flags3 & RF3_NO_FEAR)
2704 note = _("には効果がなかった。", " is unaffected.");
2706 set_afraid(p_ptr->afraid + dam);
2713 /* No obvious effect */
2714 note = _("には効果がなかった。", " is unaffected.");
2720 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2722 note = _("があなたに隷属した。", " is in your thrall!");
2727 switch (randint1(4))
2741 /* No "real" damage */
2748 /* Ice -- Cold + Cuts + Stun */
2751 if (seen) obvious = TRUE;
2753 if (r_ptr->flagsr & RFR_RES_ALL)
2755 note = _("には完全な耐性がある!", " is immune.");
2757 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2760 do_stun = (randint1(15) + 1) / (r + 1);
2761 if (r_ptr->flagsr & RFR_IM_COLD)
2763 note = _("にはかなり耐性がある!", " resists a lot.");
2765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2767 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2769 note = _("はひどい痛手をうけた。", " is hit hard.");
2771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2778 case GF_HYPODYNAMIA:
2780 if (seen) obvious = TRUE;
2782 if (r_ptr->flagsr & RFR_RES_ALL)
2784 note = _("には完全な耐性がある!", " is immune.");
2786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2789 if (!monster_living(m_ptr->r_idx))
2791 if (is_original_ap_and_seen(m_ptr))
2793 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2794 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2795 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2797 note = _("には効果がなかった。", " is unaffected.");
2801 else do_time = (dam+7)/8;
2809 if (seen) obvious = TRUE;
2811 if (r_ptr->flagsr & RFR_RES_ALL)
2813 note = _("には完全な耐性がある!", " is immune.");
2815 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2818 if (!monster_living(m_ptr->r_idx))
2820 if (is_original_ap_and_seen(m_ptr))
2822 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2823 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2824 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2826 note = _("には完全な耐性がある!", " is immune.");
2830 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2831 (randint1(888) != 666)) ||
2832 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2833 randint1(100) != 66))
2835 note = _("には耐性がある!", " resists!");
2843 /* Polymorph monster (Use "dam" as "power") */
2846 if (seen) obvious = TRUE;
2848 if (r_ptr->flagsr & RFR_RES_ALL)
2850 note = _("には効果がなかった。", " is unaffected.");
2852 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2855 /* Attempt to polymorph (see below) */
2858 /* Powerful monsters can resist */
2859 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2860 (r_ptr->flags1 & RF1_QUESTOR) ||
2861 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2863 note = _("には効果がなかった。", " is unaffected.");
2868 /* No "real" damage */
2875 /* Clone monsters (Ignore "dam") */
2878 if (seen) obvious = TRUE;
2880 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2882 note = _("には効果がなかった。", " is unaffected.");
2887 m_ptr->hp = m_ptr->maxhp;
2889 /* Attempt to clone. */
2890 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2892 note = _("が分裂した!", " spawns!");
2896 /* No "real" damage */
2903 /* Heal Monster (use "dam" as amount of healing) */
2906 if (seen) obvious = TRUE;
2909 (void)set_monster_csleep(c_ptr->m_idx, 0);
2911 if (m_ptr->maxhp < m_ptr->max_maxhp)
2913 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2914 m_ptr->maxhp = m_ptr->max_maxhp;
2919 /* Redraw (later) if needed */
2920 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2921 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2929 if (seen) obvious = TRUE;
2932 (void)set_monster_csleep(c_ptr->m_idx, 0);
2933 if (MON_STUNNED(m_ptr))
2935 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2936 (void)set_monster_stunned(c_ptr->m_idx, 0);
2938 if (MON_CONFUSED(m_ptr))
2940 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2941 (void)set_monster_confused(c_ptr->m_idx, 0);
2943 if (MON_MONFEAR(m_ptr))
2945 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2946 (void)set_monster_monfear(c_ptr->m_idx, 0);
2950 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2953 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2957 chg_virtue(V_VITALITY, 1);
2959 if (r_ptr->flags1 & RF1_UNIQUE)
2960 chg_virtue(V_INDIVIDUALISM, 1);
2962 if (is_friendly(m_ptr))
2963 chg_virtue(V_HONOUR, 1);
2964 else if (!(r_ptr->flags3 & RF3_EVIL))
2966 if (r_ptr->flags3 & RF3_GOOD)
2967 chg_virtue(V_COMPASSION, 2);
2969 chg_virtue(V_COMPASSION, 1);
2972 if (r_ptr->flags3 & RF3_ANIMAL)
2973 chg_virtue(V_NATURE, 1);
2976 if (m_ptr->r_idx == MON_LEPER)
2979 if (!who) chg_virtue(V_COMPASSION, 5);
2982 /* Redraw (later) if needed */
2983 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2984 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2986 note = _("は体力を回復したようだ。", " looks healthier.");
2988 /* No "real" damage */
2994 /* Speed Monster (Ignore "dam") */
2997 if (seen) obvious = TRUE;
3000 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3002 note = _("の動きが速くなった。", " starts moving faster.");
3007 if (r_ptr->flags1 & RF1_UNIQUE)
3008 chg_virtue(V_INDIVIDUALISM, 1);
3009 if (is_friendly(m_ptr))
3010 chg_virtue(V_HONOUR, 1);
3013 /* No "real" damage */
3019 /* Slow Monster (Use "dam" as "power") */
3022 if (seen) obvious = TRUE;
3024 if (r_ptr->flagsr & RFR_RES_ALL)
3026 note = _("には効果がなかった。", " is unaffected.");
3028 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3031 /* Powerful monsters can resist */
3032 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3033 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3035 note = _("には効果がなかった。", " is unaffected.");
3039 /* Normal monsters slow down */
3042 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3044 note = _("の動きが遅くなった。", " starts moving slower.");
3048 /* No "real" damage */
3054 /* Sleep (Use "dam" as "power") */
3057 if (seen) obvious = TRUE;
3059 if (r_ptr->flagsr & RFR_RES_ALL)
3061 note = _("には効果がなかった。", " is unaffected.");
3063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3066 /* Attempt a saving throw */
3067 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3068 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3069 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3071 /* Memorize a flag */
3072 if (r_ptr->flags3 & RF3_NO_SLEEP)
3074 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3076 /* No obvious effect */
3077 note = _("には効果がなかった。", " is unaffected.");
3082 /* Go to sleep (much) later */
3083 note = _("は眠り込んでしまった!", " falls asleep!");
3087 /* No "real" damage */
3093 /* Sleep (Use "dam" as "power") */
3094 case GF_STASIS_EVIL:
3096 if (seen) obvious = TRUE;
3098 if (r_ptr->flagsr & RFR_RES_ALL)
3100 note = _("には効果がなかった!", " is immune.");
3102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3105 /* Attempt a saving throw */
3106 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3107 !(r_ptr->flags3 & RF3_EVIL) ||
3108 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3110 note = _("には効果がなかった。", " is unaffected.");
3115 /* Go to sleep (much) later */
3116 note = _("は動けなくなった!", " is suspended!");
3120 /* No "real" damage */
3125 /* Sleep (Use "dam" as "power") */
3128 if (seen) obvious = TRUE;
3130 if (r_ptr->flagsr & RFR_RES_ALL)
3132 note = _("には効果がなかった。", " is unaffected.");
3134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3137 /* Attempt a saving throw */
3138 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3139 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3141 note = _("には効果がなかった。", " is unaffected.");
3146 /* Go to sleep (much) later */
3147 note = _("は動けなくなった!", " is suspended!");
3151 /* No "real" damage */
3160 vir = virtue_number(V_HARMONY);
3163 dam += p_ptr->virtues[vir-1]/10;
3166 vir = virtue_number(V_INDIVIDUALISM);
3169 dam -= p_ptr->virtues[vir-1]/20;
3172 if (seen) obvious = TRUE;
3174 /* Attempt a saving throw */
3175 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3179 /* No obvious effect */
3180 note = _("には効果がなかった。", " is unaffected.");
3183 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3185 else if (p_ptr->cursed & TRC_AGGRAVATE)
3187 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3188 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3192 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3195 chg_virtue(V_INDIVIDUALISM, -1);
3196 if (r_ptr->flags3 & RF3_ANIMAL)
3197 chg_virtue(V_NATURE, 1);
3200 /* No "real" damage */
3205 /* Control undead */
3206 case GF_CONTROL_UNDEAD:
3209 if (seen) obvious = TRUE;
3211 vir = virtue_number(V_UNLIFE);
3214 dam += p_ptr->virtues[vir-1]/10;
3217 vir = virtue_number(V_INDIVIDUALISM);
3220 dam -= p_ptr->virtues[vir-1]/20;
3223 /* Attempt a saving throw */
3224 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3225 !(r_ptr->flags3 & RF3_UNDEAD))
3227 /* No obvious effect */
3228 note = _("には効果がなかった。", " is unaffected.");
3230 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3232 else if (p_ptr->cursed & TRC_AGGRAVATE)
3234 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3235 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3239 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3243 /* No "real" damage */
3249 case GF_CONTROL_DEMON:
3252 if (seen) obvious = TRUE;
3254 vir = virtue_number(V_UNLIFE);
3257 dam += p_ptr->virtues[vir-1]/10;
3260 vir = virtue_number(V_INDIVIDUALISM);
3263 dam -= p_ptr->virtues[vir-1]/20;
3266 /* Attempt a saving throw */
3267 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3268 !(r_ptr->flags3 & RF3_DEMON))
3270 /* No obvious effect */
3271 note = _("には効果がなかった。", " is unaffected.");
3273 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3275 else if (p_ptr->cursed & TRC_AGGRAVATE)
3277 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3278 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3282 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3286 /* No "real" damage */
3292 case GF_CONTROL_ANIMAL:
3295 if (seen) obvious = TRUE;
3297 vir = virtue_number(V_NATURE);
3300 dam += p_ptr->virtues[vir-1]/10;
3303 vir = virtue_number(V_INDIVIDUALISM);
3306 dam -= p_ptr->virtues[vir-1]/20;
3309 /* Attempt a saving throw */
3310 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3311 !(r_ptr->flags3 & RF3_ANIMAL))
3314 /* No obvious effect */
3315 note = _("には効果がなかった。", " is unaffected.");
3317 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3319 else if (p_ptr->cursed & TRC_AGGRAVATE)
3321 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3322 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3326 note = _("はなついた。", " is tamed!");
3328 if (r_ptr->flags3 & RF3_ANIMAL)
3329 chg_virtue(V_NATURE, 1);
3332 /* No "real" damage */
3338 case GF_CHARM_LIVING:
3342 vir = virtue_number(V_UNLIFE);
3343 if (seen) obvious = TRUE;
3345 vir = virtue_number(V_UNLIFE);
3348 dam -= p_ptr->virtues[vir-1]/10;
3351 vir = virtue_number(V_INDIVIDUALISM);
3354 dam -= p_ptr->virtues[vir-1]/20;
3357 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3359 /* Attempt a saving throw */
3360 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3361 !monster_living(m_ptr->r_idx))
3364 /* No obvious effect */
3365 note = _("には効果がなかった。", " is unaffected.");
3367 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3369 else if (p_ptr->cursed & TRC_AGGRAVATE)
3371 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3372 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3376 note = _("を支配した。", " is tamed!");
3378 if (r_ptr->flags3 & RF3_ANIMAL)
3379 chg_virtue(V_NATURE, 1);
3382 /* No "real" damage */
3387 /* Confusion (Use "dam" as "power") */
3390 if (seen) obvious = TRUE;
3392 if (r_ptr->flagsr & RFR_RES_ALL)
3394 note = _("には効果がなかった。", " is unaffected.");
3396 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3399 /* Get confused later */
3400 do_conf = damroll(3, (dam / 2)) + 1;
3402 /* Attempt a saving throw */
3403 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3404 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3405 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3407 /* Memorize a flag */
3408 if (r_ptr->flags3 & (RF3_NO_CONF))
3410 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3416 /* No obvious effect */
3417 note = _("には効果がなかった。", " is unaffected.");
3421 /* No "real" damage */
3428 if (seen) obvious = TRUE;
3430 if (r_ptr->flagsr & RFR_RES_ALL)
3432 note = _("には効果がなかった。", " is unaffected.");
3434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3437 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3439 /* Attempt a saving throw */
3440 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3441 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3446 /* No obvious effect */
3447 note = _("には効果がなかった。", " is unaffected.");
3451 /* No "real" damage */
3459 /* Lite, but only hurts susceptible creatures */
3467 if (r_ptr->flagsr & RFR_RES_ALL)
3473 if (r_ptr->flags3 & (RF3_HURT_LITE))
3475 /* Obvious effect */
3476 if (seen) obvious = TRUE;
3478 /* Memorize the effects */
3479 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3481 /* Special effect */
3482 note = _("は光に身をすくめた!", " cringes from the light!");
3483 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3486 /* Normally no damage */
3498 /* Lite -- opposite of Dark */
3501 if (seen) obvious = TRUE;
3503 if (r_ptr->flagsr & RFR_RES_ALL)
3505 note = _("には完全な耐性がある!", " is immune.");
3507 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3510 if (r_ptr->flagsr & RFR_RES_LITE)
3512 note = _("には耐性がある!", " resists!");
3513 dam *= 2; dam /= (randint1(6)+6);
3514 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3516 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3518 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3519 note = _("は光に身をすくめた!", " cringes from the light!");
3520 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3527 /* Dark -- opposite of Lite */
3530 if (seen) obvious = TRUE;
3532 if (r_ptr->flagsr & RFR_RES_ALL)
3534 note = _("には完全な耐性がある!", " is immune.");
3536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3539 if (r_ptr->flagsr & RFR_RES_DARK)
3541 note = _("には耐性がある!", " resists!");
3542 dam *= 2; dam /= (randint1(6)+6);
3543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3552 if (r_ptr->flagsr & RFR_RES_ALL)
3557 /* Hurt by rock remover */
3558 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3561 if (seen) obvious = TRUE;
3563 /* Memorize the effects */
3564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3566 /* Cute little message */
3567 note = _("の皮膚がただれた!", " loses some skin!");
3568 note_dies = _("はドロドロに溶けた!", " dissolves!");
3571 /* Usually, ignore the effects */
3582 /* Teleport undead (Use "dam" as "power") */
3583 case GF_AWAY_UNDEAD:
3585 /* Only affect undead */
3586 if (r_ptr->flags3 & (RF3_UNDEAD))
3588 bool resists_tele = FALSE;
3590 if (r_ptr->flagsr & RFR_RES_TELE)
3592 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3595 note = _("には効果がなかった。", " is unaffected.");
3596 resists_tele = TRUE;
3598 else if (r_ptr->level > randint1(100))
3600 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3601 note = _("には耐性がある!", " resists!");
3602 resists_tele = TRUE;
3608 if (seen) obvious = TRUE;
3609 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3621 /* No "real" damage */
3627 /* Teleport evil (Use "dam" as "power") */
3630 /* Only affect evil */
3631 if (r_ptr->flags3 & (RF3_EVIL))
3633 bool resists_tele = FALSE;
3635 if (r_ptr->flagsr & RFR_RES_TELE)
3637 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3640 note = _("には効果がなかった。", " is unaffected.");
3641 resists_tele = TRUE;
3643 else if (r_ptr->level > randint1(100))
3645 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3646 note = _("には耐性がある!", " resists!");
3647 resists_tele = TRUE;
3653 if (seen) obvious = TRUE;
3654 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3666 /* No "real" damage */
3672 /* Teleport monster (Use "dam" as "power") */
3675 bool resists_tele = FALSE;
3676 if (r_ptr->flagsr & RFR_RES_TELE)
3678 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3680 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3681 note = _("には効果がなかった。", " is unaffected.");
3682 resists_tele = TRUE;
3684 else if (r_ptr->level > randint1(100))
3686 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3687 note = _("には耐性がある!", " resists!");
3688 resists_tele = TRUE;
3694 if (seen) obvious = TRUE;
3696 /* Prepare to teleport */
3700 /* No "real" damage */
3706 /* Turn undead (Use "dam" as "power") */
3707 case GF_TURN_UNDEAD:
3709 if (r_ptr->flagsr & RFR_RES_ALL)
3714 /* Only affect undead */
3715 if (r_ptr->flags3 & (RF3_UNDEAD))
3717 if (seen) obvious = TRUE;
3719 /* Learn about type */
3720 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3722 /* Apply some fear */
3723 do_fear = damroll(3, (dam / 2)) + 1;
3725 /* Attempt a saving throw */
3726 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3728 /* No obvious effect */
3729 note = _("には効果がなかった。", " is unaffected.");
3742 /* No "real" damage */
3748 /* Turn evil (Use "dam" as "power") */
3751 if (r_ptr->flagsr & RFR_RES_ALL)
3756 /* Only affect evil */
3757 if (r_ptr->flags3 & (RF3_EVIL))
3759 if (seen) obvious = TRUE;
3761 /* Learn about type */
3762 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3764 /* Apply some fear */
3765 do_fear = damroll(3, (dam / 2)) + 1;
3767 /* Attempt a saving throw */
3768 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3770 /* No obvious effect */
3771 note = _("には効果がなかった。", " is unaffected.");
3784 /* No "real" damage */
3790 /* Turn monster (Use "dam" as "power") */
3793 if (r_ptr->flagsr & RFR_RES_ALL)
3798 if (seen) obvious = TRUE;
3800 /* Apply some fear */
3801 do_fear = damroll(3, (dam / 2)) + 1;
3803 /* Attempt a saving throw */
3804 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3805 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3806 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3808 /* No obvious effect */
3809 note = _("には効果がなかった。", " is unaffected.");
3814 /* No "real" damage */
3821 case GF_DISP_UNDEAD:
3823 if (r_ptr->flagsr & RFR_RES_ALL)
3829 /* Only affect undead */
3830 if (r_ptr->flags3 & (RF3_UNDEAD))
3832 if (seen) obvious = TRUE;
3834 /* Learn about type */
3835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3837 note = _("は身震いした。", " shudders.");
3838 note_dies = _("はドロドロに溶けた!", " dissolves!");
3858 if (r_ptr->flagsr & RFR_RES_ALL)
3864 /* Only affect evil */
3865 if (r_ptr->flags3 & (RF3_EVIL))
3867 if (seen) obvious = TRUE;
3869 /* Learn about type */
3870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3872 note = _("は身震いした。", " shudders.");
3873 note_dies = _("はドロドロに溶けた!", " dissolves!");
3892 if (r_ptr->flagsr & RFR_RES_ALL)
3898 /* Only affect good */
3899 if (r_ptr->flags3 & (RF3_GOOD))
3901 if (seen) obvious = TRUE;
3903 /* Learn about type */
3904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3906 note = _("は身震いした。", " shudders.");
3907 note_dies = _("はドロドロに溶けた!", " dissolves!");
3924 case GF_DISP_LIVING:
3926 if (r_ptr->flagsr & RFR_RES_ALL)
3932 /* Only affect non-undead */
3933 if (monster_living(m_ptr->r_idx))
3935 if (seen) obvious = TRUE;
3937 note = _("は身震いした。", " shudders.");
3938 note_dies = _("はドロドロに溶けた!", " dissolves!");
3957 if (r_ptr->flagsr & RFR_RES_ALL)
3963 /* Only affect demons */
3964 if (r_ptr->flags3 & (RF3_DEMON))
3966 if (seen) obvious = TRUE;
3968 /* Learn about type */
3969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3971 note = _("は身震いした。", " shudders.");
3972 note_dies = _("はドロドロに溶けた!", " dissolves!");
3988 /* Dispel monster */
3991 if (r_ptr->flagsr & RFR_RES_ALL)
3997 if (seen) obvious = TRUE;
3999 note = _("は身震いした。", " shudders.");
4000 note_dies = _("はドロドロに溶けた!", " dissolves!");
4007 if (seen) obvious = TRUE;
4009 if (r_ptr->flagsr & RFR_RES_ALL)
4011 note = _("には完全な耐性がある!", " is immune.");
4013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4017 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4021 /* Heal the monster */
4022 if (caster_ptr->hp < caster_ptr->maxhp)
4025 caster_ptr->hp += dam;
4026 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4028 /* Redraw (later) if needed */
4029 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4030 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4032 /* Special message */
4035 monster_desc(killer, caster_ptr, 0);
4036 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4042 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4043 (void)hp_player(dam);
4048 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4057 if (seen) obvious = TRUE;
4058 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4060 if (r_ptr->flagsr & RFR_RES_ALL)
4062 note = _("には完全な耐性がある!", " is immune.");
4064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4068 /* Attempt a saving throw */
4069 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4070 (r_ptr->flags3 & RF3_NO_CONF) ||
4071 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4073 /* Memorize a flag */
4074 if (r_ptr->flags3 & (RF3_NO_CONF))
4076 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4078 note = _("には効果がなかった。", " is unaffected.");
4081 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4083 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4084 note = _("には完全な耐性がある!", " is immune.");
4087 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4089 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4090 note = _("には耐性がある。", " resists.");
4095 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4096 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4098 if (who > 0) do_conf = randint0(4) + 4;
4099 else do_conf = randint0(8) + 8;
4105 case GF_BRAIN_SMASH:
4107 if (seen) obvious = TRUE;
4108 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4110 if (r_ptr->flagsr & RFR_RES_ALL)
4112 note = _("には完全な耐性がある!", " is immune.");
4114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4118 /* Attempt a saving throw */
4119 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4120 (r_ptr->flags3 & RF3_NO_CONF) ||
4121 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4123 /* Memorize a flag */
4124 if (r_ptr->flags3 & (RF3_NO_CONF))
4126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4128 note = _("には効果がなかった。", " is unaffected.");
4131 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4134 note = _("には完全な耐性がある!", " is immune.");
4137 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4140 note = _("には耐性がある!", " resists!");
4145 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4146 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4150 do_conf = randint0(4) + 4;
4151 do_stun = randint0(4) + 4;
4155 do_conf = randint0(8) + 8;
4156 do_stun = randint0(8) + 8;
4158 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4166 if (seen) obvious = TRUE;
4167 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4169 if (r_ptr->flagsr & RFR_RES_ALL)
4171 note = _("には完全な耐性がある!", " is immune.");
4173 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4177 /* Attempt a saving throw */
4178 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4180 note = _("には効果がなかった。", " is unaffected.");
4189 if (seen) obvious = TRUE;
4190 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4192 if (r_ptr->flagsr & RFR_RES_ALL)
4194 note = _("には完全な耐性がある!", " is immune.");
4196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4200 /* Attempt a saving throw */
4201 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4203 note = _("には効果がなかった。", " is unaffected.");
4212 if (seen) obvious = TRUE;
4213 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4215 if (r_ptr->flagsr & RFR_RES_ALL)
4217 note = _("には完全な耐性がある!", " is immune.");
4219 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4223 /* Attempt a saving throw */
4224 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4226 note = _("には効果がなかった。", " is unaffected.");
4235 if (seen) obvious = TRUE;
4237 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4238 "You point at %s, screaming the word, 'DIE!'."), m_name);
4240 if (r_ptr->flagsr & RFR_RES_ALL)
4242 note = _("には完全な耐性がある!", " is immune.");
4244 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4248 /* Attempt a saving throw */
4249 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4251 note = _("には効果がなかった。", " is unaffected.");
4260 if (seen) obvious = TRUE;
4262 if (r_ptr->flagsr & RFR_RES_ALL)
4264 note = _("には完全な耐性がある!", " is immune.");
4266 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4270 if (r_ptr->flags1 & RF1_UNIQUE)
4272 note = _("には効果がなかった。", " is unaffected.");
4277 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4278 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4280 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4282 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4286 note = _("は耐性を持っている!", "resists!");
4293 /* Capture monster */
4297 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4298 (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)
4300 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4305 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4306 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4307 nokori_hp = m_ptr->maxhp * 3 / 10;
4309 nokori_hp = m_ptr->maxhp * 3 / 20;
4311 if (m_ptr->hp >= nokori_hp)
4313 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4316 else if (m_ptr->hp < randint0(nokori_hp))
4318 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4319 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4320 cap_mon = m_ptr->r_idx;
4321 cap_mspeed = m_ptr->mspeed;
4323 cap_maxhp = m_ptr->max_maxhp;
4324 cap_nickname = m_ptr->nickname; /* Quark transfer */
4325 if (c_ptr->m_idx == p_ptr->riding)
4327 if (rakuba(-1, FALSE))
4329 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4333 delete_monster_idx(c_ptr->m_idx);
4339 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4345 /* Attack (Use "dam" as attack type) */
4348 /* Return this monster's death */
4349 return py_attack(y, x, dam);
4352 /* Sleep (Use "dam" as "power") */
4358 if (seen) obvious = TRUE;
4360 if (r_ptr->flagsr & RFR_RES_ALL)
4362 note = _("には効果がなかった。", " is unaffected.");
4364 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4367 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4369 note = _("には効果がなかった。", " is unaffected.");
4372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4375 if (MON_CSLEEP(m_ptr))
4377 note = _("には効果がなかった。", " is unaffected.");
4383 if (one_in_(5)) effect = 1;
4384 else if (one_in_(4)) effect = 2;
4385 else if (one_in_(3)) effect = 3;
4390 /* Powerful monsters can resist */
4391 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4392 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4394 note = _("には効果がなかった。", " is unaffected.");
4398 /* Normal monsters slow down */
4401 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4403 note = _("の動きが遅くなった。", " starts moving slower.");
4408 else if (effect == 2)
4410 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4412 /* Attempt a saving throw */
4413 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4414 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4419 /* No obvious effect */
4420 note = _("には効果がなかった。", " is unaffected.");
4425 else if (effect == 3)
4427 /* Attempt a saving throw */
4428 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4429 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4430 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4432 /* Memorize a flag */
4433 if (r_ptr->flags3 & RF3_NO_SLEEP)
4435 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4438 /* No obvious effect */
4439 note = _("には効果がなかった。", " is unaffected.");
4444 /* Go to sleep (much) later */
4445 note = _("は眠り込んでしまった!", " falls asleep!");
4452 note = _("には効果がなかった。", " is unaffected.");
4455 /* No "real" damage */
4463 if (seen) obvious = TRUE;
4465 if (r_ptr->flagsr & RFR_RES_ALL)
4467 note = _("には効果がなかった。", " is unaffected.");
4469 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4473 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4475 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4476 chg_virtue(V_VITALITY, -1);
4486 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4488 if (r_ptr->flags3 & (RF3_HURT_LITE))
4490 /* Obvious effect */
4491 if (seen) obvious = TRUE;
4493 /* Memorize the effects */
4494 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4496 /* Special effect */
4497 note = _("は光に身をすくめた!", " cringes from the light!");
4498 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4501 /* Normally no damage */
4508 photo = m_ptr->r_idx;
4515 case GF_BLOOD_CURSE:
4517 if (seen) obvious = TRUE;
4519 if (r_ptr->flagsr & RFR_RES_ALL)
4521 note = _("には完全な耐性がある!", " is immune.");
4523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4531 bool success = FALSE;
4532 if (seen) obvious = TRUE;
4534 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4536 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4537 if (dam < 1) dam = 1;
4539 /* No need to tame your pet */
4542 note = _("の動きが速くなった。", " starts moving faster.");
4543 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4547 /* Attempt a saving throw */
4548 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4549 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4550 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4551 (p_ptr->cursed & TRC_AGGRAVATE) ||
4552 ((r_ptr->level+10) > randint1(dam)))
4555 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4559 note = _("を支配した。", " is tamed!");
4561 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4563 /* Learn about type */
4564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4571 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4573 do_fear = randint1(90)+10;
4575 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4578 /* No "real" damage */
4585 if (seen) obvious = TRUE;
4587 if (r_ptr->flagsr & RFR_RES_ALL)
4589 note = _("には完全な耐性がある!", " is immune.");
4591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4595 /* Attempt a saving throw */
4596 if (randint0(100 + dam) < (r_ptr->level + 50))
4598 note = _("には効果がなかった。", " is unaffected.");
4618 /* Absolutely no effect */
4619 if (skipped) return (FALSE);
4621 /* "Unique" monsters cannot be polymorphed */
4622 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4624 /* Quest monsters cannot be polymorphed */
4625 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4627 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4629 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4630 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4632 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4637 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4638 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4641 /* Modify the damage */
4643 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4644 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4646 /* Check for death */
4647 if (dam > m_ptr->hp)
4649 /* Extract method of death */
4654 /* Sound and Impact resisters never stun */
4656 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4657 !(r_ptr->flags3 & RF3_NO_STUN))
4659 if (seen) obvious = TRUE;
4662 if (MON_STUNNED(m_ptr))
4664 note = _("はひどくもうろうとした。", " is more dazed.");
4665 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4669 note = _("はもうろうとした。", " is dazed.");
4674 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4680 /* Confusion and Chaos resisters (and sleepers) never confuse */
4682 !(r_ptr->flags3 & RF3_NO_CONF) &&
4683 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4685 if (seen) obvious = TRUE;
4687 /* Already partially confused */
4688 if (MON_CONFUSED(m_ptr))
4690 note = _("はさらに混乱したようだ。", " looks more confused.");
4691 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4694 /* Was not confused */
4697 note = _("は混乱したようだ。", " looks confused.");
4701 /* Apply confusion */
4702 (void)set_monster_confused(c_ptr->m_idx, tmp);
4710 if (seen) obvious = TRUE;
4712 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4716 note = _("は弱くなったようだ。", " seems weakened.");
4717 m_ptr->maxhp -= do_time;
4718 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4723 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4724 if (do_poly && (randint1(90) > r_ptr->level))
4726 if (polymorph_monster(y, x))
4728 if (seen) obvious = TRUE;
4730 /* Monster polymorphs */
4731 note = _("が変身した!", " changes!");
4733 /* Turn off the damage */
4739 note = _("には効果がなかった。", " is unaffected.");
4742 /* Hack -- Get new monster */
4743 m_ptr = &m_list[c_ptr->m_idx];
4745 /* Hack -- Get new race */
4746 r_ptr = &r_info[m_ptr->r_idx];
4749 /* Handle "teleport" */
4752 if (seen) obvious = TRUE;
4754 note = _("が消え去った!", " disappears!");
4756 if (!who) chg_virtue(V_VALOUR, -1);
4759 teleport_away(c_ptr->m_idx, do_dist,
4760 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4762 /* Hack -- get new location */
4766 /* Hack -- get new grid */
4767 c_ptr = &cave[y][x];
4774 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4781 if (typ == GF_DRAIN_MANA)
4783 /* Drain mana does nothing */
4786 /* If another monster did the damage, hurt the monster by hand */
4789 /* Redraw (later) if needed */
4790 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4791 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4793 /* Wake the monster up */
4794 (void)set_monster_csleep(c_ptr->m_idx, 0);
4796 /* Hurt the monster */
4804 if (is_pet(m_ptr) && !(m_ptr->ml))
4807 /* Give detailed messages if destroyed */
4810 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4813 msg_format("%^s%s", m_name, note);
4821 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4823 /* Generate treasure, etc */
4824 monster_death(c_ptr->m_idx, FALSE);
4827 delete_monster_idx(c_ptr->m_idx);
4831 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4835 /* Damaged monster */
4838 /* Give detailed messages if visible or destroyed */
4839 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4841 /* Hack -- Pain message */
4844 message_pain(c_ptr->m_idx, dam);
4851 /* Hack -- handle sleep */
4852 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4856 else if (heal_leper)
4858 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4860 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4862 char m2_name[MAX_NLEN];
4864 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4865 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4868 delete_monster_idx(c_ptr->m_idx);
4871 /* If the player did it, give him experience, check fear */
4876 /* Hurt the monster, check for fear and death */
4877 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4882 /* Damaged monster */
4885 /* HACK - anger the monster before showing the sleep message */
4886 if (do_sleep) anger_monster(m_ptr);
4888 /* Give detailed messages if visible or destroyed */
4889 if (note && seen_msg)
4890 msg_format(_("%s%s", "%^s%s"), m_name, note);
4892 /* Hack -- Pain message */
4893 else if (known && (dam || !do_fear))
4895 message_pain(c_ptr->m_idx, dam);
4898 /* Anger monsters */
4899 if (((dam > 0) || get_angry) && !do_sleep)
4900 anger_monster(m_ptr);
4902 if ((fear || do_fear) && seen)
4905 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4908 /* Hack -- handle sleep */
4909 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4913 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4915 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4919 switch (randint1(28))
4924 msg_print(_("地面が揺れた...", "The ground trembles..."));
4925 earthquake(ty, tx, 4 + randint0(4));
4926 if (!one_in_(6)) break;
4928 case 3: case 4: case 5: case 6:
4931 int extra_dam = damroll(10, 10);
4932 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4934 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4935 if (!one_in_(6)) break;
4940 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4942 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4943 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4944 if (!one_in_(6)) break;
4946 case 9: case 10: case 11:
4947 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4948 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4949 if (!one_in_(6)) break;
4950 case 12: case 13: case 14: case 15: case 16:
4951 aggravate_monsters(0);
4952 if (!one_in_(6)) break;
4954 count += activate_hi_summon(ty, tx, TRUE);
4955 if (!one_in_(6)) break;
4956 case 19: case 20: case 21: case 22:
4958 bool pet = !one_in_(3);
4959 BIT_FLAGS mode = PM_ALLOW_GROUP;
4961 if (pet) mode |= PM_FORCE_PET;
4962 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4964 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');
4965 if (!one_in_(6)) break;
4967 case 23: case 24: case 25:
4968 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4969 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4971 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4972 else lose_exp(p_ptr->exp / 16);
4973 if (!one_in_(6)) break;
4974 case 26: case 27: case 28:
4983 (void)do_dec_stat(i);
4992 (void)do_dec_stat(randint0(6));
5001 if (p_ptr->inside_battle)
5003 p_ptr->health_who = c_ptr->m_idx;
5004 p_ptr->redraw |= (PR_HEALTH);
5008 /* Verify this code */
5009 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5011 /* Redraw the monster grid */
5015 /* Update monster recall window */
5016 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5018 p_ptr->window |= (PW_MONSTER);
5021 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5025 if (!(flg & PROJECT_NO_HANGEKI))
5027 set_target(m_ptr, monster_target_y, monster_target_x);
5030 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5032 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5036 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5038 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5039 rakubadam_m = (dam > 200) ? 200 : dam;
5049 /* Prepare to make a Blade of Chaos */
5050 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5052 q_ptr->pval = photo;
5054 /* Mark the item as fully known */
5055 q_ptr->ident |= (IDENT_MENTAL);
5056 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5064 /* Return "Anything seen?" */
5069 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5070 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5071 * @param who_name 効果を起こしたモンスターの名前
5072 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5073 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5074 * @param x 目標X座標 / Target x location (or location to travel "towards")
5075 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5076 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5078 * @param monspell 効果元のモンスター魔法ID
5079 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5081 * Handle a beam/bolt/ball causing damage to the player.
5082 * This routine takes a "source monster" (by index), a "distance", a default
5083 * "damage", and a "damage type". See "project_m()" above.
5084 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5085 * is reduced (see "project_m()" above). This can happen if a monster breathes
5086 * at the player and hits a wall instead.
5087 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5088 * to know if this is actually a ball or a bolt spell
5089 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5090 * we just assume that the effects were obvious, for historical reasons.
5092 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5097 /* Hack -- assume obvious */
5098 bool obvious = TRUE;
5100 /* Player blind-ness */
5101 bool blind = (p_ptr->blind ? TRUE : FALSE);
5103 /* Player needs a "description" (he is blind) */
5106 /* Source monster */
5107 monster_type *m_ptr = NULL;
5109 /* Monster name (for attacks) */
5110 GAME_TEXT m_name[MAX_NLEN];
5112 /* Monster name (for damage) */
5115 /* Hack -- messages */
5121 /* Player is not here */
5122 if (!player_bold(y, x)) return (FALSE);
5124 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5126 if (kawarimi(TRUE)) return FALSE;
5129 /* Player cannot hurt himself */
5130 if (!who) return (FALSE);
5131 if (who == p_ptr->riding) return (FALSE);
5133 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5136 int max_attempts = 10;
5137 sound(SOUND_REFLECT);
5140 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5141 else if (p_ptr->special_defense & KATA_FUUJIN)
5142 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5144 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5147 /* Choose 'new' target */
5152 t_y = m_list[who].fy - 1 + randint1(3);
5153 t_x = m_list[who].fx - 1 + randint1(3);
5156 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5158 if (max_attempts < 1)
5160 t_y = m_list[who].fy;
5161 t_x = m_list[who].fx;
5166 t_y = p_ptr->y - 1 + randint1(3);
5167 t_x = p_ptr->x - 1 + randint1(3);
5170 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5172 disturb(TRUE, TRUE);
5176 /* Limit maximum damage */
5177 if (dam > 1600) dam = 1600;
5179 /* Reduce damage by distance */
5180 dam = (dam + r) / (r + 1);
5183 /* If the player is blind, be more descriptive */
5184 if (blind) fuzzy = TRUE;
5189 m_ptr = &m_list[who];
5190 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5191 monster_desc(m_name, m_ptr, 0);
5193 /* Get the monster's real name (gotten before polymorph!) */
5194 strcpy(killer, who_name);
5200 case PROJECT_WHO_UNCTRL_POWER:
5201 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5204 case PROJECT_WHO_GLASS_SHARDS:
5205 strcpy(killer, _("ガラスの破片", "shards of glass"));
5209 strcpy(killer, _("罠", "a trap"));
5214 strcpy(m_name, killer);
5217 /* Analyze the damage */
5220 /* Standard damage -- hurts inventory too */
5223 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5224 get_damage = acid_dam(dam, killer, monspell, FALSE);
5228 /* Standard damage -- hurts inventory too */
5231 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5232 get_damage = fire_dam(dam, killer, monspell, FALSE);
5236 /* Standard damage -- hurts inventory too */
5239 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5240 get_damage = cold_dam(dam, killer, monspell, FALSE);
5244 /* Standard damage -- hurts inventory too */
5247 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5248 get_damage = elec_dam(dam, killer, monspell, FALSE);
5252 /* Standard damage -- also poisons player */
5255 bool double_resist = IS_OPPOSE_POIS();
5256 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5258 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5259 if (double_resist) dam = (dam + 2) / 3;
5261 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5266 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5268 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5270 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5275 /* Standard damage -- also poisons / mutates player */
5278 bool double_resist = IS_OPPOSE_POIS();
5279 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5281 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5282 if (double_resist) dam = (2 * dam + 2) / 5;
5283 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5284 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5286 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5288 if (one_in_(5)) /* 6 */
5290 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5291 if (one_in_(4)) /* 4 */
5299 inven_damage(set_acid_destroy, 2);
5305 /* Standard damage */
5308 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5309 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5313 /* Holy Orb -- Player only takes partial damage */
5316 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5317 if (p_ptr->align > 10)
5319 else if (p_ptr->align < -10)
5321 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5327 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5328 if (p_ptr->align > 10)
5330 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5334 /* Arrow -- XXX no dodging */
5339 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5341 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5343 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5346 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5350 /* Plasma -- XXX No resist */
5353 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5354 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5356 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5358 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5359 (void)set_stun(p_ptr->stun + plus_stun);
5362 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5364 inven_damage(set_acid_destroy, 3);
5370 /* Nether -- drain experience */
5373 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5374 if (p_ptr->resist_neth)
5376 if (!prace_is_(RACE_SPECTRE))
5378 dam *= 6; dam /= (randint1(4) + 7);
5381 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5383 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5385 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5387 learn_spell(monspell);
5391 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5397 /* Water -- stun/confuse */
5400 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5401 if (!CHECK_MULTISHADOW())
5403 if (!p_ptr->resist_sound)
5405 set_stun(p_ptr->stun + randint1(40));
5407 if (!p_ptr->resist_conf)
5409 set_confused(p_ptr->confused + randint1(5) + 5);
5414 inven_damage(set_cold_destroy, 3);
5418 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5422 /* Chaos -- many effects */
5425 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5426 if (p_ptr->resist_chaos)
5428 dam *= 6; dam /= (randint1(4) + 7);
5431 if (!CHECK_MULTISHADOW())
5433 if (!p_ptr->resist_conf)
5435 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5437 if (!p_ptr->resist_chaos)
5439 (void)set_image(p_ptr->image + randint1(10));
5442 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5443 (void)gain_random_mutation(0);
5446 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5448 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5451 if (!p_ptr->resist_chaos || one_in_(9))
5453 inven_damage(set_elec_destroy, 2);
5454 inven_damage(set_fire_destroy, 2);
5458 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5462 /* Shards -- mostly cutting */
5465 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5466 if (p_ptr->resist_shard)
5468 dam *= 6; dam /= (randint1(4) + 7);
5470 else if (!CHECK_MULTISHADOW())
5472 (void)set_cut(p_ptr->cut + dam);
5475 if (!p_ptr->resist_shard || one_in_(13))
5477 inven_damage(set_cold_destroy, 2);
5480 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5484 /* Sound -- mostly stunning */
5487 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5488 if (p_ptr->resist_sound)
5490 dam *= 5; dam /= (randint1(4) + 7);
5492 else if (!CHECK_MULTISHADOW())
5494 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5495 (void)set_stun(p_ptr->stun + plus_stun);
5498 if (!p_ptr->resist_sound || one_in_(13))
5500 inven_damage(set_cold_destroy, 2);
5503 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5507 /* Pure confusion */
5510 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5511 if (p_ptr->resist_conf)
5513 dam *= 5; dam /= (randint1(4) + 7);
5515 else if (!CHECK_MULTISHADOW())
5517 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5519 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5523 /* Disenchantment -- see above */
5526 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5527 if (p_ptr->resist_disen)
5529 dam *= 6; dam /= (randint1(4) + 7);
5531 else if (!CHECK_MULTISHADOW())
5533 (void)apply_disenchant(0);
5535 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5539 /* Nexus -- see above */
5542 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5543 if (p_ptr->resist_nexus)
5545 dam *= 6; dam /= (randint1(4) + 7);
5547 else if (!CHECK_MULTISHADOW())
5551 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5555 /* Force -- mostly stun */
5558 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5559 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5561 (void)set_stun(p_ptr->stun + randint1(20));
5563 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5568 /* Rocket -- stun, cut */
5571 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5572 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5574 (void)set_stun(p_ptr->stun + randint1(20));
5577 if (p_ptr->resist_shard)
5581 else if (!CHECK_MULTISHADOW())
5583 (void)set_cut(p_ptr->cut + (dam / 2));
5586 if (!p_ptr->resist_shard || one_in_(12))
5588 inven_damage(set_cold_destroy, 3);
5591 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5595 /* Inertia -- slowness */
5598 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5599 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5600 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5604 /* Lite -- blinding */
5607 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5608 if (p_ptr->resist_lite)
5610 dam *= 4; dam /= (randint1(4) + 7);
5612 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5614 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5617 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5619 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5622 else if (prace_is_(RACE_S_FAIRY))
5627 if (p_ptr->wraith_form) dam *= 2;
5628 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5630 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5632 p_ptr->wraith_form = 0;
5633 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5634 "The light forces you out of your incorporeal shadow form."));
5636 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5637 p_ptr->update |= (PU_MONSTERS);
5638 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5644 /* Dark -- blinding */
5647 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5648 if (p_ptr->resist_dark)
5650 dam *= 4; dam /= (randint1(4) + 7);
5652 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5654 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5656 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5658 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5662 /* Time -- bolt fewer effects XXX */
5665 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5666 if (p_ptr->resist_time)
5669 dam /= (randint1(4) + 7);
5670 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5672 else if (!CHECK_MULTISHADOW())
5674 switch (randint1(10))
5676 case 1: case 2: case 3: case 4: case 5:
5678 if (p_ptr->prace == RACE_ANDROID) break;
5679 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5680 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5684 case 6: case 7: case 8: case 9:
5686 switch (randint1(6))
5688 case 1: k = A_STR; act = _("強く", "strong"); break;
5689 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5690 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5691 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5692 case 5: k = A_CON; act = _("健康で", "hale"); break;
5693 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5696 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5697 "You're not as %s as you used to be..."), act);
5699 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5700 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5701 p_ptr->update |= (PU_BONUS);
5707 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5708 "You're not as powerful as you used to be..."));
5710 for (k = 0; k < A_MAX; k++)
5712 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5713 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5715 p_ptr->update |= (PU_BONUS);
5721 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5725 /* Gravity -- stun plus slowness plus teleport */
5728 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5729 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5731 if (!CHECK_MULTISHADOW())
5733 teleport_player(5, TELEPORT_PASSIVE);
5734 if (!p_ptr->levitation)
5735 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5736 if (!(p_ptr->resist_sound || p_ptr->levitation))
5738 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5739 (void)set_stun(p_ptr->stun + plus_stun);
5742 if (p_ptr->levitation)
5744 dam = (dam * 2) / 3;
5747 if (!p_ptr->levitation || one_in_(13))
5749 inven_damage(set_cold_destroy, 2);
5752 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5756 /* Standard damage */
5757 case GF_DISINTEGRATE:
5759 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5761 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5767 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5769 (void)hp_player(dam);
5776 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5777 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5784 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5785 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5791 if (p_ptr->free_act) break;
5792 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5794 if (ironman_nightmare)
5796 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5797 /* Have some nightmares */
5798 sanity_blast(NULL, FALSE);
5801 set_paralyzed(p_ptr->paralyzed + dam);
5811 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5812 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5819 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5820 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5827 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5829 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5830 if (!p_ptr->resist_shard || one_in_(13))
5832 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5833 inven_damage(set_cold_destroy, 2);
5839 /* Ice -- cold plus stun plus cuts */
5842 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5843 get_damage = cold_dam(dam, killer, monspell, FALSE);
5844 if (!CHECK_MULTISHADOW())
5846 if (!p_ptr->resist_shard)
5848 (void)set_cut(p_ptr->cut + damroll(5, 8));
5850 if (!p_ptr->resist_sound)
5852 (void)set_stun(p_ptr->stun + randint1(15));
5855 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5857 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5867 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5869 if (p_ptr->mimic_form)
5871 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5872 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5877 switch (p_ptr->prace)
5879 /* Some races are immune */
5893 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5905 if (CHECK_MULTISHADOW())
5907 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5909 else if (p_ptr->csp)
5913 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5915 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5918 if (dam >= p_ptr->csp)
5922 p_ptr->csp_frac = 0;
5931 learn_spell(monspell);
5932 p_ptr->redraw |= (PR_MANA);
5933 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5937 /* Heal the monster */
5938 if (m_ptr->hp < m_ptr->maxhp)
5942 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5944 /* Redraw (later) if needed */
5945 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5946 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5948 /* Special message */
5951 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5964 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5966 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5967 learn_spell(monspell);
5971 if (!CHECK_MULTISHADOW())
5973 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5975 if (!p_ptr->resist_conf)
5977 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5980 if (!p_ptr->resist_chaos && one_in_(3))
5982 (void)set_image(p_ptr->image + randint0(250) + 150);
5989 p_ptr->csp_frac = 0;
5991 p_ptr->redraw |= PR_MANA;
5994 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6000 case GF_BRAIN_SMASH:
6002 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6004 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6005 learn_spell(monspell);
6009 if (!CHECK_MULTISHADOW())
6011 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6017 p_ptr->csp_frac = 0;
6019 p_ptr->redraw |= PR_MANA;
6022 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6023 if (!CHECK_MULTISHADOW())
6025 if (!p_ptr->resist_blind)
6027 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6029 if (!p_ptr->resist_conf)
6031 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6033 if (!p_ptr->free_act)
6035 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6037 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6039 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6040 (void)do_dec_stat(A_INT);
6041 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6042 (void)do_dec_stat(A_WIS);
6044 if (!p_ptr->resist_chaos)
6046 (void)set_image(p_ptr->image + randint0(250) + 150);
6056 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6058 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6059 learn_spell(monspell);
6063 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6064 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6072 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6074 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6075 learn_spell(monspell);
6079 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6080 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6088 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6090 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6091 learn_spell(monspell);
6095 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6096 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6104 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6106 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6107 learn_spell(monspell);
6111 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6112 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6120 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6122 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6123 learn_spell(monspell);
6127 if (!CHECK_MULTISHADOW())
6129 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6130 curse_equipment(40, 20);
6133 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6135 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6150 /* Hex - revenge damage stored */
6151 revenge_store(get_damage);
6153 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6154 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6156 GAME_TEXT m_name_self[80];
6159 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6161 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6162 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6163 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6166 if (p_ptr->riding && dam > 0)
6168 rakubadam_p = (dam > 200) ? 200 : dam;
6172 disturb(TRUE, TRUE);
6175 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6177 (void)kawarimi(FALSE);
6180 /* Return "Anything seen?" */
6186 * Find the distance from (x, y) to a line.
6188 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6190 /* Vector from (x, y) to (x1, y1) */
6191 POSITION py = y1 - y;
6192 POSITION px = x1 - x;
6195 POSITION ny = x2 - x1;
6196 POSITION nx = y1 - y2;
6199 POSITION pd = distance(y1, x1, y, x);
6200 POSITION nd = distance(y1, x1, y2, x2);
6202 if (pd > nd) return distance(y, x, y2, x2);
6204 /* Component of P on N */
6205 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6207 /* Absolute value */
6208 return((nd >= 0) ? nd : 0 - nd);
6215 * Modified version of los() for calculation of disintegration balls.
6216 * Disintegration effects are stopped by permanent walls.
6218 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6220 POSITION dx, dy; /* Delta */
6221 POSITION ax, ay; /* Absolute */
6222 POSITION sx, sy; /* Signs */
6223 POSITION qx, qy; /* Fractions */
6224 POSITION tx, ty; /* Scanners */
6225 POSITION f1, f2; /* Scale factors */
6226 POSITION m; /* Slope, or 1/Slope, of LOS */
6228 /* Extract the offset */
6232 /* Extract the absolute offset */
6236 /* Handle adjacent (or identical) grids */
6237 if ((ax < 2) && (ay < 2)) return (TRUE);
6239 /* Paranoia -- require "safe" origin */
6240 /* if (!in_bounds(y1, x1)) return (FALSE); */
6242 /* Directly South/North */
6245 /* South -- check for walls */
6248 for (ty = y1 + 1; ty < y2; ty++)
6250 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6254 /* North -- check for walls */
6257 for (ty = y1 - 1; ty > y2; ty--)
6259 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6267 /* Directly East/West */
6270 /* East -- check for walls */
6273 for (tx = x1 + 1; tx < x2; tx++)
6275 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6279 /* West -- check for walls */
6282 for (tx = x1 - 1; tx > x2; tx--)
6284 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6292 /* Extract some signs */
6293 sx = (dx < 0) ? -1 : 1;
6294 sy = (dy < 0) ? -1 : 1;
6296 /* Vertical "knights" */
6301 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6305 /* Horizontal "knights" */
6310 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6314 /* Calculate scale factor div 2 */
6317 /* Calculate scale factor */
6321 /* Travel horizontally */
6324 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6330 /* Consider the special case where slope == 1. */
6341 /* Note (below) the case (qy == f2), where */
6342 /* the LOS exactly meets the corner of a tile. */
6345 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6356 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6369 /* Travel vertically */
6372 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6388 /* Note (below) the case (qx == f2), where */
6389 /* the LOS exactly meets the corner of a tile. */
6392 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6403 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6424 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)
6429 int brev = rad * rad / dist;
6433 int mdis = distance(y1, x1, y2, x2) + rad;
6435 while (bdis <= mdis)
6439 if ((0 < dist) && (path_n < dist))
6441 POSITION ny = GRID_Y(path_g[path_n]);
6442 POSITION nx = GRID_X(path_g[path_n]);
6443 POSITION nd = distance(ny, nx, y1, x1);
6445 /* Get next base point */
6454 /* Travel from center outward */
6455 for (cdis = 0; cdis <= brad; cdis++)
6457 /* Scan the maximal blast area of radius "cdis" */
6458 for (y = by - cdis; y <= by + cdis; y++)
6460 for (x = bx - cdis; x <= bx + cdis; x++)
6462 /* Ignore "illegal" locations */
6463 if (!in_bounds(y, x)) continue;
6465 /* Enforce a circular "ripple" */
6466 if (distance(y1, x1, y, x) != bdis) continue;
6468 /* Enforce an arc */
6469 if (distance(by, bx, y, x) != cdis) continue;
6475 /* Lights are stopped by opaque terrains */
6476 if (!los(by, bx, y, x)) continue;
6478 case GF_DISINTEGRATE:
6479 /* Disintegration are stopped only by perma-walls */
6480 if (!in_disintegration_range(by, bx, y, x)) continue;
6483 /* Ball explosions are stopped by walls */
6484 if (!projectable(by, bx, y, x)) continue;
6488 /* Save this grid */
6496 /* Encode some more "radius" info */
6497 gm[bdis + 1] = *pgrids;
6499 /* Increase the size */
6500 brad = rad * (path_n + brev) / (dist + brev);
6502 /* Find the next ripple */
6506 /* Store the effect size */
6512 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6513 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6514 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6515 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6516 * @param x 目標X座標 / Target x location (or location to travel "towards")
6517 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6518 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6519 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6520 * @param monspell 効果元のモンスター魔法ID
6521 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6524 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6525 * towards a given location (optionally passing over the heads of interposing
6526 * monsters), and have it do a given amount of damage to the monsters (and
6527 * optionally objects) within the given radius of the final location.
6529 * A "bolt" travels from source to target and affects only the target grid.
6530 * A "beam" travels from source to target, affecting all grids passed through.
6531 * A "ball" travels from source to the target, exploding at the target, and
6532 * affecting everything within the given radius of the target location.
6534 * Traditionally, a "bolt" does not affect anything on the ground, and does
6535 * not pass over the heads of interposing monsters, much like a traditional
6536 * missile, and will "stop" abruptly at the "target" even if no monster is
6537 * positioned there, while a "ball", on the other hand, passes over the heads
6538 * of monsters between the source and target, and affects everything except
6539 * the source monster which lies within the final radius, while a "beam"
6540 * affects every monster between the source and target, except for the casting
6541 * monster (or player), and rarely affects things on the ground.
6543 * Two special flags allow us to use this function in special ways, the
6544 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6545 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6546 * actually projecting from the source monster (or player).
6548 * The player will only get "experience" for monsters killed by himself
6549 * Unique monsters can only be destroyed by attacks from the player
6551 * Only 256 grids can be affected per projection, limiting the effective
6552 * "radius" of standard ball attacks to nine units (diameter nineteen).
6554 * One can project in a given "direction" by combining PROJECT_THRU with small
6555 * offsets to the initial location (see "line_spell()"), or by calculating
6556 * "virtual targets" far away from the player.
6558 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6559 * continuing until it actually hits somethings (useful for "stone to mud").
6561 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6563 * Balls must explode BEFORE hitting walls, or they would affect monsters
6564 * on both sides of a wall. Some bug reports indicate that this is still
6565 * happening in 2.7.8 for Windows, though it appears to be impossible.
6567 * We "pre-calculate" the blast area only in part for efficiency.
6568 * More importantly, this lets us do "explosions" from the "inside" out.
6569 * This results in a more logical distribution of "blast" treasure.
6570 * It also produces a better (in my opinion) animation of the explosion.
6571 * It could be (but is not) used to have the treasure dropped by monsters
6572 * in the middle of the explosion fall "outwards", and then be damaged by
6573 * the blast as it spreads outwards towards the treasure drop location.
6575 * Walls and doors are included in the blast area, so that they can be
6576 * "burned" or "melted" in later versions.
6578 * This algorithm is intended to maximize simplicity, not necessarily
6579 * efficiency, since this function is not a bottleneck in the code.
6581 * We apply the blast effect from ground zero outwards, in several passes,
6582 * first affecting features, then objects, then monsters, then the player.
6583 * This allows walls to be removed before checking the object or monster
6584 * in the wall, and protects objects which are dropped by monsters killed
6585 * in the blast, and allows the player to see all affects before he is
6586 * killed or teleported away. The semantics of this method are open to
6587 * various interpretations, but they seem to work well in practice.
6589 * We process the blast area from ground-zero outwards to allow for better
6590 * distribution of treasure dropped by monsters, and because it provides a
6591 * pleasing visual effect at low cost.
6593 * Note that the damage done by "ball" explosions decreases with distance.
6594 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6596 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6597 * the target, and then the damage "flows" along this beam of destruction.
6598 * The damage at every grid is the same as at the "center" of a "ball"
6599 * explosion, since the "beam" grids are treated as if they ARE at the
6600 * center of a "ball" explosion.
6602 * Currently, specifying "beam" plus "ball" means that locations which are
6603 * covered by the initial "beam", and also covered by the final "ball", except
6604 * for the final grid (the epicenter of the ball), will be "hit twice", once
6605 * by the initial beam, and once by the exploding ball. For the grid right
6606 * next to the epicenter, this results in 150% damage being done. The center
6607 * does not have this problem, for the same reason the final grid in a "beam"
6608 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6609 * grids which are covered by the "ball" will NOT work, as then they will
6610 * receive LESS damage than they should. Do not combine "beam" with "ball".
6612 * The array "gy[],gx[]" with current size "grids" is used to hold the
6613 * collected locations of all grids in the "blast area" plus "beam path".
6615 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6616 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6617 * first blast grid (see above) with radius "N" from the blast center. Note
6618 * that only the first gm[1] grids in the blast area thus take full damage.
6619 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6620 * number of blast grids.
6622 * Note that once the projection is complete, (y2,x2) holds the final location
6623 * of bolts/beams, and the "epicenter" of balls.
6625 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6626 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6627 * implementation of the "distance" function. Also, a bolt can be properly
6628 * viewed as a "ball" with a "rad" of "zero".
6630 * Note that if no "target" is reached before the beam/bolt/ball travels the
6631 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6632 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6634 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6635 * to move from point A to point B, even if the player cannot see part of the
6636 * projection path. Note that in general, the player will *always* see part
6637 * of the path, since it either starts at the player or ends on the player.
6639 * Hack -- we assume that every "projection" is "self-illuminating".
6641 * Hack -- when only a single monster is affected, we automatically track
6642 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6644 * Note that all projections now "explode" at their final destination, even
6645 * if they were being projected at a more distant destination. This means
6646 * that "ball" spells will *always* explode.
6648 * Note that we must call "handle_stuff()" after affecting terrain features
6649 * in the blast radius, in case the "illumination" of the grid was changed,
6650 * and "update_view()" and "update_monsters()" need to be called.
6653 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6663 POSITION y_saver, x_saver; /* For reflecting monsters */
6665 int msec = delay_factor * delay_factor * delay_factor;
6667 /* Assume the player sees nothing */
6668 bool notice = FALSE;
6670 /* Assume the player has seen nothing */
6671 bool visual = FALSE;
6673 /* Assume the player has seen no blast grids */
6676 /* Assume to be a normal ball spell */
6677 bool breath = FALSE;
6679 /* Is the player blind? */
6680 bool blind = (p_ptr->blind ? TRUE : FALSE);
6682 bool old_hide = FALSE;
6684 /* Number of grids in the "path" */
6687 /* Actual grids in the "path" */
6690 /* Number of grids in the "blast area" (including the "beam" path) */
6693 /* Coordinates of the affected grids */
6694 POSITION gx[1024], gy[1024];
6696 /* Encoded "radius" info (see above) */
6699 /* Actual radius encoded in gm[] */
6700 POSITION gm_rad = rad;
6704 /* Attacker's name (prepared before polymorph)*/
6705 GAME_TEXT who_name[MAX_NLEN];
6707 /* Can the player see the source of this effect? */
6708 bool see_s_msg = TRUE;
6710 /* Initialize by null string */
6716 /* Default target of monsterspell is player */
6717 monster_target_y = p_ptr->y;
6718 monster_target_x = p_ptr->x;
6720 /* Hack -- Jump to target */
6721 if (flg & (PROJECT_JUMP))
6726 /* Clear the flag */
6727 flg &= ~(PROJECT_JUMP);
6732 /* Start at player */
6739 /* Start at monster */
6742 x1 = m_list[who].fx;
6743 y1 = m_list[who].fy;
6744 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6756 /* Default "destination" */
6761 /* Hack -- verify stuff */
6762 if (flg & (PROJECT_THRU))
6764 if ((x1 == x2) && (y1 == y2))
6766 flg &= ~(PROJECT_THRU);
6770 /* Handle a breath attack */
6775 if (flg & PROJECT_HIDE) old_hide = TRUE;
6776 flg |= PROJECT_HIDE;
6780 /* Hack -- Assume there will be no blast (max radius 32) */
6781 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6789 /* Collect beam grids */
6790 if (flg & (PROJECT_BEAM))
6801 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6803 case GF_DISINTEGRATE:
6804 flg |= (PROJECT_GRID);
6805 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6809 /* Calculate the projection path */
6811 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6814 /* Giga-Hack SEEKER & SUPER_RAY */
6816 if( typ == GF_SEEKER )
6826 for (i = 0; i < path_n; ++i)
6831 int ny = GRID_Y(path_g[i]);
6832 int nx = GRID_X(path_g[i]);
6843 /* Only do visuals if requested */
6844 if (!blind && !(flg & (PROJECT_HIDE)))
6846 /* Only do visuals if the player can "see" the bolt */
6847 if (panel_contains(y, x) && player_has_los_bold(y, x))
6854 /* Obtain the bolt pict */
6855 p = bolt_pict(oy, ox, y, x, typ);
6857 /* Extract attr/char */
6861 /* Visual effects */
6862 print_rel(c, a, y, x);
6863 move_cursor_relative(y, x);
6864 /*if (fresh_before)*/ Term_fresh();
6865 Term_xtra(TERM_XTRA_DELAY, msec);
6867 /*if (fresh_before)*/ Term_fresh();
6869 /* Display "beam" grids */
6870 if (flg & (PROJECT_BEAM))
6872 /* Obtain the explosion pict */
6873 p = bolt_pict(y, x, y, x, typ);
6875 /* Extract attr/char */
6879 /* Visual effects */
6880 print_rel(c, a, y, x);
6883 /* Hack -- Activate delay */
6887 /* Hack -- delay anyway for consistency */
6890 /* Delay for consistency */
6891 Term_xtra(TERM_XTRA_DELAY, msec);
6894 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6895 if (is_mirror_grid(&cave[y][x]))
6897 /* The target of monsterspell becomes tha mirror(broken) */
6898 monster_target_y = y;
6899 monster_target_x = x;
6901 remove_mirror(y, x);
6902 next_mirror(&oy, &ox, y, x);
6904 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6905 for (j = last_i; j <= i; j++)
6907 y = GRID_Y(path_g[j]);
6908 x = GRID_X(path_g[j]);
6909 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6910 if (!who && (project_m_n == 1) && !jump) {
6911 if (cave[project_m_y][project_m_x].m_idx > 0) {
6912 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6916 /* Hack -- auto-recall */
6917 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6919 /* Hack - auto-track */
6920 health_track(cave[project_m_y][project_m_x].m_idx);
6924 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6929 for(i = last_i ; i < path_n ; i++)
6932 py = GRID_Y(path_g[i]);
6933 px = GRID_X(path_g[i]);
6934 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6936 if (!who && (project_m_n == 1) && !jump) {
6937 if (cave[project_m_y][project_m_x].m_idx > 0)
6939 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6943 /* Hack -- auto-recall */
6944 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6946 /* Hack - auto-track */
6947 health_track(cave[project_m_y][project_m_x].m_idx);
6951 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6955 else if(typ == GF_SUPER_RAY){
6957 int second_step = 0;
6964 for (i = 0; i < path_n; ++i)
6969 POSITION ny = GRID_Y(path_g[i]);
6970 POSITION nx = GRID_X(path_g[i]);
6981 /* Only do visuals if requested */
6982 if (!blind && !(flg & (PROJECT_HIDE)))
6984 /* Only do visuals if the player can "see" the bolt */
6985 if (panel_contains(y, x) && player_has_los_bold(y, x))
6992 /* Obtain the bolt pict */
6993 p = bolt_pict(oy, ox, y, x, typ);
6995 /* Extract attr/char */
6999 /* Visual effects */
7000 print_rel(c, a, y, x);
7001 move_cursor_relative(y, x);
7002 /*if (fresh_before)*/ Term_fresh();
7003 Term_xtra(TERM_XTRA_DELAY, msec);
7005 /*if (fresh_before)*/ Term_fresh();
7007 /* Display "beam" grids */
7008 if (flg & (PROJECT_BEAM))
7010 /* Obtain the explosion pict */
7011 p = bolt_pict(y, x, y, x, typ);
7013 /* Extract attr/char */
7017 /* Visual effects */
7018 print_rel(c, a, y, x);
7021 /* Hack -- Activate delay */
7025 /* Hack -- delay anyway for consistency */
7028 /* Delay for consistency */
7029 Term_xtra(TERM_XTRA_DELAY, msec);
7032 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7033 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7035 if( second_step )continue;
7038 if( is_mirror_grid(&cave[y][x]) && !second_step )
7040 /* The target of monsterspell becomes tha mirror(broken) */
7041 monster_target_y=(s16b)y;
7042 monster_target_x=(s16b)x;
7045 for( j = 0; j <=i ; j++ )
7047 y = GRID_Y(path_g[j]);
7048 x = GRID_X(path_g[j]);
7049 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7053 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7054 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
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 , x-1, flg);
7057 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7058 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7059 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7060 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7063 for( i = 0; i < path_n ; i++ )
7066 py = GRID_Y(path_g[i]);
7067 px = GRID_X(path_g[i]);
7068 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7069 if(!who && (project_m_n == 1) && !jump){
7070 if(cave[project_m_y][project_m_x].m_idx >0 ){
7071 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7075 /* Hack -- auto-recall */
7076 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7078 /* Hack - auto-track */
7079 health_track(cave[project_m_y][project_m_x].m_idx);
7083 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7088 /* Project along the path */
7089 for (i = 0; i < path_n; ++i)
7094 POSITION ny = GRID_Y(path_g[i]);
7095 POSITION nx = GRID_X(path_g[i]);
7097 if (flg & PROJECT_DISI)
7099 /* Hack -- Balls explode before reaching walls */
7100 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7102 else if (flg & PROJECT_LOS)
7104 /* Hack -- Balls explode before reaching walls */
7105 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7109 /* Hack -- Balls explode before reaching walls */
7110 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7117 /* Collect beam grids */
7118 if (flg & (PROJECT_BEAM))
7125 /* Only do visuals if requested */
7126 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7128 /* Only do visuals if the player can "see" the bolt */
7129 if (panel_contains(y, x) && player_has_los_bold(y, x))
7136 /* Obtain the bolt pict */
7137 p = bolt_pict(oy, ox, y, x, typ);
7139 /* Extract attr/char */
7143 /* Visual effects */
7144 print_rel(c, a, y, x);
7145 move_cursor_relative(y, x);
7146 /*if (fresh_before)*/ Term_fresh();
7147 Term_xtra(TERM_XTRA_DELAY, msec);
7149 /*if (fresh_before)*/ Term_fresh();
7151 /* Display "beam" grids */
7152 if (flg & (PROJECT_BEAM))
7154 /* Obtain the explosion pict */
7155 p = bolt_pict(y, x, y, x, typ);
7157 /* Extract attr/char */
7161 /* Visual effects */
7162 print_rel(c, a, y, x);
7165 /* Hack -- Activate delay */
7169 /* Hack -- delay anyway for consistency */
7172 /* Delay for consistency */
7173 Term_xtra(TERM_XTRA_DELAY, msec);
7180 /* Save the "blast epicenter" */
7184 if (breath && !path_n)
7190 flg &= ~(PROJECT_HIDE);
7194 /* Start the "explosion" */
7197 /* Hack -- make sure beams get to "explode" */
7205 /* If we found a "target", explode there */
7206 if (dist <= MAX_RANGE)
7208 /* Mega-Hack -- remove the final "beam" grid */
7209 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7212 * Create a conical breath attack
7223 flg &= ~(PROJECT_HIDE);
7225 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7229 /* Determine the blast area, work from the inside out */
7230 for (dist = 0; dist <= rad; dist++)
7232 /* Scan the maximal blast area of radius "dist" */
7233 for (y = by - dist; y <= by + dist; y++)
7235 for (x = bx - dist; x <= bx + dist; x++)
7237 /* Ignore "illegal" locations */
7238 if (!in_bounds2(y, x)) continue;
7240 /* Enforce a "circular" explosion */
7241 if (distance(by, bx, y, x) != dist) continue;
7247 /* Lights are stopped by opaque terrains */
7248 if (!los(by, bx, y, x)) continue;
7250 case GF_DISINTEGRATE:
7251 /* Disintegration are stopped only by perma-walls */
7252 if (!in_disintegration_range(by, bx, y, x)) continue;
7255 /* Ball explosions are stopped by walls */
7256 if (!projectable(by, bx, y, x)) continue;
7260 /* Save this grid */
7267 /* Encode some more "radius" info */
7273 /* Speed -- ignore "non-explosions" */
7274 if (!grids) return (FALSE);
7277 /* Display the "blast area" if requested */
7278 if (!blind && !(flg & (PROJECT_HIDE)))
7280 /* Then do the "blast", from inside out */
7281 for (t = 0; t <= gm_rad; t++)
7283 /* Dump everything with this radius */
7284 for (i = gm[t]; i < gm[t+1]; i++)
7286 /* Extract the location */
7290 /* Only do visuals if the player can "see" the blast */
7291 if (panel_contains(y, x) && player_has_los_bold(y, x))
7300 /* Obtain the explosion pict */
7301 p = bolt_pict(y, x, y, x, typ);
7303 /* Extract attr/char */
7307 /* Visual effects -- Display */
7308 print_rel(c, a, y, x);
7312 /* Hack -- center the cursor */
7313 move_cursor_relative(by, bx);
7315 /* Flush each "radius" seperately */
7316 /*if (fresh_before)*/ Term_fresh();
7318 /* Delay (efficiently) */
7319 if (visual || drawn)
7321 Term_xtra(TERM_XTRA_DELAY, msec);
7325 /* Flush the erasing */
7328 /* Erase the explosion drawn above */
7329 for (i = 0; i < grids; i++)
7331 /* Extract the location */
7335 /* Hack -- Erase if needed */
7336 if (panel_contains(y, x) && player_has_los_bold(y, x))
7342 /* Hack -- center the cursor */
7343 move_cursor_relative(by, bx);
7345 /* Flush the explosion */
7346 /*if (fresh_before)*/ Term_fresh();
7350 update_creature(p_ptr);
7352 if (flg & PROJECT_KILL)
7354 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7355 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7359 /* Check features */
7360 if (flg & (PROJECT_GRID))
7362 /* Start with "dist" of zero */
7365 /* Scan for features */
7366 for (i = 0; i < grids; i++)
7368 /* Hack -- Notice new "dist" values */
7369 if (gm[dist+1] == i) dist++;
7371 /* Get the grid location */
7375 /* Find the closest point in the blast */
7378 int d = dist_to_line(y, x, y1, x1, by, bx);
7380 /* Affect the grid */
7381 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7385 /* Affect the grid */
7386 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7391 update_creature(p_ptr);
7394 if (flg & (PROJECT_ITEM))
7396 /* Start with "dist" of zero */
7399 /* Scan for objects */
7400 for (i = 0; i < grids; i++)
7402 /* Hack -- Notice new "dist" values */
7403 if (gm[dist+1] == i) dist++;
7405 /* Get the grid location */
7409 /* Find the closest point in the blast */
7412 int d = dist_to_line(y, x, y1, x1, by, bx);
7414 /* Affect the object in the grid */
7415 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7419 /* Affect the object in the grid */
7420 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7426 /* Check monsters */
7427 if (flg & (PROJECT_KILL))
7434 /* Start with "dist" of zero */
7437 /* Scan for monsters */
7438 for (i = 0; i < grids; i++)
7442 /* Hack -- Notice new "dist" values */
7443 if (gm[dist + 1] == i) dist++;
7445 /* Get the grid location */
7449 /* A single bolt may be reflected */
7452 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7453 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7455 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7456 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7457 (!who || dist_hack > 1) && !one_in_(10))
7460 int max_attempts = 10;
7462 /* Choose 'new' target */
7465 t_y = y_saver - 1 + randint1(3);
7466 t_x = x_saver - 1 + randint1(3);
7469 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7471 if (max_attempts < 1)
7477 sound(SOUND_REFLECT);
7480 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7481 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7482 else if (m_ptr->r_idx == MON_DIO)
7483 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7485 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7487 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7489 /* Reflected bolts randomly target either one */
7490 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7491 else flg |= PROJECT_PLAYER;
7493 /* The bolt is reflected */
7494 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7496 /* Don't affect the monster any longer */
7502 /* Find the closest point in the blast */
7505 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7509 effective_dist = dist;
7513 /* There is the riding player on this monster */
7514 if (p_ptr->riding && player_bold(y, x))
7516 /* Aimed on the player */
7517 if (flg & PROJECT_PLAYER)
7519 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7522 * A beam or bolt is well aimed
7524 * So don't affects the mount.
7531 * The spell is not well aimed,
7532 * So partly affect the mount too.
7539 * This grid is the original target.
7540 * Or aimed on your horse.
7542 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7544 /* Hit the mount with full damage */
7548 * Otherwise this grid is not the
7549 * original target, it means that line
7550 * of fire is obstructed by this
7554 * A beam or bolt will hit either
7555 * player or mount. Choose randomly.
7557 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7561 /* Hit the mount with full damage */
7565 /* Hit the player later */
7566 flg |= PROJECT_PLAYER;
7568 /* Don't affect the mount */
7574 * The spell is not well aimed, so
7575 * partly affect both player and
7584 /* Affect the monster in the grid */
7585 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7589 /* Player affected one monster (without "jumping") */
7590 if (!who && (project_m_n == 1) && !jump)
7595 /* Track if possible */
7596 if (cave[y][x].m_idx > 0)
7598 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7602 /* Hack -- auto-recall */
7603 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7605 /* Hack - auto-track */
7606 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7614 if (flg & (PROJECT_KILL))
7616 /* Start with "dist" of zero */
7619 /* Scan for player */
7620 for (i = 0; i < grids; i++)
7624 /* Hack -- Notice new "dist" values */
7625 if (gm[dist+1] == i) dist++;
7627 /* Get the grid location */
7631 /* Affect the player? */
7632 if (!player_bold(y, x)) continue;
7634 /* Find the closest point in the blast */
7637 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7641 effective_dist = dist;
7644 /* Target may be your horse */
7647 /* Aimed on the player */
7648 if (flg & PROJECT_PLAYER)
7650 /* Hit the player with full damage */
7654 * Hack -- When this grid was not the
7655 * original target, a beam or bolt
7656 * would hit either player or mount,
7657 * and should be choosen randomly.
7659 * But already choosen to hit the
7660 * mount at this point.
7662 * Or aimed on your horse.
7664 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7667 * A beam or bolt is well aimed
7669 * So don't affects the player.
7676 * The spell is not well aimed,
7677 * So partly affect the player too.
7683 /* Affect the player */
7684 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7690 GAME_TEXT m_name[MAX_NLEN];
7692 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7694 if (rakubadam_m > 0)
7696 if (rakuba(rakubadam_m, FALSE))
7698 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7701 if (p_ptr->riding && rakubadam_p > 0)
7703 if(rakuba(rakubadam_p, FALSE))
7705 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7710 /* Return "something was noticed" */
7715 * @brief 鏡魔法「封魔結界」の効果処理
7717 * @return 効果があったらTRUEを返す
7719 bool binding_field(HIT_POINT dam)
7721 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7722 int mirror_num = 0; /* 鏡の数 */
7724 POSITION centersign;
7725 POSITION x1, x2, y1, y2;
7727 int msec = delay_factor*delay_factor*delay_factor;
7730 POSITION point_x[3];
7731 POSITION point_y[3];
7733 /* Default target of monsterspell is player */
7734 monster_target_y = p_ptr->y;
7735 monster_target_x = p_ptr->x;
7737 for (x = 0; x < cur_wid; x++)
7739 for (y = 0; y < cur_hgt; y++)
7741 if (is_mirror_grid(&cave[y][x]) &&
7742 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7743 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7744 player_has_los_bold(y, x) &&
7745 projectable(p_ptr->y, p_ptr->x, y, x)
7747 mirror_y[mirror_num] = y;
7748 mirror_x[mirror_num] = x;
7754 if (mirror_num < 2)return FALSE;
7756 point_x[0] = randint0(mirror_num);
7758 point_x[1] = randint0(mirror_num);
7759 } while (point_x[0] == point_x[1]);
7761 point_y[0] = mirror_y[point_x[0]];
7762 point_x[0] = mirror_x[point_x[0]];
7763 point_y[1] = mirror_y[point_x[1]];
7764 point_x[1] = mirror_x[point_x[1]];
7765 point_y[2] = p_ptr->y;
7766 point_x[2] = p_ptr->x;
7768 x = point_x[0] + point_x[1] + point_x[2];
7769 y = point_y[0] + point_y[1] + point_y[2];
7771 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7772 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7773 if (centersign == 0)return FALSE;
7775 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7776 x1 = x1 < point_x[2] ? x1 : point_x[2];
7777 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7778 y1 = y1 < point_y[2] ? y1 : point_y[2];
7780 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7781 x2 = x2 > point_x[2] ? x2 : point_x[2];
7782 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7783 y2 = y2 > point_y[2] ? y2 : point_y[2];
7785 for (y = y1; y <= y2; y++) {
7786 for (x = x1; x <= x2; x++) {
7787 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7788 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7789 centersign*((point_x[1] - x)*(point_y[2] - y)
7790 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7791 centersign*((point_x[2] - x)*(point_y[0] - y)
7792 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7794 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7795 /* Visual effects */
7797 && panel_contains(y, x)) {
7798 p = bolt_pict(y, x, y, x, GF_MANA);
7799 print_rel(PICT_C(p), PICT_A(p), y, x);
7800 move_cursor_relative(y, x);
7801 /*if (fresh_before)*/ Term_fresh();
7802 Term_xtra(TERM_XTRA_DELAY, msec);
7808 for (y = y1; y <= y2; y++) {
7809 for (x = x1; x <= x2; x++) {
7810 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7811 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7812 centersign*((point_x[1] - x)*(point_y[2] - y)
7813 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7814 centersign*((point_x[2] - x)*(point_y[0] - y)
7815 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7817 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7818 (void)project_f(0, 0, y, x, dam, GF_MANA);
7823 for (y = y1; y <= y2; y++) {
7824 for (x = x1; x <= x2; x++) {
7825 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7826 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7827 centersign*((point_x[1] - x)*(point_y[2] - y)
7828 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7829 centersign*((point_x[2] - x)*(point_y[0] - y)
7830 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7832 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7833 (void)project_o(0, 0, y, x, dam, GF_MANA);
7838 for (y = y1; y <= y2; y++) {
7839 for (x = x1; x <= x2; x++) {
7840 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7841 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7842 centersign*((point_x[1] - x)*(point_y[2] - y)
7843 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7844 centersign*((point_x[2] - x)*(point_y[0] - y)
7845 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7847 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7848 (void)project_m(0, 0, y, x, dam, GF_MANA,
7849 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7855 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7856 remove_mirror(point_y[0], point_x[0]);
7863 * @brief 鏡魔法「鏡の封印」の効果処理
7865 * @return 効果があったらTRUEを返す
7867 void seal_of_mirror(HIT_POINT dam)
7871 for (x = 0; x < cur_wid; x++)
7873 for (y = 0; y < cur_hgt; y++)
7875 if (is_mirror_grid(&cave[y][x]))
7877 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7878 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7880 if (!cave[y][x].m_idx)
7882 remove_mirror(y, x);