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_INERTIAL: 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(POSITION y, POSITION x, POSITION ny, POSITION 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, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION 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)...
1550 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1551 * may result in a dereference of an invalid pointer. XXX XXX XXX
1554 * Various messages are produced, and damage is applied.
1557 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1558 * actually be "made" of that substance, or "breathe" big balls of it.
1559 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1561 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1562 * and hurts evil less. If can breath nether, then it resists it as well.
1565 * Damage reductions use the following formulas:
1566 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1567 * gives avg damage of .655, ranging from .858 to .500
1568 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1569 * gives avg damage of .544, ranging from .714 to .417
1570 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1571 * gives avg damage of .444, ranging from .556 to .333
1572 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1573 * gives avg damage of .327, ranging from .427 to .250
1574 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1575 * gives something simple.
1578 * In this function, "result" messages are postponed until the end, where
1579 * the "note" string is appended to the monster name, if not NULL. So,
1580 * to make a spell have "no effect" just set "note" to NULL. You should
1581 * also set "notice" to FALSE, or the player will learn what the spell does.
1584 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1588 static bool project_m(int who, int r, int y, int x, HIT_POINT dam, int typ, int flg, bool see_s_msg)
1592 cave_type *c_ptr = &cave[y][x];
1594 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1595 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1597 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1601 /* Is the monster "seen"? */
1602 bool seen = m_ptr->ml;
1603 bool seen_msg = is_seen(m_ptr);
1605 bool slept = (bool)MON_CSLEEP(m_ptr);
1607 /* Were the effects "obvious" (if seen)? */
1608 bool obvious = FALSE;
1610 /* Can the player know about this effect? */
1611 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1613 /* Were the effects "irrelevant"? */
1614 bool skipped = FALSE;
1616 /* Gets the monster angry at the source of the effect? */
1617 bool get_angry = FALSE;
1619 /* Polymorph setting (true or false) */
1620 bool do_poly = FALSE;
1622 /* Teleport setting (max distance) */
1625 /* Confusion setting (amount to confuse) */
1628 /* Stunning setting (amount to stun) */
1631 /* Sleep amount (amount to sleep) */
1634 /* Fear amount (amount to fear) */
1637 /* Time amount (amount to time) */
1640 bool heal_leper = FALSE;
1642 /* Hold the monster name */
1648 /* Assume no note */
1651 /* Assume a default death */
1652 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1657 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1660 if (!c_ptr->m_idx) return (FALSE);
1662 /* Never affect projector */
1663 if (who && (c_ptr->m_idx == who)) return (FALSE);
1664 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1665 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1667 /* Don't affect already death monsters */
1668 /* Prevents problems with chain reactions of exploding monsters */
1669 if (m_ptr->hp < 0) return (FALSE);
1671 /* Reduce damage by distance */
1672 dam = (dam + r) / (r + 1);
1675 /* Get the monster name (BEFORE polymorphing) */
1676 monster_desc(m_name, m_ptr, 0);
1678 /* Get the monster possessive ("his"/"her"/"its") */
1679 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1681 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1683 /* Analyze the damage type */
1686 /* Magic Missile -- pure damage */
1689 if (seen) obvious = TRUE;
1691 if (r_ptr->flagsr & RFR_RES_ALL)
1693 note = _("には完全な耐性がある!", " is immune.");
1695 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1704 if (seen) obvious = TRUE;
1706 if (r_ptr->flagsr & RFR_RES_ALL)
1708 note = _("には完全な耐性がある!", " is immune.");
1710 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1713 if (r_ptr->flagsr & RFR_IM_ACID)
1715 note = _("にはかなり耐性がある!", " resists a lot.");
1717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1725 if (seen) obvious = TRUE;
1727 if (r_ptr->flagsr & RFR_RES_ALL)
1729 note = _("には完全な耐性がある!", " is immune.");
1731 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1734 if (r_ptr->flagsr & RFR_IM_ELEC)
1736 note = _("にはかなり耐性がある!", " resists a lot.");
1738 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1746 if (seen) obvious = TRUE;
1748 if (r_ptr->flagsr & RFR_RES_ALL)
1750 note = _("には完全な耐性がある!", " is immune.");
1752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1755 if (r_ptr->flagsr & RFR_IM_FIRE)
1757 note = _("にはかなり耐性がある!", " resists a lot.");
1759 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1761 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1763 note = _("はひどい痛手をうけた。", " is hit hard.");
1765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1773 if (seen) obvious = TRUE;
1775 if (r_ptr->flagsr & RFR_RES_ALL)
1777 note = _("には完全な耐性がある!", " is immune.");
1779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1782 if (r_ptr->flagsr & RFR_IM_COLD)
1784 note = _("にはかなり耐性がある!", " resists a lot.");
1786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1788 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1790 note = _("はひどい痛手をうけた。", " is hit hard.");
1792 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1800 if (seen) obvious = TRUE;
1802 if (r_ptr->flagsr & RFR_RES_ALL)
1804 note = _("には完全な耐性がある!", " is immune.");
1806 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1809 if (r_ptr->flagsr & RFR_IM_POIS)
1811 note = _("にはかなり耐性がある!", " resists a lot.");
1813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1821 if (seen) obvious = TRUE;
1823 if (r_ptr->flagsr & RFR_RES_ALL)
1825 note = _("には完全な耐性がある!", " is immune.");
1827 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1830 if (r_ptr->flagsr & RFR_IM_POIS)
1832 note = _("には耐性がある。", " resists.");
1833 dam *= 3; dam /= randint1(6) + 6;
1834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1836 else if (one_in_(3)) do_poly = TRUE;
1840 /* Hellfire -- hurts Evil */
1843 if (seen) obvious = TRUE;
1845 if (r_ptr->flagsr & RFR_RES_ALL)
1847 note = _("には完全な耐性がある!", " is immune.");
1849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1852 if (r_ptr->flags3 & RF3_GOOD)
1854 note = _("はひどい痛手をうけた。", " is hit hard.");
1856 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1861 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1864 if (seen) obvious = TRUE;
1866 if (r_ptr->flagsr & RFR_RES_ALL)
1868 note = _("には完全な耐性がある!", " is immune.");
1870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1873 if (r_ptr->flags3 & RF3_GOOD)
1875 note = _("には完全な耐性がある!", " is immune.");
1877 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1879 else if (r_ptr->flags3 & RF3_EVIL)
1882 note = _("はひどい痛手をうけた。", " is hit hard.");
1883 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1887 note = _("には耐性がある。", " resists.");
1888 dam *= 3; dam /= randint1(6) + 6;
1893 /* Arrow -- XXX no defense */
1896 if (seen) obvious = TRUE;
1898 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = _("には完全な耐性がある!", " is immune.");
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1908 /* Plasma -- XXX perhaps check ELEC or FIRE */
1911 if (seen) obvious = TRUE;
1913 if (r_ptr->flagsr & RFR_RES_ALL)
1915 note = _("には完全な耐性がある!", " is immune.");
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1920 if (r_ptr->flagsr & RFR_RES_PLAS)
1922 note = _("には耐性がある。", " resists.");
1923 dam *= 3; dam /= randint1(6) + 6;
1924 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1929 /* Nether -- see above */
1932 if (seen) obvious = TRUE;
1934 if (r_ptr->flagsr & RFR_RES_ALL)
1936 note = _("には完全な耐性がある!", " is immune.");
1938 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1941 if (r_ptr->flagsr & RFR_RES_NETH)
1943 if (r_ptr->flags3 & RF3_UNDEAD)
1945 note = _("には完全な耐性がある!", " is immune.");
1947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1951 note = _("には耐性がある。", " resists.");
1952 dam *= 3; dam /= randint1(6) + 6;
1954 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1956 else if (r_ptr->flags3 & RF3_EVIL)
1958 note = _("はいくらか耐性を示した。", " resists somewhat.");
1960 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1965 /* Water (acid) damage -- Water spirits/elementals are immune */
1968 if (seen) obvious = TRUE;
1970 if (r_ptr->flagsr & RFR_RES_ALL)
1972 note = _("には完全な耐性がある!", " is immune.");
1974 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1977 if (r_ptr->flagsr & RFR_RES_WATE)
1979 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1981 note = _("には完全な耐性がある!", " is immune.");
1986 note = _("には耐性がある。", " resists.");
1987 dam *= 3; dam /= randint1(6) + 6;
1989 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1994 /* Chaos -- Chaos breathers resist */
1997 if (seen) obvious = TRUE;
1999 if (r_ptr->flagsr & RFR_RES_ALL)
2001 note = _("には完全な耐性がある!", " is immune.");
2003 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2006 if (r_ptr->flagsr & RFR_RES_CHAO)
2008 note = _("には耐性がある。", " resists.");
2009 dam *= 3; dam /= randint1(6) + 6;
2010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2012 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2014 note = _("はいくらか耐性を示した。", " resists somewhat.");
2015 dam *= 3; dam /= randint1(6) + 6;
2016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2021 do_conf = (5 + randint1(11) + r) / (r + 1);
2026 /* Shards -- Shard breathers resist */
2029 if (seen) obvious = TRUE;
2031 if (r_ptr->flagsr & RFR_RES_ALL)
2033 note = _("には完全な耐性がある!", " is immune.");
2035 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2038 if (r_ptr->flagsr & RFR_RES_SHAR)
2040 note = _("には耐性がある。", " resists.");
2041 dam *= 3; dam /= randint1(6) + 6;
2042 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2047 /* Rocket: Shard resistance helps */
2050 if (seen) obvious = TRUE;
2052 if (r_ptr->flagsr & RFR_RES_ALL)
2054 note = _("には完全な耐性がある!", " is immune.");
2056 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2059 if (r_ptr->flagsr & RFR_RES_SHAR)
2061 note = _("はいくらか耐性を示した。", " resists somewhat.");
2063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2069 /* Sound -- Sound breathers resist */
2072 if (seen) obvious = TRUE;
2074 if (r_ptr->flagsr & RFR_RES_ALL)
2076 note = _("には完全な耐性がある!", " is immune.");
2078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2081 if (r_ptr->flagsr & RFR_RES_SOUN)
2083 note = _("には耐性がある。", " resists.");
2084 dam *= 2; dam /= randint1(6) + 6;
2085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2087 else do_stun = (10 + randint1(15) + r) / (r + 1);
2094 if (seen) obvious = TRUE;
2096 if (r_ptr->flagsr & RFR_RES_ALL)
2098 note = _("には完全な耐性がある!", " is immune.");
2100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2103 if (r_ptr->flags3 & RF3_NO_CONF)
2105 note = _("には耐性がある。", " resists.");
2106 dam *= 3; dam /= randint1(6) + 6;
2107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2109 else do_conf = (10 + randint1(15) + r) / (r + 1);
2113 /* Disenchantment -- Breathers and Disenchanters resist */
2116 if (seen) obvious = TRUE;
2118 if (r_ptr->flagsr & RFR_RES_ALL)
2120 note = _("には完全な耐性がある!", " is immune.");
2122 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2125 if (r_ptr->flagsr & RFR_RES_DISE)
2127 note = _("には耐性がある。", " resists.");
2128 dam *= 3; dam /= randint1(6) + 6;
2129 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2134 /* Nexus -- Breathers and Existers resist */
2137 if (seen) obvious = TRUE;
2139 if (r_ptr->flagsr & RFR_RES_ALL)
2141 note = _("には完全な耐性がある!", " is immune.");
2143 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2146 if (r_ptr->flagsr & RFR_RES_NEXU)
2148 note = _("には耐性がある。", " resists.");
2149 dam *= 3; dam /= randint1(6) + 6;
2150 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2158 if (seen) obvious = TRUE;
2160 if (r_ptr->flagsr & RFR_RES_ALL)
2162 note = _("には完全な耐性がある!", " is immune.");
2164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2167 if (r_ptr->flagsr & RFR_RES_WALL)
2169 note = _("には耐性がある。", " resists.");
2170 dam *= 3; dam /= randint1(6) + 6;
2171 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2173 else do_stun = (randint1(15) + r) / (r + 1);
2177 /* Inertia -- breathers resist */
2180 if (seen) obvious = TRUE;
2182 if (r_ptr->flagsr & RFR_RES_ALL)
2184 note = _("には完全な耐性がある!", " is immune.");
2186 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2189 if (r_ptr->flagsr & RFR_RES_INER)
2191 note = _("には耐性がある。", " resists.");
2192 dam *= 3; dam /= randint1(6) + 6;
2193 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2197 /* Powerful monsters can resist */
2198 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2199 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2203 /* Normal monsters slow down */
2206 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2208 note = _("の動きが遅くなった。", " starts moving slower.");
2215 /* Time -- breathers resist */
2218 if (seen) obvious = TRUE;
2220 if (r_ptr->flagsr & RFR_RES_ALL)
2222 note = _("には完全な耐性がある!", " is immune.");
2224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2227 if (r_ptr->flagsr & RFR_RES_TIME)
2229 note = _("には耐性がある。", " resists.");
2230 dam *= 3; dam /= randint1(6) + 6;
2231 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2233 else do_time = (dam + 1) / 2;
2237 /* Gravity -- breathers resist */
2240 bool resist_tele = FALSE;
2242 if (seen) obvious = TRUE;
2244 if (r_ptr->flagsr & RFR_RES_ALL)
2246 note = _("には完全な耐性がある!", " is immune.");
2248 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2251 if (r_ptr->flagsr & RFR_RES_TELE)
2253 if (r_ptr->flags1 & (RF1_UNIQUE))
2255 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2256 note = _("には効果がなかった。", " is unaffected!");
2259 else if (r_ptr->level > randint1(100))
2261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2262 note = _("には耐性がある!", " resists!");
2267 if (!resist_tele) do_dist = 10;
2269 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2271 if (r_ptr->flagsr & RFR_RES_GRAV)
2273 note = _("には耐性がある!", " resists!");
2274 dam *= 3; dam /= randint1(6) + 6;
2276 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2281 /* Powerful monsters can resist */
2282 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2283 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2287 /* Normal monsters slow down */
2290 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2292 note = _("の動きが遅くなった。", " starts moving slower.");
2297 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2299 /* Attempt a saving throw */
2300 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2301 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2305 /* No obvious effect */
2306 note = _("には効果がなかった。", " is unaffected!");
2318 if (seen) obvious = TRUE;
2320 if (r_ptr->flagsr & RFR_RES_ALL)
2322 note = _("には完全な耐性がある!", " is immune.");
2324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2332 case GF_DISINTEGRATE:
2334 if (seen) obvious = TRUE;
2336 if (r_ptr->flagsr & RFR_RES_ALL)
2338 note = _("には完全な耐性がある!", " is immune.");
2340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2343 if (r_ptr->flags3 & RF3_HURT_ROCK)
2345 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2346 note = _("の皮膚がただれた!", " loses some skin!");
2347 note_dies = _("は蒸発した!", " evaporates!");
2355 if (seen) obvious = TRUE;
2357 /* PSI only works if the monster can see you! -- RG */
2358 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2361 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2366 if (r_ptr->flagsr & RFR_RES_ALL)
2368 note = _("には完全な耐性がある!", " is immune.");
2370 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2373 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2376 note = _("には完全な耐性がある!", " is immune.");
2377 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2380 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2381 (r_ptr->flags3 & RF3_ANIMAL) ||
2382 (r_ptr->level > randint1(3 * dam)))
2384 note = _("には耐性がある!", " resists!");
2388 * Powerful demons & undead can turn a mindcrafter's
2389 * attacks back on them
2391 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2392 (r_ptr->level > p_ptr->lev / 2) &&
2396 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2397 (seen ? "%^s's corrupted mind backlashes your attack!" :
2398 "%^ss corrupted mind backlashes your attack!")), m_name);
2401 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2403 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2407 /* Injure +/- confusion */
2408 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2409 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2410 if (one_in_(4) && !CHECK_MULTISHADOW())
2412 switch (randint1(4))
2415 set_confused(p_ptr->confused + 3 + randint1(dam));
2418 set_stun(p_ptr->stun + randint1(dam));
2422 if (r_ptr->flags3 & RF3_NO_FEAR)
2423 note = _("には効果がなかった。", " is unaffected.");
2425 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2429 if (!p_ptr->free_act)
2430 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2439 if ((dam > 0) && one_in_(4))
2441 switch (randint1(4))
2444 do_conf = 3 + randint1(dam);
2447 do_stun = 3 + randint1(dam);
2450 do_fear = 3 + randint1(dam);
2453 note = _("は眠り込んでしまった!", " falls asleep!");
2454 do_sleep = 3 + randint1(dam);
2459 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2465 if (seen) obvious = TRUE;
2467 if (r_ptr->flagsr & RFR_RES_ALL)
2469 note = _("には完全な耐性がある!", " is immune.");
2471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2474 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2477 note = _("には完全な耐性がある!", " is immune.");
2479 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2480 (r_ptr->flags3 & RF3_ANIMAL) ||
2481 (r_ptr->level > randint1(3 * dam)))
2483 note = _("には耐性がある!", " resists!");
2487 * Powerful demons & undead can turn a mindcrafter's
2488 * attacks back on them
2490 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2491 (r_ptr->level > p_ptr->lev / 2) &&
2495 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2496 (seen ? "%^s's corrupted mind backlashes your attack!" :
2497 "%^ss corrupted mind backlashes your attack!")), m_name);
2499 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2501 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2505 /* Injure + mana drain */
2506 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2507 if (!CHECK_MULTISHADOW())
2509 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2510 p_ptr->csp -= damroll(5, dam) / 2;
2511 if (p_ptr->csp < 0) p_ptr->csp = 0;
2512 p_ptr->redraw |= PR_MANA;
2513 p_ptr->window |= (PW_SPELL);
2515 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2522 int b = damroll(5, dam) / 4;
2523 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2524 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2525 (seen ? "You convert %s's pain into %s!" :
2526 "You convert %ss pain into %s!"));
2527 msg_format(msg, m_name, str);
2529 b = MIN(p_ptr->msp, p_ptr->csp + b);
2531 p_ptr->redraw |= PR_MANA;
2532 p_ptr->window |= (PW_SPELL);
2534 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2538 case GF_TELEKINESIS:
2540 if (seen) obvious = TRUE;
2542 if (r_ptr->flagsr & RFR_RES_ALL)
2544 note = _("には完全な耐性がある!", " is immune.");
2546 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2551 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2556 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2558 /* Attempt a saving throw */
2559 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2560 (r_ptr->level > 5 + randint1(dam)))
2564 /* No obvious effect */
2570 /* Psycho-spear -- powerful magic missile */
2573 if (seen) obvious = TRUE;
2575 if (r_ptr->flagsr & RFR_RES_ALL)
2577 note = _("には完全な耐性がある!", " is immune.");
2579 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2585 /* Meteor -- powerful magic missile */
2588 if (seen) obvious = TRUE;
2590 if (r_ptr->flagsr & RFR_RES_ALL)
2592 note = _("には完全な耐性がある!", " is immune.");
2594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2602 if (!is_hostile(m_ptr)) break;
2604 if (seen) obvious = TRUE;
2606 if (r_ptr->flagsr & RFR_RES_ALL)
2608 note = _("には効果がなかった!", " is immune.");
2610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2613 /* Attempt a saving throw */
2614 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2615 (r_ptr->flags3 & RF3_NO_CONF) ||
2616 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2618 /* Memorize a flag */
2619 if (r_ptr->flags3 & RF3_NO_CONF)
2621 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2628 * Powerful demons & undead can turn a mindcrafter's
2629 * attacks back on them
2631 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2632 (r_ptr->level > p_ptr->lev / 2) &&
2636 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2637 (seen ? "%^s's corrupted mind backlashes your attack!" :
2638 "%^ss corrupted mind backlashes your attack!")), m_name);
2641 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2643 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2647 /* Confuse, stun, terrify */
2648 switch (randint1(4))
2651 set_stun(p_ptr->stun + dam / 2);
2654 set_confused(p_ptr->confused + dam / 2);
2658 if (r_ptr->flags3 & RF3_NO_FEAR)
2659 note = _("には効果がなかった。", " is unaffected.");
2661 set_afraid(p_ptr->afraid + dam);
2668 /* No obvious effect */
2669 note = _("には効果がなかった。", " is unaffected.");
2675 if ((dam > 29) && (randint1(100) < dam))
2677 note = _("があなたに隷属した。", " is in your thrall!");
2682 switch (randint1(4))
2696 /* No "real" damage */
2703 /* Ice -- Cold + Cuts + Stun */
2706 if (seen) obvious = TRUE;
2708 if (r_ptr->flagsr & RFR_RES_ALL)
2710 note = _("には完全な耐性がある!", " is immune.");
2712 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2715 do_stun = (randint1(15) + 1) / (r + 1);
2716 if (r_ptr->flagsr & RFR_IM_COLD)
2718 note = _("にはかなり耐性がある!", " resists a lot.");
2720 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2722 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2724 note = _("はひどい痛手をうけた。", " is hit hard.");
2726 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2735 if (seen) obvious = TRUE;
2737 if (r_ptr->flagsr & RFR_RES_ALL)
2739 note = _("には完全な耐性がある!", " is immune.");
2741 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2744 if (!monster_living(r_ptr))
2746 if (is_original_ap_and_seen(m_ptr))
2748 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2749 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2750 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2752 note = _("には効果がなかった。", " is unaffected.");
2756 else do_time = (dam+7)/8;
2764 if (seen) obvious = TRUE;
2766 if (r_ptr->flagsr & RFR_RES_ALL)
2768 note = _("には完全な耐性がある!", " is immune.");
2770 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2773 if (!monster_living(r_ptr))
2775 if (is_original_ap_and_seen(m_ptr))
2777 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2778 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2779 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2781 note = _("には完全な耐性がある!", " is immune.");
2785 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2786 (randint1(888) != 666)) ||
2787 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2788 randint1(100) != 66))
2790 note = _("には耐性がある!", " resists!");
2798 /* Polymorph monster (Use "dam" as "power") */
2801 if (seen) obvious = TRUE;
2803 if (r_ptr->flagsr & RFR_RES_ALL)
2805 note = _("には効果がなかった。", " is unaffected.");
2807 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2810 /* Attempt to polymorph (see below) */
2813 /* Powerful monsters can resist */
2814 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2815 (r_ptr->flags1 & RF1_QUESTOR) ||
2816 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2818 note = _("には効果がなかった。", " is unaffected.");
2823 /* No "real" damage */
2830 /* Clone monsters (Ignore "dam") */
2833 if (seen) obvious = TRUE;
2835 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2837 note = _("には効果がなかった。", " is unaffected.");
2842 m_ptr->hp = m_ptr->maxhp;
2844 /* Attempt to clone. */
2845 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2847 note = _("が分裂した!", " spawns!");
2851 /* No "real" damage */
2858 /* Heal Monster (use "dam" as amount of healing) */
2861 if (seen) obvious = TRUE;
2864 (void)set_monster_csleep(c_ptr->m_idx, 0);
2866 if (m_ptr->maxhp < m_ptr->max_maxhp)
2868 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2869 m_ptr->maxhp = m_ptr->max_maxhp;
2874 /* Redraw (later) if needed */
2875 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2876 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2884 if (seen) obvious = TRUE;
2887 (void)set_monster_csleep(c_ptr->m_idx, 0);
2888 if (MON_STUNNED(m_ptr))
2890 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2891 (void)set_monster_stunned(c_ptr->m_idx, 0);
2893 if (MON_CONFUSED(m_ptr))
2895 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2896 (void)set_monster_confused(c_ptr->m_idx, 0);
2898 if (MON_MONFEAR(m_ptr))
2900 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2901 (void)set_monster_monfear(c_ptr->m_idx, 0);
2905 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2908 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2912 chg_virtue(V_VITALITY, 1);
2914 if (r_ptr->flags1 & RF1_UNIQUE)
2915 chg_virtue(V_INDIVIDUALISM, 1);
2917 if (is_friendly(m_ptr))
2918 chg_virtue(V_HONOUR, 1);
2919 else if (!(r_ptr->flags3 & RF3_EVIL))
2921 if (r_ptr->flags3 & RF3_GOOD)
2922 chg_virtue(V_COMPASSION, 2);
2924 chg_virtue(V_COMPASSION, 1);
2927 if (r_ptr->flags3 & RF3_ANIMAL)
2928 chg_virtue(V_NATURE, 1);
2931 if (m_ptr->r_idx == MON_LEPER)
2934 if (!who) chg_virtue(V_COMPASSION, 5);
2937 /* Redraw (later) if needed */
2938 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2939 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2942 note = _("は体力を回復したようだ。", " looks healthier.");
2944 /* No "real" damage */
2950 /* Speed Monster (Ignore "dam") */
2953 if (seen) obvious = TRUE;
2956 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2958 note = _("の動きが速くなった。", " starts moving faster.");
2963 if (r_ptr->flags1 & RF1_UNIQUE)
2964 chg_virtue(V_INDIVIDUALISM, 1);
2965 if (is_friendly(m_ptr))
2966 chg_virtue(V_HONOUR, 1);
2969 /* No "real" damage */
2975 /* Slow Monster (Use "dam" as "power") */
2978 if (seen) obvious = TRUE;
2980 if (r_ptr->flagsr & RFR_RES_ALL)
2982 note = _("には効果がなかった。", " is unaffected.");
2984 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2987 /* Powerful monsters can resist */
2988 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2989 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2991 note = _("には効果がなかった。", " is unaffected.");
2995 /* Normal monsters slow down */
2998 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3000 note = _("の動きが遅くなった。", " starts moving slower.");
3004 /* No "real" damage */
3010 /* Sleep (Use "dam" as "power") */
3013 if (seen) obvious = TRUE;
3015 if (r_ptr->flagsr & RFR_RES_ALL)
3017 note = _("には効果がなかった。", " is unaffected.");
3019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3022 /* Attempt a saving throw */
3023 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3024 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3025 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3027 /* Memorize a flag */
3028 if (r_ptr->flags3 & RF3_NO_SLEEP)
3030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3032 /* No obvious effect */
3033 note = _("には効果がなかった。", " is unaffected.");
3038 /* Go to sleep (much) later */
3039 note = _("は眠り込んでしまった!", " falls asleep!");
3043 /* No "real" damage */
3049 /* Sleep (Use "dam" as "power") */
3050 case GF_STASIS_EVIL:
3052 if (seen) obvious = TRUE;
3054 if (r_ptr->flagsr & RFR_RES_ALL)
3056 note = _("には効果がなかった!", " is immune.");
3058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3061 /* Attempt a saving throw */
3062 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3063 !(r_ptr->flags3 & RF3_EVIL) ||
3064 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3066 note = _("には効果がなかった。", " is unaffected.");
3071 /* Go to sleep (much) later */
3072 note = _("は動けなくなった!", " is suspended!");
3076 /* No "real" damage */
3081 /* Sleep (Use "dam" as "power") */
3084 if (seen) obvious = TRUE;
3086 if (r_ptr->flagsr & RFR_RES_ALL)
3088 note = _("には効果がなかった。", " is unaffected.");
3090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3093 /* Attempt a saving throw */
3094 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3095 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3097 note = _("には効果がなかった。", " is unaffected.");
3102 /* Go to sleep (much) later */
3103 note = _("は動けなくなった!", " is suspended!");
3107 /* No "real" damage */
3116 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3117 vir = virtue_number(V_HARMONY);
3120 dam += p_ptr->virtues[vir-1]/10;
3123 vir = virtue_number(V_INDIVIDUALISM);
3126 dam -= p_ptr->virtues[vir-1]/20;
3129 if (seen) obvious = TRUE;
3131 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3133 note = _("には効果がなかった。", " is unaffected.");
3135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3139 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3142 /* Attempt a saving throw */
3143 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3144 (r_ptr->flags3 & RF3_NO_CONF) ||
3145 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3146 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3148 /* Memorize a flag */
3149 if (r_ptr->flags3 & RF3_NO_CONF)
3151 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3155 /* No obvious effect */
3156 note = _("には効果がなかった。", " is unaffected.");
3159 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3161 else if (p_ptr->cursed & TRC_AGGRAVATE)
3163 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3164 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3168 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3171 chg_virtue(V_INDIVIDUALISM, -1);
3172 if (r_ptr->flags3 & RF3_ANIMAL)
3173 chg_virtue(V_NATURE, 1);
3176 /* No "real" damage */
3181 /* Control undead */
3182 case GF_CONTROL_UNDEAD:
3185 if (seen) obvious = TRUE;
3187 vir = virtue_number(V_UNLIFE);
3190 dam += p_ptr->virtues[vir-1]/10;
3193 vir = virtue_number(V_INDIVIDUALISM);
3196 dam -= p_ptr->virtues[vir-1]/20;
3199 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3201 note = _("には効果がなかった。", " is unaffected.");
3203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3207 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3210 /* Attempt a saving throw */
3211 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3212 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3213 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3214 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3216 /* No obvious effect */
3217 note = _("には効果がなかった。", " is unaffected.");
3219 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3221 else if (p_ptr->cursed & TRC_AGGRAVATE)
3223 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3224 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3228 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3232 /* No "real" damage */
3238 case GF_CONTROL_DEMON:
3241 if (seen) obvious = TRUE;
3243 vir = virtue_number(V_UNLIFE);
3246 dam += p_ptr->virtues[vir-1]/10;
3249 vir = virtue_number(V_INDIVIDUALISM);
3252 dam -= p_ptr->virtues[vir-1]/20;
3255 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3257 note = _("には効果がなかった。", " is unaffected.");
3259 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3263 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3266 /* Attempt a saving throw */
3267 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3268 (!(r_ptr->flags3 & RF3_DEMON)) ||
3269 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3270 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3272 /* No obvious effect */
3273 note = _("には効果がなかった。", " is unaffected.");
3276 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3278 else if (p_ptr->cursed & TRC_AGGRAVATE)
3280 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3281 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3285 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3289 /* No "real" damage */
3295 case GF_CONTROL_ANIMAL:
3299 if (seen) obvious = TRUE;
3301 vir = virtue_number(V_NATURE);
3304 dam += p_ptr->virtues[vir-1]/10;
3307 vir = virtue_number(V_INDIVIDUALISM);
3310 dam -= p_ptr->virtues[vir-1]/20;
3313 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3315 note = _("には効果がなかった。", " is unaffected.");
3317 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3321 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3324 /* Attempt a saving throw */
3325 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3326 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3327 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3328 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3329 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3331 /* Memorize a flag */
3332 if (r_ptr->flags3 & (RF3_NO_CONF))
3334 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3338 /* No obvious effect */
3339 note = _("には効果がなかった。", " is unaffected.");
3342 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3344 else if (p_ptr->cursed & TRC_AGGRAVATE)
3346 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3347 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3351 note = _("はなついた。", " is tamed!");
3354 if (r_ptr->flags3 & RF3_ANIMAL)
3355 chg_virtue(V_NATURE, 1);
3358 /* No "real" damage */
3364 case GF_CONTROL_LIVING:
3368 vir = virtue_number(V_UNLIFE);
3369 if (seen) obvious = TRUE;
3371 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
3372 vir = virtue_number(V_UNLIFE);
3375 dam -= p_ptr->virtues[vir-1]/10;
3378 vir = virtue_number(V_INDIVIDUALISM);
3381 dam -= p_ptr->virtues[vir-1]/20;
3384 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
3385 if (dam < 1) dam = 1;
3386 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3387 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3389 note = _("には効果がなかった。", " is unaffected.");
3391 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3395 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3398 /* Attempt a saving throw */
3399 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3400 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3401 !monster_living(r_ptr) ||
3402 ((r_ptr->level+10) > randint1(dam)))
3405 /* No obvious effect */
3406 note = _("には効果がなかった。", " is unaffected.");
3409 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3411 else if (p_ptr->cursed & TRC_AGGRAVATE)
3413 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3414 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3418 note = _("を支配した。", " is tamed!");
3421 if (r_ptr->flags3 & RF3_ANIMAL)
3422 chg_virtue(V_NATURE, 1);
3425 /* No "real" damage */
3430 /* Confusion (Use "dam" as "power") */
3433 if (seen) obvious = TRUE;
3435 if (r_ptr->flagsr & RFR_RES_ALL)
3437 note = _("には効果がなかった。", " is unaffected.");
3439 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3442 /* Get confused later */
3443 do_conf = damroll(3, (dam / 2)) + 1;
3445 /* Attempt a saving throw */
3446 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3447 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3448 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3450 /* Memorize a flag */
3451 if (r_ptr->flags3 & (RF3_NO_CONF))
3453 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3459 /* No obvious effect */
3460 note = _("には効果がなかった。", " is unaffected.");
3464 /* No "real" damage */
3471 if (seen) obvious = TRUE;
3473 if (r_ptr->flagsr & RFR_RES_ALL)
3475 note = _("には効果がなかった。", " is unaffected.");
3477 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3480 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3482 /* Attempt a saving throw */
3483 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3484 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3489 /* No obvious effect */
3490 note = _("には効果がなかった。", " is unaffected.");
3494 /* No "real" damage */
3502 /* Lite, but only hurts susceptible creatures */
3510 if (r_ptr->flagsr & RFR_RES_ALL)
3516 if (r_ptr->flags3 & (RF3_HURT_LITE))
3518 /* Obvious effect */
3519 if (seen) obvious = TRUE;
3521 /* Memorize the effects */
3522 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3524 /* Special effect */
3525 note = _("は光に身をすくめた!", " cringes from the light!");
3526 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3529 /* Normally no damage */
3541 /* Lite -- opposite of Dark */
3544 if (seen) obvious = TRUE;
3546 if (r_ptr->flagsr & RFR_RES_ALL)
3548 note = _("には完全な耐性がある!", " is immune.");
3550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3553 if (r_ptr->flagsr & RFR_RES_LITE)
3555 note = _("には耐性がある!", " resists!");
3556 dam *= 2; dam /= (randint1(6)+6);
3557 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3559 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3562 note = _("は光に身をすくめた!", " cringes from the light!");
3563 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3570 /* Dark -- opposite of Lite */
3573 if (seen) obvious = TRUE;
3575 if (r_ptr->flagsr & RFR_RES_ALL)
3577 note = _("には完全な耐性がある!", " is immune.");
3579 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3582 if (r_ptr->flagsr & RFR_RES_DARK)
3584 note = _("には耐性がある!", " resists!");
3585 dam *= 2; dam /= (randint1(6)+6);
3586 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3595 if (r_ptr->flagsr & RFR_RES_ALL)
3600 /* Hurt by rock remover */
3601 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3604 if (seen) obvious = TRUE;
3606 /* Memorize the effects */
3607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3609 /* Cute little message */
3610 note = _("の皮膚がただれた!", " loses some skin!");
3611 note_dies = _("はドロドロに溶けた!", " dissolves!");
3614 /* Usually, ignore the effects */
3625 /* Teleport undead (Use "dam" as "power") */
3626 case GF_AWAY_UNDEAD:
3628 /* Only affect undead */
3629 if (r_ptr->flags3 & (RF3_UNDEAD))
3631 bool resists_tele = FALSE;
3633 if (r_ptr->flagsr & RFR_RES_TELE)
3635 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3637 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3638 note = _("には効果がなかった。", " is unaffected.");
3639 resists_tele = TRUE;
3641 else if (r_ptr->level > randint1(100))
3643 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3644 note = _("には耐性がある!", " resists!");
3645 resists_tele = TRUE;
3651 if (seen) obvious = TRUE;
3652 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3664 /* No "real" damage */
3670 /* Teleport evil (Use "dam" as "power") */
3673 /* Only affect evil */
3674 if (r_ptr->flags3 & (RF3_EVIL))
3676 bool resists_tele = FALSE;
3678 if (r_ptr->flagsr & RFR_RES_TELE)
3680 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3683 note = _("には効果がなかった。", " is unaffected.");
3684 resists_tele = TRUE;
3686 else if (r_ptr->level > randint1(100))
3688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3689 note = _("には耐性がある!", " resists!");
3690 resists_tele = TRUE;
3696 if (seen) obvious = TRUE;
3697 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3709 /* No "real" damage */
3715 /* Teleport monster (Use "dam" as "power") */
3718 bool resists_tele = FALSE;
3719 if (r_ptr->flagsr & RFR_RES_TELE)
3721 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3723 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3724 note = _("には効果がなかった。", " is unaffected.");
3725 resists_tele = TRUE;
3727 else if (r_ptr->level > randint1(100))
3729 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3730 note = _("には耐性がある!", " resists!");
3731 resists_tele = TRUE;
3738 if (seen) obvious = TRUE;
3740 /* Prepare to teleport */
3744 /* No "real" damage */
3750 /* Turn undead (Use "dam" as "power") */
3751 case GF_TURN_UNDEAD:
3753 if (r_ptr->flagsr & RFR_RES_ALL)
3758 /* Only affect undead */
3759 if (r_ptr->flags3 & (RF3_UNDEAD))
3762 if (seen) obvious = TRUE;
3764 /* Learn about type */
3765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3767 /* Apply some fear */
3768 do_fear = damroll(3, (dam / 2)) + 1;
3770 /* Attempt a saving throw */
3771 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3773 /* No obvious effect */
3774 note = _("には効果がなかった。", " is unaffected.");
3787 /* No "real" damage */
3793 /* Turn evil (Use "dam" as "power") */
3796 if (r_ptr->flagsr & RFR_RES_ALL)
3801 /* Only affect evil */
3802 if (r_ptr->flags3 & (RF3_EVIL))
3805 if (seen) obvious = TRUE;
3807 /* Learn about type */
3808 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3810 /* Apply some fear */
3811 do_fear = damroll(3, (dam / 2)) + 1;
3813 /* Attempt a saving throw */
3814 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3816 /* No obvious effect */
3817 note = _("には効果がなかった。", " is unaffected.");
3830 /* No "real" damage */
3836 /* Turn monster (Use "dam" as "power") */
3839 if (r_ptr->flagsr & RFR_RES_ALL)
3845 if (seen) obvious = TRUE;
3847 /* Apply some fear */
3848 do_fear = damroll(3, (dam / 2)) + 1;
3850 /* Attempt a saving throw */
3851 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3852 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3853 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3855 /* No obvious effect */
3856 note = _("には効果がなかった。", " is unaffected.");
3861 /* No "real" damage */
3868 case GF_DISP_UNDEAD:
3870 if (r_ptr->flagsr & RFR_RES_ALL)
3876 /* Only affect undead */
3877 if (r_ptr->flags3 & (RF3_UNDEAD))
3880 if (seen) obvious = TRUE;
3882 /* Learn about type */
3883 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3886 note = _("は身震いした。", " shudders.");
3887 note_dies = _("はドロドロに溶けた!", " dissolves!");
3907 if (r_ptr->flagsr & RFR_RES_ALL)
3913 /* Only affect evil */
3914 if (r_ptr->flags3 & (RF3_EVIL))
3917 if (seen) obvious = TRUE;
3919 /* Learn about type */
3920 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3923 note = _("は身震いした。", " shudders.");
3924 note_dies = _("はドロドロに溶けた!", " dissolves!");
3943 if (r_ptr->flagsr & RFR_RES_ALL)
3949 /* Only affect good */
3950 if (r_ptr->flags3 & (RF3_GOOD))
3953 if (seen) obvious = TRUE;
3955 /* Learn about type */
3956 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3959 note = _("は身震いした。", " shudders.");
3960 note_dies = _("はドロドロに溶けた!", " dissolves!");
3977 case GF_DISP_LIVING:
3979 if (r_ptr->flagsr & RFR_RES_ALL)
3985 /* Only affect non-undead */
3986 if (monster_living(r_ptr))
3989 if (seen) obvious = TRUE;
3992 note = _("は身震いした。", " shudders.");
3993 note_dies = _("はドロドロに溶けた!", " dissolves!");
4012 if (r_ptr->flagsr & RFR_RES_ALL)
4018 /* Only affect demons */
4019 if (r_ptr->flags3 & (RF3_DEMON))
4022 if (seen) obvious = TRUE;
4024 /* Learn about type */
4025 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4028 note = _("は身震いした。", " shudders.");
4029 note_dies = _("はドロドロに溶けた!", " dissolves!");
4045 /* Dispel monster */
4048 if (r_ptr->flagsr & RFR_RES_ALL)
4055 if (seen) obvious = TRUE;
4058 note = _("は身震いした。", " shudders.");
4059 note_dies = _("はドロドロに溶けた!", " dissolves!");
4066 if (seen) obvious = TRUE;
4068 if (r_ptr->flagsr & RFR_RES_ALL)
4070 note = _("には完全な耐性がある!", " is immune.");
4072 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4076 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
4080 /* Heal the monster */
4081 if (caster_ptr->hp < caster_ptr->maxhp)
4084 caster_ptr->hp += dam;
4085 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4087 /* Redraw (later) if needed */
4088 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4089 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4091 /* Special message */
4094 /* Get the monster name */
4095 monster_desc(killer, caster_ptr, 0);
4096 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4103 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4104 (void)hp_player(dam);
4109 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4118 if (seen) obvious = TRUE;
4120 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4122 if (r_ptr->flagsr & RFR_RES_ALL)
4124 note = _("には完全な耐性がある!", " is immune.");
4126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4130 /* Attempt a saving throw */
4131 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4132 (r_ptr->flags3 & RF3_NO_CONF) ||
4133 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4135 /* Memorize a flag */
4136 if (r_ptr->flags3 & (RF3_NO_CONF))
4138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4140 note = _("には効果がなかった。", " is unaffected.");
4143 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4145 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4146 note = _("には完全な耐性がある!", " is immune.");
4149 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4151 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4152 note = _("には耐性がある。", " resists.");
4157 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4158 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4160 if (who > 0) do_conf = randint0(4) + 4;
4161 else do_conf = randint0(8) + 8;
4167 case GF_BRAIN_SMASH:
4169 if (seen) obvious = TRUE;
4171 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4173 if (r_ptr->flagsr & RFR_RES_ALL)
4175 note = _("には完全な耐性がある!", " is immune.");
4177 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4181 /* Attempt a saving throw */
4182 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4183 (r_ptr->flags3 & RF3_NO_CONF) ||
4184 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4186 /* Memorize a flag */
4187 if (r_ptr->flags3 & (RF3_NO_CONF))
4189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4191 note = _("には効果がなかった。", " is unaffected.");
4194 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4197 note = _("には完全な耐性がある!", " is immune.");
4200 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4202 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4203 note = _("には耐性がある!", " resists!");
4208 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4209 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4213 do_conf = randint0(4) + 4;
4214 do_stun = randint0(4) + 4;
4218 do_conf = randint0(8) + 8;
4219 do_stun = randint0(8) + 8;
4221 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4229 if (seen) obvious = TRUE;
4231 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4233 if (r_ptr->flagsr & RFR_RES_ALL)
4235 note = _("には完全な耐性がある!", " is immune.");
4237 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4241 /* Attempt a saving throw */
4242 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4244 note = _("には効果がなかった。", " is unaffected.");
4253 if (seen) obvious = TRUE;
4255 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4257 if (r_ptr->flagsr & RFR_RES_ALL)
4259 note = _("には完全な耐性がある!", " is immune.");
4261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4265 /* Attempt a saving throw */
4266 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4268 note = _("には効果がなかった。", " is unaffected.");
4277 if (seen) obvious = TRUE;
4279 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4281 if (r_ptr->flagsr & RFR_RES_ALL)
4283 note = _("には完全な耐性がある!", " is immune.");
4285 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4289 /* Attempt a saving throw */
4290 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4292 note = _("には効果がなかった。", " is unaffected.");
4301 if (seen) obvious = TRUE;
4304 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4305 "You point at %s, screaming the word, 'DIE!'."), m_name);
4307 if (r_ptr->flagsr & RFR_RES_ALL)
4309 note = _("には完全な耐性がある!", " is immune.");
4311 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4315 /* Attempt a saving throw */
4316 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4318 note = _("には効果がなかった。", " is unaffected.");
4327 if (seen) obvious = TRUE;
4329 if (r_ptr->flagsr & RFR_RES_ALL)
4331 note = _("には完全な耐性がある!", " is immune.");
4333 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4337 if (r_ptr->flags1 & RF1_UNIQUE)
4339 note = _("には効果がなかった。", " is unaffected.");
4344 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4345 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4347 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4349 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4353 note = _("は耐性を持っている!", "resists!");
4360 /* Capture monster */
4364 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4365 (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)
4367 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4372 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4373 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4374 nokori_hp = m_ptr->maxhp * 3 / 10;
4376 nokori_hp = m_ptr->maxhp * 3 / 20;
4378 if (m_ptr->hp >= nokori_hp)
4380 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4383 else if (m_ptr->hp < randint0(nokori_hp))
4385 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4386 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4387 cap_mon = m_ptr->r_idx;
4388 cap_mspeed = m_ptr->mspeed;
4390 cap_maxhp = m_ptr->max_maxhp;
4391 cap_nickname = m_ptr->nickname; /* Quark transfer */
4392 if (c_ptr->m_idx == p_ptr->riding)
4394 if (rakuba(-1, FALSE))
4396 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4400 delete_monster_idx(c_ptr->m_idx);
4406 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4412 /* Attack (Use "dam" as attack type) */
4415 /* Return this monster's death */
4416 return py_attack(y, x, dam);
4419 /* Sleep (Use "dam" as "power") */
4425 if (seen) obvious = TRUE;
4427 if (r_ptr->flagsr & RFR_RES_ALL)
4429 note = _("には効果がなかった。", " is unaffected.");
4431 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4434 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4436 note = _("には効果がなかった。", " is unaffected.");
4439 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4442 if (MON_CSLEEP(m_ptr))
4444 note = _("には効果がなかった。", " is unaffected.");
4450 if (one_in_(5)) effect = 1;
4451 else if (one_in_(4)) effect = 2;
4452 else if (one_in_(3)) effect = 3;
4457 /* Powerful monsters can resist */
4458 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4459 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4461 note = _("には効果がなかった。", " is unaffected.");
4465 /* Normal monsters slow down */
4468 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4470 note = _("の動きが遅くなった。", " starts moving slower.");
4475 else if (effect == 2)
4477 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4479 /* Attempt a saving throw */
4480 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4481 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4486 /* No obvious effect */
4487 note = _("には効果がなかった。", " is unaffected.");
4492 else if (effect == 3)
4494 /* Attempt a saving throw */
4495 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4496 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4497 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4499 /* Memorize a flag */
4500 if (r_ptr->flags3 & RF3_NO_SLEEP)
4502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4505 /* No obvious effect */
4506 note = _("には効果がなかった。", " is unaffected.");
4511 /* Go to sleep (much) later */
4512 note = _("は眠り込んでしまった!", " falls asleep!");
4519 note = _("には効果がなかった。", " is unaffected.");
4522 /* No "real" damage */
4530 if (seen) obvious = TRUE;
4532 if (r_ptr->flagsr & RFR_RES_ALL)
4534 note = _("には効果がなかった。", " is unaffected.");
4536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4540 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4542 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4543 chg_virtue(V_VITALITY, -1);
4553 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4555 if (r_ptr->flags3 & (RF3_HURT_LITE))
4557 /* Obvious effect */
4558 if (seen) obvious = TRUE;
4560 /* Memorize the effects */
4561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4563 /* Special effect */
4564 note = _("は光に身をすくめた!", " cringes from the light!");
4565 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4568 /* Normally no damage */
4575 photo = m_ptr->r_idx;
4582 case GF_BLOOD_CURSE:
4584 if (seen) obvious = TRUE;
4586 if (r_ptr->flagsr & RFR_RES_ALL)
4588 note = _("には完全な耐性がある!", " is immune.");
4590 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4598 bool success = FALSE;
4599 if (seen) obvious = TRUE;
4601 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4603 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4604 if (dam < 1) dam = 1;
4606 /* No need to tame your pet */
4609 note = _("の動きが速くなった。", " starts moving faster.");
4610 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4614 /* Attempt a saving throw */
4615 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4616 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4617 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4618 (p_ptr->cursed & TRC_AGGRAVATE) ||
4619 ((r_ptr->level+10) > randint1(dam)))
4622 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4626 note = _("を支配した。", " is tamed!");
4628 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4630 /* Learn about type */
4631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4638 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4640 do_fear = randint1(90)+10;
4642 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4645 /* No "real" damage */
4652 if (seen) obvious = TRUE;
4654 if (r_ptr->flagsr & RFR_RES_ALL)
4656 note = _("には完全な耐性がある!", " is immune.");
4658 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4662 /* Attempt a saving throw */
4663 if (randint0(100 + dam) < (r_ptr->level + 50))
4665 note = _("には効果がなかった。", " is unaffected.");
4685 /* Absolutely no effect */
4686 if (skipped) return (FALSE);
4688 /* "Unique" monsters cannot be polymorphed */
4689 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4691 /* Quest monsters cannot be polymorphed */
4692 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4694 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4696 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4697 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4699 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4704 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4705 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4708 /* Modify the damage */
4710 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4711 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4713 /* Check for death */
4714 if (dam > m_ptr->hp)
4716 /* Extract method of death */
4721 /* Sound and Impact resisters never stun */
4723 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4724 !(r_ptr->flags3 & RF3_NO_STUN))
4727 if (seen) obvious = TRUE;
4730 if (MON_STUNNED(m_ptr))
4732 note = _("はひどくもうろうとした。", " is more dazed.");
4733 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4737 note = _("はもうろうとした。", " is dazed.");
4742 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4748 /* Confusion and Chaos resisters (and sleepers) never confuse */
4750 !(r_ptr->flags3 & RF3_NO_CONF) &&
4751 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4754 if (seen) obvious = TRUE;
4756 /* Already partially confused */
4757 if (MON_CONFUSED(m_ptr))
4759 note = _("はさらに混乱したようだ。", " looks more confused.");
4760 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4763 /* Was not confused */
4766 note = _("は混乱したようだ。", " looks confused.");
4770 /* Apply confusion */
4771 (void)set_monster_confused(c_ptr->m_idx, tmp);
4780 if (seen) obvious = TRUE;
4782 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4786 note = _("は弱くなったようだ。", " seems weakened.");
4787 m_ptr->maxhp -= do_time;
4788 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4793 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4794 if (do_poly && (randint1(90) > r_ptr->level))
4796 if (polymorph_monster(y, x))
4799 if (seen) obvious = TRUE;
4801 /* Monster polymorphs */
4802 note = _("が変身した!", " changes!");
4804 /* Turn off the damage */
4810 note = _("には効果がなかった。", " is unaffected.");
4813 /* Hack -- Get new monster */
4814 m_ptr = &m_list[c_ptr->m_idx];
4816 /* Hack -- Get new race */
4817 r_ptr = &r_info[m_ptr->r_idx];
4820 /* Handle "teleport" */
4824 if (seen) obvious = TRUE;
4827 note = _("が消え去った!", " disappears!");
4829 if (!who) chg_virtue(V_VALOUR, -1);
4832 teleport_away(c_ptr->m_idx, do_dist,
4833 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4835 /* Hack -- get new location */
4839 /* Hack -- get new grid */
4840 c_ptr = &cave[y][x];
4847 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4854 if (typ == GF_DRAIN_MANA)
4856 /* Drain mana does nothing */
4859 /* If another monster did the damage, hurt the monster by hand */
4862 /* Redraw (later) if needed */
4863 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4864 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4866 /* Wake the monster up */
4867 (void)set_monster_csleep(c_ptr->m_idx, 0);
4869 /* Hurt the monster */
4877 if (is_pet(m_ptr) && !(m_ptr->ml))
4880 /* Give detailed messages if destroyed */
4883 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4886 msg_format("%^s%s", m_name, note);
4894 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4896 /* Generate treasure, etc */
4897 monster_death(c_ptr->m_idx, FALSE);
4899 /* Delete the monster */
4900 delete_monster_idx(c_ptr->m_idx);
4904 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4908 /* Damaged monster */
4911 /* Give detailed messages if visible or destroyed */
4912 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4914 /* Hack -- Pain message */
4917 message_pain(c_ptr->m_idx, dam);
4924 /* Hack -- handle sleep */
4925 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4929 else if (heal_leper)
4931 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4933 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4937 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4938 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4941 delete_monster_idx(c_ptr->m_idx);
4944 /* If the player did it, give him experience, check fear */
4949 /* Hurt the monster, check for fear and death */
4950 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4955 /* Damaged monster */
4958 /* HACK - anger the monster before showing the sleep message */
4959 if (do_sleep) anger_monster(m_ptr);
4961 /* Give detailed messages if visible or destroyed */
4962 if (note && seen_msg)
4963 msg_format(_("%s%s", "%^s%s"), m_name, note);
4965 /* Hack -- Pain message */
4966 else if (known && (dam || !do_fear))
4968 message_pain(c_ptr->m_idx, dam);
4971 /* Anger monsters */
4972 if (((dam > 0) || get_angry) && !do_sleep)
4973 anger_monster(m_ptr);
4976 if ((fear || do_fear) && seen)
4982 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4985 /* Hack -- handle sleep */
4986 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4990 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4992 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4996 switch (randint1(28))
5001 msg_print(_("地面が揺れた...", "The ground trembles..."));
5002 earthquake(ty, tx, 4 + randint0(4));
5003 if (!one_in_(6)) break;
5005 case 3: case 4: case 5: case 6:
5008 int extra_dam = damroll(10, 10);
5009 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
5011 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
5012 if (!one_in_(6)) break;
5017 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5019 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5020 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5021 if (!one_in_(6)) break;
5023 case 9: case 10: case 11:
5024 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5025 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5026 if (!one_in_(6)) break;
5027 case 12: case 13: case 14: case 15: case 16:
5028 aggravate_monsters(0);
5029 if (!one_in_(6)) break;
5031 count += activate_hi_summon(ty, tx, TRUE);
5032 if (!one_in_(6)) break;
5033 case 19: case 20: case 21: case 22:
5035 bool pet = !one_in_(3);
5036 u32b mode = PM_ALLOW_GROUP;
5038 if (pet) mode |= PM_FORCE_PET;
5039 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5041 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
5042 if (!one_in_(6)) break;
5044 case 23: case 24: case 25:
5045 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5046 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5048 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5049 else lose_exp(p_ptr->exp / 16);
5050 if (!one_in_(6)) break;
5051 case 26: case 27: case 28:
5060 (void)do_dec_stat(i);
5069 (void)do_dec_stat(randint0(6));
5078 if (p_ptr->inside_battle)
5080 p_ptr->health_who = c_ptr->m_idx;
5081 p_ptr->redraw |= (PR_HEALTH);
5085 /* XXX XXX XXX Verify this code */
5087 /* Update the monster */
5088 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5090 /* Redraw the monster grid */
5094 /* Update monster recall window */
5095 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5098 p_ptr->window |= (PW_MONSTER);
5101 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5105 if (!(flg & PROJECT_NO_HANGEKI))
5107 set_target(m_ptr, monster_target_y, monster_target_x);
5110 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5112 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5116 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5118 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5119 rakubadam_m = (dam > 200) ? 200 : dam;
5128 /* Get local object */
5131 /* Prepare to make a Blade of Chaos */
5132 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5134 q_ptr->pval = photo;
5136 /* Mark the item as fully known */
5137 q_ptr->ident |= (IDENT_MENTAL);
5139 /* Drop it in the dungeon */
5140 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
5148 /* Return "Anything seen?" */
5153 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5154 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5155 * @param who_name 効果を起こしたモンスターの名前
5156 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5157 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5158 * @param x 目標X座標 / Target x location (or location to travel "towards")
5159 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5160 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5162 * @param monspell 効果元のモンスター魔法ID
5163 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5165 * Handle a beam/bolt/ball causing damage to the player.
5166 * This routine takes a "source monster" (by index), a "distance", a default
5167 * "damage", and a "damage type". See "project_m()" above.
5168 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5169 * is reduced (see "project_m()" above). This can happen if a monster breathes
5170 * at the player and hits a wall instead.
5171 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5172 * to know if this is actually a ball or a bolt spell
5173 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5174 * we just assume that the effects were obvious, for historical reasons.
5176 static bool project_p(int who, cptr who_name, int r, POSITION y, POSITION x, int dam, int typ, int flg, int monspell)
5181 /* Hack -- assume obvious */
5182 bool obvious = TRUE;
5184 /* Player blind-ness */
5185 bool blind = (p_ptr->blind ? TRUE : FALSE);
5187 /* Player needs a "description" (he is blind) */
5190 /* Source monster */
5191 monster_type *m_ptr = NULL;
5193 /* Monster name (for attacks) */
5196 /* Monster name (for damage) */
5199 /* Hack -- messages */
5205 /* Player is not here */
5206 if (!player_bold(y, x)) return (FALSE);
5208 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5210 if (kawarimi(TRUE)) return FALSE;
5213 /* Player cannot hurt himself */
5214 if (!who) return (FALSE);
5215 if (who == p_ptr->riding) return (FALSE);
5217 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5220 int max_attempts = 10;
5223 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5224 else if (p_ptr->special_defense & KATA_FUUJIN)
5225 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5227 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5230 /* Choose 'new' target */
5235 t_y = m_list[who].fy - 1 + randint1(3);
5236 t_x = m_list[who].fx - 1 + randint1(3);
5239 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
5241 if (max_attempts < 1)
5243 t_y = m_list[who].fy;
5244 t_x = m_list[who].fx;
5249 t_y = p_ptr->y - 1 + randint1(3);
5250 t_x = p_ptr->x - 1 + randint1(3);
5253 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5260 /* Limit maximum damage */
5261 if (dam > 1600) dam = 1600;
5263 /* Reduce damage by distance */
5264 dam = (dam + r) / (r + 1);
5267 /* If the player is blind, be more descriptive */
5268 if (blind) fuzzy = TRUE;
5273 /* Get the source monster */
5274 m_ptr = &m_list[who];
5275 /* Extract the monster level */
5276 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5278 /* Get the monster name */
5279 monster_desc(m_name, m_ptr, 0);
5281 /* Get the monster's real name (gotten before polymorph!) */
5282 strcpy(killer, who_name);
5288 case PROJECT_WHO_UNCTRL_POWER:
5289 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5292 case PROJECT_WHO_GLASS_SHARDS:
5293 strcpy(killer, _("ガラスの破片", "shards of glass"));
5297 strcpy(killer, _("罠", "a trap"));
5302 strcpy(m_name, killer);
5305 /* Analyze the damage */
5308 /* Standard damage -- hurts inventory too */
5311 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5312 get_damage = acid_dam(dam, killer, monspell, FALSE);
5316 /* Standard damage -- hurts inventory too */
5319 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5320 get_damage = fire_dam(dam, killer, monspell, FALSE);
5324 /* Standard damage -- hurts inventory too */
5327 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5328 get_damage = cold_dam(dam, killer, monspell, FALSE);
5332 /* Standard damage -- hurts inventory too */
5335 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5336 get_damage = elec_dam(dam, killer, monspell, FALSE);
5340 /* Standard damage -- also poisons player */
5343 bool double_resist = IS_OPPOSE_POIS();
5344 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5346 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5347 if (double_resist) dam = (dam + 2) / 3;
5349 if ((!(double_resist || p_ptr->resist_pois)) &&
5350 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5355 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5357 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5359 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5364 /* Standard damage -- also poisons / mutates player */
5367 bool double_resist = IS_OPPOSE_POIS();
5368 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5370 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5371 if (double_resist) dam = (2 * dam + 2) / 5;
5372 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5373 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5375 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5377 if (one_in_(5)) /* 6 */
5379 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5380 if (one_in_(4)) /* 4 */
5388 inven_damage(set_acid_destroy, 2);
5394 /* Standard damage */
5397 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5398 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5402 /* Holy Orb -- Player only takes partial damage */
5405 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5406 if (p_ptr->align > 10)
5408 else if (p_ptr->align < -10)
5410 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5416 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5417 if (p_ptr->align > 10)
5419 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5423 /* Arrow -- XXX no dodging */
5428 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5430 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5432 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5435 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5439 /* Plasma -- XXX No resist */
5442 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5443 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5445 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5447 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5448 (void)set_stun(p_ptr->stun + plus_stun);
5451 if (!(p_ptr->resist_fire ||
5453 p_ptr->immune_fire))
5455 inven_damage(set_acid_destroy, 3);
5461 /* Nether -- drain experience */
5464 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5465 if (p_ptr->resist_neth)
5467 if (!prace_is_(RACE_SPECTRE))
5469 dam *= 6; dam /= (randint1(4) + 7);
5472 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
5474 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
5476 msg_print(_("気分がよくなった。", "You feel invigorated!"));
5478 learn_spell(monspell);
5482 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5488 /* Water -- stun/confuse */
5491 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
5492 if (!CHECK_MULTISHADOW())
5494 if (!p_ptr->resist_sound)
5496 set_stun(p_ptr->stun + randint1(40));
5498 if (!p_ptr->resist_conf)
5500 set_confused(p_ptr->confused + randint1(5) + 5);
5505 inven_damage(set_cold_destroy, 3);
5509 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5513 /* Chaos -- many effects */
5516 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5517 if (p_ptr->resist_chaos)
5519 dam *= 6; dam /= (randint1(4) + 7);
5522 if (!CHECK_MULTISHADOW())
5524 if (!p_ptr->resist_conf)
5526 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5528 if (!p_ptr->resist_chaos)
5530 (void)set_image(p_ptr->image + randint1(10));
5533 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5534 (void)gain_random_mutation(0);
5537 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5539 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5542 if (!p_ptr->resist_chaos || one_in_(9))
5544 inven_damage(set_elec_destroy, 2);
5545 inven_damage(set_fire_destroy, 2);
5549 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5553 /* Shards -- mostly cutting */
5556 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5557 if (p_ptr->resist_shard)
5559 dam *= 6; dam /= (randint1(4) + 7);
5561 else if (!CHECK_MULTISHADOW())
5563 (void)set_cut(p_ptr->cut + dam);
5566 if (!p_ptr->resist_shard || one_in_(13))
5568 inven_damage(set_cold_destroy, 2);
5571 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5575 /* Sound -- mostly stunning */
5578 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5579 if (p_ptr->resist_sound)
5581 dam *= 5; dam /= (randint1(4) + 7);
5583 else if (!CHECK_MULTISHADOW())
5585 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5586 (void)set_stun(p_ptr->stun + plus_stun);
5589 if (!p_ptr->resist_sound || one_in_(13))
5591 inven_damage(set_cold_destroy, 2);
5594 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5598 /* Pure confusion */
5601 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5602 if (p_ptr->resist_conf)
5604 dam *= 5; dam /= (randint1(4) + 7);
5606 else if (!CHECK_MULTISHADOW())
5608 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5610 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5614 /* Disenchantment -- see above */
5617 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5618 if (p_ptr->resist_disen)
5620 dam *= 6; dam /= (randint1(4) + 7);
5622 else if (!CHECK_MULTISHADOW())
5624 (void)apply_disenchant(0);
5626 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5630 /* Nexus -- see above */
5633 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5634 if (p_ptr->resist_nexus)
5636 dam *= 6; dam /= (randint1(4) + 7);
5638 else if (!CHECK_MULTISHADOW())
5642 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5646 /* Force -- mostly stun */
5649 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5650 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5652 (void)set_stun(p_ptr->stun + randint1(20));
5654 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5659 /* Rocket -- stun, cut */
5662 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5663 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5665 (void)set_stun(p_ptr->stun + randint1(20));
5668 if (p_ptr->resist_shard)
5672 else if (!CHECK_MULTISHADOW())
5674 (void)set_cut(p_ptr->cut + (dam / 2));
5677 if (!p_ptr->resist_shard || one_in_(12))
5679 inven_damage(set_cold_destroy, 3);
5682 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5686 /* Inertia -- slowness */
5689 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5690 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5691 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5695 /* Lite -- blinding */
5698 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5699 if (p_ptr->resist_lite)
5701 dam *= 4; dam /= (randint1(4) + 7);
5703 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5705 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5708 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5710 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5713 else if (prace_is_(RACE_S_FAIRY))
5718 if (p_ptr->wraith_form) dam *= 2;
5719 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5721 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5723 p_ptr->wraith_form = 0;
5724 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5725 "The light forces you out of your incorporeal shadow form."));
5727 p_ptr->redraw |= PR_MAP;
5728 /* Update monsters */
5729 p_ptr->update |= (PU_MONSTERS);
5731 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5733 /* Redraw status bar */
5734 p_ptr->redraw |= (PR_STATUS);
5741 /* Dark -- blinding */
5744 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5745 if (p_ptr->resist_dark)
5747 dam *= 4; dam /= (randint1(4) + 7);
5749 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5751 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5753 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5755 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5759 /* Time -- bolt fewer effects XXX */
5762 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5763 if (p_ptr->resist_time)
5766 dam /= (randint1(4) + 7);
5767 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5769 else if (!CHECK_MULTISHADOW())
5771 switch (randint1(10))
5773 case 1: case 2: case 3: case 4: case 5:
5775 if (p_ptr->prace == RACE_ANDROID) break;
5776 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5777 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5781 case 6: case 7: case 8: case 9:
5783 switch (randint1(6))
5785 case 1: k = A_STR; act = _("強く", "strong"); break;
5786 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5787 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5788 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5789 case 5: k = A_CON; act = _("健康で", "hale"); break;
5790 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5793 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5794 "You're not as %s as you used to be..."), act);
5796 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5797 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5798 p_ptr->update |= (PU_BONUS);
5804 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5805 "You're not as powerful as you used to be..."));
5807 for (k = 0; k < 6; k++)
5809 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5810 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5812 p_ptr->update |= (PU_BONUS);
5818 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5822 /* Gravity -- stun plus slowness plus teleport */
5825 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5826 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5828 if (!CHECK_MULTISHADOW())
5830 teleport_player(5, TELEPORT_PASSIVE);
5831 if (!p_ptr->levitation)
5832 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5833 if (!(p_ptr->resist_sound || p_ptr->levitation))
5835 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5836 (void)set_stun(p_ptr->stun + plus_stun);
5839 if (p_ptr->levitation)
5841 dam = (dam * 2) / 3;
5844 if (!p_ptr->levitation || one_in_(13))
5846 inven_damage(set_cold_destroy, 2);
5849 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5853 /* Standard damage */
5854 case GF_DISINTEGRATE:
5856 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5858 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5864 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5866 (void)hp_player(dam);
5873 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5874 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5881 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5882 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5888 if (p_ptr->free_act) break;
5889 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5891 if (ironman_nightmare)
5893 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5894 /* Have some nightmares */
5895 sanity_blast(NULL, FALSE);
5898 set_paralyzed(p_ptr->paralyzed + dam);
5908 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5909 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5916 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5917 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5924 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5926 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5927 if (!p_ptr->resist_shard || one_in_(13))
5929 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5930 inven_damage(set_cold_destroy, 2);
5936 /* Ice -- cold plus stun plus cuts */
5939 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5940 get_damage = cold_dam(dam, killer, monspell, FALSE);
5941 if (!CHECK_MULTISHADOW())
5943 if (!p_ptr->resist_shard)
5945 (void)set_cut(p_ptr->cut + damroll(5, 8));
5947 if (!p_ptr->resist_sound)
5949 (void)set_stun(p_ptr->stun + randint1(15));
5952 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5954 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5964 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5966 if (p_ptr->mimic_form)
5968 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5969 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5974 switch (p_ptr->prace)
5976 /* Some races are immune */
5990 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6002 if (CHECK_MULTISHADOW())
6004 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
6006 else if (p_ptr->csp)
6010 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6012 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6015 if (dam >= p_ptr->csp)
6019 p_ptr->csp_frac = 0;
6028 learn_spell(monspell);
6031 p_ptr->redraw |= (PR_MANA);
6034 p_ptr->window |= (PW_PLAYER);
6035 p_ptr->window |= (PW_SPELL);
6039 /* Heal the monster */
6040 if (m_ptr->hp < m_ptr->maxhp)
6044 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6046 /* Redraw (later) if needed */
6047 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6048 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6050 /* Special message */
6053 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6066 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6068 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6069 learn_spell(monspell);
6073 if (!CHECK_MULTISHADOW())
6075 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6077 if (!p_ptr->resist_conf)
6079 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6082 if (!p_ptr->resist_chaos && one_in_(3))
6084 (void)set_image(p_ptr->image + randint0(250) + 150);
6091 p_ptr->csp_frac = 0;
6093 p_ptr->redraw |= PR_MANA;
6096 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6102 case GF_BRAIN_SMASH:
6104 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6106 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6107 learn_spell(monspell);
6111 if (!CHECK_MULTISHADOW())
6113 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6119 p_ptr->csp_frac = 0;
6121 p_ptr->redraw |= PR_MANA;
6124 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6125 if (!CHECK_MULTISHADOW())
6127 if (!p_ptr->resist_blind)
6129 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6131 if (!p_ptr->resist_conf)
6133 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6135 if (!p_ptr->free_act)
6137 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6139 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6141 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6142 (void)do_dec_stat(A_INT);
6143 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6144 (void)do_dec_stat(A_WIS);
6146 if (!p_ptr->resist_chaos)
6148 (void)set_image(p_ptr->image + randint0(250) + 150);
6158 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6160 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6161 learn_spell(monspell);
6165 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6166 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6174 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6176 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6177 learn_spell(monspell);
6181 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6182 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6190 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6192 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6193 learn_spell(monspell);
6197 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6198 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6206 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6208 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6209 learn_spell(monspell);
6213 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6214 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6222 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6224 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6225 learn_spell(monspell);
6229 if (!CHECK_MULTISHADOW())
6231 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6232 curse_equipment(40, 20);
6235 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6237 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6252 /* Hex - revenge damage stored */
6253 revenge_store(get_damage);
6255 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6256 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6258 char m_name_self[80];
6261 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6263 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6264 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6265 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6268 if (p_ptr->riding && dam > 0)
6270 rakubadam_p = (dam > 200) ? 200 : dam;
6278 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6280 (void)kawarimi(FALSE);
6283 /* Return "Anything seen?" */
6289 * Find the distance from (x, y) to a line.
6291 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
6293 /* Vector from (x, y) to (x1, y1) */
6302 int pd = distance(y1, x1, y, x);
6303 int nd = distance(y1, x1, y2, x2);
6305 if (pd > nd) return distance(y, x, y2, x2);
6307 /* Component of P on N */
6308 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6310 /* Absolute value */
6311 return((nd >= 0) ? nd : 0 - nd);
6318 * Modified version of los() for calculation of disintegration balls.
6319 * Disintegration effects are stopped by permanent walls.
6321 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
6341 /* Slope, or 1/Slope, of LOS */
6345 /* Extract the offset */
6349 /* Extract the absolute offset */
6354 /* Handle adjacent (or identical) grids */
6355 if ((ax < 2) && (ay < 2)) return (TRUE);
6358 /* Paranoia -- require "safe" origin */
6359 /* if (!in_bounds(y1, x1)) return (FALSE); */
6362 /* Directly South/North */
6365 /* South -- check for walls */
6368 for (ty = y1 + 1; ty < y2; ty++)
6370 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6374 /* North -- check for walls */
6377 for (ty = y1 - 1; ty > y2; ty--)
6379 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6387 /* Directly East/West */
6390 /* East -- check for walls */
6393 for (tx = x1 + 1; tx < x2; tx++)
6395 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6399 /* West -- check for walls */
6402 for (tx = x1 - 1; tx > x2; tx--)
6404 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6413 /* Extract some signs */
6414 sx = (dx < 0) ? -1 : 1;
6415 sy = (dy < 0) ? -1 : 1;
6418 /* Vertical "knights" */
6423 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6427 /* Horizontal "knights" */
6432 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6437 /* Calculate scale factor div 2 */
6440 /* Calculate scale factor */
6444 /* Travel horizontally */
6447 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6453 /* Consider the special case where slope == 1. */
6464 /* Note (below) the case (qy == f2), where */
6465 /* the LOS exactly meets the corner of a tile. */
6468 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6479 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6492 /* Travel vertically */
6495 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6511 /* Note (below) the case (qx == f2), where */
6512 /* the LOS exactly meets the corner of a tile. */
6515 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6526 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6547 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)
6552 int brev = rad * rad / dist;
6556 int mdis = distance(y1, x1, y2, x2) + rad;
6558 while (bdis <= mdis)
6562 if ((0 < dist) && (path_n < dist))
6564 int ny = GRID_Y(path_g[path_n]);
6565 int nx = GRID_X(path_g[path_n]);
6566 int nd = distance(ny, nx, y1, x1);
6568 /* Get next base point */
6577 /* Travel from center outward */
6578 for (cdis = 0; cdis <= brad; cdis++)
6580 /* Scan the maximal blast area of radius "cdis" */
6581 for (y = by - cdis; y <= by + cdis; y++)
6583 for (x = bx - cdis; x <= bx + cdis; x++)
6585 /* Ignore "illegal" locations */
6586 if (!in_bounds(y, x)) continue;
6588 /* Enforce a circular "ripple" */
6589 if (distance(y1, x1, y, x) != bdis) continue;
6591 /* Enforce an arc */
6592 if (distance(by, bx, y, x) != cdis) continue;
6598 /* Lights are stopped by opaque terrains */
6599 if (!los(by, bx, y, x)) continue;
6601 case GF_DISINTEGRATE:
6602 /* Disintegration are stopped only by perma-walls */
6603 if (!in_disintegration_range(by, bx, y, x)) continue;
6606 /* Ball explosions are stopped by walls */
6607 if (!projectable(by, bx, y, x)) continue;
6611 /* Save this grid */
6619 /* Encode some more "radius" info */
6620 gm[bdis + 1] = *pgrids;
6622 /* Increase the size */
6623 brad = rad * (path_n + brev) / (dist + brev);
6625 /* Find the next ripple */
6629 /* Store the effect size */
6635 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6636 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6637 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6638 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6639 * @param x 目標X座標 / Target x location (or location to travel "towards")
6640 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6641 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6642 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6643 * @param monspell 効果元のモンスター魔法ID
6644 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6647 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6648 * towards a given location (optionally passing over the heads of interposing
6649 * monsters), and have it do a given amount of damage to the monsters (and
6650 * optionally objects) within the given radius of the final location.
6652 * A "bolt" travels from source to target and affects only the target grid.
6653 * A "beam" travels from source to target, affecting all grids passed through.
6654 * A "ball" travels from source to the target, exploding at the target, and
6655 * affecting everything within the given radius of the target location.
6657 * Traditionally, a "bolt" does not affect anything on the ground, and does
6658 * not pass over the heads of interposing monsters, much like a traditional
6659 * missile, and will "stop" abruptly at the "target" even if no monster is
6660 * positioned there, while a "ball", on the other hand, passes over the heads
6661 * of monsters between the source and target, and affects everything except
6662 * the source monster which lies within the final radius, while a "beam"
6663 * affects every monster between the source and target, except for the casting
6664 * monster (or player), and rarely affects things on the ground.
6666 * Two special flags allow us to use this function in special ways, the
6667 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6668 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6669 * actually projecting from the source monster (or player).
6671 * The player will only get "experience" for monsters killed by himself
6672 * Unique monsters can only be destroyed by attacks from the player
6674 * Only 256 grids can be affected per projection, limiting the effective
6675 * "radius" of standard ball attacks to nine units (diameter nineteen).
6677 * One can project in a given "direction" by combining PROJECT_THRU with small
6678 * offsets to the initial location (see "line_spell()"), or by calculating
6679 * "virtual targets" far away from the player.
6681 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6682 * continuing until it actually hits somethings (useful for "stone to mud").
6684 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6686 * Balls must explode BEFORE hitting walls, or they would affect monsters
6687 * on both sides of a wall. Some bug reports indicate that this is still
6688 * happening in 2.7.8 for Windows, though it appears to be impossible.
6690 * We "pre-calculate" the blast area only in part for efficiency.
6691 * More importantly, this lets us do "explosions" from the "inside" out.
6692 * This results in a more logical distribution of "blast" treasure.
6693 * It also produces a better (in my opinion) animation of the explosion.
6694 * It could be (but is not) used to have the treasure dropped by monsters
6695 * in the middle of the explosion fall "outwards", and then be damaged by
6696 * the blast as it spreads outwards towards the treasure drop location.
6698 * Walls and doors are included in the blast area, so that they can be
6699 * "burned" or "melted" in later versions.
6701 * This algorithm is intended to maximize simplicity, not necessarily
6702 * efficiency, since this function is not a bottleneck in the code.
6704 * We apply the blast effect from ground zero outwards, in several passes,
6705 * first affecting features, then objects, then monsters, then the player.
6706 * This allows walls to be removed before checking the object or monster
6707 * in the wall, and protects objects which are dropped by monsters killed
6708 * in the blast, and allows the player to see all affects before he is
6709 * killed or teleported away. The semantics of this method are open to
6710 * various interpretations, but they seem to work well in practice.
6712 * We process the blast area from ground-zero outwards to allow for better
6713 * distribution of treasure dropped by monsters, and because it provides a
6714 * pleasing visual effect at low cost.
6716 * Note that the damage done by "ball" explosions decreases with distance.
6717 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6719 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6720 * the target, and then the damage "flows" along this beam of destruction.
6721 * The damage at every grid is the same as at the "center" of a "ball"
6722 * explosion, since the "beam" grids are treated as if they ARE at the
6723 * center of a "ball" explosion.
6725 * Currently, specifying "beam" plus "ball" means that locations which are
6726 * covered by the initial "beam", and also covered by the final "ball", except
6727 * for the final grid (the epicenter of the ball), will be "hit twice", once
6728 * by the initial beam, and once by the exploding ball. For the grid right
6729 * next to the epicenter, this results in 150% damage being done. The center
6730 * does not have this problem, for the same reason the final grid in a "beam"
6731 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6732 * grids which are covered by the "ball" will NOT work, as then they will
6733 * receive LESS damage than they should. Do not combine "beam" with "ball".
6735 * The array "gy[],gx[]" with current size "grids" is used to hold the
6736 * collected locations of all grids in the "blast area" plus "beam path".
6738 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6739 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6740 * first blast grid (see above) with radius "N" from the blast center. Note
6741 * that only the first gm[1] grids in the blast area thus take full damage.
6742 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6743 * number of blast grids.
6745 * Note that once the projection is complete, (y2,x2) holds the final location
6746 * of bolts/beams, and the "epicenter" of balls.
6748 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6749 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6750 * implementation of the "distance" function. Also, a bolt can be properly
6751 * viewed as a "ball" with a "rad" of "zero".
6753 * Note that if no "target" is reached before the beam/bolt/ball travels the
6754 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6755 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6757 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6758 * to move from point A to point B, even if the player cannot see part of the
6759 * projection path. Note that in general, the player will *always* see part
6760 * of the path, since it either starts at the player or ends on the player.
6762 * Hack -- we assume that every "projection" is "self-illuminating".
6764 * Hack -- when only a single monster is affected, we automatically track
6765 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6767 * Note that all projections now "explode" at their final destination, even
6768 * if they were being projected at a more distant destination. This means
6769 * that "ball" spells will *always* explode.
6771 * Note that we must call "handle_stuff()" after affecting terrain features
6772 * in the blast radius, in case the "illumination" of the grid was changed,
6773 * and "update_view()" and "update_monsters()" need to be called.
6776 bool project(int who, int rad, int y, int x, HIT_POINT dam, int typ, int flg, int monspell)
6786 int y_saver, x_saver; /* For reflecting monsters */
6788 int msec = delay_factor * delay_factor * delay_factor;
6790 /* Assume the player sees nothing */
6791 bool notice = FALSE;
6793 /* Assume the player has seen nothing */
6794 bool visual = FALSE;
6796 /* Assume the player has seen no blast grids */
6799 /* Assume to be a normal ball spell */
6800 bool breath = FALSE;
6802 /* Is the player blind? */
6803 bool blind = (p_ptr->blind ? TRUE : FALSE);
6805 bool old_hide = FALSE;
6807 /* Number of grids in the "path" */
6810 /* Actual grids in the "path" */
6813 /* Number of grids in the "blast area" (including the "beam" path) */
6816 /* Coordinates of the affected grids */
6817 byte gx[1024], gy[1024];
6819 /* Encoded "radius" info (see above) */
6822 /* Actual radius encoded in gm[] */
6827 /* Attacker's name (prepared before polymorph)*/
6830 /* Can the player see the source of this effect? */
6831 bool see_s_msg = TRUE;
6833 /* Initialize by null string */
6839 /* Default target of monsterspell is player */
6840 monster_target_y=p_ptr->y;
6841 monster_target_x=p_ptr->x;
6843 /* Hack -- Jump to target */
6844 if (flg & (PROJECT_JUMP))
6849 /* Clear the flag */
6850 flg &= ~(PROJECT_JUMP);
6855 /* Start at player */
6862 /* Start at monster */
6865 x1 = m_list[who].fx;
6866 y1 = m_list[who].fy;
6867 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6880 /* Default "destination" */
6885 /* Hack -- verify stuff */
6886 if (flg & (PROJECT_THRU))
6888 if ((x1 == x2) && (y1 == y2))
6890 flg &= ~(PROJECT_THRU);
6894 /* Handle a breath attack */
6899 if (flg & PROJECT_HIDE) old_hide = TRUE;
6900 flg |= PROJECT_HIDE;
6904 /* Hack -- Assume there will be no blast (max radius 32) */
6905 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6913 /* Collect beam grids */
6914 if (flg & (PROJECT_BEAM))
6925 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6927 case GF_DISINTEGRATE:
6928 flg |= (PROJECT_GRID);
6929 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6933 /* Calculate the projection path */
6935 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6937 /* Hack -- Handle stuff */
6940 /* Giga-Hack SEEKER & SUPER_RAY */
6942 if( typ == GF_SEEKER )
6952 for (i = 0; i < path_n; ++i)
6957 int ny = GRID_Y(path_g[i]);
6958 int nx = GRID_X(path_g[i]);
6969 /* Only do visuals if requested */
6970 if (!blind && !(flg & (PROJECT_HIDE)))
6972 /* Only do visuals if the player can "see" the bolt */
6973 if (panel_contains(y, x) && player_has_los_bold(y, x))
6980 /* Obtain the bolt pict */
6981 p = bolt_pict(oy, ox, y, x, typ);
6983 /* Extract attr/char */
6987 /* Visual effects */
6988 print_rel(c, a, y, x);
6989 move_cursor_relative(y, x);
6990 /*if (fresh_before)*/ Term_fresh();
6991 Term_xtra(TERM_XTRA_DELAY, msec);
6993 /*if (fresh_before)*/ Term_fresh();
6995 /* Display "beam" grids */
6996 if (flg & (PROJECT_BEAM))
6998 /* Obtain the explosion pict */
6999 p = bolt_pict(y, x, y, x, typ);
7001 /* Extract attr/char */
7005 /* Visual effects */
7006 print_rel(c, a, y, x);
7009 /* Hack -- Activate delay */
7013 /* Hack -- delay anyway for consistency */
7016 /* Delay for consistency */
7017 Term_xtra(TERM_XTRA_DELAY, msec);
7020 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7021 if( is_mirror_grid(&cave[y][x]))
7023 /* The target of monsterspell becomes tha mirror(broken) */
7024 monster_target_y=(s16b)y;
7025 monster_target_x=(s16b)x;
7027 remove_mirror(y, x);
7028 next_mirror(&oy, &ox, y, x);
7030 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7031 for(j = last_i; j <= i; j++)
7033 y = GRID_Y(path_g[j]);
7034 x = GRID_X(path_g[j]);
7035 if(project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice=TRUE;
7036 if(!who && (project_m_n==1) && !jump ){
7037 if(cave[project_m_y][project_m_x].m_idx >0 ){
7038 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7042 /* Hack -- auto-recall */
7043 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7045 /* Hack - auto-track */
7046 health_track(cave[project_m_y][project_m_x].m_idx);
7050 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7055 for(i = last_i ; i < path_n ; i++)
7058 py = GRID_Y(path_g[i]);
7059 px = GRID_X(path_g[i]);
7060 if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
7062 if(!who && (project_m_n==1) && !jump ){
7063 if(cave[project_m_y][project_m_x].m_idx > 0)
7065 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7069 /* Hack -- auto-recall */
7070 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7072 /* Hack - auto-track */
7073 health_track(cave[project_m_y][project_m_x].m_idx);
7077 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
7081 else if(typ == GF_SUPER_RAY){
7083 int second_step = 0;
7090 for (i = 0; i < path_n; ++i)
7095 int ny = GRID_Y(path_g[i]);
7096 int nx = GRID_X(path_g[i]);
7107 /* Only do visuals if requested */
7108 if (!blind && !(flg & (PROJECT_HIDE)))
7110 /* Only do visuals if the player can "see" the bolt */
7111 if (panel_contains(y, x) && player_has_los_bold(y, x))
7118 /* Obtain the bolt pict */
7119 p = bolt_pict(oy, ox, y, x, typ);
7121 /* Extract attr/char */
7125 /* Visual effects */
7126 print_rel(c, a, y, x);
7127 move_cursor_relative(y, x);
7128 /*if (fresh_before)*/ Term_fresh();
7129 Term_xtra(TERM_XTRA_DELAY, msec);
7131 /*if (fresh_before)*/ Term_fresh();
7133 /* Display "beam" grids */
7134 if (flg & (PROJECT_BEAM))
7136 /* Obtain the explosion pict */
7137 p = bolt_pict(y, x, y, x, typ);
7139 /* Extract attr/char */
7143 /* Visual effects */
7144 print_rel(c, a, y, x);
7147 /* Hack -- Activate delay */
7151 /* Hack -- delay anyway for consistency */
7154 /* Delay for consistency */
7155 Term_xtra(TERM_XTRA_DELAY, msec);
7158 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7159 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7161 if( second_step )continue;
7164 if( is_mirror_grid(&cave[y][x]) && !second_step )
7166 /* The target of monsterspell becomes tha mirror(broken) */
7167 monster_target_y=(s16b)y;
7168 monster_target_x=(s16b)x;
7171 for( j = 0; j <=i ; j++ )
7173 y = GRID_Y(path_g[j]);
7174 x = GRID_X(path_g[j]);
7175 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7179 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7180 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7181 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7182 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7183 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
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);
7189 for( i = 0; i < path_n ; i++ )
7192 py = GRID_Y(path_g[i]);
7193 px = GRID_X(path_g[i]);
7194 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
7195 if(!who && (project_m_n == 1) && !jump){
7196 if(cave[project_m_y][project_m_x].m_idx >0 ){
7197 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7201 /* Hack -- auto-recall */
7202 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7204 /* Hack - auto-track */
7205 health_track(cave[project_m_y][project_m_x].m_idx);
7209 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
7214 /* Project along the path */
7215 for (i = 0; i < path_n; ++i)
7220 int ny = GRID_Y(path_g[i]);
7221 int nx = GRID_X(path_g[i]);
7223 if (flg & PROJECT_DISI)
7225 /* Hack -- Balls explode before reaching walls */
7226 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7228 else if (flg & PROJECT_LOS)
7230 /* Hack -- Balls explode before reaching walls */
7231 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7235 /* Hack -- Balls explode before reaching walls */
7236 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7243 /* Collect beam grids */
7244 if (flg & (PROJECT_BEAM))
7251 /* Only do visuals if requested */
7252 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7254 /* Only do visuals if the player can "see" the bolt */
7255 if (panel_contains(y, x) && player_has_los_bold(y, x))
7262 /* Obtain the bolt pict */
7263 p = bolt_pict(oy, ox, y, x, typ);
7265 /* Extract attr/char */
7269 /* Visual effects */
7270 print_rel(c, a, y, x);
7271 move_cursor_relative(y, x);
7272 /*if (fresh_before)*/ Term_fresh();
7273 Term_xtra(TERM_XTRA_DELAY, msec);
7275 /*if (fresh_before)*/ Term_fresh();
7277 /* Display "beam" grids */
7278 if (flg & (PROJECT_BEAM))
7280 /* Obtain the explosion pict */
7281 p = bolt_pict(y, x, y, x, typ);
7283 /* Extract attr/char */
7287 /* Visual effects */
7288 print_rel(c, a, y, x);
7291 /* Hack -- Activate delay */
7295 /* Hack -- delay anyway for consistency */
7298 /* Delay for consistency */
7299 Term_xtra(TERM_XTRA_DELAY, msec);
7306 /* Save the "blast epicenter" */
7310 if (breath && !path_n)
7316 flg &= ~(PROJECT_HIDE);
7320 /* Start the "explosion" */
7323 /* Hack -- make sure beams get to "explode" */
7331 /* If we found a "target", explode there */
7332 if (dist <= MAX_RANGE)
7334 /* Mega-Hack -- remove the final "beam" grid */
7335 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7338 * Create a conical breath attack
7349 flg &= ~(PROJECT_HIDE);
7351 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7355 /* Determine the blast area, work from the inside out */
7356 for (dist = 0; dist <= rad; dist++)
7358 /* Scan the maximal blast area of radius "dist" */
7359 for (y = by - dist; y <= by + dist; y++)
7361 for (x = bx - dist; x <= bx + dist; x++)
7363 /* Ignore "illegal" locations */
7364 if (!in_bounds2(y, x)) continue;
7366 /* Enforce a "circular" explosion */
7367 if (distance(by, bx, y, x) != dist) continue;
7373 /* Lights are stopped by opaque terrains */
7374 if (!los(by, bx, y, x)) continue;
7376 case GF_DISINTEGRATE:
7377 /* Disintegration are stopped only by perma-walls */
7378 if (!in_disintegration_range(by, bx, y, x)) continue;
7381 /* Ball explosions are stopped by walls */
7382 if (!projectable(by, bx, y, x)) continue;
7386 /* Save this grid */
7393 /* Encode some more "radius" info */
7399 /* Speed -- ignore "non-explosions" */
7400 if (!grids) return (FALSE);
7403 /* Display the "blast area" if requested */
7404 if (!blind && !(flg & (PROJECT_HIDE)))
7406 /* Then do the "blast", from inside out */
7407 for (t = 0; t <= gm_rad; t++)
7409 /* Dump everything with this radius */
7410 for (i = gm[t]; i < gm[t+1]; i++)
7412 /* Extract the location */
7416 /* Only do visuals if the player can "see" the blast */
7417 if (panel_contains(y, x) && player_has_los_bold(y, x))
7426 /* Obtain the explosion pict */
7427 p = bolt_pict(y, x, y, x, typ);
7429 /* Extract attr/char */
7433 /* Visual effects -- Display */
7434 print_rel(c, a, y, x);
7438 /* Hack -- center the cursor */
7439 move_cursor_relative(by, bx);
7441 /* Flush each "radius" seperately */
7442 /*if (fresh_before)*/ Term_fresh();
7444 /* Delay (efficiently) */
7445 if (visual || drawn)
7447 Term_xtra(TERM_XTRA_DELAY, msec);
7451 /* Flush the erasing */
7454 /* Erase the explosion drawn above */
7455 for (i = 0; i < grids; i++)
7457 /* Extract the location */
7461 /* Hack -- Erase if needed */
7462 if (panel_contains(y, x) && player_has_los_bold(y, x))
7468 /* Hack -- center the cursor */
7469 move_cursor_relative(by, bx);
7471 /* Flush the explosion */
7472 /*if (fresh_before)*/ Term_fresh();
7477 /* Update stuff if needed */
7478 if (p_ptr->update) update_stuff();
7481 if (flg & PROJECT_KILL)
7483 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7484 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
7488 /* Check features */
7489 if (flg & (PROJECT_GRID))
7491 /* Start with "dist" of zero */
7494 /* Scan for features */
7495 for (i = 0; i < grids; i++)
7497 /* Hack -- Notice new "dist" values */
7498 if (gm[dist+1] == i) dist++;
7500 /* Get the grid location */
7504 /* Find the closest point in the blast */
7507 int d = dist_to_line(y, x, y1, x1, by, bx);
7509 /* Affect the grid */
7510 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7514 /* Affect the grid */
7515 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7520 /* Update stuff if needed */
7521 if (p_ptr->update) update_stuff();
7524 if (flg & (PROJECT_ITEM))
7526 /* Start with "dist" of zero */
7529 /* Scan for objects */
7530 for (i = 0; i < grids; i++)
7532 /* Hack -- Notice new "dist" values */
7533 if (gm[dist+1] == i) dist++;
7535 /* Get the grid location */
7539 /* Find the closest point in the blast */
7542 int d = dist_to_line(y, x, y1, x1, by, bx);
7544 /* Affect the object in the grid */
7545 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7549 /* Affect the object in the grid */
7550 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7556 /* Check monsters */
7557 if (flg & (PROJECT_KILL))
7564 /* Start with "dist" of zero */
7567 /* Scan for monsters */
7568 for (i = 0; i < grids; i++)
7572 /* Hack -- Notice new "dist" values */
7573 if (gm[dist + 1] == i) dist++;
7575 /* Get the grid location */
7579 /* A single bolt may be reflected */
7582 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7583 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7585 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7586 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7587 (!who || dist_hack > 1) && !one_in_(10))
7590 int max_attempts = 10;
7592 /* Choose 'new' target */
7595 t_y = y_saver - 1 + randint1(3);
7596 t_x = x_saver - 1 + randint1(3);
7599 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7601 if (max_attempts < 1)
7609 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7610 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7611 else if (m_ptr->r_idx == MON_DIO)
7612 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7614 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7616 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7618 /* Reflected bolts randomly target either one */
7619 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7620 else flg |= PROJECT_PLAYER;
7622 /* The bolt is reflected */
7623 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7625 /* Don't affect the monster any longer */
7631 /* Find the closest point in the blast */
7634 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7638 effective_dist = dist;
7642 /* There is the riding player on this monster */
7643 if (p_ptr->riding && player_bold(y, x))
7645 /* Aimed on the player */
7646 if (flg & PROJECT_PLAYER)
7648 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7651 * A beam or bolt is well aimed
7653 * So don't affects the mount.
7660 * The spell is not well aimed,
7661 * So partly affect the mount too.
7668 * This grid is the original target.
7669 * Or aimed on your horse.
7671 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7673 /* Hit the mount with full damage */
7677 * Otherwise this grid is not the
7678 * original target, it means that line
7679 * of fire is obstructed by this
7683 * A beam or bolt will hit either
7684 * player or mount. Choose randomly.
7686 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7690 /* Hit the mount with full damage */
7694 /* Hit the player later */
7695 flg |= PROJECT_PLAYER;
7697 /* Don't affect the mount */
7703 * The spell is not well aimed, so
7704 * partly affect both player and
7713 /* Affect the monster in the grid */
7714 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7718 /* Player affected one monster (without "jumping") */
7719 if (!who && (project_m_n == 1) && !jump)
7725 /* Track if possible */
7726 if (cave[y][x].m_idx > 0)
7728 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7732 /* Hack -- auto-recall */
7733 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7735 /* Hack - auto-track */
7736 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7744 if (flg & (PROJECT_KILL))
7746 /* Start with "dist" of zero */
7749 /* Scan for player */
7750 for (i = 0; i < grids; i++)
7754 /* Hack -- Notice new "dist" values */
7755 if (gm[dist+1] == i) dist++;
7757 /* Get the grid location */
7761 /* Affect the player? */
7762 if (!player_bold(y, x)) continue;
7764 /* Find the closest point in the blast */
7767 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7771 effective_dist = dist;
7774 /* Target may be your horse */
7777 /* Aimed on the player */
7778 if (flg & PROJECT_PLAYER)
7780 /* Hit the player with full damage */
7784 * Hack -- When this grid was not the
7785 * original target, a beam or bolt
7786 * would hit either player or mount,
7787 * and should be choosen randomly.
7789 * But already choosen to hit the
7790 * mount at this point.
7792 * Or aimed on your horse.
7794 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7797 * A beam or bolt is well aimed
7799 * So don't affects the player.
7806 * The spell is not well aimed,
7807 * So partly affect the player too.
7813 /* Affect the player */
7814 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7822 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7824 if (rakubadam_m > 0)
7826 if (rakuba(rakubadam_m, FALSE))
7828 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7831 if (p_ptr->riding && rakubadam_p > 0)
7833 if(rakuba(rakubadam_p, FALSE))
7835 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7840 /* Return "something was noticed" */
7845 * @brief 鏡魔法「封魔結界」の効果処理
7847 * @return 効果があったらTRUEを返す
7849 bool binding_field( int dam )
7851 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
7852 int mirror_num=0; /* 鏡の数 */
7857 int msec= delay_factor*delay_factor*delay_factor;
7863 /* Default target of monsterspell is player */
7864 monster_target_y=p_ptr->y;
7865 monster_target_x=p_ptr->x;
7867 for( x=0 ; x < cur_wid ; x++ )
7869 for( y=0 ; y < cur_hgt ; y++ )
7871 if( is_mirror_grid(&cave[y][x]) &&
7872 distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
7873 distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
7874 player_has_los_bold(y,x) &&
7875 projectable(p_ptr->y, p_ptr->x, y, x)
7877 mirror_y[mirror_num]=y;
7878 mirror_x[mirror_num]=x;
7884 if( mirror_num < 2 )return FALSE;
7886 point_x[0] = randint0( mirror_num );
7888 point_x[1] = randint0( mirror_num );
7890 while( point_x[0] == point_x[1] );
7892 point_y[0]=mirror_y[point_x[0]];
7893 point_x[0]=mirror_x[point_x[0]];
7894 point_y[1]=mirror_y[point_x[1]];
7895 point_x[1]=mirror_x[point_x[1]];
7896 point_y[2]=p_ptr->y;
7897 point_x[2]=p_ptr->x;
7899 x=point_x[0]+point_x[1]+point_x[2];
7900 y=point_y[0]+point_y[1]+point_y[2];
7902 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
7903 - (point_y[0]*3-y)*(point_x[1]*3-x);
7904 if( centersign == 0 )return FALSE;
7906 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7907 x1 = x1 < point_x[2] ? x1 : point_x[2];
7908 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7909 y1 = y1 < point_y[2] ? y1 : point_y[2];
7911 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7912 x2 = x2 > point_x[2] ? x2 : point_x[2];
7913 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7914 y2 = y2 > point_y[2] ? y2 : point_y[2];
7916 for( y=y1 ; y <=y2 ; y++ ){
7917 for( x=x1 ; x <=x2 ; x++ ){
7918 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7919 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7920 centersign*( (point_x[1]-x)*(point_y[2]-y)
7921 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7922 centersign*( (point_x[2]-x)*(point_y[0]-y)
7923 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7925 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7926 /* Visual effects */
7928 && panel_contains(y,x)){
7929 p = bolt_pict(y,x,y,x, GF_MANA );
7930 print_rel(PICT_C(p), PICT_A(p),y,x);
7931 move_cursor_relative(y, x);
7932 /*if (fresh_before)*/ Term_fresh();
7933 Term_xtra(TERM_XTRA_DELAY, msec);
7939 for( y=y1 ; y <=y2 ; y++ ){
7940 for( x=x1 ; x <=x2 ; x++ ){
7941 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7942 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7943 centersign*( (point_x[1]-x)*(point_y[2]-y)
7944 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7945 centersign*( (point_x[2]-x)*(point_y[0]-y)
7946 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7948 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7949 (void)project_f(0,0,y,x,dam,GF_MANA);
7954 for( y=y1 ; y <=y2 ; y++ ){
7955 for( x=x1 ; x <=x2 ; x++ ){
7956 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7957 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7958 centersign*( (point_x[1]-x)*(point_y[2]-y)
7959 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7960 centersign*( (point_x[2]-x)*(point_y[0]-y)
7961 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7963 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7964 (void)project_o(0,0,y,x,dam,GF_MANA);
7969 for( y=y1 ; y <=y2 ; y++ ){
7970 for( x=x1 ; x <=x2 ; x++ ){
7971 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
7972 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
7973 centersign*( (point_x[1]-x)*(point_y[2]-y)
7974 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
7975 centersign*( (point_x[2]-x)*(point_y[0]-y)
7976 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
7978 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7979 (void)project_m(0,0,y,x,dam,GF_MANA,
7980 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
7986 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7987 remove_mirror(point_y[0],point_x[0]);
7994 * @brief 鏡魔法「鏡の封印」の効果処理
7996 * @return 効果があったらTRUEを返す
7998 void seal_of_mirror( int dam )
8002 for( x = 0 ; x < cur_wid ; x++ )
8004 for( y = 0 ; y < cur_hgt ; y++ )
8006 if( is_mirror_grid(&cave[y][x]))
8008 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8009 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8011 if( !cave[y][x].m_idx )