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.
16 /* ToDo: Make this global */
17 #define HURT_CHANCE 16 /*!< 属性攻撃を受けた際に能力値低下を起こす確率(1/X) / 1/x chance of reducing stats (for elemental attacks) */
19 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
20 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
22 int project_length = 0; /*!< 投射の射程距離 */
26 * @brief モンスター魅了用セービングスロー共通部
28 * @param m_ptr 対象モンスター
29 * @return 魅了に抵抗したらTRUE
31 static bool_hack common_saving_throw_charm(player_type *player_ptr, HIT_POINT pow, monster_type *m_ptr)
33 monster_race *r_ptr = &r_info[m_ptr->r_idx];
35 if(r_ptr->flagsr & RFR_RES_ALL || p_ptr->inside_arena) return TRUE;
37 pow += (adj_chr_chm[player_ptr->stat_ind[A_CHR]] - 1);
39 if((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL)) pow = pow * 2 / 3;
41 return (r_ptr->flags1 & RF1_QUESTOR) ||
42 (r_ptr->flags3 & RF3_NO_CONF) ||
43 (m_ptr->mflag2 & MFLAG2_NOPET) ||
44 (r_ptr->level > randint1((pow - 10) < 1 ? 1 : (pow - 10)) + 5);
48 * @brief 配置した鏡リストの次を取得する /
49 * Get another mirror. for SEEKER
50 * @param next_y 次の鏡のy座標を返す参照ポインタ
51 * @param next_x 次の鏡のx座標を返す参照ポインタ
52 * @param cury 現在の鏡のy座標
53 * @param curx 現在の鏡のx座標
55 static void next_mirror(int* next_y, int* next_x, int cury, int curx)
57 int mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
58 int mirror_num = 0; /* 鏡の数 */
62 for (x = 0; x < cur_wid; x++)
64 for (y = 0; y < cur_hgt; y++)
66 if (is_mirror_grid(&cave[y][x])) {
67 mirror_y[mirror_num] = y;
68 mirror_x[mirror_num] = x;
75 num = randint0(mirror_num);
76 *next_y = mirror_y[num];
77 *next_x = mirror_x[num];
80 *next_y = cury + randint0(5) - 2;
81 *next_x = curx + randint0(5) - 2;
86 * @brief 万色表現用にランダムな色を選択する関数 /
87 * Get a legal "multi-hued" color for drawing "spells"
91 static byte mh_attr(int max)
93 switch (randint1(max))
95 case 1: return (TERM_RED);
96 case 2: return (TERM_GREEN);
97 case 3: return (TERM_BLUE);
98 case 4: return (TERM_YELLOW);
99 case 5: return (TERM_ORANGE);
100 case 6: return (TERM_VIOLET);
101 case 7: return (TERM_L_RED);
102 case 8: return (TERM_L_GREEN);
103 case 9: return (TERM_L_BLUE);
104 case 10: return (TERM_UMBER);
105 case 11: return (TERM_L_UMBER);
106 case 12: return (TERM_SLATE);
107 case 13: return (TERM_WHITE);
108 case 14: return (TERM_L_WHITE);
109 case 15: return (TERM_L_DARK);
117 * @brief 魔法属性に応じたエフェクトの色を返す /
118 * Return a color to use for the bolt/ball spells
122 static byte spell_color(int type)
124 /* Check if A.B.'s new graphics should be used (rr9) */
125 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
130 case GF_PSY_SPEAR: return (0x06);
131 case GF_MISSILE: return (0x0F);
132 case GF_ACID: return (0x04);
133 case GF_ELEC: return (0x02);
134 case GF_FIRE: return (0x00);
135 case GF_COLD: return (0x01);
136 case GF_POIS: return (0x03);
137 case GF_HOLY_FIRE: return (0x00);
138 case GF_HELL_FIRE: return (0x00);
139 case GF_MANA: return (0x0E);
141 case GF_SEEKER: return (0x0E);
142 case GF_SUPER_RAY: return (0x0E);
144 case GF_ARROW: return (0x0F);
145 case GF_WATER: return (0x04);
146 case GF_NETHER: return (0x07);
147 case GF_CHAOS: return (mh_attr(15));
148 case GF_DISENCHANT: return (0x05);
149 case GF_NEXUS: return (0x0C);
150 case GF_CONFUSION: return (mh_attr(4));
151 case GF_SOUND: return (0x09);
152 case GF_SHARDS: return (0x08);
153 case GF_FORCE: return (0x09);
154 case GF_INERTIAL: return (0x09);
155 case GF_GRAVITY: return (0x09);
156 case GF_TIME: return (0x09);
157 case GF_LITE_WEAK: return (0x06);
158 case GF_LITE: return (0x06);
159 case GF_DARK_WEAK: return (0x07);
160 case GF_DARK: return (0x07);
161 case GF_PLASMA: return (0x0B);
162 case GF_METEOR: return (0x00);
163 case GF_ICE: return (0x01);
164 case GF_ROCKET: return (0x0F);
165 case GF_DEATH_RAY: return (0x07);
166 case GF_NUKE: return (mh_attr(2));
167 case GF_DISINTEGRATE: return (0x05);
179 case GF_CAUSE_4: return (0x0E);
180 case GF_HAND_DOOM: return (0x07);
181 case GF_CAPTURE : return (0x0E);
182 case GF_IDENTIFY: return (0x01);
183 case GF_ATTACK: return (0x0F);
184 case GF_PHOTO : return (0x06);
187 /* Normal tiles or ASCII */
193 /* Lookup the default colors for this type */
194 cptr s = quark_str(gf_color[type]);
197 if (!s) return (TERM_WHITE);
199 /* Pick a random color */
200 c = s[randint0(strlen(s))];
202 /* Lookup this color */
203 a = my_strchr(color_char, c) - color_char;
205 /* Invalid color (note check for < 0 removed, gave a silly
206 * warning because bytes are always >= 0 -- RG) */
207 if (a > 15) return (TERM_WHITE);
213 /* Standard "color" */
219 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
220 * Find the attr/char pair to use for a spell effect
229 * It is moving (or has moved) from (x,y) to (nx,ny).
230 * If the distance is not "one", we (may) return "*".
233 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
243 if ((ny == y) && (nx == x)) base = 0x30;
246 else if (nx == x) base = 0x40;
249 else if (ny == y) base = 0x50;
252 else if ((ny - y) == (x - nx)) base = 0x60;
255 else if ((ny - y) == (nx - x)) base = 0x70;
260 /* Basic spell color */
261 k = spell_color(typ);
263 /* Obtain attr/char */
264 a = misc_to_attr[base + k];
265 c = misc_to_char[base + k];
273 * @brief 始点から終点への経路を返す /
274 * Determine the path taken by a projection.
275 * @param gp 経路座標リストを返す参照ポインタ
285 * The projection will always start from the grid (y1,x1), and will travel
286 * towards the grid (y2,x2), touching one grid per unit of distance along
287 * the major axis, and stopping when it enters the destination grid or a
288 * wall grid, or has travelled the maximum legal distance of "range".
290 * Note that "distance" in this function (as in the "update_view()" code)
291 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
292 * actually has an "octagon of projection" not a "circle of projection".
294 * The path grids are saved into the grid array pointed to by "gp", and
295 * there should be room for at least "range" grids in "gp". Note that
296 * due to the way in which distance is calculated, this function normally
297 * uses fewer than "range" grids for the projection path, so the result
298 * of this function should never be compared directly to "range". Note
299 * that the initial grid (y1,x1) is never saved into the grid array, not
300 * even if the initial grid is also the final grid. XXX XXX XXX
302 * The "flg" flags can be used to modify the behavior of this function.
304 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
305 * semantics as they do for the "project" function, namely, that the path
306 * will stop as soon as it hits a monster, or that the path will continue
307 * through the destination grid, respectively.
309 * The "PROJECT_JUMP" flag, which for the "project()" function means to
310 * start at a special grid (which makes no sense in this function), means
311 * that the path should be "angled" slightly if needed to avoid any wall
312 * grids, allowing the player to "target" any grid which is in "view".
313 * This flag is non-trivial and has not yet been implemented, but could
314 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
316 * This function returns the number of grids (if any) in the path. This
317 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
319 * This algorithm is similar to, but slightly different from, the one used
320 * by "update_view_los()", and very different from the one used by "los()".
323 sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
345 /* No path necessary (or allowed) */
346 if ((x1 == x2) && (y1 == y2)) return (0);
374 /* Number of "units" in one "half" grid */
377 /* Number of "units" in one "full" grid */
383 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
394 /* Advance (X) part 2 */
397 /* Advance (X) part 3 */
404 /* Create the projection path */
408 gp[n++] = GRID(y, x);
410 /* Hack -- Check maximum range */
411 if ((n + (k >> 1)) >= range) break;
413 /* Sometimes stop at destination grid */
414 if (!(flg & (PROJECT_THRU)))
416 if ((x == x2) && (y == y2)) break;
419 if (flg & (PROJECT_DISI))
421 if ((n > 0) && cave_stop_disintegration(y, x)) break;
423 else if (flg & (PROJECT_LOS))
425 if ((n > 0) && !cave_los_bold(y, x)) break;
427 else if (!(flg & (PROJECT_PATH)))
429 /* Always stop at non-initial wall grids */
430 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
433 /* Sometimes stop at non-initial monsters/players */
434 if (flg & (PROJECT_STOP))
437 (player_bold(y, x) || cave[y][x].m_idx != 0))
441 if (!in_bounds(y, x)) break;
446 /* Advance (X) part 1 */
449 /* Horizontal change */
452 /* Advance (X) part 2 */
455 /* Advance (X) part 3 */
471 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
480 /* Vertical change */
483 /* Advance (Y) part 2 */
486 /* Advance (Y) part 3 */
493 /* Create the projection path */
497 gp[n++] = GRID(y, x);
499 /* Hack -- Check maximum range */
500 if ((n + (k >> 1)) >= range) break;
502 /* Sometimes stop at destination grid */
503 if (!(flg & (PROJECT_THRU)))
505 if ((x == x2) && (y == y2)) break;
508 if (flg & (PROJECT_DISI))
510 if ((n > 0) && cave_stop_disintegration(y, x)) break;
512 else if (flg & (PROJECT_LOS))
514 if ((n > 0) && !cave_los_bold(y, x)) break;
516 else if (!(flg & (PROJECT_PATH)))
518 /* Always stop at non-initial wall grids */
519 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
522 /* Sometimes stop at non-initial monsters/players */
523 if (flg & (PROJECT_STOP))
526 (player_bold(y, x) || cave[y][x].m_idx != 0))
530 if (!in_bounds(y, x)) break;
535 /* Advance (Y) part 1 */
538 /* Vertical change */
541 /* Advance (Y) part 2 */
544 /* Advance (Y) part 3 */
564 /* Create the projection path */
568 gp[n++] = GRID(y, x);
570 /* Hack -- Check maximum range */
571 if ((n + (n >> 1)) >= range) break;
573 /* Sometimes stop at destination grid */
574 if (!(flg & (PROJECT_THRU)))
576 if ((x == x2) && (y == y2)) break;
579 if (flg & (PROJECT_DISI))
581 if ((n > 0) && cave_stop_disintegration(y, x)) break;
583 else if (flg & (PROJECT_LOS))
585 if ((n > 0) && !cave_los_bold(y, x)) break;
587 else if (!(flg & (PROJECT_PATH)))
589 /* Always stop at non-initial wall grids */
590 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
593 /* Sometimes stop at non-initial monsters/players */
594 if (flg & (PROJECT_STOP))
597 (player_bold(y, x) || cave[y][x].m_idx != 0))
601 if (!in_bounds(y, x)) break;
618 * Mega-Hack -- track "affected" monsters (see "project()" comments)
620 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
621 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
622 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
623 /* Mega-Hack -- monsters target */
624 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
625 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
629 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
630 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
631 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
632 * @param y 目標Y座標 / Target y location (or location to travel "towards")
633 * @param x 目標X座標 / Target x location (or location to travel "towards")
634 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
635 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
636 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
639 * We are called both for "beam" effects and "ball" effects.
641 * The "r" parameter is the "distance from ground zero".
643 * Note that we determine if the player can "see" anything that happens
644 * by taking into account: blindness, line-of-sight, and illumination.
646 * We return "TRUE" if the effect of the projection is "obvious".
648 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
650 * XXX XXX XXX Perhaps we should affect doors?
653 static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
655 cave_type *c_ptr = &cave[y][x];
656 feature_type *f_ptr = &f_info[c_ptr->feat];
658 bool obvious = FALSE;
659 bool known = player_has_los_bold(y, x);
665 /* Reduce damage by distance */
666 dam = (dam + r) / (r + 1);
669 if (have_flag(f_ptr->flags, FF_TREE))
677 message = _("枯れた", "was blasted."); break;
679 message = _("縮んだ", "shrank."); break;
681 message = _("溶けた", "melted."); break;
684 message = _("凍り、砕け散った", "was frozen and smashed."); break;
688 message = _("燃えた", "burns up!"); break;
700 message = _("粉砕された", "was crushed."); break;
702 message = NULL;break;
706 msg_format(_("木は%s。", "A tree %s"), message);
707 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
710 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
714 /* Analyze the type */
717 /* Ignore most effects */
752 /* Destroy Traps (and Locks) */
755 /* Reveal secret doors */
756 if (is_hidden_door(c_ptr))
761 /* Check line of sight */
769 if (is_trap(c_ptr->feat))
771 /* Check line of sight */
774 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
778 /* Destroy the trap */
779 cave_alter_feat(y, x, FF_DISARM);
782 /* Locked doors are unlocked */
783 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
785 s16b old_feat = c_ptr->feat;
787 /* Unlock the door */
788 cave_alter_feat(y, x, FF_DISARM);
790 /* Check line of sound */
791 if (known && (old_feat != c_ptr->feat))
793 msg_print(_("カチッと音がした!", "Click!"));
798 /* Remove "unsafe" flag if player is not blind */
799 if (!p_ptr->blind && player_has_los_bold(y, x))
801 c_ptr->info &= ~(CAVE_UNSAFE);
812 /* Destroy Doors (and traps) */
815 /* Destroy all doors and traps */
816 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
818 /* Check line of sight */
822 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
826 /* Destroy the feature */
827 cave_alter_feat(y, x, FF_TUNNEL);
830 /* Remove "unsafe" flag if player is not blind */
831 if (!p_ptr->blind && player_has_los_bold(y, x))
833 c_ptr->info &= ~(CAVE_UNSAFE);
844 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
846 if (have_flag(f_ptr->flags, FF_SPIKE))
848 s16b old_mimic = c_ptr->mimic;
849 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
851 cave_alter_feat(y, x, FF_SPIKE);
853 c_ptr->mimic = old_mimic;
861 /* Check line of sight */
862 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
865 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
872 /* Destroy walls (and doors) */
875 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
878 if (known && (c_ptr->info & (CAVE_MARK)))
880 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
884 /* Destroy the wall */
885 cave_alter_feat(y, x, FF_HURT_ROCK);
887 /* Update some things */
888 p_ptr->update |= (PU_FLOW);
897 /* Require a "naked" floor grid */
898 if (!cave_naked_bold(y, x)) break;
900 /* Not on the player */
901 if (player_bold(y, x)) break;
903 /* Create a closed door */
904 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
907 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
924 /* Require a "naked" floor grid */
925 if (!cave_naked_bold(y, x)) break;
927 /* Not on the player */
928 if (player_bold(y, x)) break;
930 /* Create a closed door */
931 cave_set_feat(y, x, feat_tree);
934 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
942 /* Require a "naked" floor grid */
943 if (!cave_naked_bold(y, x)) break;
946 c_ptr->info |= CAVE_OBJECT;
947 c_ptr->mimic = feat_glyph;
960 /* Require a "naked" floor grid */
961 if (!cave_naked_bold(y, x)) break;
963 /* Not on the player */
964 if (player_bold(y, x)) break;
967 cave_set_feat(y, x, feat_granite);
975 /* Ignore permanent grid */
976 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
981 /* Ignore grid without enough space */
982 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
984 /* Place a shallow lava */
985 cave_set_feat(y, x, feat_shallow_lava);
990 /* Place a deep lava */
991 cave_set_feat(y, x, feat_deep_lava);
998 /* Ignore permanent grid */
999 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1004 /* Ignore grid without enough space */
1005 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1007 /* Place a shallow water */
1008 cave_set_feat(y, x, feat_shallow_water);
1013 /* Place a deep water */
1014 cave_set_feat(y, x, feat_deep_water);
1019 /* Lite up the grid */
1023 /* Turn on the light */
1024 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1026 c_ptr->info |= (CAVE_GLOW);
1034 update_local_illumination(y, x);
1037 if (player_can_see_bold(y, x)) obvious = TRUE;
1039 /* Mega-Hack -- Update the monster in the affected grid */
1040 /* This allows "spear of light" (etc) to work "correctly" */
1041 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1043 if (p_ptr->special_defense & NINJA_S_STEALTH)
1045 if (player_bold(y, x)) set_superstealth(FALSE);
1052 /* Darken the grid */
1056 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1059 /* Turn off the light. */
1062 if (dun_level || !is_daytime())
1064 for (j = 0; j < 9; j++)
1066 int by = y + ddy_ddd[j];
1067 int bx = x + ddx_ddd[j];
1069 if (in_bounds2(by, bx))
1071 cave_type *cc_ptr = &cave[by][bx];
1073 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1081 if (!do_dark) break;
1084 c_ptr->info &= ~(CAVE_GLOW);
1086 /* Hack -- Forget "boring" grids */
1087 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1090 c_ptr->info &= ~(CAVE_MARK);
1099 update_local_illumination(y, x);
1102 if (player_can_see_bold(y, x)) obvious = TRUE;
1104 /* Mega-Hack -- Update the monster in the affected grid */
1105 /* This allows "spear of light" (etc) to work "correctly" */
1106 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1116 if (is_mirror_grid(c_ptr))
1118 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1120 remove_mirror(y, x);
1121 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1124 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1127 if (known && (c_ptr->info & CAVE_MARK))
1129 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1133 /* Destroy the wall */
1134 cave_alter_feat(y, x, FF_HURT_ROCK);
1136 /* Update some things */
1137 p_ptr->update |= (PU_FLOW);
1144 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1146 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1148 remove_mirror(y, x);
1149 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1152 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1155 if (known && (c_ptr->info & CAVE_MARK))
1157 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1161 /* Destroy the wall */
1162 cave_alter_feat(y, x, FF_HURT_ROCK);
1164 /* Update some things */
1165 p_ptr->update |= (PU_FLOW);
1170 case GF_DISINTEGRATE:
1172 /* Destroy mirror/glyph */
1173 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1174 remove_mirror(y, x);
1176 /* Permanent features don't get effect */
1177 /* But not protect monsters and other objects */
1178 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1180 cave_alter_feat(y, x, FF_HURT_DISI);
1182 /* Update some things -- similar to GF_KILL_WALL */
1183 p_ptr->update |= (PU_FLOW);
1190 /* Return "Anything seen?" */
1197 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1198 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1199 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1200 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1201 * @param x 目標X座標 / Target x location (or location to travel "towards")
1202 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1203 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1204 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1207 * We are called from "project()" to "damage" objects
1209 * We are called both for "beam" effects and "ball" effects.
1211 * Perhaps we should only SOMETIMES damage things on the ground.
1213 * The "r" parameter is the "distance from ground zero".
1215 * Note that we determine if the player can "see" anything that happens
1216 * by taking into account: blindness, line-of-sight, and illumination.
1218 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1220 * We return "TRUE" if the effect of the projection is "obvious".
1223 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
1225 cave_type *c_ptr = &cave[y][x];
1227 OBJECT_IDX this_o_idx, next_o_idx = 0;
1229 bool obvious = FALSE;
1230 bool known = player_has_los_bold(y, x);
1232 BIT_FLAGS flgs[TR_FLAG_SIZE];
1234 char o_name[MAX_NLEN];
1236 KIND_OBJECT_IDX k_idx = 0;
1237 bool is_potion = FALSE;
1241 who = who ? who : 0;
1243 /* Reduce damage by distance */
1244 dam = (dam + r) / (r + 1);
1247 /* Scan all objects in the grid */
1248 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1250 /* Acquire object */
1251 object_type *o_ptr = &o_list[this_o_idx];
1253 bool is_art = FALSE;
1254 bool ignore = FALSE;
1255 bool do_kill = FALSE;
1257 cptr note_kill = NULL;
1260 /* Get the "plural"-ness */
1261 bool plural = (o_ptr->number > 1);
1264 /* Acquire next object */
1265 next_o_idx = o_ptr->next_o_idx;
1267 /* Extract the flags */
1268 object_flags(o_ptr, flgs);
1270 /* Check for artifact */
1271 if (object_is_artifact(o_ptr)) is_art = TRUE;
1273 /* Analyze the type */
1276 /* Acid -- Lots of things */
1279 if (hates_acid(o_ptr))
1282 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1283 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1288 /* Elec -- Rings and Wands */
1291 if (hates_elec(o_ptr))
1294 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1295 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1300 /* Fire -- Flammable objects */
1303 if (hates_fire(o_ptr))
1306 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1307 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1312 /* Cold -- potions and flasks */
1315 if (hates_cold(o_ptr))
1317 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1319 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1327 if (hates_fire(o_ptr))
1330 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1331 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1333 if (hates_elec(o_ptr))
1337 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1338 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1346 if (hates_fire(o_ptr))
1349 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1350 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1352 if (hates_cold(o_ptr))
1356 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1357 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1362 /* Hack -- break potions and such */
1368 if (hates_cold(o_ptr))
1370 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1376 /* Mana and Chaos -- destroy everything */
1382 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1386 case GF_DISINTEGRATE:
1389 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1396 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1397 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1398 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1402 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1406 if (object_is_cursed(o_ptr))
1409 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1416 identify_item(o_ptr);
1418 /* Auto-inscription */
1419 autopick_alter_item((-this_o_idx), FALSE);
1427 /* Chests are noticed only if trapped or locked */
1428 if (o_ptr->tval == TV_CHEST)
1430 /* Disarm/Unlock traps */
1431 if (o_ptr->pval > 0)
1433 /* Disarm or Unlock */
1434 o_ptr->pval = (0 - o_ptr->pval);
1437 object_known(o_ptr);
1440 if (known && (o_ptr->marked & OM_FOUND))
1442 msg_print(_("カチッと音がした!", "Click!"));
1452 if (o_ptr->tval == TV_CORPSE)
1455 BIT_FLAGS mode = 0L;
1457 if (!who || is_pet(&m_list[who]))
1458 mode |= PM_FORCE_PET;
1460 for (i = 0; i < o_ptr->number ; i++)
1462 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1463 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1467 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1471 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1473 note_kill = _("生き返った。", " revived.");
1475 else if (!note_kill)
1477 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1488 /* Attempt to destroy the object */
1491 /* Effect "observed" */
1492 if (known && (o_ptr->marked & OM_FOUND))
1495 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1498 /* Artifacts, and other objects, get to resist */
1499 if (is_art || ignore)
1501 /* Observe the resist */
1502 if (known && (o_ptr->marked & OM_FOUND))
1504 msg_format(_("%sは影響を受けない!",
1505 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1512 /* Describe if needed */
1513 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1515 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1518 k_idx = o_ptr->k_idx;
1519 is_potion = object_is_potion(o_ptr);
1522 /* Delete the object */
1523 delete_object_idx(this_o_idx);
1525 /* Potions produce effects when 'shattered' */
1528 (void)potion_smash_effect(who, y, x, k_idx);
1537 /* Return "Anything seen?" */
1543 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1544 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1545 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1546 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1547 * @param x 目標X座標 / Target x location (or location to travel "towards")
1548 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1549 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1551 * @param see_s_msg TRUEならばメッセージを表示する
1552 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1555 * This routine takes a "source monster" (by index) which is mostly used to
1556 * determine if the player is causing the damage, and a "radius" (see below),
1557 * which is used to decrease the power of explosions with distance, and a
1558 * location, via integers which are modified by certain types of attacks
1559 * (polymorph and teleport being the obvious ones), a default damage, which
1560 * is modified as needed based on various properties, and finally a "damage
1561 * type" (see below).
1564 * Note that this routine can handle "no damage" attacks (like teleport) by
1565 * taking a "zero" damage, and can even take "parameters" to attacks (like
1566 * confuse) by accepting a "damage", using it to calculate the effect, and
1567 * then setting the damage to zero. Note that the "damage" parameter is
1568 * divided by the radius, so monsters not at the "epicenter" will not take
1569 * as much damage (or whatever)...
1572 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1573 * may result in a dereference of an invalid pointer. XXX XXX XXX
1576 * Various messages are produced, and damage is applied.
1579 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1580 * actually be "made" of that substance, or "breathe" big balls of it.
1581 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1583 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1584 * and hurts evil less. If can breath nether, then it resists it as well.
1587 * Damage reductions use the following formulas:
1588 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1589 * gives avg damage of .655, ranging from .858 to .500
1590 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1591 * gives avg damage of .544, ranging from .714 to .417
1592 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1593 * gives avg damage of .444, ranging from .556 to .333
1594 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1595 * gives avg damage of .327, ranging from .427 to .250
1596 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1597 * gives something simple.
1600 * In this function, "result" messages are postponed until the end, where
1601 * the "note" string is appended to the monster name, if not NULL. So,
1602 * to make a spell have "no effect" just set "note" to NULL. You should
1603 * also set "notice" to FALSE, or the player will learn what the spell does.
1606 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1610 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, bool see_s_msg)
1614 cave_type *c_ptr = &cave[y][x];
1616 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1617 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1619 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1623 /* Is the monster "seen"? */
1624 bool seen = m_ptr->ml;
1625 bool seen_msg = is_seen(m_ptr);
1627 bool slept = (bool)MON_CSLEEP(m_ptr);
1629 /* Were the effects "obvious" (if seen)? */
1630 bool obvious = FALSE;
1632 /* Can the player know about this effect? */
1633 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1635 /* Were the effects "irrelevant"? */
1636 bool skipped = FALSE;
1638 /* Gets the monster angry at the source of the effect? */
1639 bool get_angry = FALSE;
1641 /* Polymorph setting (true or false) */
1642 bool do_poly = FALSE;
1644 /* Teleport setting (max distance) */
1647 /* Confusion setting (amount to confuse) */
1650 /* Stunning setting (amount to stun) */
1653 /* Sleep amount (amount to sleep) */
1656 /* Fear amount (amount to fear) */
1659 /* Time amount (amount to time) */
1662 bool heal_leper = FALSE;
1664 /* Hold the monster name */
1668 PARAMETER_VALUE photo = 0;
1670 /* Assume no note */
1673 /* Assume a default death */
1674 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1679 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1682 if (!c_ptr->m_idx) return (FALSE);
1684 /* Never affect projector */
1685 if (who && (c_ptr->m_idx == who)) return (FALSE);
1686 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1687 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1689 /* Don't affect already death monsters */
1690 /* Prevents problems with chain reactions of exploding monsters */
1691 if (m_ptr->hp < 0) return (FALSE);
1693 /* Reduce damage by distance */
1694 dam = (dam + r) / (r + 1);
1697 /* Get the monster name (BEFORE polymorphing) */
1698 monster_desc(m_name, m_ptr, 0);
1700 /* Get the monster possessive ("his"/"her"/"its") */
1701 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1703 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1705 /* Analyze the damage type */
1708 /* Magic Missile -- pure damage */
1711 if (seen) obvious = TRUE;
1713 if (r_ptr->flagsr & RFR_RES_ALL)
1715 note = _("には完全な耐性がある!", " is immune.");
1717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1726 if (seen) obvious = TRUE;
1728 if (r_ptr->flagsr & RFR_RES_ALL)
1730 note = _("には完全な耐性がある!", " is immune.");
1732 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1735 if (r_ptr->flagsr & RFR_IM_ACID)
1737 note = _("にはかなり耐性がある!", " resists a lot.");
1739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1747 if (seen) obvious = TRUE;
1749 if (r_ptr->flagsr & RFR_RES_ALL)
1751 note = _("には完全な耐性がある!", " is immune.");
1753 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1756 if (r_ptr->flagsr & RFR_IM_ELEC)
1758 note = _("にはかなり耐性がある!", " resists a lot.");
1760 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1768 if (seen) obvious = TRUE;
1770 if (r_ptr->flagsr & RFR_RES_ALL)
1772 note = _("には完全な耐性がある!", " is immune.");
1774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1777 if (r_ptr->flagsr & RFR_IM_FIRE)
1779 note = _("にはかなり耐性がある!", " resists a lot.");
1781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1783 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1785 note = _("はひどい痛手をうけた。", " is hit hard.");
1787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1795 if (seen) obvious = TRUE;
1797 if (r_ptr->flagsr & RFR_RES_ALL)
1799 note = _("には完全な耐性がある!", " is immune.");
1801 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1804 if (r_ptr->flagsr & RFR_IM_COLD)
1806 note = _("にはかなり耐性がある!", " resists a lot.");
1808 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1810 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1812 note = _("はひどい痛手をうけた。", " is hit hard.");
1814 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1822 if (seen) obvious = TRUE;
1824 if (r_ptr->flagsr & RFR_RES_ALL)
1826 note = _("には完全な耐性がある!", " is immune.");
1828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1831 if (r_ptr->flagsr & RFR_IM_POIS)
1833 note = _("にはかなり耐性がある!", " resists a lot.");
1835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1843 if (seen) obvious = TRUE;
1845 if (r_ptr->flagsr & RFR_RES_ALL)
1847 note = _("には完全な耐性がある!", " is immune.");
1849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1852 if (r_ptr->flagsr & RFR_IM_POIS)
1854 note = _("には耐性がある。", " resists.");
1855 dam *= 3; dam /= randint1(6) + 6;
1856 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1858 else if (one_in_(3)) do_poly = TRUE;
1862 /* Hellfire -- hurts Evil */
1865 if (seen) obvious = TRUE;
1867 if (r_ptr->flagsr & RFR_RES_ALL)
1869 note = _("には完全な耐性がある!", " is immune.");
1871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1874 if (r_ptr->flags3 & RF3_GOOD)
1876 note = _("はひどい痛手をうけた。", " is hit hard.");
1878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1883 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1886 if (seen) obvious = TRUE;
1888 if (r_ptr->flagsr & RFR_RES_ALL)
1890 note = _("には完全な耐性がある!", " is immune.");
1892 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1895 if (r_ptr->flags3 & RF3_GOOD)
1897 note = _("には完全な耐性がある!", " is immune.");
1899 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1901 else if (r_ptr->flags3 & RF3_EVIL)
1904 note = _("はひどい痛手をうけた。", " is hit hard.");
1905 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1909 note = _("には耐性がある。", " resists.");
1910 dam *= 3; dam /= randint1(6) + 6;
1915 /* Arrow -- XXX no defense */
1918 if (seen) obvious = TRUE;
1920 if (r_ptr->flagsr & RFR_RES_ALL)
1922 note = _("には完全な耐性がある!", " is immune.");
1924 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1930 /* Plasma -- XXX perhaps check ELEC or FIRE */
1933 if (seen) obvious = TRUE;
1935 if (r_ptr->flagsr & RFR_RES_ALL)
1937 note = _("には完全な耐性がある!", " is immune.");
1939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1942 if (r_ptr->flagsr & RFR_RES_PLAS)
1944 note = _("には耐性がある。", " resists.");
1945 dam *= 3; dam /= randint1(6) + 6;
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1951 /* Nether -- see above */
1954 if (seen) obvious = TRUE;
1956 if (r_ptr->flagsr & RFR_RES_ALL)
1958 note = _("には完全な耐性がある!", " is immune.");
1960 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1963 if (r_ptr->flagsr & RFR_RES_NETH)
1965 if (r_ptr->flags3 & RF3_UNDEAD)
1967 note = _("には完全な耐性がある!", " is immune.");
1969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1973 note = _("には耐性がある。", " resists.");
1974 dam *= 3; dam /= randint1(6) + 6;
1976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1978 else if (r_ptr->flags3 & RF3_EVIL)
1980 note = _("はいくらか耐性を示した。", " resists somewhat.");
1982 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1987 /* Water (acid) damage -- Water spirits/elementals are immune */
1990 if (seen) obvious = TRUE;
1992 if (r_ptr->flagsr & RFR_RES_ALL)
1994 note = _("には完全な耐性がある!", " is immune.");
1996 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1999 if (r_ptr->flagsr & RFR_RES_WATE)
2001 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2003 note = _("には完全な耐性がある!", " is immune.");
2008 note = _("には耐性がある。", " resists.");
2009 dam *= 3; dam /= randint1(6) + 6;
2011 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2016 /* Chaos -- Chaos breathers resist */
2019 if (seen) obvious = TRUE;
2021 if (r_ptr->flagsr & RFR_RES_ALL)
2023 note = _("には完全な耐性がある!", " is immune.");
2025 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2028 if (r_ptr->flagsr & RFR_RES_CHAO)
2030 note = _("には耐性がある。", " resists.");
2031 dam *= 3; dam /= randint1(6) + 6;
2032 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2034 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2036 note = _("はいくらか耐性を示した。", " resists somewhat.");
2037 dam *= 3; dam /= randint1(6) + 6;
2038 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2043 do_conf = (5 + randint1(11) + r) / (r + 1);
2048 /* Shards -- Shard breathers resist */
2051 if (seen) obvious = TRUE;
2053 if (r_ptr->flagsr & RFR_RES_ALL)
2055 note = _("には完全な耐性がある!", " is immune.");
2057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2060 if (r_ptr->flagsr & RFR_RES_SHAR)
2062 note = _("には耐性がある。", " resists.");
2063 dam *= 3; dam /= randint1(6) + 6;
2064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2069 /* Rocket: Shard resistance helps */
2072 if (seen) obvious = TRUE;
2074 if (r_ptr->flagsr & RFR_RES_ALL)
2076 note = _("には完全な耐性がある!", " is immune.");
2078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2081 if (r_ptr->flagsr & RFR_RES_SHAR)
2083 note = _("はいくらか耐性を示した。", " resists somewhat.");
2085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2091 /* Sound -- Sound breathers resist */
2094 if (seen) obvious = TRUE;
2096 if (r_ptr->flagsr & RFR_RES_ALL)
2098 note = _("には完全な耐性がある!", " is immune.");
2100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2103 if (r_ptr->flagsr & RFR_RES_SOUN)
2105 note = _("には耐性がある。", " resists.");
2106 dam *= 2; dam /= randint1(6) + 6;
2107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2109 else do_stun = (10 + randint1(15) + r) / (r + 1);
2116 if (seen) obvious = TRUE;
2118 if (r_ptr->flagsr & RFR_RES_ALL)
2120 note = _("には完全な耐性がある!", " is immune.");
2122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2125 if (r_ptr->flags3 & RF3_NO_CONF)
2127 note = _("には耐性がある。", " resists.");
2128 dam *= 3; dam /= randint1(6) + 6;
2129 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2131 else do_conf = (10 + randint1(15) + r) / (r + 1);
2135 /* Disenchantment -- Breathers and Disenchanters resist */
2138 if (seen) obvious = TRUE;
2140 if (r_ptr->flagsr & RFR_RES_ALL)
2142 note = _("には完全な耐性がある!", " is immune.");
2144 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2147 if (r_ptr->flagsr & RFR_RES_DISE)
2149 note = _("には耐性がある。", " resists.");
2150 dam *= 3; dam /= randint1(6) + 6;
2151 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2156 /* Nexus -- Breathers and Existers resist */
2159 if (seen) obvious = TRUE;
2161 if (r_ptr->flagsr & RFR_RES_ALL)
2163 note = _("には完全な耐性がある!", " is immune.");
2165 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2168 if (r_ptr->flagsr & RFR_RES_NEXU)
2170 note = _("には耐性がある。", " resists.");
2171 dam *= 3; dam /= randint1(6) + 6;
2172 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2180 if (seen) obvious = TRUE;
2182 if (r_ptr->flagsr & RFR_RES_ALL)
2184 note = _("には完全な耐性がある!", " is immune.");
2186 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2189 if (r_ptr->flagsr & RFR_RES_WALL)
2191 note = _("には耐性がある。", " resists.");
2192 dam *= 3; dam /= randint1(6) + 6;
2193 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2195 else do_stun = (randint1(15) + r) / (r + 1);
2199 /* Inertia -- breathers resist */
2202 if (seen) obvious = TRUE;
2204 if (r_ptr->flagsr & RFR_RES_ALL)
2206 note = _("には完全な耐性がある!", " is immune.");
2208 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2211 if (r_ptr->flagsr & RFR_RES_INER)
2213 note = _("には耐性がある。", " resists.");
2214 dam *= 3; dam /= randint1(6) + 6;
2215 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2219 /* Powerful monsters can resist */
2220 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2221 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2225 /* Normal monsters slow down */
2228 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2230 note = _("の動きが遅くなった。", " starts moving slower.");
2237 /* Time -- breathers resist */
2240 if (seen) obvious = TRUE;
2242 if (r_ptr->flagsr & RFR_RES_ALL)
2244 note = _("には完全な耐性がある!", " is immune.");
2246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2249 if (r_ptr->flagsr & RFR_RES_TIME)
2251 note = _("には耐性がある。", " resists.");
2252 dam *= 3; dam /= randint1(6) + 6;
2253 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2255 else do_time = (dam + 1) / 2;
2259 /* Gravity -- breathers resist */
2262 bool resist_tele = FALSE;
2264 if (seen) obvious = TRUE;
2266 if (r_ptr->flagsr & RFR_RES_ALL)
2268 note = _("には完全な耐性がある!", " is immune.");
2270 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2273 if (r_ptr->flagsr & RFR_RES_TELE)
2275 if (r_ptr->flags1 & (RF1_UNIQUE))
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2278 note = _("には効果がなかった。", " is unaffected!");
2281 else if (r_ptr->level > randint1(100))
2283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2284 note = _("には耐性がある!", " resists!");
2289 if (!resist_tele) do_dist = 10;
2291 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2293 if (r_ptr->flagsr & RFR_RES_GRAV)
2295 note = _("には耐性がある!", " resists!");
2296 dam *= 3; dam /= randint1(6) + 6;
2298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2303 /* Powerful monsters can resist */
2304 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2305 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2309 /* Normal monsters slow down */
2312 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2314 note = _("の動きが遅くなった。", " starts moving slower.");
2319 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2321 /* Attempt a saving throw */
2322 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2323 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2327 /* No obvious effect */
2328 note = _("には効果がなかった。", " is unaffected!");
2340 if (seen) obvious = TRUE;
2342 if (r_ptr->flagsr & RFR_RES_ALL)
2344 note = _("には完全な耐性がある!", " is immune.");
2346 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2354 case GF_DISINTEGRATE:
2356 if (seen) obvious = TRUE;
2358 if (r_ptr->flagsr & RFR_RES_ALL)
2360 note = _("には完全な耐性がある!", " is immune.");
2362 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2365 if (r_ptr->flags3 & RF3_HURT_ROCK)
2367 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2368 note = _("の皮膚がただれた!", " loses some skin!");
2369 note_dies = _("は蒸発した!", " evaporates!");
2377 if (seen) obvious = TRUE;
2379 /* PSI only works if the monster can see you! -- RG */
2380 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2383 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2388 if (r_ptr->flagsr & RFR_RES_ALL)
2390 note = _("には完全な耐性がある!", " is immune.");
2392 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2395 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2398 note = _("には完全な耐性がある!", " is immune.");
2399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2402 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2403 (r_ptr->flags3 & RF3_ANIMAL) ||
2404 (r_ptr->level > randint1(3 * dam)))
2406 note = _("には耐性がある!", " resists!");
2410 * Powerful demons & undead can turn a mindcrafter's
2411 * attacks back on them
2413 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2414 (r_ptr->level > p_ptr->lev / 2) &&
2418 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2419 (seen ? "%^s's corrupted mind backlashes your attack!" :
2420 "%^ss corrupted mind backlashes your attack!")), m_name);
2423 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2425 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2429 /* Injure +/- confusion */
2430 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2431 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2432 if (one_in_(4) && !CHECK_MULTISHADOW())
2434 switch (randint1(4))
2437 set_confused(p_ptr->confused + 3 + randint1(dam));
2440 set_stun(p_ptr->stun + randint1(dam));
2444 if (r_ptr->flags3 & RF3_NO_FEAR)
2445 note = _("には効果がなかった。", " is unaffected.");
2447 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2451 if (!p_ptr->free_act)
2452 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2461 if ((dam > 0) && one_in_(4))
2463 switch (randint1(4))
2466 do_conf = 3 + randint1(dam);
2469 do_stun = 3 + randint1(dam);
2472 do_fear = 3 + randint1(dam);
2475 note = _("は眠り込んでしまった!", " falls asleep!");
2476 do_sleep = 3 + randint1(dam);
2481 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2487 if (seen) obvious = TRUE;
2489 if (r_ptr->flagsr & RFR_RES_ALL)
2491 note = _("には完全な耐性がある!", " is immune.");
2493 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2496 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2499 note = _("には完全な耐性がある!", " is immune.");
2501 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2502 (r_ptr->flags3 & RF3_ANIMAL) ||
2503 (r_ptr->level > randint1(3 * dam)))
2505 note = _("には耐性がある!", " resists!");
2509 * Powerful demons & undead can turn a mindcrafter's
2510 * attacks back on them
2512 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2513 (r_ptr->level > p_ptr->lev / 2) &&
2517 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2518 (seen ? "%^s's corrupted mind backlashes your attack!" :
2519 "%^ss corrupted mind backlashes your attack!")), m_name);
2521 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2523 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2527 /* Injure + mana drain */
2528 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2529 if (!CHECK_MULTISHADOW())
2531 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2532 p_ptr->csp -= damroll(5, dam) / 2;
2533 if (p_ptr->csp < 0) p_ptr->csp = 0;
2534 p_ptr->redraw |= PR_MANA;
2535 p_ptr->window |= (PW_SPELL);
2537 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2544 int b = damroll(5, dam) / 4;
2545 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2546 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2547 (seen ? "You convert %s's pain into %s!" :
2548 "You convert %ss pain into %s!"));
2549 msg_format(msg, m_name, str);
2551 b = MIN(p_ptr->msp, p_ptr->csp + b);
2553 p_ptr->redraw |= PR_MANA;
2554 p_ptr->window |= (PW_SPELL);
2556 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2560 case GF_TELEKINESIS:
2562 if (seen) obvious = TRUE;
2564 if (r_ptr->flagsr & RFR_RES_ALL)
2566 note = _("には完全な耐性がある!", " is immune.");
2568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2573 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2578 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2580 /* Attempt a saving throw */
2581 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2582 (r_ptr->level > 5 + randint1(dam)))
2586 /* No obvious effect */
2592 /* Psycho-spear -- powerful magic missile */
2595 if (seen) obvious = TRUE;
2597 if (r_ptr->flagsr & RFR_RES_ALL)
2599 note = _("には完全な耐性がある!", " is immune.");
2601 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2607 /* Meteor -- powerful magic missile */
2610 if (seen) obvious = TRUE;
2612 if (r_ptr->flagsr & RFR_RES_ALL)
2614 note = _("には完全な耐性がある!", " is immune.");
2616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2624 if (!is_hostile(m_ptr)) break;
2626 if (seen) obvious = TRUE;
2628 if (r_ptr->flagsr & RFR_RES_ALL)
2630 note = _("には効果がなかった!", " is immune.");
2632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2635 /* Attempt a saving throw */
2636 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2637 (r_ptr->flags3 & RF3_NO_CONF) ||
2638 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2640 /* Memorize a flag */
2641 if (r_ptr->flags3 & RF3_NO_CONF)
2643 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2650 * Powerful demons & undead can turn a mindcrafter's
2651 * attacks back on them
2653 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2654 (r_ptr->level > p_ptr->lev / 2) &&
2658 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2659 (seen ? "%^s's corrupted mind backlashes your attack!" :
2660 "%^ss corrupted mind backlashes your attack!")), m_name);
2663 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2665 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2669 /* Confuse, stun, terrify */
2670 switch (randint1(4))
2673 set_stun(p_ptr->stun + dam / 2);
2676 set_confused(p_ptr->confused + dam / 2);
2680 if (r_ptr->flags3 & RF3_NO_FEAR)
2681 note = _("には効果がなかった。", " is unaffected.");
2683 set_afraid(p_ptr->afraid + dam);
2690 /* No obvious effect */
2691 note = _("には効果がなかった。", " is unaffected.");
2697 if ((dam > 29) && (randint1(100) < dam))
2699 note = _("があなたに隷属した。", " is in your thrall!");
2704 switch (randint1(4))
2718 /* No "real" damage */
2725 /* Ice -- Cold + Cuts + Stun */
2728 if (seen) obvious = TRUE;
2730 if (r_ptr->flagsr & RFR_RES_ALL)
2732 note = _("には完全な耐性がある!", " is immune.");
2734 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2737 do_stun = (randint1(15) + 1) / (r + 1);
2738 if (r_ptr->flagsr & RFR_IM_COLD)
2740 note = _("にはかなり耐性がある!", " resists a lot.");
2742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2744 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2746 note = _("はひどい痛手をうけた。", " is hit hard.");
2748 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2755 case GF_HYPODYNAMIA:
2757 if (seen) obvious = TRUE;
2759 if (r_ptr->flagsr & RFR_RES_ALL)
2761 note = _("には完全な耐性がある!", " is immune.");
2763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2766 if (!monster_living(r_ptr))
2768 if (is_original_ap_and_seen(m_ptr))
2770 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2771 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2772 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2774 note = _("には効果がなかった。", " is unaffected.");
2778 else do_time = (dam+7)/8;
2786 if (seen) obvious = TRUE;
2788 if (r_ptr->flagsr & RFR_RES_ALL)
2790 note = _("には完全な耐性がある!", " is immune.");
2792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2795 if (!monster_living(r_ptr))
2797 if (is_original_ap_and_seen(m_ptr))
2799 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2800 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2801 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2803 note = _("には完全な耐性がある!", " is immune.");
2807 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2808 (randint1(888) != 666)) ||
2809 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2810 randint1(100) != 66))
2812 note = _("には耐性がある!", " resists!");
2820 /* Polymorph monster (Use "dam" as "power") */
2823 if (seen) obvious = TRUE;
2825 if (r_ptr->flagsr & RFR_RES_ALL)
2827 note = _("には効果がなかった。", " is unaffected.");
2829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2832 /* Attempt to polymorph (see below) */
2835 /* Powerful monsters can resist */
2836 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2837 (r_ptr->flags1 & RF1_QUESTOR) ||
2838 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2840 note = _("には効果がなかった。", " is unaffected.");
2845 /* No "real" damage */
2852 /* Clone monsters (Ignore "dam") */
2855 if (seen) obvious = TRUE;
2857 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2859 note = _("には効果がなかった。", " is unaffected.");
2864 m_ptr->hp = m_ptr->maxhp;
2866 /* Attempt to clone. */
2867 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2869 note = _("が分裂した!", " spawns!");
2873 /* No "real" damage */
2880 /* Heal Monster (use "dam" as amount of healing) */
2883 if (seen) obvious = TRUE;
2886 (void)set_monster_csleep(c_ptr->m_idx, 0);
2888 if (m_ptr->maxhp < m_ptr->max_maxhp)
2890 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2891 m_ptr->maxhp = m_ptr->max_maxhp;
2896 /* Redraw (later) if needed */
2897 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2898 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2906 if (seen) obvious = TRUE;
2909 (void)set_monster_csleep(c_ptr->m_idx, 0);
2910 if (MON_STUNNED(m_ptr))
2912 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2913 (void)set_monster_stunned(c_ptr->m_idx, 0);
2915 if (MON_CONFUSED(m_ptr))
2917 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2918 (void)set_monster_confused(c_ptr->m_idx, 0);
2920 if (MON_MONFEAR(m_ptr))
2922 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2923 (void)set_monster_monfear(c_ptr->m_idx, 0);
2927 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2930 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2934 chg_virtue(V_VITALITY, 1);
2936 if (r_ptr->flags1 & RF1_UNIQUE)
2937 chg_virtue(V_INDIVIDUALISM, 1);
2939 if (is_friendly(m_ptr))
2940 chg_virtue(V_HONOUR, 1);
2941 else if (!(r_ptr->flags3 & RF3_EVIL))
2943 if (r_ptr->flags3 & RF3_GOOD)
2944 chg_virtue(V_COMPASSION, 2);
2946 chg_virtue(V_COMPASSION, 1);
2949 if (r_ptr->flags3 & RF3_ANIMAL)
2950 chg_virtue(V_NATURE, 1);
2953 if (m_ptr->r_idx == MON_LEPER)
2956 if (!who) chg_virtue(V_COMPASSION, 5);
2959 /* Redraw (later) if needed */
2960 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2961 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2964 note = _("は体力を回復したようだ。", " looks healthier.");
2966 /* No "real" damage */
2972 /* Speed Monster (Ignore "dam") */
2975 if (seen) obvious = TRUE;
2978 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2980 note = _("の動きが速くなった。", " starts moving faster.");
2985 if (r_ptr->flags1 & RF1_UNIQUE)
2986 chg_virtue(V_INDIVIDUALISM, 1);
2987 if (is_friendly(m_ptr))
2988 chg_virtue(V_HONOUR, 1);
2991 /* No "real" damage */
2997 /* Slow Monster (Use "dam" as "power") */
3000 if (seen) obvious = TRUE;
3002 if (r_ptr->flagsr & RFR_RES_ALL)
3004 note = _("には効果がなかった。", " is unaffected.");
3006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3009 /* Powerful monsters can resist */
3010 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3011 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3013 note = _("には効果がなかった。", " is unaffected.");
3017 /* Normal monsters slow down */
3020 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3022 note = _("の動きが遅くなった。", " starts moving slower.");
3026 /* No "real" damage */
3032 /* Sleep (Use "dam" as "power") */
3035 if (seen) obvious = TRUE;
3037 if (r_ptr->flagsr & RFR_RES_ALL)
3039 note = _("には効果がなかった。", " is unaffected.");
3041 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3044 /* Attempt a saving throw */
3045 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3046 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3047 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3049 /* Memorize a flag */
3050 if (r_ptr->flags3 & RF3_NO_SLEEP)
3052 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3054 /* No obvious effect */
3055 note = _("には効果がなかった。", " is unaffected.");
3060 /* Go to sleep (much) later */
3061 note = _("は眠り込んでしまった!", " falls asleep!");
3065 /* No "real" damage */
3071 /* Sleep (Use "dam" as "power") */
3072 case GF_STASIS_EVIL:
3074 if (seen) obvious = TRUE;
3076 if (r_ptr->flagsr & RFR_RES_ALL)
3078 note = _("には効果がなかった!", " is immune.");
3080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3083 /* Attempt a saving throw */
3084 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3085 !(r_ptr->flags3 & RF3_EVIL) ||
3086 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3088 note = _("には効果がなかった。", " is unaffected.");
3093 /* Go to sleep (much) later */
3094 note = _("は動けなくなった!", " is suspended!");
3098 /* No "real" damage */
3103 /* Sleep (Use "dam" as "power") */
3106 if (seen) obvious = TRUE;
3108 if (r_ptr->flagsr & RFR_RES_ALL)
3110 note = _("には効果がなかった。", " is unaffected.");
3112 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3115 /* Attempt a saving throw */
3116 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3117 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3119 note = _("には効果がなかった。", " is unaffected.");
3124 /* Go to sleep (much) later */
3125 note = _("は動けなくなった!", " is suspended!");
3129 /* No "real" damage */
3138 vir = virtue_number(V_HARMONY);
3141 dam += p_ptr->virtues[vir-1]/10;
3144 vir = virtue_number(V_INDIVIDUALISM);
3147 dam -= p_ptr->virtues[vir-1]/20;
3150 if (seen) obvious = TRUE;
3152 /* Attempt a saving throw */
3153 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
3156 /* Memorize a flag */
3157 if (r_ptr->flagsr & RFR_RES_ALL)
3159 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3162 if (r_ptr->flags3 & RF3_NO_CONF)
3164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3168 /* No obvious effect */
3169 note = _("には効果がなかった。", " is unaffected.");
3172 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3174 else if (p_ptr->cursed & TRC_AGGRAVATE)
3176 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3177 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3181 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3184 chg_virtue(V_INDIVIDUALISM, -1);
3185 if (r_ptr->flags3 & RF3_ANIMAL)
3186 chg_virtue(V_NATURE, 1);
3189 /* No "real" damage */
3194 /* Control undead */
3195 case GF_CONTROL_UNDEAD:
3198 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]] - 1);
3199 if (seen) obvious = TRUE;
3201 vir = virtue_number(V_UNLIFE);
3204 dam += p_ptr->virtues[vir-1]/10;
3207 vir = virtue_number(V_INDIVIDUALISM);
3210 dam -= p_ptr->virtues[vir-1]/20;
3213 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3215 note = _("には効果がなかった。", " is unaffected.");
3217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3221 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3224 /* Attempt a saving throw */
3225 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3226 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3227 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3228 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3230 /* No obvious effect */
3231 note = _("には効果がなかった。", " is unaffected.");
3233 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3235 else if (p_ptr->cursed & TRC_AGGRAVATE)
3237 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3238 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3242 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3246 /* No "real" damage */
3252 case GF_CONTROL_DEMON:
3255 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]] - 1);
3256 if (seen) obvious = TRUE;
3258 vir = virtue_number(V_UNLIFE);
3261 dam += p_ptr->virtues[vir-1]/10;
3264 vir = virtue_number(V_INDIVIDUALISM);
3267 dam -= p_ptr->virtues[vir-1]/20;
3270 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3272 note = _("には効果がなかった。", " is unaffected.");
3274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3278 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3281 /* Attempt a saving throw */
3282 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3283 (!(r_ptr->flags3 & RF3_DEMON)) ||
3284 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3285 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3287 /* No obvious effect */
3288 note = _("には効果がなかった。", " is unaffected.");
3291 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3293 else if (p_ptr->cursed & TRC_AGGRAVATE)
3295 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3296 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3300 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3304 /* No "real" damage */
3310 case GF_CONTROL_ANIMAL:
3313 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]] - 1);
3315 if (seen) obvious = TRUE;
3317 vir = virtue_number(V_NATURE);
3320 dam += p_ptr->virtues[vir-1]/10;
3323 vir = virtue_number(V_INDIVIDUALISM);
3326 dam -= p_ptr->virtues[vir-1]/20;
3329 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3331 note = _("には効果がなかった。", " is unaffected.");
3333 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3337 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3340 /* Attempt a saving throw */
3341 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3342 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3343 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3344 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3345 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3347 /* Memorize a flag */
3348 if (r_ptr->flags3 & (RF3_NO_CONF))
3350 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3354 /* No obvious effect */
3355 note = _("には効果がなかった。", " is unaffected.");
3358 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3360 else if (p_ptr->cursed & TRC_AGGRAVATE)
3362 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3363 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3367 note = _("はなついた。", " is tamed!");
3370 if (r_ptr->flags3 & RF3_ANIMAL)
3371 chg_virtue(V_NATURE, 1);
3374 /* No "real" damage */
3380 case GF_CONTROL_LIVING:
3384 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]] - 1);
3385 vir = virtue_number(V_UNLIFE);
3386 if (seen) obvious = TRUE;
3388 vir = virtue_number(V_UNLIFE);
3391 dam -= p_ptr->virtues[vir-1]/10;
3394 vir = virtue_number(V_INDIVIDUALISM);
3397 dam -= p_ptr->virtues[vir-1]/20;
3400 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
3401 if (dam < 1) dam = 1;
3402 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3403 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3405 note = _("には効果がなかった。", " is unaffected.");
3407 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3411 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3414 /* Attempt a saving throw */
3415 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3416 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3417 !monster_living(r_ptr) ||
3418 ((r_ptr->level+10) > randint1(dam)))
3421 /* No obvious effect */
3422 note = _("には効果がなかった。", " is unaffected.");
3425 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3427 else if (p_ptr->cursed & TRC_AGGRAVATE)
3429 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3430 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3434 note = _("を支配した。", " is tamed!");
3437 if (r_ptr->flags3 & RF3_ANIMAL)
3438 chg_virtue(V_NATURE, 1);
3441 /* No "real" damage */
3446 /* Confusion (Use "dam" as "power") */
3449 if (seen) obvious = TRUE;
3451 if (r_ptr->flagsr & RFR_RES_ALL)
3453 note = _("には効果がなかった。", " is unaffected.");
3455 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3458 /* Get confused later */
3459 do_conf = damroll(3, (dam / 2)) + 1;
3461 /* Attempt a saving throw */
3462 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3463 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3464 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3466 /* Memorize a flag */
3467 if (r_ptr->flags3 & (RF3_NO_CONF))
3469 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3475 /* No obvious effect */
3476 note = _("には効果がなかった。", " is unaffected.");
3480 /* No "real" damage */
3487 if (seen) obvious = TRUE;
3489 if (r_ptr->flagsr & RFR_RES_ALL)
3491 note = _("には効果がなかった。", " is unaffected.");
3493 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3496 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3498 /* Attempt a saving throw */
3499 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3500 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3505 /* No obvious effect */
3506 note = _("には効果がなかった。", " is unaffected.");
3510 /* No "real" damage */
3518 /* Lite, but only hurts susceptible creatures */
3526 if (r_ptr->flagsr & RFR_RES_ALL)
3532 if (r_ptr->flags3 & (RF3_HURT_LITE))
3534 /* Obvious effect */
3535 if (seen) obvious = TRUE;
3537 /* Memorize the effects */
3538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3540 /* Special effect */
3541 note = _("は光に身をすくめた!", " cringes from the light!");
3542 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3545 /* Normally no damage */
3557 /* Lite -- opposite of Dark */
3560 if (seen) obvious = TRUE;
3562 if (r_ptr->flagsr & RFR_RES_ALL)
3564 note = _("には完全な耐性がある!", " is immune.");
3566 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3569 if (r_ptr->flagsr & RFR_RES_LITE)
3571 note = _("には耐性がある!", " resists!");
3572 dam *= 2; dam /= (randint1(6)+6);
3573 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3575 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3578 note = _("は光に身をすくめた!", " cringes from the light!");
3579 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3586 /* Dark -- opposite of Lite */
3589 if (seen) obvious = TRUE;
3591 if (r_ptr->flagsr & RFR_RES_ALL)
3593 note = _("には完全な耐性がある!", " is immune.");
3595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3598 if (r_ptr->flagsr & RFR_RES_DARK)
3600 note = _("には耐性がある!", " resists!");
3601 dam *= 2; dam /= (randint1(6)+6);
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3611 if (r_ptr->flagsr & RFR_RES_ALL)
3616 /* Hurt by rock remover */
3617 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3620 if (seen) obvious = TRUE;
3622 /* Memorize the effects */
3623 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3625 /* Cute little message */
3626 note = _("の皮膚がただれた!", " loses some skin!");
3627 note_dies = _("はドロドロに溶けた!", " dissolves!");
3630 /* Usually, ignore the effects */
3641 /* Teleport undead (Use "dam" as "power") */
3642 case GF_AWAY_UNDEAD:
3644 /* Only affect undead */
3645 if (r_ptr->flags3 & (RF3_UNDEAD))
3647 bool resists_tele = FALSE;
3649 if (r_ptr->flagsr & RFR_RES_TELE)
3651 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3654 note = _("には効果がなかった。", " is unaffected.");
3655 resists_tele = TRUE;
3657 else if (r_ptr->level > randint1(100))
3659 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3660 note = _("には耐性がある!", " resists!");
3661 resists_tele = TRUE;
3667 if (seen) obvious = TRUE;
3668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3680 /* No "real" damage */
3686 /* Teleport evil (Use "dam" as "power") */
3689 /* Only affect evil */
3690 if (r_ptr->flags3 & (RF3_EVIL))
3692 bool resists_tele = FALSE;
3694 if (r_ptr->flagsr & RFR_RES_TELE)
3696 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3698 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3699 note = _("には効果がなかった。", " is unaffected.");
3700 resists_tele = TRUE;
3702 else if (r_ptr->level > randint1(100))
3704 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3705 note = _("には耐性がある!", " resists!");
3706 resists_tele = TRUE;
3712 if (seen) obvious = TRUE;
3713 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3725 /* No "real" damage */
3731 /* Teleport monster (Use "dam" as "power") */
3734 bool resists_tele = FALSE;
3735 if (r_ptr->flagsr & RFR_RES_TELE)
3737 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3740 note = _("には効果がなかった。", " is unaffected.");
3741 resists_tele = TRUE;
3743 else if (r_ptr->level > randint1(100))
3745 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3746 note = _("には耐性がある!", " resists!");
3747 resists_tele = TRUE;
3754 if (seen) obvious = TRUE;
3756 /* Prepare to teleport */
3760 /* No "real" damage */
3766 /* Turn undead (Use "dam" as "power") */
3767 case GF_TURN_UNDEAD:
3769 if (r_ptr->flagsr & RFR_RES_ALL)
3774 /* Only affect undead */
3775 if (r_ptr->flags3 & (RF3_UNDEAD))
3778 if (seen) obvious = TRUE;
3780 /* Learn about type */
3781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3783 /* Apply some fear */
3784 do_fear = damroll(3, (dam / 2)) + 1;
3786 /* Attempt a saving throw */
3787 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3789 /* No obvious effect */
3790 note = _("には効果がなかった。", " is unaffected.");
3803 /* No "real" damage */
3809 /* Turn evil (Use "dam" as "power") */
3812 if (r_ptr->flagsr & RFR_RES_ALL)
3817 /* Only affect evil */
3818 if (r_ptr->flags3 & (RF3_EVIL))
3821 if (seen) obvious = TRUE;
3823 /* Learn about type */
3824 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3826 /* Apply some fear */
3827 do_fear = damroll(3, (dam / 2)) + 1;
3829 /* Attempt a saving throw */
3830 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3832 /* No obvious effect */
3833 note = _("には効果がなかった。", " is unaffected.");
3846 /* No "real" damage */
3852 /* Turn monster (Use "dam" as "power") */
3855 if (r_ptr->flagsr & RFR_RES_ALL)
3861 if (seen) obvious = TRUE;
3863 /* Apply some fear */
3864 do_fear = damroll(3, (dam / 2)) + 1;
3866 /* Attempt a saving throw */
3867 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3868 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3869 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3871 /* No obvious effect */
3872 note = _("には効果がなかった。", " is unaffected.");
3877 /* No "real" damage */
3884 case GF_DISP_UNDEAD:
3886 if (r_ptr->flagsr & RFR_RES_ALL)
3892 /* Only affect undead */
3893 if (r_ptr->flags3 & (RF3_UNDEAD))
3896 if (seen) obvious = TRUE;
3898 /* Learn about type */
3899 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3902 note = _("は身震いした。", " shudders.");
3903 note_dies = _("はドロドロに溶けた!", " dissolves!");
3923 if (r_ptr->flagsr & RFR_RES_ALL)
3929 /* Only affect evil */
3930 if (r_ptr->flags3 & (RF3_EVIL))
3933 if (seen) obvious = TRUE;
3935 /* Learn about type */
3936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3939 note = _("は身震いした。", " shudders.");
3940 note_dies = _("はドロドロに溶けた!", " dissolves!");
3959 if (r_ptr->flagsr & RFR_RES_ALL)
3965 /* Only affect good */
3966 if (r_ptr->flags3 & (RF3_GOOD))
3969 if (seen) obvious = TRUE;
3971 /* Learn about type */
3972 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3975 note = _("は身震いした。", " shudders.");
3976 note_dies = _("はドロドロに溶けた!", " dissolves!");
3993 case GF_DISP_LIVING:
3995 if (r_ptr->flagsr & RFR_RES_ALL)
4001 /* Only affect non-undead */
4002 if (monster_living(r_ptr))
4005 if (seen) obvious = TRUE;
4008 note = _("は身震いした。", " shudders.");
4009 note_dies = _("はドロドロに溶けた!", " dissolves!");
4028 if (r_ptr->flagsr & RFR_RES_ALL)
4034 /* Only affect demons */
4035 if (r_ptr->flags3 & (RF3_DEMON))
4038 if (seen) obvious = TRUE;
4040 /* Learn about type */
4041 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4044 note = _("は身震いした。", " shudders.");
4045 note_dies = _("はドロドロに溶けた!", " dissolves!");
4061 /* Dispel monster */
4064 if (r_ptr->flagsr & RFR_RES_ALL)
4071 if (seen) obvious = TRUE;
4074 note = _("は身震いした。", " shudders.");
4075 note_dies = _("はドロドロに溶けた!", " dissolves!");
4082 if (seen) obvious = TRUE;
4084 if (r_ptr->flagsr & RFR_RES_ALL)
4086 note = _("には完全な耐性がある!", " is immune.");
4088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4092 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4096 /* Heal the monster */
4097 if (caster_ptr->hp < caster_ptr->maxhp)
4100 caster_ptr->hp += dam;
4101 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4103 /* Redraw (later) if needed */
4104 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4105 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4107 /* Special message */
4110 /* Get the monster name */
4111 monster_desc(killer, caster_ptr, 0);
4112 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4119 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4120 (void)hp_player(dam);
4125 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4134 if (seen) obvious = TRUE;
4136 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4138 if (r_ptr->flagsr & RFR_RES_ALL)
4140 note = _("には完全な耐性がある!", " is immune.");
4142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4146 /* Attempt a saving throw */
4147 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4148 (r_ptr->flags3 & RF3_NO_CONF) ||
4149 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4151 /* Memorize a flag */
4152 if (r_ptr->flags3 & (RF3_NO_CONF))
4154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4156 note = _("には効果がなかった。", " is unaffected.");
4159 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4162 note = _("には完全な耐性がある!", " is immune.");
4165 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4167 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4168 note = _("には耐性がある。", " resists.");
4173 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4174 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4176 if (who > 0) do_conf = randint0(4) + 4;
4177 else do_conf = randint0(8) + 8;
4183 case GF_BRAIN_SMASH:
4185 if (seen) obvious = TRUE;
4187 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4189 if (r_ptr->flagsr & RFR_RES_ALL)
4191 note = _("には完全な耐性がある!", " is immune.");
4193 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4197 /* Attempt a saving throw */
4198 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4199 (r_ptr->flags3 & RF3_NO_CONF) ||
4200 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4202 /* Memorize a flag */
4203 if (r_ptr->flags3 & (RF3_NO_CONF))
4205 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4207 note = _("には効果がなかった。", " is unaffected.");
4210 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4212 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4213 note = _("には完全な耐性がある!", " is immune.");
4216 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4219 note = _("には耐性がある!", " resists!");
4224 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4225 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4229 do_conf = randint0(4) + 4;
4230 do_stun = randint0(4) + 4;
4234 do_conf = randint0(8) + 8;
4235 do_stun = randint0(8) + 8;
4237 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4245 if (seen) obvious = TRUE;
4247 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4249 if (r_ptr->flagsr & RFR_RES_ALL)
4251 note = _("には完全な耐性がある!", " is immune.");
4253 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4257 /* Attempt a saving throw */
4258 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4260 note = _("には効果がなかった。", " is unaffected.");
4269 if (seen) obvious = TRUE;
4271 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4273 if (r_ptr->flagsr & RFR_RES_ALL)
4275 note = _("には完全な耐性がある!", " is immune.");
4277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4281 /* Attempt a saving throw */
4282 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4284 note = _("には効果がなかった。", " is unaffected.");
4293 if (seen) obvious = TRUE;
4295 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4297 if (r_ptr->flagsr & RFR_RES_ALL)
4299 note = _("には完全な耐性がある!", " is immune.");
4301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4305 /* Attempt a saving throw */
4306 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4308 note = _("には効果がなかった。", " is unaffected.");
4317 if (seen) obvious = TRUE;
4320 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4321 "You point at %s, screaming the word, 'DIE!'."), m_name);
4323 if (r_ptr->flagsr & RFR_RES_ALL)
4325 note = _("には完全な耐性がある!", " is immune.");
4327 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4331 /* Attempt a saving throw */
4332 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4334 note = _("には効果がなかった。", " is unaffected.");
4343 if (seen) obvious = TRUE;
4345 if (r_ptr->flagsr & RFR_RES_ALL)
4347 note = _("には完全な耐性がある!", " is immune.");
4349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4353 if (r_ptr->flags1 & RF1_UNIQUE)
4355 note = _("には効果がなかった。", " is unaffected.");
4360 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4361 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4363 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4365 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4369 note = _("は耐性を持っている!", "resists!");
4376 /* Capture monster */
4380 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4381 (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)
4383 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4388 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4389 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4390 nokori_hp = m_ptr->maxhp * 3 / 10;
4392 nokori_hp = m_ptr->maxhp * 3 / 20;
4394 if (m_ptr->hp >= nokori_hp)
4396 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4399 else if (m_ptr->hp < randint0(nokori_hp))
4401 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4402 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4403 cap_mon = m_ptr->r_idx;
4404 cap_mspeed = m_ptr->mspeed;
4406 cap_maxhp = m_ptr->max_maxhp;
4407 cap_nickname = m_ptr->nickname; /* Quark transfer */
4408 if (c_ptr->m_idx == p_ptr->riding)
4410 if (rakuba(-1, FALSE))
4412 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4416 delete_monster_idx(c_ptr->m_idx);
4422 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4428 /* Attack (Use "dam" as attack type) */
4431 /* Return this monster's death */
4432 return py_attack(y, x, dam);
4435 /* Sleep (Use "dam" as "power") */
4441 if (seen) obvious = TRUE;
4443 if (r_ptr->flagsr & RFR_RES_ALL)
4445 note = _("には効果がなかった。", " is unaffected.");
4447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4450 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4452 note = _("には効果がなかった。", " is unaffected.");
4455 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4458 if (MON_CSLEEP(m_ptr))
4460 note = _("には効果がなかった。", " is unaffected.");
4466 if (one_in_(5)) effect = 1;
4467 else if (one_in_(4)) effect = 2;
4468 else if (one_in_(3)) effect = 3;
4473 /* Powerful monsters can resist */
4474 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4475 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4477 note = _("には効果がなかった。", " is unaffected.");
4481 /* Normal monsters slow down */
4484 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4486 note = _("の動きが遅くなった。", " starts moving slower.");
4491 else if (effect == 2)
4493 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4495 /* Attempt a saving throw */
4496 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4497 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4502 /* No obvious effect */
4503 note = _("には効果がなかった。", " is unaffected.");
4508 else if (effect == 3)
4510 /* Attempt a saving throw */
4511 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4512 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4513 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4515 /* Memorize a flag */
4516 if (r_ptr->flags3 & RF3_NO_SLEEP)
4518 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4521 /* No obvious effect */
4522 note = _("には効果がなかった。", " is unaffected.");
4527 /* Go to sleep (much) later */
4528 note = _("は眠り込んでしまった!", " falls asleep!");
4535 note = _("には効果がなかった。", " is unaffected.");
4538 /* No "real" damage */
4546 if (seen) obvious = TRUE;
4548 if (r_ptr->flagsr & RFR_RES_ALL)
4550 note = _("には効果がなかった。", " is unaffected.");
4552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4556 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4558 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4559 chg_virtue(V_VITALITY, -1);
4569 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4571 if (r_ptr->flags3 & (RF3_HURT_LITE))
4573 /* Obvious effect */
4574 if (seen) obvious = TRUE;
4576 /* Memorize the effects */
4577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4579 /* Special effect */
4580 note = _("は光に身をすくめた!", " cringes from the light!");
4581 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4584 /* Normally no damage */
4591 photo = m_ptr->r_idx;
4598 case GF_BLOOD_CURSE:
4600 if (seen) obvious = TRUE;
4602 if (r_ptr->flagsr & RFR_RES_ALL)
4604 note = _("には完全な耐性がある!", " is immune.");
4606 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4614 bool success = FALSE;
4615 if (seen) obvious = TRUE;
4617 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4619 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4620 if (dam < 1) dam = 1;
4622 /* No need to tame your pet */
4625 note = _("の動きが速くなった。", " starts moving faster.");
4626 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4630 /* Attempt a saving throw */
4631 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4632 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4633 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4634 (p_ptr->cursed & TRC_AGGRAVATE) ||
4635 ((r_ptr->level+10) > randint1(dam)))
4638 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4642 note = _("を支配した。", " is tamed!");
4644 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4646 /* Learn about type */
4647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4654 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4656 do_fear = randint1(90)+10;
4658 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4661 /* No "real" damage */
4668 if (seen) obvious = TRUE;
4670 if (r_ptr->flagsr & RFR_RES_ALL)
4672 note = _("には完全な耐性がある!", " is immune.");
4674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4678 /* Attempt a saving throw */
4679 if (randint0(100 + dam) < (r_ptr->level + 50))
4681 note = _("には効果がなかった。", " is unaffected.");
4701 /* Absolutely no effect */
4702 if (skipped) return (FALSE);
4704 /* "Unique" monsters cannot be polymorphed */
4705 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4707 /* Quest monsters cannot be polymorphed */
4708 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4710 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4712 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4713 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4715 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4720 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4721 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4724 /* Modify the damage */
4726 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4727 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4729 /* Check for death */
4730 if (dam > m_ptr->hp)
4732 /* Extract method of death */
4737 /* Sound and Impact resisters never stun */
4739 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4740 !(r_ptr->flags3 & RF3_NO_STUN))
4743 if (seen) obvious = TRUE;
4746 if (MON_STUNNED(m_ptr))
4748 note = _("はひどくもうろうとした。", " is more dazed.");
4749 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4753 note = _("はもうろうとした。", " is dazed.");
4758 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4764 /* Confusion and Chaos resisters (and sleepers) never confuse */
4766 !(r_ptr->flags3 & RF3_NO_CONF) &&
4767 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4770 if (seen) obvious = TRUE;
4772 /* Already partially confused */
4773 if (MON_CONFUSED(m_ptr))
4775 note = _("はさらに混乱したようだ。", " looks more confused.");
4776 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4779 /* Was not confused */
4782 note = _("は混乱したようだ。", " looks confused.");
4786 /* Apply confusion */
4787 (void)set_monster_confused(c_ptr->m_idx, tmp);
4796 if (seen) obvious = TRUE;
4798 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4802 note = _("は弱くなったようだ。", " seems weakened.");
4803 m_ptr->maxhp -= do_time;
4804 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4809 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4810 if (do_poly && (randint1(90) > r_ptr->level))
4812 if (polymorph_monster(y, x))
4815 if (seen) obvious = TRUE;
4817 /* Monster polymorphs */
4818 note = _("が変身した!", " changes!");
4820 /* Turn off the damage */
4826 note = _("には効果がなかった。", " is unaffected.");
4829 /* Hack -- Get new monster */
4830 m_ptr = &m_list[c_ptr->m_idx];
4832 /* Hack -- Get new race */
4833 r_ptr = &r_info[m_ptr->r_idx];
4836 /* Handle "teleport" */
4840 if (seen) obvious = TRUE;
4843 note = _("が消え去った!", " disappears!");
4845 if (!who) chg_virtue(V_VALOUR, -1);
4848 teleport_away(c_ptr->m_idx, do_dist,
4849 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4851 /* Hack -- get new location */
4855 /* Hack -- get new grid */
4856 c_ptr = &cave[y][x];
4863 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4870 if (typ == GF_DRAIN_MANA)
4872 /* Drain mana does nothing */
4875 /* If another monster did the damage, hurt the monster by hand */
4878 /* Redraw (later) if needed */
4879 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4880 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4882 /* Wake the monster up */
4883 (void)set_monster_csleep(c_ptr->m_idx, 0);
4885 /* Hurt the monster */
4893 if (is_pet(m_ptr) && !(m_ptr->ml))
4896 /* Give detailed messages if destroyed */
4899 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4902 msg_format("%^s%s", m_name, note);
4910 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4912 /* Generate treasure, etc */
4913 monster_death(c_ptr->m_idx, FALSE);
4915 /* Delete the monster */
4916 delete_monster_idx(c_ptr->m_idx);
4920 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4924 /* Damaged monster */
4927 /* Give detailed messages if visible or destroyed */
4928 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4930 /* Hack -- Pain message */
4933 message_pain(c_ptr->m_idx, dam);
4940 /* Hack -- handle sleep */
4941 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4945 else if (heal_leper)
4947 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4949 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4953 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4954 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4957 delete_monster_idx(c_ptr->m_idx);
4960 /* If the player did it, give him experience, check fear */
4965 /* Hurt the monster, check for fear and death */
4966 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4971 /* Damaged monster */
4974 /* HACK - anger the monster before showing the sleep message */
4975 if (do_sleep) anger_monster(m_ptr);
4977 /* Give detailed messages if visible or destroyed */
4978 if (note && seen_msg)
4979 msg_format(_("%s%s", "%^s%s"), m_name, note);
4981 /* Hack -- Pain message */
4982 else if (known && (dam || !do_fear))
4984 message_pain(c_ptr->m_idx, dam);
4987 /* Anger monsters */
4988 if (((dam > 0) || get_angry) && !do_sleep)
4989 anger_monster(m_ptr);
4992 if ((fear || do_fear) && seen)
4998 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
5001 /* Hack -- handle sleep */
5002 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
5006 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
5008 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
5012 switch (randint1(28))
5017 msg_print(_("地面が揺れた...", "The ground trembles..."));
5018 earthquake(ty, tx, 4 + randint0(4));
5019 if (!one_in_(6)) break;
5021 case 3: case 4: case 5: case 6:
5024 int extra_dam = damroll(10, 10);
5025 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
5027 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
5028 if (!one_in_(6)) break;
5033 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5035 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5036 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5037 if (!one_in_(6)) break;
5039 case 9: case 10: case 11:
5040 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5041 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5042 if (!one_in_(6)) break;
5043 case 12: case 13: case 14: case 15: case 16:
5044 aggravate_monsters(0);
5045 if (!one_in_(6)) break;
5047 count += activate_hi_summon(ty, tx, TRUE);
5048 if (!one_in_(6)) break;
5049 case 19: case 20: case 21: case 22:
5051 bool pet = !one_in_(3);
5052 BIT_FLAGS mode = PM_ALLOW_GROUP;
5054 if (pet) mode |= PM_FORCE_PET;
5055 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5057 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);
5058 if (!one_in_(6)) break;
5060 case 23: case 24: case 25:
5061 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5062 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5064 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5065 else lose_exp(p_ptr->exp / 16);
5066 if (!one_in_(6)) break;
5067 case 26: case 27: case 28:
5076 (void)do_dec_stat(i);
5085 (void)do_dec_stat(randint0(6));
5094 if (p_ptr->inside_battle)
5096 p_ptr->health_who = c_ptr->m_idx;
5097 p_ptr->redraw |= (PR_HEALTH);
5101 /* XXX XXX XXX Verify this code */
5103 /* Update the monster */
5104 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5106 /* Redraw the monster grid */
5110 /* Update monster recall window */
5111 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5114 p_ptr->window |= (PW_MONSTER);
5117 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5121 if (!(flg & PROJECT_NO_HANGEKI))
5123 set_target(m_ptr, monster_target_y, monster_target_x);
5126 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5128 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5132 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5134 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5135 rakubadam_m = (dam > 200) ? 200 : dam;
5144 /* Get local object */
5147 /* Prepare to make a Blade of Chaos */
5148 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5150 q_ptr->pval = photo;
5152 /* Mark the item as fully known */
5153 q_ptr->ident |= (IDENT_MENTAL);
5155 /* Drop it in the dungeon */
5156 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5164 /* Return "Anything seen?" */
5169 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5170 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5171 * @param who_name 効果を起こしたモンスターの名前
5172 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5173 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5174 * @param x 目標X座標 / Target x location (or location to travel "towards")
5175 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5176 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5178 * @param monspell 効果元のモンスター魔法ID
5179 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5181 * Handle a beam/bolt/ball causing damage to the player.
5182 * This routine takes a "source monster" (by index), a "distance", a default
5183 * "damage", and a "damage type". See "project_m()" above.
5184 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5185 * is reduced (see "project_m()" above). This can happen if a monster breathes
5186 * at the player and hits a wall instead.
5187 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5188 * to know if this is actually a ball or a bolt spell
5189 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5190 * we just assume that the effects were obvious, for historical reasons.
5192 static bool project_p(int who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
5197 /* Hack -- assume obvious */
5198 bool obvious = TRUE;
5200 /* Player blind-ness */
5201 bool blind = (p_ptr->blind ? TRUE : FALSE);
5203 /* Player needs a "description" (he is blind) */
5206 /* Source monster */
5207 monster_type *m_ptr = NULL;
5209 /* Monster name (for attacks) */
5212 /* Monster name (for damage) */
5215 /* Hack -- messages */
5221 /* Player is not here */
5222 if (!player_bold(y, x)) return (FALSE);
5224 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5226 if (kawarimi(TRUE)) return FALSE;
5229 /* Player cannot hurt himself */
5230 if (!who) return (FALSE);
5231 if (who == p_ptr->riding) return (FALSE);
5233 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5236 int max_attempts = 10;
5237 sound(SOUND_REFLECT);
5240 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5241 else if (p_ptr->special_defense & KATA_FUUJIN)
5242 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5244 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5247 /* Choose 'new' target */
5252 t_y = m_list[who].fy - 1 + randint1(3);
5253 t_x = m_list[who].fx - 1 + randint1(3);
5256 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5258 if (max_attempts < 1)
5260 t_y = m_list[who].fy;
5261 t_x = m_list[who].fx;
5266 t_y = p_ptr->y - 1 + randint1(3);
5267 t_x = p_ptr->x - 1 + randint1(3);
5270 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5277 /* Limit maximum damage */
5278 if (dam > 1600) dam = 1600;
5280 /* Reduce damage by distance */
5281 dam = (dam + r) / (r + 1);
5284 /* If the player is blind, be more descriptive */
5285 if (blind) fuzzy = TRUE;
5290 /* Get the source monster */
5291 m_ptr = &m_list[who];
5292 /* Extract the monster level */
5293 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5295 /* Get the monster name */
5296 monster_desc(m_name, m_ptr, 0);
5298 /* Get the monster's real name (gotten before polymorph!) */
5299 strcpy(killer, who_name);
5305 case PROJECT_WHO_UNCTRL_POWER:
5306 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5309 case PROJECT_WHO_GLASS_SHARDS:
5310 strcpy(killer, _("ガラスの破片", "shards of glass"));
5314 strcpy(killer, _("罠", "a trap"));
5319 strcpy(m_name, killer);
5322 /* Analyze the damage */
5325 /* Standard damage -- hurts inventory too */
5328 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5329 get_damage = acid_dam(dam, killer, monspell, FALSE);
5333 /* Standard damage -- hurts inventory too */
5336 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5337 get_damage = fire_dam(dam, killer, monspell, FALSE);
5341 /* Standard damage -- hurts inventory too */
5344 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5345 get_damage = cold_dam(dam, killer, monspell, FALSE);
5349 /* Standard damage -- hurts inventory too */
5352 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5353 get_damage = elec_dam(dam, killer, monspell, FALSE);
5357 /* Standard damage -- also poisons player */
5360 bool double_resist = IS_OPPOSE_POIS();
5361 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5363 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5364 if (double_resist) dam = (dam + 2) / 3;
5366 if ((!(double_resist || p_ptr->resist_pois)) &&
5367 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5372 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5374 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5376 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5381 /* Standard damage -- also poisons / mutates player */
5384 bool double_resist = IS_OPPOSE_POIS();
5385 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5387 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5388 if (double_resist) dam = (2 * dam + 2) / 5;
5389 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5390 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5392 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5394 if (one_in_(5)) /* 6 */
5396 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5397 if (one_in_(4)) /* 4 */
5405 inven_damage(set_acid_destroy, 2);
5411 /* Standard damage */
5414 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5415 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5419 /* Holy Orb -- Player only takes partial damage */
5422 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5423 if (p_ptr->align > 10)
5425 else if (p_ptr->align < -10)
5427 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5433 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5434 if (p_ptr->align > 10)
5436 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5440 /* Arrow -- XXX no dodging */
5445 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5447 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5449 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5452 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5456 /* Plasma -- XXX No resist */
5459 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5460 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5462 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5464 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5465 (void)set_stun(p_ptr->stun + plus_stun);
5468 if (!(p_ptr->resist_fire ||
5470 p_ptr->immune_fire))
5472 inven_damage(set_acid_destroy, 3);
5478 /* Nether -- drain experience */
5481 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5482 if (p_ptr->resist_neth)
5484 if (!prace_is_(RACE_SPECTRE))
5486 dam *= 6; dam /= (randint1(4) + 7);
5489 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5491 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5493 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5495 learn_spell(monspell);
5499 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5505 /* Water -- stun/confuse */
5508 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5509 if (!CHECK_MULTISHADOW())
5511 if (!p_ptr->resist_sound)
5513 set_stun(p_ptr->stun + randint1(40));
5515 if (!p_ptr->resist_conf)
5517 set_confused(p_ptr->confused + randint1(5) + 5);
5522 inven_damage(set_cold_destroy, 3);
5526 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5530 /* Chaos -- many effects */
5533 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5534 if (p_ptr->resist_chaos)
5536 dam *= 6; dam /= (randint1(4) + 7);
5539 if (!CHECK_MULTISHADOW())
5541 if (!p_ptr->resist_conf)
5543 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5545 if (!p_ptr->resist_chaos)
5547 (void)set_image(p_ptr->image + randint1(10));
5550 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5551 (void)gain_random_mutation(0);
5554 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5556 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5559 if (!p_ptr->resist_chaos || one_in_(9))
5561 inven_damage(set_elec_destroy, 2);
5562 inven_damage(set_fire_destroy, 2);
5566 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5570 /* Shards -- mostly cutting */
5573 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5574 if (p_ptr->resist_shard)
5576 dam *= 6; dam /= (randint1(4) + 7);
5578 else if (!CHECK_MULTISHADOW())
5580 (void)set_cut(p_ptr->cut + dam);
5583 if (!p_ptr->resist_shard || one_in_(13))
5585 inven_damage(set_cold_destroy, 2);
5588 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5592 /* Sound -- mostly stunning */
5595 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5596 if (p_ptr->resist_sound)
5598 dam *= 5; dam /= (randint1(4) + 7);
5600 else if (!CHECK_MULTISHADOW())
5602 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5603 (void)set_stun(p_ptr->stun + plus_stun);
5606 if (!p_ptr->resist_sound || one_in_(13))
5608 inven_damage(set_cold_destroy, 2);
5611 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5615 /* Pure confusion */
5618 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5619 if (p_ptr->resist_conf)
5621 dam *= 5; dam /= (randint1(4) + 7);
5623 else if (!CHECK_MULTISHADOW())
5625 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5627 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5631 /* Disenchantment -- see above */
5634 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5635 if (p_ptr->resist_disen)
5637 dam *= 6; dam /= (randint1(4) + 7);
5639 else if (!CHECK_MULTISHADOW())
5641 (void)apply_disenchant(0);
5643 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5647 /* Nexus -- see above */
5650 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5651 if (p_ptr->resist_nexus)
5653 dam *= 6; dam /= (randint1(4) + 7);
5655 else if (!CHECK_MULTISHADOW())
5659 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5663 /* Force -- mostly stun */
5666 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5667 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5669 (void)set_stun(p_ptr->stun + randint1(20));
5671 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5676 /* Rocket -- stun, cut */
5679 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5680 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5682 (void)set_stun(p_ptr->stun + randint1(20));
5685 if (p_ptr->resist_shard)
5689 else if (!CHECK_MULTISHADOW())
5691 (void)set_cut(p_ptr->cut + (dam / 2));
5694 if (!p_ptr->resist_shard || one_in_(12))
5696 inven_damage(set_cold_destroy, 3);
5699 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5703 /* Inertia -- slowness */
5706 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5707 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5708 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5712 /* Lite -- blinding */
5715 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5716 if (p_ptr->resist_lite)
5718 dam *= 4; dam /= (randint1(4) + 7);
5720 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5722 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5725 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5727 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5730 else if (prace_is_(RACE_S_FAIRY))
5735 if (p_ptr->wraith_form) dam *= 2;
5736 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5738 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5740 p_ptr->wraith_form = 0;
5741 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5742 "The light forces you out of your incorporeal shadow form."));
5744 p_ptr->redraw |= PR_MAP;
5745 /* Update monsters */
5746 p_ptr->update |= (PU_MONSTERS);
5748 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5750 /* Redraw status bar */
5751 p_ptr->redraw |= (PR_STATUS);
5758 /* Dark -- blinding */
5761 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5762 if (p_ptr->resist_dark)
5764 dam *= 4; dam /= (randint1(4) + 7);
5766 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5768 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5770 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5772 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5776 /* Time -- bolt fewer effects XXX */
5779 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5780 if (p_ptr->resist_time)
5783 dam /= (randint1(4) + 7);
5784 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5786 else if (!CHECK_MULTISHADOW())
5788 switch (randint1(10))
5790 case 1: case 2: case 3: case 4: case 5:
5792 if (p_ptr->prace == RACE_ANDROID) break;
5793 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5794 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5798 case 6: case 7: case 8: case 9:
5800 switch (randint1(6))
5802 case 1: k = A_STR; act = _("強く", "strong"); break;
5803 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5804 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5805 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5806 case 5: k = A_CON; act = _("健康で", "hale"); break;
5807 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5810 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5811 "You're not as %s as you used to be..."), act);
5813 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5814 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5815 p_ptr->update |= (PU_BONUS);
5821 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5822 "You're not as powerful as you used to be..."));
5824 for (k = 0; k < 6; k++)
5826 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5827 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5829 p_ptr->update |= (PU_BONUS);
5835 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5839 /* Gravity -- stun plus slowness plus teleport */
5842 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5843 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5845 if (!CHECK_MULTISHADOW())
5847 teleport_player(5, TELEPORT_PASSIVE);
5848 if (!p_ptr->levitation)
5849 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5850 if (!(p_ptr->resist_sound || p_ptr->levitation))
5852 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5853 (void)set_stun(p_ptr->stun + plus_stun);
5856 if (p_ptr->levitation)
5858 dam = (dam * 2) / 3;
5861 if (!p_ptr->levitation || one_in_(13))
5863 inven_damage(set_cold_destroy, 2);
5866 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5870 /* Standard damage */
5871 case GF_DISINTEGRATE:
5873 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5875 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5881 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5883 (void)hp_player(dam);
5890 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5891 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5898 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5899 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5905 if (p_ptr->free_act) break;
5906 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5908 if (ironman_nightmare)
5910 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5911 /* Have some nightmares */
5912 sanity_blast(NULL, FALSE);
5915 set_paralyzed(p_ptr->paralyzed + dam);
5925 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5926 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5933 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5934 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5941 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5943 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5944 if (!p_ptr->resist_shard || one_in_(13))
5946 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5947 inven_damage(set_cold_destroy, 2);
5953 /* Ice -- cold plus stun plus cuts */
5956 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5957 get_damage = cold_dam(dam, killer, monspell, FALSE);
5958 if (!CHECK_MULTISHADOW())
5960 if (!p_ptr->resist_shard)
5962 (void)set_cut(p_ptr->cut + damroll(5, 8));
5964 if (!p_ptr->resist_sound)
5966 (void)set_stun(p_ptr->stun + randint1(15));
5969 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5971 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5981 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5983 if (p_ptr->mimic_form)
5985 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5986 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5991 switch (p_ptr->prace)
5993 /* Some races are immune */
6007 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6019 if (CHECK_MULTISHADOW())
6021 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
6023 else if (p_ptr->csp)
6027 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6029 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6032 if (dam >= p_ptr->csp)
6036 p_ptr->csp_frac = 0;
6045 learn_spell(monspell);
6048 p_ptr->redraw |= (PR_MANA);
6051 p_ptr->window |= (PW_PLAYER);
6052 p_ptr->window |= (PW_SPELL);
6056 /* Heal the monster */
6057 if (m_ptr->hp < m_ptr->maxhp)
6061 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6063 /* Redraw (later) if needed */
6064 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6065 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6067 /* Special message */
6070 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6083 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6085 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6086 learn_spell(monspell);
6090 if (!CHECK_MULTISHADOW())
6092 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6094 if (!p_ptr->resist_conf)
6096 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6099 if (!p_ptr->resist_chaos && one_in_(3))
6101 (void)set_image(p_ptr->image + randint0(250) + 150);
6108 p_ptr->csp_frac = 0;
6110 p_ptr->redraw |= PR_MANA;
6113 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6119 case GF_BRAIN_SMASH:
6121 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6123 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6124 learn_spell(monspell);
6128 if (!CHECK_MULTISHADOW())
6130 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6136 p_ptr->csp_frac = 0;
6138 p_ptr->redraw |= PR_MANA;
6141 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6142 if (!CHECK_MULTISHADOW())
6144 if (!p_ptr->resist_blind)
6146 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6148 if (!p_ptr->resist_conf)
6150 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6152 if (!p_ptr->free_act)
6154 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6156 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6158 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6159 (void)do_dec_stat(A_INT);
6160 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6161 (void)do_dec_stat(A_WIS);
6163 if (!p_ptr->resist_chaos)
6165 (void)set_image(p_ptr->image + randint0(250) + 150);
6175 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6177 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6178 learn_spell(monspell);
6182 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6183 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6191 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6193 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6194 learn_spell(monspell);
6198 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6199 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6207 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6209 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6210 learn_spell(monspell);
6214 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6215 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6223 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6225 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6226 learn_spell(monspell);
6230 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6231 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6239 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6241 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6242 learn_spell(monspell);
6246 if (!CHECK_MULTISHADOW())
6248 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6249 curse_equipment(40, 20);
6252 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6254 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6269 /* Hex - revenge damage stored */
6270 revenge_store(get_damage);
6272 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6273 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6275 char m_name_self[80];
6278 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6280 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6281 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6282 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6285 if (p_ptr->riding && dam > 0)
6287 rakubadam_p = (dam > 200) ? 200 : dam;
6295 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6297 (void)kawarimi(FALSE);
6300 /* Return "Anything seen?" */
6306 * Find the distance from (x, y) to a line.
6308 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6310 /* Vector from (x, y) to (x1, y1) */
6311 POSITION py = y1 - y;
6312 POSITION px = x1 - x;
6315 POSITION ny = x2 - x1;
6316 POSITION nx = y1 - y2;
6319 POSITION pd = distance(y1, x1, y, x);
6320 POSITION nd = distance(y1, x1, y2, x2);
6322 if (pd > nd) return distance(y, x, y2, x2);
6324 /* Component of P on N */
6325 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6327 /* Absolute value */
6328 return((nd >= 0) ? nd : 0 - nd);
6335 * Modified version of los() for calculation of disintegration balls.
6336 * Disintegration effects are stopped by permanent walls.
6338 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6358 /* Slope, or 1/Slope, of LOS */
6362 /* Extract the offset */
6366 /* Extract the absolute offset */
6371 /* Handle adjacent (or identical) grids */
6372 if ((ax < 2) && (ay < 2)) return (TRUE);
6375 /* Paranoia -- require "safe" origin */
6376 /* if (!in_bounds(y1, x1)) return (FALSE); */
6379 /* Directly South/North */
6382 /* South -- check for walls */
6385 for (ty = y1 + 1; ty < y2; ty++)
6387 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6391 /* North -- check for walls */
6394 for (ty = y1 - 1; ty > y2; ty--)
6396 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6404 /* Directly East/West */
6407 /* East -- check for walls */
6410 for (tx = x1 + 1; tx < x2; tx++)
6412 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6416 /* West -- check for walls */
6419 for (tx = x1 - 1; tx > x2; tx--)
6421 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6430 /* Extract some signs */
6431 sx = (dx < 0) ? -1 : 1;
6432 sy = (dy < 0) ? -1 : 1;
6435 /* Vertical "knights" */
6440 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6444 /* Horizontal "knights" */
6449 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6454 /* Calculate scale factor div 2 */
6457 /* Calculate scale factor */
6461 /* Travel horizontally */
6464 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6470 /* Consider the special case where slope == 1. */
6481 /* Note (below) the case (qy == f2), where */
6482 /* the LOS exactly meets the corner of a tile. */
6485 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6496 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6509 /* Travel vertically */
6512 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6528 /* Note (below) the case (qx == f2), where */
6529 /* the LOS exactly meets the corner of a tile. */
6532 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6543 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6564 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, int typ)
6569 int brev = rad * rad / dist;
6573 int mdis = distance(y1, x1, y2, x2) + rad;
6575 while (bdis <= mdis)
6579 if ((0 < dist) && (path_n < dist))
6581 int ny = GRID_Y(path_g[path_n]);
6582 int nx = GRID_X(path_g[path_n]);
6583 int nd = distance(ny, nx, y1, x1);
6585 /* Get next base point */
6594 /* Travel from center outward */
6595 for (cdis = 0; cdis <= brad; cdis++)
6597 /* Scan the maximal blast area of radius "cdis" */
6598 for (y = by - cdis; y <= by + cdis; y++)
6600 for (x = bx - cdis; x <= bx + cdis; x++)
6602 /* Ignore "illegal" locations */
6603 if (!in_bounds(y, x)) continue;
6605 /* Enforce a circular "ripple" */
6606 if (distance(y1, x1, y, x) != bdis) continue;
6608 /* Enforce an arc */
6609 if (distance(by, bx, y, x) != cdis) continue;
6615 /* Lights are stopped by opaque terrains */
6616 if (!los(by, bx, y, x)) continue;
6618 case GF_DISINTEGRATE:
6619 /* Disintegration are stopped only by perma-walls */
6620 if (!in_disintegration_range(by, bx, y, x)) continue;
6623 /* Ball explosions are stopped by walls */
6624 if (!projectable(by, bx, y, x)) continue;
6628 /* Save this grid */
6636 /* Encode some more "radius" info */
6637 gm[bdis + 1] = *pgrids;
6639 /* Increase the size */
6640 brad = rad * (path_n + brev) / (dist + brev);
6642 /* Find the next ripple */
6646 /* Store the effect size */
6652 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6653 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6654 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6655 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6656 * @param x 目標X座標 / Target x location (or location to travel "towards")
6657 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6658 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6659 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6660 * @param monspell 効果元のモンスター魔法ID
6661 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6664 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6665 * towards a given location (optionally passing over the heads of interposing
6666 * monsters), and have it do a given amount of damage to the monsters (and
6667 * optionally objects) within the given radius of the final location.
6669 * A "bolt" travels from source to target and affects only the target grid.
6670 * A "beam" travels from source to target, affecting all grids passed through.
6671 * A "ball" travels from source to the target, exploding at the target, and
6672 * affecting everything within the given radius of the target location.
6674 * Traditionally, a "bolt" does not affect anything on the ground, and does
6675 * not pass over the heads of interposing monsters, much like a traditional
6676 * missile, and will "stop" abruptly at the "target" even if no monster is
6677 * positioned there, while a "ball", on the other hand, passes over the heads
6678 * of monsters between the source and target, and affects everything except
6679 * the source monster which lies within the final radius, while a "beam"
6680 * affects every monster between the source and target, except for the casting
6681 * monster (or player), and rarely affects things on the ground.
6683 * Two special flags allow us to use this function in special ways, the
6684 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6685 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6686 * actually projecting from the source monster (or player).
6688 * The player will only get "experience" for monsters killed by himself
6689 * Unique monsters can only be destroyed by attacks from the player
6691 * Only 256 grids can be affected per projection, limiting the effective
6692 * "radius" of standard ball attacks to nine units (diameter nineteen).
6694 * One can project in a given "direction" by combining PROJECT_THRU with small
6695 * offsets to the initial location (see "line_spell()"), or by calculating
6696 * "virtual targets" far away from the player.
6698 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6699 * continuing until it actually hits somethings (useful for "stone to mud").
6701 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6703 * Balls must explode BEFORE hitting walls, or they would affect monsters
6704 * on both sides of a wall. Some bug reports indicate that this is still
6705 * happening in 2.7.8 for Windows, though it appears to be impossible.
6707 * We "pre-calculate" the blast area only in part for efficiency.
6708 * More importantly, this lets us do "explosions" from the "inside" out.
6709 * This results in a more logical distribution of "blast" treasure.
6710 * It also produces a better (in my opinion) animation of the explosion.
6711 * It could be (but is not) used to have the treasure dropped by monsters
6712 * in the middle of the explosion fall "outwards", and then be damaged by
6713 * the blast as it spreads outwards towards the treasure drop location.
6715 * Walls and doors are included in the blast area, so that they can be
6716 * "burned" or "melted" in later versions.
6718 * This algorithm is intended to maximize simplicity, not necessarily
6719 * efficiency, since this function is not a bottleneck in the code.
6721 * We apply the blast effect from ground zero outwards, in several passes,
6722 * first affecting features, then objects, then monsters, then the player.
6723 * This allows walls to be removed before checking the object or monster
6724 * in the wall, and protects objects which are dropped by monsters killed
6725 * in the blast, and allows the player to see all affects before he is
6726 * killed or teleported away. The semantics of this method are open to
6727 * various interpretations, but they seem to work well in practice.
6729 * We process the blast area from ground-zero outwards to allow for better
6730 * distribution of treasure dropped by monsters, and because it provides a
6731 * pleasing visual effect at low cost.
6733 * Note that the damage done by "ball" explosions decreases with distance.
6734 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6736 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6737 * the target, and then the damage "flows" along this beam of destruction.
6738 * The damage at every grid is the same as at the "center" of a "ball"
6739 * explosion, since the "beam" grids are treated as if they ARE at the
6740 * center of a "ball" explosion.
6742 * Currently, specifying "beam" plus "ball" means that locations which are
6743 * covered by the initial "beam", and also covered by the final "ball", except
6744 * for the final grid (the epicenter of the ball), will be "hit twice", once
6745 * by the initial beam, and once by the exploding ball. For the grid right
6746 * next to the epicenter, this results in 150% damage being done. The center
6747 * does not have this problem, for the same reason the final grid in a "beam"
6748 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6749 * grids which are covered by the "ball" will NOT work, as then they will
6750 * receive LESS damage than they should. Do not combine "beam" with "ball".
6752 * The array "gy[],gx[]" with current size "grids" is used to hold the
6753 * collected locations of all grids in the "blast area" plus "beam path".
6755 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6756 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6757 * first blast grid (see above) with radius "N" from the blast center. Note
6758 * that only the first gm[1] grids in the blast area thus take full damage.
6759 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6760 * number of blast grids.
6762 * Note that once the projection is complete, (y2,x2) holds the final location
6763 * of bolts/beams, and the "epicenter" of balls.
6765 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6766 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6767 * implementation of the "distance" function. Also, a bolt can be properly
6768 * viewed as a "ball" with a "rad" of "zero".
6770 * Note that if no "target" is reached before the beam/bolt/ball travels the
6771 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6772 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6774 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6775 * to move from point A to point B, even if the player cannot see part of the
6776 * projection path. Note that in general, the player will *always* see part
6777 * of the path, since it either starts at the player or ends on the player.
6779 * Hack -- we assume that every "projection" is "self-illuminating".
6781 * Hack -- when only a single monster is affected, we automatically track
6782 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6784 * Note that all projections now "explode" at their final destination, even
6785 * if they were being projected at a more distant destination. This means
6786 * that "ball" spells will *always* explode.
6788 * Note that we must call "handle_stuff()" after affecting terrain features
6789 * in the blast radius, in case the "illumination" of the grid was changed,
6790 * and "update_view()" and "update_monsters()" need to be called.
6793 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
6803 POSITION y_saver, x_saver; /* For reflecting monsters */
6805 int msec = delay_factor * delay_factor * delay_factor;
6807 /* Assume the player sees nothing */
6808 bool notice = FALSE;
6810 /* Assume the player has seen nothing */
6811 bool visual = FALSE;
6813 /* Assume the player has seen no blast grids */
6816 /* Assume to be a normal ball spell */
6817 bool breath = FALSE;
6819 /* Is the player blind? */
6820 bool blind = (p_ptr->blind ? TRUE : FALSE);
6822 bool old_hide = FALSE;
6824 /* Number of grids in the "path" */
6827 /* Actual grids in the "path" */
6830 /* Number of grids in the "blast area" (including the "beam" path) */
6833 /* Coordinates of the affected grids */
6834 POSITION gx[1024], gy[1024];
6836 /* Encoded "radius" info (see above) */
6839 /* Actual radius encoded in gm[] */
6840 POSITION gm_rad = rad;
6844 /* Attacker's name (prepared before polymorph)*/
6847 /* Can the player see the source of this effect? */
6848 bool see_s_msg = TRUE;
6850 /* Initialize by null string */
6856 /* Default target of monsterspell is player */
6857 monster_target_y=p_ptr->y;
6858 monster_target_x=p_ptr->x;
6860 /* Hack -- Jump to target */
6861 if (flg & (PROJECT_JUMP))
6866 /* Clear the flag */
6867 flg &= ~(PROJECT_JUMP);
6872 /* Start at player */
6879 /* Start at monster */
6882 x1 = m_list[who].fx;
6883 y1 = m_list[who].fy;
6884 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6897 /* Default "destination" */
6902 /* Hack -- verify stuff */
6903 if (flg & (PROJECT_THRU))
6905 if ((x1 == x2) && (y1 == y2))
6907 flg &= ~(PROJECT_THRU);
6911 /* Handle a breath attack */
6916 if (flg & PROJECT_HIDE) old_hide = TRUE;
6917 flg |= PROJECT_HIDE;
6921 /* Hack -- Assume there will be no blast (max radius 32) */
6922 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6930 /* Collect beam grids */
6931 if (flg & (PROJECT_BEAM))
6942 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6944 case GF_DISINTEGRATE:
6945 flg |= (PROJECT_GRID);
6946 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6950 /* Calculate the projection path */
6952 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6954 /* Hack -- Handle stuff */
6957 /* Giga-Hack SEEKER & SUPER_RAY */
6959 if( typ == GF_SEEKER )
6969 for (i = 0; i < path_n; ++i)
6974 int ny = GRID_Y(path_g[i]);
6975 int nx = GRID_X(path_g[i]);
6986 /* Only do visuals if requested */
6987 if (!blind && !(flg & (PROJECT_HIDE)))
6989 /* Only do visuals if the player can "see" the bolt */
6990 if (panel_contains(y, x) && player_has_los_bold(y, x))
6997 /* Obtain the bolt pict */
6998 p = bolt_pict(oy, ox, y, x, typ);
7000 /* Extract attr/char */
7004 /* Visual effects */
7005 print_rel(c, a, y, x);
7006 move_cursor_relative(y, x);
7007 /*if (fresh_before)*/ Term_fresh();
7008 Term_xtra(TERM_XTRA_DELAY, msec);
7010 /*if (fresh_before)*/ Term_fresh();
7012 /* Display "beam" grids */
7013 if (flg & (PROJECT_BEAM))
7015 /* Obtain the explosion pict */
7016 p = bolt_pict(y, x, y, x, typ);
7018 /* Extract attr/char */
7022 /* Visual effects */
7023 print_rel(c, a, y, x);
7026 /* Hack -- Activate delay */
7030 /* Hack -- delay anyway for consistency */
7033 /* Delay for consistency */
7034 Term_xtra(TERM_XTRA_DELAY, msec);
7037 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7038 if( is_mirror_grid(&cave[y][x]))
7040 /* The target of monsterspell becomes tha mirror(broken) */
7041 monster_target_y=(s16b)y;
7042 monster_target_x=(s16b)x;
7044 remove_mirror(y, x);
7045 next_mirror(&oy, &ox, y, x);
7047 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7048 for(j = last_i; j <= i; j++)
7050 y = GRID_Y(path_g[j]);
7051 x = GRID_X(path_g[j]);
7052 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7053 if(!who && (project_m_n==1) && !jump ){
7054 if(cave[project_m_y][project_m_x].m_idx >0 ){
7055 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7059 /* Hack -- auto-recall */
7060 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7062 /* Hack - auto-track */
7063 health_track(cave[project_m_y][project_m_x].m_idx);
7067 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7072 for(i = last_i ; i < path_n ; i++)
7075 py = GRID_Y(path_g[i]);
7076 px = GRID_X(path_g[i]);
7077 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7079 if(!who && (project_m_n==1) && !jump ){
7080 if(cave[project_m_y][project_m_x].m_idx > 0)
7082 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7086 /* Hack -- auto-recall */
7087 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7089 /* Hack - auto-track */
7090 health_track(cave[project_m_y][project_m_x].m_idx);
7094 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7098 else if(typ == GF_SUPER_RAY){
7100 int second_step = 0;
7107 for (i = 0; i < path_n; ++i)
7112 int ny = GRID_Y(path_g[i]);
7113 int nx = GRID_X(path_g[i]);
7124 /* Only do visuals if requested */
7125 if (!blind && !(flg & (PROJECT_HIDE)))
7127 /* Only do visuals if the player can "see" the bolt */
7128 if (panel_contains(y, x) && player_has_los_bold(y, x))
7135 /* Obtain the bolt pict */
7136 p = bolt_pict(oy, ox, y, x, typ);
7138 /* Extract attr/char */
7142 /* Visual effects */
7143 print_rel(c, a, y, x);
7144 move_cursor_relative(y, x);
7145 /*if (fresh_before)*/ Term_fresh();
7146 Term_xtra(TERM_XTRA_DELAY, msec);
7148 /*if (fresh_before)*/ Term_fresh();
7150 /* Display "beam" grids */
7151 if (flg & (PROJECT_BEAM))
7153 /* Obtain the explosion pict */
7154 p = bolt_pict(y, x, y, x, typ);
7156 /* Extract attr/char */
7160 /* Visual effects */
7161 print_rel(c, a, y, x);
7164 /* Hack -- Activate delay */
7168 /* Hack -- delay anyway for consistency */
7171 /* Delay for consistency */
7172 Term_xtra(TERM_XTRA_DELAY, msec);
7175 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7176 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7178 if( second_step )continue;
7181 if( is_mirror_grid(&cave[y][x]) && !second_step )
7183 /* The target of monsterspell becomes tha mirror(broken) */
7184 monster_target_y=(s16b)y;
7185 monster_target_x=(s16b)x;
7188 for( j = 0; j <=i ; j++ )
7190 y = GRID_Y(path_g[j]);
7191 x = GRID_X(path_g[j]);
7192 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7196 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7197 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7198 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7199 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7200 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7201 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7202 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7203 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7206 for( i = 0; i < path_n ; i++ )
7209 py = GRID_Y(path_g[i]);
7210 px = GRID_X(path_g[i]);
7211 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7212 if(!who && (project_m_n == 1) && !jump){
7213 if(cave[project_m_y][project_m_x].m_idx >0 ){
7214 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7218 /* Hack -- auto-recall */
7219 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7221 /* Hack - auto-track */
7222 health_track(cave[project_m_y][project_m_x].m_idx);
7226 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7231 /* Project along the path */
7232 for (i = 0; i < path_n; ++i)
7237 int ny = GRID_Y(path_g[i]);
7238 int nx = GRID_X(path_g[i]);
7240 if (flg & PROJECT_DISI)
7242 /* Hack -- Balls explode before reaching walls */
7243 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7245 else if (flg & PROJECT_LOS)
7247 /* Hack -- Balls explode before reaching walls */
7248 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7252 /* Hack -- Balls explode before reaching walls */
7253 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7260 /* Collect beam grids */
7261 if (flg & (PROJECT_BEAM))
7268 /* Only do visuals if requested */
7269 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7271 /* Only do visuals if the player can "see" the bolt */
7272 if (panel_contains(y, x) && player_has_los_bold(y, x))
7279 /* Obtain the bolt pict */
7280 p = bolt_pict(oy, ox, y, x, typ);
7282 /* Extract attr/char */
7286 /* Visual effects */
7287 print_rel(c, a, y, x);
7288 move_cursor_relative(y, x);
7289 /*if (fresh_before)*/ Term_fresh();
7290 Term_xtra(TERM_XTRA_DELAY, msec);
7292 /*if (fresh_before)*/ Term_fresh();
7294 /* Display "beam" grids */
7295 if (flg & (PROJECT_BEAM))
7297 /* Obtain the explosion pict */
7298 p = bolt_pict(y, x, y, x, typ);
7300 /* Extract attr/char */
7304 /* Visual effects */
7305 print_rel(c, a, y, x);
7308 /* Hack -- Activate delay */
7312 /* Hack -- delay anyway for consistency */
7315 /* Delay for consistency */
7316 Term_xtra(TERM_XTRA_DELAY, msec);
7323 /* Save the "blast epicenter" */
7327 if (breath && !path_n)
7333 flg &= ~(PROJECT_HIDE);
7337 /* Start the "explosion" */
7340 /* Hack -- make sure beams get to "explode" */
7348 /* If we found a "target", explode there */
7349 if (dist <= MAX_RANGE)
7351 /* Mega-Hack -- remove the final "beam" grid */
7352 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7355 * Create a conical breath attack
7366 flg &= ~(PROJECT_HIDE);
7368 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7372 /* Determine the blast area, work from the inside out */
7373 for (dist = 0; dist <= rad; dist++)
7375 /* Scan the maximal blast area of radius "dist" */
7376 for (y = by - dist; y <= by + dist; y++)
7378 for (x = bx - dist; x <= bx + dist; x++)
7380 /* Ignore "illegal" locations */
7381 if (!in_bounds2(y, x)) continue;
7383 /* Enforce a "circular" explosion */
7384 if (distance(by, bx, y, x) != dist) continue;
7390 /* Lights are stopped by opaque terrains */
7391 if (!los(by, bx, y, x)) continue;
7393 case GF_DISINTEGRATE:
7394 /* Disintegration are stopped only by perma-walls */
7395 if (!in_disintegration_range(by, bx, y, x)) continue;
7398 /* Ball explosions are stopped by walls */
7399 if (!projectable(by, bx, y, x)) continue;
7403 /* Save this grid */
7410 /* Encode some more "radius" info */
7416 /* Speed -- ignore "non-explosions" */
7417 if (!grids) return (FALSE);
7420 /* Display the "blast area" if requested */
7421 if (!blind && !(flg & (PROJECT_HIDE)))
7423 /* Then do the "blast", from inside out */
7424 for (t = 0; t <= gm_rad; t++)
7426 /* Dump everything with this radius */
7427 for (i = gm[t]; i < gm[t+1]; i++)
7429 /* Extract the location */
7433 /* Only do visuals if the player can "see" the blast */
7434 if (panel_contains(y, x) && player_has_los_bold(y, x))
7443 /* Obtain the explosion pict */
7444 p = bolt_pict(y, x, y, x, typ);
7446 /* Extract attr/char */
7450 /* Visual effects -- Display */
7451 print_rel(c, a, y, x);
7455 /* Hack -- center the cursor */
7456 move_cursor_relative(by, bx);
7458 /* Flush each "radius" seperately */
7459 /*if (fresh_before)*/ Term_fresh();
7461 /* Delay (efficiently) */
7462 if (visual || drawn)
7464 Term_xtra(TERM_XTRA_DELAY, msec);
7468 /* Flush the erasing */
7471 /* Erase the explosion drawn above */
7472 for (i = 0; i < grids; i++)
7474 /* Extract the location */
7478 /* Hack -- Erase if needed */
7479 if (panel_contains(y, x) && player_has_los_bold(y, x))
7485 /* Hack -- center the cursor */
7486 move_cursor_relative(by, bx);
7488 /* Flush the explosion */
7489 /*if (fresh_before)*/ Term_fresh();
7494 /* Update stuff if needed */
7495 if (p_ptr->update) update_stuff();
7498 if (flg & PROJECT_KILL)
7500 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7501 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7505 /* Check features */
7506 if (flg & (PROJECT_GRID))
7508 /* Start with "dist" of zero */
7511 /* Scan for features */
7512 for (i = 0; i < grids; i++)
7514 /* Hack -- Notice new "dist" values */
7515 if (gm[dist+1] == i) dist++;
7517 /* Get the grid location */
7521 /* Find the closest point in the blast */
7524 int d = dist_to_line(y, x, y1, x1, by, bx);
7526 /* Affect the grid */
7527 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7531 /* Affect the grid */
7532 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7537 /* Update stuff if needed */
7538 if (p_ptr->update) update_stuff();
7541 if (flg & (PROJECT_ITEM))
7543 /* Start with "dist" of zero */
7546 /* Scan for objects */
7547 for (i = 0; i < grids; i++)
7549 /* Hack -- Notice new "dist" values */
7550 if (gm[dist+1] == i) dist++;
7552 /* Get the grid location */
7556 /* Find the closest point in the blast */
7559 int d = dist_to_line(y, x, y1, x1, by, bx);
7561 /* Affect the object in the grid */
7562 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7566 /* Affect the object in the grid */
7567 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7573 /* Check monsters */
7574 if (flg & (PROJECT_KILL))
7581 /* Start with "dist" of zero */
7584 /* Scan for monsters */
7585 for (i = 0; i < grids; i++)
7589 /* Hack -- Notice new "dist" values */
7590 if (gm[dist + 1] == i) dist++;
7592 /* Get the grid location */
7596 /* A single bolt may be reflected */
7599 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7600 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7602 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7603 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7604 (!who || dist_hack > 1) && !one_in_(10))
7607 int max_attempts = 10;
7609 /* Choose 'new' target */
7612 t_y = y_saver - 1 + randint1(3);
7613 t_x = x_saver - 1 + randint1(3);
7616 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7618 if (max_attempts < 1)
7624 sound(SOUND_REFLECT);
7627 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7628 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7629 else if (m_ptr->r_idx == MON_DIO)
7630 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7632 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7634 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7636 /* Reflected bolts randomly target either one */
7637 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7638 else flg |= PROJECT_PLAYER;
7640 /* The bolt is reflected */
7641 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7643 /* Don't affect the monster any longer */
7649 /* Find the closest point in the blast */
7652 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7656 effective_dist = dist;
7660 /* There is the riding player on this monster */
7661 if (p_ptr->riding && player_bold(y, x))
7663 /* Aimed on the player */
7664 if (flg & PROJECT_PLAYER)
7666 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7669 * A beam or bolt is well aimed
7671 * So don't affects the mount.
7678 * The spell is not well aimed,
7679 * So partly affect the mount too.
7686 * This grid is the original target.
7687 * Or aimed on your horse.
7689 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7691 /* Hit the mount with full damage */
7695 * Otherwise this grid is not the
7696 * original target, it means that line
7697 * of fire is obstructed by this
7701 * A beam or bolt will hit either
7702 * player or mount. Choose randomly.
7704 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7708 /* Hit the mount with full damage */
7712 /* Hit the player later */
7713 flg |= PROJECT_PLAYER;
7715 /* Don't affect the mount */
7721 * The spell is not well aimed, so
7722 * partly affect both player and
7731 /* Affect the monster in the grid */
7732 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7736 /* Player affected one monster (without "jumping") */
7737 if (!who && (project_m_n == 1) && !jump)
7743 /* Track if possible */
7744 if (cave[y][x].m_idx > 0)
7746 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7750 /* Hack -- auto-recall */
7751 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7753 /* Hack - auto-track */
7754 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7762 if (flg & (PROJECT_KILL))
7764 /* Start with "dist" of zero */
7767 /* Scan for player */
7768 for (i = 0; i < grids; i++)
7772 /* Hack -- Notice new "dist" values */
7773 if (gm[dist+1] == i) dist++;
7775 /* Get the grid location */
7779 /* Affect the player? */
7780 if (!player_bold(y, x)) continue;
7782 /* Find the closest point in the blast */
7785 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7789 effective_dist = dist;
7792 /* Target may be your horse */
7795 /* Aimed on the player */
7796 if (flg & PROJECT_PLAYER)
7798 /* Hit the player with full damage */
7802 * Hack -- When this grid was not the
7803 * original target, a beam or bolt
7804 * would hit either player or mount,
7805 * and should be choosen randomly.
7807 * But already choosen to hit the
7808 * mount at this point.
7810 * Or aimed on your horse.
7812 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7815 * A beam or bolt is well aimed
7817 * So don't affects the player.
7824 * The spell is not well aimed,
7825 * So partly affect the player too.
7831 /* Affect the player */
7832 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7840 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7842 if (rakubadam_m > 0)
7844 if (rakuba(rakubadam_m, FALSE))
7846 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7849 if (p_ptr->riding && rakubadam_p > 0)
7851 if(rakuba(rakubadam_p, FALSE))
7853 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7858 /* Return "something was noticed" */
7863 * @brief 鏡魔法「封魔結界」の効果処理
7865 * @return 効果があったらTRUEを返す
7867 bool binding_field( HIT_POINT dam )
7869 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7870 int mirror_num=0; /* 鏡の数 */
7875 int msec= delay_factor*delay_factor*delay_factor;
7881 /* Default target of monsterspell is player */
7882 monster_target_y=p_ptr->y;
7883 monster_target_x=p_ptr->x;
7885 for( x=0 ; x < cur_wid ; x++ )
7887 for( y=0 ; y < cur_hgt ; y++ )
7889 if( is_mirror_grid(&cave[y][x]) &&
7890 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7891 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7892 player_has_los_bold(y,x) &&
7893 projectable(p_ptr->y, p_ptr->x, y, x)
7895 mirror_y[mirror_num]=y;
7896 mirror_x[mirror_num]=x;
7902 if( mirror_num < 2 )return FALSE;
7904 point_x[0] = randint0( mirror_num );
7906 point_x[1] = randint0( mirror_num );
7908 while( point_x[0] == point_x[1] );
7910 point_y[0]=mirror_y[point_x[0]];
7911 point_x[0]=mirror_x[point_x[0]];
7912 point_y[1]=mirror_y[point_x[1]];
7913 point_x[1]=mirror_x[point_x[1]];
7914 point_y[2]=p_ptr->y;
7915 point_x[2]=p_ptr->x;
7917 x=point_x[0]+point_x[1]+point_x[2];
7918 y=point_y[0]+point_y[1]+point_y[2];
7920 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7921 - (point_y[0]*3-y)*(point_x[1]*3-x);
7922 if( centersign == 0 )return FALSE;
7924 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7925 x1 = x1 < point_x[2] ? x1 : point_x[2];
7926 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7927 y1 = y1 < point_y[2] ? y1 : point_y[2];
7929 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7930 x2 = x2 > point_x[2] ? x2 : point_x[2];
7931 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7932 y2 = y2 > point_y[2] ? y2 : point_y[2];
7934 for( y=y1 ; y <=y2 ; y++ ){
7935 for( x=x1 ; x <=x2 ; x++ ){
7936 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7937 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7938 centersign*( (point_x[1]-x)*(point_y[2]-y)
7939 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7940 centersign*( (point_x[2]-x)*(point_y[0]-y)
7941 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7943 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7944 /* Visual effects */
7946 && panel_contains(y,x)){
7947 p = bolt_pict(y,x,y,x, GF_MANA );
7948 print_rel(PICT_C(p), PICT_A(p),y,x);
7949 move_cursor_relative(y, x);
7950 /*if (fresh_before)*/ Term_fresh();
7951 Term_xtra(TERM_XTRA_DELAY, msec);
7957 for( y=y1 ; y <=y2 ; y++ ){
7958 for( x=x1 ; x <=x2 ; x++ ){
7959 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7960 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7961 centersign*( (point_x[1]-x)*(point_y[2]-y)
7962 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7963 centersign*( (point_x[2]-x)*(point_y[0]-y)
7964 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7966 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7967 (void)project_f(0,0,y,x,dam,GF_MANA);
7972 for( y=y1 ; y <=y2 ; y++ ){
7973 for( x=x1 ; x <=x2 ; x++ ){
7974 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7975 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7976 centersign*( (point_x[1]-x)*(point_y[2]-y)
7977 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7978 centersign*( (point_x[2]-x)*(point_y[0]-y)
7979 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7981 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7982 (void)project_o(0,0,y,x,dam,GF_MANA);
7987 for( y=y1 ; y <=y2 ; y++ ){
7988 for( x=x1 ; x <=x2 ; x++ ){
7989 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7990 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7991 centersign*( (point_x[1]-x)*(point_y[2]-y)
7992 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7993 centersign*( (point_x[2]-x)*(point_y[0]-y)
7994 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7996 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7997 (void)project_m(0,0,y,x,dam,GF_MANA,
7998 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
8004 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
8005 remove_mirror(point_y[0],point_x[0]);
8012 * @brief 鏡魔法「鏡の封印」の効果処理
8014 * @return 効果があったらTRUEを返す
8016 void seal_of_mirror( HIT_POINT dam )
8020 for( x = 0 ; x < cur_wid ; x++ )
8022 for( y = 0 ; y < cur_hgt ; y++ )
8024 if( is_mirror_grid(&cave[y][x]))
8026 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8027 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8029 if( !cave[y][x].m_idx )