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 /* 1/x chance of reducing stats (for elemental attacks) */
18 #define HURT_CHANCE 16
21 static int rakubadam_m;
22 static int rakubadam_p;
24 int project_length = 0;
28 * @brief 配置した鏡リストの次を取得する /
29 * Get another mirror. for SEEKER
30 * @param next_y 次の鏡のy座標を返す参照ポインタ
31 * @param next_x 次の鏡のx座標を返す参照ポインタ
32 * @param cury 現在の鏡のy座標
33 * @param curx 現在の鏡のx座標
35 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
37 int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
38 int mirror_num=0; /* 鏡の数 */
42 for( x=0 ; x < cur_wid ; x++ )
44 for( y=0 ; y < cur_hgt ; y++ )
46 if( is_mirror_grid(&cave[y][x])){
47 mirror_y[mirror_num]=y;
48 mirror_x[mirror_num]=x;
55 num=randint0(mirror_num);
56 *next_y=mirror_y[num];
57 *next_x=mirror_x[num];
60 *next_y=cury+randint0(5)-2;
61 *next_x=curx+randint0(5)-2;
66 * @brief 万色表現用にランダムな色を選択する関数 /
67 * Get a legal "multi-hued" color for drawing "spells"
71 static byte mh_attr(int max)
73 switch (randint1(max))
75 case 1: return (TERM_RED);
76 case 2: return (TERM_GREEN);
77 case 3: return (TERM_BLUE);
78 case 4: return (TERM_YELLOW);
79 case 5: return (TERM_ORANGE);
80 case 6: return (TERM_VIOLET);
81 case 7: return (TERM_L_RED);
82 case 8: return (TERM_L_GREEN);
83 case 9: return (TERM_L_BLUE);
84 case 10: return (TERM_UMBER);
85 case 11: return (TERM_L_UMBER);
86 case 12: return (TERM_SLATE);
87 case 13: return (TERM_WHITE);
88 case 14: return (TERM_L_WHITE);
89 case 15: return (TERM_L_DARK);
97 * @brief 魔法属性に応じたエフェクトの色を返す /
98 * Return a color to use for the bolt/ball spells
102 static byte spell_color(int type)
104 /* Check if A.B.'s new graphics should be used (rr9) */
105 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
110 case GF_PSY_SPEAR: return (0x06);
111 case GF_MISSILE: return (0x0F);
112 case GF_ACID: return (0x04);
113 case GF_ELEC: return (0x02);
114 case GF_FIRE: return (0x00);
115 case GF_COLD: return (0x01);
116 case GF_POIS: return (0x03);
117 case GF_HOLY_FIRE: return (0x00);
118 case GF_HELL_FIRE: return (0x00);
119 case GF_MANA: return (0x0E);
121 case GF_SEEKER: return (0x0E);
122 case GF_SUPER_RAY: return (0x0E);
124 case GF_ARROW: return (0x0F);
125 case GF_WATER: return (0x04);
126 case GF_NETHER: return (0x07);
127 case GF_CHAOS: return (mh_attr(15));
128 case GF_DISENCHANT: return (0x05);
129 case GF_NEXUS: return (0x0C);
130 case GF_CONFUSION: return (mh_attr(4));
131 case GF_SOUND: return (0x09);
132 case GF_SHARDS: return (0x08);
133 case GF_FORCE: return (0x09);
134 case GF_INERTIA: return (0x09);
135 case GF_GRAVITY: return (0x09);
136 case GF_TIME: return (0x09);
137 case GF_LITE_WEAK: return (0x06);
138 case GF_LITE: return (0x06);
139 case GF_DARK_WEAK: return (0x07);
140 case GF_DARK: return (0x07);
141 case GF_PLASMA: return (0x0B);
142 case GF_METEOR: return (0x00);
143 case GF_ICE: return (0x01);
144 case GF_ROCKET: return (0x0F);
145 case GF_DEATH_RAY: return (0x07);
146 case GF_NUKE: return (mh_attr(2));
147 case GF_DISINTEGRATE: return (0x05);
159 case GF_CAUSE_4: return (0x0E);
160 case GF_HAND_DOOM: return (0x07);
161 case GF_CAPTURE : return (0x0E);
162 case GF_IDENTIFY: return (0x01);
163 case GF_ATTACK: return (0x0F);
164 case GF_PHOTO : return (0x06);
167 /* Normal tiles or ASCII */
173 /* Lookup the default colors for this type */
174 cptr s = quark_str(gf_color[type]);
177 if (!s) return (TERM_WHITE);
179 /* Pick a random color */
180 c = s[randint0(strlen(s))];
182 /* Lookup this color */
183 a = my_strchr(color_char, c) - color_char;
185 /* Invalid color (note check for < 0 removed, gave a silly
186 * warning because bytes are always >= 0 -- RG) */
187 if (a > 15) return (TERM_WHITE);
193 /* Standard "color" */
199 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
200 * Find the attr/char pair to use for a spell effect
208 * It is moving (or has moved) from (x,y) to (nx,ny).
209 * If the distance is not "one", we (may) return "*".
212 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
222 if ((ny == y) && (nx == x)) base = 0x30;
225 else if (nx == x) base = 0x40;
228 else if (ny == y) base = 0x50;
231 else if ((ny - y) == (x - nx)) base = 0x60;
234 else if ((ny - y) == (nx - x)) base = 0x70;
239 /* Basic spell color */
240 k = spell_color(typ);
242 /* Obtain attr/char */
243 a = misc_to_attr[base + k];
244 c = misc_to_char[base + k];
252 * @brief 始点から終点への経路を返す /
253 * Determine the path taken by a projection.
254 * @param gp 経路座標リストを返す参照ポインタ
264 * The projection will always start from the grid (y1,x1), and will travel
265 * towards the grid (y2,x2), touching one grid per unit of distance along
266 * the major axis, and stopping when it enters the destination grid or a
267 * wall grid, or has travelled the maximum legal distance of "range".
269 * Note that "distance" in this function (as in the "update_view()" code)
270 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
271 * actually has an "octagon of projection" not a "circle of projection".
273 * The path grids are saved into the grid array pointed to by "gp", and
274 * there should be room for at least "range" grids in "gp". Note that
275 * due to the way in which distance is calculated, this function normally
276 * uses fewer than "range" grids for the projection path, so the result
277 * of this function should never be compared directly to "range". Note
278 * that the initial grid (y1,x1) is never saved into the grid array, not
279 * even if the initial grid is also the final grid. XXX XXX XXX
281 * The "flg" flags can be used to modify the behavior of this function.
283 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
284 * semantics as they do for the "project" function, namely, that the path
285 * will stop as soon as it hits a monster, or that the path will continue
286 * through the destination grid, respectively.
288 * The "PROJECT_JUMP" flag, which for the "project()" function means to
289 * start at a special grid (which makes no sense in this function), means
290 * that the path should be "angled" slightly if needed to avoid any wall
291 * grids, allowing the player to "target" any grid which is in "view".
292 * This flag is non-trivial and has not yet been implemented, but could
293 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
295 * This function returns the number of grids (if any) in the path. This
296 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
298 * This algorithm is similar to, but slightly different from, the one used
299 * by "update_view_los()", and very different from the one used by "los()".
302 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
324 /* No path necessary (or allowed) */
325 if ((x1 == x2) && (y1 == y2)) return (0);
353 /* Number of "units" in one "half" grid */
356 /* Number of "units" in one "full" grid */
362 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
373 /* Advance (X) part 2 */
376 /* Advance (X) part 3 */
383 /* Create the projection path */
387 gp[n++] = GRID(y, x);
389 /* Hack -- Check maximum range */
390 if ((n + (k >> 1)) >= range) break;
392 /* Sometimes stop at destination grid */
393 if (!(flg & (PROJECT_THRU)))
395 if ((x == x2) && (y == y2)) break;
398 if (flg & (PROJECT_DISI))
400 if ((n > 0) && cave_stop_disintegration(y, x)) break;
402 else if (flg & (PROJECT_LOS))
404 if ((n > 0) && !cave_los_bold(y, x)) break;
406 else if (!(flg & (PROJECT_PATH)))
408 /* Always stop at non-initial wall grids */
409 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
412 /* Sometimes stop at non-initial monsters/players */
413 if (flg & (PROJECT_STOP))
416 (player_bold(y, x) || cave[y][x].m_idx != 0))
420 if (!in_bounds(y, x)) break;
425 /* Advance (X) part 1 */
428 /* Horizontal change */
431 /* Advance (X) part 2 */
434 /* Advance (X) part 3 */
450 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
459 /* Vertical change */
462 /* Advance (Y) part 2 */
465 /* Advance (Y) part 3 */
472 /* Create the projection path */
476 gp[n++] = GRID(y, x);
478 /* Hack -- Check maximum range */
479 if ((n + (k >> 1)) >= range) break;
481 /* Sometimes stop at destination grid */
482 if (!(flg & (PROJECT_THRU)))
484 if ((x == x2) && (y == y2)) break;
487 if (flg & (PROJECT_DISI))
489 if ((n > 0) && cave_stop_disintegration(y, x)) break;
491 else if (flg & (PROJECT_LOS))
493 if ((n > 0) && !cave_los_bold(y, x)) break;
495 else if (!(flg & (PROJECT_PATH)))
497 /* Always stop at non-initial wall grids */
498 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
501 /* Sometimes stop at non-initial monsters/players */
502 if (flg & (PROJECT_STOP))
505 (player_bold(y, x) || cave[y][x].m_idx != 0))
509 if (!in_bounds(y, x)) break;
514 /* Advance (Y) part 1 */
517 /* Vertical change */
520 /* Advance (Y) part 2 */
523 /* Advance (Y) part 3 */
543 /* Create the projection path */
547 gp[n++] = GRID(y, x);
549 /* Hack -- Check maximum range */
550 if ((n + (n >> 1)) >= range) break;
552 /* Sometimes stop at destination grid */
553 if (!(flg & (PROJECT_THRU)))
555 if ((x == x2) && (y == y2)) break;
558 if (flg & (PROJECT_DISI))
560 if ((n > 0) && cave_stop_disintegration(y, x)) break;
562 else if (flg & (PROJECT_LOS))
564 if ((n > 0) && !cave_los_bold(y, x)) break;
566 else if (!(flg & (PROJECT_PATH)))
568 /* Always stop at non-initial wall grids */
569 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
572 /* Sometimes stop at non-initial monsters/players */
573 if (flg & (PROJECT_STOP))
576 (player_bold(y, x) || cave[y][x].m_idx != 0))
580 if (!in_bounds(y, x)) break;
597 * Mega-Hack -- track "affected" monsters (see "project()" comments)
599 static int project_m_n;
600 static int project_m_x;
601 static int project_m_y;
602 /* Mega-Hack -- monsters target */
603 static s16b monster_target_x;
604 static s16b monster_target_y;
608 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
609 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
610 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
611 * @param y 目標Y座標 / Target y location (or location to travel "towards")
612 * @param x 目標X座標 / Target x location (or location to travel "towards")
613 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
614 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
615 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
618 * We are called both for "beam" effects and "ball" effects.
620 * The "r" parameter is the "distance from ground zero".
622 * Note that we determine if the player can "see" anything that happens
623 * by taking into account: blindness, line-of-sight, and illumination.
625 * We return "TRUE" if the effect of the projection is "obvious".
627 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
629 * XXX XXX XXX Perhaps we should affect doors?
632 static bool project_f(int who, int r, int y, int x, int dam, int typ)
634 cave_type *c_ptr = &cave[y][x];
635 feature_type *f_ptr = &f_info[c_ptr->feat];
637 bool obvious = FALSE;
638 bool known = player_has_los_bold(y, x);
644 /* Reduce damage by distance */
645 dam = (dam + r) / (r + 1);
648 if (have_flag(f_ptr->flags, FF_TREE))
656 message = _("枯れた", "was blasted."); break;
658 message = _("縮んだ", "shrank."); break;
660 message = _("溶けた", "melted."); break;
663 message = _("凍り、砕け散った", "was frozen and smashed."); break;
667 message = _("燃えた", "burns up!"); break;
679 message = _("粉砕された", "was crushed."); break;
681 message = NULL;break;
685 msg_format(_("木は%s。", "A tree %s"), message);
686 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
689 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
693 /* Analyze the type */
696 /* Ignore most effects */
731 /* Destroy Traps (and Locks) */
734 /* Reveal secret doors */
735 if (is_hidden_door(c_ptr))
740 /* Check line of sight */
748 if (is_trap(c_ptr->feat))
750 /* Check line of sight */
753 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
757 /* Destroy the trap */
758 cave_alter_feat(y, x, FF_DISARM);
761 /* Locked doors are unlocked */
762 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
764 s16b old_feat = c_ptr->feat;
766 /* Unlock the door */
767 cave_alter_feat(y, x, FF_DISARM);
769 /* Check line of sound */
770 if (known && (old_feat != c_ptr->feat))
772 msg_print(_("カチッと音がした!", "Click!"));
777 /* Remove "unsafe" flag if player is not blind */
778 if (!p_ptr->blind && player_has_los_bold(y, x))
780 c_ptr->info &= ~(CAVE_UNSAFE);
791 /* Destroy Doors (and traps) */
794 /* Destroy all doors and traps */
795 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
797 /* Check line of sight */
801 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
805 /* Destroy the feature */
806 cave_alter_feat(y, x, FF_TUNNEL);
809 /* Remove "unsafe" flag if player is not blind */
810 if (!p_ptr->blind && player_has_los_bold(y, x))
812 c_ptr->info &= ~(CAVE_UNSAFE);
823 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
825 if (have_flag(f_ptr->flags, FF_SPIKE))
827 s16b old_mimic = c_ptr->mimic;
828 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
830 cave_alter_feat(y, x, FF_SPIKE);
832 c_ptr->mimic = old_mimic;
840 /* Check line of sight */
841 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
844 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
851 /* Destroy walls (and doors) */
854 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
857 if (known && (c_ptr->info & (CAVE_MARK)))
859 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
863 /* Destroy the wall */
864 cave_alter_feat(y, x, FF_HURT_ROCK);
866 /* Update some things */
867 p_ptr->update |= (PU_FLOW);
876 /* Require a "naked" floor grid */
877 if (!cave_naked_bold(y, x)) break;
879 /* Not on the player */
880 if (player_bold(y, x)) break;
882 /* Create a closed door */
883 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
886 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
903 /* Require a "naked" floor grid */
904 if (!cave_naked_bold(y, x)) break;
906 /* Not on the player */
907 if (player_bold(y, x)) break;
909 /* Create a closed door */
910 cave_set_feat(y, x, feat_tree);
913 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
921 /* Require a "naked" floor grid */
922 if (!cave_naked_bold(y, x)) break;
925 c_ptr->info |= CAVE_OBJECT;
926 c_ptr->mimic = feat_glyph;
939 /* Require a "naked" floor grid */
940 if (!cave_naked_bold(y, x)) break;
942 /* Not on the player */
943 if (player_bold(y, x)) break;
946 cave_set_feat(y, x, feat_granite);
954 /* Ignore permanent grid */
955 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
960 /* Ignore grid without enough space */
961 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
963 /* Place a shallow lava */
964 cave_set_feat(y, x, feat_shallow_lava);
969 /* Place a deep lava */
970 cave_set_feat(y, x, feat_deep_lava);
977 /* Ignore permanent grid */
978 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
983 /* Ignore grid without enough space */
984 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
986 /* Place a shallow water */
987 cave_set_feat(y, x, feat_shallow_water);
992 /* Place a deep water */
993 cave_set_feat(y, x, feat_deep_water);
998 /* Lite up the grid */
1002 /* Turn on the light */
1003 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1005 c_ptr->info |= (CAVE_GLOW);
1013 update_local_illumination(y, x);
1016 if (player_can_see_bold(y, x)) obvious = TRUE;
1018 /* Mega-Hack -- Update the monster in the affected grid */
1019 /* This allows "spear of light" (etc) to work "correctly" */
1020 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1022 if (p_ptr->special_defense & NINJA_S_STEALTH)
1024 if (player_bold(y, x)) set_superstealth(FALSE);
1031 /* Darken the grid */
1035 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1038 /* Turn off the light. */
1041 if (dun_level || !is_daytime())
1043 for (j = 0; j < 9; j++)
1045 int by = y + ddy_ddd[j];
1046 int bx = x + ddx_ddd[j];
1048 if (in_bounds2(by, bx))
1050 cave_type *cc_ptr = &cave[by][bx];
1052 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1060 if (!do_dark) break;
1063 c_ptr->info &= ~(CAVE_GLOW);
1065 /* Hack -- Forget "boring" grids */
1066 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1069 c_ptr->info &= ~(CAVE_MARK);
1078 update_local_illumination(y, x);
1081 if (player_can_see_bold(y, x)) obvious = TRUE;
1083 /* Mega-Hack -- Update the monster in the affected grid */
1084 /* This allows "spear of light" (etc) to work "correctly" */
1085 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1095 if (is_mirror_grid(c_ptr))
1097 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1099 remove_mirror(y, x);
1100 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1103 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1106 if (known && (c_ptr->info & CAVE_MARK))
1108 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1112 /* Destroy the wall */
1113 cave_alter_feat(y, x, FF_HURT_ROCK);
1115 /* Update some things */
1116 p_ptr->update |= (PU_FLOW);
1123 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1125 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
1127 remove_mirror(y, x);
1128 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1131 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1134 if (known && (c_ptr->info & CAVE_MARK))
1136 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
1140 /* Destroy the wall */
1141 cave_alter_feat(y, x, FF_HURT_ROCK);
1143 /* Update some things */
1144 p_ptr->update |= (PU_FLOW);
1149 case GF_DISINTEGRATE:
1151 /* Destroy mirror/glyph */
1152 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1153 remove_mirror(y, x);
1155 /* Permanent features don't get effect */
1156 /* But not protect monsters and other objects */
1157 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1159 cave_alter_feat(y, x, FF_HURT_DISI);
1161 /* Update some things -- similar to GF_KILL_WALL */
1162 p_ptr->update |= (PU_FLOW);
1169 /* Return "Anything seen?" */
1176 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1177 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1178 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1179 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1180 * @param x 目標X座標 / Target x location (or location to travel "towards")
1181 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1182 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1183 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1186 * We are called from "project()" to "damage" objects
1188 * We are called both for "beam" effects and "ball" effects.
1190 * Perhaps we should only SOMETIMES damage things on the ground.
1192 * The "r" parameter is the "distance from ground zero".
1194 * Note that we determine if the player can "see" anything that happens
1195 * by taking into account: blindness, line-of-sight, and illumination.
1197 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1199 * We return "TRUE" if the effect of the projection is "obvious".
1202 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1204 cave_type *c_ptr = &cave[y][x];
1206 s16b this_o_idx, next_o_idx = 0;
1208 bool obvious = FALSE;
1209 bool known = player_has_los_bold(y, x);
1211 u32b flgs[TR_FLAG_SIZE];
1213 char o_name[MAX_NLEN];
1216 bool is_potion = FALSE;
1220 who = who ? who : 0;
1222 /* Reduce damage by distance */
1223 dam = (dam + r) / (r + 1);
1226 /* Scan all objects in the grid */
1227 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1229 /* Acquire object */
1230 object_type *o_ptr = &o_list[this_o_idx];
1232 bool is_art = FALSE;
1233 bool ignore = FALSE;
1234 bool do_kill = FALSE;
1236 cptr note_kill = NULL;
1239 /* Get the "plural"-ness */
1240 bool plural = (o_ptr->number > 1);
1243 /* Acquire next object */
1244 next_o_idx = o_ptr->next_o_idx;
1246 /* Extract the flags */
1247 object_flags(o_ptr, flgs);
1249 /* Check for artifact */
1250 if (object_is_artifact(o_ptr)) is_art = TRUE;
1252 /* Analyze the type */
1255 /* Acid -- Lots of things */
1258 if (hates_acid(o_ptr))
1261 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
1262 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1267 /* Elec -- Rings and Wands */
1270 if (hates_elec(o_ptr))
1273 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1274 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1279 /* Fire -- Flammable objects */
1282 if (hates_fire(o_ptr))
1285 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1286 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1291 /* Cold -- potions and flasks */
1294 if (hates_cold(o_ptr))
1296 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1298 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1306 if (hates_fire(o_ptr))
1309 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1310 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1312 if (hates_elec(o_ptr))
1316 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1317 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1325 if (hates_fire(o_ptr))
1328 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
1329 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1331 if (hates_cold(o_ptr))
1335 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1336 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1341 /* Hack -- break potions and such */
1347 if (hates_cold(o_ptr))
1349 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
1355 /* Mana and Chaos -- destroy everything */
1361 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1365 case GF_DISINTEGRATE:
1368 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1375 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1376 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1377 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1381 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1385 if (object_is_cursed(o_ptr))
1388 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1395 identify_item(o_ptr);
1397 /* Auto-inscription */
1398 autopick_alter_item((-this_o_idx), FALSE);
1406 /* Chests are noticed only if trapped or locked */
1407 if (o_ptr->tval == TV_CHEST)
1409 /* Disarm/Unlock traps */
1410 if (o_ptr->pval > 0)
1412 /* Disarm or Unlock */
1413 o_ptr->pval = (0 - o_ptr->pval);
1416 object_known(o_ptr);
1419 if (known && (o_ptr->marked & OM_FOUND))
1421 msg_print(_("カチッと音がした!", "Click!"));
1431 if (o_ptr->tval == TV_CORPSE)
1436 if (!who || is_pet(&m_list[who]))
1437 mode |= PM_FORCE_PET;
1439 for (i = 0; i < o_ptr->number ; i++)
1441 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1442 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1446 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1450 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1452 note_kill = _("生き返った。", " revived.");
1454 else if (!note_kill)
1456 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1467 /* Attempt to destroy the object */
1470 /* Effect "observed" */
1471 if (known && (o_ptr->marked & OM_FOUND))
1474 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1477 /* Artifacts, and other objects, get to resist */
1478 if (is_art || ignore)
1480 /* Observe the resist */
1481 if (known && (o_ptr->marked & OM_FOUND))
1483 msg_format(_("%sは影響を受けない!",
1484 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1491 /* Describe if needed */
1492 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1494 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1497 k_idx = o_ptr->k_idx;
1498 is_potion = object_is_potion(o_ptr);
1501 /* Delete the object */
1502 delete_object_idx(this_o_idx);
1504 /* Potions produce effects when 'shattered' */
1507 (void)potion_smash_effect(who, y, x, k_idx);
1516 /* Return "Anything seen?" */
1522 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1523 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1524 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1525 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1526 * @param x 目標X座標 / Target x location (or location to travel "towards")
1527 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1528 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1530 * @param see_s_msg TRUEならばメッセージを表示する
1531 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1534 * This routine takes a "source monster" (by index) which is mostly used to
1535 * determine if the player is causing the damage, and a "radius" (see below),
1536 * which is used to decrease the power of explosions with distance, and a
1537 * location, via integers which are modified by certain types of attacks
1538 * (polymorph and teleport being the obvious ones), a default damage, which
1539 * is modified as needed based on various properties, and finally a "damage
1540 * type" (see below).
1542 * Note that this routine can handle "no damage" attacks (like teleport) by
1543 * taking a "zero" damage, and can even take "parameters" to attacks (like
1544 * confuse) by accepting a "damage", using it to calculate the effect, and
1545 * then setting the damage to zero. Note that the "damage" parameter is
1546 * divided by the radius, so monsters not at the "epicenter" will not take
1547 * as much damage (or whatever)...
1549 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1550 * may result in a dereference of an invalid pointer. XXX XXX XXX
1552 * Various messages are produced, and damage is applied.
1554 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1555 * actually be "made" of that substance, or "breathe" big balls of it.
1557 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1560 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1561 * and hurts evil less. If can breath nether, then it resists it as well.
1563 * Damage reductions use the following formulas:
1564 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1565 * gives avg damage of .655, ranging from .858 to .500
1566 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1567 * gives avg damage of .544, ranging from .714 to .417
1568 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1569 * gives avg damage of .444, ranging from .556 to .333
1570 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1571 * gives avg damage of .327, ranging from .427 to .250
1572 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1573 * gives something simple.
1575 * In this function, "result" messages are postponed until the end, where
1576 * the "note" string is appended to the monster name, if not NULL. So,
1577 * to make a spell have "no effect" just set "note" to NULL. You should
1578 * also set "notice" to FALSE, or the player will learn what the spell does.
1580 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1582 /* "flg" was added. */
1583 static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
1587 cave_type *c_ptr = &cave[y][x];
1589 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1590 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1592 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1596 /* Is the monster "seen"? */
1597 bool seen = m_ptr->ml;
1598 bool seen_msg = is_seen(m_ptr);
1600 bool slept = (bool)MON_CSLEEP(m_ptr);
1602 /* Were the effects "obvious" (if seen)? */
1603 bool obvious = FALSE;
1605 /* Can the player know about this effect? */
1606 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1608 /* Were the effects "irrelevant"? */
1609 bool skipped = FALSE;
1611 /* Gets the monster angry at the source of the effect? */
1612 bool get_angry = FALSE;
1614 /* Polymorph setting (true or false) */
1615 bool do_poly = FALSE;
1617 /* Teleport setting (max distance) */
1620 /* Confusion setting (amount to confuse) */
1623 /* Stunning setting (amount to stun) */
1626 /* Sleep amount (amount to sleep) */
1629 /* Fear amount (amount to fear) */
1632 /* Time amount (amount to time) */
1635 bool heal_leper = FALSE;
1637 /* Hold the monster name */
1643 /* Assume no note */
1646 /* Assume a default death */
1647 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1652 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1655 if (!c_ptr->m_idx) return (FALSE);
1657 /* Never affect projector */
1658 if (who && (c_ptr->m_idx == who)) return (FALSE);
1659 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1660 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1662 /* Don't affect already death monsters */
1663 /* Prevents problems with chain reactions of exploding monsters */
1664 if (m_ptr->hp < 0) return (FALSE);
1666 /* Reduce damage by distance */
1667 dam = (dam + r) / (r + 1);
1670 /* Get the monster name (BEFORE polymorphing) */
1671 monster_desc(m_name, m_ptr, 0);
1673 /* Get the monster possessive ("his"/"her"/"its") */
1674 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1676 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 1);
1678 /* Analyze the damage type */
1681 /* Magic Missile -- pure damage */
1684 if (seen) obvious = TRUE;
1686 if (r_ptr->flagsr & RFR_RES_ALL)
1688 note = _("には完全な耐性がある!", " is immune.");
1690 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1699 if (seen) obvious = TRUE;
1701 if (r_ptr->flagsr & RFR_RES_ALL)
1703 note = _("には完全な耐性がある!", " is immune.");
1705 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1708 if (r_ptr->flagsr & RFR_IM_ACID)
1710 note = _("にはかなり耐性がある!", " resists a lot.");
1712 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1720 if (seen) obvious = TRUE;
1722 if (r_ptr->flagsr & RFR_RES_ALL)
1724 note = _("には完全な耐性がある!", " is immune.");
1726 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1729 if (r_ptr->flagsr & RFR_IM_ELEC)
1731 note = _("にはかなり耐性がある!", " resists a lot.");
1733 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1741 if (seen) obvious = TRUE;
1743 if (r_ptr->flagsr & RFR_RES_ALL)
1745 note = _("には完全な耐性がある!", " is immune.");
1747 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1750 if (r_ptr->flagsr & RFR_IM_FIRE)
1752 note = _("にはかなり耐性がある!", " resists a lot.");
1754 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1756 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1758 note = _("はひどい痛手をうけた。", " is hit hard.");
1760 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1768 if (seen) obvious = TRUE;
1770 if (r_ptr->flagsr & RFR_RES_ALL)
1772 note = _("には完全な耐性がある!", " is immune.");
1774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1777 if (r_ptr->flagsr & RFR_IM_COLD)
1779 note = _("にはかなり耐性がある!", " resists a lot.");
1781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1783 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1785 note = _("はひどい痛手をうけた。", " is hit hard.");
1787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1795 if (seen) obvious = TRUE;
1797 if (r_ptr->flagsr & RFR_RES_ALL)
1799 note = _("には完全な耐性がある!", " is immune.");
1801 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1804 if (r_ptr->flagsr & RFR_IM_POIS)
1806 note = _("にはかなり耐性がある!", " resists a lot.");
1808 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1816 if (seen) obvious = TRUE;
1818 if (r_ptr->flagsr & RFR_RES_ALL)
1820 note = _("には完全な耐性がある!", " is immune.");
1822 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1825 if (r_ptr->flagsr & RFR_IM_POIS)
1827 note = _("には耐性がある。", " resists.");
1828 dam *= 3; dam /= randint1(6) + 6;
1829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1831 else if (one_in_(3)) do_poly = TRUE;
1835 /* Hellfire -- hurts Evil */
1838 if (seen) obvious = TRUE;
1840 if (r_ptr->flagsr & RFR_RES_ALL)
1842 note = _("には完全な耐性がある!", " is immune.");
1844 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1847 if (r_ptr->flags3 & RF3_GOOD)
1849 note = _("はひどい痛手をうけた。", " is hit hard.");
1851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1856 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1859 if (seen) obvious = TRUE;
1861 if (r_ptr->flagsr & RFR_RES_ALL)
1863 note = _("には完全な耐性がある!", " is immune.");
1865 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1868 if (r_ptr->flags3 & RF3_GOOD)
1870 note = _("には完全な耐性がある!", " is immune.");
1872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1874 else if (r_ptr->flags3 & RF3_EVIL)
1877 note = _("はひどい痛手をうけた。", " is hit hard.");
1878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1882 note = _("には耐性がある。", " resists.");
1883 dam *= 3; dam /= randint1(6) + 6;
1888 /* Arrow -- XXX no defense */
1891 if (seen) obvious = TRUE;
1893 if (r_ptr->flagsr & RFR_RES_ALL)
1895 note = _("には完全な耐性がある!", " is immune.");
1897 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1903 /* Plasma -- XXX perhaps check ELEC or FIRE */
1906 if (seen) obvious = TRUE;
1908 if (r_ptr->flagsr & RFR_RES_ALL)
1910 note = _("には完全な耐性がある!", " is immune.");
1912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1915 if (r_ptr->flagsr & RFR_RES_PLAS)
1917 note = _("には耐性がある。", " resists.");
1918 dam *= 3; dam /= randint1(6) + 6;
1919 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1924 /* Nether -- see above */
1927 if (seen) obvious = TRUE;
1929 if (r_ptr->flagsr & RFR_RES_ALL)
1931 note = _("には完全な耐性がある!", " is immune.");
1933 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1936 if (r_ptr->flagsr & RFR_RES_NETH)
1938 if (r_ptr->flags3 & RF3_UNDEAD)
1940 note = _("には完全な耐性がある!", " is immune.");
1942 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1946 note = _("には耐性がある。", " resists.");
1947 dam *= 3; dam /= randint1(6) + 6;
1949 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1951 else if (r_ptr->flags3 & RF3_EVIL)
1953 note = _("はいくらか耐性を示した。", " resists somewhat.");
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1960 /* Water (acid) damage -- Water spirits/elementals are immune */
1963 if (seen) obvious = TRUE;
1965 if (r_ptr->flagsr & RFR_RES_ALL)
1967 note = _("には完全な耐性がある!", " is immune.");
1969 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1972 if (r_ptr->flagsr & RFR_RES_WATE)
1974 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1976 note = _("には完全な耐性がある!", " is immune.");
1981 note = _("には耐性がある。", " resists.");
1982 dam *= 3; dam /= randint1(6) + 6;
1984 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1989 /* Chaos -- Chaos breathers resist */
1992 if (seen) obvious = TRUE;
1994 if (r_ptr->flagsr & RFR_RES_ALL)
1996 note = _("には完全な耐性がある!", " is immune.");
1998 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2001 if (r_ptr->flagsr & RFR_RES_CHAO)
2003 note = _("には耐性がある。", " resists.");
2004 dam *= 3; dam /= randint1(6) + 6;
2005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2007 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2009 note = _("はいくらか耐性を示した。", " resists somewhat.");
2010 dam *= 3; dam /= randint1(6) + 6;
2011 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2016 do_conf = (5 + randint1(11) + r) / (r + 1);
2021 /* Shards -- Shard breathers resist */
2024 if (seen) obvious = TRUE;
2026 if (r_ptr->flagsr & RFR_RES_ALL)
2028 note = _("には完全な耐性がある!", " is immune.");
2030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2033 if (r_ptr->flagsr & RFR_RES_SHAR)
2035 note = _("には耐性がある。", " resists.");
2036 dam *= 3; dam /= randint1(6) + 6;
2037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2042 /* Rocket: Shard resistance helps */
2045 if (seen) obvious = TRUE;
2047 if (r_ptr->flagsr & RFR_RES_ALL)
2049 note = _("には完全な耐性がある!", " is immune.");
2051 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2054 if (r_ptr->flagsr & RFR_RES_SHAR)
2056 note = _("はいくらか耐性を示した。", " resists somewhat.");
2058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2064 /* Sound -- Sound breathers resist */
2067 if (seen) obvious = TRUE;
2069 if (r_ptr->flagsr & RFR_RES_ALL)
2071 note = _("には完全な耐性がある!", " is immune.");
2073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2076 if (r_ptr->flagsr & RFR_RES_SOUN)
2078 note = _("には耐性がある。", " resists.");
2079 dam *= 2; dam /= randint1(6) + 6;
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2082 else do_stun = (10 + randint1(15) + r) / (r + 1);
2089 if (seen) obvious = TRUE;
2091 if (r_ptr->flagsr & RFR_RES_ALL)
2093 note = _("には完全な耐性がある!", " is immune.");
2095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2098 if (r_ptr->flags3 & RF3_NO_CONF)
2100 note = _("には耐性がある。", " resists.");
2101 dam *= 3; dam /= randint1(6) + 6;
2102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2104 else do_conf = (10 + randint1(15) + r) / (r + 1);
2108 /* Disenchantment -- Breathers and Disenchanters resist */
2111 if (seen) obvious = TRUE;
2113 if (r_ptr->flagsr & RFR_RES_ALL)
2115 note = _("には完全な耐性がある!", " is immune.");
2117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2120 if (r_ptr->flagsr & RFR_RES_DISE)
2122 note = _("には耐性がある。", " resists.");
2123 dam *= 3; dam /= randint1(6) + 6;
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2129 /* Nexus -- Breathers and Existers resist */
2132 if (seen) obvious = TRUE;
2134 if (r_ptr->flagsr & RFR_RES_ALL)
2136 note = _("には完全な耐性がある!", " is immune.");
2138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2141 if (r_ptr->flagsr & RFR_RES_NEXU)
2143 note = _("には耐性がある。", " resists.");
2144 dam *= 3; dam /= randint1(6) + 6;
2145 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2153 if (seen) obvious = TRUE;
2155 if (r_ptr->flagsr & RFR_RES_ALL)
2157 note = _("には完全な耐性がある!", " is immune.");
2159 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2162 if (r_ptr->flagsr & RFR_RES_WALL)
2164 note = _("には耐性がある。", " resists.");
2165 dam *= 3; dam /= randint1(6) + 6;
2166 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2168 else do_stun = (randint1(15) + r) / (r + 1);
2172 /* Inertia -- breathers resist */
2175 if (seen) obvious = TRUE;
2177 if (r_ptr->flagsr & RFR_RES_ALL)
2179 note = _("には完全な耐性がある!", " is immune.");
2181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2184 if (r_ptr->flagsr & RFR_RES_INER)
2186 note = _("には耐性がある。", " resists.");
2187 dam *= 3; dam /= randint1(6) + 6;
2188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2192 /* Powerful monsters can resist */
2193 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2194 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2198 /* Normal monsters slow down */
2201 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2203 note = _("の動きが遅くなった。", " starts moving slower.");
2210 /* Time -- breathers resist */
2213 if (seen) obvious = TRUE;
2215 if (r_ptr->flagsr & RFR_RES_ALL)
2217 note = _("には完全な耐性がある!", " is immune.");
2219 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2222 if (r_ptr->flagsr & RFR_RES_TIME)
2224 note = _("には耐性がある。", " resists.");
2225 dam *= 3; dam /= randint1(6) + 6;
2226 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2228 else do_time = (dam + 1) / 2;
2232 /* Gravity -- breathers resist */
2235 bool resist_tele = FALSE;
2237 if (seen) obvious = TRUE;
2239 if (r_ptr->flagsr & RFR_RES_ALL)
2241 note = _("には完全な耐性がある!", " is immune.");
2243 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2246 if (r_ptr->flagsr & RFR_RES_TELE)
2248 if (r_ptr->flags1 & (RF1_UNIQUE))
2250 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2251 note = _("には効果がなかった。", " is unaffected!");
2254 else if (r_ptr->level > randint1(100))
2256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2257 note = _("には耐性がある!", " resists!");
2262 if (!resist_tele) do_dist = 10;
2264 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2266 if (r_ptr->flagsr & RFR_RES_GRAV)
2268 note = _("には耐性がある!", " resists!");
2269 dam *= 3; dam /= randint1(6) + 6;
2271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2276 /* Powerful monsters can resist */
2277 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2278 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2282 /* Normal monsters slow down */
2285 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2287 note = _("の動きが遅くなった。", " starts moving slower.");
2292 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2294 /* Attempt a saving throw */
2295 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2296 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2300 /* No obvious effect */
2301 note = _("には効果がなかった。", " is unaffected!");
2313 if (seen) obvious = TRUE;
2315 if (r_ptr->flagsr & RFR_RES_ALL)
2317 note = _("には完全な耐性がある!", " is immune.");
2319 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2327 case GF_DISINTEGRATE:
2329 if (seen) obvious = TRUE;
2331 if (r_ptr->flagsr & RFR_RES_ALL)
2333 note = _("には完全な耐性がある!", " is immune.");
2335 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2338 if (r_ptr->flags3 & RF3_HURT_ROCK)
2340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2341 note = _("の皮膚がただれた!", " loses some skin!");
2342 note_dies = _("は蒸発した!", " evaporates!");
2350 if (seen) obvious = TRUE;
2352 /* PSI only works if the monster can see you! -- RG */
2353 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2356 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2361 if (r_ptr->flagsr & RFR_RES_ALL)
2363 note = _("には完全な耐性がある!", " is immune.");
2365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2368 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2371 note = _("には完全な耐性がある!", " is immune.");
2372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2375 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2376 (r_ptr->flags3 & RF3_ANIMAL) ||
2377 (r_ptr->level > randint1(3 * dam)))
2379 note = _("には耐性がある!", " resists!");
2383 * Powerful demons & undead can turn a mindcrafter's
2384 * attacks back on them
2386 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2387 (r_ptr->level > p_ptr->lev / 2) &&
2391 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2392 (seen ? "%^s's corrupted mind backlashes your attack!" :
2393 "%^ss corrupted mind backlashes your attack!")), m_name);
2396 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2398 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2402 /* Injure +/- confusion */
2403 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2404 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2405 if (one_in_(4) && !CHECK_MULTISHADOW())
2407 switch (randint1(4))
2410 set_confused(p_ptr->confused + 3 + randint1(dam));
2413 set_stun(p_ptr->stun + randint1(dam));
2417 if (r_ptr->flags3 & RF3_NO_FEAR)
2418 note = _("には効果がなかった。", " is unaffected.");
2420 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2424 if (!p_ptr->free_act)
2425 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2434 if ((dam > 0) && one_in_(4))
2436 switch (randint1(4))
2439 do_conf = 3 + randint1(dam);
2442 do_stun = 3 + randint1(dam);
2445 do_fear = 3 + randint1(dam);
2448 note = _("は眠り込んでしまった!", " falls asleep!");
2449 do_sleep = 3 + randint1(dam);
2454 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2460 if (seen) obvious = TRUE;
2462 if (r_ptr->flagsr & RFR_RES_ALL)
2464 note = _("には完全な耐性がある!", " is immune.");
2466 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2469 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2472 note = _("には完全な耐性がある!", " is immune.");
2474 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2475 (r_ptr->flags3 & RF3_ANIMAL) ||
2476 (r_ptr->level > randint1(3 * dam)))
2478 note = _("には耐性がある!", " resists!");
2482 * Powerful demons & undead can turn a mindcrafter's
2483 * attacks back on them
2485 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2486 (r_ptr->level > p_ptr->lev / 2) &&
2490 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2491 (seen ? "%^s's corrupted mind backlashes your attack!" :
2492 "%^ss corrupted mind backlashes your attack!")), m_name);
2494 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2496 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2500 /* Injure + mana drain */
2501 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2502 if (!CHECK_MULTISHADOW())
2504 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2505 p_ptr->csp -= damroll(5, dam) / 2;
2506 if (p_ptr->csp < 0) p_ptr->csp = 0;
2507 p_ptr->redraw |= PR_MANA;
2508 p_ptr->window |= (PW_SPELL);
2510 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2517 int b = damroll(5, dam) / 4;
2518 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2519 cptr msg = _("あなたは%sの苦痛を%sに変換した!",
2520 (seen ? "You convert %s's pain into %s!" :
2521 "You convert %ss pain into %s!"));
2522 msg_format(msg, m_name, str);
2524 b = MIN(p_ptr->msp, p_ptr->csp + b);
2526 p_ptr->redraw |= PR_MANA;
2527 p_ptr->window |= (PW_SPELL);
2529 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2533 case GF_TELEKINESIS:
2535 if (seen) obvious = TRUE;
2537 if (r_ptr->flagsr & RFR_RES_ALL)
2539 note = _("には完全な耐性がある!", " is immune.");
2541 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2546 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2551 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2553 /* Attempt a saving throw */
2554 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2555 (r_ptr->level > 5 + randint1(dam)))
2559 /* No obvious effect */
2565 /* Psycho-spear -- powerful magic missile */
2568 if (seen) obvious = TRUE;
2570 if (r_ptr->flagsr & RFR_RES_ALL)
2572 note = _("には完全な耐性がある!", " is immune.");
2574 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2580 /* Meteor -- powerful magic missile */
2583 if (seen) obvious = TRUE;
2585 if (r_ptr->flagsr & RFR_RES_ALL)
2587 note = _("には完全な耐性がある!", " is immune.");
2589 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2597 if (!is_hostile(m_ptr)) break;
2599 if (seen) obvious = TRUE;
2601 if (r_ptr->flagsr & RFR_RES_ALL)
2603 note = _("には効果がなかった!", " is immune.");
2605 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2608 /* Attempt a saving throw */
2609 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2610 (r_ptr->flags3 & RF3_NO_CONF) ||
2611 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2613 /* Memorize a flag */
2614 if (r_ptr->flags3 & RF3_NO_CONF)
2616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2623 * Powerful demons & undead can turn a mindcrafter's
2624 * attacks back on them
2626 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2627 (r_ptr->level > p_ptr->lev / 2) &&
2631 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2632 (seen ? "%^s's corrupted mind backlashes your attack!" :
2633 "%^ss corrupted mind backlashes your attack!")), m_name);
2636 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2638 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2642 /* Confuse, stun, terrify */
2643 switch (randint1(4))
2646 set_stun(p_ptr->stun + dam / 2);
2649 set_confused(p_ptr->confused + dam / 2);
2653 if (r_ptr->flags3 & RF3_NO_FEAR)
2654 note = _("には効果がなかった。", " is unaffected.");
2656 set_afraid(p_ptr->afraid + dam);
2663 /* No obvious effect */
2664 note = _("には効果がなかった。", " is unaffected.");
2670 if ((dam > 29) && (randint1(100) < dam))
2672 note = _("があなたに隷属した。", " is in your thrall!");
2677 switch (randint1(4))
2691 /* No "real" damage */
2698 /* Ice -- Cold + Cuts + Stun */
2701 if (seen) obvious = TRUE;
2703 if (r_ptr->flagsr & RFR_RES_ALL)
2705 note = _("には完全な耐性がある!", " is immune.");
2707 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2710 do_stun = (randint1(15) + 1) / (r + 1);
2711 if (r_ptr->flagsr & RFR_IM_COLD)
2713 note = _("にはかなり耐性がある!", " resists a lot.");
2715 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2717 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2719 note = _("はひどい痛手をうけた。", " is hit hard.");
2721 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2730 if (seen) obvious = TRUE;
2732 if (r_ptr->flagsr & RFR_RES_ALL)
2734 note = _("には完全な耐性がある!", " is immune.");
2736 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2739 if (!monster_living(r_ptr))
2741 if (is_original_ap_and_seen(m_ptr))
2743 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2744 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2745 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2747 note = _("には効果がなかった。", " is unaffected.");
2751 else do_time = (dam+7)/8;
2759 if (seen) obvious = TRUE;
2761 if (r_ptr->flagsr & RFR_RES_ALL)
2763 note = _("には完全な耐性がある!", " is immune.");
2765 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2768 if (!monster_living(r_ptr))
2770 if (is_original_ap_and_seen(m_ptr))
2772 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2773 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2774 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2776 note = _("には完全な耐性がある!", " is immune.");
2780 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2781 (randint1(888) != 666)) ||
2782 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2783 randint1(100) != 66))
2785 note = _("には耐性がある!", " resists!");
2793 /* Polymorph monster (Use "dam" as "power") */
2796 if (seen) obvious = TRUE;
2798 if (r_ptr->flagsr & RFR_RES_ALL)
2800 note = _("には効果がなかった。", " is unaffected.");
2802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2805 /* Attempt to polymorph (see below) */
2808 /* Powerful monsters can resist */
2809 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2810 (r_ptr->flags1 & RF1_QUESTOR) ||
2811 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2813 note = _("には効果がなかった。", " is unaffected.");
2818 /* No "real" damage */
2825 /* Clone monsters (Ignore "dam") */
2828 if (seen) obvious = TRUE;
2830 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2832 note = _("には効果がなかった。", " is unaffected.");
2837 m_ptr->hp = m_ptr->maxhp;
2839 /* Attempt to clone. */
2840 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2842 note = _("が分裂した!", " spawns!");
2846 /* No "real" damage */
2853 /* Heal Monster (use "dam" as amount of healing) */
2856 if (seen) obvious = TRUE;
2859 (void)set_monster_csleep(c_ptr->m_idx, 0);
2861 if (m_ptr->maxhp < m_ptr->max_maxhp)
2863 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2864 m_ptr->maxhp = m_ptr->max_maxhp;
2869 /* Redraw (later) if needed */
2870 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2871 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2879 if (seen) obvious = TRUE;
2882 (void)set_monster_csleep(c_ptr->m_idx, 0);
2883 if (MON_STUNNED(m_ptr))
2885 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2886 (void)set_monster_stunned(c_ptr->m_idx, 0);
2888 if (MON_CONFUSED(m_ptr))
2890 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2891 (void)set_monster_confused(c_ptr->m_idx, 0);
2893 if (MON_MONFEAR(m_ptr))
2895 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2896 (void)set_monster_monfear(c_ptr->m_idx, 0);
2900 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2903 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2907 chg_virtue(V_VITALITY, 1);
2909 if (r_ptr->flags1 & RF1_UNIQUE)
2910 chg_virtue(V_INDIVIDUALISM, 1);
2912 if (is_friendly(m_ptr))
2913 chg_virtue(V_HONOUR, 1);
2914 else if (!(r_ptr->flags3 & RF3_EVIL))
2916 if (r_ptr->flags3 & RF3_GOOD)
2917 chg_virtue(V_COMPASSION, 2);
2919 chg_virtue(V_COMPASSION, 1);
2922 if (r_ptr->flags3 & RF3_ANIMAL)
2923 chg_virtue(V_NATURE, 1);
2926 if (m_ptr->r_idx == MON_LEPER)
2929 if (!who) chg_virtue(V_COMPASSION, 5);
2932 /* Redraw (later) if needed */
2933 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2934 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2937 note = _("は体力を回復したようだ。", " looks healthier.");
2939 /* No "real" damage */
2945 /* Speed Monster (Ignore "dam") */
2948 if (seen) obvious = TRUE;
2951 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2953 note = _("の動きが速くなった。", " starts moving faster.");
2958 if (r_ptr->flags1 & RF1_UNIQUE)
2959 chg_virtue(V_INDIVIDUALISM, 1);
2960 if (is_friendly(m_ptr))
2961 chg_virtue(V_HONOUR, 1);
2964 /* No "real" damage */
2970 /* Slow Monster (Use "dam" as "power") */
2973 if (seen) obvious = TRUE;
2975 if (r_ptr->flagsr & RFR_RES_ALL)
2977 note = _("には効果がなかった。", " is unaffected.");
2979 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2982 /* Powerful monsters can resist */
2983 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2984 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2986 note = _("には効果がなかった。", " is unaffected.");
2990 /* Normal monsters slow down */
2993 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2995 note = _("の動きが遅くなった。", " starts moving slower.");
2999 /* No "real" damage */
3005 /* Sleep (Use "dam" as "power") */
3008 if (seen) obvious = TRUE;
3010 if (r_ptr->flagsr & RFR_RES_ALL)
3012 note = _("には効果がなかった。", " is unaffected.");
3014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3017 /* Attempt a saving throw */
3018 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3019 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3020 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3022 /* Memorize a flag */
3023 if (r_ptr->flags3 & RF3_NO_SLEEP)
3025 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3027 /* No obvious effect */
3028 note = _("には効果がなかった。", " is unaffected.");
3033 /* Go to sleep (much) later */
3034 note = _("は眠り込んでしまった!", " falls asleep!");
3038 /* No "real" damage */
3044 /* Sleep (Use "dam" as "power") */
3045 case GF_STASIS_EVIL:
3047 if (seen) obvious = TRUE;
3049 if (r_ptr->flagsr & RFR_RES_ALL)
3051 note = _("には効果がなかった!", " is immune.");
3053 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3056 /* Attempt a saving throw */
3057 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3058 !(r_ptr->flags3 & RF3_EVIL) ||
3059 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3061 note = _("には効果がなかった。", " is unaffected.");
3066 /* Go to sleep (much) later */
3067 note = _("は動けなくなった!", " is suspended!");
3071 /* No "real" damage */
3076 /* Sleep (Use "dam" as "power") */
3079 if (seen) obvious = TRUE;
3081 if (r_ptr->flagsr & RFR_RES_ALL)
3083 note = _("には効果がなかった。", " is unaffected.");
3085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3088 /* Attempt a saving throw */
3089 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3090 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3092 note = _("には効果がなかった。", " is unaffected.");
3097 /* Go to sleep (much) later */
3098 note = _("は動けなくなった!", " is suspended!");
3102 /* No "real" damage */
3111 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3112 vir = virtue_number(V_HARMONY);
3115 dam += p_ptr->virtues[vir-1]/10;
3118 vir = virtue_number(V_INDIVIDUALISM);
3121 dam -= p_ptr->virtues[vir-1]/20;
3124 if (seen) obvious = TRUE;
3126 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3128 note = _("には効果がなかった。", " is unaffected.");
3130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3134 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3137 /* Attempt a saving throw */
3138 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3139 (r_ptr->flags3 & RF3_NO_CONF) ||
3140 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3141 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3143 /* Memorize a flag */
3144 if (r_ptr->flags3 & RF3_NO_CONF)
3146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3150 /* No obvious effect */
3151 note = _("には効果がなかった。", " is unaffected.");
3154 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3156 else if (p_ptr->cursed & TRC_AGGRAVATE)
3158 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3159 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3163 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
3166 chg_virtue(V_INDIVIDUALISM, -1);
3167 if (r_ptr->flags3 & RF3_ANIMAL)
3168 chg_virtue(V_NATURE, 1);
3171 /* No "real" damage */
3176 /* Control undead */
3177 case GF_CONTROL_UNDEAD:
3180 if (seen) obvious = TRUE;
3182 vir = virtue_number(V_UNLIFE);
3185 dam += p_ptr->virtues[vir-1]/10;
3188 vir = virtue_number(V_INDIVIDUALISM);
3191 dam -= p_ptr->virtues[vir-1]/20;
3194 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3196 note = _("には効果がなかった。", " is unaffected.");
3198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3202 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3205 /* Attempt a saving throw */
3206 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3207 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3208 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3209 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3211 /* No obvious effect */
3212 note = _("には効果がなかった。", " is unaffected.");
3214 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3216 else if (p_ptr->cursed & TRC_AGGRAVATE)
3218 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3219 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3223 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3227 /* No "real" damage */
3233 case GF_CONTROL_DEMON:
3236 if (seen) obvious = TRUE;
3238 vir = virtue_number(V_UNLIFE);
3241 dam += p_ptr->virtues[vir-1]/10;
3244 vir = virtue_number(V_INDIVIDUALISM);
3247 dam -= p_ptr->virtues[vir-1]/20;
3250 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3252 note = _("には効果がなかった。", " is unaffected.");
3254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3258 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3261 /* Attempt a saving throw */
3262 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3263 (!(r_ptr->flags3 & RF3_DEMON)) ||
3264 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3265 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3267 /* No obvious effect */
3268 note = _("には効果がなかった。", " is unaffected.");
3271 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3273 else if (p_ptr->cursed & TRC_AGGRAVATE)
3275 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3276 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3280 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
3284 /* No "real" damage */
3290 case GF_CONTROL_ANIMAL:
3294 if (seen) obvious = TRUE;
3296 vir = virtue_number(V_NATURE);
3299 dam += p_ptr->virtues[vir-1]/10;
3302 vir = virtue_number(V_INDIVIDUALISM);
3305 dam -= p_ptr->virtues[vir-1]/20;
3308 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3310 note = _("には効果がなかった。", " is unaffected.");
3312 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3316 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3319 /* Attempt a saving throw */
3320 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3321 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3322 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3323 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3324 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3326 /* Memorize a flag */
3327 if (r_ptr->flags3 & (RF3_NO_CONF))
3329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3333 /* No obvious effect */
3334 note = _("には効果がなかった。", " is unaffected.");
3337 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3339 else if (p_ptr->cursed & TRC_AGGRAVATE)
3341 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3342 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3346 note = _("はなついた。", " is tamed!");
3349 if (r_ptr->flags3 & RF3_ANIMAL)
3350 chg_virtue(V_NATURE, 1);
3353 /* No "real" damage */
3359 case GF_CONTROL_LIVING:
3363 vir = virtue_number(V_UNLIFE);
3364 if (seen) obvious = TRUE;
3366 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
3367 vir = virtue_number(V_UNLIFE);
3370 dam -= p_ptr->virtues[vir-1]/10;
3373 vir = virtue_number(V_INDIVIDUALISM);
3376 dam -= p_ptr->virtues[vir-1]/20;
3379 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
3380 if (dam < 1) dam = 1;
3381 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
3382 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3384 note = _("には効果がなかった。", " is unaffected.");
3386 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3390 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3393 /* Attempt a saving throw */
3394 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3395 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3396 !monster_living(r_ptr) ||
3397 ((r_ptr->level+10) > randint1(dam)))
3400 /* No obvious effect */
3401 note = _("には効果がなかった。", " is unaffected.");
3404 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3406 else if (p_ptr->cursed & TRC_AGGRAVATE)
3408 note = _("はあなたに敵意を抱いている!", " hates you too much!");
3409 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3413 note = _("を支配した。", " is tamed!");
3416 if (r_ptr->flags3 & RF3_ANIMAL)
3417 chg_virtue(V_NATURE, 1);
3420 /* No "real" damage */
3425 /* Confusion (Use "dam" as "power") */
3428 if (seen) obvious = TRUE;
3430 if (r_ptr->flagsr & RFR_RES_ALL)
3432 note = _("には効果がなかった。", " is unaffected.");
3434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3437 /* Get confused later */
3438 do_conf = damroll(3, (dam / 2)) + 1;
3440 /* Attempt a saving throw */
3441 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3442 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3443 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3445 /* Memorize a flag */
3446 if (r_ptr->flags3 & (RF3_NO_CONF))
3448 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3454 /* No obvious effect */
3455 note = _("には効果がなかった。", " is unaffected.");
3459 /* No "real" damage */
3466 if (seen) obvious = TRUE;
3468 if (r_ptr->flagsr & RFR_RES_ALL)
3470 note = _("には効果がなかった。", " is unaffected.");
3472 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3475 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3477 /* Attempt a saving throw */
3478 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3479 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3484 /* No obvious effect */
3485 note = _("には効果がなかった。", " is unaffected.");
3489 /* No "real" damage */
3497 /* Lite, but only hurts susceptible creatures */
3505 if (r_ptr->flagsr & RFR_RES_ALL)
3511 if (r_ptr->flags3 & (RF3_HURT_LITE))
3513 /* Obvious effect */
3514 if (seen) obvious = TRUE;
3516 /* Memorize the effects */
3517 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3519 /* Special effect */
3520 note = _("は光に身をすくめた!", " cringes from the light!");
3521 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3524 /* Normally no damage */
3536 /* Lite -- opposite of Dark */
3539 if (seen) obvious = TRUE;
3541 if (r_ptr->flagsr & RFR_RES_ALL)
3543 note = _("には完全な耐性がある!", " is immune.");
3545 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3548 if (r_ptr->flagsr & RFR_RES_LITE)
3550 note = _("には耐性がある!", " resists!");
3551 dam *= 2; dam /= (randint1(6)+6);
3552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3554 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3557 note = _("は光に身をすくめた!", " cringes from the light!");
3558 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3565 /* Dark -- opposite of Lite */
3568 if (seen) obvious = TRUE;
3570 if (r_ptr->flagsr & RFR_RES_ALL)
3572 note = _("には完全な耐性がある!", " is immune.");
3574 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3577 if (r_ptr->flagsr & RFR_RES_DARK)
3579 note = _("には耐性がある!", " resists!");
3580 dam *= 2; dam /= (randint1(6)+6);
3581 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3590 if (r_ptr->flagsr & RFR_RES_ALL)
3595 /* Hurt by rock remover */
3596 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3599 if (seen) obvious = TRUE;
3601 /* Memorize the effects */
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3604 /* Cute little message */
3605 note = _("の皮膚がただれた!", " loses some skin!");
3606 note_dies = _("はドロドロに溶けた!", " dissolves!");
3609 /* Usually, ignore the effects */
3620 /* Teleport undead (Use "dam" as "power") */
3621 case GF_AWAY_UNDEAD:
3623 /* Only affect undead */
3624 if (r_ptr->flags3 & (RF3_UNDEAD))
3626 bool resists_tele = FALSE;
3628 if (r_ptr->flagsr & RFR_RES_TELE)
3630 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3633 note = _("には効果がなかった。", " is unaffected.");
3634 resists_tele = TRUE;
3636 else if (r_ptr->level > randint1(100))
3638 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3639 note = _("には耐性がある!", " resists!");
3640 resists_tele = TRUE;
3646 if (seen) obvious = TRUE;
3647 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3659 /* No "real" damage */
3665 /* Teleport evil (Use "dam" as "power") */
3668 /* Only affect evil */
3669 if (r_ptr->flags3 & (RF3_EVIL))
3671 bool resists_tele = FALSE;
3673 if (r_ptr->flagsr & RFR_RES_TELE)
3675 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3677 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3678 note = _("には効果がなかった。", " is unaffected.");
3679 resists_tele = TRUE;
3681 else if (r_ptr->level > randint1(100))
3683 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3684 note = _("には耐性がある!", " resists!");
3685 resists_tele = TRUE;
3691 if (seen) obvious = TRUE;
3692 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3704 /* No "real" damage */
3710 /* Teleport monster (Use "dam" as "power") */
3713 bool resists_tele = FALSE;
3714 if (r_ptr->flagsr & RFR_RES_TELE)
3716 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3719 note = _("には効果がなかった。", " is unaffected.");
3720 resists_tele = TRUE;
3722 else if (r_ptr->level > randint1(100))
3724 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3725 note = _("には耐性がある!", " resists!");
3726 resists_tele = TRUE;
3733 if (seen) obvious = TRUE;
3735 /* Prepare to teleport */
3739 /* No "real" damage */
3745 /* Turn undead (Use "dam" as "power") */
3746 case GF_TURN_UNDEAD:
3748 if (r_ptr->flagsr & RFR_RES_ALL)
3753 /* Only affect undead */
3754 if (r_ptr->flags3 & (RF3_UNDEAD))
3757 if (seen) obvious = TRUE;
3759 /* Learn about type */
3760 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3762 /* Apply some fear */
3763 do_fear = damroll(3, (dam / 2)) + 1;
3765 /* Attempt a saving throw */
3766 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3768 /* No obvious effect */
3769 note = _("には効果がなかった。", " is unaffected.");
3782 /* No "real" damage */
3788 /* Turn evil (Use "dam" as "power") */
3791 if (r_ptr->flagsr & RFR_RES_ALL)
3796 /* Only affect evil */
3797 if (r_ptr->flags3 & (RF3_EVIL))
3800 if (seen) obvious = TRUE;
3802 /* Learn about type */
3803 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3805 /* Apply some fear */
3806 do_fear = damroll(3, (dam / 2)) + 1;
3808 /* Attempt a saving throw */
3809 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3811 /* No obvious effect */
3812 note = _("には効果がなかった。", " is unaffected.");
3825 /* No "real" damage */
3831 /* Turn monster (Use "dam" as "power") */
3834 if (r_ptr->flagsr & RFR_RES_ALL)
3840 if (seen) obvious = TRUE;
3842 /* Apply some fear */
3843 do_fear = damroll(3, (dam / 2)) + 1;
3845 /* Attempt a saving throw */
3846 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3847 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3848 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3850 /* No obvious effect */
3851 note = _("には効果がなかった。", " is unaffected.");
3856 /* No "real" damage */
3863 case GF_DISP_UNDEAD:
3865 if (r_ptr->flagsr & RFR_RES_ALL)
3871 /* Only affect undead */
3872 if (r_ptr->flags3 & (RF3_UNDEAD))
3875 if (seen) obvious = TRUE;
3877 /* Learn about type */
3878 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3881 note = _("は身震いした。", " shudders.");
3882 note_dies = _("はドロドロに溶けた!", " dissolves!");
3902 if (r_ptr->flagsr & RFR_RES_ALL)
3908 /* Only affect evil */
3909 if (r_ptr->flags3 & (RF3_EVIL))
3912 if (seen) obvious = TRUE;
3914 /* Learn about type */
3915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3918 note = _("は身震いした。", " shudders.");
3919 note_dies = _("はドロドロに溶けた!", " dissolves!");
3938 if (r_ptr->flagsr & RFR_RES_ALL)
3944 /* Only affect good */
3945 if (r_ptr->flags3 & (RF3_GOOD))
3948 if (seen) obvious = TRUE;
3950 /* Learn about type */
3951 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3954 note = _("は身震いした。", " shudders.");
3955 note_dies = _("はドロドロに溶けた!", " dissolves!");
3972 case GF_DISP_LIVING:
3974 if (r_ptr->flagsr & RFR_RES_ALL)
3980 /* Only affect non-undead */
3981 if (monster_living(r_ptr))
3984 if (seen) obvious = TRUE;
3987 note = _("は身震いした。", " shudders.");
3988 note_dies = _("はドロドロに溶けた!", " dissolves!");
4007 if (r_ptr->flagsr & RFR_RES_ALL)
4013 /* Only affect demons */
4014 if (r_ptr->flags3 & (RF3_DEMON))
4017 if (seen) obvious = TRUE;
4019 /* Learn about type */
4020 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4023 note = _("は身震いした。", " shudders.");
4024 note_dies = _("はドロドロに溶けた!", " dissolves!");
4040 /* Dispel monster */
4043 if (r_ptr->flagsr & RFR_RES_ALL)
4050 if (seen) obvious = TRUE;
4053 note = _("は身震いした。", " shudders.");
4054 note_dies = _("はドロドロに溶けた!", " dissolves!");
4061 if (seen) obvious = TRUE;
4063 if (r_ptr->flagsr & RFR_RES_ALL)
4065 note = _("には完全な耐性がある!", " is immune.");
4067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4071 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4075 /* Heal the monster */
4076 if (caster_ptr->hp < caster_ptr->maxhp)
4079 caster_ptr->hp += dam;
4080 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4082 /* Redraw (later) if needed */
4083 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4084 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4086 /* Special message */
4089 /* Get the monster name */
4090 monster_desc(killer, caster_ptr, 0);
4091 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
4098 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
4099 (void)hp_player(dam);
4104 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4113 if (seen) obvious = TRUE;
4115 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4117 if (r_ptr->flagsr & RFR_RES_ALL)
4119 note = _("には完全な耐性がある!", " is immune.");
4121 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4125 /* Attempt a saving throw */
4126 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4127 (r_ptr->flags3 & RF3_NO_CONF) ||
4128 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4130 /* Memorize a flag */
4131 if (r_ptr->flags3 & (RF3_NO_CONF))
4133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4135 note = _("には効果がなかった。", " is unaffected.");
4138 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4140 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4141 note = _("には完全な耐性がある!", " is immune.");
4144 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4147 note = _("には耐性がある。", " resists.");
4152 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4153 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4155 if (who > 0) do_conf = randint0(4) + 4;
4156 else do_conf = randint0(8) + 8;
4162 case GF_BRAIN_SMASH:
4164 if (seen) obvious = TRUE;
4166 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
4168 if (r_ptr->flagsr & RFR_RES_ALL)
4170 note = _("には完全な耐性がある!", " is immune.");
4172 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4176 /* Attempt a saving throw */
4177 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4178 (r_ptr->flags3 & RF3_NO_CONF) ||
4179 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
4181 /* Memorize a flag */
4182 if (r_ptr->flags3 & (RF3_NO_CONF))
4184 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4186 note = _("には効果がなかった。", " is unaffected.");
4189 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
4191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4192 note = _("には完全な耐性がある!", " is immune.");
4195 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
4197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
4198 note = _("には耐性がある!", " resists!");
4203 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
4204 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
4208 do_conf = randint0(4) + 4;
4209 do_stun = randint0(4) + 4;
4213 do_conf = randint0(8) + 8;
4214 do_stun = randint0(8) + 8;
4216 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
4224 if (seen) obvious = TRUE;
4226 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
4228 if (r_ptr->flagsr & RFR_RES_ALL)
4230 note = _("には完全な耐性がある!", " is immune.");
4232 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4236 /* Attempt a saving throw */
4237 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4239 note = _("には効果がなかった。", " is unaffected.");
4248 if (seen) obvious = TRUE;
4250 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
4252 if (r_ptr->flagsr & RFR_RES_ALL)
4254 note = _("には完全な耐性がある!", " is immune.");
4256 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4260 /* Attempt a saving throw */
4261 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4263 note = _("には効果がなかった。", " is unaffected.");
4272 if (seen) obvious = TRUE;
4274 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
4276 if (r_ptr->flagsr & RFR_RES_ALL)
4278 note = _("には完全な耐性がある!", " is immune.");
4280 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4284 /* Attempt a saving throw */
4285 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
4287 note = _("には効果がなかった。", " is unaffected.");
4296 if (seen) obvious = TRUE;
4299 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
4300 "You point at %s, screaming the word, 'DIE!'."), m_name);
4302 if (r_ptr->flagsr & RFR_RES_ALL)
4304 note = _("には完全な耐性がある!", " is immune.");
4306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4310 /* Attempt a saving throw */
4311 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
4313 note = _("には効果がなかった。", " is unaffected.");
4322 if (seen) obvious = TRUE;
4324 if (r_ptr->flagsr & RFR_RES_ALL)
4326 note = _("には完全な耐性がある!", " is immune.");
4328 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4332 if (r_ptr->flags1 & RF1_UNIQUE)
4334 note = _("には効果がなかった。", " is unaffected.");
4339 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
4340 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
4342 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
4344 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
4348 note = _("は耐性を持っている!", "resists!");
4355 /* Capture monster */
4359 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
4360 (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)
4362 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
4367 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
4368 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
4369 nokori_hp = m_ptr->maxhp * 3 / 10;
4371 nokori_hp = m_ptr->maxhp * 3 / 20;
4373 if (m_ptr->hp >= nokori_hp)
4375 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
4378 else if (m_ptr->hp < randint0(nokori_hp))
4380 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
4381 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
4382 cap_mon = m_ptr->r_idx;
4383 cap_mspeed = m_ptr->mspeed;
4385 cap_maxhp = m_ptr->max_maxhp;
4386 cap_nickname = m_ptr->nickname; /* Quark transfer */
4387 if (c_ptr->m_idx == p_ptr->riding)
4389 if (rakuba(-1, FALSE))
4391 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
4395 delete_monster_idx(c_ptr->m_idx);
4401 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
4407 /* Attack (Use "dam" as attack type) */
4410 /* Return this monster's death */
4411 return py_attack(y, x, dam);
4414 /* Sleep (Use "dam" as "power") */
4420 if (seen) obvious = TRUE;
4422 if (r_ptr->flagsr & RFR_RES_ALL)
4424 note = _("には効果がなかった。", " is unaffected.");
4426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4429 if (r_ptr->flags2 & RF2_EMPTY_MIND)
4431 note = _("には効果がなかった。", " is unaffected.");
4434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
4437 if (MON_CSLEEP(m_ptr))
4439 note = _("には効果がなかった。", " is unaffected.");
4445 if (one_in_(5)) effect = 1;
4446 else if (one_in_(4)) effect = 2;
4447 else if (one_in_(3)) effect = 3;
4452 /* Powerful monsters can resist */
4453 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4454 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4456 note = _("には効果がなかった。", " is unaffected.");
4460 /* Normal monsters slow down */
4463 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
4465 note = _("の動きが遅くなった。", " starts moving slower.");
4470 else if (effect == 2)
4472 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4474 /* Attempt a saving throw */
4475 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4476 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4481 /* No obvious effect */
4482 note = _("には効果がなかった。", " is unaffected.");
4487 else if (effect == 3)
4489 /* Attempt a saving throw */
4490 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4491 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4492 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4494 /* Memorize a flag */
4495 if (r_ptr->flags3 & RF3_NO_SLEEP)
4497 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4500 /* No obvious effect */
4501 note = _("には効果がなかった。", " is unaffected.");
4506 /* Go to sleep (much) later */
4507 note = _("は眠り込んでしまった!", " falls asleep!");
4514 note = _("には効果がなかった。", " is unaffected.");
4517 /* No "real" damage */
4525 if (seen) obvious = TRUE;
4527 if (r_ptr->flagsr & RFR_RES_ALL)
4529 note = _("には効果がなかった。", " is unaffected.");
4531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4535 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4537 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4538 chg_virtue(V_VITALITY, -1);
4548 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4550 if (r_ptr->flags3 & (RF3_HURT_LITE))
4552 /* Obvious effect */
4553 if (seen) obvious = TRUE;
4555 /* Memorize the effects */
4556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4558 /* Special effect */
4559 note = _("は光に身をすくめた!", " cringes from the light!");
4560 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4563 /* Normally no damage */
4570 photo = m_ptr->r_idx;
4577 case GF_BLOOD_CURSE:
4579 if (seen) obvious = TRUE;
4581 if (r_ptr->flagsr & RFR_RES_ALL)
4583 note = _("には完全な耐性がある!", " is immune.");
4585 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4593 bool success = FALSE;
4594 if (seen) obvious = TRUE;
4596 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4598 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4599 if (dam < 1) dam = 1;
4601 /* No need to tame your pet */
4604 note = _("の動きが速くなった。", " starts moving faster.");
4605 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4609 /* Attempt a saving throw */
4610 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4611 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4612 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4613 (p_ptr->cursed & TRC_AGGRAVATE) ||
4614 ((r_ptr->level+10) > randint1(dam)))
4617 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4621 note = _("を支配した。", " is tamed!");
4623 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4625 /* Learn about type */
4626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4633 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4635 do_fear = randint1(90)+10;
4637 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4640 /* No "real" damage */
4647 if (seen) obvious = TRUE;
4649 if (r_ptr->flagsr & RFR_RES_ALL)
4651 note = _("には完全な耐性がある!", " is immune.");
4653 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4657 /* Attempt a saving throw */
4658 if (randint0(100 + dam) < (r_ptr->level + 50))
4660 note = _("には効果がなかった。", " is unaffected.");
4680 /* Absolutely no effect */
4681 if (skipped) return (FALSE);
4683 /* "Unique" monsters cannot be polymorphed */
4684 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4686 /* Quest monsters cannot be polymorphed */
4687 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4689 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4691 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4692 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4694 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4699 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4700 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4703 /* Modify the damage */
4705 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4706 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4708 /* Check for death */
4709 if (dam > m_ptr->hp)
4711 /* Extract method of death */
4716 /* Sound and Impact resisters never stun */
4718 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4719 !(r_ptr->flags3 & RF3_NO_STUN))
4722 if (seen) obvious = TRUE;
4725 if (MON_STUNNED(m_ptr))
4727 note = _("はひどくもうろうとした。", " is more dazed.");
4728 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4732 note = _("はもうろうとした。", " is dazed.");
4737 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4743 /* Confusion and Chaos resisters (and sleepers) never confuse */
4745 !(r_ptr->flags3 & RF3_NO_CONF) &&
4746 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4749 if (seen) obvious = TRUE;
4751 /* Already partially confused */
4752 if (MON_CONFUSED(m_ptr))
4754 note = _("はさらに混乱したようだ。", " looks more confused.");
4755 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4758 /* Was not confused */
4761 note = _("は混乱したようだ。", " looks confused.");
4765 /* Apply confusion */
4766 (void)set_monster_confused(c_ptr->m_idx, tmp);
4775 if (seen) obvious = TRUE;
4777 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4781 note = _("は弱くなったようだ。", " seems weakened.");
4782 m_ptr->maxhp -= do_time;
4783 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4788 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4789 if (do_poly && (randint1(90) > r_ptr->level))
4791 if (polymorph_monster(y, x))
4794 if (seen) obvious = TRUE;
4796 /* Monster polymorphs */
4797 note = _("が変身した!", " changes!");
4799 /* Turn off the damage */
4805 note = _("には効果がなかった。", " is unaffected.");
4808 /* Hack -- Get new monster */
4809 m_ptr = &m_list[c_ptr->m_idx];
4811 /* Hack -- Get new race */
4812 r_ptr = &r_info[m_ptr->r_idx];
4815 /* Handle "teleport" */
4819 if (seen) obvious = TRUE;
4822 note = _("が消え去った!", " disappears!");
4824 if (!who) chg_virtue(V_VALOUR, -1);
4827 teleport_away(c_ptr->m_idx, do_dist,
4828 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4830 /* Hack -- get new location */
4834 /* Hack -- get new grid */
4835 c_ptr = &cave[y][x];
4842 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4849 if (typ == GF_DRAIN_MANA)
4851 /* Drain mana does nothing */
4854 /* If another monster did the damage, hurt the monster by hand */
4857 /* Redraw (later) if needed */
4858 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4859 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4861 /* Wake the monster up */
4862 (void)set_monster_csleep(c_ptr->m_idx, 0);
4864 /* Hurt the monster */
4872 if (is_pet(m_ptr) && !(m_ptr->ml))
4875 /* Give detailed messages if destroyed */
4878 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4881 msg_format("%^s%s", m_name, note);
4889 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4891 /* Generate treasure, etc */
4892 monster_death(c_ptr->m_idx, FALSE);
4894 /* Delete the monster */
4895 delete_monster_idx(c_ptr->m_idx);
4899 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4903 /* Damaged monster */
4906 /* Give detailed messages if visible or destroyed */
4907 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4909 /* Hack -- Pain message */
4912 message_pain(c_ptr->m_idx, dam);
4919 /* Hack -- handle sleep */
4920 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4924 else if (heal_leper)
4926 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4928 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4932 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4933 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4936 delete_monster_idx(c_ptr->m_idx);
4939 /* If the player did it, give him experience, check fear */
4944 /* Hurt the monster, check for fear and death */
4945 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4950 /* Damaged monster */
4953 /* HACK - anger the monster before showing the sleep message */
4954 if (do_sleep) anger_monster(m_ptr);
4956 /* Give detailed messages if visible or destroyed */
4957 if (note && seen_msg)
4958 msg_format(_("%s%s", "%^s%s"), m_name, note);
4960 /* Hack -- Pain message */
4961 else if (known && (dam || !do_fear))
4963 message_pain(c_ptr->m_idx, dam);
4966 /* Anger monsters */
4967 if (((dam > 0) || get_angry) && !do_sleep)
4968 anger_monster(m_ptr);
4971 if ((fear || do_fear) && seen)
4977 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4980 /* Hack -- handle sleep */
4981 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4985 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4987 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4991 switch (randint1(28))
4996 msg_print(_("地面が揺れた...", "The ground trembles..."));
4997 earthquake(ty, tx, 4 + randint0(4));
4998 if (!one_in_(6)) break;
5000 case 3: case 4: case 5: case 6:
5003 int dam = damroll(10, 10);
5004 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
5006 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
5007 if (!one_in_(6)) break;
5012 msg_print(_("空間が歪んだ!", "Space warps about you!"));
5014 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
5015 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
5016 if (!one_in_(6)) break;
5018 case 9: case 10: case 11:
5019 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
5020 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
5021 if (!one_in_(6)) break;
5022 case 12: case 13: case 14: case 15: case 16:
5023 aggravate_monsters(0);
5024 if (!one_in_(6)) break;
5026 count += activate_hi_summon(ty, tx, TRUE);
5027 if (!one_in_(6)) break;
5028 case 19: case 20: case 21: case 22:
5030 bool pet = !one_in_(3);
5031 u32b mode = PM_ALLOW_GROUP;
5033 if (pet) mode |= PM_FORCE_PET;
5034 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
5036 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
5037 if (!one_in_(6)) break;
5039 case 23: case 24: case 25:
5040 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
5041 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
5043 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
5044 else lose_exp(p_ptr->exp / 16);
5045 if (!one_in_(6)) break;
5046 case 26: case 27: case 28:
5055 (void)do_dec_stat(i);
5064 (void)do_dec_stat(randint0(6));
5073 if (p_ptr->inside_battle)
5075 p_ptr->health_who = c_ptr->m_idx;
5076 p_ptr->redraw |= (PR_HEALTH);
5080 /* XXX XXX XXX Verify this code */
5082 /* Update the monster */
5083 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
5085 /* Redraw the monster grid */
5089 /* Update monster recall window */
5090 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
5093 p_ptr->window |= (PW_MONSTER);
5096 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
5100 if (!(flg & PROJECT_NO_HANGEKI))
5102 set_target(m_ptr, monster_target_y, monster_target_x);
5105 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
5107 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
5111 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
5113 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
5114 rakubadam_m = (dam > 200) ? 200 : dam;
5123 /* Get local object */
5126 /* Prepare to make a Blade of Chaos */
5127 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
5129 q_ptr->pval = photo;
5131 /* Mark the item as fully known */
5132 q_ptr->ident |= (IDENT_MENTAL);
5134 /* Drop it in the dungeon */
5135 (void)drop_near(q_ptr, -1, py, px);
5143 /* Return "Anything seen?" */
5148 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
5149 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5150 * @param who_name 効果を起こしたモンスターの名前
5151 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5152 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5153 * @param x 目標X座標 / Target x location (or location to travel "towards")
5154 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5155 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5157 * @param monspell モンスター魔法効果ID
5158 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5161 * Handle a beam/bolt/ball causing damage to the player.
5163 * This routine takes a "source monster" (by index), a "distance", a default
5164 * "damage", and a "damage type". See "project_m()" above.
5166 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
5167 * is reduced (see "project_m()" above). This can happen if a monster breathes
5168 * at the player and hits a wall instead.
5170 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
5171 * to know if this is actually a ball or a bolt spell
5174 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
5175 * we just assume that the effects were obvious, for historical reasons.
5178 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
5183 /* Hack -- assume obvious */
5184 bool obvious = TRUE;
5186 /* Player blind-ness */
5187 bool blind = (p_ptr->blind ? TRUE : FALSE);
5189 /* Player needs a "description" (he is blind) */
5192 /* Source monster */
5193 monster_type *m_ptr = NULL;
5195 /* Monster name (for attacks) */
5198 /* Monster name (for damage) */
5201 /* Hack -- messages */
5207 /* Player is not here */
5208 if (!player_bold(y, x)) return (FALSE);
5210 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
5212 if (kawarimi(TRUE)) return FALSE;
5215 /* Player cannot hurt himself */
5216 if (!who) return (FALSE);
5217 if (who == p_ptr->riding) return (FALSE);
5219 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
5222 int max_attempts = 10;
5225 msg_print(_("何かが跳ね返った!", "Something bounces!"));
5226 else if (p_ptr->special_defense & KATA_FUUJIN)
5227 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
5229 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
5232 /* Choose 'new' target */
5237 t_y = m_list[who].fy - 1 + randint1(3);
5238 t_x = m_list[who].fx - 1 + randint1(3);
5241 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
5243 if (max_attempts < 1)
5245 t_y = m_list[who].fy;
5246 t_x = m_list[who].fx;
5251 t_y = py - 1 + randint1(3);
5252 t_x = px - 1 + randint1(3);
5255 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
5262 /* Limit maximum damage */
5263 if (dam > 1600) dam = 1600;
5265 /* Reduce damage by distance */
5266 dam = (dam + r) / (r + 1);
5269 /* If the player is blind, be more descriptive */
5270 if (blind) fuzzy = TRUE;
5275 /* Get the source monster */
5276 m_ptr = &m_list[who];
5277 /* Extract the monster level */
5278 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
5280 /* Get the monster name */
5281 monster_desc(m_name, m_ptr, 0);
5283 /* Get the monster's real name (gotten before polymorph!) */
5284 strcpy(killer, who_name);
5290 case PROJECT_WHO_UNCTRL_POWER:
5291 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
5294 case PROJECT_WHO_GLASS_SHARDS:
5295 strcpy(killer, _("ガラスの破片", "shards of glass"));
5299 strcpy(killer, _("罠", "a trap"));
5304 strcpy(m_name, killer);
5307 /* Analyze the damage */
5310 /* Standard damage -- hurts inventory too */
5313 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
5314 get_damage = acid_dam(dam, killer, monspell, FALSE);
5318 /* Standard damage -- hurts inventory too */
5321 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
5322 get_damage = fire_dam(dam, killer, monspell, FALSE);
5326 /* Standard damage -- hurts inventory too */
5329 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
5330 get_damage = cold_dam(dam, killer, monspell, FALSE);
5334 /* Standard damage -- hurts inventory too */
5337 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
5338 get_damage = elec_dam(dam, killer, monspell, FALSE);
5342 /* Standard damage -- also poisons player */
5345 bool double_resist = IS_OPPOSE_POIS();
5346 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
5348 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
5349 if (double_resist) dam = (dam + 2) / 3;
5351 if ((!(double_resist || p_ptr->resist_pois)) &&
5352 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
5357 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5359 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5361 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5366 /* Standard damage -- also poisons / mutates player */
5369 bool double_resist = IS_OPPOSE_POIS();
5370 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
5372 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
5373 if (double_resist) dam = (2 * dam + 2) / 5;
5374 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5375 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
5377 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
5379 if (one_in_(5)) /* 6 */
5381 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
5382 if (one_in_(4)) /* 4 */
5390 inven_damage(set_acid_destroy, 2);
5396 /* Standard damage */
5399 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5400 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5404 /* Holy Orb -- Player only takes partial damage */
5407 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5408 if (p_ptr->align > 10)
5410 else if (p_ptr->align < -10)
5412 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5418 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5419 if (p_ptr->align > 10)
5421 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5425 /* Arrow -- XXX no dodging */
5430 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5432 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
5434 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
5437 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5441 /* Plasma -- XXX No resist */
5444 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
5445 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5447 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5449 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
5450 (void)set_stun(p_ptr->stun + k);
5453 if (!(p_ptr->resist_fire ||
5455 p_ptr->immune_fire))
5457 inven_damage(set_acid_destroy, 3);
5463 /* Nether -- drain experience */
5466 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
5467 if (p_ptr->resist_neth)
5469 if (!prace_is_(RACE_SPECTRE))
5470 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 k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5586 (void)set_stun(p_ptr->stun + k);
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 k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5836 (void)set_stun(p_ptr->stun + k);
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."));
5895 /* Pick a nightmare */
5896 get_mon_num_prep(get_nightmare, NULL);
5898 /* Have some nightmares */
5899 have_nightmare(get_mon_num(MAX_DEPTH));
5901 /* Remove the monster restriction */
5902 get_mon_num_prep(NULL, NULL);
5905 set_paralyzed(p_ptr->paralyzed + dam);
5915 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5916 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5923 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5924 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5931 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5933 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5934 if (!p_ptr->resist_shard || one_in_(13))
5936 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5937 inven_damage(set_cold_destroy, 2);
5943 /* Ice -- cold plus stun plus cuts */
5946 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5947 get_damage = cold_dam(dam, killer, monspell, FALSE);
5948 if (!CHECK_MULTISHADOW())
5950 if (!p_ptr->resist_shard)
5952 (void)set_cut(p_ptr->cut + damroll(5, 8));
5954 if (!p_ptr->resist_sound)
5956 (void)set_stun(p_ptr->stun + randint1(15));
5959 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5961 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5971 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5973 if (p_ptr->mimic_form)
5975 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5976 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5981 switch (p_ptr->prace)
5983 /* Some races are immune */
5997 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6009 if (CHECK_MULTISHADOW())
6011 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
6013 else if (p_ptr->csp)
6017 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
6019 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
6022 if (dam >= p_ptr->csp)
6026 p_ptr->csp_frac = 0;
6035 learn_spell(monspell);
6038 p_ptr->redraw |= (PR_MANA);
6041 p_ptr->window |= (PW_PLAYER);
6042 p_ptr->window |= (PW_SPELL);
6046 /* Heal the monster */
6047 if (m_ptr->hp < m_ptr->maxhp)
6051 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
6053 /* Redraw (later) if needed */
6054 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
6055 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
6057 /* Special message */
6060 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
6073 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6075 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6076 learn_spell(monspell);
6080 if (!CHECK_MULTISHADOW())
6082 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6084 if (!p_ptr->resist_conf)
6086 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6089 if (!p_ptr->resist_chaos && one_in_(3))
6091 (void)set_image(p_ptr->image + randint0(250) + 150);
6098 p_ptr->csp_frac = 0;
6100 p_ptr->redraw |= PR_MANA;
6103 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6109 case GF_BRAIN_SMASH:
6111 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
6113 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6114 learn_spell(monspell);
6118 if (!CHECK_MULTISHADOW())
6120 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
6126 p_ptr->csp_frac = 0;
6128 p_ptr->redraw |= PR_MANA;
6131 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6132 if (!CHECK_MULTISHADOW())
6134 if (!p_ptr->resist_blind)
6136 (void)set_blind(p_ptr->blind + 8 + randint0(8));
6138 if (!p_ptr->resist_conf)
6140 (void)set_confused(p_ptr->confused + randint0(4) + 4);
6142 if (!p_ptr->free_act)
6144 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
6146 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6148 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6149 (void)do_dec_stat(A_INT);
6150 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
6151 (void)do_dec_stat(A_WIS);
6153 if (!p_ptr->resist_chaos)
6155 (void)set_image(p_ptr->image + randint0(250) + 150);
6165 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6167 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6168 learn_spell(monspell);
6172 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
6173 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6181 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6183 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6184 learn_spell(monspell);
6188 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
6189 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6197 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6199 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6200 learn_spell(monspell);
6204 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
6205 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6213 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
6215 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
6216 learn_spell(monspell);
6220 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6221 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
6229 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
6231 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
6232 learn_spell(monspell);
6236 if (!CHECK_MULTISHADOW())
6238 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
6239 curse_equipment(40, 20);
6242 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
6244 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
6259 /* Hex - revenge damage stored */
6260 revenge_store(get_damage);
6262 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
6263 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
6265 char m_name_self[80];
6268 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
6270 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
6271 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
6272 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
6275 if (p_ptr->riding && dam > 0)
6277 rakubadam_p = (dam > 200) ? 200 : dam;
6285 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
6287 (void)kawarimi(FALSE);
6290 /* Return "Anything seen?" */
6296 * Find the distance from (x, y) to a line.
6298 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
6300 /* Vector from (x, y) to (x1, y1) */
6309 int pd = distance(y1, x1, y, x);
6310 int nd = distance(y1, x1, y2, x2);
6312 if (pd > nd) return distance(y, x, y2, x2);
6314 /* Component of P on N */
6315 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
6317 /* Absolute value */
6318 return((nd >= 0) ? nd : 0 - nd);
6325 * Modified version of los() for calculation of disintegration balls.
6326 * Disintegration effects are stopped by permanent walls.
6328 bool in_disintegration_range(int y1, int x1, int y2, int x2)
6348 /* Slope, or 1/Slope, of LOS */
6352 /* Extract the offset */
6356 /* Extract the absolute offset */
6361 /* Handle adjacent (or identical) grids */
6362 if ((ax < 2) && (ay < 2)) return (TRUE);
6365 /* Paranoia -- require "safe" origin */
6366 /* if (!in_bounds(y1, x1)) return (FALSE); */
6369 /* Directly South/North */
6372 /* South -- check for walls */
6375 for (ty = y1 + 1; ty < y2; ty++)
6377 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6381 /* North -- check for walls */
6384 for (ty = y1 - 1; ty > y2; ty--)
6386 if (cave_stop_disintegration(ty, x1)) return (FALSE);
6394 /* Directly East/West */
6397 /* East -- check for walls */
6400 for (tx = x1 + 1; tx < x2; tx++)
6402 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6406 /* West -- check for walls */
6409 for (tx = x1 - 1; tx > x2; tx--)
6411 if (cave_stop_disintegration(y1, tx)) return (FALSE);
6420 /* Extract some signs */
6421 sx = (dx < 0) ? -1 : 1;
6422 sy = (dy < 0) ? -1 : 1;
6425 /* Vertical "knights" */
6430 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
6434 /* Horizontal "knights" */
6439 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
6444 /* Calculate scale factor div 2 */
6447 /* Calculate scale factor */
6451 /* Travel horizontally */
6454 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
6460 /* Consider the special case where slope == 1. */
6471 /* Note (below) the case (qy == f2), where */
6472 /* the LOS exactly meets the corner of a tile. */
6475 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6486 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6499 /* Travel vertically */
6502 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
6518 /* Note (below) the case (qx == f2), where */
6519 /* the LOS exactly meets the corner of a tile. */
6522 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6533 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6554 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)
6559 int brev = rad * rad / dist;
6563 int mdis = distance(y1, x1, y2, x2) + rad;
6565 while (bdis <= mdis)
6569 if ((0 < dist) && (path_n < dist))
6571 int ny = GRID_Y(path_g[path_n]);
6572 int nx = GRID_X(path_g[path_n]);
6573 int nd = distance(ny, nx, y1, x1);
6575 /* Get next base point */
6584 /* Travel from center outward */
6585 for (cdis = 0; cdis <= brad; cdis++)
6587 /* Scan the maximal blast area of radius "cdis" */
6588 for (y = by - cdis; y <= by + cdis; y++)
6590 for (x = bx - cdis; x <= bx + cdis; x++)
6592 /* Ignore "illegal" locations */
6593 if (!in_bounds(y, x)) continue;
6595 /* Enforce a circular "ripple" */
6596 if (distance(y1, x1, y, x) != bdis) continue;
6598 /* Enforce an arc */
6599 if (distance(by, bx, y, x) != cdis) continue;
6605 /* Lights are stopped by opaque terrains */
6606 if (!los(by, bx, y, x)) continue;
6608 case GF_DISINTEGRATE:
6609 /* Disintegration are stopped only by perma-walls */
6610 if (!in_disintegration_range(by, bx, y, x)) continue;
6613 /* Ball explosions are stopped by walls */
6614 if (!projectable(by, bx, y, x)) continue;
6618 /* Save this grid */
6626 /* Encode some more "radius" info */
6627 gm[bdis + 1] = *pgrids;
6629 /* Increase the size */
6630 brad = rad * (path_n + brev) / (dist + brev);
6632 /* Find the next ripple */
6636 /* Store the effect size */
6642 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6643 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6644 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6645 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6646 * @param x 目標X座標 / Target x location (or location to travel "towards")
6647 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6648 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6649 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6650 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6653 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6654 * towards a given location (optionally passing over the heads of interposing
6655 * monsters), and have it do a given amount of damage to the monsters (and
6656 * optionally objects) within the given radius of the final location.
6658 * A "bolt" travels from source to target and affects only the target grid.
6659 * A "beam" travels from source to target, affecting all grids passed through.
6660 * A "ball" travels from source to the target, exploding at the target, and
6661 * affecting everything within the given radius of the target location.
6663 * Traditionally, a "bolt" does not affect anything on the ground, and does
6664 * not pass over the heads of interposing monsters, much like a traditional
6665 * missile, and will "stop" abruptly at the "target" even if no monster is
6666 * positioned there, while a "ball", on the other hand, passes over the heads
6667 * of monsters between the source and target, and affects everything except
6668 * the source monster which lies within the final radius, while a "beam"
6669 * affects every monster between the source and target, except for the casting
6670 * monster (or player), and rarely affects things on the ground.
6672 * Two special flags allow us to use this function in special ways, the
6673 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6674 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6675 * actually projecting from the source monster (or player).
6677 * The player will only get "experience" for monsters killed by himself
6678 * Unique monsters can only be destroyed by attacks from the player
6680 * Only 256 grids can be affected per projection, limiting the effective
6681 * "radius" of standard ball attacks to nine units (diameter nineteen).
6683 * One can project in a given "direction" by combining PROJECT_THRU with small
6684 * offsets to the initial location (see "line_spell()"), or by calculating
6685 * "virtual targets" far away from the player.
6687 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6688 * continuing until it actually hits somethings (useful for "stone to mud").
6690 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6692 * Balls must explode BEFORE hitting walls, or they would affect monsters
6693 * on both sides of a wall. Some bug reports indicate that this is still
6694 * happening in 2.7.8 for Windows, though it appears to be impossible.
6696 * We "pre-calculate" the blast area only in part for efficiency.
6697 * More importantly, this lets us do "explosions" from the "inside" out.
6698 * This results in a more logical distribution of "blast" treasure.
6699 * It also produces a better (in my opinion) animation of the explosion.
6700 * It could be (but is not) used to have the treasure dropped by monsters
6701 * in the middle of the explosion fall "outwards", and then be damaged by
6702 * the blast as it spreads outwards towards the treasure drop location.
6704 * Walls and doors are included in the blast area, so that they can be
6705 * "burned" or "melted" in later versions.
6707 * This algorithm is intended to maximize simplicity, not necessarily
6708 * efficiency, since this function is not a bottleneck in the code.
6710 * We apply the blast effect from ground zero outwards, in several passes,
6711 * first affecting features, then objects, then monsters, then the player.
6712 * This allows walls to be removed before checking the object or monster
6713 * in the wall, and protects objects which are dropped by monsters killed
6714 * in the blast, and allows the player to see all affects before he is
6715 * killed or teleported away. The semantics of this method are open to
6716 * various interpretations, but they seem to work well in practice.
6718 * We process the blast area from ground-zero outwards to allow for better
6719 * distribution of treasure dropped by monsters, and because it provides a
6720 * pleasing visual effect at low cost.
6722 * Note that the damage done by "ball" explosions decreases with distance.
6723 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6725 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6726 * the target, and then the damage "flows" along this beam of destruction.
6727 * The damage at every grid is the same as at the "center" of a "ball"
6728 * explosion, since the "beam" grids are treated as if they ARE at the
6729 * center of a "ball" explosion.
6731 * Currently, specifying "beam" plus "ball" means that locations which are
6732 * covered by the initial "beam", and also covered by the final "ball", except
6733 * for the final grid (the epicenter of the ball), will be "hit twice", once
6734 * by the initial beam, and once by the exploding ball. For the grid right
6735 * next to the epicenter, this results in 150% damage being done. The center
6736 * does not have this problem, for the same reason the final grid in a "beam"
6737 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6738 * grids which are covered by the "ball" will NOT work, as then they will
6739 * receive LESS damage than they should. Do not combine "beam" with "ball".
6741 * The array "gy[],gx[]" with current size "grids" is used to hold the
6742 * collected locations of all grids in the "blast area" plus "beam path".
6744 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6745 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6746 * first blast grid (see above) with radius "N" from the blast center. Note
6747 * that only the first gm[1] grids in the blast area thus take full damage.
6748 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6749 * number of blast grids.
6751 * Note that once the projection is complete, (y2,x2) holds the final location
6752 * of bolts/beams, and the "epicenter" of balls.
6754 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6755 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6756 * implementation of the "distance" function. Also, a bolt can be properly
6757 * viewed as a "ball" with a "rad" of "zero".
6759 * Note that if no "target" is reached before the beam/bolt/ball travels the
6760 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6761 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6763 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6764 * to move from point A to point B, even if the player cannot see part of the
6765 * projection path. Note that in general, the player will *always* see part
6766 * of the path, since it either starts at the player or ends on the player.
6768 * Hack -- we assume that every "projection" is "self-illuminating".
6770 * Hack -- when only a single monster is affected, we automatically track
6771 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6773 * Note that all projections now "explode" at their final destination, even
6774 * if they were being projected at a more distant destination. This means
6775 * that "ball" spells will *always* explode.
6777 * Note that we must call "handle_stuff()" after affecting terrain features
6778 * in the blast radius, in case the "illumination" of the grid was changed,
6779 * and "update_view()" and "update_monsters()" need to be called.
6782 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
6792 int y_saver, x_saver; /* For reflecting monsters */
6794 int msec = delay_factor * delay_factor * delay_factor;
6796 /* Assume the player sees nothing */
6797 bool notice = FALSE;
6799 /* Assume the player has seen nothing */
6800 bool visual = FALSE;
6802 /* Assume the player has seen no blast grids */
6805 /* Assume to be a normal ball spell */
6806 bool breath = FALSE;
6808 /* Is the player blind? */
6809 bool blind = (p_ptr->blind ? TRUE : FALSE);
6811 bool old_hide = FALSE;
6813 /* Number of grids in the "path" */
6816 /* Actual grids in the "path" */
6819 /* Number of grids in the "blast area" (including the "beam" path) */
6822 /* Coordinates of the affected grids */
6823 byte gx[1024], gy[1024];
6825 /* Encoded "radius" info (see above) */
6828 /* Actual radius encoded in gm[] */
6833 /* Attacker's name (prepared before polymorph)*/
6836 /* Can the player see the source of this effect? */
6837 bool see_s_msg = TRUE;
6839 /* Initialize by null string */
6845 /* Default target of monsterspell is player */
6846 monster_target_y=py;
6847 monster_target_x=px;
6849 /* Hack -- Jump to target */
6850 if (flg & (PROJECT_JUMP))
6855 /* Clear the flag */
6856 flg &= ~(PROJECT_JUMP);
6861 /* Start at player */
6868 /* Start at monster */
6871 x1 = m_list[who].fx;
6872 y1 = m_list[who].fy;
6873 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6886 /* Default "destination" */
6891 /* Hack -- verify stuff */
6892 if (flg & (PROJECT_THRU))
6894 if ((x1 == x2) && (y1 == y2))
6896 flg &= ~(PROJECT_THRU);
6900 /* Handle a breath attack */
6905 if (flg & PROJECT_HIDE) old_hide = TRUE;
6906 flg |= PROJECT_HIDE;
6910 /* Hack -- Assume there will be no blast (max radius 32) */
6911 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6919 /* Collect beam grids */
6920 if (flg & (PROJECT_BEAM))
6931 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6933 case GF_DISINTEGRATE:
6934 flg |= (PROJECT_GRID);
6935 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6939 /* Calculate the projection path */
6941 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6943 /* Hack -- Handle stuff */
6946 /* Giga-Hack SEEKER & SUPER_RAY */
6948 if( typ == GF_SEEKER )
6958 for (i = 0; i < path_n; ++i)
6963 int ny = GRID_Y(path_g[i]);
6964 int nx = GRID_X(path_g[i]);
6975 /* Only do visuals if requested */
6976 if (!blind && !(flg & (PROJECT_HIDE)))
6978 /* Only do visuals if the player can "see" the bolt */
6979 if (panel_contains(y, x) && player_has_los_bold(y, x))
6986 /* Obtain the bolt pict */
6987 p = bolt_pict(oy, ox, y, x, typ);
6989 /* Extract attr/char */
6993 /* Visual effects */
6994 print_rel(c, a, y, x);
6995 move_cursor_relative(y, x);
6996 /*if (fresh_before)*/ Term_fresh();
6997 Term_xtra(TERM_XTRA_DELAY, msec);
6999 /*if (fresh_before)*/ Term_fresh();
7001 /* Display "beam" grids */
7002 if (flg & (PROJECT_BEAM))
7004 /* Obtain the explosion pict */
7005 p = bolt_pict(y, x, y, x, typ);
7007 /* Extract attr/char */
7011 /* Visual effects */
7012 print_rel(c, a, y, x);
7015 /* Hack -- Activate delay */
7019 /* Hack -- delay anyway for consistency */
7022 /* Delay for consistency */
7023 Term_xtra(TERM_XTRA_DELAY, msec);
7026 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
7027 if( is_mirror_grid(&cave[y][x]))
7029 /* The target of monsterspell becomes tha mirror(broken) */
7030 monster_target_y=(s16b)y;
7031 monster_target_x=(s16b)x;
7034 next_mirror( &oy,&ox,y,x );
7036 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
7037 for( j = last_i; j <=i ; j++ )
7039 y = GRID_Y(path_g[j]);
7040 x = GRID_X(path_g[j]);
7041 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
7042 if(!who && (project_m_n==1) && !jump ){
7043 if(cave[project_m_y][project_m_x].m_idx >0 ){
7044 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7048 /* Hack -- auto-recall */
7049 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7051 /* Hack - auto-track */
7052 health_track(cave[project_m_y][project_m_x].m_idx);
7056 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7061 for( i = last_i ; i < path_n ; i++ )
7064 y = GRID_Y(path_g[i]);
7065 x = GRID_X(path_g[i]);
7066 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
7068 if(!who && (project_m_n==1) && !jump ){
7069 if(cave[project_m_y][project_m_x].m_idx >0 ){
7070 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7074 /* Hack -- auto-recall */
7075 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7077 /* Hack - auto-track */
7078 health_track(cave[project_m_y][project_m_x].m_idx);
7082 (void)project_f(0,0,y,x,dam,GF_SEEKER);
7086 else if(typ == GF_SUPER_RAY){
7088 int second_step = 0;
7095 for (i = 0; i < path_n; ++i)
7100 int ny = GRID_Y(path_g[i]);
7101 int nx = GRID_X(path_g[i]);
7112 /* Only do visuals if requested */
7113 if (!blind && !(flg & (PROJECT_HIDE)))
7115 /* Only do visuals if the player can "see" the bolt */
7116 if (panel_contains(y, x) && player_has_los_bold(y, x))
7123 /* Obtain the bolt pict */
7124 p = bolt_pict(oy, ox, y, x, typ);
7126 /* Extract attr/char */
7130 /* Visual effects */
7131 print_rel(c, a, y, x);
7132 move_cursor_relative(y, x);
7133 /*if (fresh_before)*/ Term_fresh();
7134 Term_xtra(TERM_XTRA_DELAY, msec);
7136 /*if (fresh_before)*/ Term_fresh();
7138 /* Display "beam" grids */
7139 if (flg & (PROJECT_BEAM))
7141 /* Obtain the explosion pict */
7142 p = bolt_pict(y, x, y, x, typ);
7144 /* Extract attr/char */
7148 /* Visual effects */
7149 print_rel(c, a, y, x);
7152 /* Hack -- Activate delay */
7156 /* Hack -- delay anyway for consistency */
7159 /* Delay for consistency */
7160 Term_xtra(TERM_XTRA_DELAY, msec);
7163 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
7164 if (!cave_have_flag_bold(y, x, FF_PROJECT))
7166 if( second_step )continue;
7169 if( is_mirror_grid(&cave[y][x]) && !second_step )
7171 /* The target of monsterspell becomes tha mirror(broken) */
7172 monster_target_y=(s16b)y;
7173 monster_target_x=(s16b)x;
7176 for( j = 0; j <=i ; j++ )
7178 y = GRID_Y(path_g[j]);
7179 x = GRID_X(path_g[j]);
7180 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7184 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
7185 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
7186 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
7187 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
7188 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
7189 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
7190 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
7191 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
7194 for( i = 0; i < path_n ; i++ )
7197 y = GRID_Y(path_g[i]);
7198 x = GRID_X(path_g[i]);
7199 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
7200 if(!who && (project_m_n==1) && !jump ){
7201 if(cave[project_m_y][project_m_x].m_idx >0 ){
7202 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
7206 /* Hack -- auto-recall */
7207 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7209 /* Hack - auto-track */
7210 health_track(cave[project_m_y][project_m_x].m_idx);
7214 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
7219 /* Project along the path */
7220 for (i = 0; i < path_n; ++i)
7225 int ny = GRID_Y(path_g[i]);
7226 int nx = GRID_X(path_g[i]);
7228 if (flg & PROJECT_DISI)
7230 /* Hack -- Balls explode before reaching walls */
7231 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
7233 else if (flg & PROJECT_LOS)
7235 /* Hack -- Balls explode before reaching walls */
7236 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
7240 /* Hack -- Balls explode before reaching walls */
7241 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
7248 /* Collect beam grids */
7249 if (flg & (PROJECT_BEAM))
7256 /* Only do visuals if requested */
7257 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
7259 /* Only do visuals if the player can "see" the bolt */
7260 if (panel_contains(y, x) && player_has_los_bold(y, x))
7267 /* Obtain the bolt pict */
7268 p = bolt_pict(oy, ox, y, x, typ);
7270 /* Extract attr/char */
7274 /* Visual effects */
7275 print_rel(c, a, y, x);
7276 move_cursor_relative(y, x);
7277 /*if (fresh_before)*/ Term_fresh();
7278 Term_xtra(TERM_XTRA_DELAY, msec);
7280 /*if (fresh_before)*/ Term_fresh();
7282 /* Display "beam" grids */
7283 if (flg & (PROJECT_BEAM))
7285 /* Obtain the explosion pict */
7286 p = bolt_pict(y, x, y, x, typ);
7288 /* Extract attr/char */
7292 /* Visual effects */
7293 print_rel(c, a, y, x);
7296 /* Hack -- Activate delay */
7300 /* Hack -- delay anyway for consistency */
7303 /* Delay for consistency */
7304 Term_xtra(TERM_XTRA_DELAY, msec);
7311 /* Save the "blast epicenter" */
7315 if (breath && !path_n)
7321 flg &= ~(PROJECT_HIDE);
7325 /* Start the "explosion" */
7328 /* Hack -- make sure beams get to "explode" */
7336 /* If we found a "target", explode there */
7337 if (dist <= MAX_RANGE)
7339 /* Mega-Hack -- remove the final "beam" grid */
7340 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
7343 * Create a conical breath attack
7354 flg &= ~(PROJECT_HIDE);
7356 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
7360 /* Determine the blast area, work from the inside out */
7361 for (dist = 0; dist <= rad; dist++)
7363 /* Scan the maximal blast area of radius "dist" */
7364 for (y = by - dist; y <= by + dist; y++)
7366 for (x = bx - dist; x <= bx + dist; x++)
7368 /* Ignore "illegal" locations */
7369 if (!in_bounds2(y, x)) continue;
7371 /* Enforce a "circular" explosion */
7372 if (distance(by, bx, y, x) != dist) continue;
7378 /* Lights are stopped by opaque terrains */
7379 if (!los(by, bx, y, x)) continue;
7381 case GF_DISINTEGRATE:
7382 /* Disintegration are stopped only by perma-walls */
7383 if (!in_disintegration_range(by, bx, y, x)) continue;
7386 /* Ball explosions are stopped by walls */
7387 if (!projectable(by, bx, y, x)) continue;
7391 /* Save this grid */
7398 /* Encode some more "radius" info */
7404 /* Speed -- ignore "non-explosions" */
7405 if (!grids) return (FALSE);
7408 /* Display the "blast area" if requested */
7409 if (!blind && !(flg & (PROJECT_HIDE)))
7411 /* Then do the "blast", from inside out */
7412 for (t = 0; t <= gm_rad; t++)
7414 /* Dump everything with this radius */
7415 for (i = gm[t]; i < gm[t+1]; i++)
7417 /* Extract the location */
7421 /* Only do visuals if the player can "see" the blast */
7422 if (panel_contains(y, x) && player_has_los_bold(y, x))
7431 /* Obtain the explosion pict */
7432 p = bolt_pict(y, x, y, x, typ);
7434 /* Extract attr/char */
7438 /* Visual effects -- Display */
7439 print_rel(c, a, y, x);
7443 /* Hack -- center the cursor */
7444 move_cursor_relative(by, bx);
7446 /* Flush each "radius" seperately */
7447 /*if (fresh_before)*/ Term_fresh();
7449 /* Delay (efficiently) */
7450 if (visual || drawn)
7452 Term_xtra(TERM_XTRA_DELAY, msec);
7456 /* Flush the erasing */
7459 /* Erase the explosion drawn above */
7460 for (i = 0; i < grids; i++)
7462 /* Extract the location */
7466 /* Hack -- Erase if needed */
7467 if (panel_contains(y, x) && player_has_los_bold(y, x))
7473 /* Hack -- center the cursor */
7474 move_cursor_relative(by, bx);
7476 /* Flush the explosion */
7477 /*if (fresh_before)*/ Term_fresh();
7482 /* Update stuff if needed */
7483 if (p_ptr->update) update_stuff();
7486 if (flg & PROJECT_KILL)
7488 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
7489 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
7493 /* Check features */
7494 if (flg & (PROJECT_GRID))
7496 /* Start with "dist" of zero */
7499 /* Scan for features */
7500 for (i = 0; i < grids; i++)
7502 /* Hack -- Notice new "dist" values */
7503 if (gm[dist+1] == i) dist++;
7505 /* Get the grid location */
7509 /* Find the closest point in the blast */
7512 int d = dist_to_line(y, x, y1, x1, by, bx);
7514 /* Affect the grid */
7515 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
7519 /* Affect the grid */
7520 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
7525 /* Update stuff if needed */
7526 if (p_ptr->update) update_stuff();
7529 if (flg & (PROJECT_ITEM))
7531 /* Start with "dist" of zero */
7534 /* Scan for objects */
7535 for (i = 0; i < grids; i++)
7537 /* Hack -- Notice new "dist" values */
7538 if (gm[dist+1] == i) dist++;
7540 /* Get the grid location */
7544 /* Find the closest point in the blast */
7547 int d = dist_to_line(y, x, y1, x1, by, bx);
7549 /* Affect the object in the grid */
7550 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7554 /* Affect the object in the grid */
7555 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7561 /* Check monsters */
7562 if (flg & (PROJECT_KILL))
7569 /* Start with "dist" of zero */
7572 /* Scan for monsters */
7573 for (i = 0; i < grids; i++)
7577 /* Hack -- Notice new "dist" values */
7578 if (gm[dist + 1] == i) dist++;
7580 /* Get the grid location */
7584 /* A single bolt may be reflected */
7587 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7588 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7590 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7591 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7592 (!who || dist_hack > 1) && !one_in_(10))
7595 int max_attempts = 10;
7597 /* Choose 'new' target */
7600 t_y = y_saver - 1 + randint1(3);
7601 t_x = x_saver - 1 + randint1(3);
7604 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7606 if (max_attempts < 1)
7614 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7615 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7616 else if (m_ptr->r_idx == MON_DIO)
7617 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7619 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7621 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7623 /* Reflected bolts randomly target either one */
7624 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7625 else flg |= PROJECT_PLAYER;
7627 /* The bolt is reflected */
7628 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7630 /* Don't affect the monster any longer */
7636 /* Find the closest point in the blast */
7639 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7643 effective_dist = dist;
7647 /* There is the riding player on this monster */
7648 if (p_ptr->riding && player_bold(y, x))
7650 /* Aimed on the player */
7651 if (flg & PROJECT_PLAYER)
7653 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7656 * A beam or bolt is well aimed
7658 * So don't affects the mount.
7665 * The spell is not well aimed,
7666 * So partly affect the mount too.
7673 * This grid is the original target.
7674 * Or aimed on your horse.
7676 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7678 /* Hit the mount with full damage */
7682 * Otherwise this grid is not the
7683 * original target, it means that line
7684 * of fire is obstructed by this
7688 * A beam or bolt will hit either
7689 * player or mount. Choose randomly.
7691 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7695 /* Hit the mount with full damage */
7699 /* Hit the player later */
7700 flg |= PROJECT_PLAYER;
7702 /* Don't affect the mount */
7708 * The spell is not well aimed, so
7709 * partly affect both player and
7718 /* Affect the monster in the grid */
7719 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7723 /* Player affected one monster (without "jumping") */
7724 if (!who && (project_m_n == 1) && !jump)
7730 /* Track if possible */
7731 if (cave[y][x].m_idx > 0)
7733 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7737 /* Hack -- auto-recall */
7738 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7740 /* Hack - auto-track */
7741 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7749 if (flg & (PROJECT_KILL))
7751 /* Start with "dist" of zero */
7754 /* Scan for player */
7755 for (i = 0; i < grids; i++)
7759 /* Hack -- Notice new "dist" values */
7760 if (gm[dist+1] == i) dist++;
7762 /* Get the grid location */
7766 /* Affect the player? */
7767 if (!player_bold(y, x)) continue;
7769 /* Find the closest point in the blast */
7772 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7776 effective_dist = dist;
7779 /* Target may be your horse */
7782 /* Aimed on the player */
7783 if (flg & PROJECT_PLAYER)
7785 /* Hit the player with full damage */
7789 * Hack -- When this grid was not the
7790 * original target, a beam or bolt
7791 * would hit either player or mount,
7792 * and should be choosen randomly.
7794 * But already choosen to hit the
7795 * mount at this point.
7797 * Or aimed on your horse.
7799 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7802 * A beam or bolt is well aimed
7804 * So don't affects the player.
7811 * The spell is not well aimed,
7812 * So partly affect the player too.
7818 /* Affect the player */
7819 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7827 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7829 if (rakubadam_m > 0)
7831 if (rakuba(rakubadam_m, FALSE))
7833 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7836 if (p_ptr->riding && rakubadam_p > 0)
7838 if(rakuba(rakubadam_p, FALSE))
7840 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7845 /* Return "something was noticed" */
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=py;
7865 monster_target_x=px;
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(py,px,y,x) <= MAX_RANGE &&
7873 distance(py,px,y,x) != 0 &&
7874 player_has_los_bold(y,x) &&
7875 projectable(py, px, 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]];
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(py, px, 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(py, px, 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(py, px, 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(py, px, 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]);
7993 void seal_of_mirror( int dam )
7997 for( x = 0 ; x < cur_wid ; x++ )
7999 for( y = 0 ; y < cur_hgt ; y++ )
8001 if( is_mirror_grid(&cave[y][x]))
8003 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8004 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
8006 if( !cave[y][x].m_idx )