3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
19 #include "monsterrace-hook.h"
24 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
25 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
27 int project_length = 0; /*!< 投射の射程距離 */
31 * @brief モンスター魅了用セービングスロー共通部(汎用系)
33 * @param m_ptr 対象モンスター
34 * @return 魅了に抵抗したらTRUE
36 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
38 monster_race *r_ptr = &r_info[m_ptr->r_idx];
40 if(p_ptr->inside_arena) return TRUE;
43 if (r_ptr->flagsr & RFR_RES_ALL)
45 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
49 if (r_ptr->flags3 & RF3_NO_CONF)
51 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
55 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
57 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
58 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
59 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
63 * @brief モンスター服従用セービングスロー共通部(部族依存系)
65 * @param m_ptr 対象モンスター
66 * @return 服従に抵抗したらTRUE
68 static bool_hack common_saving_throw_control(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
70 monster_race *r_ptr = &r_info[m_ptr->r_idx];
72 if (p_ptr->inside_arena) return TRUE;
75 if (r_ptr->flagsr & RFR_RES_ALL)
77 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
81 if (r_ptr->flags1 & RF1_QUESTOR || m_ptr->mflag2 & MFLAG2_NOPET) return TRUE;
83 pow += adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1;
84 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
85 return (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
89 * @brief 一部ボルト魔法のビーム化確率を算出する / Prepare standard probability to become beam for fire_bolt_or_beam()
92 * ハードコーティングによる実装が行われている。
93 * メイジは(レベル)%、ハイメイジ、スペルマスターは(レベル)%、それ以外の職業は(レベル/2)%
95 PERCENTAGE beam_chance(void)
97 if (p_ptr->pclass == CLASS_MAGE)
98 return (PERCENTAGE)(p_ptr->lev);
99 if (p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
100 return (PERCENTAGE)(p_ptr->lev + 10);
102 return (PERCENTAGE)(p_ptr->lev / 2);
107 * @brief 配置した鏡リストの次を取得する /
108 * Get another mirror. for SEEKER
109 * @param next_y 次の鏡のy座標を返す参照ポインタ
110 * @param next_x 次の鏡のx座標を返す参照ポインタ
111 * @param cury 現在の鏡のy座標
112 * @param curx 現在の鏡のx座標
114 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
116 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
117 int mirror_num = 0; /* 鏡の数 */
121 for (x = 0; x < cur_wid; x++)
123 for (y = 0; y < cur_hgt; y++)
125 if (is_mirror_grid(&cave[y][x])) {
126 mirror_y[mirror_num] = y;
127 mirror_x[mirror_num] = x;
134 num = randint0(mirror_num);
135 *next_y = mirror_y[num];
136 *next_x = mirror_x[num];
139 *next_y = cury + randint0(5) - 2;
140 *next_x = curx + randint0(5) - 2;
145 * @brief 万色表現用にランダムな色を選択する関数 /
146 * Get a legal "multi-hued" color for drawing "spells"
150 static TERM_COLOR mh_attr(int max)
152 switch (randint1(max))
154 case 1: return (TERM_RED);
155 case 2: return (TERM_GREEN);
156 case 3: return (TERM_BLUE);
157 case 4: return (TERM_YELLOW);
158 case 5: return (TERM_ORANGE);
159 case 6: return (TERM_VIOLET);
160 case 7: return (TERM_L_RED);
161 case 8: return (TERM_L_GREEN);
162 case 9: return (TERM_L_BLUE);
163 case 10: return (TERM_UMBER);
164 case 11: return (TERM_L_UMBER);
165 case 12: return (TERM_SLATE);
166 case 13: return (TERM_WHITE);
167 case 14: return (TERM_L_WHITE);
168 case 15: return (TERM_L_DARK);
176 * @brief 魔法属性に応じたエフェクトの色を返す /
177 * Return a color to use for the bolt/ball spells
181 static TERM_COLOR spell_color(int type)
183 /* Check if A.B.'s new graphics should be used (rr9) */
184 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
189 case GF_PSY_SPEAR: return (0x06);
190 case GF_MISSILE: return (0x0F);
191 case GF_ACID: return (0x04);
192 case GF_ELEC: return (0x02);
193 case GF_FIRE: return (0x00);
194 case GF_COLD: return (0x01);
195 case GF_POIS: return (0x03);
196 case GF_HOLY_FIRE: return (0x00);
197 case GF_HELL_FIRE: return (0x00);
198 case GF_MANA: return (0x0E);
200 case GF_SEEKER: return (0x0E);
201 case GF_SUPER_RAY: return (0x0E);
203 case GF_ARROW: return (0x0F);
204 case GF_WATER: return (0x04);
205 case GF_NETHER: return (0x07);
206 case GF_CHAOS: return (mh_attr(15));
207 case GF_DISENCHANT: return (0x05);
208 case GF_NEXUS: return (0x0C);
209 case GF_CONFUSION: return (mh_attr(4));
210 case GF_SOUND: return (0x09);
211 case GF_SHARDS: return (0x08);
212 case GF_FORCE: return (0x09);
213 case GF_INERTIAL: return (0x09);
214 case GF_GRAVITY: return (0x09);
215 case GF_TIME: return (0x09);
216 case GF_LITE_WEAK: return (0x06);
217 case GF_LITE: return (0x06);
218 case GF_DARK_WEAK: return (0x07);
219 case GF_DARK: return (0x07);
220 case GF_PLASMA: return (0x0B);
221 case GF_METEOR: return (0x00);
222 case GF_ICE: return (0x01);
223 case GF_ROCKET: return (0x0F);
224 case GF_DEATH_RAY: return (0x07);
225 case GF_NUKE: return (mh_attr(2));
226 case GF_DISINTEGRATE: return (0x05);
238 case GF_CAUSE_4: return (0x0E);
239 case GF_HAND_DOOM: return (0x07);
240 case GF_CAPTURE : return (0x0E);
241 case GF_IDENTIFY: return (0x01);
242 case GF_ATTACK: return (0x0F);
243 case GF_PHOTO : return (0x06);
246 /* Normal tiles or ASCII */
252 /* Lookup the default colors for this type */
253 cptr s = quark_str(gf_color[type]);
255 if (!s) return (TERM_WHITE);
257 /* Pick a random color */
258 c = s[randint0(strlen(s))];
260 /* Lookup this color */
261 a = my_strchr(color_char, c) - color_char;
263 /* Invalid color (note check for < 0 removed, gave a silly
264 * warning because bytes are always >= 0 -- RG) */
265 if (a > 15) return (TERM_WHITE);
271 /* Standard "color" */
277 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
278 * Find the attr/char pair to use for a spell effect
287 * It is moving (or has moved) from (x,y) to (nx,ny).
288 * If the distance is not "one", we (may) return "*".
291 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
301 if ((ny == y) && (nx == x)) base = 0x30;
304 else if (nx == x) base = 0x40;
307 else if (ny == y) base = 0x50;
310 else if ((ny - y) == (x - nx)) base = 0x60;
313 else if ((ny - y) == (nx - x)) base = 0x70;
318 /* Basic spell color */
319 k = spell_color(typ);
321 /* Obtain attr/char */
322 a = misc_to_attr[base + k];
323 c = misc_to_char[base + k];
331 * @brief 始点から終点への経路を返す /
332 * Determine the path taken by a projection.
333 * @param gp 経路座標リストを返す参照ポインタ
343 * The projection will always start from the grid (y1,x1), and will travel
344 * towards the grid (y2,x2), touching one grid per unit of distance along
345 * the major axis, and stopping when it enters the destination grid or a
346 * wall grid, or has travelled the maximum legal distance of "range".
348 * Note that "distance" in this function (as in the "update_view()" code)
349 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
350 * actually has an "octagon of projection" not a "circle of projection".
352 * The path grids are saved into the grid array pointed to by "gp", and
353 * there should be room for at least "range" grids in "gp". Note that
354 * due to the way in which distance is calculated, this function normally
355 * uses fewer than "range" grids for the projection path, so the result
356 * of this function should never be compared directly to "range". Note
357 * that the initial grid (y1,x1) is never saved into the grid array, not
358 * even if the initial grid is also the final grid.
360 * The "flg" flags can be used to modify the behavior of this function.
362 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
363 * semantics as they do for the "project" function, namely, that the path
364 * will stop as soon as it hits a monster, or that the path will continue
365 * through the destination grid, respectively.
367 * The "PROJECT_JUMP" flag, which for the "project()" function means to
368 * start at a special grid (which makes no sense in this function), means
369 * that the path should be "angled" slightly if needed to avoid any wall
370 * grids, allowing the player to "target" any grid which is in "view".
371 * This flag is non-trivial and has not yet been implemented, but could
372 * perhaps make use of the "vinfo" array (above).
374 * This function returns the number of grids (if any) in the path. This
375 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
377 * This algorithm is similar to, but slightly different from, the one used
378 * by "update_view_los()", and very different from the one used by "los()".
381 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
403 /* No path necessary (or allowed) */
404 if ((x1 == x2) && (y1 == y2)) return (0);
432 /* Number of "units" in one "half" grid */
435 /* Number of "units" in one "full" grid */
441 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
452 /* Advance (X) part 2 */
455 /* Advance (X) part 3 */
462 /* Create the projection path */
466 gp[n++] = GRID(y, x);
468 /* Hack -- Check maximum range */
469 if ((n + (k >> 1)) >= range) break;
471 /* Sometimes stop at destination grid */
472 if (!(flg & (PROJECT_THRU)))
474 if ((x == x2) && (y == y2)) break;
477 if (flg & (PROJECT_DISI))
479 if ((n > 0) && cave_stop_disintegration(y, x)) break;
481 else if (flg & (PROJECT_LOS))
483 if ((n > 0) && !cave_los_bold(y, x)) break;
485 else if (!(flg & (PROJECT_PATH)))
487 /* Always stop at non-initial wall grids */
488 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
491 /* Sometimes stop at non-initial monsters/players */
492 if (flg & (PROJECT_STOP))
495 (player_bold(y, x) || cave[y][x].m_idx != 0))
499 if (!in_bounds(y, x)) break;
504 /* Advance (X) part 1 */
507 /* Horizontal change */
510 /* Advance (X) part 2 */
513 /* Advance (X) part 3 */
529 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
538 /* Vertical change */
541 /* Advance (Y) part 2 */
544 /* Advance (Y) part 3 */
551 /* Create the projection path */
555 gp[n++] = GRID(y, x);
557 /* Hack -- Check maximum range */
558 if ((n + (k >> 1)) >= range) break;
560 /* Sometimes stop at destination grid */
561 if (!(flg & (PROJECT_THRU)))
563 if ((x == x2) && (y == y2)) break;
566 if (flg & (PROJECT_DISI))
568 if ((n > 0) && cave_stop_disintegration(y, x)) break;
570 else if (flg & (PROJECT_LOS))
572 if ((n > 0) && !cave_los_bold(y, x)) break;
574 else if (!(flg & (PROJECT_PATH)))
576 /* Always stop at non-initial wall grids */
577 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
580 /* Sometimes stop at non-initial monsters/players */
581 if (flg & (PROJECT_STOP))
584 (player_bold(y, x) || cave[y][x].m_idx != 0))
588 if (!in_bounds(y, x)) break;
593 /* Advance (Y) part 1 */
596 /* Vertical change */
599 /* Advance (Y) part 2 */
602 /* Advance (Y) part 3 */
622 /* Create the projection path */
626 gp[n++] = GRID(y, x);
628 /* Hack -- Check maximum range */
629 if ((n + (n >> 1)) >= range) break;
631 /* Sometimes stop at destination grid */
632 if (!(flg & (PROJECT_THRU)))
634 if ((x == x2) && (y == y2)) break;
637 if (flg & (PROJECT_DISI))
639 if ((n > 0) && cave_stop_disintegration(y, x)) break;
641 else if (flg & (PROJECT_LOS))
643 if ((n > 0) && !cave_los_bold(y, x)) break;
645 else if (!(flg & (PROJECT_PATH)))
647 /* Always stop at non-initial wall grids */
648 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
651 /* Sometimes stop at non-initial monsters/players */
652 if (flg & (PROJECT_STOP))
655 (player_bold(y, x) || cave[y][x].m_idx != 0))
659 if (!in_bounds(y, x)) break;
676 * Mega-Hack -- track "affected" monsters (see "project()" comments)
678 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
679 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
680 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
681 /* Mega-Hack -- monsters target */
682 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
683 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
687 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
688 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
689 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
690 * @param y 目標Y座標 / Target y location (or location to travel "towards")
691 * @param x 目標X座標 / Target x location (or location to travel "towards")
692 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
693 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
694 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
697 * We are called both for "beam" effects and "ball" effects.
699 * The "r" parameter is the "distance from ground zero".
701 * Note that we determine if the player can "see" anything that happens
702 * by taking into account: blindness, line-of-sight, and illumination.
704 * We return "TRUE" if the effect of the projection is "obvious".
706 * We also "see" grids which are "memorized", probably a hack
708 * Perhaps we should affect doors?
711 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
713 cave_type *c_ptr = &cave[y][x];
714 feature_type *f_ptr = &f_info[c_ptr->feat];
716 bool obvious = FALSE;
717 bool known = player_has_los_bold(y, x);
722 /* Reduce damage by distance */
723 dam = (dam + r) / (r + 1);
726 if (have_flag(f_ptr->flags, FF_TREE))
734 message = _("枯れた", "was blasted."); break;
736 message = _("縮んだ", "shrank."); break;
738 message = _("溶けた", "melted."); break;
741 message = _("凍り、砕け散った", "was frozen and smashed."); break;
745 message = _("燃えた", "burns up!"); break;
757 message = _("粉砕された", "was crushed."); break;
759 message = NULL; break;
763 msg_format(_("木は%s。", "A tree %s"), message);
764 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
767 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
771 /* Analyze the type */
774 /* Ignore most effects */
809 /* Destroy Traps (and Locks) */
812 /* Reveal secret doors */
813 if (is_hidden_door(c_ptr))
818 /* Check line of sight */
826 if (is_trap(c_ptr->feat))
828 /* Check line of sight */
831 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
835 /* Destroy the trap */
836 cave_alter_feat(y, x, FF_DISARM);
839 /* Locked doors are unlocked */
840 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
842 s16b old_feat = c_ptr->feat;
844 /* Unlock the door */
845 cave_alter_feat(y, x, FF_DISARM);
847 /* Check line of sound */
848 if (known && (old_feat != c_ptr->feat))
850 msg_print(_("カチッと音がした!", "Click!"));
855 /* Remove "unsafe" flag if player is not blind */
856 if (!p_ptr->blind && player_has_los_bold(y, x))
858 c_ptr->info &= ~(CAVE_UNSAFE);
866 /* Destroy Doors (and traps) */
869 /* Destroy all doors and traps */
870 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
872 /* Check line of sight */
875 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
879 /* Destroy the feature */
880 cave_alter_feat(y, x, FF_TUNNEL);
883 /* Remove "unsafe" flag if player is not blind */
884 if (!p_ptr->blind && player_has_los_bold(y, x))
886 c_ptr->info &= ~(CAVE_UNSAFE);
894 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
896 if (have_flag(f_ptr->flags, FF_SPIKE))
898 s16b old_mimic = c_ptr->mimic;
899 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
901 cave_alter_feat(y, x, FF_SPIKE);
902 c_ptr->mimic = old_mimic;
907 /* Check line of sight */
908 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
910 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
917 /* Destroy walls (and doors) */
920 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
922 if (known && (c_ptr->info & (CAVE_MARK)))
924 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
928 /* Destroy the wall */
929 cave_alter_feat(y, x, FF_HURT_ROCK);
931 /* Update some things */
932 p_ptr->update |= (PU_FLOW);
941 /* Require a "naked" floor grid */
942 if (!cave_naked_bold(y, x)) break;
944 /* Not on the player */
945 if (player_bold(y, x)) break;
947 /* Create a closed door */
948 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
951 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
968 /* Require a "naked" floor grid */
969 if (!cave_naked_bold(y, x)) break;
971 /* Not on the player */
972 if (player_bold(y, x)) break;
974 /* Create a closed door */
975 cave_set_feat(y, x, feat_tree);
978 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
986 /* Require a "naked" floor grid */
987 if (!cave_naked_bold(y, x)) break;
990 c_ptr->info |= CAVE_OBJECT;
991 c_ptr->mimic = feat_glyph;
1002 /* Require a "naked" floor grid */
1003 if (!cave_naked_bold(y, x)) break;
1005 /* Not on the player */
1006 if (player_bold(y, x)) break;
1009 cave_set_feat(y, x, feat_granite);
1017 /* Ignore permanent grid */
1018 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1023 /* Ignore grid without enough space */
1024 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1026 /* Place a shallow lava */
1027 cave_set_feat(y, x, feat_shallow_lava);
1032 /* Place a deep lava */
1033 cave_set_feat(y, x, feat_deep_lava);
1040 /* Ignore permanent grid */
1041 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1046 /* Ignore grid without enough space */
1047 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1049 /* Place a shallow water */
1050 cave_set_feat(y, x, feat_shallow_water);
1055 /* Place a deep water */
1056 cave_set_feat(y, x, feat_deep_water);
1061 /* Lite up the grid */
1065 /* Turn on the light */
1066 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1068 c_ptr->info |= (CAVE_GLOW);
1071 update_local_illumination(y, x);
1074 if (player_can_see_bold(y, x)) obvious = TRUE;
1076 /* Mega-Hack -- Update the monster in the affected grid */
1077 /* This allows "spear of light" (etc) to work "correctly" */
1078 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1080 if (p_ptr->special_defense & NINJA_S_STEALTH)
1082 if (player_bold(y, x)) set_superstealth(FALSE);
1089 /* Darken the grid */
1093 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1096 /* Turn off the light. */
1099 if (dun_level || !is_daytime())
1101 for (j = 0; j < 9; j++)
1103 int by = y + ddy_ddd[j];
1104 int bx = x + ddx_ddd[j];
1106 if (in_bounds2(by, bx))
1108 cave_type *cc_ptr = &cave[by][bx];
1110 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1118 if (!do_dark) break;
1121 c_ptr->info &= ~(CAVE_GLOW);
1123 /* Hack -- Forget "boring" grids */
1124 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1127 c_ptr->info &= ~(CAVE_MARK);
1134 update_local_illumination(y, x);
1136 if (player_can_see_bold(y, x)) obvious = TRUE;
1138 /* Mega-Hack -- Update the monster in the affected grid */
1139 /* This allows "spear of light" (etc) to work "correctly" */
1140 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
1150 if (is_mirror_grid(c_ptr))
1152 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1154 remove_mirror(y, x);
1155 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1158 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1160 if (known && (c_ptr->info & CAVE_MARK))
1162 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1166 /* Destroy the wall */
1167 cave_alter_feat(y, x, FF_HURT_ROCK);
1169 /* Update some things */
1170 p_ptr->update |= (PU_FLOW);
1177 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1179 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1181 remove_mirror(y, x);
1182 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1185 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1187 if (known && (c_ptr->info & CAVE_MARK))
1189 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1193 /* Destroy the wall */
1194 cave_alter_feat(y, x, FF_HURT_ROCK);
1196 /* Update some things */
1197 p_ptr->update |= (PU_FLOW);
1202 case GF_DISINTEGRATE:
1204 /* Destroy mirror/glyph */
1205 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1206 remove_mirror(y, x);
1208 /* Permanent features don't get effect */
1209 /* But not protect monsters and other objects */
1210 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1212 cave_alter_feat(y, x, FF_HURT_DISI);
1214 /* Update some things -- similar to GF_KILL_WALL */
1215 p_ptr->update |= (PU_FLOW);
1222 /* Return "Anything seen?" */
1229 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1230 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1231 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1232 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1233 * @param x 目標X座標 / Target x location (or location to travel "towards")
1234 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1235 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1236 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1239 * We are called from "project()" to "damage" objects
1241 * We are called both for "beam" effects and "ball" effects.
1243 * Perhaps we should only SOMETIMES damage things on the ground.
1245 * The "r" parameter is the "distance from ground zero".
1247 * Note that we determine if the player can "see" anything that happens
1248 * by taking into account: blindness, line-of-sight, and illumination.
1250 * We also "see" grids which are "memorized", probably a hack
1252 * We return "TRUE" if the effect of the projection is "obvious".
1255 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
1257 cave_type *c_ptr = &cave[y][x];
1259 OBJECT_IDX this_o_idx, next_o_idx = 0;
1261 bool obvious = FALSE;
1262 bool known = player_has_los_bold(y, x);
1264 BIT_FLAGS flgs[TR_FLAG_SIZE];
1266 GAME_TEXT o_name[MAX_NLEN];
1268 KIND_OBJECT_IDX k_idx = 0;
1269 bool is_potion = FALSE;
1272 who = who ? who : 0;
1274 /* Reduce damage by distance */
1275 dam = (dam + r) / (r + 1);
1278 /* Scan all objects in the grid */
1279 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1281 object_type *o_ptr = &o_list[this_o_idx];
1283 bool is_art = FALSE;
1284 bool ignore = FALSE;
1285 bool do_kill = FALSE;
1287 cptr note_kill = NULL;
1290 /* Get the "plural"-ness */
1291 bool plural = (o_ptr->number > 1);
1294 /* Acquire next object */
1295 next_o_idx = o_ptr->next_o_idx;
1297 /* Extract the flags */
1298 object_flags(o_ptr, flgs);
1300 /* Check for artifact */
1301 if (object_is_artifact(o_ptr)) is_art = TRUE;
1303 /* Analyze the type */
1306 /* Acid -- Lots of things */
1309 if (hates_acid(o_ptr))
1312 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1313 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1318 /* Elec -- Rings and Wands */
1321 if (hates_elec(o_ptr))
1324 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1325 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1330 /* Fire -- Flammable objects */
1333 if (hates_fire(o_ptr))
1336 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1337 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1342 /* Cold -- potions and flasks */
1345 if (hates_cold(o_ptr))
1347 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1349 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1357 if (hates_fire(o_ptr))
1360 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1361 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1363 if (hates_elec(o_ptr))
1367 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1368 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1376 if (hates_fire(o_ptr))
1379 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1380 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1382 if (hates_cold(o_ptr))
1386 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1387 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1392 /* Hack -- break potions and such */
1398 if (hates_cold(o_ptr))
1400 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1406 /* Mana and Chaos -- destroy everything */
1412 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1416 case GF_DISINTEGRATE:
1419 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1426 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1427 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1428 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1432 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1436 if (object_is_cursed(o_ptr))
1439 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1446 identify_item(o_ptr);
1448 /* Auto-inscription */
1449 autopick_alter_item((-this_o_idx), FALSE);
1457 /* Chests are noticed only if trapped or locked */
1458 if (o_ptr->tval == TV_CHEST)
1460 /* Disarm/Unlock traps */
1461 if (o_ptr->pval > 0)
1463 /* Disarm or Unlock */
1464 o_ptr->pval = (0 - o_ptr->pval);
1467 object_known(o_ptr);
1469 if (known && (o_ptr->marked & OM_FOUND))
1471 msg_print(_("カチッと音がした!", "Click!"));
1481 if (o_ptr->tval == TV_CORPSE)
1484 BIT_FLAGS mode = 0L;
1486 if (!who || is_pet(&m_list[who]))
1487 mode |= PM_FORCE_PET;
1489 for (i = 0; i < o_ptr->number ; i++)
1491 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1492 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1496 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1500 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1502 note_kill = _("生き返った。", " revived.");
1504 else if (!note_kill)
1506 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1517 /* Attempt to destroy the object */
1520 /* Effect "observed" */
1521 if (known && (o_ptr->marked & OM_FOUND))
1524 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1527 /* Artifacts, and other objects, get to resist */
1528 if (is_art || ignore)
1530 /* Observe the resist */
1531 if (known && (o_ptr->marked & OM_FOUND))
1533 msg_format(_("%sは影響を受けない!",
1534 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1541 /* Describe if needed */
1542 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1544 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1547 k_idx = o_ptr->k_idx;
1548 is_potion = object_is_potion(o_ptr);
1549 delete_object_idx(this_o_idx);
1551 /* Potions produce effects when 'shattered' */
1554 (void)potion_smash_effect(who, y, x, k_idx);
1562 /* Return "Anything seen?" */
1568 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1569 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1570 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1571 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1572 * @param x 目標X座標 / Target x location (or location to travel "towards")
1573 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1574 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1576 * @param see_s_msg TRUEならばメッセージを表示する
1577 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1580 * This routine takes a "source monster" (by index) which is mostly used to
1581 * determine if the player is causing the damage, and a "radius" (see below),
1582 * which is used to decrease the power of explosions with distance, and a
1583 * location, via integers which are modified by certain types of attacks
1584 * (polymorph and teleport being the obvious ones), a default damage, which
1585 * is modified as needed based on various properties, and finally a "damage
1586 * type" (see below).
1589 * Note that this routine can handle "no damage" attacks (like teleport) by
1590 * taking a "zero" damage, and can even take "parameters" to attacks (like
1591 * confuse) by accepting a "damage", using it to calculate the effect, and
1592 * then setting the damage to zero. Note that the "damage" parameter is
1593 * divided by the radius, so monsters not at the "epicenter" will not take
1594 * as much damage (or whatever)...
1597 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1598 * may result in a dereference of an invalid pointer.
1601 * Various messages are produced, and damage is applied.
1604 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1605 * actually be "made" of that substance, or "breathe" big balls of it.
1606 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1608 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1609 * and hurts evil less. If can breath nether, then it resists it as well.
1612 * Damage reductions use the following formulas:
1613 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1614 * gives avg damage of .655, ranging from .858 to .500
1615 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1616 * gives avg damage of .544, ranging from .714 to .417
1617 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1618 * gives avg damage of .444, ranging from .556 to .333
1619 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1620 * gives avg damage of .327, ranging from .427 to .250
1621 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1622 * gives something simple.
1625 * In this function, "result" messages are postponed until the end, where
1626 * the "note" string is appended to the monster name, if not NULL. So,
1627 * to make a spell have "no effect" just set "note" to NULL. You should
1628 * also set "notice" to FALSE, or the player will learn what the spell does.
1631 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1635 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1639 cave_type *c_ptr = &cave[y][x];
1641 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1642 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1644 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1648 /* Is the monster "seen"? */
1649 bool seen = m_ptr->ml;
1650 bool seen_msg = is_seen(m_ptr);
1652 bool slept = (bool)MON_CSLEEP(m_ptr);
1654 /* Were the effects "obvious" (if seen)? */
1655 bool obvious = FALSE;
1657 /* Can the player know about this effect? */
1658 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1660 /* Were the effects "irrelevant"? */
1661 bool skipped = FALSE;
1663 /* Gets the monster angry at the source of the effect? */
1664 bool get_angry = FALSE;
1666 /* Polymorph setting (true or false) */
1667 bool do_poly = FALSE;
1669 /* Teleport setting (max distance) */
1672 /* Confusion setting (amount to confuse) */
1675 /* Stunning setting (amount to stun) */
1678 /* Sleep amount (amount to sleep) */
1681 /* Fear amount (amount to fear) */
1684 /* Time amount (amount to time) */
1687 bool heal_leper = FALSE;
1689 /* Hold the monster name */
1690 GAME_TEXT m_name[MAX_NLEN];
1693 PARAMETER_VALUE photo = 0;
1695 /* Assume no note */
1698 /* Assume a default death */
1699 cptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1701 POSITION ty = m_ptr->fy;
1702 POSITION tx = m_ptr->fx;
1704 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1707 if (!c_ptr->m_idx) return (FALSE);
1709 /* Never affect projector */
1710 if (who && (c_ptr->m_idx == who)) return (FALSE);
1711 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1712 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1714 /* Don't affect already death monsters */
1715 /* Prevents problems with chain reactions of exploding monsters */
1716 if (m_ptr->hp < 0) return (FALSE);
1718 /* Reduce damage by distance */
1719 dam = (dam + r) / (r + 1);
1722 /* Get the monster name (BEFORE polymorphing) */
1723 monster_desc(m_name, m_ptr, 0);
1725 /* Get the monster possessive ("his"/"her"/"its") */
1726 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1728 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1730 /* Analyze the damage type */
1733 /* Magic Missile -- pure damage */
1736 if (seen) obvious = TRUE;
1738 if (r_ptr->flagsr & RFR_RES_ALL)
1740 note = _("には完全な耐性がある!", " is immune.");
1742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1751 if (seen) obvious = TRUE;
1753 if (r_ptr->flagsr & RFR_RES_ALL)
1755 note = _("には完全な耐性がある!", " is immune.");
1757 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1760 if (r_ptr->flagsr & RFR_IM_ACID)
1762 note = _("にはかなり耐性がある!", " resists a lot.");
1764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1772 if (seen) obvious = TRUE;
1774 if (r_ptr->flagsr & RFR_RES_ALL)
1776 note = _("には完全な耐性がある!", " is immune.");
1778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1781 if (r_ptr->flagsr & RFR_IM_ELEC)
1783 note = _("にはかなり耐性がある!", " resists a lot.");
1785 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1793 if (seen) obvious = TRUE;
1795 if (r_ptr->flagsr & RFR_RES_ALL)
1797 note = _("には完全な耐性がある!", " is immune.");
1799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1802 if (r_ptr->flagsr & RFR_IM_FIRE)
1804 note = _("にはかなり耐性がある!", " resists a lot.");
1806 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1808 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1810 note = _("はひどい痛手をうけた。", " is hit hard.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1820 if (seen) obvious = TRUE;
1822 if (r_ptr->flagsr & RFR_RES_ALL)
1824 note = _("には完全な耐性がある!", " is immune.");
1826 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1829 if (r_ptr->flagsr & RFR_IM_COLD)
1831 note = _("にはかなり耐性がある!", " resists a lot.");
1833 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1835 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1837 note = _("はひどい痛手をうけた。", " is hit hard.");
1839 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1847 if (seen) obvious = TRUE;
1849 if (r_ptr->flagsr & RFR_RES_ALL)
1851 note = _("には完全な耐性がある!", " is immune.");
1853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1856 if (r_ptr->flagsr & RFR_IM_POIS)
1858 note = _("にはかなり耐性がある!", " resists a lot.");
1860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1868 if (seen) obvious = TRUE;
1870 if (r_ptr->flagsr & RFR_RES_ALL)
1872 note = _("には完全な耐性がある!", " is immune.");
1874 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1877 if (r_ptr->flagsr & RFR_IM_POIS)
1879 note = _("には耐性がある。", " resists.");
1880 dam *= 3; dam /= randint1(6) + 6;
1881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1883 else if (one_in_(3)) do_poly = TRUE;
1887 /* Hellfire -- hurts Evil */
1890 if (seen) obvious = TRUE;
1892 if (r_ptr->flagsr & RFR_RES_ALL)
1894 note = _("には完全な耐性がある!", " is immune.");
1896 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1899 if (r_ptr->flags3 & RF3_GOOD)
1901 note = _("はひどい痛手をうけた。", " is hit hard.");
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1908 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1911 if (seen) obvious = TRUE;
1913 if (r_ptr->flagsr & RFR_RES_ALL)
1915 note = _("には完全な耐性がある!", " is immune.");
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1920 if (r_ptr->flags3 & RF3_GOOD)
1922 note = _("には完全な耐性がある!", " is immune.");
1924 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1926 else if (r_ptr->flags3 & RF3_EVIL)
1929 note = _("はひどい痛手をうけた。", " is hit hard.");
1930 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1934 note = _("には耐性がある。", " resists.");
1935 dam *= 3; dam /= randint1(6) + 6;
1940 /* Arrow -- XXX no defense */
1943 if (seen) obvious = TRUE;
1945 if (r_ptr->flagsr & RFR_RES_ALL)
1947 note = _("には完全な耐性がある!", " is immune.");
1949 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1955 /* Plasma -- XXX perhaps check ELEC or FIRE */
1958 if (seen) obvious = TRUE;
1960 if (r_ptr->flagsr & RFR_RES_ALL)
1962 note = _("には完全な耐性がある!", " is immune.");
1964 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1967 if (r_ptr->flagsr & RFR_RES_PLAS)
1969 note = _("には耐性がある。", " resists.");
1970 dam *= 3; dam /= randint1(6) + 6;
1971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1976 /* Nether -- see above */
1979 if (seen) obvious = TRUE;
1981 if (r_ptr->flagsr & RFR_RES_ALL)
1983 note = _("には完全な耐性がある!", " is immune.");
1985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1988 if (r_ptr->flagsr & RFR_RES_NETH)
1990 if (r_ptr->flags3 & RF3_UNDEAD)
1992 note = _("には完全な耐性がある!", " is immune.");
1994 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1998 note = _("には耐性がある。", " resists.");
1999 dam *= 3; dam /= randint1(6) + 6;
2001 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2003 else if (r_ptr->flags3 & RF3_EVIL)
2005 note = _("はいくらか耐性を示した。", " resists somewhat.");
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2012 /* Water (acid) damage -- Water spirits/elementals are immune */
2015 if (seen) obvious = TRUE;
2017 if (r_ptr->flagsr & RFR_RES_ALL)
2019 note = _("には完全な耐性がある!", " is immune.");
2021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2024 if (r_ptr->flagsr & RFR_RES_WATE)
2026 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2028 note = _("には完全な耐性がある!", " is immune.");
2033 note = _("には耐性がある。", " resists.");
2034 dam *= 3; dam /= randint1(6) + 6;
2036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2041 /* Chaos -- Chaos breathers resist */
2044 if (seen) obvious = TRUE;
2046 if (r_ptr->flagsr & RFR_RES_ALL)
2048 note = _("には完全な耐性がある!", " is immune.");
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2053 if (r_ptr->flagsr & RFR_RES_CHAO)
2055 note = _("には耐性がある。", " resists.");
2056 dam *= 3; dam /= randint1(6) + 6;
2057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2059 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2061 note = _("はいくらか耐性を示した。", " resists somewhat.");
2062 dam *= 3; dam /= randint1(6) + 6;
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2068 do_conf = (5 + randint1(11) + r) / (r + 1);
2073 /* Shards -- Shard breathers resist */
2076 if (seen) obvious = TRUE;
2078 if (r_ptr->flagsr & RFR_RES_ALL)
2080 note = _("には完全な耐性がある!", " is immune.");
2082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2085 if (r_ptr->flagsr & RFR_RES_SHAR)
2087 note = _("には耐性がある。", " resists.");
2088 dam *= 3; dam /= randint1(6) + 6;
2089 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2094 /* Rocket: Shard resistance helps */
2097 if (seen) obvious = TRUE;
2099 if (r_ptr->flagsr & RFR_RES_ALL)
2101 note = _("には完全な耐性がある!", " is immune.");
2103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2106 if (r_ptr->flagsr & RFR_RES_SHAR)
2108 note = _("はいくらか耐性を示した。", " resists somewhat.");
2110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2116 /* Sound -- Sound breathers resist */
2119 if (seen) obvious = TRUE;
2121 if (r_ptr->flagsr & RFR_RES_ALL)
2123 note = _("には完全な耐性がある!", " is immune.");
2125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2128 if (r_ptr->flagsr & RFR_RES_SOUN)
2130 note = _("には耐性がある。", " resists.");
2131 dam *= 2; dam /= randint1(6) + 6;
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2134 else do_stun = (10 + randint1(15) + r) / (r + 1);
2141 if (seen) obvious = TRUE;
2143 if (r_ptr->flagsr & RFR_RES_ALL)
2145 note = _("には完全な耐性がある!", " is immune.");
2147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2150 if (r_ptr->flags3 & RF3_NO_CONF)
2152 note = _("には耐性がある。", " resists.");
2153 dam *= 3; dam /= randint1(6) + 6;
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2156 else do_conf = (10 + randint1(15) + r) / (r + 1);
2160 /* Disenchantment -- Breathers and Disenchanters resist */
2163 if (seen) obvious = TRUE;
2165 if (r_ptr->flagsr & RFR_RES_ALL)
2167 note = _("には完全な耐性がある!", " is immune.");
2169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2172 if (r_ptr->flagsr & RFR_RES_DISE)
2174 note = _("には耐性がある。", " resists.");
2175 dam *= 3; dam /= randint1(6) + 6;
2176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2181 /* Nexus -- Breathers and Existers resist */
2184 if (seen) obvious = TRUE;
2186 if (r_ptr->flagsr & RFR_RES_ALL)
2188 note = _("には完全な耐性がある!", " is immune.");
2190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2193 if (r_ptr->flagsr & RFR_RES_NEXU)
2195 note = _("には耐性がある。", " resists.");
2196 dam *= 3; dam /= randint1(6) + 6;
2197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2205 if (seen) obvious = TRUE;
2207 if (r_ptr->flagsr & RFR_RES_ALL)
2209 note = _("には完全な耐性がある!", " is immune.");
2211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2214 if (r_ptr->flagsr & RFR_RES_WALL)
2216 note = _("には耐性がある。", " resists.");
2217 dam *= 3; dam /= randint1(6) + 6;
2218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2220 else do_stun = (randint1(15) + r) / (r + 1);
2224 /* Inertia -- breathers resist */
2227 if (seen) obvious = TRUE;
2229 if (r_ptr->flagsr & RFR_RES_ALL)
2231 note = _("には完全な耐性がある!", " is immune.");
2233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2236 if (r_ptr->flagsr & RFR_RES_INER)
2238 note = _("には耐性がある。", " resists.");
2239 dam *= 3; dam /= randint1(6) + 6;
2240 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2244 /* Powerful monsters can resist */
2245 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2246 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2250 /* Normal monsters slow down */
2253 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2255 note = _("の動きが遅くなった。", " starts moving slower.");
2262 /* Time -- breathers resist */
2265 if (seen) obvious = TRUE;
2267 if (r_ptr->flagsr & RFR_RES_ALL)
2269 note = _("には完全な耐性がある!", " is immune.");
2271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2274 if (r_ptr->flagsr & RFR_RES_TIME)
2276 note = _("には耐性がある。", " resists.");
2277 dam *= 3; dam /= randint1(6) + 6;
2278 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2280 else do_time = (dam + 1) / 2;
2284 /* Gravity -- breathers resist */
2287 bool resist_tele = FALSE;
2289 if (seen) obvious = TRUE;
2291 if (r_ptr->flagsr & RFR_RES_ALL)
2293 note = _("には完全な耐性がある!", " is immune.");
2295 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2298 if (r_ptr->flagsr & RFR_RES_TELE)
2300 if (r_ptr->flags1 & (RF1_UNIQUE))
2302 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2303 note = _("には効果がなかった。", " is unaffected!");
2306 else if (r_ptr->level > randint1(100))
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2309 note = _("には耐性がある!", " resists!");
2314 if (!resist_tele) do_dist = 10;
2316 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2318 if (r_ptr->flagsr & RFR_RES_GRAV)
2320 note = _("には耐性がある!", " resists!");
2321 dam *= 3; dam /= randint1(6) + 6;
2323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2328 /* Powerful monsters can resist */
2329 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2330 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2334 /* Normal monsters slow down */
2337 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2339 note = _("の動きが遅くなった。", " starts moving slower.");
2344 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2346 /* Attempt a saving throw */
2347 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2348 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2352 /* No obvious effect */
2353 note = _("には効果がなかった。", " is unaffected!");
2365 if (seen) obvious = TRUE;
2367 if (r_ptr->flagsr & RFR_RES_ALL)
2369 note = _("には完全な耐性がある!", " is immune.");
2371 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2379 case GF_DISINTEGRATE:
2381 if (seen) obvious = TRUE;
2383 if (r_ptr->flagsr & RFR_RES_ALL)
2385 note = _("には完全な耐性がある!", " is immune.");
2387 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2390 if (r_ptr->flags3 & RF3_HURT_ROCK)
2392 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2393 note = _("の皮膚がただれた!", " loses some skin!");
2394 note_dies = _("は蒸発した!", " evaporates!");
2402 if (seen) obvious = TRUE;
2404 /* PSI only works if the monster can see you! -- RG */
2405 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2408 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2413 if (r_ptr->flagsr & RFR_RES_ALL)
2415 note = _("には完全な耐性がある!", " is immune.");
2417 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2420 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2423 note = _("には完全な耐性がある!", " is immune.");
2424 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2427 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2428 (r_ptr->flags3 & RF3_ANIMAL) ||
2429 (r_ptr->level > randint1(3 * dam)))
2431 note = _("には耐性がある!", " resists!");
2435 * Powerful demons & undead can turn a mindcrafter's
2436 * attacks back on them
2438 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2439 (r_ptr->level > p_ptr->lev / 2) &&
2443 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2444 (seen ? "%^s's corrupted mind backlashes your attack!" :
2445 "%^ss corrupted mind backlashes your attack!")), m_name);
2448 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2450 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2454 /* Injure +/- confusion */
2455 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2456 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2457 if (one_in_(4) && !CHECK_MULTISHADOW())
2459 switch (randint1(4))
2462 set_confused(p_ptr->confused + 3 + randint1(dam));
2465 set_stun(p_ptr->stun + randint1(dam));
2469 if (r_ptr->flags3 & RF3_NO_FEAR)
2470 note = _("には効果がなかった。", " is unaffected.");
2472 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2476 if (!p_ptr->free_act)
2477 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2486 if ((dam > 0) && one_in_(4))
2488 switch (randint1(4))
2491 do_conf = 3 + randint1(dam);
2494 do_stun = 3 + randint1(dam);
2497 do_fear = 3 + randint1(dam);
2500 note = _("は眠り込んでしまった!", " falls asleep!");
2501 do_sleep = 3 + randint1(dam);
2506 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2512 if (seen) obvious = TRUE;
2514 if (r_ptr->flagsr & RFR_RES_ALL)
2516 note = _("には完全な耐性がある!", " is immune.");
2518 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2521 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2524 note = _("には完全な耐性がある!", " is immune.");
2526 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2527 (r_ptr->flags3 & RF3_ANIMAL) ||
2528 (r_ptr->level > randint1(3 * dam)))
2530 note = _("には耐性がある!", " resists!");
2534 * Powerful demons & undead can turn a mindcrafter's
2535 * attacks back on them
2537 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2538 (r_ptr->level > p_ptr->lev / 2) &&
2542 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2543 (seen ? "%^s's corrupted mind backlashes your attack!" :
2544 "%^ss corrupted mind backlashes your attack!")), m_name);
2546 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2548 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2552 /* Injure + mana drain */
2553 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2554 if (!CHECK_MULTISHADOW())
2556 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2557 p_ptr->csp -= damroll(5, dam) / 2;
2558 if (p_ptr->csp < 0) p_ptr->csp = 0;
2559 p_ptr->redraw |= PR_MANA;
2560 p_ptr->window |= (PW_SPELL);
2562 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2569 int b = damroll(5, dam) / 4;
2570 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2571 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2572 (seen ? "You convert %s's pain into %s!" :
2573 "You convert %ss pain into %s!"));
2574 msg_format(msg, m_name, str);
2576 b = MIN(p_ptr->msp, p_ptr->csp + b);
2578 p_ptr->redraw |= PR_MANA;
2579 p_ptr->window |= (PW_SPELL);
2581 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2585 case GF_TELEKINESIS:
2587 if (seen) obvious = TRUE;
2589 if (r_ptr->flagsr & RFR_RES_ALL)
2591 note = _("には完全な耐性がある!", " is immune.");
2593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2598 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2603 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2605 /* Attempt a saving throw */
2606 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2607 (r_ptr->level > 5 + randint1(dam)))
2611 /* No obvious effect */
2617 /* Psycho-spear -- powerful magic missile */
2620 if (seen) obvious = TRUE;
2622 if (r_ptr->flagsr & RFR_RES_ALL)
2624 note = _("には完全な耐性がある!", " is immune.");
2626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2632 /* Meteor -- powerful magic missile */
2635 if (seen) obvious = TRUE;
2637 if (r_ptr->flagsr & RFR_RES_ALL)
2639 note = _("には完全な耐性がある!", " is immune.");
2641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2649 if (!is_hostile(m_ptr)) break;
2651 if (seen) obvious = TRUE;
2653 if (r_ptr->flagsr & RFR_RES_ALL)
2655 note = _("には効果がなかった!", " is immune.");
2657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2660 /* Attempt a saving throw */
2661 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2662 (r_ptr->flags3 & RF3_NO_CONF) ||
2663 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2665 /* Memorize a flag */
2666 if (r_ptr->flags3 & RF3_NO_CONF)
2668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2675 * Powerful demons & undead can turn a mindcrafter's
2676 * attacks back on them
2678 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2679 (r_ptr->level > p_ptr->lev / 2) &&
2683 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2684 (seen ? "%^s's corrupted mind backlashes your attack!" :
2685 "%^ss corrupted mind backlashes your attack!")), m_name);
2688 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2690 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2694 /* Confuse, stun, terrify */
2695 switch (randint1(4))
2698 set_stun(p_ptr->stun + dam / 2);
2701 set_confused(p_ptr->confused + dam / 2);
2705 if (r_ptr->flags3 & RF3_NO_FEAR)
2706 note = _("には効果がなかった。", " is unaffected.");
2708 set_afraid(p_ptr->afraid + dam);
2715 /* No obvious effect */
2716 note = _("には効果がなかった。", " is unaffected.");
2722 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2724 note = _("があなたに隷属した。", " is in your thrall!");
2729 switch (randint1(4))
2743 /* No "real" damage */
2750 /* Ice -- Cold + Cuts + Stun */
2753 if (seen) obvious = TRUE;
2755 if (r_ptr->flagsr & RFR_RES_ALL)
2757 note = _("には完全な耐性がある!", " is immune.");
2759 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2762 do_stun = (randint1(15) + 1) / (r + 1);
2763 if (r_ptr->flagsr & RFR_IM_COLD)
2765 note = _("にはかなり耐性がある!", " resists a lot.");
2767 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2769 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2771 note = _("はひどい痛手をうけた。", " is hit hard.");
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2780 case GF_HYPODYNAMIA:
2782 if (seen) obvious = TRUE;
2784 if (r_ptr->flagsr & RFR_RES_ALL)
2786 note = _("には完全な耐性がある!", " is immune.");
2788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2791 if (!monster_living(m_ptr->r_idx))
2793 if (is_original_ap_and_seen(m_ptr))
2795 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2796 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2797 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2799 note = _("には効果がなかった。", " is unaffected.");
2803 else do_time = (dam+7)/8;
2811 if (seen) obvious = TRUE;
2813 if (r_ptr->flagsr & RFR_RES_ALL)
2815 note = _("には完全な耐性がある!", " is immune.");
2817 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2820 if (!monster_living(m_ptr->r_idx))
2822 if (is_original_ap_and_seen(m_ptr))
2824 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2825 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2826 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2828 note = _("には完全な耐性がある!", " is immune.");
2832 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2833 (randint1(888) != 666)) ||
2834 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2835 randint1(100) != 66))
2837 note = _("には耐性がある!", " resists!");
2845 /* Polymorph monster (Use "dam" as "power") */
2848 if (seen) obvious = TRUE;
2850 if (r_ptr->flagsr & RFR_RES_ALL)
2852 note = _("には効果がなかった。", " is unaffected.");
2854 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2857 /* Attempt to polymorph (see below) */
2860 /* Powerful monsters can resist */
2861 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2862 (r_ptr->flags1 & RF1_QUESTOR) ||
2863 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2865 note = _("には効果がなかった。", " is unaffected.");
2870 /* No "real" damage */
2877 /* Clone monsters (Ignore "dam") */
2880 if (seen) obvious = TRUE;
2882 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2884 note = _("には効果がなかった。", " is unaffected.");
2889 m_ptr->hp = m_ptr->maxhp;
2891 /* Attempt to clone. */
2892 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2894 note = _("が分裂した!", " spawns!");
2898 /* No "real" damage */
2905 /* Heal Monster (use "dam" as amount of healing) */
2908 if (seen) obvious = TRUE;
2911 (void)set_monster_csleep(c_ptr->m_idx, 0);
2913 if (m_ptr->maxhp < m_ptr->max_maxhp)
2915 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2916 m_ptr->maxhp = m_ptr->max_maxhp;
2921 /* Redraw (later) if needed */
2922 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2923 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2931 if (seen) obvious = TRUE;
2934 (void)set_monster_csleep(c_ptr->m_idx, 0);
2935 if (MON_STUNNED(m_ptr))
2937 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2938 (void)set_monster_stunned(c_ptr->m_idx, 0);
2940 if (MON_CONFUSED(m_ptr))
2942 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2943 (void)set_monster_confused(c_ptr->m_idx, 0);
2945 if (MON_MONFEAR(m_ptr))
2947 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2948 (void)set_monster_monfear(c_ptr->m_idx, 0);
2952 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2955 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2959 chg_virtue(V_VITALITY, 1);
2961 if (r_ptr->flags1 & RF1_UNIQUE)
2962 chg_virtue(V_INDIVIDUALISM, 1);
2964 if (is_friendly(m_ptr))
2965 chg_virtue(V_HONOUR, 1);
2966 else if (!(r_ptr->flags3 & RF3_EVIL))
2968 if (r_ptr->flags3 & RF3_GOOD)
2969 chg_virtue(V_COMPASSION, 2);
2971 chg_virtue(V_COMPASSION, 1);
2974 if (r_ptr->flags3 & RF3_ANIMAL)
2975 chg_virtue(V_NATURE, 1);
2978 if (m_ptr->r_idx == MON_LEPER)
2981 if (!who) chg_virtue(V_COMPASSION, 5);
2984 /* Redraw (later) if needed */
2985 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2986 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2988 note = _("は体力を回復したようだ。", " looks healthier.");
2990 /* No "real" damage */
2996 /* Speed Monster (Ignore "dam") */
2999 if (seen) obvious = TRUE;
3002 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3004 note = _("の動きが速くなった。", " starts moving faster.");
3009 if (r_ptr->flags1 & RF1_UNIQUE)
3010 chg_virtue(V_INDIVIDUALISM, 1);
3011 if (is_friendly(m_ptr))
3012 chg_virtue(V_HONOUR, 1);
3015 /* No "real" damage */
3021 /* Slow Monster (Use "dam" as "power") */
3024 if (seen) obvious = TRUE;
3026 if (r_ptr->flagsr & RFR_RES_ALL)
3028 note = _("には効果がなかった。", " is unaffected.");
3030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3033 /* Powerful monsters can resist */
3034 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3035 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3037 note = _("には効果がなかった。", " is unaffected.");
3041 /* Normal monsters slow down */
3044 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3046 note = _("の動きが遅くなった。", " starts moving slower.");
3050 /* No "real" damage */
3056 /* Sleep (Use "dam" as "power") */
3059 if (seen) obvious = TRUE;
3061 if (r_ptr->flagsr & RFR_RES_ALL)
3063 note = _("には効果がなかった。", " is unaffected.");
3065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3068 /* Attempt a saving throw */
3069 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3070 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3071 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3073 /* Memorize a flag */
3074 if (r_ptr->flags3 & RF3_NO_SLEEP)
3076 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3078 /* No obvious effect */
3079 note = _("には効果がなかった。", " is unaffected.");
3084 /* Go to sleep (much) later */
3085 note = _("は眠り込んでしまった!", " falls asleep!");
3089 /* No "real" damage */
3095 /* Sleep (Use "dam" as "power") */
3096 case GF_STASIS_EVIL:
3098 if (seen) obvious = TRUE;
3100 if (r_ptr->flagsr & RFR_RES_ALL)
3102 note = _("には効果がなかった!", " is immune.");
3104 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3107 /* Attempt a saving throw */
3108 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3109 !(r_ptr->flags3 & RF3_EVIL) ||
3110 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3112 note = _("には効果がなかった。", " is unaffected.");
3117 /* Go to sleep (much) later */
3118 note = _("は動けなくなった!", " is suspended!");
3122 /* No "real" damage */
3127 /* Sleep (Use "dam" as "power") */
3130 if (seen) obvious = TRUE;
3132 if (r_ptr->flagsr & RFR_RES_ALL)
3134 note = _("には効果がなかった。", " is unaffected.");
3136 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3139 /* Attempt a saving throw */
3140 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3141 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3143 note = _("には効果がなかった。", " is unaffected.");
3148 /* Go to sleep (much) later */
3149 note = _("は動けなくなった!", " is suspended!");
3153 /* No "real" damage */
3162 vir = virtue_number(V_HARMONY);
3165 dam += p_ptr->virtues[vir-1]/10;
3168 vir = virtue_number(V_INDIVIDUALISM);
3171 dam -= p_ptr->virtues[vir-1]/20;
3174 if (seen) obvious = TRUE;
3176 /* Attempt a saving throw */
3177 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3181 /* No obvious effect */
3182 note = _("には効果がなかった。", " is unaffected.");
3185 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3187 else if (p_ptr->cursed & TRC_AGGRAVATE)
3189 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3190 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3194 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3197 chg_virtue(V_INDIVIDUALISM, -1);
3198 if (r_ptr->flags3 & RF3_ANIMAL)
3199 chg_virtue(V_NATURE, 1);
3202 /* No "real" damage */
3207 /* Control undead */
3208 case GF_CONTROL_UNDEAD:
3211 if (seen) obvious = TRUE;
3213 vir = virtue_number(V_UNLIFE);
3216 dam += p_ptr->virtues[vir-1]/10;
3219 vir = virtue_number(V_INDIVIDUALISM);
3222 dam -= p_ptr->virtues[vir-1]/20;
3225 /* Attempt a saving throw */
3226 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3227 !(r_ptr->flags3 & RF3_UNDEAD))
3229 /* No obvious effect */
3230 note = _("には効果がなかった。", " is unaffected.");
3232 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3234 else if (p_ptr->cursed & TRC_AGGRAVATE)
3236 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3237 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3241 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3245 /* No "real" damage */
3251 case GF_CONTROL_DEMON:
3254 if (seen) obvious = TRUE;
3256 vir = virtue_number(V_UNLIFE);
3259 dam += p_ptr->virtues[vir-1]/10;
3262 vir = virtue_number(V_INDIVIDUALISM);
3265 dam -= p_ptr->virtues[vir-1]/20;
3268 /* Attempt a saving throw */
3269 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3270 !(r_ptr->flags3 & RF3_DEMON))
3272 /* No obvious effect */
3273 note = _("には効果がなかった。", " is unaffected.");
3275 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3277 else if (p_ptr->cursed & TRC_AGGRAVATE)
3279 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3280 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3284 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3288 /* No "real" damage */
3294 case GF_CONTROL_ANIMAL:
3297 if (seen) obvious = TRUE;
3299 vir = virtue_number(V_NATURE);
3302 dam += p_ptr->virtues[vir-1]/10;
3305 vir = virtue_number(V_INDIVIDUALISM);
3308 dam -= p_ptr->virtues[vir-1]/20;
3311 /* Attempt a saving throw */
3312 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
3313 !(r_ptr->flags3 & RF3_ANIMAL))
3316 /* No obvious effect */
3317 note = _("には効果がなかった。", " is unaffected.");
3319 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3321 else if (p_ptr->cursed & TRC_AGGRAVATE)
3323 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3324 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3328 note = _("はなついた。", " is tamed!");
3330 if (r_ptr->flags3 & RF3_ANIMAL)
3331 chg_virtue(V_NATURE, 1);
3334 /* No "real" damage */
3340 case GF_CHARM_LIVING:
3344 vir = virtue_number(V_UNLIFE);
3345 if (seen) obvious = TRUE;
3347 vir = virtue_number(V_UNLIFE);
3350 dam -= p_ptr->virtues[vir-1]/10;
3353 vir = virtue_number(V_INDIVIDUALISM);
3356 dam -= p_ptr->virtues[vir-1]/20;
3359 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3361 /* Attempt a saving throw */
3362 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
3363 !monster_living(m_ptr->r_idx))
3366 /* No obvious effect */
3367 note = _("には効果がなかった。", " is unaffected.");
3369 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3371 else if (p_ptr->cursed & TRC_AGGRAVATE)
3373 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3374 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3378 note = _("を支配した。", " is tamed!");
3380 if (r_ptr->flags3 & RF3_ANIMAL)
3381 chg_virtue(V_NATURE, 1);
3384 /* No "real" damage */
3389 /* Confusion (Use "dam" as "power") */
3392 if (seen) obvious = TRUE;
3394 if (r_ptr->flagsr & RFR_RES_ALL)
3396 note = _("には効果がなかった。", " is unaffected.");
3398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3401 /* Get confused later */
3402 do_conf = damroll(3, (dam / 2)) + 1;
3404 /* Attempt a saving throw */
3405 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3406 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3407 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3409 /* Memorize a flag */
3410 if (r_ptr->flags3 & (RF3_NO_CONF))
3412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3418 /* No obvious effect */
3419 note = _("には効果がなかった。", " is unaffected.");
3423 /* No "real" damage */
3430 if (seen) obvious = TRUE;
3432 if (r_ptr->flagsr & RFR_RES_ALL)
3434 note = _("には効果がなかった。", " is unaffected.");
3436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3439 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3441 /* Attempt a saving throw */
3442 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3443 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3448 /* No obvious effect */
3449 note = _("には効果がなかった。", " is unaffected.");
3453 /* No "real" damage */
3461 /* Lite, but only hurts susceptible creatures */
3469 if (r_ptr->flagsr & RFR_RES_ALL)
3475 if (r_ptr->flags3 & (RF3_HURT_LITE))
3477 /* Obvious effect */
3478 if (seen) obvious = TRUE;
3480 /* Memorize the effects */
3481 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3483 /* Special effect */
3484 note = _("は光に身をすくめた!", " cringes from the light!");
3485 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3488 /* Normally no damage */
3500 /* Lite -- opposite of Dark */
3503 if (seen) obvious = TRUE;
3505 if (r_ptr->flagsr & RFR_RES_ALL)
3507 note = _("には完全な耐性がある!", " is immune.");
3509 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3512 if (r_ptr->flagsr & RFR_RES_LITE)
3514 note = _("には耐性がある!", " resists!");
3515 dam *= 2; dam /= (randint1(6)+6);
3516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3518 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3520 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3521 note = _("は光に身をすくめた!", " cringes from the light!");
3522 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3529 /* Dark -- opposite of Lite */
3532 if (seen) obvious = TRUE;
3534 if (r_ptr->flagsr & RFR_RES_ALL)
3536 note = _("には完全な耐性がある!", " is immune.");
3538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3541 if (r_ptr->flagsr & RFR_RES_DARK)
3543 note = _("には耐性がある!", " resists!");
3544 dam *= 2; dam /= (randint1(6)+6);
3545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3554 if (r_ptr->flagsr & RFR_RES_ALL)
3559 /* Hurt by rock remover */
3560 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3563 if (seen) obvious = TRUE;
3565 /* Memorize the effects */
3566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3568 /* Cute little message */
3569 note = _("の皮膚がただれた!", " loses some skin!");
3570 note_dies = _("はドロドロに溶けた!", " dissolves!");
3573 /* Usually, ignore the effects */
3584 /* Teleport undead (Use "dam" as "power") */
3585 case GF_AWAY_UNDEAD:
3587 /* Only affect undead */
3588 if (r_ptr->flags3 & (RF3_UNDEAD))
3590 bool resists_tele = FALSE;
3592 if (r_ptr->flagsr & RFR_RES_TELE)
3594 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3596 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3597 note = _("には効果がなかった。", " is unaffected.");
3598 resists_tele = TRUE;
3600 else if (r_ptr->level > randint1(100))
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3603 note = _("には耐性がある!", " resists!");
3604 resists_tele = TRUE;
3610 if (seen) obvious = TRUE;
3611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3623 /* No "real" damage */
3629 /* Teleport evil (Use "dam" as "power") */
3632 /* Only affect evil */
3633 if (r_ptr->flags3 & (RF3_EVIL))
3635 bool resists_tele = FALSE;
3637 if (r_ptr->flagsr & RFR_RES_TELE)
3639 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3642 note = _("には効果がなかった。", " is unaffected.");
3643 resists_tele = TRUE;
3645 else if (r_ptr->level > randint1(100))
3647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3648 note = _("には耐性がある!", " resists!");
3649 resists_tele = TRUE;
3655 if (seen) obvious = TRUE;
3656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3668 /* No "real" damage */
3674 /* Teleport monster (Use "dam" as "power") */
3677 bool resists_tele = FALSE;
3678 if (r_ptr->flagsr & RFR_RES_TELE)
3680 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3683 note = _("には効果がなかった。", " is unaffected.");
3684 resists_tele = TRUE;
3686 else if (r_ptr->level > randint1(100))
3688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3689 note = _("には耐性がある!", " resists!");
3690 resists_tele = TRUE;
3696 if (seen) obvious = TRUE;
3698 /* Prepare to teleport */
3702 /* No "real" damage */
3708 /* Turn undead (Use "dam" as "power") */
3709 case GF_TURN_UNDEAD:
3711 if (r_ptr->flagsr & RFR_RES_ALL)
3716 /* Only affect undead */
3717 if (r_ptr->flags3 & (RF3_UNDEAD))
3719 if (seen) obvious = TRUE;
3721 /* Learn about type */
3722 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3724 /* Apply some fear */
3725 do_fear = damroll(3, (dam / 2)) + 1;
3727 /* Attempt a saving throw */
3728 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3730 /* No obvious effect */
3731 note = _("には効果がなかった。", " is unaffected.");
3744 /* No "real" damage */
3750 /* Turn evil (Use "dam" as "power") */
3753 if (r_ptr->flagsr & RFR_RES_ALL)
3758 /* Only affect evil */
3759 if (r_ptr->flags3 & (RF3_EVIL))
3761 if (seen) obvious = TRUE;
3763 /* Learn about type */
3764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3766 /* Apply some fear */
3767 do_fear = damroll(3, (dam / 2)) + 1;
3769 /* Attempt a saving throw */
3770 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3772 /* No obvious effect */
3773 note = _("には効果がなかった。", " is unaffected.");
3786 /* No "real" damage */
3792 /* Turn monster (Use "dam" as "power") */
3795 if (r_ptr->flagsr & RFR_RES_ALL)
3800 if (seen) obvious = TRUE;
3802 /* Apply some fear */
3803 do_fear = damroll(3, (dam / 2)) + 1;
3805 /* Attempt a saving throw */
3806 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3807 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3808 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3810 /* No obvious effect */
3811 note = _("には効果がなかった。", " is unaffected.");
3816 /* No "real" damage */
3823 case GF_DISP_UNDEAD:
3825 if (r_ptr->flagsr & RFR_RES_ALL)
3831 /* Only affect undead */
3832 if (r_ptr->flags3 & (RF3_UNDEAD))
3834 if (seen) obvious = TRUE;
3836 /* Learn about type */
3837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3839 note = _("は身震いした。", " shudders.");
3840 note_dies = _("はドロドロに溶けた!", " dissolves!");
3860 if (r_ptr->flagsr & RFR_RES_ALL)
3866 /* Only affect evil */
3867 if (r_ptr->flags3 & (RF3_EVIL))
3869 if (seen) obvious = TRUE;
3871 /* Learn about type */
3872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3874 note = _("は身震いした。", " shudders.");
3875 note_dies = _("はドロドロに溶けた!", " dissolves!");
3894 if (r_ptr->flagsr & RFR_RES_ALL)
3900 /* Only affect good */
3901 if (r_ptr->flags3 & (RF3_GOOD))
3903 if (seen) obvious = TRUE;
3905 /* Learn about type */
3906 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3908 note = _("は身震いした。", " shudders.");
3909 note_dies = _("はドロドロに溶けた!", " dissolves!");
3926 case GF_DISP_LIVING:
3928 if (r_ptr->flagsr & RFR_RES_ALL)
3934 /* Only affect non-undead */
3935 if (monster_living(m_ptr->r_idx))
3937 if (seen) obvious = TRUE;
3939 note = _("は身震いした。", " shudders.");
3940 note_dies = _("はドロドロに溶けた!", " dissolves!");
3959 if (r_ptr->flagsr & RFR_RES_ALL)
3965 /* Only affect demons */
3966 if (r_ptr->flags3 & (RF3_DEMON))
3968 if (seen) obvious = TRUE;
3970 /* Learn about type */
3971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3973 note = _("は身震いした。", " shudders.");
3974 note_dies = _("はドロドロに溶けた!", " dissolves!");
3990 /* Dispel monster */
3993 if (r_ptr->flagsr & RFR_RES_ALL)
3999 if (seen) obvious = TRUE;
4001 note = _("は身震いした。", " shudders.");
4002 note_dies = _("はドロドロに溶けた!", " dissolves!");
4009 if (seen) obvious = TRUE;
4011 if (r_ptr->flagsr & RFR_RES_ALL)
4013 note = _("には完全な耐性がある!", " is immune.");
4015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4019 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4023 /* Heal the monster */
4024 if (caster_ptr->hp < caster_ptr->maxhp)
4027 caster_ptr->hp += dam;
4028 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4030 /* Redraw (later) if needed */
4031 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4032 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4034 /* Special message */
4037 monster_desc(killer, caster_ptr, 0);
4038 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4044 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4045 (void)hp_player(dam);
4050 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4059 if (seen) obvious = TRUE;
4060 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4062 if (r_ptr->flagsr & RFR_RES_ALL)
4064 note = _("には完全な耐性がある!", " is immune.");
4066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4070 /* Attempt a saving throw */
4071 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4072 (r_ptr->flags3 & RF3_NO_CONF) ||
4073 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4075 /* Memorize a flag */
4076 if (r_ptr->flags3 & (RF3_NO_CONF))
4078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4080 note = _("には効果がなかった。", " is unaffected.");
4083 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4086 note = _("には完全な耐性がある!", " is immune.");
4089 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4092 note = _("には耐性がある。", " resists.");
4097 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4098 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4100 if (who > 0) do_conf = randint0(4) + 4;
4101 else do_conf = randint0(8) + 8;
4107 case GF_BRAIN_SMASH:
4109 if (seen) obvious = TRUE;
4110 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4112 if (r_ptr->flagsr & RFR_RES_ALL)
4114 note = _("には完全な耐性がある!", " is immune.");
4116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4120 /* Attempt a saving throw */
4121 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4122 (r_ptr->flags3 & RF3_NO_CONF) ||
4123 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4125 /* Memorize a flag */
4126 if (r_ptr->flags3 & (RF3_NO_CONF))
4128 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4130 note = _("には効果がなかった。", " is unaffected.");
4133 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4136 note = _("には完全な耐性がある!", " is immune.");
4139 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4141 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4142 note = _("には耐性がある!", " resists!");
4147 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4148 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4152 do_conf = randint0(4) + 4;
4153 do_stun = randint0(4) + 4;
4157 do_conf = randint0(8) + 8;
4158 do_stun = randint0(8) + 8;
4160 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4168 if (seen) obvious = TRUE;
4169 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4171 if (r_ptr->flagsr & RFR_RES_ALL)
4173 note = _("には完全な耐性がある!", " is immune.");
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4179 /* Attempt a saving throw */
4180 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4182 note = _("には効果がなかった。", " is unaffected.");
4191 if (seen) obvious = TRUE;
4192 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4194 if (r_ptr->flagsr & RFR_RES_ALL)
4196 note = _("には完全な耐性がある!", " is immune.");
4198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4202 /* Attempt a saving throw */
4203 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4205 note = _("には効果がなかった。", " is unaffected.");
4214 if (seen) obvious = TRUE;
4215 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4217 if (r_ptr->flagsr & RFR_RES_ALL)
4219 note = _("には完全な耐性がある!", " is immune.");
4221 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4225 /* Attempt a saving throw */
4226 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4228 note = _("には効果がなかった。", " is unaffected.");
4237 if (seen) obvious = TRUE;
4239 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4240 "You point at %s, screaming the word, 'DIE!'."), m_name);
4242 if (r_ptr->flagsr & RFR_RES_ALL)
4244 note = _("には完全な耐性がある!", " is immune.");
4246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4250 /* Attempt a saving throw */
4251 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4253 note = _("には効果がなかった。", " is unaffected.");
4262 if (seen) obvious = TRUE;
4264 if (r_ptr->flagsr & RFR_RES_ALL)
4266 note = _("には完全な耐性がある!", " is immune.");
4268 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4272 if (r_ptr->flags1 & RF1_UNIQUE)
4274 note = _("には効果がなかった。", " is unaffected.");
4279 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4280 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4282 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4284 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4288 note = _("は耐性を持っている!", "resists!");
4295 /* Capture monster */
4299 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4300 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
4302 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4307 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4308 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
4309 nokori_hp = m_ptr->maxhp * 3 / 10;
4311 nokori_hp = m_ptr->maxhp * 3 / 20;
4313 if (m_ptr->hp >= nokori_hp)
4315 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4318 else if (m_ptr->hp < randint0(nokori_hp))
4320 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4321 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4322 cap_mon = m_ptr->r_idx;
4323 cap_mspeed = m_ptr->mspeed;
4325 cap_maxhp = m_ptr->max_maxhp;
4326 cap_nickname = m_ptr->nickname; /* Quark transfer */
4327 if (c_ptr->m_idx == p_ptr->riding)
4329 if (rakuba(-1, FALSE))
4331 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4335 delete_monster_idx(c_ptr->m_idx);
4341 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4347 /* Attack (Use "dam" as attack type) */
4350 /* Return this monster's death */
4351 return py_attack(y, x, dam);
4354 /* Sleep (Use "dam" as "power") */
4360 if (seen) obvious = TRUE;
4362 if (r_ptr->flagsr & RFR_RES_ALL)
4364 note = _("には効果がなかった。", " is unaffected.");
4366 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4369 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4371 note = _("には効果がなかった。", " is unaffected.");
4374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4377 if (MON_CSLEEP(m_ptr))
4379 note = _("には効果がなかった。", " is unaffected.");
4385 if (one_in_(5)) effect = 1;
4386 else if (one_in_(4)) effect = 2;
4387 else if (one_in_(3)) effect = 3;
4392 /* Powerful monsters can resist */
4393 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4394 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4396 note = _("には効果がなかった。", " is unaffected.");
4400 /* Normal monsters slow down */
4403 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4405 note = _("の動きが遅くなった。", " starts moving slower.");
4410 else if (effect == 2)
4412 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4414 /* Attempt a saving throw */
4415 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4416 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4421 /* No obvious effect */
4422 note = _("には効果がなかった。", " is unaffected.");
4427 else if (effect == 3)
4429 /* Attempt a saving throw */
4430 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4431 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4434 /* Memorize a flag */
4435 if (r_ptr->flags3 & RF3_NO_SLEEP)
4437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4440 /* No obvious effect */
4441 note = _("には効果がなかった。", " is unaffected.");
4446 /* Go to sleep (much) later */
4447 note = _("は眠り込んでしまった!", " falls asleep!");
4454 note = _("には効果がなかった。", " is unaffected.");
4457 /* No "real" damage */
4465 if (seen) obvious = TRUE;
4467 if (r_ptr->flagsr & RFR_RES_ALL)
4469 note = _("には効果がなかった。", " is unaffected.");
4471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4475 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4477 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4478 chg_virtue(V_VITALITY, -1);
4488 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4490 if (r_ptr->flags3 & (RF3_HURT_LITE))
4492 /* Obvious effect */
4493 if (seen) obvious = TRUE;
4495 /* Memorize the effects */
4496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4498 /* Special effect */
4499 note = _("は光に身をすくめた!", " cringes from the light!");
4500 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4503 /* Normally no damage */
4510 photo = m_ptr->r_idx;
4517 case GF_BLOOD_CURSE:
4519 if (seen) obvious = TRUE;
4521 if (r_ptr->flagsr & RFR_RES_ALL)
4523 note = _("には完全な耐性がある!", " is immune.");
4525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4533 bool success = FALSE;
4534 if (seen) obvious = TRUE;
4536 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4538 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4539 if (dam < 1) dam = 1;
4541 /* No need to tame your pet */
4544 note = _("の動きが速くなった。", " starts moving faster.");
4545 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4549 /* Attempt a saving throw */
4550 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4551 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4552 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4553 (p_ptr->cursed & TRC_AGGRAVATE) ||
4554 ((r_ptr->level+10) > randint1(dam)))
4557 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4561 note = _("を支配した。", " is tamed!");
4563 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4565 /* Learn about type */
4566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4573 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4575 do_fear = randint1(90)+10;
4577 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4580 /* No "real" damage */
4587 if (seen) obvious = TRUE;
4589 if (r_ptr->flagsr & RFR_RES_ALL)
4591 note = _("には完全な耐性がある!", " is immune.");
4593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4597 /* Attempt a saving throw */
4598 if (randint0(100 + dam) < (r_ptr->level + 50))
4600 note = _("には効果がなかった。", " is unaffected.");
4620 /* Absolutely no effect */
4621 if (skipped) return (FALSE);
4623 /* "Unique" monsters cannot be polymorphed */
4624 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4626 /* Quest monsters cannot be polymorphed */
4627 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4629 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4631 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4632 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4634 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4639 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4640 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4643 /* Modify the damage */
4645 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4646 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4648 /* Check for death */
4649 if (dam > m_ptr->hp)
4651 /* Extract method of death */
4656 /* Sound and Impact resisters never stun */
4658 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4659 !(r_ptr->flags3 & RF3_NO_STUN))
4661 if (seen) obvious = TRUE;
4664 if (MON_STUNNED(m_ptr))
4666 note = _("はひどくもうろうとした。", " is more dazed.");
4667 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4671 note = _("はもうろうとした。", " is dazed.");
4676 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4682 /* Confusion and Chaos resisters (and sleepers) never confuse */
4684 !(r_ptr->flags3 & RF3_NO_CONF) &&
4685 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4687 if (seen) obvious = TRUE;
4689 /* Already partially confused */
4690 if (MON_CONFUSED(m_ptr))
4692 note = _("はさらに混乱したようだ。", " looks more confused.");
4693 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4696 /* Was not confused */
4699 note = _("は混乱したようだ。", " looks confused.");
4703 /* Apply confusion */
4704 (void)set_monster_confused(c_ptr->m_idx, tmp);
4712 if (seen) obvious = TRUE;
4714 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4718 note = _("は弱くなったようだ。", " seems weakened.");
4719 m_ptr->maxhp -= do_time;
4720 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4725 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4726 if (do_poly && (randint1(90) > r_ptr->level))
4728 if (polymorph_monster(y, x))
4730 if (seen) obvious = TRUE;
4732 /* Monster polymorphs */
4733 note = _("が変身した!", " changes!");
4735 /* Turn off the damage */
4741 note = _("には効果がなかった。", " is unaffected.");
4744 /* Hack -- Get new monster */
4745 m_ptr = &m_list[c_ptr->m_idx];
4747 /* Hack -- Get new race */
4748 r_ptr = &r_info[m_ptr->r_idx];
4751 /* Handle "teleport" */
4754 if (seen) obvious = TRUE;
4756 note = _("が消え去った!", " disappears!");
4758 if (!who) chg_virtue(V_VALOUR, -1);
4761 teleport_away(c_ptr->m_idx, do_dist,
4762 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4764 /* Hack -- get new location */
4768 /* Hack -- get new grid */
4769 c_ptr = &cave[y][x];
4776 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4783 if (typ == GF_DRAIN_MANA)
4785 /* Drain mana does nothing */
4788 /* If another monster did the damage, hurt the monster by hand */
4791 /* Redraw (later) if needed */
4792 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4793 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4795 /* Wake the monster up */
4796 (void)set_monster_csleep(c_ptr->m_idx, 0);
4798 /* Hurt the monster */
4806 if (is_pet(m_ptr) && !(m_ptr->ml))
4809 /* Give detailed messages if destroyed */
4812 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4815 msg_format("%^s%s", m_name, note);
4823 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4825 /* Generate treasure, etc */
4826 monster_death(c_ptr->m_idx, FALSE);
4829 delete_monster_idx(c_ptr->m_idx);
4833 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4837 /* Damaged monster */
4840 /* Give detailed messages if visible or destroyed */
4841 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4843 /* Hack -- Pain message */
4846 message_pain(c_ptr->m_idx, dam);
4853 /* Hack -- handle sleep */
4854 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4858 else if (heal_leper)
4860 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4862 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4864 char m2_name[MAX_NLEN];
4866 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4867 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4870 delete_monster_idx(c_ptr->m_idx);
4873 /* If the player did it, give him experience, check fear */
4878 /* Hurt the monster, check for fear and death */
4879 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4884 /* Damaged monster */
4887 /* HACK - anger the monster before showing the sleep message */
4888 if (do_sleep) anger_monster(m_ptr);
4890 /* Give detailed messages if visible or destroyed */
4891 if (note && seen_msg)
4892 msg_format(_("%s%s", "%^s%s"), m_name, note);
4894 /* Hack -- Pain message */
4895 else if (known && (dam || !do_fear))
4897 message_pain(c_ptr->m_idx, dam);
4900 /* Anger monsters */
4901 if (((dam > 0) || get_angry) && !do_sleep)
4902 anger_monster(m_ptr);
4904 if ((fear || do_fear) && seen)
4907 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4910 /* Hack -- handle sleep */
4911 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4915 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4917 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4921 switch (randint1(28))
4926 msg_print(_("地面が揺れた...", "The ground trembles..."));
4927 earthquake(ty, tx, 4 + randint0(4));
4928 if (!one_in_(6)) break;
4930 case 3: case 4: case 5: case 6:
4933 int extra_dam = damroll(10, 10);
4934 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4936 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4937 if (!one_in_(6)) break;
4942 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4944 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4945 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4946 if (!one_in_(6)) break;
4948 case 9: case 10: case 11:
4949 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4950 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4951 if (!one_in_(6)) break;
4952 case 12: case 13: case 14: case 15: case 16:
4953 aggravate_monsters(0);
4954 if (!one_in_(6)) break;
4956 count += activate_hi_summon(ty, tx, TRUE);
4957 if (!one_in_(6)) break;
4958 case 19: case 20: case 21: case 22:
4960 bool pet = !one_in_(3);
4961 BIT_FLAGS mode = PM_ALLOW_GROUP;
4963 if (pet) mode |= PM_FORCE_PET;
4964 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4966 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode, '\0');
4967 if (!one_in_(6)) break;
4969 case 23: case 24: case 25:
4970 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4971 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4973 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4974 else lose_exp(p_ptr->exp / 16);
4975 if (!one_in_(6)) break;
4976 case 26: case 27: case 28:
4985 (void)do_dec_stat(i);
4994 (void)do_dec_stat(randint0(6));
5003 if (p_ptr->inside_battle)
5005 p_ptr->health_who = c_ptr->m_idx;
5006 p_ptr->redraw |= (PR_HEALTH);
5010 /* Verify this code */
5011 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
5013 /* Redraw the monster grid */
5017 /* Update monster recall window */
5018 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5020 p_ptr->window |= (PW_MONSTER);
5023 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5027 if (!(flg & PROJECT_NO_HANGEKI))
5029 set_target(m_ptr, monster_target_y, monster_target_x);
5032 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5034 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5038 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5040 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5041 rakubadam_m = (dam > 200) ? 200 : dam;
5051 /* Prepare to make a Blade of Chaos */
5052 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5054 q_ptr->pval = photo;
5056 /* Mark the item as fully known */
5057 q_ptr->ident |= (IDENT_MENTAL);
5059 /* Drop it in the dungeon */
5060 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5068 /* Return "Anything seen?" */
5073 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5074 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5075 * @param who_name 効果を起こしたモンスターの名前
5076 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5077 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5078 * @param x 目標X座標 / Target x location (or location to travel "towards")
5079 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5080 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5082 * @param monspell 効果元のモンスター魔法ID
5083 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5085 * Handle a beam/bolt/ball causing damage to the player.
5086 * This routine takes a "source monster" (by index), a "distance", a default
5087 * "damage", and a "damage type". See "project_m()" above.
5088 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5089 * is reduced (see "project_m()" above). This can happen if a monster breathes
5090 * at the player and hits a wall instead.
5091 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5092 * to know if this is actually a ball or a bolt spell
5093 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5094 * we just assume that the effects were obvious, for historical reasons.
5096 static bool project_p(MONSTER_IDX who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5101 /* Hack -- assume obvious */
5102 bool obvious = TRUE;
5104 /* Player blind-ness */
5105 bool blind = (p_ptr->blind ? TRUE : FALSE);
5107 /* Player needs a "description" (he is blind) */
5110 /* Source monster */
5111 monster_type *m_ptr = NULL;
5113 /* Monster name (for attacks) */
5114 GAME_TEXT m_name[MAX_NLEN];
5116 /* Monster name (for damage) */
5119 /* Hack -- messages */
5125 /* Player is not here */
5126 if (!player_bold(y, x)) return (FALSE);
5128 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5130 if (kawarimi(TRUE)) return FALSE;
5133 /* Player cannot hurt himself */
5134 if (!who) return (FALSE);
5135 if (who == p_ptr->riding) return (FALSE);
5137 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5140 int max_attempts = 10;
5141 sound(SOUND_REFLECT);
5144 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5145 else if (p_ptr->special_defense & KATA_FUUJIN)
5146 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5148 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5151 /* Choose 'new' target */
5156 t_y = m_list[who].fy - 1 + randint1(3);
5157 t_x = m_list[who].fx - 1 + randint1(3);
5160 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5162 if (max_attempts < 1)
5164 t_y = m_list[who].fy;
5165 t_x = m_list[who].fx;
5170 t_y = p_ptr->y - 1 + randint1(3);
5171 t_x = p_ptr->x - 1 + randint1(3);
5174 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5176 disturb(TRUE, TRUE);
5180 /* Limit maximum damage */
5181 if (dam > 1600) dam = 1600;
5183 /* Reduce damage by distance */
5184 dam = (dam + r) / (r + 1);
5187 /* If the player is blind, be more descriptive */
5188 if (blind) fuzzy = TRUE;
5193 m_ptr = &m_list[who];
5194 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5195 monster_desc(m_name, m_ptr, 0);
5197 /* Get the monster's real name (gotten before polymorph!) */
5198 strcpy(killer, who_name);
5204 case PROJECT_WHO_UNCTRL_POWER:
5205 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5208 case PROJECT_WHO_GLASS_SHARDS:
5209 strcpy(killer, _("ガラスの破片", "shards of glass"));
5213 strcpy(killer, _("罠", "a trap"));
5218 strcpy(m_name, killer);
5221 /* Analyze the damage */
5224 /* Standard damage -- hurts inventory too */
5227 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5228 get_damage = acid_dam(dam, killer, monspell, FALSE);
5232 /* Standard damage -- hurts inventory too */
5235 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5236 get_damage = fire_dam(dam, killer, monspell, FALSE);
5240 /* Standard damage -- hurts inventory too */
5243 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5244 get_damage = cold_dam(dam, killer, monspell, FALSE);
5248 /* Standard damage -- hurts inventory too */
5251 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5252 get_damage = elec_dam(dam, killer, monspell, FALSE);
5256 /* Standard damage -- also poisons player */
5259 bool double_resist = IS_OPPOSE_POIS();
5260 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5262 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5263 if (double_resist) dam = (dam + 2) / 3;
5265 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5270 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5272 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5274 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5279 /* Standard damage -- also poisons / mutates player */
5282 bool double_resist = IS_OPPOSE_POIS();
5283 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5285 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5286 if (double_resist) dam = (2 * dam + 2) / 5;
5287 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5288 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5290 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5292 if (one_in_(5)) /* 6 */
5294 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5295 if (one_in_(4)) /* 4 */
5303 inven_damage(set_acid_destroy, 2);
5309 /* Standard damage */
5312 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5313 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5317 /* Holy Orb -- Player only takes partial damage */
5320 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5321 if (p_ptr->align > 10)
5323 else if (p_ptr->align < -10)
5325 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5331 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5332 if (p_ptr->align > 10)
5334 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5338 /* Arrow -- XXX no dodging */
5343 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5345 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5347 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5350 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5354 /* Plasma -- XXX No resist */
5357 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5358 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5360 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5362 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5363 (void)set_stun(p_ptr->stun + plus_stun);
5366 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
5368 inven_damage(set_acid_destroy, 3);
5374 /* Nether -- drain experience */
5377 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5378 if (p_ptr->resist_neth)
5380 if (!prace_is_(RACE_SPECTRE))
5382 dam *= 6; dam /= (randint1(4) + 7);
5385 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5387 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5389 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5391 learn_spell(monspell);
5395 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5401 /* Water -- stun/confuse */
5404 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5405 if (!CHECK_MULTISHADOW())
5407 if (!p_ptr->resist_sound)
5409 set_stun(p_ptr->stun + randint1(40));
5411 if (!p_ptr->resist_conf)
5413 set_confused(p_ptr->confused + randint1(5) + 5);
5418 inven_damage(set_cold_destroy, 3);
5422 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5426 /* Chaos -- many effects */
5429 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5430 if (p_ptr->resist_chaos)
5432 dam *= 6; dam /= (randint1(4) + 7);
5435 if (!CHECK_MULTISHADOW())
5437 if (!p_ptr->resist_conf)
5439 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5441 if (!p_ptr->resist_chaos)
5443 (void)set_image(p_ptr->image + randint1(10));
5446 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5447 (void)gain_random_mutation(0);
5450 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5452 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5455 if (!p_ptr->resist_chaos || one_in_(9))
5457 inven_damage(set_elec_destroy, 2);
5458 inven_damage(set_fire_destroy, 2);
5462 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5466 /* Shards -- mostly cutting */
5469 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5470 if (p_ptr->resist_shard)
5472 dam *= 6; dam /= (randint1(4) + 7);
5474 else if (!CHECK_MULTISHADOW())
5476 (void)set_cut(p_ptr->cut + dam);
5479 if (!p_ptr->resist_shard || one_in_(13))
5481 inven_damage(set_cold_destroy, 2);
5484 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5488 /* Sound -- mostly stunning */
5491 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5492 if (p_ptr->resist_sound)
5494 dam *= 5; dam /= (randint1(4) + 7);
5496 else if (!CHECK_MULTISHADOW())
5498 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5499 (void)set_stun(p_ptr->stun + plus_stun);
5502 if (!p_ptr->resist_sound || one_in_(13))
5504 inven_damage(set_cold_destroy, 2);
5507 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5511 /* Pure confusion */
5514 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5515 if (p_ptr->resist_conf)
5517 dam *= 5; dam /= (randint1(4) + 7);
5519 else if (!CHECK_MULTISHADOW())
5521 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5523 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5527 /* Disenchantment -- see above */
5530 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5531 if (p_ptr->resist_disen)
5533 dam *= 6; dam /= (randint1(4) + 7);
5535 else if (!CHECK_MULTISHADOW())
5537 (void)apply_disenchant(0);
5539 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5543 /* Nexus -- see above */
5546 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5547 if (p_ptr->resist_nexus)
5549 dam *= 6; dam /= (randint1(4) + 7);
5551 else if (!CHECK_MULTISHADOW())
5555 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5559 /* Force -- mostly stun */
5562 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5563 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5565 (void)set_stun(p_ptr->stun + randint1(20));
5567 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5572 /* Rocket -- stun, cut */
5575 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5576 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5578 (void)set_stun(p_ptr->stun + randint1(20));
5581 if (p_ptr->resist_shard)
5585 else if (!CHECK_MULTISHADOW())
5587 (void)set_cut(p_ptr->cut + (dam / 2));
5590 if (!p_ptr->resist_shard || one_in_(12))
5592 inven_damage(set_cold_destroy, 3);
5595 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5599 /* Inertia -- slowness */
5602 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5603 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5604 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5608 /* Lite -- blinding */
5611 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5612 if (p_ptr->resist_lite)
5614 dam *= 4; dam /= (randint1(4) + 7);
5616 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5618 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5621 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5623 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5626 else if (prace_is_(RACE_S_FAIRY))
5631 if (p_ptr->wraith_form) dam *= 2;
5632 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5634 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5636 p_ptr->wraith_form = 0;
5637 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5638 "The light forces you out of your incorporeal shadow form."));
5640 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5641 p_ptr->update |= (PU_MONSTERS);
5642 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5648 /* Dark -- blinding */
5651 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5652 if (p_ptr->resist_dark)
5654 dam *= 4; dam /= (randint1(4) + 7);
5656 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5658 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5660 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5662 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5666 /* Time -- bolt fewer effects XXX */
5669 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5670 if (p_ptr->resist_time)
5673 dam /= (randint1(4) + 7);
5674 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5676 else if (!CHECK_MULTISHADOW())
5678 switch (randint1(10))
5680 case 1: case 2: case 3: case 4: case 5:
5682 if (p_ptr->prace == RACE_ANDROID) break;
5683 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5684 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5688 case 6: case 7: case 8: case 9:
5690 switch (randint1(6))
5692 case 1: k = A_STR; act = _("強く", "strong"); break;
5693 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5694 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5695 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5696 case 5: k = A_CON; act = _("健康で", "hale"); break;
5697 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5700 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5701 "You're not as %s as you used to be..."), act);
5703 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5704 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5705 p_ptr->update |= (PU_BONUS);
5711 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5712 "You're not as powerful as you used to be..."));
5714 for (k = 0; k < 6; k++)
5716 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5717 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5719 p_ptr->update |= (PU_BONUS);
5725 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5729 /* Gravity -- stun plus slowness plus teleport */
5732 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5733 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5735 if (!CHECK_MULTISHADOW())
5737 teleport_player(5, TELEPORT_PASSIVE);
5738 if (!p_ptr->levitation)
5739 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5740 if (!(p_ptr->resist_sound || p_ptr->levitation))
5742 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5743 (void)set_stun(p_ptr->stun + plus_stun);
5746 if (p_ptr->levitation)
5748 dam = (dam * 2) / 3;
5751 if (!p_ptr->levitation || one_in_(13))
5753 inven_damage(set_cold_destroy, 2);
5756 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5760 /* Standard damage */
5761 case GF_DISINTEGRATE:
5763 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5765 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5771 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5773 (void)hp_player(dam);
5780 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5781 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5788 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5789 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5795 if (p_ptr->free_act) break;
5796 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5798 if (ironman_nightmare)
5800 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5801 /* Have some nightmares */
5802 sanity_blast(NULL, FALSE);
5805 set_paralyzed(p_ptr->paralyzed + dam);
5815 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5816 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5823 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5824 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5831 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5833 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5834 if (!p_ptr->resist_shard || one_in_(13))
5836 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5837 inven_damage(set_cold_destroy, 2);
5843 /* Ice -- cold plus stun plus cuts */
5846 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5847 get_damage = cold_dam(dam, killer, monspell, FALSE);
5848 if (!CHECK_MULTISHADOW())
5850 if (!p_ptr->resist_shard)
5852 (void)set_cut(p_ptr->cut + damroll(5, 8));
5854 if (!p_ptr->resist_sound)
5856 (void)set_stun(p_ptr->stun + randint1(15));
5859 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5861 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5871 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5873 if (p_ptr->mimic_form)
5875 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5876 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5881 switch (p_ptr->prace)
5883 /* Some races are immune */
5897 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5909 if (CHECK_MULTISHADOW())
5911 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5913 else if (p_ptr->csp)
5917 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5919 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5922 if (dam >= p_ptr->csp)
5926 p_ptr->csp_frac = 0;
5935 learn_spell(monspell);
5936 p_ptr->redraw |= (PR_MANA);
5937 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5941 /* Heal the monster */
5942 if (m_ptr->hp < m_ptr->maxhp)
5946 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5948 /* Redraw (later) if needed */
5949 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5950 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5952 /* Special message */
5955 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5968 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5970 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5971 learn_spell(monspell);
5975 if (!CHECK_MULTISHADOW())
5977 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5979 if (!p_ptr->resist_conf)
5981 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5984 if (!p_ptr->resist_chaos && one_in_(3))
5986 (void)set_image(p_ptr->image + randint0(250) + 150);
5993 p_ptr->csp_frac = 0;
5995 p_ptr->redraw |= PR_MANA;
5998 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6004 case GF_BRAIN_SMASH:
6006 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6008 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6009 learn_spell(monspell);
6013 if (!CHECK_MULTISHADOW())
6015 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6021 p_ptr->csp_frac = 0;
6023 p_ptr->redraw |= PR_MANA;
6026 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6027 if (!CHECK_MULTISHADOW())
6029 if (!p_ptr->resist_blind)
6031 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6033 if (!p_ptr->resist_conf)
6035 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6037 if (!p_ptr->free_act)
6039 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6041 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6043 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6044 (void)do_dec_stat(A_INT);
6045 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6046 (void)do_dec_stat(A_WIS);
6048 if (!p_ptr->resist_chaos)
6050 (void)set_image(p_ptr->image + randint0(250) + 150);
6060 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6062 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6063 learn_spell(monspell);
6067 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6068 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6076 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6078 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6079 learn_spell(monspell);
6083 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6084 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6092 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6094 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6095 learn_spell(monspell);
6099 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6100 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6108 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6110 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6111 learn_spell(monspell);
6115 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6116 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6124 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6126 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6127 learn_spell(monspell);
6131 if (!CHECK_MULTISHADOW())
6133 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6134 curse_equipment(40, 20);
6137 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6139 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6154 /* Hex - revenge damage stored */
6155 revenge_store(get_damage);
6157 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6158 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6160 GAME_TEXT m_name_self[80];
6163 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6165 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6166 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6167 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6170 if (p_ptr->riding && dam > 0)
6172 rakubadam_p = (dam > 200) ? 200 : dam;
6176 disturb(TRUE, TRUE);
6179 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6181 (void)kawarimi(FALSE);
6184 /* Return "Anything seen?" */
6190 * Find the distance from (x, y) to a line.
6192 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6194 /* Vector from (x, y) to (x1, y1) */
6195 POSITION py = y1 - y;
6196 POSITION px = x1 - x;
6199 POSITION ny = x2 - x1;
6200 POSITION nx = y1 - y2;
6203 POSITION pd = distance(y1, x1, y, x);
6204 POSITION nd = distance(y1, x1, y2, x2);
6206 if (pd > nd) return distance(y, x, y2, x2);
6208 /* Component of P on N */
6209 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6211 /* Absolute value */
6212 return((nd >= 0) ? nd : 0 - nd);
6219 * Modified version of los() for calculation of disintegration balls.
6220 * Disintegration effects are stopped by permanent walls.
6222 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6224 POSITION dx, dy; /* Delta */
6225 POSITION ax, ay; /* Absolute */
6226 POSITION sx, sy; /* Signs */
6227 POSITION qx, qy; /* Fractions */
6228 POSITION tx, ty; /* Scanners */
6229 POSITION f1, f2; /* Scale factors */
6230 POSITION m; /* Slope, or 1/Slope, of LOS */
6232 /* Extract the offset */
6236 /* Extract the absolute offset */
6240 /* Handle adjacent (or identical) grids */
6241 if ((ax < 2) && (ay < 2)) return (TRUE);
6243 /* Paranoia -- require "safe" origin */
6244 /* if (!in_bounds(y1, x1)) return (FALSE); */
6246 /* Directly South/North */
6249 /* South -- check for walls */
6252 for (ty = y1 + 1; ty < y2; ty++)
6254 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6258 /* North -- check for walls */
6261 for (ty = y1 - 1; ty > y2; ty--)
6263 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6271 /* Directly East/West */
6274 /* East -- check for walls */
6277 for (tx = x1 + 1; tx < x2; tx++)
6279 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6283 /* West -- check for walls */
6286 for (tx = x1 - 1; tx > x2; tx--)
6288 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6296 /* Extract some signs */
6297 sx = (dx < 0) ? -1 : 1;
6298 sy = (dy < 0) ? -1 : 1;
6300 /* Vertical "knights" */
6305 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6309 /* Horizontal "knights" */
6314 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6318 /* Calculate scale factor div 2 */
6321 /* Calculate scale factor */
6325 /* Travel horizontally */
6328 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6334 /* Consider the special case where slope == 1. */
6345 /* Note (below) the case (qy == f2), where */
6346 /* the LOS exactly meets the corner of a tile. */
6349 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6360 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6373 /* Travel vertically */
6376 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6392 /* Note (below) the case (qx == f2), where */
6393 /* the LOS exactly meets the corner of a tile. */
6396 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6407 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6428 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)
6433 int brev = rad * rad / dist;
6437 int mdis = distance(y1, x1, y2, x2) + rad;
6439 while (bdis <= mdis)
6443 if ((0 < dist) && (path_n < dist))
6445 POSITION ny = GRID_Y(path_g[path_n]);
6446 POSITION nx = GRID_X(path_g[path_n]);
6447 POSITION nd = distance(ny, nx, y1, x1);
6449 /* Get next base point */
6458 /* Travel from center outward */
6459 for (cdis = 0; cdis <= brad; cdis++)
6461 /* Scan the maximal blast area of radius "cdis" */
6462 for (y = by - cdis; y <= by + cdis; y++)
6464 for (x = bx - cdis; x <= bx + cdis; x++)
6466 /* Ignore "illegal" locations */
6467 if (!in_bounds(y, x)) continue;
6469 /* Enforce a circular "ripple" */
6470 if (distance(y1, x1, y, x) != bdis) continue;
6472 /* Enforce an arc */
6473 if (distance(by, bx, y, x) != cdis) continue;
6479 /* Lights are stopped by opaque terrains */
6480 if (!los(by, bx, y, x)) continue;
6482 case GF_DISINTEGRATE:
6483 /* Disintegration are stopped only by perma-walls */
6484 if (!in_disintegration_range(by, bx, y, x)) continue;
6487 /* Ball explosions are stopped by walls */
6488 if (!projectable(by, bx, y, x)) continue;
6492 /* Save this grid */
6500 /* Encode some more "radius" info */
6501 gm[bdis + 1] = *pgrids;
6503 /* Increase the size */
6504 brad = rad * (path_n + brev) / (dist + brev);
6506 /* Find the next ripple */
6510 /* Store the effect size */
6516 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6517 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6518 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6519 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6520 * @param x 目標X座標 / Target x location (or location to travel "towards")
6521 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6522 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6523 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6524 * @param monspell 効果元のモンスター魔法ID
6525 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6528 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6529 * towards a given location (optionally passing over the heads of interposing
6530 * monsters), and have it do a given amount of damage to the monsters (and
6531 * optionally objects) within the given radius of the final location.
6533 * A "bolt" travels from source to target and affects only the target grid.
6534 * A "beam" travels from source to target, affecting all grids passed through.
6535 * A "ball" travels from source to the target, exploding at the target, and
6536 * affecting everything within the given radius of the target location.
6538 * Traditionally, a "bolt" does not affect anything on the ground, and does
6539 * not pass over the heads of interposing monsters, much like a traditional
6540 * missile, and will "stop" abruptly at the "target" even if no monster is
6541 * positioned there, while a "ball", on the other hand, passes over the heads
6542 * of monsters between the source and target, and affects everything except
6543 * the source monster which lies within the final radius, while a "beam"
6544 * affects every monster between the source and target, except for the casting
6545 * monster (or player), and rarely affects things on the ground.
6547 * Two special flags allow us to use this function in special ways, the
6548 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6549 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6550 * actually projecting from the source monster (or player).
6552 * The player will only get "experience" for monsters killed by himself
6553 * Unique monsters can only be destroyed by attacks from the player
6555 * Only 256 grids can be affected per projection, limiting the effective
6556 * "radius" of standard ball attacks to nine units (diameter nineteen).
6558 * One can project in a given "direction" by combining PROJECT_THRU with small
6559 * offsets to the initial location (see "line_spell()"), or by calculating
6560 * "virtual targets" far away from the player.
6562 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6563 * continuing until it actually hits somethings (useful for "stone to mud").
6565 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6567 * Balls must explode BEFORE hitting walls, or they would affect monsters
6568 * on both sides of a wall. Some bug reports indicate that this is still
6569 * happening in 2.7.8 for Windows, though it appears to be impossible.
6571 * We "pre-calculate" the blast area only in part for efficiency.
6572 * More importantly, this lets us do "explosions" from the "inside" out.
6573 * This results in a more logical distribution of "blast" treasure.
6574 * It also produces a better (in my opinion) animation of the explosion.
6575 * It could be (but is not) used to have the treasure dropped by monsters
6576 * in the middle of the explosion fall "outwards", and then be damaged by
6577 * the blast as it spreads outwards towards the treasure drop location.
6579 * Walls and doors are included in the blast area, so that they can be
6580 * "burned" or "melted" in later versions.
6582 * This algorithm is intended to maximize simplicity, not necessarily
6583 * efficiency, since this function is not a bottleneck in the code.
6585 * We apply the blast effect from ground zero outwards, in several passes,
6586 * first affecting features, then objects, then monsters, then the player.
6587 * This allows walls to be removed before checking the object or monster
6588 * in the wall, and protects objects which are dropped by monsters killed
6589 * in the blast, and allows the player to see all affects before he is
6590 * killed or teleported away. The semantics of this method are open to
6591 * various interpretations, but they seem to work well in practice.
6593 * We process the blast area from ground-zero outwards to allow for better
6594 * distribution of treasure dropped by monsters, and because it provides a
6595 * pleasing visual effect at low cost.
6597 * Note that the damage done by "ball" explosions decreases with distance.
6598 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6600 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6601 * the target, and then the damage "flows" along this beam of destruction.
6602 * The damage at every grid is the same as at the "center" of a "ball"
6603 * explosion, since the "beam" grids are treated as if they ARE at the
6604 * center of a "ball" explosion.
6606 * Currently, specifying "beam" plus "ball" means that locations which are
6607 * covered by the initial "beam", and also covered by the final "ball", except
6608 * for the final grid (the epicenter of the ball), will be "hit twice", once
6609 * by the initial beam, and once by the exploding ball. For the grid right
6610 * next to the epicenter, this results in 150% damage being done. The center
6611 * does not have this problem, for the same reason the final grid in a "beam"
6612 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6613 * grids which are covered by the "ball" will NOT work, as then they will
6614 * receive LESS damage than they should. Do not combine "beam" with "ball".
6616 * The array "gy[],gx[]" with current size "grids" is used to hold the
6617 * collected locations of all grids in the "blast area" plus "beam path".
6619 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6620 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6621 * first blast grid (see above) with radius "N" from the blast center. Note
6622 * that only the first gm[1] grids in the blast area thus take full damage.
6623 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6624 * number of blast grids.
6626 * Note that once the projection is complete, (y2,x2) holds the final location
6627 * of bolts/beams, and the "epicenter" of balls.
6629 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6630 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6631 * implementation of the "distance" function. Also, a bolt can be properly
6632 * viewed as a "ball" with a "rad" of "zero".
6634 * Note that if no "target" is reached before the beam/bolt/ball travels the
6635 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6636 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6638 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6639 * to move from point A to point B, even if the player cannot see part of the
6640 * projection path. Note that in general, the player will *always* see part
6641 * of the path, since it either starts at the player or ends on the player.
6643 * Hack -- we assume that every "projection" is "self-illuminating".
6645 * Hack -- when only a single monster is affected, we automatically track
6646 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6648 * Note that all projections now "explode" at their final destination, even
6649 * if they were being projected at a more distant destination. This means
6650 * that "ball" spells will *always* explode.
6652 * Note that we must call "handle_stuff()" after affecting terrain features
6653 * in the blast radius, in case the "illumination" of the grid was changed,
6654 * and "update_view()" and "update_monsters()" need to be called.
6657 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6667 POSITION y_saver, x_saver; /* For reflecting monsters */
6669 int msec = delay_factor * delay_factor * delay_factor;
6671 /* Assume the player sees nothing */
6672 bool notice = FALSE;
6674 /* Assume the player has seen nothing */
6675 bool visual = FALSE;
6677 /* Assume the player has seen no blast grids */
6680 /* Assume to be a normal ball spell */
6681 bool breath = FALSE;
6683 /* Is the player blind? */
6684 bool blind = (p_ptr->blind ? TRUE : FALSE);
6686 bool old_hide = FALSE;
6688 /* Number of grids in the "path" */
6691 /* Actual grids in the "path" */
6694 /* Number of grids in the "blast area" (including the "beam" path) */
6697 /* Coordinates of the affected grids */
6698 POSITION gx[1024], gy[1024];
6700 /* Encoded "radius" info (see above) */
6703 /* Actual radius encoded in gm[] */
6704 POSITION gm_rad = rad;
6708 /* Attacker's name (prepared before polymorph)*/
6709 GAME_TEXT who_name[MAX_NLEN];
6711 /* Can the player see the source of this effect? */
6712 bool see_s_msg = TRUE;
6714 /* Initialize by null string */
6720 /* Default target of monsterspell is player */
6721 monster_target_y = p_ptr->y;
6722 monster_target_x = p_ptr->x;
6724 /* Hack -- Jump to target */
6725 if (flg & (PROJECT_JUMP))
6730 /* Clear the flag */
6731 flg &= ~(PROJECT_JUMP);
6736 /* Start at player */
6743 /* Start at monster */
6746 x1 = m_list[who].fx;
6747 y1 = m_list[who].fy;
6748 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6760 /* Default "destination" */
6765 /* Hack -- verify stuff */
6766 if (flg & (PROJECT_THRU))
6768 if ((x1 == x2) && (y1 == y2))
6770 flg &= ~(PROJECT_THRU);
6774 /* Handle a breath attack */
6779 if (flg & PROJECT_HIDE) old_hide = TRUE;
6780 flg |= PROJECT_HIDE;
6784 /* Hack -- Assume there will be no blast (max radius 32) */
6785 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6793 /* Collect beam grids */
6794 if (flg & (PROJECT_BEAM))
6805 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6807 case GF_DISINTEGRATE:
6808 flg |= (PROJECT_GRID);
6809 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6813 /* Calculate the projection path */
6815 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6818 /* Giga-Hack SEEKER & SUPER_RAY */
6820 if( typ == GF_SEEKER )
6830 for (i = 0; i < path_n; ++i)
6835 int ny = GRID_Y(path_g[i]);
6836 int nx = GRID_X(path_g[i]);
6847 /* Only do visuals if requested */
6848 if (!blind && !(flg & (PROJECT_HIDE)))
6850 /* Only do visuals if the player can "see" the bolt */
6851 if (panel_contains(y, x) && player_has_los_bold(y, x))
6858 /* Obtain the bolt pict */
6859 p = bolt_pict(oy, ox, y, x, typ);
6861 /* Extract attr/char */
6865 /* Visual effects */
6866 print_rel(c, a, y, x);
6867 move_cursor_relative(y, x);
6868 /*if (fresh_before)*/ Term_fresh();
6869 Term_xtra(TERM_XTRA_DELAY, msec);
6871 /*if (fresh_before)*/ Term_fresh();
6873 /* Display "beam" grids */
6874 if (flg & (PROJECT_BEAM))
6876 /* Obtain the explosion pict */
6877 p = bolt_pict(y, x, y, x, typ);
6879 /* Extract attr/char */
6883 /* Visual effects */
6884 print_rel(c, a, y, x);
6887 /* Hack -- Activate delay */
6891 /* Hack -- delay anyway for consistency */
6894 /* Delay for consistency */
6895 Term_xtra(TERM_XTRA_DELAY, msec);
6898 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6899 if (is_mirror_grid(&cave[y][x]))
6901 /* The target of monsterspell becomes tha mirror(broken) */
6902 monster_target_y = y;
6903 monster_target_x = x;
6905 remove_mirror(y, x);
6906 next_mirror(&oy, &ox, y, x);
6908 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6909 for (j = last_i; j <= i; j++)
6911 y = GRID_Y(path_g[j]);
6912 x = GRID_X(path_g[j]);
6913 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6914 if (!who && (project_m_n == 1) && !jump) {
6915 if (cave[project_m_y][project_m_x].m_idx > 0) {
6916 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6920 /* Hack -- auto-recall */
6921 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6923 /* Hack - auto-track */
6924 health_track(cave[project_m_y][project_m_x].m_idx);
6928 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6933 for(i = last_i ; i < path_n ; i++)
6936 py = GRID_Y(path_g[i]);
6937 px = GRID_X(path_g[i]);
6938 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6940 if (!who && (project_m_n == 1) && !jump) {
6941 if (cave[project_m_y][project_m_x].m_idx > 0)
6943 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6947 /* Hack -- auto-recall */
6948 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6950 /* Hack - auto-track */
6951 health_track(cave[project_m_y][project_m_x].m_idx);
6955 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6959 else if(typ == GF_SUPER_RAY){
6961 int second_step = 0;
6968 for (i = 0; i < path_n; ++i)
6973 POSITION ny = GRID_Y(path_g[i]);
6974 POSITION nx = GRID_X(path_g[i]);
6985 /* Only do visuals if requested */
6986 if (!blind && !(flg & (PROJECT_HIDE)))
6988 /* Only do visuals if the player can "see" the bolt */
6989 if (panel_contains(y, x) && player_has_los_bold(y, x))
6996 /* Obtain the bolt pict */
6997 p = bolt_pict(oy, ox, y, x, typ);
6999 /* Extract attr/char */
7003 /* Visual effects */
7004 print_rel(c, a, y, x);
7005 move_cursor_relative(y, x);
7006 /*if (fresh_before)*/ Term_fresh();
7007 Term_xtra(TERM_XTRA_DELAY, msec);
7009 /*if (fresh_before)*/ Term_fresh();
7011 /* Display "beam" grids */
7012 if (flg & (PROJECT_BEAM))
7014 /* Obtain the explosion pict */
7015 p = bolt_pict(y, x, y, x, typ);
7017 /* Extract attr/char */
7021 /* Visual effects */
7022 print_rel(c, a, y, x);
7025 /* Hack -- Activate delay */
7029 /* Hack -- delay anyway for consistency */
7032 /* Delay for consistency */
7033 Term_xtra(TERM_XTRA_DELAY, msec);
7036 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7037 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7039 if( second_step )continue;
7042 if( is_mirror_grid(&cave[y][x]) && !second_step )
7044 /* The target of monsterspell becomes tha mirror(broken) */
7045 monster_target_y=(s16b)y;
7046 monster_target_x=(s16b)x;
7049 for( j = 0; j <=i ; j++ )
7051 y = GRID_Y(path_g[j]);
7052 x = GRID_X(path_g[j]);
7053 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7057 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7058 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7059 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7060 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7061 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7062 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7063 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7064 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7067 for( i = 0; i < path_n ; i++ )
7070 py = GRID_Y(path_g[i]);
7071 px = GRID_X(path_g[i]);
7072 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7073 if(!who && (project_m_n == 1) && !jump){
7074 if(cave[project_m_y][project_m_x].m_idx >0 ){
7075 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7079 /* Hack -- auto-recall */
7080 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7082 /* Hack - auto-track */
7083 health_track(cave[project_m_y][project_m_x].m_idx);
7087 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7092 /* Project along the path */
7093 for (i = 0; i < path_n; ++i)
7098 POSITION ny = GRID_Y(path_g[i]);
7099 POSITION nx = GRID_X(path_g[i]);
7101 if (flg & PROJECT_DISI)
7103 /* Hack -- Balls explode before reaching walls */
7104 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7106 else if (flg & PROJECT_LOS)
7108 /* Hack -- Balls explode before reaching walls */
7109 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7113 /* Hack -- Balls explode before reaching walls */
7114 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7121 /* Collect beam grids */
7122 if (flg & (PROJECT_BEAM))
7129 /* Only do visuals if requested */
7130 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7132 /* Only do visuals if the player can "see" the bolt */
7133 if (panel_contains(y, x) && player_has_los_bold(y, x))
7140 /* Obtain the bolt pict */
7141 p = bolt_pict(oy, ox, y, x, typ);
7143 /* Extract attr/char */
7147 /* Visual effects */
7148 print_rel(c, a, y, x);
7149 move_cursor_relative(y, x);
7150 /*if (fresh_before)*/ Term_fresh();
7151 Term_xtra(TERM_XTRA_DELAY, msec);
7153 /*if (fresh_before)*/ Term_fresh();
7155 /* Display "beam" grids */
7156 if (flg & (PROJECT_BEAM))
7158 /* Obtain the explosion pict */
7159 p = bolt_pict(y, x, y, x, typ);
7161 /* Extract attr/char */
7165 /* Visual effects */
7166 print_rel(c, a, y, x);
7169 /* Hack -- Activate delay */
7173 /* Hack -- delay anyway for consistency */
7176 /* Delay for consistency */
7177 Term_xtra(TERM_XTRA_DELAY, msec);
7184 /* Save the "blast epicenter" */
7188 if (breath && !path_n)
7194 flg &= ~(PROJECT_HIDE);
7198 /* Start the "explosion" */
7201 /* Hack -- make sure beams get to "explode" */
7209 /* If we found a "target", explode there */
7210 if (dist <= MAX_RANGE)
7212 /* Mega-Hack -- remove the final "beam" grid */
7213 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7216 * Create a conical breath attack
7227 flg &= ~(PROJECT_HIDE);
7229 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7233 /* Determine the blast area, work from the inside out */
7234 for (dist = 0; dist <= rad; dist++)
7236 /* Scan the maximal blast area of radius "dist" */
7237 for (y = by - dist; y <= by + dist; y++)
7239 for (x = bx - dist; x <= bx + dist; x++)
7241 /* Ignore "illegal" locations */
7242 if (!in_bounds2(y, x)) continue;
7244 /* Enforce a "circular" explosion */
7245 if (distance(by, bx, y, x) != dist) continue;
7251 /* Lights are stopped by opaque terrains */
7252 if (!los(by, bx, y, x)) continue;
7254 case GF_DISINTEGRATE:
7255 /* Disintegration are stopped only by perma-walls */
7256 if (!in_disintegration_range(by, bx, y, x)) continue;
7259 /* Ball explosions are stopped by walls */
7260 if (!projectable(by, bx, y, x)) continue;
7264 /* Save this grid */
7271 /* Encode some more "radius" info */
7277 /* Speed -- ignore "non-explosions" */
7278 if (!grids) return (FALSE);
7281 /* Display the "blast area" if requested */
7282 if (!blind && !(flg & (PROJECT_HIDE)))
7284 /* Then do the "blast", from inside out */
7285 for (t = 0; t <= gm_rad; t++)
7287 /* Dump everything with this radius */
7288 for (i = gm[t]; i < gm[t+1]; i++)
7290 /* Extract the location */
7294 /* Only do visuals if the player can "see" the blast */
7295 if (panel_contains(y, x) && player_has_los_bold(y, x))
7304 /* Obtain the explosion pict */
7305 p = bolt_pict(y, x, y, x, typ);
7307 /* Extract attr/char */
7311 /* Visual effects -- Display */
7312 print_rel(c, a, y, x);
7316 /* Hack -- center the cursor */
7317 move_cursor_relative(by, bx);
7319 /* Flush each "radius" seperately */
7320 /*if (fresh_before)*/ Term_fresh();
7322 /* Delay (efficiently) */
7323 if (visual || drawn)
7325 Term_xtra(TERM_XTRA_DELAY, msec);
7329 /* Flush the erasing */
7332 /* Erase the explosion drawn above */
7333 for (i = 0; i < grids; i++)
7335 /* Extract the location */
7339 /* Hack -- Erase if needed */
7340 if (panel_contains(y, x) && player_has_los_bold(y, x))
7346 /* Hack -- center the cursor */
7347 move_cursor_relative(by, bx);
7349 /* Flush the explosion */
7350 /*if (fresh_before)*/ Term_fresh();
7355 /* Update stuff if needed */
7356 if (p_ptr->update) handle_stuff();
7359 if (flg & PROJECT_KILL)
7361 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7362 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7366 /* Check features */
7367 if (flg & (PROJECT_GRID))
7369 /* Start with "dist" of zero */
7372 /* Scan for features */
7373 for (i = 0; i < grids; i++)
7375 /* Hack -- Notice new "dist" values */
7376 if (gm[dist+1] == i) dist++;
7378 /* Get the grid location */
7382 /* Find the closest point in the blast */
7385 int d = dist_to_line(y, x, y1, x1, by, bx);
7387 /* Affect the grid */
7388 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7392 /* Affect the grid */
7393 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7398 /* Update stuff if needed */
7399 if (p_ptr->update) handle_stuff();
7402 if (flg & (PROJECT_ITEM))
7404 /* Start with "dist" of zero */
7407 /* Scan for objects */
7408 for (i = 0; i < grids; i++)
7410 /* Hack -- Notice new "dist" values */
7411 if (gm[dist+1] == i) dist++;
7413 /* Get the grid location */
7417 /* Find the closest point in the blast */
7420 int d = dist_to_line(y, x, y1, x1, by, bx);
7422 /* Affect the object in the grid */
7423 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7427 /* Affect the object in the grid */
7428 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7434 /* Check monsters */
7435 if (flg & (PROJECT_KILL))
7442 /* Start with "dist" of zero */
7445 /* Scan for monsters */
7446 for (i = 0; i < grids; i++)
7450 /* Hack -- Notice new "dist" values */
7451 if (gm[dist + 1] == i) dist++;
7453 /* Get the grid location */
7457 /* A single bolt may be reflected */
7460 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7461 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7463 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7464 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7465 (!who || dist_hack > 1) && !one_in_(10))
7468 int max_attempts = 10;
7470 /* Choose 'new' target */
7473 t_y = y_saver - 1 + randint1(3);
7474 t_x = x_saver - 1 + randint1(3);
7477 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7479 if (max_attempts < 1)
7485 sound(SOUND_REFLECT);
7488 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7489 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7490 else if (m_ptr->r_idx == MON_DIO)
7491 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7493 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7495 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7497 /* Reflected bolts randomly target either one */
7498 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7499 else flg |= PROJECT_PLAYER;
7501 /* The bolt is reflected */
7502 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7504 /* Don't affect the monster any longer */
7510 /* Find the closest point in the blast */
7513 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7517 effective_dist = dist;
7521 /* There is the riding player on this monster */
7522 if (p_ptr->riding && player_bold(y, x))
7524 /* Aimed on the player */
7525 if (flg & PROJECT_PLAYER)
7527 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7530 * A beam or bolt is well aimed
7532 * So don't affects the mount.
7539 * The spell is not well aimed,
7540 * So partly affect the mount too.
7547 * This grid is the original target.
7548 * Or aimed on your horse.
7550 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7552 /* Hit the mount with full damage */
7556 * Otherwise this grid is not the
7557 * original target, it means that line
7558 * of fire is obstructed by this
7562 * A beam or bolt will hit either
7563 * player or mount. Choose randomly.
7565 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7569 /* Hit the mount with full damage */
7573 /* Hit the player later */
7574 flg |= PROJECT_PLAYER;
7576 /* Don't affect the mount */
7582 * The spell is not well aimed, so
7583 * partly affect both player and
7592 /* Affect the monster in the grid */
7593 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7597 /* Player affected one monster (without "jumping") */
7598 if (!who && (project_m_n == 1) && !jump)
7603 /* Track if possible */
7604 if (cave[y][x].m_idx > 0)
7606 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7610 /* Hack -- auto-recall */
7611 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7613 /* Hack - auto-track */
7614 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7622 if (flg & (PROJECT_KILL))
7624 /* Start with "dist" of zero */
7627 /* Scan for player */
7628 for (i = 0; i < grids; i++)
7632 /* Hack -- Notice new "dist" values */
7633 if (gm[dist+1] == i) dist++;
7635 /* Get the grid location */
7639 /* Affect the player? */
7640 if (!player_bold(y, x)) continue;
7642 /* Find the closest point in the blast */
7645 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7649 effective_dist = dist;
7652 /* Target may be your horse */
7655 /* Aimed on the player */
7656 if (flg & PROJECT_PLAYER)
7658 /* Hit the player with full damage */
7662 * Hack -- When this grid was not the
7663 * original target, a beam or bolt
7664 * would hit either player or mount,
7665 * and should be choosen randomly.
7667 * But already choosen to hit the
7668 * mount at this point.
7670 * Or aimed on your horse.
7672 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7675 * A beam or bolt is well aimed
7677 * So don't affects the player.
7684 * The spell is not well aimed,
7685 * So partly affect the player too.
7691 /* Affect the player */
7692 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7698 GAME_TEXT m_name[MAX_NLEN];
7700 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7702 if (rakubadam_m > 0)
7704 if (rakuba(rakubadam_m, FALSE))
7706 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7709 if (p_ptr->riding && rakubadam_p > 0)
7711 if(rakuba(rakubadam_p, FALSE))
7713 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7718 /* Return "something was noticed" */
7723 * @brief 鏡魔法「封魔結界」の効果処理
7725 * @return 効果があったらTRUEを返す
7727 bool binding_field(HIT_POINT dam)
7729 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7730 int mirror_num = 0; /* 鏡の数 */
7732 POSITION centersign;
7733 POSITION x1, x2, y1, y2;
7735 int msec = delay_factor*delay_factor*delay_factor;
7738 POSITION point_x[3];
7739 POSITION point_y[3];
7741 /* Default target of monsterspell is player */
7742 monster_target_y = p_ptr->y;
7743 monster_target_x = p_ptr->x;
7745 for (x = 0; x < cur_wid; x++)
7747 for (y = 0; y < cur_hgt; y++)
7749 if (is_mirror_grid(&cave[y][x]) &&
7750 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7751 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7752 player_has_los_bold(y, x) &&
7753 projectable(p_ptr->y, p_ptr->x, y, x)
7755 mirror_y[mirror_num] = y;
7756 mirror_x[mirror_num] = x;
7762 if (mirror_num < 2)return FALSE;
7764 point_x[0] = randint0(mirror_num);
7766 point_x[1] = randint0(mirror_num);
7767 } while (point_x[0] == point_x[1]);
7769 point_y[0] = mirror_y[point_x[0]];
7770 point_x[0] = mirror_x[point_x[0]];
7771 point_y[1] = mirror_y[point_x[1]];
7772 point_x[1] = mirror_x[point_x[1]];
7773 point_y[2] = p_ptr->y;
7774 point_x[2] = p_ptr->x;
7776 x = point_x[0] + point_x[1] + point_x[2];
7777 y = point_y[0] + point_y[1] + point_y[2];
7779 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7780 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7781 if (centersign == 0)return FALSE;
7783 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7784 x1 = x1 < point_x[2] ? x1 : point_x[2];
7785 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7786 y1 = y1 < point_y[2] ? y1 : point_y[2];
7788 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7789 x2 = x2 > point_x[2] ? x2 : point_x[2];
7790 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7791 y2 = y2 > point_y[2] ? y2 : point_y[2];
7793 for (y = y1; y <= y2; y++) {
7794 for (x = x1; x <= x2; x++) {
7795 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7796 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7797 centersign*((point_x[1] - x)*(point_y[2] - y)
7798 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7799 centersign*((point_x[2] - x)*(point_y[0] - y)
7800 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7802 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7803 /* Visual effects */
7805 && panel_contains(y, x)) {
7806 p = bolt_pict(y, x, y, x, GF_MANA);
7807 print_rel(PICT_C(p), PICT_A(p), y, x);
7808 move_cursor_relative(y, x);
7809 /*if (fresh_before)*/ Term_fresh();
7810 Term_xtra(TERM_XTRA_DELAY, msec);
7816 for (y = y1; y <= y2; y++) {
7817 for (x = x1; x <= x2; x++) {
7818 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7819 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7820 centersign*((point_x[1] - x)*(point_y[2] - y)
7821 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7822 centersign*((point_x[2] - x)*(point_y[0] - y)
7823 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7825 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7826 (void)project_f(0, 0, y, x, dam, GF_MANA);
7831 for (y = y1; y <= y2; y++) {
7832 for (x = x1; x <= x2; x++) {
7833 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7834 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7835 centersign*((point_x[1] - x)*(point_y[2] - y)
7836 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7837 centersign*((point_x[2] - x)*(point_y[0] - y)
7838 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7840 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7841 (void)project_o(0, 0, y, x, dam, GF_MANA);
7846 for (y = y1; y <= y2; y++) {
7847 for (x = x1; x <= x2; x++) {
7848 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7849 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7850 centersign*((point_x[1] - x)*(point_y[2] - y)
7851 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7852 centersign*((point_x[2] - x)*(point_y[0] - y)
7853 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7855 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7856 (void)project_m(0, 0, y, x, dam, GF_MANA,
7857 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7863 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7864 remove_mirror(point_y[0], point_x[0]);
7871 * @brief 鏡魔法「鏡の封印」の効果処理
7873 * @return 効果があったらTRUEを返す
7875 void seal_of_mirror(HIT_POINT dam)
7879 for (x = 0; x < cur_wid; x++)
7881 for (y = 0; y < cur_hgt; y++)
7883 if (is_mirror_grid(&cave[y][x]))
7885 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7886 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7888 if (!cave[y][x].m_idx)
7890 remove_mirror(y, x);