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 配置した鏡リストの次を取得する /
27 * Get another mirror. for SEEKER
28 * @param next_y 次の鏡のy座標を返す参照ポインタ
29 * @param next_x 次の鏡のx座標を返す参照ポインタ
30 * @param cury 現在の鏡のy座標
31 * @param curx 現在の鏡のx座標
33 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
35 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
36 int mirror_num=0; /* 鏡の数 */
40 for( x=0 ; x < cur_wid ; x++ )
42 for( y=0 ; y < cur_hgt ; y++ )
44 if( is_mirror_grid(&cave[y][x])){
45 mirror_y[mirror_num]=y;
46 mirror_x[mirror_num]=x;
53 num=randint0(mirror_num);
54 *next_y=mirror_y[num];
55 *next_x=mirror_x[num];
58 *next_y=cury+randint0(5)-2;
59 *next_x=curx+randint0(5)-2;
64 * @brief 万色表現用にランダムな色を選択する関数 /
65 * Get a legal "multi-hued" color for drawing "spells"
69 static byte mh_attr(int max)
71 switch (randint1(max))
73 case 1: return (TERM_RED);
74 case 2: return (TERM_GREEN);
75 case 3: return (TERM_BLUE);
76 case 4: return (TERM_YELLOW);
77 case 5: return (TERM_ORANGE);
78 case 6: return (TERM_VIOLET);
79 case 7: return (TERM_L_RED);
80 case 8: return (TERM_L_GREEN);
81 case 9: return (TERM_L_BLUE);
82 case 10: return (TERM_UMBER);
83 case 11: return (TERM_L_UMBER);
84 case 12: return (TERM_SLATE);
85 case 13: return (TERM_WHITE);
86 case 14: return (TERM_L_WHITE);
87 case 15: return (TERM_L_DARK);
95 * @brief 魔法属性に応じたエフェクトの色を返す /
96 * Return a color to use for the bolt/ball spells
100 static byte spell_color(int type)
102 /* Check if A.B.'s new graphics should be used (rr9) */
103 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
108 case GF_PSY_SPEAR: return (0x06);
109 case GF_MISSILE: return (0x0F);
110 case GF_ACID: return (0x04);
111 case GF_ELEC: return (0x02);
112 case GF_FIRE: return (0x00);
113 case GF_COLD: return (0x01);
114 case GF_POIS: return (0x03);
115 case GF_HOLY_FIRE: return (0x00);
116 case GF_HELL_FIRE: return (0x00);
117 case GF_MANA: return (0x0E);
119 case GF_SEEKER: return (0x0E);
120 case GF_SUPER_RAY: return (0x0E);
122 case GF_ARROW: return (0x0F);
123 case GF_WATER: return (0x04);
124 case GF_NETHER: return (0x07);
125 case GF_CHAOS: return (mh_attr(15));
126 case GF_DISENCHANT: return (0x05);
127 case GF_NEXUS: return (0x0C);
128 case GF_CONFUSION: return (mh_attr(4));
129 case GF_SOUND: return (0x09);
130 case GF_SHARDS: return (0x08);
131 case GF_FORCE: return (0x09);
132 case GF_INERTIA: return (0x09);
133 case GF_GRAVITY: return (0x09);
134 case GF_TIME: return (0x09);
135 case GF_LITE_WEAK: return (0x06);
136 case GF_LITE: return (0x06);
137 case GF_DARK_WEAK: return (0x07);
138 case GF_DARK: return (0x07);
139 case GF_PLASMA: return (0x0B);
140 case GF_METEOR: return (0x00);
141 case GF_ICE: return (0x01);
142 case GF_ROCKET: return (0x0F);
143 case GF_DEATH_RAY: return (0x07);
144 case GF_NUKE: return (mh_attr(2));
145 case GF_DISINTEGRATE: return (0x05);
157 case GF_CAUSE_4: return (0x0E);
158 case GF_HAND_DOOM: return (0x07);
159 case GF_CAPTURE : return (0x0E);
160 case GF_IDENTIFY: return (0x01);
161 case GF_ATTACK: return (0x0F);
162 case GF_PHOTO : return (0x06);
165 /* Normal tiles or ASCII */
171 /* Lookup the default colors for this type */
172 cptr s = quark_str(gf_color[type]);
175 if (!s) return (TERM_WHITE);
177 /* Pick a random color */
178 c = s[randint0(strlen(s))];
180 /* Lookup this color */
181 a = my_strchr(color_char, c) - color_char;
183 /* Invalid color (note check for < 0 removed, gave a silly
184 * warning because bytes are always >= 0 -- RG) */
185 if (a > 15) return (TERM_WHITE);
191 /* Standard "color" */
197 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
198 * Find the attr/char pair to use for a spell effect
207 * It is moving (or has moved) from (x,y) to (nx,ny).
208 * If the distance is not "one", we (may) return "*".
211 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
221 if ((ny == y) && (nx == x)) base = 0x30;
224 else if (nx == x) base = 0x40;
227 else if (ny == y) base = 0x50;
230 else if ((ny - y) == (x - nx)) base = 0x60;
233 else if ((ny - y) == (nx - x)) base = 0x70;
238 /* Basic spell color */
239 k = spell_color(typ);
241 /* Obtain attr/char */
242 a = misc_to_attr[base + k];
243 c = misc_to_char[base + k];
251 * @brief 始点から終点への経路を返す /
252 * Determine the path taken by a projection.
253 * @param gp 経路座標リストを返す参照ポインタ
263 * The projection will always start from the grid (y1,x1), and will travel
264 * towards the grid (y2,x2), touching one grid per unit of distance along
265 * the major axis, and stopping when it enters the destination grid or a
266 * wall grid, or has travelled the maximum legal distance of "range".
268 * Note that "distance" in this function (as in the "update_view()" code)
269 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
270 * actually has an "octagon of projection" not a "circle of projection".
272 * The path grids are saved into the grid array pointed to by "gp", and
273 * there should be room for at least "range" grids in "gp". Note that
274 * due to the way in which distance is calculated, this function normally
275 * uses fewer than "range" grids for the projection path, so the result
276 * of this function should never be compared directly to "range". Note
277 * that the initial grid (y1,x1) is never saved into the grid array, not
278 * even if the initial grid is also the final grid. XXX XXX XXX
280 * The "flg" flags can be used to modify the behavior of this function.
282 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
283 * semantics as they do for the "project" function, namely, that the path
284 * will stop as soon as it hits a monster, or that the path will continue
285 * through the destination grid, respectively.
287 * The "PROJECT_JUMP" flag, which for the "project()" function means to
288 * start at a special grid (which makes no sense in this function), means
289 * that the path should be "angled" slightly if needed to avoid any wall
290 * grids, allowing the player to "target" any grid which is in "view".
291 * This flag is non-trivial and has not yet been implemented, but could
292 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
294 * This function returns the number of grids (if any) in the path. This
295 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
297 * This algorithm is similar to, but slightly different from, the one used
298 * by "update_view_los()", and very different from the one used by "los()".
301 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
323 /* No path necessary (or allowed) */
324 if ((x1 == x2) && (y1 == y2)) return (0);
352 /* Number of "units" in one "half" grid */
355 /* Number of "units" in one "full" grid */
361 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
372 /* Advance (X) part 2 */
375 /* Advance (X) part 3 */
382 /* Create the projection path */
386 gp[n++] = GRID(y, x);
388 /* Hack -- Check maximum range */
389 if ((n + (k >> 1)) >= range) break;
391 /* Sometimes stop at destination grid */
392 if (!(flg & (PROJECT_THRU)))
394 if ((x == x2) && (y == y2)) break;
397 if (flg & (PROJECT_DISI))
399 if ((n > 0) && cave_stop_disintegration(y, x)) break;
401 else if (flg & (PROJECT_LOS))
403 if ((n > 0) && !cave_los_bold(y, x)) break;
405 else if (!(flg & (PROJECT_PATH)))
407 /* Always stop at non-initial wall grids */
408 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
411 /* Sometimes stop at non-initial monsters/players */
412 if (flg & (PROJECT_STOP))
415 (player_bold(y, x) || cave[y][x].m_idx != 0))
419 if (!in_bounds(y, x)) break;
424 /* Advance (X) part 1 */
427 /* Horizontal change */
430 /* Advance (X) part 2 */
433 /* Advance (X) part 3 */
449 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
458 /* Vertical change */
461 /* Advance (Y) part 2 */
464 /* Advance (Y) part 3 */
471 /* Create the projection path */
475 gp[n++] = GRID(y, x);
477 /* Hack -- Check maximum range */
478 if ((n + (k >> 1)) >= range) break;
480 /* Sometimes stop at destination grid */
481 if (!(flg & (PROJECT_THRU)))
483 if ((x == x2) && (y == y2)) break;
486 if (flg & (PROJECT_DISI))
488 if ((n > 0) && cave_stop_disintegration(y, x)) break;
490 else if (flg & (PROJECT_LOS))
492 if ((n > 0) && !cave_los_bold(y, x)) break;
494 else if (!(flg & (PROJECT_PATH)))
496 /* Always stop at non-initial wall grids */
497 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
500 /* Sometimes stop at non-initial monsters/players */
501 if (flg & (PROJECT_STOP))
504 (player_bold(y, x) || cave[y][x].m_idx != 0))
508 if (!in_bounds(y, x)) break;
513 /* Advance (Y) part 1 */
516 /* Vertical change */
519 /* Advance (Y) part 2 */
522 /* Advance (Y) part 3 */
542 /* Create the projection path */
546 gp[n++] = GRID(y, x);
548 /* Hack -- Check maximum range */
549 if ((n + (n >> 1)) >= range) break;
551 /* Sometimes stop at destination grid */
552 if (!(flg & (PROJECT_THRU)))
554 if ((x == x2) && (y == y2)) break;
557 if (flg & (PROJECT_DISI))
559 if ((n > 0) && cave_stop_disintegration(y, x)) break;
561 else if (flg & (PROJECT_LOS))
563 if ((n > 0) && !cave_los_bold(y, x)) break;
565 else if (!(flg & (PROJECT_PATH)))
567 /* Always stop at non-initial wall grids */
568 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
571 /* Sometimes stop at non-initial monsters/players */
572 if (flg & (PROJECT_STOP))
575 (player_bold(y, x) || cave[y][x].m_idx != 0))
579 if (!in_bounds(y, x)) break;
596 * Mega-Hack -- track "affected" monsters (see "project()" comments)
598 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
599 static int project_m_x; /*!< 処理中のモンスターX座標 */
600 static int project_m_y; /*!< 処理中のモンスターY座標 */
601 /* Mega-Hack -- monsters target */
602 static s16b monster_target_x; /*!< モンスターの攻撃目標X座標 */
603 static s16b monster_target_y; /*!< モンスターの攻撃目標Y座標 */
607 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
608 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
609 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
610 * @param y 目標Y座標 / Target y location (or location to travel "towards")
611 * @param x 目標X座標 / Target x location (or location to travel "towards")
612 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
613 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
614 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
617 * We are called both for "beam" effects and "ball" effects.
619 * The "r" parameter is the "distance from ground zero".
621 * Note that we determine if the player can "see" anything that happens
622 * by taking into account: blindness, line-of-sight, and illumination.
624 * We return "TRUE" if the effect of the projection is "obvious".
626 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
628 * XXX XXX XXX Perhaps we should affect doors?
631 static bool project_f(int who, int r, int y, int x, int dam, int typ)
633 cave_type *c_ptr = &cave[y][x];
634 feature_type *f_ptr = &f_info[c_ptr->feat];
636 bool obvious = FALSE;
637 bool known = player_has_los_bold(y, x);
643 /* Reduce damage by distance */
644 dam = (dam + r) / (r + 1);
647 if (have_flag(f_ptr->flags, FF_TREE))
655 message = _("枯れた", "was blasted."); break;
657 message = _("縮んだ", "shrank."); break;
659 message = _("溶けた", "melted."); break;
662 message = _("凍り、砕け散った", "was frozen and smashed."); break;
666 message = _("燃えた", "burns up!"); break;
678 message = _("粉砕された", "was crushed."); break;
680 message = NULL;break;
684 msg_format(_("木は%s。", "A tree %s"), message);
685 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
688 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
692 /* Analyze the type */
695 /* Ignore most effects */
730 /* Destroy Traps (and Locks) */
733 /* Reveal secret doors */
734 if (is_hidden_door(c_ptr))
739 /* Check line of sight */
747 if (is_trap(c_ptr->feat))
749 /* Check line of sight */
752 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
756 /* Destroy the trap */
757 cave_alter_feat(y, x, FF_DISARM);
760 /* Locked doors are unlocked */
761 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
763 s16b old_feat = c_ptr->feat;
765 /* Unlock the door */
766 cave_alter_feat(y, x, FF_DISARM);
768 /* Check line of sound */
769 if (known && (old_feat != c_ptr->feat))
771 msg_print(_("カチッと音がした!", "Click!"));
776 /* Remove "unsafe" flag if player is not blind */
777 if (!p_ptr->blind && player_has_los_bold(y, x))
779 c_ptr->info &= ~(CAVE_UNSAFE);
790 /* Destroy Doors (and traps) */
793 /* Destroy all doors and traps */
794 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
796 /* Check line of sight */
800 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
804 /* Destroy the feature */
805 cave_alter_feat(y, x, FF_TUNNEL);
808 /* Remove "unsafe" flag if player is not blind */
809 if (!p_ptr->blind && player_has_los_bold(y, x))
811 c_ptr->info &= ~(CAVE_UNSAFE);
822 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
824 if (have_flag(f_ptr->flags, FF_SPIKE))
826 s16b old_mimic = c_ptr->mimic;
827 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
829 cave_alter_feat(y, x, FF_SPIKE);
831 c_ptr->mimic = old_mimic;
839 /* Check line of sight */
840 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
843 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
850 /* Destroy walls (and doors) */
853 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
856 if (known && (c_ptr->info & (CAVE_MARK)))
858 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
862 /* Destroy the wall */
863 cave_alter_feat(y, x, FF_HURT_ROCK);
865 /* Update some things */
866 p_ptr->update |= (PU_FLOW);
875 /* Require a "naked" floor grid */
876 if (!cave_naked_bold(y, x)) break;
878 /* Not on the player */
879 if (player_bold(y, x)) break;
881 /* Create a closed door */
882 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
885 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
902 /* Require a "naked" floor grid */
903 if (!cave_naked_bold(y, x)) break;
905 /* Not on the player */
906 if (player_bold(y, x)) break;
908 /* Create a closed door */
909 cave_set_feat(y, x, feat_tree);
912 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
920 /* Require a "naked" floor grid */
921 if (!cave_naked_bold(y, x)) break;
924 c_ptr->info |= CAVE_OBJECT;
925 c_ptr->mimic = feat_glyph;
938 /* Require a "naked" floor grid */
939 if (!cave_naked_bold(y, x)) break;
941 /* Not on the player */
942 if (player_bold(y, x)) break;
945 cave_set_feat(y, x, feat_granite);
953 /* Ignore permanent grid */
954 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
959 /* Ignore grid without enough space */
960 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
962 /* Place a shallow lava */
963 cave_set_feat(y, x, feat_shallow_lava);
968 /* Place a deep lava */
969 cave_set_feat(y, x, feat_deep_lava);
976 /* Ignore permanent grid */
977 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
982 /* Ignore grid without enough space */
983 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
985 /* Place a shallow water */
986 cave_set_feat(y, x, feat_shallow_water);
991 /* Place a deep water */
992 cave_set_feat(y, x, feat_deep_water);
997 /* Lite up the grid */
1001 /* Turn on the light */
1002 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1004 c_ptr->info |= (CAVE_GLOW);
1012 update_local_illumination(y, x);
1015 if (player_can_see_bold(y, x)) obvious = TRUE;
1017 /* Mega-Hack -- Update the monster in the affected grid */
1018 /* This allows "spear of light" (etc) to work "correctly" */
1019 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1021 if (p_ptr->special_defense & NINJA_S_STEALTH)
1023 if (player_bold(y, x)) set_superstealth(FALSE);
1030 /* Darken the grid */
1034 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1037 /* Turn off the light. */
1040 if (dun_level || !is_daytime())
1042 for (j = 0; j < 9; j++)
1044 int by = y + ddy_ddd[j];
1045 int bx = x + ddx_ddd[j];
1047 if (in_bounds2(by, bx))
1049 cave_type *cc_ptr = &cave[by][bx];
1051 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1059 if (!do_dark) break;
1062 c_ptr->info &= ~(CAVE_GLOW);
1064 /* Hack -- Forget "boring" grids */
1065 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1068 c_ptr->info &= ~(CAVE_MARK);
1077 update_local_illumination(y, x);
1080 if (player_can_see_bold(y, x)) obvious = TRUE;
1082 /* Mega-Hack -- Update the monster in the affected grid */
1083 /* This allows "spear of light" (etc) to work "correctly" */
1084 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1094 if (is_mirror_grid(c_ptr))
1096 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1098 remove_mirror(y, x);
1099 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1102 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1105 if (known && (c_ptr->info & CAVE_MARK))
1107 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1111 /* Destroy the wall */
1112 cave_alter_feat(y, x, FF_HURT_ROCK);
1114 /* Update some things */
1115 p_ptr->update |= (PU_FLOW);
1122 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1124 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1126 remove_mirror(y, x);
1127 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1130 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1133 if (known && (c_ptr->info & CAVE_MARK))
1135 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1139 /* Destroy the wall */
1140 cave_alter_feat(y, x, FF_HURT_ROCK);
1142 /* Update some things */
1143 p_ptr->update |= (PU_FLOW);
1148 case GF_DISINTEGRATE:
1150 /* Destroy mirror/glyph */
1151 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1152 remove_mirror(y, x);
1154 /* Permanent features don't get effect */
1155 /* But not protect monsters and other objects */
1156 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1158 cave_alter_feat(y, x, FF_HURT_DISI);
1160 /* Update some things -- similar to GF_KILL_WALL */
1161 p_ptr->update |= (PU_FLOW);
1168 /* Return "Anything seen?" */
1175 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1176 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1177 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1178 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1179 * @param x 目標X座標 / Target x location (or location to travel "towards")
1180 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1181 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1182 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1185 * We are called from "project()" to "damage" objects
1187 * We are called both for "beam" effects and "ball" effects.
1189 * Perhaps we should only SOMETIMES damage things on the ground.
1191 * The "r" parameter is the "distance from ground zero".
1193 * Note that we determine if the player can "see" anything that happens
1194 * by taking into account: blindness, line-of-sight, and illumination.
1196 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1198 * We return "TRUE" if the effect of the projection is "obvious".
1201 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1203 cave_type *c_ptr = &cave[y][x];
1205 s16b this_o_idx, next_o_idx = 0;
1207 bool obvious = FALSE;
1208 bool known = player_has_los_bold(y, x);
1210 u32b flgs[TR_FLAG_SIZE];
1212 char o_name[MAX_NLEN];
1215 bool is_potion = FALSE;
1219 who = who ? who : 0;
1221 /* Reduce damage by distance */
1222 dam = (dam + r) / (r + 1);
1225 /* Scan all objects in the grid */
1226 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1228 /* Acquire object */
1229 object_type *o_ptr = &o_list[this_o_idx];
1231 bool is_art = FALSE;
1232 bool ignore = FALSE;
1233 bool do_kill = FALSE;
1235 cptr note_kill = NULL;
1238 /* Get the "plural"-ness */
1239 bool plural = (o_ptr->number > 1);
1242 /* Acquire next object */
1243 next_o_idx = o_ptr->next_o_idx;
1245 /* Extract the flags */
1246 object_flags(o_ptr, flgs);
1248 /* Check for artifact */
1249 if (object_is_artifact(o_ptr)) is_art = TRUE;
1251 /* Analyze the type */
1254 /* Acid -- Lots of things */
1257 if (hates_acid(o_ptr))
1260 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1261 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1266 /* Elec -- Rings and Wands */
1269 if (hates_elec(o_ptr))
1272 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1273 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1278 /* Fire -- Flammable objects */
1281 if (hates_fire(o_ptr))
1284 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1285 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1290 /* Cold -- potions and flasks */
1293 if (hates_cold(o_ptr))
1295 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1297 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1305 if (hates_fire(o_ptr))
1308 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1309 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1311 if (hates_elec(o_ptr))
1315 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1316 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1324 if (hates_fire(o_ptr))
1327 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1328 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1330 if (hates_cold(o_ptr))
1334 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1335 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1340 /* Hack -- break potions and such */
1346 if (hates_cold(o_ptr))
1348 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1354 /* Mana and Chaos -- destroy everything */
1360 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1364 case GF_DISINTEGRATE:
1367 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1374 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1375 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1376 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1380 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1384 if (object_is_cursed(o_ptr))
1387 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1394 identify_item(o_ptr);
1396 /* Auto-inscription */
1397 autopick_alter_item((-this_o_idx), FALSE);
1405 /* Chests are noticed only if trapped or locked */
1406 if (o_ptr->tval == TV_CHEST)
1408 /* Disarm/Unlock traps */
1409 if (o_ptr->pval > 0)
1411 /* Disarm or Unlock */
1412 o_ptr->pval = (0 - o_ptr->pval);
1415 object_known(o_ptr);
1418 if (known && (o_ptr->marked & OM_FOUND))
1420 msg_print(_("カチッと音がした!", "Click!"));
1430 if (o_ptr->tval == TV_CORPSE)
1435 if (!who || is_pet(&m_list[who]))
1436 mode |= PM_FORCE_PET;
1438 for (i = 0; i < o_ptr->number ; i++)
1440 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1441 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1445 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1449 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1451 note_kill = _("生き返った。", " revived.");
1453 else if (!note_kill)
1455 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1466 /* Attempt to destroy the object */
1469 /* Effect "observed" */
1470 if (known && (o_ptr->marked & OM_FOUND))
1473 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1476 /* Artifacts, and other objects, get to resist */
1477 if (is_art || ignore)
1479 /* Observe the resist */
1480 if (known && (o_ptr->marked & OM_FOUND))
1482 msg_format(_("%sは影響を受けない!",
1483 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1490 /* Describe if needed */
1491 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1493 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1496 k_idx = o_ptr->k_idx;
1497 is_potion = object_is_potion(o_ptr);
1500 /* Delete the object */
1501 delete_object_idx(this_o_idx);
1503 /* Potions produce effects when 'shattered' */
1506 (void)potion_smash_effect(who, y, x, k_idx);
1515 /* Return "Anything seen?" */
1521 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1522 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1523 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1524 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1525 * @param x 目標X座標 / Target x location (or location to travel "towards")
1526 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1527 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1529 * @param see_s_msg TRUEならばメッセージを表示する
1530 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1533 * This routine takes a "source monster" (by index) which is mostly used to
1534 * determine if the player is causing the damage, and a "radius" (see below),
1535 * which is used to decrease the power of explosions with distance, and a
1536 * location, via integers which are modified by certain types of attacks
1537 * (polymorph and teleport being the obvious ones), a default damage, which
1538 * is modified as needed based on various properties, and finally a "damage
1539 * type" (see below).
1542 * Note that this routine can handle "no damage" attacks (like teleport) by
1543 * taking a "zero" damage, and can even take "parameters" to attacks (like
1544 * confuse) by accepting a "damage", using it to calculate the effect, and
1545 * then setting the damage to zero. Note that the "damage" parameter is
1546 * divided by the radius, so monsters not at the "epicenter" will not take
1547 * as much damage (or whatever)...
1549 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1550 * may result in a dereference of an invalid pointer. XXX XXX XXX
1555 * Various messages are produced, and damage is applied.
1558 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1559 * actually be "made" of that substance, or "breathe" big balls of it.
1560 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1562 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1563 * and hurts evil less. If can breath nether, then it resists it as well.
1566 * Damage reductions use the following formulas:
1567 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1568 * gives avg damage of .655, ranging from .858 to .500
1569 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1570 * gives avg damage of .544, ranging from .714 to .417
1571 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1572 * gives avg damage of .444, ranging from .556 to .333
1573 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1574 * gives avg damage of .327, ranging from .427 to .250
1575 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1576 * gives something simple.
1579 * In this function, "result" messages are postponed until the end, where
1580 * the "note" string is appended to the monster name, if not NULL. So,
1581 * to make a spell have "no effect" just set "note" to NULL. You should
1582 * also set "notice" to FALSE, or the player will learn what the spell does.
1585 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1589 static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
1593 cave_type *c_ptr = &cave[y][x];
1595 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1596 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1598 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1602 /* Is the monster "seen"? */
1603 bool seen = m_ptr->ml;
1604 bool seen_msg = is_seen(m_ptr);
1606 bool slept = (bool)MON_CSLEEP(m_ptr);
1608 /* Were the effects "obvious" (if seen)? */
1609 bool obvious = FALSE;
1611 /* Can the player know about this effect? */
1612 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1614 /* Were the effects "irrelevant"? */
1615 bool skipped = FALSE;
1617 /* Gets the monster angry at the source of the effect? */
1618 bool get_angry = FALSE;
1620 /* Polymorph setting (true or false) */
1621 bool do_poly = FALSE;
1623 /* Teleport setting (max distance) */
1626 /* Confusion setting (amount to confuse) */
1629 /* Stunning setting (amount to stun) */
1632 /* Sleep amount (amount to sleep) */
1635 /* Fear amount (amount to fear) */
1638 /* Time amount (amount to time) */
1641 bool heal_leper = FALSE;
1643 /* Hold the monster name */
1649 /* Assume no note */
1652 /* Assume a default death */
1653 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1658 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1661 if (!c_ptr->m_idx) return (FALSE);
1663 /* Never affect projector */
1664 if (who && (c_ptr->m_idx == who)) return (FALSE);
1665 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1666 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1668 /* Don't affect already death monsters */
1669 /* Prevents problems with chain reactions of exploding monsters */
1670 if (m_ptr->hp < 0) return (FALSE);
1672 /* Reduce damage by distance */
1673 dam = (dam + r) / (r + 1);
1676 /* Get the monster name (BEFORE polymorphing) */
1677 monster_desc(m_name, m_ptr, 0);
1679 /* Get the monster possessive ("his"/"her"/"its") */
1680 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1682 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1684 /* Analyze the damage type */
1687 /* Magic Missile -- pure damage */
1690 if (seen) obvious = TRUE;
1692 if (r_ptr->flagsr & RFR_RES_ALL)
1694 note = _("には完全な耐性がある!", " is immune.");
1696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1705 if (seen) obvious = TRUE;
1707 if (r_ptr->flagsr & RFR_RES_ALL)
1709 note = _("には完全な耐性がある!", " is immune.");
1711 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1714 if (r_ptr->flagsr & RFR_IM_ACID)
1716 note = _("にはかなり耐性がある!", " resists a lot.");
1718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
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_ELEC)
1737 note = _("にはかなり耐性がある!", " resists a lot.");
1739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
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_FIRE)
1758 note = _("にはかなり耐性がある!", " resists a lot.");
1760 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1762 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1764 note = _("はひどい痛手をうけた。", " is hit hard.");
1766 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1774 if (seen) obvious = TRUE;
1776 if (r_ptr->flagsr & RFR_RES_ALL)
1778 note = _("には完全な耐性がある!", " is immune.");
1780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1783 if (r_ptr->flagsr & RFR_IM_COLD)
1785 note = _("にはかなり耐性がある!", " resists a lot.");
1787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1789 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1791 note = _("はひどい痛手をうけた。", " is hit hard.");
1793 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1801 if (seen) obvious = TRUE;
1803 if (r_ptr->flagsr & RFR_RES_ALL)
1805 note = _("には完全な耐性がある!", " is immune.");
1807 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1810 if (r_ptr->flagsr & RFR_IM_POIS)
1812 note = _("にはかなり耐性がある!", " resists a lot.");
1814 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
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.");
1834 dam *= 3; dam /= randint1(6) + 6;
1835 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1837 else if (one_in_(3)) do_poly = TRUE;
1841 /* Hellfire -- hurts Evil */
1844 if (seen) obvious = TRUE;
1846 if (r_ptr->flagsr & RFR_RES_ALL)
1848 note = _("には完全な耐性がある!", " is immune.");
1850 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1853 if (r_ptr->flags3 & RF3_GOOD)
1855 note = _("はひどい痛手をうけた。", " is hit hard.");
1857 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1862 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
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 immune.");
1878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1880 else if (r_ptr->flags3 & RF3_EVIL)
1883 note = _("はひどい痛手をうけた。", " is hit hard.");
1884 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1888 note = _("には耐性がある。", " resists.");
1889 dam *= 3; dam /= randint1(6) + 6;
1894 /* Arrow -- XXX no defense */
1897 if (seen) obvious = TRUE;
1899 if (r_ptr->flagsr & RFR_RES_ALL)
1901 note = _("には完全な耐性がある!", " is immune.");
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1909 /* Plasma -- XXX perhaps check ELEC or FIRE */
1912 if (seen) obvious = TRUE;
1914 if (r_ptr->flagsr & RFR_RES_ALL)
1916 note = _("には完全な耐性がある!", " is immune.");
1918 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1921 if (r_ptr->flagsr & RFR_RES_PLAS)
1923 note = _("には耐性がある。", " resists.");
1924 dam *= 3; dam /= randint1(6) + 6;
1925 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1930 /* Nether -- see above */
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_NETH)
1944 if (r_ptr->flags3 & RF3_UNDEAD)
1946 note = _("には完全な耐性がある!", " is immune.");
1948 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1952 note = _("には耐性がある。", " resists.");
1953 dam *= 3; dam /= randint1(6) + 6;
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1957 else if (r_ptr->flags3 & RF3_EVIL)
1959 note = _("はいくらか耐性を示した。", " resists somewhat.");
1961 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1966 /* Water (acid) damage -- Water spirits/elementals are immune */
1969 if (seen) obvious = TRUE;
1971 if (r_ptr->flagsr & RFR_RES_ALL)
1973 note = _("には完全な耐性がある!", " is immune.");
1975 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1978 if (r_ptr->flagsr & RFR_RES_WATE)
1980 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1982 note = _("には完全な耐性がある!", " is immune.");
1987 note = _("には耐性がある。", " resists.");
1988 dam *= 3; dam /= randint1(6) + 6;
1990 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1995 /* Chaos -- Chaos breathers resist */
1998 if (seen) obvious = TRUE;
2000 if (r_ptr->flagsr & RFR_RES_ALL)
2002 note = _("には完全な耐性がある!", " is immune.");
2004 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2007 if (r_ptr->flagsr & RFR_RES_CHAO)
2009 note = _("には耐性がある。", " resists.");
2010 dam *= 3; dam /= randint1(6) + 6;
2011 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2013 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2015 note = _("はいくらか耐性を示した。", " resists somewhat.");
2016 dam *= 3; dam /= randint1(6) + 6;
2017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2022 do_conf = (5 + randint1(11) + r) / (r + 1);
2027 /* Shards -- Shard breathers resist */
2030 if (seen) obvious = TRUE;
2032 if (r_ptr->flagsr & RFR_RES_ALL)
2034 note = _("には完全な耐性がある!", " is immune.");
2036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2039 if (r_ptr->flagsr & RFR_RES_SHAR)
2041 note = _("には耐性がある。", " resists.");
2042 dam *= 3; dam /= randint1(6) + 6;
2043 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2048 /* Rocket: Shard resistance helps */
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 somewhat.");
2064 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2070 /* Sound -- Sound breathers resist */
2073 if (seen) obvious = TRUE;
2075 if (r_ptr->flagsr & RFR_RES_ALL)
2077 note = _("には完全な耐性がある!", " is immune.");
2079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2082 if (r_ptr->flagsr & RFR_RES_SOUN)
2084 note = _("には耐性がある。", " resists.");
2085 dam *= 2; dam /= randint1(6) + 6;
2086 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2088 else do_stun = (10 + randint1(15) + r) / (r + 1);
2095 if (seen) obvious = TRUE;
2097 if (r_ptr->flagsr & RFR_RES_ALL)
2099 note = _("には完全な耐性がある!", " is immune.");
2101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2104 if (r_ptr->flags3 & RF3_NO_CONF)
2106 note = _("には耐性がある。", " resists.");
2107 dam *= 3; dam /= randint1(6) + 6;
2108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2110 else do_conf = (10 + randint1(15) + r) / (r + 1);
2114 /* Disenchantment -- Breathers and Disenchanters resist */
2117 if (seen) obvious = TRUE;
2119 if (r_ptr->flagsr & RFR_RES_ALL)
2121 note = _("には完全な耐性がある!", " is immune.");
2123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2126 if (r_ptr->flagsr & RFR_RES_DISE)
2128 note = _("には耐性がある。", " resists.");
2129 dam *= 3; dam /= randint1(6) + 6;
2130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2135 /* Nexus -- Breathers and Existers 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_NEXU)
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_NEXU);
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_WALL)
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_WALL);
2174 else do_stun = (randint1(15) + r) / (r + 1);
2178 /* Inertia -- breathers resist */
2181 if (seen) obvious = TRUE;
2183 if (r_ptr->flagsr & RFR_RES_ALL)
2185 note = _("には完全な耐性がある!", " is immune.");
2187 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2190 if (r_ptr->flagsr & RFR_RES_INER)
2192 note = _("には耐性がある。", " resists.");
2193 dam *= 3; dam /= randint1(6) + 6;
2194 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2198 /* Powerful monsters can resist */
2199 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2200 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2204 /* Normal monsters slow down */
2207 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2209 note = _("の動きが遅くなった。", " starts moving slower.");
2216 /* Time -- breathers resist */
2219 if (seen) obvious = TRUE;
2221 if (r_ptr->flagsr & RFR_RES_ALL)
2223 note = _("には完全な耐性がある!", " is immune.");
2225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2228 if (r_ptr->flagsr & RFR_RES_TIME)
2230 note = _("には耐性がある。", " resists.");
2231 dam *= 3; dam /= randint1(6) + 6;
2232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2234 else do_time = (dam + 1) / 2;
2238 /* Gravity -- breathers resist */
2241 bool resist_tele = FALSE;
2243 if (seen) obvious = TRUE;
2245 if (r_ptr->flagsr & RFR_RES_ALL)
2247 note = _("には完全な耐性がある!", " is immune.");
2249 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2252 if (r_ptr->flagsr & RFR_RES_TELE)
2254 if (r_ptr->flags1 & (RF1_UNIQUE))
2256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2257 note = _("には効果がなかった。", " is unaffected!");
2260 else if (r_ptr->level > randint1(100))
2262 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2263 note = _("には耐性がある!", " resists!");
2268 if (!resist_tele) do_dist = 10;
2270 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2272 if (r_ptr->flagsr & RFR_RES_GRAV)
2274 note = _("には耐性がある!", " resists!");
2275 dam *= 3; dam /= randint1(6) + 6;
2277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2282 /* Powerful monsters can resist */
2283 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2284 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2288 /* Normal monsters slow down */
2291 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2293 note = _("の動きが遅くなった。", " starts moving slower.");
2298 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2300 /* Attempt a saving throw */
2301 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2302 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2306 /* No obvious effect */
2307 note = _("には効果がなかった。", " is unaffected!");
2319 if (seen) obvious = TRUE;
2321 if (r_ptr->flagsr & RFR_RES_ALL)
2323 note = _("には完全な耐性がある!", " is immune.");
2325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2333 case GF_DISINTEGRATE:
2335 if (seen) obvious = TRUE;
2337 if (r_ptr->flagsr & RFR_RES_ALL)
2339 note = _("には完全な耐性がある!", " is immune.");
2341 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2344 if (r_ptr->flags3 & RF3_HURT_ROCK)
2346 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2347 note = _("の皮膚がただれた!", " loses some skin!");
2348 note_dies = _("は蒸発した!", " evaporates!");
2356 if (seen) obvious = TRUE;
2358 /* PSI only works if the monster can see you! -- RG */
2359 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2362 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2367 if (r_ptr->flagsr & RFR_RES_ALL)
2369 note = _("には完全な耐性がある!", " is immune.");
2371 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2374 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2377 note = _("には完全な耐性がある!", " is immune.");
2378 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2381 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2382 (r_ptr->flags3 & RF3_ANIMAL) ||
2383 (r_ptr->level > randint1(3 * dam)))
2385 note = _("には耐性がある!", " resists!");
2389 * Powerful demons & undead can turn a mindcrafter's
2390 * attacks back on them
2392 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2393 (r_ptr->level > p_ptr->lev / 2) &&
2397 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2398 (seen ? "%^s's corrupted mind backlashes your attack!" :
2399 "%^ss corrupted mind backlashes your attack!")), m_name);
2402 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2404 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2408 /* Injure +/- confusion */
2409 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2410 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2411 if (one_in_(4) && !CHECK_MULTISHADOW())
2413 switch (randint1(4))
2416 set_confused(p_ptr->confused + 3 + randint1(dam));
2419 set_stun(p_ptr->stun + randint1(dam));
2423 if (r_ptr->flags3 & RF3_NO_FEAR)
2424 note = _("には効果がなかった。", " is unaffected.");
2426 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2430 if (!p_ptr->free_act)
2431 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2440 if ((dam > 0) && one_in_(4))
2442 switch (randint1(4))
2445 do_conf = 3 + randint1(dam);
2448 do_stun = 3 + randint1(dam);
2451 do_fear = 3 + randint1(dam);
2454 note = _("は眠り込んでしまった!", " falls asleep!");
2455 do_sleep = 3 + randint1(dam);
2460 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2466 if (seen) obvious = TRUE;
2468 if (r_ptr->flagsr & RFR_RES_ALL)
2470 note = _("には完全な耐性がある!", " is immune.");
2472 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2475 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2478 note = _("には完全な耐性がある!", " is immune.");
2480 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2481 (r_ptr->flags3 & RF3_ANIMAL) ||
2482 (r_ptr->level > randint1(3 * dam)))
2484 note = _("には耐性がある!", " resists!");
2488 * Powerful demons & undead can turn a mindcrafter's
2489 * attacks back on them
2491 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2492 (r_ptr->level > p_ptr->lev / 2) &&
2496 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2497 (seen ? "%^s's corrupted mind backlashes your attack!" :
2498 "%^ss corrupted mind backlashes your attack!")), m_name);
2500 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2502 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2506 /* Injure + mana drain */
2507 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2508 if (!CHECK_MULTISHADOW())
2510 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2511 p_ptr->csp -= damroll(5, dam) / 2;
2512 if (p_ptr->csp < 0) p_ptr->csp = 0;
2513 p_ptr->redraw |= PR_MANA;
2514 p_ptr->window |= (PW_SPELL);
2516 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2523 int b = damroll(5, dam) / 4;
2524 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2525 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2526 (seen ? "You convert %s's pain into %s!" :
2527 "You convert %ss pain into %s!"));
2528 msg_format(msg, m_name, str);
2530 b = MIN(p_ptr->msp, p_ptr->csp + b);
2532 p_ptr->redraw |= PR_MANA;
2533 p_ptr->window |= (PW_SPELL);
2535 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2539 case GF_TELEKINESIS:
2541 if (seen) obvious = TRUE;
2543 if (r_ptr->flagsr & RFR_RES_ALL)
2545 note = _("には完全な耐性がある!", " is immune.");
2547 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2552 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2557 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2559 /* Attempt a saving throw */
2560 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2561 (r_ptr->level > 5 + randint1(dam)))
2565 /* No obvious effect */
2571 /* Psycho-spear -- powerful magic missile */
2574 if (seen) obvious = TRUE;
2576 if (r_ptr->flagsr & RFR_RES_ALL)
2578 note = _("には完全な耐性がある!", " is immune.");
2580 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2586 /* Meteor -- powerful magic missile */
2589 if (seen) obvious = TRUE;
2591 if (r_ptr->flagsr & RFR_RES_ALL)
2593 note = _("には完全な耐性がある!", " is immune.");
2595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2603 if (!is_hostile(m_ptr)) break;
2605 if (seen) obvious = TRUE;
2607 if (r_ptr->flagsr & RFR_RES_ALL)
2609 note = _("には効果がなかった!", " is immune.");
2611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2614 /* Attempt a saving throw */
2615 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2616 (r_ptr->flags3 & RF3_NO_CONF) ||
2617 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2619 /* Memorize a flag */
2620 if (r_ptr->flags3 & RF3_NO_CONF)
2622 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2629 * Powerful demons & undead can turn a mindcrafter's
2630 * attacks back on them
2632 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2633 (r_ptr->level > p_ptr->lev / 2) &&
2637 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2638 (seen ? "%^s's corrupted mind backlashes your attack!" :
2639 "%^ss corrupted mind backlashes your attack!")), m_name);
2642 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2644 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2648 /* Confuse, stun, terrify */
2649 switch (randint1(4))
2652 set_stun(p_ptr->stun + dam / 2);
2655 set_confused(p_ptr->confused + dam / 2);
2659 if (r_ptr->flags3 & RF3_NO_FEAR)
2660 note = _("には効果がなかった。", " is unaffected.");
2662 set_afraid(p_ptr->afraid + dam);
2669 /* No obvious effect */
2670 note = _("には効果がなかった。", " is unaffected.");
2676 if ((dam > 29) && (randint1(100) < dam))
2678 note = _("があなたに隷属した。", " is in your thrall!");
2683 switch (randint1(4))
2697 /* No "real" damage */
2704 /* Ice -- Cold + Cuts + Stun */
2707 if (seen) obvious = TRUE;
2709 if (r_ptr->flagsr & RFR_RES_ALL)
2711 note = _("には完全な耐性がある!", " is immune.");
2713 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2716 do_stun = (randint1(15) + 1) / (r + 1);
2717 if (r_ptr->flagsr & RFR_IM_COLD)
2719 note = _("にはかなり耐性がある!", " resists a lot.");
2721 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2723 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2725 note = _("はひどい痛手をうけた。", " is hit hard.");
2727 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2736 if (seen) obvious = TRUE;
2738 if (r_ptr->flagsr & RFR_RES_ALL)
2740 note = _("には完全な耐性がある!", " is immune.");
2742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2745 if (!monster_living(r_ptr))
2747 if (is_original_ap_and_seen(m_ptr))
2749 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2750 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2751 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2753 note = _("には効果がなかった。", " is unaffected.");
2757 else do_time = (dam+7)/8;
2765 if (seen) obvious = TRUE;
2767 if (r_ptr->flagsr & RFR_RES_ALL)
2769 note = _("には完全な耐性がある!", " is immune.");
2771 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2774 if (!monster_living(r_ptr))
2776 if (is_original_ap_and_seen(m_ptr))
2778 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2779 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2780 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2782 note = _("には完全な耐性がある!", " is immune.");
2786 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2787 (randint1(888) != 666)) ||
2788 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2789 randint1(100) != 66))
2791 note = _("には耐性がある!", " resists!");
2799 /* Polymorph monster (Use "dam" as "power") */
2802 if (seen) obvious = TRUE;
2804 if (r_ptr->flagsr & RFR_RES_ALL)
2806 note = _("には効果がなかった。", " is unaffected.");
2808 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2811 /* Attempt to polymorph (see below) */
2814 /* Powerful monsters can resist */
2815 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2816 (r_ptr->flags1 & RF1_QUESTOR) ||
2817 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2819 note = _("には効果がなかった。", " is unaffected.");
2824 /* No "real" damage */
2831 /* Clone monsters (Ignore "dam") */
2834 if (seen) obvious = TRUE;
2836 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2838 note = _("には効果がなかった。", " is unaffected.");
2843 m_ptr->hp = m_ptr->maxhp;
2845 /* Attempt to clone. */
2846 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2848 note = _("が分裂した!", " spawns!");
2852 /* No "real" damage */
2859 /* Heal Monster (use "dam" as amount of healing) */
2862 if (seen) obvious = TRUE;
2865 (void)set_monster_csleep(c_ptr->m_idx, 0);
2867 if (m_ptr->maxhp < m_ptr->max_maxhp)
2869 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2870 m_ptr->maxhp = m_ptr->max_maxhp;
2875 /* Redraw (later) if needed */
2876 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2877 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2885 if (seen) obvious = TRUE;
2888 (void)set_monster_csleep(c_ptr->m_idx, 0);
2889 if (MON_STUNNED(m_ptr))
2891 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2892 (void)set_monster_stunned(c_ptr->m_idx, 0);
2894 if (MON_CONFUSED(m_ptr))
2896 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2897 (void)set_monster_confused(c_ptr->m_idx, 0);
2899 if (MON_MONFEAR(m_ptr))
2901 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2902 (void)set_monster_monfear(c_ptr->m_idx, 0);
2906 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2909 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2913 chg_virtue(V_VITALITY, 1);
2915 if (r_ptr->flags1 & RF1_UNIQUE)
2916 chg_virtue(V_INDIVIDUALISM, 1);
2918 if (is_friendly(m_ptr))
2919 chg_virtue(V_HONOUR, 1);
2920 else if (!(r_ptr->flags3 & RF3_EVIL))
2922 if (r_ptr->flags3 & RF3_GOOD)
2923 chg_virtue(V_COMPASSION, 2);
2925 chg_virtue(V_COMPASSION, 1);
2928 if (r_ptr->flags3 & RF3_ANIMAL)
2929 chg_virtue(V_NATURE, 1);
2932 if (m_ptr->r_idx == MON_LEPER)
2935 if (!who) chg_virtue(V_COMPASSION, 5);
2938 /* Redraw (later) if needed */
2939 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2940 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2943 note = _("は体力を回復したようだ。", " looks healthier.");
2945 /* No "real" damage */
2951 /* Speed Monster (Ignore "dam") */
2954 if (seen) obvious = TRUE;
2957 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2959 note = _("の動きが速くなった。", " starts moving faster.");
2964 if (r_ptr->flags1 & RF1_UNIQUE)
2965 chg_virtue(V_INDIVIDUALISM, 1);
2966 if (is_friendly(m_ptr))
2967 chg_virtue(V_HONOUR, 1);
2970 /* No "real" damage */
2976 /* Slow Monster (Use "dam" as "power") */
2979 if (seen) obvious = TRUE;
2981 if (r_ptr->flagsr & RFR_RES_ALL)
2983 note = _("には効果がなかった。", " is unaffected.");
2985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2988 /* Powerful monsters can resist */
2989 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2990 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2992 note = _("には効果がなかった。", " is unaffected.");
2996 /* Normal monsters slow down */
2999 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3001 note = _("の動きが遅くなった。", " starts moving slower.");
3005 /* No "real" damage */
3011 /* Sleep (Use "dam" as "power") */
3014 if (seen) obvious = TRUE;
3016 if (r_ptr->flagsr & RFR_RES_ALL)
3018 note = _("には効果がなかった。", " is unaffected.");
3020 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3023 /* Attempt a saving throw */
3024 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3025 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3026 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3028 /* Memorize a flag */
3029 if (r_ptr->flags3 & RF3_NO_SLEEP)
3031 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3033 /* No obvious effect */
3034 note = _("には効果がなかった。", " is unaffected.");
3039 /* Go to sleep (much) later */
3040 note = _("は眠り込んでしまった!", " falls asleep!");
3044 /* No "real" damage */
3050 /* Sleep (Use "dam" as "power") */
3051 case GF_STASIS_EVIL:
3053 if (seen) obvious = TRUE;
3055 if (r_ptr->flagsr & RFR_RES_ALL)
3057 note = _("には効果がなかった!", " is immune.");
3059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3062 /* Attempt a saving throw */
3063 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3064 !(r_ptr->flags3 & RF3_EVIL) ||
3065 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3067 note = _("には効果がなかった。", " is unaffected.");
3072 /* Go to sleep (much) later */
3073 note = _("は動けなくなった!", " is suspended!");
3077 /* No "real" damage */
3082 /* Sleep (Use "dam" as "power") */
3085 if (seen) obvious = TRUE;
3087 if (r_ptr->flagsr & RFR_RES_ALL)
3089 note = _("には効果がなかった。", " is unaffected.");
3091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3094 /* Attempt a saving throw */
3095 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3096 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3098 note = _("には効果がなかった。", " is unaffected.");
3103 /* Go to sleep (much) later */
3104 note = _("は動けなくなった!", " is suspended!");
3108 /* No "real" damage */
3117 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3118 vir = virtue_number(V_HARMONY);
3121 dam += p_ptr->virtues[vir-1]/10;
3124 vir = virtue_number(V_INDIVIDUALISM);
3127 dam -= p_ptr->virtues[vir-1]/20;
3130 if (seen) obvious = TRUE;
3132 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3134 note = _("には効果がなかった。", " is unaffected.");
3136 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3140 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3143 /* Attempt a saving throw */
3144 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3145 (r_ptr->flags3 & RF3_NO_CONF) ||
3146 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3147 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3149 /* Memorize a flag */
3150 if (r_ptr->flags3 & RF3_NO_CONF)
3152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3156 /* No obvious effect */
3157 note = _("には効果がなかった。", " is unaffected.");
3160 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3162 else if (p_ptr->cursed & TRC_AGGRAVATE)
3164 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3165 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3169 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3172 chg_virtue(V_INDIVIDUALISM, -1);
3173 if (r_ptr->flags3 & RF3_ANIMAL)
3174 chg_virtue(V_NATURE, 1);
3177 /* No "real" damage */
3182 /* Control undead */
3183 case GF_CONTROL_UNDEAD:
3186 if (seen) obvious = TRUE;
3188 vir = virtue_number(V_UNLIFE);
3191 dam += p_ptr->virtues[vir-1]/10;
3194 vir = virtue_number(V_INDIVIDUALISM);
3197 dam -= p_ptr->virtues[vir-1]/20;
3200 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3202 note = _("には効果がなかった。", " is unaffected.");
3204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3208 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3211 /* Attempt a saving throw */
3212 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3213 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3214 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3215 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3217 /* No obvious effect */
3218 note = _("には効果がなかった。", " is unaffected.");
3220 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3222 else if (p_ptr->cursed & TRC_AGGRAVATE)
3224 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3225 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3229 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3233 /* No "real" damage */
3239 case GF_CONTROL_DEMON:
3242 if (seen) obvious = TRUE;
3244 vir = virtue_number(V_UNLIFE);
3247 dam += p_ptr->virtues[vir-1]/10;
3250 vir = virtue_number(V_INDIVIDUALISM);
3253 dam -= p_ptr->virtues[vir-1]/20;
3256 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3258 note = _("には効果がなかった。", " is unaffected.");
3260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3264 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3267 /* Attempt a saving throw */
3268 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3269 (!(r_ptr->flags3 & RF3_DEMON)) ||
3270 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3271 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3273 /* No obvious effect */
3274 note = _("には効果がなかった。", " is unaffected.");
3277 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3279 else if (p_ptr->cursed & TRC_AGGRAVATE)
3281 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3282 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3286 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3290 /* No "real" damage */
3296 case GF_CONTROL_ANIMAL:
3300 if (seen) obvious = TRUE;
3302 vir = virtue_number(V_NATURE);
3305 dam += p_ptr->virtues[vir-1]/10;
3308 vir = virtue_number(V_INDIVIDUALISM);
3311 dam -= p_ptr->virtues[vir-1]/20;
3314 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3316 note = _("には効果がなかった。", " is unaffected.");
3318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3322 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3325 /* Attempt a saving throw */
3326 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3327 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3328 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3329 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3330 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3332 /* Memorize a flag */
3333 if (r_ptr->flags3 & (RF3_NO_CONF))
3335 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3339 /* No obvious effect */
3340 note = _("には効果がなかった。", " is unaffected.");
3343 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3345 else if (p_ptr->cursed & TRC_AGGRAVATE)
3347 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3348 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3352 note = _("はなついた。", " is tamed!");
3355 if (r_ptr->flags3 & RF3_ANIMAL)
3356 chg_virtue(V_NATURE, 1);
3359 /* No "real" damage */
3365 case GF_CONTROL_LIVING:
3369 vir = virtue_number(V_UNLIFE);
3370 if (seen) obvious = TRUE;
3372 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
3373 vir = virtue_number(V_UNLIFE);
3376 dam -= p_ptr->virtues[vir-1]/10;
3379 vir = virtue_number(V_INDIVIDUALISM);
3382 dam -= p_ptr->virtues[vir-1]/20;
3385 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
3386 if (dam < 1) dam = 1;
3387 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3388 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3390 note = _("には効果がなかった。", " is unaffected.");
3392 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3396 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3399 /* Attempt a saving throw */
3400 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3401 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3402 !monster_living(r_ptr) ||
3403 ((r_ptr->level+10) > randint1(dam)))
3406 /* No obvious effect */
3407 note = _("には効果がなかった。", " is unaffected.");
3410 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3412 else if (p_ptr->cursed & TRC_AGGRAVATE)
3414 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3415 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3419 note = _("を支配した。", " is tamed!");
3422 if (r_ptr->flags3 & RF3_ANIMAL)
3423 chg_virtue(V_NATURE, 1);
3426 /* No "real" damage */
3431 /* Confusion (Use "dam" as "power") */
3434 if (seen) obvious = TRUE;
3436 if (r_ptr->flagsr & RFR_RES_ALL)
3438 note = _("には効果がなかった。", " is unaffected.");
3440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3443 /* Get confused later */
3444 do_conf = damroll(3, (dam / 2)) + 1;
3446 /* Attempt a saving throw */
3447 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3448 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3449 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3451 /* Memorize a flag */
3452 if (r_ptr->flags3 & (RF3_NO_CONF))
3454 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3460 /* No obvious effect */
3461 note = _("には効果がなかった。", " is unaffected.");
3465 /* No "real" damage */
3472 if (seen) obvious = TRUE;
3474 if (r_ptr->flagsr & RFR_RES_ALL)
3476 note = _("には効果がなかった。", " is unaffected.");
3478 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3481 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3483 /* Attempt a saving throw */
3484 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3485 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3490 /* No obvious effect */
3491 note = _("には効果がなかった。", " is unaffected.");
3495 /* No "real" damage */
3503 /* Lite, but only hurts susceptible creatures */
3511 if (r_ptr->flagsr & RFR_RES_ALL)
3517 if (r_ptr->flags3 & (RF3_HURT_LITE))
3519 /* Obvious effect */
3520 if (seen) obvious = TRUE;
3522 /* Memorize the effects */
3523 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3525 /* Special effect */
3526 note = _("は光に身をすくめた!", " cringes from the light!");
3527 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3530 /* Normally no damage */
3542 /* Lite -- opposite of Dark */
3545 if (seen) obvious = TRUE;
3547 if (r_ptr->flagsr & RFR_RES_ALL)
3549 note = _("には完全な耐性がある!", " is immune.");
3551 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3554 if (r_ptr->flagsr & RFR_RES_LITE)
3556 note = _("には耐性がある!", " resists!");
3557 dam *= 2; dam /= (randint1(6)+6);
3558 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3560 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3563 note = _("は光に身をすくめた!", " cringes from the light!");
3564 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3571 /* Dark -- opposite of Lite */
3574 if (seen) obvious = TRUE;
3576 if (r_ptr->flagsr & RFR_RES_ALL)
3578 note = _("には完全な耐性がある!", " is immune.");
3580 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3583 if (r_ptr->flagsr & RFR_RES_DARK)
3585 note = _("には耐性がある!", " resists!");
3586 dam *= 2; dam /= (randint1(6)+6);
3587 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3596 if (r_ptr->flagsr & RFR_RES_ALL)
3601 /* Hurt by rock remover */
3602 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3605 if (seen) obvious = TRUE;
3607 /* Memorize the effects */
3608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3610 /* Cute little message */
3611 note = _("の皮膚がただれた!", " loses some skin!");
3612 note_dies = _("はドロドロに溶けた!", " dissolves!");
3615 /* Usually, ignore the effects */
3626 /* Teleport undead (Use "dam" as "power") */
3627 case GF_AWAY_UNDEAD:
3629 /* Only affect undead */
3630 if (r_ptr->flags3 & (RF3_UNDEAD))
3632 bool resists_tele = FALSE;
3634 if (r_ptr->flagsr & RFR_RES_TELE)
3636 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3638 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3639 note = _("には効果がなかった。", " is unaffected.");
3640 resists_tele = TRUE;
3642 else if (r_ptr->level > randint1(100))
3644 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3645 note = _("には耐性がある!", " resists!");
3646 resists_tele = TRUE;
3652 if (seen) obvious = TRUE;
3653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3665 /* No "real" damage */
3671 /* Teleport evil (Use "dam" as "power") */
3674 /* Only affect evil */
3675 if (r_ptr->flags3 & (RF3_EVIL))
3677 bool resists_tele = FALSE;
3679 if (r_ptr->flagsr & RFR_RES_TELE)
3681 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3683 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3684 note = _("には効果がなかった。", " is unaffected.");
3685 resists_tele = TRUE;
3687 else if (r_ptr->level > randint1(100))
3689 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3690 note = _("には耐性がある!", " resists!");
3691 resists_tele = TRUE;
3697 if (seen) obvious = TRUE;
3698 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3710 /* No "real" damage */
3716 /* Teleport monster (Use "dam" as "power") */
3719 bool resists_tele = FALSE;
3720 if (r_ptr->flagsr & RFR_RES_TELE)
3722 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3724 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3725 note = _("には効果がなかった。", " is unaffected.");
3726 resists_tele = TRUE;
3728 else if (r_ptr->level > randint1(100))
3730 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3731 note = _("には耐性がある!", " resists!");
3732 resists_tele = TRUE;
3739 if (seen) obvious = TRUE;
3741 /* Prepare to teleport */
3745 /* No "real" damage */
3751 /* Turn undead (Use "dam" as "power") */
3752 case GF_TURN_UNDEAD:
3754 if (r_ptr->flagsr & RFR_RES_ALL)
3759 /* Only affect undead */
3760 if (r_ptr->flags3 & (RF3_UNDEAD))
3763 if (seen) obvious = TRUE;
3765 /* Learn about type */
3766 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3768 /* Apply some fear */
3769 do_fear = damroll(3, (dam / 2)) + 1;
3771 /* Attempt a saving throw */
3772 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3774 /* No obvious effect */
3775 note = _("には効果がなかった。", " is unaffected.");
3788 /* No "real" damage */
3794 /* Turn evil (Use "dam" as "power") */
3797 if (r_ptr->flagsr & RFR_RES_ALL)
3802 /* Only affect evil */
3803 if (r_ptr->flags3 & (RF3_EVIL))
3806 if (seen) obvious = TRUE;
3808 /* Learn about type */
3809 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3811 /* Apply some fear */
3812 do_fear = damroll(3, (dam / 2)) + 1;
3814 /* Attempt a saving throw */
3815 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3817 /* No obvious effect */
3818 note = _("には効果がなかった。", " is unaffected.");
3831 /* No "real" damage */
3837 /* Turn monster (Use "dam" as "power") */
3840 if (r_ptr->flagsr & RFR_RES_ALL)
3846 if (seen) obvious = TRUE;
3848 /* Apply some fear */
3849 do_fear = damroll(3, (dam / 2)) + 1;
3851 /* Attempt a saving throw */
3852 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3853 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3854 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3856 /* No obvious effect */
3857 note = _("には効果がなかった。", " is unaffected.");
3862 /* No "real" damage */
3869 case GF_DISP_UNDEAD:
3871 if (r_ptr->flagsr & RFR_RES_ALL)
3877 /* Only affect undead */
3878 if (r_ptr->flags3 & (RF3_UNDEAD))
3881 if (seen) obvious = TRUE;
3883 /* Learn about type */
3884 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3887 note = _("は身震いした。", " shudders.");
3888 note_dies = _("はドロドロに溶けた!", " dissolves!");
3908 if (r_ptr->flagsr & RFR_RES_ALL)
3914 /* Only affect evil */
3915 if (r_ptr->flags3 & (RF3_EVIL))
3918 if (seen) obvious = TRUE;
3920 /* Learn about type */
3921 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3924 note = _("は身震いした。", " shudders.");
3925 note_dies = _("はドロドロに溶けた!", " dissolves!");
3944 if (r_ptr->flagsr & RFR_RES_ALL)
3950 /* Only affect good */
3951 if (r_ptr->flags3 & (RF3_GOOD))
3954 if (seen) obvious = TRUE;
3956 /* Learn about type */
3957 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3960 note = _("は身震いした。", " shudders.");
3961 note_dies = _("はドロドロに溶けた!", " dissolves!");
3978 case GF_DISP_LIVING:
3980 if (r_ptr->flagsr & RFR_RES_ALL)
3986 /* Only affect non-undead */
3987 if (monster_living(r_ptr))
3990 if (seen) obvious = TRUE;
3993 note = _("は身震いした。", " shudders.");
3994 note_dies = _("はドロドロに溶けた!", " dissolves!");
4013 if (r_ptr->flagsr & RFR_RES_ALL)
4019 /* Only affect demons */
4020 if (r_ptr->flags3 & (RF3_DEMON))
4023 if (seen) obvious = TRUE;
4025 /* Learn about type */
4026 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4029 note = _("は身震いした。", " shudders.");
4030 note_dies = _("はドロドロに溶けた!", " dissolves!");
4046 /* Dispel monster */
4049 if (r_ptr->flagsr & RFR_RES_ALL)
4056 if (seen) obvious = TRUE;
4059 note = _("は身震いした。", " shudders.");
4060 note_dies = _("はドロドロに溶けた!", " dissolves!");
4067 if (seen) obvious = TRUE;
4069 if (r_ptr->flagsr & RFR_RES_ALL)
4071 note = _("には完全な耐性がある!", " is immune.");
4073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4077 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4081 /* Heal the monster */
4082 if (caster_ptr->hp < caster_ptr->maxhp)
4085 caster_ptr->hp += dam;
4086 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4088 /* Redraw (later) if needed */
4089 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4090 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4092 /* Special message */
4095 /* Get the monster name */
4096 monster_desc(killer, caster_ptr, 0);
4097 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4104 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4105 (void)hp_player(dam);
4110 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4119 if (seen) obvious = TRUE;
4121 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4123 if (r_ptr->flagsr & RFR_RES_ALL)
4125 note = _("には完全な耐性がある!", " is immune.");
4127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4131 /* Attempt a saving throw */
4132 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4133 (r_ptr->flags3 & RF3_NO_CONF) ||
4134 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4136 /* Memorize a flag */
4137 if (r_ptr->flags3 & (RF3_NO_CONF))
4139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4141 note = _("には効果がなかった。", " is unaffected.");
4144 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4147 note = _("には完全な耐性がある!", " is immune.");
4150 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4153 note = _("には耐性がある。", " resists.");
4158 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4159 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4161 if (who > 0) do_conf = randint0(4) + 4;
4162 else do_conf = randint0(8) + 8;
4168 case GF_BRAIN_SMASH:
4170 if (seen) obvious = TRUE;
4172 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4174 if (r_ptr->flagsr & RFR_RES_ALL)
4176 note = _("には完全な耐性がある!", " is immune.");
4178 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4182 /* Attempt a saving throw */
4183 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4184 (r_ptr->flags3 & RF3_NO_CONF) ||
4185 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4187 /* Memorize a flag */
4188 if (r_ptr->flags3 & (RF3_NO_CONF))
4190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4192 note = _("には効果がなかった。", " is unaffected.");
4195 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4198 note = _("には完全な耐性がある!", " is immune.");
4201 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4204 note = _("には耐性がある!", " resists!");
4209 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4210 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4214 do_conf = randint0(4) + 4;
4215 do_stun = randint0(4) + 4;
4219 do_conf = randint0(8) + 8;
4220 do_stun = randint0(8) + 8;
4222 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4230 if (seen) obvious = TRUE;
4232 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4234 if (r_ptr->flagsr & RFR_RES_ALL)
4236 note = _("には完全な耐性がある!", " is immune.");
4238 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4242 /* Attempt a saving throw */
4243 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4245 note = _("には効果がなかった。", " is unaffected.");
4254 if (seen) obvious = TRUE;
4256 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4258 if (r_ptr->flagsr & RFR_RES_ALL)
4260 note = _("には完全な耐性がある!", " is immune.");
4262 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4266 /* Attempt a saving throw */
4267 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4269 note = _("には効果がなかった。", " is unaffected.");
4278 if (seen) obvious = TRUE;
4280 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4282 if (r_ptr->flagsr & RFR_RES_ALL)
4284 note = _("には完全な耐性がある!", " is immune.");
4286 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4290 /* Attempt a saving throw */
4291 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4293 note = _("には効果がなかった。", " is unaffected.");
4302 if (seen) obvious = TRUE;
4305 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4306 "You point at %s, screaming the word, 'DIE!'."), m_name);
4308 if (r_ptr->flagsr & RFR_RES_ALL)
4310 note = _("には完全な耐性がある!", " is immune.");
4312 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4316 /* Attempt a saving throw */
4317 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4319 note = _("には効果がなかった。", " is unaffected.");
4328 if (seen) obvious = TRUE;
4330 if (r_ptr->flagsr & RFR_RES_ALL)
4332 note = _("には完全な耐性がある!", " is immune.");
4334 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4338 if (r_ptr->flags1 & RF1_UNIQUE)
4340 note = _("には効果がなかった。", " is unaffected.");
4345 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4346 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4348 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4350 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4354 note = _("は耐性を持っている!", "resists!");
4361 /* Capture monster */
4365 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4366 (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)
4368 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4373 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4374 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4375 nokori_hp = m_ptr->maxhp * 3 / 10;
4377 nokori_hp = m_ptr->maxhp * 3 / 20;
4379 if (m_ptr->hp >= nokori_hp)
4381 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4384 else if (m_ptr->hp < randint0(nokori_hp))
4386 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4387 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4388 cap_mon = m_ptr->r_idx;
4389 cap_mspeed = m_ptr->mspeed;
4391 cap_maxhp = m_ptr->max_maxhp;
4392 cap_nickname = m_ptr->nickname; /* Quark transfer */
4393 if (c_ptr->m_idx == p_ptr->riding)
4395 if (rakuba(-1, FALSE))
4397 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4401 delete_monster_idx(c_ptr->m_idx);
4407 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4413 /* Attack (Use "dam" as attack type) */
4416 /* Return this monster's death */
4417 return py_attack(y, x, dam);
4420 /* Sleep (Use "dam" as "power") */
4426 if (seen) obvious = TRUE;
4428 if (r_ptr->flagsr & RFR_RES_ALL)
4430 note = _("には効果がなかった。", " is unaffected.");
4432 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4435 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4437 note = _("には効果がなかった。", " is unaffected.");
4440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4443 if (MON_CSLEEP(m_ptr))
4445 note = _("には効果がなかった。", " is unaffected.");
4451 if (one_in_(5)) effect = 1;
4452 else if (one_in_(4)) effect = 2;
4453 else if (one_in_(3)) effect = 3;
4458 /* Powerful monsters can resist */
4459 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4460 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4462 note = _("には効果がなかった。", " is unaffected.");
4466 /* Normal monsters slow down */
4469 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4471 note = _("の動きが遅くなった。", " starts moving slower.");
4476 else if (effect == 2)
4478 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4480 /* Attempt a saving throw */
4481 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4482 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4487 /* No obvious effect */
4488 note = _("には効果がなかった。", " is unaffected.");
4493 else if (effect == 3)
4495 /* Attempt a saving throw */
4496 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4497 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4498 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4500 /* Memorize a flag */
4501 if (r_ptr->flags3 & RF3_NO_SLEEP)
4503 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4506 /* No obvious effect */
4507 note = _("には効果がなかった。", " is unaffected.");
4512 /* Go to sleep (much) later */
4513 note = _("は眠り込んでしまった!", " falls asleep!");
4520 note = _("には効果がなかった。", " is unaffected.");
4523 /* No "real" damage */
4531 if (seen) obvious = TRUE;
4533 if (r_ptr->flagsr & RFR_RES_ALL)
4535 note = _("には効果がなかった。", " is unaffected.");
4537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4541 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4543 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4544 chg_virtue(V_VITALITY, -1);
4554 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4556 if (r_ptr->flags3 & (RF3_HURT_LITE))
4558 /* Obvious effect */
4559 if (seen) obvious = TRUE;
4561 /* Memorize the effects */
4562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4564 /* Special effect */
4565 note = _("は光に身をすくめた!", " cringes from the light!");
4566 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4569 /* Normally no damage */
4576 photo = m_ptr->r_idx;
4583 case GF_BLOOD_CURSE:
4585 if (seen) obvious = TRUE;
4587 if (r_ptr->flagsr & RFR_RES_ALL)
4589 note = _("には完全な耐性がある!", " is immune.");
4591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4599 bool success = FALSE;
4600 if (seen) obvious = TRUE;
4602 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4604 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4605 if (dam < 1) dam = 1;
4607 /* No need to tame your pet */
4610 note = _("の動きが速くなった。", " starts moving faster.");
4611 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4615 /* Attempt a saving throw */
4616 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4617 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4618 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4619 (p_ptr->cursed & TRC_AGGRAVATE) ||
4620 ((r_ptr->level+10) > randint1(dam)))
4623 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4627 note = _("を支配した。", " is tamed!");
4629 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4631 /* Learn about type */
4632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4639 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4641 do_fear = randint1(90)+10;
4643 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4646 /* No "real" damage */
4653 if (seen) obvious = TRUE;
4655 if (r_ptr->flagsr & RFR_RES_ALL)
4657 note = _("には完全な耐性がある!", " is immune.");
4659 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4663 /* Attempt a saving throw */
4664 if (randint0(100 + dam) < (r_ptr->level + 50))
4666 note = _("には効果がなかった。", " is unaffected.");
4686 /* Absolutely no effect */
4687 if (skipped) return (FALSE);
4689 /* "Unique" monsters cannot be polymorphed */
4690 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4692 /* Quest monsters cannot be polymorphed */
4693 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4695 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4697 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4698 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4700 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4705 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4706 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4709 /* Modify the damage */
4711 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4712 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4714 /* Check for death */
4715 if (dam > m_ptr->hp)
4717 /* Extract method of death */
4722 /* Sound and Impact resisters never stun */
4724 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4725 !(r_ptr->flags3 & RF3_NO_STUN))
4728 if (seen) obvious = TRUE;
4731 if (MON_STUNNED(m_ptr))
4733 note = _("はひどくもうろうとした。", " is more dazed.");
4734 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4738 note = _("はもうろうとした。", " is dazed.");
4743 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4749 /* Confusion and Chaos resisters (and sleepers) never confuse */
4751 !(r_ptr->flags3 & RF3_NO_CONF) &&
4752 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4755 if (seen) obvious = TRUE;
4757 /* Already partially confused */
4758 if (MON_CONFUSED(m_ptr))
4760 note = _("はさらに混乱したようだ。", " looks more confused.");
4761 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4764 /* Was not confused */
4767 note = _("は混乱したようだ。", " looks confused.");
4771 /* Apply confusion */
4772 (void)set_monster_confused(c_ptr->m_idx, tmp);
4781 if (seen) obvious = TRUE;
4783 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4787 note = _("は弱くなったようだ。", " seems weakened.");
4788 m_ptr->maxhp -= do_time;
4789 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4794 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4795 if (do_poly && (randint1(90) > r_ptr->level))
4797 if (polymorph_monster(y, x))
4800 if (seen) obvious = TRUE;
4802 /* Monster polymorphs */
4803 note = _("が変身した!", " changes!");
4805 /* Turn off the damage */
4811 note = _("には効果がなかった。", " is unaffected.");
4814 /* Hack -- Get new monster */
4815 m_ptr = &m_list[c_ptr->m_idx];
4817 /* Hack -- Get new race */
4818 r_ptr = &r_info[m_ptr->r_idx];
4821 /* Handle "teleport" */
4825 if (seen) obvious = TRUE;
4828 note = _("が消え去った!", " disappears!");
4830 if (!who) chg_virtue(V_VALOUR, -1);
4833 teleport_away(c_ptr->m_idx, do_dist,
4834 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4836 /* Hack -- get new location */
4840 /* Hack -- get new grid */
4841 c_ptr = &cave[y][x];
4848 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4855 if (typ == GF_DRAIN_MANA)
4857 /* Drain mana does nothing */
4860 /* If another monster did the damage, hurt the monster by hand */
4863 /* Redraw (later) if needed */
4864 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4865 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4867 /* Wake the monster up */
4868 (void)set_monster_csleep(c_ptr->m_idx, 0);
4870 /* Hurt the monster */
4878 if (is_pet(m_ptr) && !(m_ptr->ml))
4881 /* Give detailed messages if destroyed */
4884 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4887 msg_format("%^s%s", m_name, note);
4895 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4897 /* Generate treasure, etc */
4898 monster_death(c_ptr->m_idx, FALSE);
4900 /* Delete the monster */
4901 delete_monster_idx(c_ptr->m_idx);
4905 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4909 /* Damaged monster */
4912 /* Give detailed messages if visible or destroyed */
4913 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4915 /* Hack -- Pain message */
4918 message_pain(c_ptr->m_idx, dam);
4925 /* Hack -- handle sleep */
4926 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4930 else if (heal_leper)
4932 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4934 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4938 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4939 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4942 delete_monster_idx(c_ptr->m_idx);
4945 /* If the player did it, give him experience, check fear */
4950 /* Hurt the monster, check for fear and death */
4951 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4956 /* Damaged monster */
4959 /* HACK - anger the monster before showing the sleep message */
4960 if (do_sleep) anger_monster(m_ptr);
4962 /* Give detailed messages if visible or destroyed */
4963 if (note && seen_msg)
4964 msg_format(_("%s%s", "%^s%s"), m_name, note);
4966 /* Hack -- Pain message */
4967 else if (known && (dam || !do_fear))
4969 message_pain(c_ptr->m_idx, dam);
4972 /* Anger monsters */
4973 if (((dam > 0) || get_angry) && !do_sleep)
4974 anger_monster(m_ptr);
4977 if ((fear || do_fear) && seen)
4983 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4986 /* Hack -- handle sleep */
4987 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4991 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4993 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4997 switch (randint1(28))
5002 msg_print(_("地面が揺れた...", "The ground trembles..."));
5003 earthquake(ty, tx, 4 + randint0(4));
5004 if (!one_in_(6)) break;
5006 case 3: case 4: case 5: case 6:
5009 int dam = damroll(10, 10);
5010 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
5012 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
5013 if (!one_in_(6)) break;
5018 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5020 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5021 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5022 if (!one_in_(6)) break;
5024 case 9: case 10: case 11:
5025 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5026 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5027 if (!one_in_(6)) break;
5028 case 12: case 13: case 14: case 15: case 16:
5029 aggravate_monsters(0);
5030 if (!one_in_(6)) break;
5032 count += activate_hi_summon(ty, tx, TRUE);
5033 if (!one_in_(6)) break;
5034 case 19: case 20: case 21: case 22:
5036 bool pet = !one_in_(3);
5037 u32b mode = PM_ALLOW_GROUP;
5039 if (pet) mode |= PM_FORCE_PET;
5040 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5042 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
5043 if (!one_in_(6)) break;
5045 case 23: case 24: case 25:
5046 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5047 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5049 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5050 else lose_exp(p_ptr->exp / 16);
5051 if (!one_in_(6)) break;
5052 case 26: case 27: case 28:
5061 (void)do_dec_stat(i);
5070 (void)do_dec_stat(randint0(6));
5079 if (p_ptr->inside_battle)
5081 p_ptr->health_who = c_ptr->m_idx;
5082 p_ptr->redraw |= (PR_HEALTH);
5086 /* XXX XXX XXX Verify this code */
5088 /* Update the monster */
5089 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5091 /* Redraw the monster grid */
5095 /* Update monster recall window */
5096 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5099 p_ptr->window |= (PW_MONSTER);
5102 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5106 if (!(flg & PROJECT_NO_HANGEKI))
5108 set_target(m_ptr, monster_target_y, monster_target_x);
5111 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5113 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5117 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5119 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5120 rakubadam_m = (dam > 200) ? 200 : dam;
5129 /* Get local object */
5132 /* Prepare to make a Blade of Chaos */
5133 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5135 q_ptr->pval = photo;
5137 /* Mark the item as fully known */
5138 q_ptr->ident |= (IDENT_MENTAL);
5140 /* Drop it in the dungeon */
5141 (void)drop_near(q_ptr, -1, py, px);
5149 /* Return "Anything seen?" */
5154 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5155 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5156 * @param who_name 効果を起こしたモンスターの名前
5157 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5158 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5159 * @param x 目標X座標 / Target x location (or location to travel "towards")
5160 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5161 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5163 * @param monspell 効果元のモンスター魔法ID
5164 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5166 * Handle a beam/bolt/ball causing damage to the player.
5167 * This routine takes a "source monster" (by index), a "distance", a default
5168 * "damage", and a "damage type". See "project_m()" above.
5169 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5170 * is reduced (see "project_m()" above). This can happen if a monster breathes
5171 * at the player and hits a wall instead.
5172 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5173 * to know if this is actually a ball or a bolt spell
5174 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5175 * we just assume that the effects were obvious, for historical reasons.
5177 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
5182 /* Hack -- assume obvious */
5183 bool obvious = TRUE;
5185 /* Player blind-ness */
5186 bool blind = (p_ptr->blind ? TRUE : FALSE);
5188 /* Player needs a "description" (he is blind) */
5191 /* Source monster */
5192 monster_type *m_ptr = NULL;
5194 /* Monster name (for attacks) */
5197 /* Monster name (for damage) */
5200 /* Hack -- messages */
5206 /* Player is not here */
5207 if (!player_bold(y, x)) return (FALSE);
5209 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5211 if (kawarimi(TRUE)) return FALSE;
5214 /* Player cannot hurt himself */
5215 if (!who) return (FALSE);
5216 if (who == p_ptr->riding) return (FALSE);
5218 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5221 int max_attempts = 10;
5224 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5225 else if (p_ptr->special_defense & KATA_FUUJIN)
5226 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5228 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5231 /* Choose 'new' target */
5236 t_y = m_list[who].fy - 1 + randint1(3);
5237 t_x = m_list[who].fx - 1 + randint1(3);
5240 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
5242 if (max_attempts < 1)
5244 t_y = m_list[who].fy;
5245 t_x = m_list[who].fx;
5250 t_y = py - 1 + randint1(3);
5251 t_x = px - 1 + randint1(3);
5254 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5261 /* Limit maximum damage */
5262 if (dam > 1600) dam = 1600;
5264 /* Reduce damage by distance */
5265 dam = (dam + r) / (r + 1);
5268 /* If the player is blind, be more descriptive */
5269 if (blind) fuzzy = TRUE;
5274 /* Get the source monster */
5275 m_ptr = &m_list[who];
5276 /* Extract the monster level */
5277 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5279 /* Get the monster name */
5280 monster_desc(m_name, m_ptr, 0);
5282 /* Get the monster's real name (gotten before polymorph!) */
5283 strcpy(killer, who_name);
5289 case PROJECT_WHO_UNCTRL_POWER:
5290 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5293 case PROJECT_WHO_GLASS_SHARDS:
5294 strcpy(killer, _("ガラスの破片", "shards of glass"));
5298 strcpy(killer, _("罠", "a trap"));
5303 strcpy(m_name, killer);
5306 /* Analyze the damage */
5309 /* Standard damage -- hurts inventory too */
5312 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5313 get_damage = acid_dam(dam, killer, monspell, FALSE);
5317 /* Standard damage -- hurts inventory too */
5320 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5321 get_damage = fire_dam(dam, killer, monspell, FALSE);
5325 /* Standard damage -- hurts inventory too */
5328 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5329 get_damage = cold_dam(dam, killer, monspell, FALSE);
5333 /* Standard damage -- hurts inventory too */
5336 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5337 get_damage = elec_dam(dam, killer, monspell, FALSE);
5341 /* Standard damage -- also poisons player */
5344 bool double_resist = IS_OPPOSE_POIS();
5345 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5347 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5348 if (double_resist) dam = (dam + 2) / 3;
5350 if ((!(double_resist || p_ptr->resist_pois)) &&
5351 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5358 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5360 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5365 /* Standard damage -- also poisons / mutates player */
5368 bool double_resist = IS_OPPOSE_POIS();
5369 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5371 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5372 if (double_resist) dam = (2 * dam + 2) / 5;
5373 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);
5378 if (one_in_(5)) /* 6 */
5380 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5381 if (one_in_(4)) /* 4 */
5389 inven_damage(set_acid_destroy, 2);
5395 /* Standard damage */
5398 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5399 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5403 /* Holy Orb -- Player only takes partial damage */
5406 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5407 if (p_ptr->align > 10)
5409 else if (p_ptr->align < -10)
5411 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5417 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5418 if (p_ptr->align > 10)
5420 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5424 /* Arrow -- XXX no dodging */
5429 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5431 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5433 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5436 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5440 /* Plasma -- XXX No resist */
5443 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5444 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5446 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5448 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5449 (void)set_stun(p_ptr->stun + k);
5452 if (!(p_ptr->resist_fire ||
5454 p_ptr->immune_fire))
5456 inven_damage(set_acid_destroy, 3);
5462 /* Nether -- drain experience */
5465 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5466 if (p_ptr->resist_neth)
5468 if (!prace_is_(RACE_SPECTRE))
5469 dam *= 6; dam /= (randint1(4) + 7);
5471 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5473 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5475 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5477 learn_spell(monspell);
5481 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5487 /* Water -- stun/confuse */
5490 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5491 if (!CHECK_MULTISHADOW())
5493 if (!p_ptr->resist_sound)
5495 set_stun(p_ptr->stun + randint1(40));
5497 if (!p_ptr->resist_conf)
5499 set_confused(p_ptr->confused + randint1(5) + 5);
5504 inven_damage(set_cold_destroy, 3);
5508 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5512 /* Chaos -- many effects */
5515 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5516 if (p_ptr->resist_chaos)
5518 dam *= 6; dam /= (randint1(4) + 7);
5521 if (!CHECK_MULTISHADOW())
5523 if (!p_ptr->resist_conf)
5525 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5527 if (!p_ptr->resist_chaos)
5529 (void)set_image(p_ptr->image + randint1(10));
5532 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5533 (void)gain_random_mutation(0);
5536 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5538 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5541 if (!p_ptr->resist_chaos || one_in_(9))
5543 inven_damage(set_elec_destroy, 2);
5544 inven_damage(set_fire_destroy, 2);
5548 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5552 /* Shards -- mostly cutting */
5555 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5556 if (p_ptr->resist_shard)
5558 dam *= 6; dam /= (randint1(4) + 7);
5560 else if (!CHECK_MULTISHADOW())
5562 (void)set_cut(p_ptr->cut + dam);
5565 if (!p_ptr->resist_shard || one_in_(13))
5567 inven_damage(set_cold_destroy, 2);
5570 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5574 /* Sound -- mostly stunning */
5577 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5578 if (p_ptr->resist_sound)
5580 dam *= 5; dam /= (randint1(4) + 7);
5582 else if (!CHECK_MULTISHADOW())
5584 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5585 (void)set_stun(p_ptr->stun + k);
5588 if (!p_ptr->resist_sound || one_in_(13))
5590 inven_damage(set_cold_destroy, 2);
5593 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5597 /* Pure confusion */
5600 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5601 if (p_ptr->resist_conf)
5603 dam *= 5; dam /= (randint1(4) + 7);
5605 else if (!CHECK_MULTISHADOW())
5607 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5609 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5613 /* Disenchantment -- see above */
5616 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5617 if (p_ptr->resist_disen)
5619 dam *= 6; dam /= (randint1(4) + 7);
5621 else if (!CHECK_MULTISHADOW())
5623 (void)apply_disenchant(0);
5625 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5629 /* Nexus -- see above */
5632 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5633 if (p_ptr->resist_nexus)
5635 dam *= 6; dam /= (randint1(4) + 7);
5637 else if (!CHECK_MULTISHADOW())
5641 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5645 /* Force -- mostly stun */
5648 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5649 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5651 (void)set_stun(p_ptr->stun + randint1(20));
5653 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5658 /* Rocket -- stun, cut */
5661 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5662 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5664 (void)set_stun(p_ptr->stun + randint1(20));
5667 if (p_ptr->resist_shard)
5671 else if (!CHECK_MULTISHADOW())
5673 (void)set_cut(p_ptr->cut + (dam / 2));
5676 if (!p_ptr->resist_shard || one_in_(12))
5678 inven_damage(set_cold_destroy, 3);
5681 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5685 /* Inertia -- slowness */
5688 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5689 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5690 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5694 /* Lite -- blinding */
5697 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5698 if (p_ptr->resist_lite)
5700 dam *= 4; dam /= (randint1(4) + 7);
5702 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5704 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5707 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5709 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5712 else if (prace_is_(RACE_S_FAIRY))
5717 if (p_ptr->wraith_form) dam *= 2;
5718 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5720 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5722 p_ptr->wraith_form = 0;
5723 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5724 "The light forces you out of your incorporeal shadow form."));
5726 p_ptr->redraw |= PR_MAP;
5727 /* Update monsters */
5728 p_ptr->update |= (PU_MONSTERS);
5730 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5732 /* Redraw status bar */
5733 p_ptr->redraw |= (PR_STATUS);
5740 /* Dark -- blinding */
5743 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5744 if (p_ptr->resist_dark)
5746 dam *= 4; dam /= (randint1(4) + 7);
5748 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5750 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5752 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5754 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5758 /* Time -- bolt fewer effects XXX */
5761 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5762 if (p_ptr->resist_time)
5765 dam /= (randint1(4) + 7);
5766 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5768 else if (!CHECK_MULTISHADOW())
5770 switch (randint1(10))
5772 case 1: case 2: case 3: case 4: case 5:
5774 if (p_ptr->prace == RACE_ANDROID) break;
5775 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5776 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5780 case 6: case 7: case 8: case 9:
5782 switch (randint1(6))
5784 case 1: k = A_STR; act = _("強く", "strong"); break;
5785 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5786 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5787 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5788 case 5: k = A_CON; act = _("健康で", "hale"); break;
5789 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5792 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5793 "You're not as %s as you used to be..."), act);
5795 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5796 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5797 p_ptr->update |= (PU_BONUS);
5803 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5804 "You're not as powerful as you used to be..."));
5806 for (k = 0; k < 6; k++)
5808 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5809 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5811 p_ptr->update |= (PU_BONUS);
5817 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5821 /* Gravity -- stun plus slowness plus teleport */
5824 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5825 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5827 if (!CHECK_MULTISHADOW())
5829 teleport_player(5, TELEPORT_PASSIVE);
5830 if (!p_ptr->levitation)
5831 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5832 if (!(p_ptr->resist_sound || p_ptr->levitation))
5834 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5835 (void)set_stun(p_ptr->stun + k);
5838 if (p_ptr->levitation)
5840 dam = (dam * 2) / 3;
5843 if (!p_ptr->levitation || one_in_(13))
5845 inven_damage(set_cold_destroy, 2);
5848 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5852 /* Standard damage */
5853 case GF_DISINTEGRATE:
5855 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5857 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5863 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5865 (void)hp_player(dam);
5872 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5873 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5880 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5881 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5887 if (p_ptr->free_act) break;
5888 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5890 if (ironman_nightmare)
5892 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5894 /* Pick a nightmare */
5895 get_mon_num_prep(get_nightmare, NULL);
5897 /* Have some nightmares */
5898 have_nightmare(get_mon_num(MAX_DEPTH));
5900 /* Remove the monster restriction */
5901 get_mon_num_prep(NULL, NULL);
5904 set_paralyzed(p_ptr->paralyzed + dam);
5914 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5915 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5922 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5923 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5930 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5932 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5933 if (!p_ptr->resist_shard || one_in_(13))
5935 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5936 inven_damage(set_cold_destroy, 2);
5942 /* Ice -- cold plus stun plus cuts */
5945 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5946 get_damage = cold_dam(dam, killer, monspell, FALSE);
5947 if (!CHECK_MULTISHADOW())
5949 if (!p_ptr->resist_shard)
5951 (void)set_cut(p_ptr->cut + damroll(5, 8));
5953 if (!p_ptr->resist_sound)
5955 (void)set_stun(p_ptr->stun + randint1(15));
5958 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5960 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5970 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5972 if (p_ptr->mimic_form)
5974 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5975 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5980 switch (p_ptr->prace)
5982 /* Some races are immune */
5996 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6008 if (CHECK_MULTISHADOW())
6010 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
6012 else if (p_ptr->csp)
6016 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6018 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6021 if (dam >= p_ptr->csp)
6025 p_ptr->csp_frac = 0;
6034 learn_spell(monspell);
6037 p_ptr->redraw |= (PR_MANA);
6040 p_ptr->window |= (PW_PLAYER);
6041 p_ptr->window |= (PW_SPELL);
6045 /* Heal the monster */
6046 if (m_ptr->hp < m_ptr->maxhp)
6050 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6052 /* Redraw (later) if needed */
6053 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6054 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6056 /* Special message */
6059 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6072 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6074 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6075 learn_spell(monspell);
6079 if (!CHECK_MULTISHADOW())
6081 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6083 if (!p_ptr->resist_conf)
6085 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6088 if (!p_ptr->resist_chaos && one_in_(3))
6090 (void)set_image(p_ptr->image + randint0(250) + 150);
6097 p_ptr->csp_frac = 0;
6099 p_ptr->redraw |= PR_MANA;
6102 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6108 case GF_BRAIN_SMASH:
6110 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6112 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6113 learn_spell(monspell);
6117 if (!CHECK_MULTISHADOW())
6119 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6125 p_ptr->csp_frac = 0;
6127 p_ptr->redraw |= PR_MANA;
6130 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6131 if (!CHECK_MULTISHADOW())
6133 if (!p_ptr->resist_blind)
6135 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6137 if (!p_ptr->resist_conf)
6139 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6141 if (!p_ptr->free_act)
6143 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6145 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6147 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6148 (void)do_dec_stat(A_INT);
6149 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6150 (void)do_dec_stat(A_WIS);
6152 if (!p_ptr->resist_chaos)
6154 (void)set_image(p_ptr->image + randint0(250) + 150);
6164 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6166 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6167 learn_spell(monspell);
6171 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6172 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6180 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6182 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6183 learn_spell(monspell);
6187 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6188 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6196 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6198 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6199 learn_spell(monspell);
6203 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6204 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6212 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6214 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6215 learn_spell(monspell);
6219 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6220 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6228 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6230 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6231 learn_spell(monspell);
6235 if (!CHECK_MULTISHADOW())
6237 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6238 curse_equipment(40, 20);
6241 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6243 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6258 /* Hex - revenge damage stored */
6259 revenge_store(get_damage);
6261 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6262 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6264 char m_name_self[80];
6267 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6269 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6270 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6271 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6274 if (p_ptr->riding && dam > 0)
6276 rakubadam_p = (dam > 200) ? 200 : dam;
6284 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6286 (void)kawarimi(FALSE);
6289 /* Return "Anything seen?" */
6295 * Find the distance from (x, y) to a line.
6297 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
6299 /* Vector from (x, y) to (x1, y1) */
6308 int pd = distance(y1, x1, y, x);
6309 int nd = distance(y1, x1, y2, x2);
6311 if (pd > nd) return distance(y, x, y2, x2);
6313 /* Component of P on N */
6314 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6316 /* Absolute value */
6317 return((nd >= 0) ? nd : 0 - nd);
6324 * Modified version of los() for calculation of disintegration balls.
6325 * Disintegration effects are stopped by permanent walls.
6327 bool in_disintegration_range(int y1, int x1, int y2, int x2)
6347 /* Slope, or 1/Slope, of LOS */
6351 /* Extract the offset */
6355 /* Extract the absolute offset */
6360 /* Handle adjacent (or identical) grids */
6361 if ((ax < 2) && (ay < 2)) return (TRUE);
6364 /* Paranoia -- require "safe" origin */
6365 /* if (!in_bounds(y1, x1)) return (FALSE); */
6368 /* Directly South/North */
6371 /* South -- check for walls */
6374 for (ty = y1 + 1; ty < y2; ty++)
6376 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6380 /* North -- check for walls */
6383 for (ty = y1 - 1; ty > y2; ty--)
6385 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6393 /* Directly East/West */
6396 /* East -- check for walls */
6399 for (tx = x1 + 1; tx < x2; tx++)
6401 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6405 /* West -- check for walls */
6408 for (tx = x1 - 1; tx > x2; tx--)
6410 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6419 /* Extract some signs */
6420 sx = (dx < 0) ? -1 : 1;
6421 sy = (dy < 0) ? -1 : 1;
6424 /* Vertical "knights" */
6429 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6433 /* Horizontal "knights" */
6438 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6443 /* Calculate scale factor div 2 */
6446 /* Calculate scale factor */
6450 /* Travel horizontally */
6453 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6459 /* Consider the special case where slope == 1. */
6470 /* Note (below) the case (qy == f2), where */
6471 /* the LOS exactly meets the corner of a tile. */
6474 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6485 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6498 /* Travel vertically */
6501 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6517 /* Note (below) the case (qx == f2), where */
6518 /* the LOS exactly meets the corner of a tile. */
6521 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6532 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6553 void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, int typ)
6558 int brev = rad * rad / dist;
6562 int mdis = distance(y1, x1, y2, x2) + rad;
6564 while (bdis <= mdis)
6568 if ((0 < dist) && (path_n < dist))
6570 int ny = GRID_Y(path_g[path_n]);
6571 int nx = GRID_X(path_g[path_n]);
6572 int nd = distance(ny, nx, y1, x1);
6574 /* Get next base point */
6583 /* Travel from center outward */
6584 for (cdis = 0; cdis <= brad; cdis++)
6586 /* Scan the maximal blast area of radius "cdis" */
6587 for (y = by - cdis; y <= by + cdis; y++)
6589 for (x = bx - cdis; x <= bx + cdis; x++)
6591 /* Ignore "illegal" locations */
6592 if (!in_bounds(y, x)) continue;
6594 /* Enforce a circular "ripple" */
6595 if (distance(y1, x1, y, x) != bdis) continue;
6597 /* Enforce an arc */
6598 if (distance(by, bx, y, x) != cdis) continue;
6604 /* Lights are stopped by opaque terrains */
6605 if (!los(by, bx, y, x)) continue;
6607 case GF_DISINTEGRATE:
6608 /* Disintegration are stopped only by perma-walls */
6609 if (!in_disintegration_range(by, bx, y, x)) continue;
6612 /* Ball explosions are stopped by walls */
6613 if (!projectable(by, bx, y, x)) continue;
6617 /* Save this grid */
6625 /* Encode some more "radius" info */
6626 gm[bdis + 1] = *pgrids;
6628 /* Increase the size */
6629 brad = rad * (path_n + brev) / (dist + brev);
6631 /* Find the next ripple */
6635 /* Store the effect size */
6641 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6642 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6643 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6644 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6645 * @param x 目標X座標 / Target x location (or location to travel "towards")
6646 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6647 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6648 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6649 * @param monspell 効果元のモンスター魔法ID
6650 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6653 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6654 * towards a given location (optionally passing over the heads of interposing
6655 * monsters), and have it do a given amount of damage to the monsters (and
6656 * optionally objects) within the given radius of the final location.
6658 * A "bolt" travels from source to target and affects only the target grid.
6659 * A "beam" travels from source to target, affecting all grids passed through.
6660 * A "ball" travels from source to the target, exploding at the target, and
6661 * affecting everything within the given radius of the target location.
6663 * Traditionally, a "bolt" does not affect anything on the ground, and does
6664 * not pass over the heads of interposing monsters, much like a traditional
6665 * missile, and will "stop" abruptly at the "target" even if no monster is
6666 * positioned there, while a "ball", on the other hand, passes over the heads
6667 * of monsters between the source and target, and affects everything except
6668 * the source monster which lies within the final radius, while a "beam"
6669 * affects every monster between the source and target, except for the casting
6670 * monster (or player), and rarely affects things on the ground.
6672 * Two special flags allow us to use this function in special ways, the
6673 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6674 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6675 * actually projecting from the source monster (or player).
6677 * The player will only get "experience" for monsters killed by himself
6678 * Unique monsters can only be destroyed by attacks from the player
6680 * Only 256 grids can be affected per projection, limiting the effective
6681 * "radius" of standard ball attacks to nine units (diameter nineteen).
6683 * One can project in a given "direction" by combining PROJECT_THRU with small
6684 * offsets to the initial location (see "line_spell()"), or by calculating
6685 * "virtual targets" far away from the player.
6687 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6688 * continuing until it actually hits somethings (useful for "stone to mud").
6690 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6692 * Balls must explode BEFORE hitting walls, or they would affect monsters
6693 * on both sides of a wall. Some bug reports indicate that this is still
6694 * happening in 2.7.8 for Windows, though it appears to be impossible.
6696 * We "pre-calculate" the blast area only in part for efficiency.
6697 * More importantly, this lets us do "explosions" from the "inside" out.
6698 * This results in a more logical distribution of "blast" treasure.
6699 * It also produces a better (in my opinion) animation of the explosion.
6700 * It could be (but is not) used to have the treasure dropped by monsters
6701 * in the middle of the explosion fall "outwards", and then be damaged by
6702 * the blast as it spreads outwards towards the treasure drop location.
6704 * Walls and doors are included in the blast area, so that they can be
6705 * "burned" or "melted" in later versions.
6707 * This algorithm is intended to maximize simplicity, not necessarily
6708 * efficiency, since this function is not a bottleneck in the code.
6710 * We apply the blast effect from ground zero outwards, in several passes,
6711 * first affecting features, then objects, then monsters, then the player.
6712 * This allows walls to be removed before checking the object or monster
6713 * in the wall, and protects objects which are dropped by monsters killed
6714 * in the blast, and allows the player to see all affects before he is
6715 * killed or teleported away. The semantics of this method are open to
6716 * various interpretations, but they seem to work well in practice.
6718 * We process the blast area from ground-zero outwards to allow for better
6719 * distribution of treasure dropped by monsters, and because it provides a
6720 * pleasing visual effect at low cost.
6722 * Note that the damage done by "ball" explosions decreases with distance.
6723 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6725 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6726 * the target, and then the damage "flows" along this beam of destruction.
6727 * The damage at every grid is the same as at the "center" of a "ball"
6728 * explosion, since the "beam" grids are treated as if they ARE at the
6729 * center of a "ball" explosion.
6731 * Currently, specifying "beam" plus "ball" means that locations which are
6732 * covered by the initial "beam", and also covered by the final "ball", except
6733 * for the final grid (the epicenter of the ball), will be "hit twice", once
6734 * by the initial beam, and once by the exploding ball. For the grid right
6735 * next to the epicenter, this results in 150% damage being done. The center
6736 * does not have this problem, for the same reason the final grid in a "beam"
6737 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6738 * grids which are covered by the "ball" will NOT work, as then they will
6739 * receive LESS damage than they should. Do not combine "beam" with "ball".
6741 * The array "gy[],gx[]" with current size "grids" is used to hold the
6742 * collected locations of all grids in the "blast area" plus "beam path".
6744 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6745 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6746 * first blast grid (see above) with radius "N" from the blast center. Note
6747 * that only the first gm[1] grids in the blast area thus take full damage.
6748 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6749 * number of blast grids.
6751 * Note that once the projection is complete, (y2,x2) holds the final location
6752 * of bolts/beams, and the "epicenter" of balls.
6754 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6755 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6756 * implementation of the "distance" function. Also, a bolt can be properly
6757 * viewed as a "ball" with a "rad" of "zero".
6759 * Note that if no "target" is reached before the beam/bolt/ball travels the
6760 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6761 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6763 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6764 * to move from point A to point B, even if the player cannot see part of the
6765 * projection path. Note that in general, the player will *always* see part
6766 * of the path, since it either starts at the player or ends on the player.
6768 * Hack -- we assume that every "projection" is "self-illuminating".
6770 * Hack -- when only a single monster is affected, we automatically track
6771 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6773 * Note that all projections now "explode" at their final destination, even
6774 * if they were being projected at a more distant destination. This means
6775 * that "ball" spells will *always* explode.
6777 * Note that we must call "handle_stuff()" after affecting terrain features
6778 * in the blast radius, in case the "illumination" of the grid was changed,
6779 * and "update_view()" and "update_monsters()" need to be called.
6782 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
6792 int y_saver, x_saver; /* For reflecting monsters */
6794 int msec = delay_factor * delay_factor * delay_factor;
6796 /* Assume the player sees nothing */
6797 bool notice = FALSE;
6799 /* Assume the player has seen nothing */
6800 bool visual = FALSE;
6802 /* Assume the player has seen no blast grids */
6805 /* Assume to be a normal ball spell */
6806 bool breath = FALSE;
6808 /* Is the player blind? */
6809 bool blind = (p_ptr->blind ? TRUE : FALSE);
6811 bool old_hide = FALSE;
6813 /* Number of grids in the "path" */
6816 /* Actual grids in the "path" */
6819 /* Number of grids in the "blast area" (including the "beam" path) */
6822 /* Coordinates of the affected grids */
6823 byte gx[1024], gy[1024];
6825 /* Encoded "radius" info (see above) */
6828 /* Actual radius encoded in gm[] */
6833 /* Attacker's name (prepared before polymorph)*/
6836 /* Can the player see the source of this effect? */
6837 bool see_s_msg = TRUE;
6839 /* Initialize by null string */
6845 /* Default target of monsterspell is player */
6846 monster_target_y=py;
6847 monster_target_x=px;
6849 /* Hack -- Jump to target */
6850 if (flg & (PROJECT_JUMP))
6855 /* Clear the flag */
6856 flg &= ~(PROJECT_JUMP);
6861 /* Start at player */
6868 /* Start at monster */
6871 x1 = m_list[who].fx;
6872 y1 = m_list[who].fy;
6873 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6886 /* Default "destination" */
6891 /* Hack -- verify stuff */
6892 if (flg & (PROJECT_THRU))
6894 if ((x1 == x2) && (y1 == y2))
6896 flg &= ~(PROJECT_THRU);
6900 /* Handle a breath attack */
6905 if (flg & PROJECT_HIDE) old_hide = TRUE;
6906 flg |= PROJECT_HIDE;
6910 /* Hack -- Assume there will be no blast (max radius 32) */
6911 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6919 /* Collect beam grids */
6920 if (flg & (PROJECT_BEAM))
6931 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6933 case GF_DISINTEGRATE:
6934 flg |= (PROJECT_GRID);
6935 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6939 /* Calculate the projection path */
6941 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6943 /* Hack -- Handle stuff */
6946 /* Giga-Hack SEEKER & SUPER_RAY */
6948 if( typ == GF_SEEKER )
6958 for (i = 0; i < path_n; ++i)
6963 int ny = GRID_Y(path_g[i]);
6964 int nx = GRID_X(path_g[i]);
6975 /* Only do visuals if requested */
6976 if (!blind && !(flg & (PROJECT_HIDE)))
6978 /* Only do visuals if the player can "see" the bolt */
6979 if (panel_contains(y, x) && player_has_los_bold(y, x))
6986 /* Obtain the bolt pict */
6987 p = bolt_pict(oy, ox, y, x, typ);
6989 /* Extract attr/char */
6993 /* Visual effects */
6994 print_rel(c, a, y, x);
6995 move_cursor_relative(y, x);
6996 /*if (fresh_before)*/ Term_fresh();
6997 Term_xtra(TERM_XTRA_DELAY, msec);
6999 /*if (fresh_before)*/ Term_fresh();
7001 /* Display "beam" grids */
7002 if (flg & (PROJECT_BEAM))
7004 /* Obtain the explosion pict */
7005 p = bolt_pict(y, x, y, x, typ);
7007 /* Extract attr/char */
7011 /* Visual effects */
7012 print_rel(c, a, y, x);
7015 /* Hack -- Activate delay */
7019 /* Hack -- delay anyway for consistency */
7022 /* Delay for consistency */
7023 Term_xtra(TERM_XTRA_DELAY, msec);
7026 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7027 if( is_mirror_grid(&cave[y][x]))
7029 /* The target of monsterspell becomes tha mirror(broken) */
7030 monster_target_y=(s16b)y;
7031 monster_target_x=(s16b)x;
7034 next_mirror( &oy,&ox,y,x );
7036 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7037 for( j = last_i; j <=i ; j++ )
7039 y = GRID_Y(path_g[j]);
7040 x = GRID_X(path_g[j]);
7041 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
7042 if(!who && (project_m_n==1) && !jump ){
7043 if(cave[project_m_y][project_m_x].m_idx >0 ){
7044 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7048 /* Hack -- auto-recall */
7049 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7051 /* Hack - auto-track */
7052 health_track(cave[project_m_y][project_m_x].m_idx);
7056 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7061 for( i = last_i ; i < path_n ; i++ )
7064 y = GRID_Y(path_g[i]);
7065 x = GRID_X(path_g[i]);
7066 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
7068 if(!who && (project_m_n==1) && !jump ){
7069 if(cave[project_m_y][project_m_x].m_idx >0 ){
7070 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7074 /* Hack -- auto-recall */
7075 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7077 /* Hack - auto-track */
7078 health_track(cave[project_m_y][project_m_x].m_idx);
7082 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7086 else if(typ == GF_SUPER_RAY){
7088 int second_step = 0;
7095 for (i = 0; i < path_n; ++i)
7100 int ny = GRID_Y(path_g[i]);
7101 int nx = GRID_X(path_g[i]);
7112 /* Only do visuals if requested */
7113 if (!blind && !(flg & (PROJECT_HIDE)))
7115 /* Only do visuals if the player can "see" the bolt */
7116 if (panel_contains(y, x) && player_has_los_bold(y, x))
7123 /* Obtain the bolt pict */
7124 p = bolt_pict(oy, ox, y, x, typ);
7126 /* Extract attr/char */
7130 /* Visual effects */
7131 print_rel(c, a, y, x);
7132 move_cursor_relative(y, x);
7133 /*if (fresh_before)*/ Term_fresh();
7134 Term_xtra(TERM_XTRA_DELAY, msec);
7136 /*if (fresh_before)*/ Term_fresh();
7138 /* Display "beam" grids */
7139 if (flg & (PROJECT_BEAM))
7141 /* Obtain the explosion pict */
7142 p = bolt_pict(y, x, y, x, typ);
7144 /* Extract attr/char */
7148 /* Visual effects */
7149 print_rel(c, a, y, x);
7152 /* Hack -- Activate delay */
7156 /* Hack -- delay anyway for consistency */
7159 /* Delay for consistency */
7160 Term_xtra(TERM_XTRA_DELAY, msec);
7163 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7164 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7166 if( second_step )continue;
7169 if( is_mirror_grid(&cave[y][x]) && !second_step )
7171 /* The target of monsterspell becomes tha mirror(broken) */
7172 monster_target_y=(s16b)y;
7173 monster_target_x=(s16b)x;
7176 for( j = 0; j <=i ; j++ )
7178 y = GRID_Y(path_g[j]);
7179 x = GRID_X(path_g[j]);
7180 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7184 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7185 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7186 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7187 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7188 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7189 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7190 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7191 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7194 for( i = 0; i < path_n ; i++ )
7197 y = GRID_Y(path_g[i]);
7198 x = GRID_X(path_g[i]);
7199 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
7200 if(!who && (project_m_n==1) && !jump ){
7201 if(cave[project_m_y][project_m_x].m_idx >0 ){
7202 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7206 /* Hack -- auto-recall */
7207 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7209 /* Hack - auto-track */
7210 health_track(cave[project_m_y][project_m_x].m_idx);
7214 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7219 /* Project along the path */
7220 for (i = 0; i < path_n; ++i)
7225 int ny = GRID_Y(path_g[i]);
7226 int nx = GRID_X(path_g[i]);
7228 if (flg & PROJECT_DISI)
7230 /* Hack -- Balls explode before reaching walls */
7231 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7233 else if (flg & PROJECT_LOS)
7235 /* Hack -- Balls explode before reaching walls */
7236 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7240 /* Hack -- Balls explode before reaching walls */
7241 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7248 /* Collect beam grids */
7249 if (flg & (PROJECT_BEAM))
7256 /* Only do visuals if requested */
7257 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7259 /* Only do visuals if the player can "see" the bolt */
7260 if (panel_contains(y, x) && player_has_los_bold(y, x))
7267 /* Obtain the bolt pict */
7268 p = bolt_pict(oy, ox, y, x, typ);
7270 /* Extract attr/char */
7274 /* Visual effects */
7275 print_rel(c, a, y, x);
7276 move_cursor_relative(y, x);
7277 /*if (fresh_before)*/ Term_fresh();
7278 Term_xtra(TERM_XTRA_DELAY, msec);
7280 /*if (fresh_before)*/ Term_fresh();
7282 /* Display "beam" grids */
7283 if (flg & (PROJECT_BEAM))
7285 /* Obtain the explosion pict */
7286 p = bolt_pict(y, x, y, x, typ);
7288 /* Extract attr/char */
7292 /* Visual effects */
7293 print_rel(c, a, y, x);
7296 /* Hack -- Activate delay */
7300 /* Hack -- delay anyway for consistency */
7303 /* Delay for consistency */
7304 Term_xtra(TERM_XTRA_DELAY, msec);
7311 /* Save the "blast epicenter" */
7315 if (breath && !path_n)
7321 flg &= ~(PROJECT_HIDE);
7325 /* Start the "explosion" */
7328 /* Hack -- make sure beams get to "explode" */
7336 /* If we found a "target", explode there */
7337 if (dist <= MAX_RANGE)
7339 /* Mega-Hack -- remove the final "beam" grid */
7340 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7343 * Create a conical breath attack
7354 flg &= ~(PROJECT_HIDE);
7356 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7360 /* Determine the blast area, work from the inside out */
7361 for (dist = 0; dist <= rad; dist++)
7363 /* Scan the maximal blast area of radius "dist" */
7364 for (y = by - dist; y <= by + dist; y++)
7366 for (x = bx - dist; x <= bx + dist; x++)
7368 /* Ignore "illegal" locations */
7369 if (!in_bounds2(y, x)) continue;
7371 /* Enforce a "circular" explosion */
7372 if (distance(by, bx, y, x) != dist) continue;
7378 /* Lights are stopped by opaque terrains */
7379 if (!los(by, bx, y, x)) continue;
7381 case GF_DISINTEGRATE:
7382 /* Disintegration are stopped only by perma-walls */
7383 if (!in_disintegration_range(by, bx, y, x)) continue;
7386 /* Ball explosions are stopped by walls */
7387 if (!projectable(by, bx, y, x)) continue;
7391 /* Save this grid */
7398 /* Encode some more "radius" info */
7404 /* Speed -- ignore "non-explosions" */
7405 if (!grids) return (FALSE);
7408 /* Display the "blast area" if requested */
7409 if (!blind && !(flg & (PROJECT_HIDE)))
7411 /* Then do the "blast", from inside out */
7412 for (t = 0; t <= gm_rad; t++)
7414 /* Dump everything with this radius */
7415 for (i = gm[t]; i < gm[t+1]; i++)
7417 /* Extract the location */
7421 /* Only do visuals if the player can "see" the blast */
7422 if (panel_contains(y, x) && player_has_los_bold(y, x))
7431 /* Obtain the explosion pict */
7432 p = bolt_pict(y, x, y, x, typ);
7434 /* Extract attr/char */
7438 /* Visual effects -- Display */
7439 print_rel(c, a, y, x);
7443 /* Hack -- center the cursor */
7444 move_cursor_relative(by, bx);
7446 /* Flush each "radius" seperately */
7447 /*if (fresh_before)*/ Term_fresh();
7449 /* Delay (efficiently) */
7450 if (visual || drawn)
7452 Term_xtra(TERM_XTRA_DELAY, msec);
7456 /* Flush the erasing */
7459 /* Erase the explosion drawn above */
7460 for (i = 0; i < grids; i++)
7462 /* Extract the location */
7466 /* Hack -- Erase if needed */
7467 if (panel_contains(y, x) && player_has_los_bold(y, x))
7473 /* Hack -- center the cursor */
7474 move_cursor_relative(by, bx);
7476 /* Flush the explosion */
7477 /*if (fresh_before)*/ Term_fresh();
7482 /* Update stuff if needed */
7483 if (p_ptr->update) update_stuff();
7486 if (flg & PROJECT_KILL)
7488 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7489 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
7493 /* Check features */
7494 if (flg & (PROJECT_GRID))
7496 /* Start with "dist" of zero */
7499 /* Scan for features */
7500 for (i = 0; i < grids; i++)
7502 /* Hack -- Notice new "dist" values */
7503 if (gm[dist+1] == i) dist++;
7505 /* Get the grid location */
7509 /* Find the closest point in the blast */
7512 int d = dist_to_line(y, x, y1, x1, by, bx);
7514 /* Affect the grid */
7515 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7519 /* Affect the grid */
7520 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7525 /* Update stuff if needed */
7526 if (p_ptr->update) update_stuff();
7529 if (flg & (PROJECT_ITEM))
7531 /* Start with "dist" of zero */
7534 /* Scan for objects */
7535 for (i = 0; i < grids; i++)
7537 /* Hack -- Notice new "dist" values */
7538 if (gm[dist+1] == i) dist++;
7540 /* Get the grid location */
7544 /* Find the closest point in the blast */
7547 int d = dist_to_line(y, x, y1, x1, by, bx);
7549 /* Affect the object in the grid */
7550 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7554 /* Affect the object in the grid */
7555 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7561 /* Check monsters */
7562 if (flg & (PROJECT_KILL))
7569 /* Start with "dist" of zero */
7572 /* Scan for monsters */
7573 for (i = 0; i < grids; i++)
7577 /* Hack -- Notice new "dist" values */
7578 if (gm[dist + 1] == i) dist++;
7580 /* Get the grid location */
7584 /* A single bolt may be reflected */
7587 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7588 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7590 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7591 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7592 (!who || dist_hack > 1) && !one_in_(10))
7595 int max_attempts = 10;
7597 /* Choose 'new' target */
7600 t_y = y_saver - 1 + randint1(3);
7601 t_x = x_saver - 1 + randint1(3);
7604 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7606 if (max_attempts < 1)
7614 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7615 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7616 else if (m_ptr->r_idx == MON_DIO)
7617 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7619 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7621 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7623 /* Reflected bolts randomly target either one */
7624 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7625 else flg |= PROJECT_PLAYER;
7627 /* The bolt is reflected */
7628 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7630 /* Don't affect the monster any longer */
7636 /* Find the closest point in the blast */
7639 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7643 effective_dist = dist;
7647 /* There is the riding player on this monster */
7648 if (p_ptr->riding && player_bold(y, x))
7650 /* Aimed on the player */
7651 if (flg & PROJECT_PLAYER)
7653 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7656 * A beam or bolt is well aimed
7658 * So don't affects the mount.
7665 * The spell is not well aimed,
7666 * So partly affect the mount too.
7673 * This grid is the original target.
7674 * Or aimed on your horse.
7676 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7678 /* Hit the mount with full damage */
7682 * Otherwise this grid is not the
7683 * original target, it means that line
7684 * of fire is obstructed by this
7688 * A beam or bolt will hit either
7689 * player or mount. Choose randomly.
7691 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7695 /* Hit the mount with full damage */
7699 /* Hit the player later */
7700 flg |= PROJECT_PLAYER;
7702 /* Don't affect the mount */
7708 * The spell is not well aimed, so
7709 * partly affect both player and
7718 /* Affect the monster in the grid */
7719 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7723 /* Player affected one monster (without "jumping") */
7724 if (!who && (project_m_n == 1) && !jump)
7730 /* Track if possible */
7731 if (cave[y][x].m_idx > 0)
7733 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7737 /* Hack -- auto-recall */
7738 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7740 /* Hack - auto-track */
7741 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7749 if (flg & (PROJECT_KILL))
7751 /* Start with "dist" of zero */
7754 /* Scan for player */
7755 for (i = 0; i < grids; i++)
7759 /* Hack -- Notice new "dist" values */
7760 if (gm[dist+1] == i) dist++;
7762 /* Get the grid location */
7766 /* Affect the player? */
7767 if (!player_bold(y, x)) continue;
7769 /* Find the closest point in the blast */
7772 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7776 effective_dist = dist;
7779 /* Target may be your horse */
7782 /* Aimed on the player */
7783 if (flg & PROJECT_PLAYER)
7785 /* Hit the player with full damage */
7789 * Hack -- When this grid was not the
7790 * original target, a beam or bolt
7791 * would hit either player or mount,
7792 * and should be choosen randomly.
7794 * But already choosen to hit the
7795 * mount at this point.
7797 * Or aimed on your horse.
7799 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7802 * A beam or bolt is well aimed
7804 * So don't affects the player.
7811 * The spell is not well aimed,
7812 * So partly affect the player too.
7818 /* Affect the player */
7819 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7827 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7829 if (rakubadam_m > 0)
7831 if (rakuba(rakubadam_m, FALSE))
7833 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7836 if (p_ptr->riding && rakubadam_p > 0)
7838 if(rakuba(rakubadam_p, FALSE))
7840 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7845 /* Return "something was noticed" */
7850 * @brief 鏡魔法「封魔結界」の効果処理
7852 * @return 効果があったらTRUEを返す
7854 bool binding_field( int dam )
7856 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7857 int mirror_num=0; /* 鏡の数 */
7862 int msec= delay_factor*delay_factor*delay_factor;
7868 /* Default target of monsterspell is player */
7869 monster_target_y=py;
7870 monster_target_x=px;
7872 for( x=0 ; x < cur_wid ; x++ )
7874 for( y=0 ; y < cur_hgt ; y++ )
7876 if( is_mirror_grid(&cave[y][x]) &&
7877 distance(py,px,y,x) <= MAX_RANGE &&
7878 distance(py,px,y,x) != 0 &&
7879 player_has_los_bold(y,x) &&
7880 projectable(py, px, y, x)
7882 mirror_y[mirror_num]=y;
7883 mirror_x[mirror_num]=x;
7889 if( mirror_num < 2 )return FALSE;
7891 point_x[0] = randint0( mirror_num );
7893 point_x[1] = randint0( mirror_num );
7895 while( point_x[0] == point_x[1] );
7897 point_y[0]=mirror_y[point_x[0]];
7898 point_x[0]=mirror_x[point_x[0]];
7899 point_y[1]=mirror_y[point_x[1]];
7900 point_x[1]=mirror_x[point_x[1]];
7904 x=point_x[0]+point_x[1]+point_x[2];
7905 y=point_y[0]+point_y[1]+point_y[2];
7907 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7908 - (point_y[0]*3-y)*(point_x[1]*3-x);
7909 if( centersign == 0 )return FALSE;
7911 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7912 x1 = x1 < point_x[2] ? x1 : point_x[2];
7913 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7914 y1 = y1 < point_y[2] ? y1 : point_y[2];
7916 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7917 x2 = x2 > point_x[2] ? x2 : point_x[2];
7918 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7919 y2 = y2 > point_y[2] ? y2 : point_y[2];
7921 for( y=y1 ; y <=y2 ; y++ ){
7922 for( x=x1 ; x <=x2 ; x++ ){
7923 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7924 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7925 centersign*( (point_x[1]-x)*(point_y[2]-y)
7926 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7927 centersign*( (point_x[2]-x)*(point_y[0]-y)
7928 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7930 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
7931 /* Visual effects */
7933 && panel_contains(y,x)){
7934 p = bolt_pict(y,x,y,x, GF_MANA );
7935 print_rel(PICT_C(p), PICT_A(p),y,x);
7936 move_cursor_relative(y, x);
7937 /*if (fresh_before)*/ Term_fresh();
7938 Term_xtra(TERM_XTRA_DELAY, msec);
7944 for( y=y1 ; y <=y2 ; y++ ){
7945 for( x=x1 ; x <=x2 ; x++ ){
7946 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7947 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7948 centersign*( (point_x[1]-x)*(point_y[2]-y)
7949 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7950 centersign*( (point_x[2]-x)*(point_y[0]-y)
7951 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7953 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
7954 (void)project_f(0,0,y,x,dam,GF_MANA);
7959 for( y=y1 ; y <=y2 ; y++ ){
7960 for( x=x1 ; x <=x2 ; x++ ){
7961 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7962 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7963 centersign*( (point_x[1]-x)*(point_y[2]-y)
7964 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7965 centersign*( (point_x[2]-x)*(point_y[0]-y)
7966 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7968 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
7969 (void)project_o(0,0,y,x,dam,GF_MANA);
7974 for( y=y1 ; y <=y2 ; y++ ){
7975 for( x=x1 ; x <=x2 ; x++ ){
7976 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7977 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7978 centersign*( (point_x[1]-x)*(point_y[2]-y)
7979 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7980 centersign*( (point_x[2]-x)*(point_y[0]-y)
7981 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7983 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
7984 (void)project_m(0,0,y,x,dam,GF_MANA,
7985 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7991 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7992 remove_mirror(point_y[0],point_x[0]);
7999 * @brief 鏡魔法「鏡の封印」の効果処理
8001 * @return 効果があったらTRUEを返す
8003 void seal_of_mirror( int dam )
8007 for( x = 0 ; x < cur_wid ; x++ )
8009 for( y = 0 ; y < cur_hgt ; y++ )
8011 if( is_mirror_grid(&cave[y][x]))
8013 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8014 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8016 if( !cave[y][x].m_idx )