4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Spell projection */
15 /* ToDo: Make this global */
16 /* 1/x chance of reducing stats (for elemental attacks) */
17 #define HURT_CHANCE 16
21 * Does the grid stop disintegration?
23 #define cave_stop_disintegration(Y,X) \
24 (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
25 (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
26 (cave[Y][X].feat == FEAT_MOUNTAIN) || \
27 ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
28 (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
29 ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
30 (cave[Y][X].feat <= FEAT_BLDG_TAIL)) || \
31 (cave[Y][X].feat == FEAT_MUSEUM))
33 static int rakubadam_m;
34 static int rakubadam_p;
36 int project_length = 0;
39 * Get another mirror. for SEEKER
41 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
43 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
44 int mirror_num=0; /* ¶À¤Î¿ô */
48 for( x=0 ; x < cur_wid ; x++ )
50 for( y=0 ; y < cur_hgt ; y++ )
52 if( is_mirror_grid(&cave[y][x])){
53 mirror_y[mirror_num]=y;
54 mirror_x[mirror_num]=x;
61 num=randint0(mirror_num);
62 *next_y=mirror_y[num];
63 *next_x=mirror_x[num];
66 *next_y=cury+randint0(5)-2;
67 *next_x=curx+randint0(5)-2;
72 * Get a legal "multi-hued" color for drawing "spells"
74 static byte mh_attr(int max)
76 switch (randint1(max))
78 case 1: return (TERM_RED);
79 case 2: return (TERM_GREEN);
80 case 3: return (TERM_BLUE);
81 case 4: return (TERM_YELLOW);
82 case 5: return (TERM_ORANGE);
83 case 6: return (TERM_VIOLET);
84 case 7: return (TERM_L_RED);
85 case 8: return (TERM_L_GREEN);
86 case 9: return (TERM_L_BLUE);
87 case 10: return (TERM_UMBER);
88 case 11: return (TERM_L_UMBER);
89 case 12: return (TERM_SLATE);
90 case 13: return (TERM_WHITE);
91 case 14: return (TERM_L_WHITE);
92 case 15: return (TERM_L_DARK);
100 * 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"))
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 = 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 * Find the attr/char pair to use for a spell effect
201 * It is moving (or has moved) from (x,y) to (nx,ny).
203 * If the distance is not "one", we (may) return "*".
205 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
215 if ((ny == y) && (nx == x)) base = 0x30;
218 else if (nx == x) base = 0x40;
221 else if (ny == y) base = 0x50;
224 else if ((ny - y) == (x - nx)) base = 0x60;
227 else if ((ny - y) == (nx - x)) base = 0x70;
232 /* Basic spell color */
233 k = spell_color(typ);
235 /* Obtain attr/char */
236 a = misc_to_attr[base + k];
237 c = misc_to_char[base + k];
245 * Determine the path taken by a projection.
247 * The projection will always start from the grid (y1,x1), and will travel
248 * towards the grid (y2,x2), touching one grid per unit of distance along
249 * the major axis, and stopping when it enters the destination grid or a
250 * wall grid, or has travelled the maximum legal distance of "range".
252 * Note that "distance" in this function (as in the "update_view()" code)
253 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
254 * actually has an "octagon of projection" not a "circle of projection".
256 * The path grids are saved into the grid array pointed to by "gp", and
257 * there should be room for at least "range" grids in "gp". Note that
258 * due to the way in which distance is calculated, this function normally
259 * uses fewer than "range" grids for the projection path, so the result
260 * of this function should never be compared directly to "range". Note
261 * that the initial grid (y1,x1) is never saved into the grid array, not
262 * even if the initial grid is also the final grid. XXX XXX XXX
264 * The "flg" flags can be used to modify the behavior of this function.
266 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
267 * semantics as they do for the "project" function, namely, that the path
268 * will stop as soon as it hits a monster, or that the path will continue
269 * through the destination grid, respectively.
271 * The "PROJECT_JUMP" flag, which for the "project()" function means to
272 * start at a special grid (which makes no sense in this function), means
273 * that the path should be "angled" slightly if needed to avoid any wall
274 * grids, allowing the player to "target" any grid which is in "view".
275 * This flag is non-trivial and has not yet been implemented, but could
276 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
278 * This function returns the number of grids (if any) in the path. This
279 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
281 * This algorithm is similar to, but slightly different from, the one used
282 * by "update_view_los()", and very different from the one used by "los()".
284 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
306 /* No path necessary (or allowed) */
307 if ((x1 == x2) && (y1 == y2)) return (0);
335 /* Number of "units" in one "half" grid */
338 /* Number of "units" in one "full" grid */
344 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
355 /* Advance (X) part 2 */
358 /* Advance (X) part 3 */
365 /* Create the projection path */
369 gp[n++] = GRID(y, x);
371 /* Hack -- Check maximum range */
372 if ((n + (k >> 1)) >= range) break;
374 /* Sometimes stop at destination grid */
375 if (!(flg & (PROJECT_THRU)))
377 if ((x == x2) && (y == y2)) break;
380 if (flg & (PROJECT_DISI))
382 if ((n > 0) && cave_stop_disintegration(y, x)) break;
384 else if (!(flg & (PROJECT_PATH)))
386 /* Always stop at non-initial wall grids */
387 if ((n > 0) && !cave_floor_bold(y, x)) break;
390 /* Sometimes stop at non-initial monsters/players */
391 if (flg & (PROJECT_STOP))
394 (player_bold(y, x) || cave[y][x].m_idx != 0))
398 if (!in_bounds(y, x)) break;
403 /* Advance (X) part 1 */
406 /* Horizontal change */
409 /* Advance (X) part 2 */
412 /* Advance (X) part 3 */
428 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
437 /* Vertical change */
440 /* Advance (Y) part 2 */
443 /* Advance (Y) part 3 */
450 /* Create the projection path */
454 gp[n++] = GRID(y, x);
456 /* Hack -- Check maximum range */
457 if ((n + (k >> 1)) >= range) break;
459 /* Sometimes stop at destination grid */
460 if (!(flg & (PROJECT_THRU)))
462 if ((x == x2) && (y == y2)) break;
465 if (flg & (PROJECT_DISI))
467 if ((n > 0) && cave_stop_disintegration(y, x)) break;
469 else if (!(flg & (PROJECT_PATH)))
471 /* Always stop at non-initial wall grids */
472 if ((n > 0) && !cave_floor_bold(y, x)) break;
475 /* Sometimes stop at non-initial monsters/players */
476 if (flg & (PROJECT_STOP))
479 (player_bold(y, x) || cave[y][x].m_idx != 0))
483 if (!in_bounds(y, x)) break;
488 /* Advance (Y) part 1 */
491 /* Vertical change */
494 /* Advance (Y) part 2 */
497 /* Advance (Y) part 3 */
517 /* Create the projection path */
521 gp[n++] = GRID(y, x);
523 /* Hack -- Check maximum range */
524 if ((n + (n >> 1)) >= range) break;
526 /* Sometimes stop at destination grid */
527 if (!(flg & (PROJECT_THRU)))
529 if ((x == x2) && (y == y2)) break;
532 if (flg & (PROJECT_DISI))
534 if ((n > 0) && cave_stop_disintegration(y, x)) break;
536 else if (!(flg & (PROJECT_PATH)))
538 /* Always stop at non-initial wall grids */
539 if ((n > 0) && !cave_floor_bold(y, x)) break;
542 /* Sometimes stop at non-initial monsters/players */
543 if (flg & (PROJECT_STOP))
546 (player_bold(y, x) || cave[y][x].m_idx != 0))
550 if (!in_bounds(y, x)) break;
567 * Mega-Hack -- track "affected" monsters (see "project()" comments)
569 static int project_m_n;
570 static int project_m_x;
571 static int project_m_y;
572 /* Mega-Hack -- monsters target */
573 static s16b monster_target_x;
574 static s16b monster_target_y;
578 * We are called from "project()" to "damage" terrain features
580 * We are called both for "beam" effects and "ball" effects.
582 * The "r" parameter is the "distance from ground zero".
584 * Note that we determine if the player can "see" anything that happens
585 * by taking into account: blindness, line-of-sight, and illumination.
587 * We return "TRUE" if the effect of the projection is "obvious".
589 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
591 * XXX XXX XXX Perhaps we should affect doors?
593 static bool project_f(int who, int r, int y, int x, int dam, int typ)
595 cave_type *c_ptr = &cave[y][x];
597 bool obvious = FALSE;
598 bool known = player_has_los_bold(y, x);
604 /* Reduce damage by distance */
605 dam = (dam + r) / (r + 1);
608 if (c_ptr->feat == FEAT_TREES)
617 message = "¸Ï¤ì¤¿";break;
619 message = "was blasted.";break;
623 message = "½Ì¤ó¤À";break;
625 message = "shrank.";break;
629 message = "ÍϤ±¤¿";break;
631 message = "melted.";break;
636 message = "Åà¤ê¡¢ºÕ¤±»¶¤Ã¤¿";break;
638 message = "was frozen and smashed.";break;
644 message = "dz¤¨¤¿";break;
646 message = "burns up!";break;
660 message = "Ê´ºÕ¤µ¤ì¤¿";break;
662 message = "was crushed.";break;
665 message = NULL;break;
670 msg_format("ÌÚ¤Ï%s¡£", message);
672 msg_format("A tree %s", message);
674 cave_set_feat(y, x, (one_in_(3) ? FEAT_DEEP_GRASS : FEAT_GRASS));
677 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
679 /* Update some things */
680 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
684 /* Analyze the type */
687 /* Ignore most effects */
701 case GF_DISINTEGRATE:
723 /* Destroy Traps (and Locks) */
726 /* Reveal secret doors */
727 if (is_hidden_door(c_ptr))
732 /* Check line of sight */
740 if (is_trap(c_ptr->feat))
742 /* Check line of sight */
746 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
748 msg_print("There is a bright flash of light!");
754 /* Forget the trap */
755 c_ptr->info &= ~(CAVE_MARK);
757 /* Destroy the trap */
758 cave_set_feat(y, x, floor_type[randint0(100)]);
761 /* Locked doors are unlocked */
762 else if ((c_ptr->feat >= FEAT_DOOR_HEAD + 0x01) &&
763 (c_ptr->feat <= FEAT_DOOR_HEAD + 0x07))
765 /* Unlock the door */
766 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
768 /* Check line of sound */
772 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
781 /* Remove "unsafe" flag if player is not blind */
782 if (!p_ptr->blind && player_has_los_bold(y, x))
784 c_ptr->info &= ~(CAVE_UNSAFE);
795 /* Destroy Doors (and traps) */
798 /* Destroy all doors and traps */
799 if ((c_ptr->feat == FEAT_OPEN) ||
800 (c_ptr->feat == FEAT_BROKEN) ||
801 is_trap(c_ptr->feat) ||
802 ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
803 (c_ptr->feat <= FEAT_DOOR_TAIL)))
805 /* Check line of sight */
810 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
812 msg_print("There is a bright flash of light!");
817 /* Visibility change */
818 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
819 (c_ptr->feat <= FEAT_DOOR_TAIL))
821 /* Update some things */
822 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
826 /* Forget the door */
827 c_ptr->info &= ~(CAVE_MARK);
829 /* Destroy the feature */
830 cave_set_feat(y, x, floor_type[randint0(100)]);
836 /* Remove "unsafe" flag if player is not blind */
837 if (!p_ptr->blind && player_has_los_bold(y, x))
839 c_ptr->info &= ~(CAVE_UNSAFE);
850 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
852 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
853 (c_ptr->feat <= FEAT_DOOR_TAIL))
855 /* Convert "locked" to "stuck" XXX XXX XXX */
856 if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08) c_ptr->feat += 0x08;
858 /* Add one spike to the door */
859 if (c_ptr->feat < FEAT_DOOR_TAIL) c_ptr->feat++;
861 /* Check line of sight */
866 msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ¥É¥¢¤¬³«¤«¤Ê¤¤¡£");
868 msg_print("The door seems stuck.");
877 /* Destroy walls (and doors) */
880 /* Non-walls (etc) */
881 if (cave_floor_bold(y, x)) break;
883 /* Permanent walls */
884 if (c_ptr->feat >= FEAT_PERM_EXTRA) break;
887 if (c_ptr->feat >= FEAT_WALL_EXTRA)
890 if (known && (c_ptr->info & (CAVE_MARK)))
893 msg_print("Êɤ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
895 msg_print("The wall turns into mud!");
901 /* Forget the wall */
902 c_ptr->info &= ~(CAVE_MARK);
904 /* Destroy the wall */
905 cave_set_feat(y, x, floor_type[randint0(100)]);
908 /* Quartz / Magma with treasure */
909 else if (c_ptr->feat >= FEAT_MAGMA_H)
912 if (known && (c_ptr->info & (CAVE_MARK)))
915 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
916 msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
918 msg_print("The vein turns into mud!");
919 msg_print("You have found something!");
925 /* Forget the wall */
926 c_ptr->info &= ~(CAVE_MARK);
928 /* Destroy the wall */
929 cave_set_feat(y, x, floor_type[randint0(100)]);
931 /* Place some gold */
936 else if (c_ptr->feat >= FEAT_MAGMA)
939 if (known && (c_ptr->info & (CAVE_MARK)))
942 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
944 msg_print("The vein turns into mud!");
950 /* Forget the wall */
951 c_ptr->info &= ~(CAVE_MARK);
953 /* Destroy the wall */
954 cave_set_feat(y, x, floor_type[randint0(100)]);
958 else if (c_ptr->feat == FEAT_RUBBLE)
961 if (known && (c_ptr->info & (CAVE_MARK)))
964 msg_print("´äÀФ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
966 msg_print("The rubble turns into mud!");
972 /* Forget the wall */
973 c_ptr->info &= ~(CAVE_MARK);
975 /* Destroy the rubble */
976 cave_set_feat(y, x, floor_type[randint0(100)]);
978 /* Hack -- place an object */
979 if (randint0(100) < 10)
981 /* Found something */
982 if (player_can_see_bold(y, x))
985 msg_print("´äÀФβ¼¤Ë²¿¤«±£¤µ¤ì¤Æ¤¤¤¿¡ª");
987 msg_print("There was something buried in the rubble!");
994 place_object(y, x, 0L);
998 /* Destroy doors (and secret doors) */
999 else /* if (c_ptr->feat >= FEAT_DOOR_HEAD) */
1001 /* Hack -- special message */
1002 if (known && (c_ptr->info & (CAVE_MARK)))
1005 msg_print("¥É¥¢¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
1007 msg_print("The door turns into mud!");
1013 /* Forget the wall */
1014 c_ptr->info &= ~(CAVE_MARK);
1016 /* Destroy the feature */
1017 cave_set_feat(y, x, floor_type[randint0(100)]);
1023 /* Update some things */
1024 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
1032 /* Require a "naked" floor grid */
1033 if (!cave_naked_bold(y, x)) break;
1035 /* Not on the player */
1036 if (player_bold(y, x)) break;
1038 /* Create a closed door */
1039 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
1042 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
1044 /* Update some things */
1045 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1053 /* Require a "naked" floor grid */
1054 if (((cave[y][x].feat != FEAT_FLOOR) &&
1055 (cave[y][x].feat != FEAT_GRASS) &&
1056 (cave[y][x].feat != FEAT_DIRT) &&
1057 (cave[y][x].o_idx == 0) &&
1058 (cave[y][x].m_idx == 0))
1059 || is_mirror_grid(&cave[y][x]) )
1070 /* Require a "naked" floor grid */
1071 if (!cave_naked_bold(y, x)) break;
1073 /* Not on the player */
1074 if (player_bold(y, x)) break;
1076 /* Create a closed door */
1077 cave_set_feat(y, x, FEAT_TREES);
1080 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
1082 /* Update some things */
1083 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1090 /* Require a "naked" floor grid */
1091 if (!cave_naked_bold(y, x)) break;
1093 /* Create a glyph */
1094 cave[y][x].info |= CAVE_OBJECT;
1095 cave[y][x].mimic = FEAT_GLYPH;
1108 /* Require a "naked" floor grid */
1109 if (!cave_naked_bold(y, x)) break;
1111 /* Not on the player */
1112 if (player_bold(y, x)) break;
1115 cave_set_feat(y, x, FEAT_WALL_EXTRA);
1117 /* Update some things */
1118 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1129 /* Require a "naked" floor grid */
1130 if (!cave_naked_bold(y, x)) break;
1132 /* Place a shallow lava */
1133 cave_set_feat(y, x, FEAT_SHAL_LAVA);
1138 /* Require a "naked" floor grid */
1139 if (cave_perma_bold(y, x) || !dam) break;
1141 /* Place a deep lava */
1142 cave_set_feat(y, x, FEAT_DEEP_LAVA);
1144 /* Dam is used as a counter for the number of grid to convert */
1155 /* Require a "naked" floor grid */
1156 if (!cave_naked_bold(y, x)) break;
1158 /* Place a shallow lava */
1159 cave_set_feat(y, x, FEAT_SHAL_WATER);
1164 /* Require a "naked" floor grid */
1165 if (cave_perma_bold(y, x) || !dam) break;
1167 /* Place a deep lava */
1168 cave_set_feat(y, x, FEAT_DEEP_WATER);
1170 /* Dam is used as a counter for the number of grid to convert */
1176 /* Lite up the grid */
1180 /* Turn on the light */
1181 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= (CAVE_GLOW);
1190 if (player_can_see_bold(y, x)) obvious = TRUE;
1192 /* Mega-Hack -- Update the monster in the affected grid */
1193 /* This allows "spear of light" (etc) to work "correctly" */
1194 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1199 /* Darken the grid */
1203 if (!p_ptr->inside_battle)
1206 if (player_can_see_bold(y, x)) obvious = TRUE;
1208 /* Turn off the light. */
1209 if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW);
1211 /* Hack -- Forget "boring" grids */
1212 if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
1215 c_ptr->info &= ~(CAVE_MARK);
1224 /* Mega-Hack -- Update the monster in the affected grid */
1225 /* This allows "spear of light" (etc) to work "correctly" */
1226 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1235 if (is_mirror_grid(&cave[y][x]))
1238 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1240 msg_print("The mirror was chashed!");
1243 project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
1249 if (is_mirror_grid(&cave[y][x]) && p_ptr->lev < 40 )
1252 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1254 msg_print("The mirror was chashed!");
1256 cave_set_feat(y,x, FEAT_FLOOR);
1263 /* Return "Anything seen?" */
1270 * We are called from "project()" to "damage" objects
1272 * We are called both for "beam" effects and "ball" effects.
1274 * Perhaps we should only SOMETIMES damage things on the ground.
1276 * The "r" parameter is the "distance from ground zero".
1278 * Note that we determine if the player can "see" anything that happens
1279 * by taking into account: blindness, line-of-sight, and illumination.
1281 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1283 * We return "TRUE" if the effect of the projection is "obvious".
1285 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1287 cave_type *c_ptr = &cave[y][x];
1289 s16b this_o_idx, next_o_idx = 0;
1291 bool obvious = FALSE;
1292 bool known = player_has_los_bold(y, x);
1294 u32b flgs[TR_FLAG_SIZE];
1296 char o_name[MAX_NLEN];
1299 bool is_potion = FALSE;
1303 who = who ? who : 0;
1305 /* Reduce damage by distance */
1306 dam = (dam + r) / (r + 1);
1309 /* Scan all objects in the grid */
1310 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1312 /* Acquire object */
1313 object_type *o_ptr = &o_list[this_o_idx];
1315 bool is_art = FALSE;
1316 bool ignore = FALSE;
1317 bool do_kill = FALSE;
1319 cptr note_kill = NULL;
1322 /* Get the "plural"-ness */
1323 bool plural = (o_ptr->number > 1);
1326 /* Acquire next object */
1327 next_o_idx = o_ptr->next_o_idx;
1329 /* Extract the flags */
1330 object_flags(o_ptr, flgs);
1332 /* Check for artifact */
1333 if ((artifact_p(o_ptr) || o_ptr->art_name)) is_art = TRUE;
1335 /* Analyze the type */
1338 /* Acid -- Lots of things */
1341 if (hates_acid(o_ptr))
1345 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1347 note_kill = (plural ? " melt!" : " melts!");
1350 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1355 /* Elec -- Rings and Wands */
1358 if (hates_elec(o_ptr))
1362 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1364 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1367 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1372 /* Fire -- Flammable objects */
1375 if (hates_fire(o_ptr))
1379 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1381 note_kill = (plural ? " burn up!" : " burns up!");
1384 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1389 /* Cold -- potions and flasks */
1392 if (hates_cold(o_ptr))
1395 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1397 note_kill = (plural ? " shatter!" : " shatters!");
1401 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1409 if (hates_fire(o_ptr))
1413 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1415 note_kill = (plural ? " burn up!" : " burns up!");
1418 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1420 if (hates_elec(o_ptr))
1425 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1427 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1430 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1438 if (hates_fire(o_ptr))
1442 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1444 note_kill = (plural ? " burn up!" : " burns up!");
1447 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1449 if (hates_cold(o_ptr))
1454 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1456 note_kill = (plural ? " shatter!" : " shatters!");
1459 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1464 /* Hack -- break potions and such */
1470 if (hates_cold(o_ptr))
1473 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1475 note_kill = (plural ? " shatter!" : " shatters!");
1483 /* Mana and Chaos -- destroy everything */
1490 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1492 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1498 case GF_DISINTEGRATE:
1502 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1504 note_kill = (plural ? " evaporate!" : " evaporates!");
1514 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1516 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1519 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1520 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1524 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1528 if (cursed_p(o_ptr))
1532 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1534 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1543 identify_item(o_ptr);
1545 /* Auto-inscription */
1546 auto_inscribe_item(-this_o_idx, is_autopick(o_ptr));
1554 /* Chests are noticed only if trapped or locked */
1555 if (o_ptr->tval == TV_CHEST)
1557 /* Disarm/Unlock traps */
1558 if (o_ptr->pval > 0)
1560 /* Disarm or Unlock */
1561 o_ptr->pval = (0 - o_ptr->pval);
1564 object_known(o_ptr);
1567 if (known && o_ptr->marked)
1570 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1572 msg_print("Click!");
1584 if (o_ptr->tval == TV_CORPSE)
1589 if (!who || is_pet(&m_list[who]))
1590 mode |= PM_FORCE_PET;
1592 for (i = 0; i < o_ptr->number ; i++)
1594 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1595 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1600 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1602 note_kill = (plural ? " become dust." : " becomes dust.");
1607 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1610 note_kill = "À¸¤Ê֤ä¿¡£";
1612 note_kill = "rivived.";
1615 else if (!note_kill)
1618 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1620 note_kill = (plural ? " become dust." : " becomes dust.");
1632 /* Attempt to destroy the object */
1635 /* Effect "observed" */
1636 if (known && o_ptr->marked)
1639 object_desc(o_name, o_ptr, FALSE, 0);
1642 /* Artifacts, and other objects, get to resist */
1643 if (is_art || ignore)
1645 /* Observe the resist */
1646 if (known && o_ptr->marked)
1649 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1652 msg_format("The %s %s unaffected!",
1653 o_name, (plural ? "are" : "is"));
1662 /* Describe if needed */
1663 if (known && o_ptr->marked && note_kill)
1666 msg_format("%s¤Ï%s", o_name, note_kill);
1668 msg_format("The %s%s", o_name, note_kill);
1673 k_idx = o_ptr->k_idx;
1674 is_potion = object_is_potion(o_ptr);
1677 /* Delete the object */
1678 delete_object_idx(this_o_idx);
1680 /* Potions produce effects when 'shattered' */
1683 (void)potion_smash_effect(who, y, x, k_idx);
1692 /* Return "Anything seen?" */
1698 * Helper function for "project()" below.
1700 * Handle a beam/bolt/ball causing damage to a monster.
1702 * This routine takes a "source monster" (by index) which is mostly used to
1703 * determine if the player is causing the damage, and a "radius" (see below),
1704 * which is used to decrease the power of explosions with distance, and a
1705 * location, via integers which are modified by certain types of attacks
1706 * (polymorph and teleport being the obvious ones), a default damage, which
1707 * is modified as needed based on various properties, and finally a "damage
1708 * type" (see below).
1710 * Note that this routine can handle "no damage" attacks (like teleport) by
1711 * taking a "zero" damage, and can even take "parameters" to attacks (like
1712 * confuse) by accepting a "damage", using it to calculate the effect, and
1713 * then setting the damage to zero. Note that the "damage" parameter is
1714 * divided by the radius, so monsters not at the "epicenter" will not take
1715 * as much damage (or whatever)...
1717 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1718 * may result in a dereference of an invalid pointer. XXX XXX XXX
1720 * Various messages are produced, and damage is applied.
1722 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1723 * actually be "made" of that substance, or "breathe" big balls of it.
1725 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1728 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1729 * and hurts evil less. If can breath nether, then it resists it as well.
1731 * Damage reductions use the following formulas:
1732 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1733 * gives avg damage of .655, ranging from .858 to .500
1734 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1735 * gives avg damage of .544, ranging from .714 to .417
1736 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1737 * gives avg damage of .444, ranging from .556 to .333
1738 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1739 * gives avg damage of .327, ranging from .427 to .250
1740 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1741 * gives something simple.
1743 * In this function, "result" messages are postponed until the end, where
1744 * the "note" string is appended to the monster name, if not NULL. So,
1745 * to make a spell have "no effect" just set "note" to NULL. You should
1746 * also set "notice" to FALSE, or the player will learn what the spell does.
1748 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1750 /* "flg" was added. */
1751 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1755 cave_type *c_ptr = &cave[y][x];
1757 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1759 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1763 /* Is the monster "seen"? */
1764 bool seen = m_ptr->ml;
1766 bool slept = (bool)(m_ptr->csleep > 0);
1768 /* Were the effects "obvious" (if seen)? */
1769 bool obvious = FALSE;
1771 /* Can the player know about this effect? */
1772 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1774 /* Can the player see the source of this effect? */
1775 bool see_s = ((who <= 0) || m_list[who].ml);
1777 /* Were the effects "irrelevant"? */
1778 bool skipped = FALSE;
1780 /* Gets the monster angry at the source of the effect? */
1781 bool get_angry = FALSE;
1783 /* Polymorph setting (true or false) */
1784 bool do_poly = FALSE;
1786 /* Teleport setting (max distance) */
1789 /* Confusion setting (amount to confuse) */
1792 /* Stunning setting (amount to stun) */
1795 /* Sleep amount (amount to sleep) */
1798 /* Fear amount (amount to fear) */
1801 /* Time amount (amount to time) */
1804 bool heal_leper = FALSE;
1806 /* Hold the monster name */
1815 /* Assume no note */
1818 /* Assume a default death */
1819 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1824 int caster_lev = (who > 0) ? r_info[m_list[who].r_idx].level : p_ptr->lev * 2;
1827 if (!c_ptr->m_idx) return (FALSE);
1829 /* Never affect projector */
1830 if (who && (c_ptr->m_idx == who)) return (FALSE);
1831 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1832 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1834 /* Don't affect already death monsters */
1835 /* Prevents problems with chain reactions of exploding monsters */
1836 if (m_ptr->hp < 0) return (FALSE);
1838 /* Reduce damage by distance */
1839 dam = (dam + r) / (r + 1);
1842 /* Get the monster name (BEFORE polymorphing) */
1843 monster_desc(m_name, m_ptr, 0);
1846 /* Get the monster possessive ("his"/"her"/"its") */
1847 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1851 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1853 /* Analyze the damage type */
1856 /* Magic Missile -- pure damage */
1859 if (seen) obvious = TRUE;
1861 if (r_ptr->flagsr & RFR_RES_ALL)
1864 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1866 note = " is immune.";
1869 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1878 if (seen) obvious = TRUE;
1880 if (r_ptr->flagsr & RFR_RES_ALL)
1883 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1885 note = " is immune.";
1888 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1891 if (r_ptr->flagsr & RFR_IM_ACID)
1894 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1896 note = " resists a lot.";
1900 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1908 if (seen) obvious = TRUE;
1910 if (r_ptr->flagsr & RFR_RES_ALL)
1913 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1915 note = " is immune.";
1918 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1921 if (r_ptr->flagsr & RFR_IM_ELEC)
1924 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1926 note = " resists a lot.";
1930 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1938 if (seen) obvious = TRUE;
1940 if (r_ptr->flagsr & RFR_RES_ALL)
1943 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1945 note = " is immune.";
1948 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1951 if (r_ptr->flagsr & RFR_IM_FIRE)
1954 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1956 note = " resists a lot.";
1960 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1962 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1965 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1967 note = " is hit hard.";
1971 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1979 if (seen) obvious = TRUE;
1981 if (r_ptr->flagsr & RFR_RES_ALL)
1984 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1986 note = " is immune.";
1989 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1992 if (r_ptr->flagsr & RFR_IM_COLD)
1995 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1997 note = " resists a lot.";
2001 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2003 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2006 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
2008 note = " is hit hard.";
2012 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2020 if (seen) obvious = TRUE;
2022 if (r_ptr->flagsr & RFR_RES_ALL)
2025 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2027 note = " is immune.";
2030 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2033 if (r_ptr->flagsr & RFR_IM_POIS)
2036 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
2038 note = " resists a lot.";
2042 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
2050 if (seen) obvious = TRUE;
2052 if (r_ptr->flagsr & RFR_RES_ALL)
2055 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2057 note = " is immune.";
2060 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2063 if (r_ptr->flagsr & RFR_IM_POIS)
2066 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2071 dam *= 3; dam /= randint1(6) + 6;
2072 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
2074 else if (one_in_(3)) do_poly = TRUE;
2078 /* Hellfire -- hurts Evil */
2081 if (seen) obvious = TRUE;
2083 if (r_ptr->flagsr & RFR_RES_ALL)
2086 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2088 note = " is immune.";
2091 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2094 if (r_ptr->flags3 & RF3_GOOD)
2098 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2100 note = " is hit hard.";
2103 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2108 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2111 if (seen) obvious = TRUE;
2113 if (r_ptr->flagsr & RFR_RES_ALL)
2116 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2118 note = " is immune.";
2121 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2124 if (r_ptr->flags3 & RF3_GOOD)
2128 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2130 note = " is immune.";
2133 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2135 else if (r_ptr->flags3 & RF3_EVIL)
2139 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2141 note = " is hit hard.";
2144 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2149 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2154 dam *= 3; dam /= randint1(6) + 6;
2159 /* Arrow -- XXX no defense */
2162 if (seen) obvious = TRUE;
2164 if (r_ptr->flagsr & RFR_RES_ALL)
2167 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2169 note = " is immune.";
2172 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2178 /* Plasma -- XXX perhaps check ELEC or FIRE */
2181 if (seen) obvious = TRUE;
2183 if (r_ptr->flagsr & RFR_RES_ALL)
2186 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2188 note = " is immune.";
2191 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2194 if (r_ptr->flagsr & RFR_RES_PLAS)
2197 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2202 dam *= 3; dam /= randint1(6) + 6;
2203 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2208 /* Nether -- see above */
2211 if (seen) obvious = TRUE;
2213 if (r_ptr->flagsr & RFR_RES_ALL)
2216 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2218 note = " is immune.";
2221 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2224 if (r_ptr->flagsr & RFR_RES_NETH)
2226 if (r_ptr->flags3 & RF3_UNDEAD)
2229 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2231 note = " is immune.";
2235 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2240 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2245 dam *= 3; dam /= randint1(6) + 6;
2247 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2249 else if (r_ptr->flags3 & RF3_EVIL)
2253 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2255 note = " resists somewhat.";
2258 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2263 /* Water (acid) damage -- Water spirits/elementals are immune */
2266 if (seen) obvious = TRUE;
2268 if (r_ptr->flagsr & RFR_RES_ALL)
2271 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2273 note = " is immune.";
2276 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2279 if (r_ptr->flagsr & RFR_RES_WATE)
2281 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2284 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2286 note = " is immune.";
2294 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2299 dam *= 3; dam /= randint1(6) + 6;
2301 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2306 /* Chaos -- Chaos breathers resist */
2309 if (seen) obvious = TRUE;
2311 if (r_ptr->flagsr & RFR_RES_ALL)
2314 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2316 note = " is immune.";
2319 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2322 if (r_ptr->flagsr & RFR_RES_CHAO)
2325 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2330 dam *= 3; dam /= randint1(6) + 6;
2331 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2333 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2336 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2338 note = " resists somewhat.";
2341 dam *= 3; dam /= randint1(6) + 6;
2342 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2347 do_conf = (5 + randint1(11) + r) / (r + 1);
2352 /* Shards -- Shard breathers resist */
2355 if (seen) obvious = TRUE;
2357 if (r_ptr->flagsr & RFR_RES_ALL)
2360 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2362 note = " is immune.";
2365 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2368 if (r_ptr->flagsr & RFR_RES_SHAR)
2371 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2376 dam *= 3; dam /= randint1(6) + 6;
2377 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2382 /* Rocket: Shard resistance helps */
2385 if (seen) obvious = TRUE;
2387 if (r_ptr->flagsr & RFR_RES_ALL)
2390 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2392 note = " is immune.";
2395 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2398 if (r_ptr->flagsr & RFR_RES_SHAR)
2401 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2403 note = " resists somewhat.";
2407 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2413 /* Sound -- Sound breathers resist */
2416 if (seen) obvious = TRUE;
2418 if (r_ptr->flagsr & RFR_RES_ALL)
2421 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2423 note = " is immune.";
2426 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2429 if (r_ptr->flagsr & RFR_RES_SOUN)
2432 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2437 dam *= 2; dam /= randint1(6) + 6;
2438 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2440 else do_stun = (10 + randint1(15) + r) / (r + 1);
2447 if (seen) obvious = TRUE;
2449 if (r_ptr->flagsr & RFR_RES_ALL)
2452 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2454 note = " is immune.";
2457 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2460 if (r_ptr->flags3 & RF3_NO_CONF)
2463 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2468 dam *= 3; dam /= randint1(6) + 6;
2469 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2471 else do_conf = (10 + randint1(15) + r) / (r + 1);
2475 /* Disenchantment -- Breathers and Disenchanters resist */
2478 if (seen) obvious = TRUE;
2480 if (r_ptr->flagsr & RFR_RES_ALL)
2483 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2485 note = " is immune.";
2488 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2491 if (r_ptr->flagsr & RFR_RES_DISE)
2494 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2499 dam *= 3; dam /= randint1(6) + 6;
2500 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2505 /* Nexus -- Breathers and Existers resist */
2508 if (seen) obvious = TRUE;
2510 if (r_ptr->flagsr & RFR_RES_ALL)
2513 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2515 note = " is immune.";
2518 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2521 if (r_ptr->flagsr & RFR_RES_NEXU)
2524 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2529 dam *= 3; dam /= randint1(6) + 6;
2530 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2538 if (seen) obvious = TRUE;
2540 if (r_ptr->flagsr & RFR_RES_ALL)
2543 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2545 note = " is immune.";
2548 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2551 if (r_ptr->flagsr & RFR_RES_WALL)
2554 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2559 dam *= 3; dam /= randint1(6) + 6;
2560 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2562 else do_stun = (randint1(15) + r) / (r + 1);
2566 /* Inertia -- breathers resist */
2569 if (seen) obvious = TRUE;
2571 if (r_ptr->flagsr & RFR_RES_ALL)
2574 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2576 note = " is immune.";
2579 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2582 if (r_ptr->flagsr & RFR_RES_INER)
2585 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2590 dam *= 3; dam /= randint1(6) + 6;
2591 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2595 /* Powerful monsters can resist */
2596 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2597 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2601 /* Normal monsters slow down */
2607 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2609 note = " starts moving slower.";
2612 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2613 if (c_ptr->m_idx == p_ptr->riding)
2614 p_ptr->update |= (PU_BONUS);
2620 /* Time -- breathers resist */
2623 if (seen) obvious = TRUE;
2625 if (r_ptr->flagsr & RFR_RES_ALL)
2628 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2630 note = " is immune.";
2633 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2636 if (r_ptr->flagsr & RFR_RES_TIME)
2639 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2644 dam *= 3; dam /= randint1(6) + 6;
2645 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2647 else do_time = (dam + 1) / 2;
2651 /* Gravity -- breathers resist */
2654 bool resist_tele = FALSE;
2656 if (seen) obvious = TRUE;
2658 if (r_ptr->flagsr & RFR_RES_ALL)
2661 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2663 note = " is immune.";
2666 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2669 if (r_ptr->flagsr & RFR_RES_TELE)
2671 if (r_ptr->flags1 & (RF1_UNIQUE))
2673 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2675 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2677 note = " is unaffected!";
2682 else if (r_ptr->level > randint1(100))
2684 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2686 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2695 if (!resist_tele) do_dist = 10;
2697 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2699 if (r_ptr->flagsr & RFR_RES_GRAV)
2702 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2707 dam *= 3; dam /= randint1(6) + 6;
2709 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2714 /* Powerful monsters can resist */
2715 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2716 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2720 /* Normal monsters slow down */
2726 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2728 note = " starts moving slower.";
2731 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2732 if (c_ptr->m_idx == p_ptr->riding)
2733 p_ptr->update |= (PU_BONUS);
2737 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2739 /* Attempt a saving throw */
2740 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2741 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2745 /* No obvious effect */
2747 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2749 note = " is unaffected!";
2763 if (seen) obvious = TRUE;
2765 if (r_ptr->flagsr & RFR_RES_ALL)
2768 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2770 note = " is immune.";
2773 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2781 case GF_DISINTEGRATE:
2783 if (seen) obvious = TRUE;
2785 if (r_ptr->flagsr & RFR_RES_ALL)
2788 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2790 note = " is immune.";
2793 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2796 if (r_ptr->flags3 & RF3_HURT_ROCK)
2798 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2800 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2801 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2803 note = " loses some skin!";
2804 note_dies = " evaporates!";
2814 if (seen) obvious = TRUE;
2816 /* PSI only works if the monster can see you! -- RG */
2817 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2820 if (seen) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2822 if (seen) msg_format("%^s can't see you, and isn't affected!", m_name);
2828 if (r_ptr->flagsr & RFR_RES_ALL)
2831 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2833 note = " is immune.";
2836 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2839 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2843 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2845 note = " is immune!";
2847 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2850 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2851 (r_ptr->flags3 & RF3_ANIMAL) ||
2852 (r_ptr->level > randint1(3 * dam)))
2856 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2863 * Powerful demons & undead can turn a mindcrafter's
2864 * attacks back on them
2866 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2867 (r_ptr->level > p_ptr->lev / 2) &&
2872 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2874 msg_format("%^s%s corrupted mind backlashes your attack!",
2875 m_name, (seen ? "'s" : "s"));
2879 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2882 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2884 msg_print("You resist the effects!");
2890 /* Injure +/- confusion */
2891 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2892 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2895 switch (randint1(4))
2898 set_confused(p_ptr->confused + 3 + randint1(dam));
2901 set_stun(p_ptr->stun + randint1(dam));
2905 if (r_ptr->flags3 & RF3_NO_FEAR)
2907 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2909 note = " is unaffected.";
2913 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2917 if (!p_ptr->free_act)
2918 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2927 if ((dam > 0) && one_in_(4))
2929 switch (randint1(4))
2932 do_conf = 3 + randint1(dam);
2935 do_stun = 3 + randint1(dam);
2938 do_fear = 3 + randint1(dam);
2942 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2944 note = " falls asleep!";
2947 do_sleep = 3 + randint1(dam);
2953 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2955 note_dies = " collapses, a mindless husk.";
2963 if (seen) obvious = TRUE;
2965 if (r_ptr->flagsr & RFR_RES_ALL)
2968 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2970 note = " is immune.";
2973 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2976 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2980 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2982 note = " is immune!";
2986 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2987 (r_ptr->flags3 & RF3_ANIMAL) ||
2988 (r_ptr->level > randint1(3 * dam)))
2992 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2999 * Powerful demons & undead can turn a mindcrafter's
3000 * attacks back on them
3002 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3003 (r_ptr->level > p_ptr->lev / 2) &&
3008 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3010 msg_format("%^s%s corrupted mind backlashes your attack!",
3011 m_name, (seen ? "'s" : "s"));
3015 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3018 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3020 msg_print("You resist the effects!");
3026 /* Injure + mana drain */
3027 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
3029 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
3031 msg_print("Your psychic energy is drained!");
3034 p_ptr->csp -= damroll(5, dam) / 2;
3035 if (p_ptr->csp < 0) p_ptr->csp = 0;
3036 p_ptr->redraw |= PR_MANA;
3037 p_ptr->window |= (PW_SPELL);
3038 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
3045 int b = damroll(5, dam) / 4;
3047 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
3049 msg_format("You convert %s%s pain into psychic energy!",
3050 m_name, (seen ? "'s" : "s"));
3053 b = MIN(p_ptr->msp, p_ptr->csp + b);
3055 p_ptr->redraw |= PR_MANA;
3056 p_ptr->window |= (PW_SPELL);
3060 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
3062 note_dies = " collapses, a mindless husk.";
3068 case GF_TELEKINESIS:
3070 if (seen) obvious = TRUE;
3072 if (r_ptr->flagsr & RFR_RES_ALL)
3075 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3077 note = " is immune.";
3080 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3085 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3090 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3092 /* Attempt a saving throw */
3093 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3094 (r_ptr->level > 5 + randint1(dam)))
3098 /* No obvious effect */
3104 /* Psycho-spear -- powerful magic missile */
3107 if (seen) obvious = TRUE;
3109 if (r_ptr->flagsr & RFR_RES_ALL)
3112 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3114 note = " is immune.";
3117 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3123 /* Meteor -- powerful magic missile */
3126 if (seen) obvious = TRUE;
3128 if (r_ptr->flagsr & RFR_RES_ALL)
3131 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3133 note = " is immune.";
3136 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3144 if (!is_hostile(m_ptr)) break;
3146 if (seen) obvious = TRUE;
3148 if (r_ptr->flagsr & RFR_RES_ALL)
3151 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3153 note = " is immune.";
3156 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3159 /* Attempt a saving throw */
3160 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3161 (r_ptr->flags3 & RF3_NO_CONF) ||
3162 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3164 /* Memorize a flag */
3165 if (r_ptr->flags3 & RF3_NO_CONF)
3167 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3174 * Powerful demons & undead can turn a mindcrafter's
3175 * attacks back on them
3177 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3178 (r_ptr->level > p_ptr->lev / 2) &&
3183 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3185 msg_format("%^s%s corrupted mind backlashes your attack!",
3186 m_name, (seen ? "'s" : "s"));
3190 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3193 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3195 msg_print("You resist the effects!");
3201 /* Confuse, stun, terrify */
3202 switch (randint1(4))
3205 set_stun(p_ptr->stun + dam / 2);
3208 set_confused(p_ptr->confused + dam / 2);
3212 if (r_ptr->flags3 & RF3_NO_FEAR)
3214 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3216 note = " is unaffected.";
3220 set_afraid(p_ptr->afraid + dam);
3227 /* No obvious effect */
3229 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3231 note = " is unaffected!";
3239 if ((dam > 29) && (randint1(100) < dam))
3242 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3244 note = " is in your thrall!";
3251 switch (randint1(4))
3265 /* No "real" damage */
3272 /* Ice -- Cold + Cuts + Stun */
3275 if (seen) obvious = TRUE;
3277 if (r_ptr->flagsr & RFR_RES_ALL)
3280 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3282 note = " is immune.";
3285 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3288 do_stun = (randint1(15) + 1) / (r + 1);
3289 if (r_ptr->flagsr & RFR_IM_COLD)
3292 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3294 note = " resists a lot.";
3298 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3300 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3303 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3305 note = " is hit hard.";
3309 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3318 if (seen) obvious = TRUE;
3320 if (r_ptr->flagsr & RFR_RES_ALL)
3323 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3325 note = " is immune.";
3328 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3331 if (!monster_living(r_ptr))
3335 if (is_original_ap(m_ptr))
3337 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3338 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3339 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3344 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3346 note = " is unaffected!";
3352 else do_time = (dam+7)/8;
3360 if (seen) obvious = TRUE;
3362 if (r_ptr->flagsr & RFR_RES_ALL)
3365 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3367 note = " is immune.";
3370 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3373 if (!monster_living(r_ptr))
3377 if (is_original_ap(m_ptr))
3379 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3380 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3381 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3386 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3388 note = " is immune.";
3394 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3395 (randint1(888) != 666)) ||
3396 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3397 randint1(100) != 66))
3400 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3412 /* Polymorph monster (Use "dam" as "power") */
3415 if (seen) obvious = TRUE;
3417 if (r_ptr->flagsr & RFR_RES_ALL)
3420 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3422 note = " is immune.";
3425 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3428 /* Attempt to polymorph (see below) */
3431 /* Powerful monsters can resist */
3432 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3433 (r_ptr->flags1 & RF1_QUESTOR) ||
3434 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3437 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3439 note = " is unaffected!";
3446 /* No "real" damage */
3453 /* Clone monsters (Ignore "dam") */
3456 if (seen) obvious = TRUE;
3458 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3461 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3463 note = " is unaffected!";
3469 m_ptr->hp = m_ptr->maxhp;
3471 /* Attempt to clone. */
3472 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3475 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3483 /* No "real" damage */
3490 /* Heal Monster (use "dam" as amount of healing) */
3493 if (seen) obvious = TRUE;
3498 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3500 if (m_ptr->maxhp < m_ptr->max_maxhp)
3503 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3505 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3507 m_ptr->maxhp = m_ptr->max_maxhp;
3513 if (seen) obvious = TRUE;
3518 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3523 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3525 msg_format("%^s is no longer stunned.", m_name);
3529 if (m_ptr->confused)
3532 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3534 msg_format("%^s is no longer confused.", m_name);
3536 m_ptr->confused = 0;
3541 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3543 msg_format("%^s recovers %s courage.", m_name, m_poss);
3549 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3552 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3554 chg_virtue(V_VITALITY, 1);
3556 if (r_ptr->flags1 & RF1_UNIQUE)
3557 chg_virtue(V_INDIVIDUALISM, 1);
3559 if (is_friendly(m_ptr))
3560 chg_virtue(V_HONOUR, 1);
3561 else if (!(r_ptr->flags3 & RF3_EVIL))
3563 if (r_ptr->flags3 & RF3_GOOD)
3564 chg_virtue(V_COMPASSION, 2);
3566 chg_virtue(V_COMPASSION, 1);
3569 if (m_ptr->r_idx == MON_LEPER)
3572 chg_virtue(V_COMPASSION, 5);
3575 if (r_ptr->flags3 & RF3_ANIMAL)
3576 chg_virtue(V_NATURE, 1);
3578 /* Redraw (later) if needed */
3579 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3580 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3584 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3586 note = " looks healthier.";
3590 /* No "real" damage */
3596 /* Speed Monster (Ignore "dam") */
3599 if (seen) obvious = TRUE;
3605 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3607 note = " starts moving faster.";
3610 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3612 if (c_ptr->m_idx == p_ptr->riding)
3613 p_ptr->update |= (PU_BONUS);
3615 if (r_ptr->flags1 & RF1_UNIQUE)
3616 chg_virtue(V_INDIVIDUALISM, 1);
3617 if (is_friendly(m_ptr))
3618 chg_virtue(V_HONOUR, 1);
3620 /* No "real" damage */
3626 /* Slow Monster (Use "dam" as "power") */
3629 if (seen) obvious = TRUE;
3631 if (r_ptr->flagsr & RFR_RES_ALL)
3634 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3636 note = " is immune.";
3639 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3642 /* Powerful monsters can resist */
3643 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3644 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3647 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3649 note = " is unaffected!";
3655 /* Normal monsters slow down */
3661 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3663 note = " starts moving slower.";
3666 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3668 if (c_ptr->m_idx == p_ptr->riding)
3669 p_ptr->update |= (PU_BONUS);
3672 /* No "real" damage */
3678 /* Sleep (Use "dam" as "power") */
3681 if (seen) obvious = TRUE;
3683 if (r_ptr->flagsr & RFR_RES_ALL)
3686 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3688 note = " is immune.";
3691 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3694 /* Attempt a saving throw */
3695 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3696 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3697 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3699 /* Memorize a flag */
3700 if (r_ptr->flags3 & RF3_NO_SLEEP)
3702 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3705 /* No obvious effect */
3707 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3709 note = " is unaffected!";
3716 /* Go to sleep (much) later */
3718 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3720 note = " falls asleep!";
3726 /* No "real" damage */
3732 /* Sleep (Use "dam" as "power") */
3733 case GF_STASIS_EVIL:
3735 if (seen) obvious = TRUE;
3737 if (r_ptr->flagsr & RFR_RES_ALL)
3740 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3742 note = " is immune.";
3745 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3748 /* Attempt a saving throw */
3749 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3750 !(r_ptr->flags3 & RF3_EVIL) ||
3751 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3754 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3756 note = " is unaffected!";
3763 /* Go to sleep (much) later */
3765 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3767 note = " is suspended!";
3773 /* No "real" damage */
3778 /* Sleep (Use "dam" as "power") */
3781 if (seen) obvious = TRUE;
3783 if (r_ptr->flagsr & RFR_RES_ALL)
3786 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3788 note = " is immune.";
3791 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3794 /* Attempt a saving throw */
3795 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3796 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3799 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3801 note = " is unaffected!";
3808 /* Go to sleep (much) later */
3810 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3812 note = " is suspended!";
3818 /* No "real" damage */
3827 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3828 vir = virtue_number(V_HARMONY);
3831 dam += p_ptr->virtues[vir-1]/10;
3834 vir = virtue_number(V_INDIVIDUALISM);
3837 dam -= p_ptr->virtues[vir-1]/20;
3840 if (seen) obvious = TRUE;
3842 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3845 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3847 note = " is immune.";
3850 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3854 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3857 /* Attempt a saving throw */
3858 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3859 (r_ptr->flags3 & RF3_NO_CONF) ||
3860 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3861 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3863 /* Memorize a flag */
3864 if (r_ptr->flags3 & RF3_NO_CONF)
3866 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3870 /* No obvious effect */
3872 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3874 note = " is unaffected!";
3879 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3881 else if (p_ptr->cursed & TRC_AGGRAVATE)
3884 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3886 note = " hates you too much!";
3889 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3894 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3896 note = " suddenly seems friendly!";
3901 chg_virtue(V_INDIVIDUALISM, -1);
3902 if (r_ptr->flags3 & RF3_ANIMAL)
3903 chg_virtue(V_NATURE, 1);
3906 /* No "real" damage */
3911 /* Control undead */
3912 case GF_CONTROL_UNDEAD:
3915 if (seen) obvious = TRUE;
3917 vir = virtue_number(V_UNLIFE);
3920 dam += p_ptr->virtues[vir-1]/10;
3923 vir = virtue_number(V_INDIVIDUALISM);
3926 dam -= p_ptr->virtues[vir-1]/20;
3929 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3932 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3934 note = " is immune.";
3937 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3941 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3944 /* Attempt a saving throw */
3945 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3946 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3947 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3948 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3950 /* No obvious effect */
3952 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3954 note = " is unaffected!";
3958 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3960 else if (p_ptr->cursed & TRC_AGGRAVATE)
3963 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3965 note = " hates you too much!";
3968 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3973 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3975 note = " is in your thrall!";
3981 /* No "real" damage */
3987 case GF_CONTROL_DEMON:
3990 if (seen) obvious = TRUE;
3992 vir = virtue_number(V_UNLIFE);
3995 dam += p_ptr->virtues[vir-1]/10;
3998 vir = virtue_number(V_INDIVIDUALISM);
4001 dam -= p_ptr->virtues[vir-1]/20;
4004 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4007 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4009 note = " is immune.";
4012 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4016 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4019 /* Attempt a saving throw */
4020 if ((r_ptr->flags1 & RF1_QUESTOR) ||
4021 (!(r_ptr->flags3 & RF3_DEMON)) ||
4022 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4023 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4025 /* No obvious effect */
4027 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4029 note = " is unaffected!";
4033 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4035 else if (p_ptr->cursed & TRC_AGGRAVATE)
4038 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4040 note = " hates you too much!";
4043 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4048 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
4050 note = " is in your thrall!";
4056 /* No "real" damage */
4062 case GF_CONTROL_ANIMAL:
4066 if (seen) obvious = TRUE;
4068 vir = virtue_number(V_NATURE);
4071 dam += p_ptr->virtues[vir-1]/10;
4074 vir = virtue_number(V_INDIVIDUALISM);
4077 dam -= p_ptr->virtues[vir-1]/20;
4080 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4083 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4085 note = " is immune.";
4088 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4092 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4095 /* Attempt a saving throw */
4096 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4097 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4098 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4099 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4100 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4102 /* Memorize a flag */
4103 if (r_ptr->flags3 & (RF3_NO_CONF))
4105 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4109 /* No obvious effect */
4111 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4113 note = " is unaffected!";
4117 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4119 else if (p_ptr->cursed & TRC_AGGRAVATE)
4122 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4124 note = " hates you too much!";
4127 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4132 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4134 note = " is tamed!";
4139 if (r_ptr->flags3 & RF3_ANIMAL)
4140 chg_virtue(V_NATURE, 1);
4143 /* No "real" damage */
4149 case GF_CONTROL_LIVING:
4153 vir = virtue_number(V_UNLIFE);
4154 if (seen) obvious = TRUE;
4156 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4157 vir = virtue_number(V_UNLIFE);
4160 dam -= p_ptr->virtues[vir-1]/10;
4163 vir = virtue_number(V_INDIVIDUALISM);
4166 dam -= p_ptr->virtues[vir-1]/20;
4169 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4170 if (dam < 1) dam = 1;
4172 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4174 msg_format("You stare into %s.", m_name);
4176 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4179 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4181 note = " is immune.";
4184 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4188 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4191 /* Attempt a saving throw */
4192 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4193 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4194 !monster_living(r_ptr) ||
4195 ((r_ptr->level+10) > randint1(dam)))
4198 /* No obvious effect */
4200 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4202 note = " is unaffected!";
4206 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4208 else if (p_ptr->cursed & TRC_AGGRAVATE)
4211 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4213 note = " hates you too much!";
4216 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4221 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4223 note = " is tamed!";
4228 if (r_ptr->flags3 & RF3_ANIMAL)
4229 chg_virtue(V_NATURE, 1);
4232 /* No "real" damage */
4237 /* Confusion (Use "dam" as "power") */
4240 if (seen) obvious = TRUE;
4242 if (r_ptr->flagsr & RFR_RES_ALL)
4245 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4247 note = " is immune.";
4250 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4253 /* Get confused later */
4254 do_conf = damroll(3, (dam / 2)) + 1;
4256 /* Attempt a saving throw */
4257 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4258 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4259 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4261 /* Memorize a flag */
4262 if (r_ptr->flags3 & (RF3_NO_CONF))
4264 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4270 /* No obvious effect */
4272 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4274 note = " is unaffected!";
4280 /* No "real" damage */
4287 if (seen) obvious = TRUE;
4289 if (r_ptr->flagsr & RFR_RES_ALL)
4292 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4294 note = " is immune.";
4297 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4300 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4302 /* Attempt a saving throw */
4303 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4304 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4309 /* No obvious effect */
4311 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4313 note = " is unaffected!";
4319 /* No "real" damage */
4327 /* Lite, but only hurts susceptible creatures */
4335 if (r_ptr->flagsr & RFR_RES_ALL)
4341 if (r_ptr->flags3 & (RF3_HURT_LITE))
4345 /* Obvious effect */
4348 /* Memorize the effects */
4349 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4352 /* Special effect */
4354 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4355 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4357 note = " cringes from the light!";
4358 note_dies = " shrivels away in the light!";
4363 /* Normally no damage */
4375 /* Lite -- opposite of Dark */
4378 if (seen) obvious = TRUE;
4380 if (r_ptr->flagsr & RFR_RES_ALL)
4383 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4385 note = " is immune.";
4388 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4391 if (r_ptr->flagsr & RFR_RES_LITE)
4394 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4399 dam *= 2; dam /= (randint1(6)+6);
4400 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4402 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4404 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4406 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4407 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4409 note = " cringes from the light!";
4410 note_dies = " shrivels away in the light!";
4419 /* Dark -- opposite of Lite */
4422 if (seen) obvious = TRUE;
4424 if (r_ptr->flagsr & RFR_RES_ALL)
4427 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4429 note = " is immune.";
4432 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4435 if (r_ptr->flagsr & RFR_RES_DARK)
4438 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4443 dam *= 2; dam /= (randint1(6)+6);
4444 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4453 if (r_ptr->flagsr & RFR_RES_ALL)
4458 /* Hurt by rock remover */
4459 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4466 /* Memorize the effects */
4467 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4470 /* Cute little message */
4472 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4473 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4475 note = " loses some skin!";
4476 note_dies = " dissolves!";
4481 /* Usually, ignore the effects */
4492 /* Teleport undead (Use "dam" as "power") */
4493 case GF_AWAY_UNDEAD:
4495 /* Only affect undead */
4496 if (r_ptr->flags3 & (RF3_UNDEAD))
4498 bool resists_tele = FALSE;
4500 if (r_ptr->flagsr & RFR_RES_TELE)
4502 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4504 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4506 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4508 note = " is unaffected!";
4511 resists_tele = TRUE;
4513 else if (r_ptr->level > randint1(100))
4515 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4517 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4522 resists_tele = TRUE;
4531 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4544 /* No "real" damage */
4550 /* Teleport evil (Use "dam" as "power") */
4553 /* Only affect evil */
4554 if (r_ptr->flags3 & (RF3_EVIL))
4556 bool resists_tele = FALSE;
4558 if (r_ptr->flagsr & RFR_RES_TELE)
4560 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4562 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4564 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4566 note = " is unaffected!";
4569 resists_tele = TRUE;
4571 else if (r_ptr->level > randint1(100))
4573 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4575 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4580 resists_tele = TRUE;
4589 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4602 /* No "real" damage */
4608 /* Teleport monster (Use "dam" as "power") */
4611 bool resists_tele = FALSE;
4612 if (r_ptr->flagsr & RFR_RES_TELE)
4614 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4616 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4618 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4620 note = " is unaffected!";
4623 resists_tele = TRUE;
4625 else if (r_ptr->level > randint1(100))
4627 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4629 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4634 resists_tele = TRUE;
4641 if (seen) obvious = TRUE;
4643 /* Prepare to teleport */
4647 /* No "real" damage */
4653 /* Turn undead (Use "dam" as "power") */
4654 case GF_TURN_UNDEAD:
4656 if (r_ptr->flagsr & RFR_RES_ALL)
4661 /* Only affect undead */
4662 if (r_ptr->flags3 & (RF3_UNDEAD))
4666 /* Learn about type */
4667 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4673 /* Apply some fear */
4674 do_fear = damroll(3, (dam / 2)) + 1;
4676 /* Attempt a saving throw */
4677 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4679 /* No obvious effect */
4681 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4683 note = " is unaffected!";
4698 /* No "real" damage */
4704 /* Turn evil (Use "dam" as "power") */
4707 if (r_ptr->flagsr & RFR_RES_ALL)
4712 /* Only affect evil */
4713 if (r_ptr->flags3 & (RF3_EVIL))
4717 /* Learn about type */
4718 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4724 /* Apply some fear */
4725 do_fear = damroll(3, (dam / 2)) + 1;
4727 /* Attempt a saving throw */
4728 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4730 /* No obvious effect */
4732 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4734 note = " is unaffected!";
4749 /* No "real" damage */
4755 /* Turn monster (Use "dam" as "power") */
4758 if (r_ptr->flagsr & RFR_RES_ALL)
4764 if (seen) obvious = TRUE;
4766 /* Apply some fear */
4767 do_fear = damroll(3, (dam / 2)) + 1;
4769 /* Attempt a saving throw */
4770 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4771 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4772 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4774 /* No obvious effect */
4776 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4778 note = " is unaffected!";
4785 /* No "real" damage */
4792 case GF_DISP_UNDEAD:
4794 if (r_ptr->flagsr & RFR_RES_ALL)
4800 /* Only affect undead */
4801 if (r_ptr->flags3 & (RF3_UNDEAD))
4805 /* Learn about type */
4806 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4814 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4815 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4817 note = " shudders.";
4818 note_dies = " dissolves!";
4840 if (r_ptr->flagsr & RFR_RES_ALL)
4846 /* Only affect evil */
4847 if (r_ptr->flags3 & (RF3_EVIL))
4851 /* Learn about type */
4852 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4860 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4861 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4863 note = " shudders.";
4864 note_dies = " dissolves!";
4885 if (r_ptr->flagsr & RFR_RES_ALL)
4891 /* Only affect good */
4892 if (r_ptr->flags3 & (RF3_GOOD))
4896 /* Learn about type */
4897 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4905 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4906 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4908 note = " shudders.";
4909 note_dies = " dissolves!";
4928 case GF_DISP_LIVING:
4930 if (r_ptr->flagsr & RFR_RES_ALL)
4936 /* Only affect non-undead */
4937 if (monster_living(r_ptr))
4940 if (seen) obvious = TRUE;
4944 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4945 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4947 note = " shudders.";
4948 note_dies = " dissolves!";
4969 if (r_ptr->flagsr & RFR_RES_ALL)
4975 /* Only affect demons */
4976 if (r_ptr->flags3 & (RF3_DEMON))
4980 /* Learn about type */
4981 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4989 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4990 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4992 note = " shudders.";
4993 note_dies = " dissolves!";
5011 /* Dispel monster */
5014 if (r_ptr->flagsr & RFR_RES_ALL)
5021 if (seen) obvious = TRUE;
5025 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
5026 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
5028 note = " shudders.";
5029 note_dies = " dissolves!";
5039 if (seen) obvious = TRUE;
5041 if (r_ptr->flagsr & RFR_RES_ALL)
5044 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5046 note = " is immune.";
5049 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5053 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
5057 monster_type *caster_ptr = &m_list[who];
5059 /* Heal the monster */
5060 if (caster_ptr->hp < caster_ptr->maxhp)
5063 caster_ptr->hp += 6 * dam;
5064 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
5066 /* Redraw (later) if needed */
5067 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5068 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5070 /* Special message */
5073 /* Get the monster name */
5074 monster_desc(killer, caster_ptr, 0);
5076 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
5078 msg_format("%^s appears healthier.", killer);
5087 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
5089 msg_format("You draw psychic energy from %s.", m_name);
5092 (void)hp_player(dam);
5098 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
5100 msg_format("%s is unaffected.", m_name);
5110 if (seen) obvious = TRUE;
5113 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5115 if (!who) msg_format("You gaze intently at %s.", m_name);
5118 if (r_ptr->flagsr & RFR_RES_ALL)
5121 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5123 note = " is immune.";
5126 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5130 /* Attempt a saving throw */
5131 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5132 (r_ptr->flags3 & RF3_NO_CONF) ||
5133 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5135 /* Memorize a flag */
5136 if (r_ptr->flags3 & (RF3_NO_CONF))
5138 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5141 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5143 note = "is unaffected!";
5147 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5149 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5151 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5153 note = " is immune!";
5157 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5159 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5161 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5170 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5171 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5173 note = " is blasted by psionic energy.";
5174 note_dies = " collapses, a mindless husk.";
5177 if (who > 0) do_conf = randint0(4) + 4;
5178 else do_conf = randint0(8) + 8;
5184 case GF_BRAIN_SMASH:
5186 if (seen) obvious = TRUE;
5189 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5191 if (!who) msg_format("You gaze intently at %s.", m_name);
5194 if (r_ptr->flagsr & RFR_RES_ALL)
5197 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5199 note = " is immune.";
5202 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5206 /* Attempt a saving throw */
5207 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5208 (r_ptr->flags3 & RF3_NO_CONF) ||
5209 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5211 /* Memorize a flag */
5212 if (r_ptr->flags3 & (RF3_NO_CONF))
5214 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5217 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5219 note = "is unaffected!";
5223 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5225 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5227 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5229 note = " is immune!";
5233 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5235 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5237 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5246 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5247 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5249 note = " is blasted by psionic energy.";
5250 note_dies = " collapses, a mindless husk.";
5255 do_conf = randint0(4) + 4;
5256 do_stun = randint0(4) + 4;
5260 do_conf = randint0(8) + 8;
5261 do_stun = randint0(8) + 8;
5263 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5264 if (c_ptr->m_idx == p_ptr->riding)
5265 p_ptr->update |= (PU_BONUS);
5273 if (seen) obvious = TRUE;
5276 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5278 if (!who) msg_format("You point at %s and curses.", m_name);
5281 if (r_ptr->flagsr & RFR_RES_ALL)
5284 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5286 note = " is immune.";
5289 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5293 /* Attempt a saving throw */
5294 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5297 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5299 note = "is unaffected!";
5309 if (seen) obvious = TRUE;
5312 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5314 if (!who) msg_format("You point at %s and curses horribly.", m_name);
5317 if (r_ptr->flagsr & RFR_RES_ALL)
5320 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5322 note = " is immune.";
5325 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5329 /* Attempt a saving throw */
5330 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5333 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5335 note = "is unaffected!";
5345 if (seen) obvious = TRUE;
5348 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5350 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5353 if (r_ptr->flagsr & RFR_RES_ALL)
5356 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5358 note = " is immune.";
5361 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5365 /* Attempt a saving throw */
5366 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5369 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5371 note = "is unaffected!";
5381 if (seen) obvious = TRUE;
5384 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5386 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5389 if (r_ptr->flagsr & RFR_RES_ALL)
5392 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5394 note = " is immune.";
5397 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5401 /* Attempt a saving throw */
5402 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (m_list[who].r_idx != MON_KENSHIROU)))
5405 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5407 note = "is unaffected!";
5417 if (seen) obvious = TRUE;
5419 if (r_ptr->flagsr & RFR_RES_ALL)
5422 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5424 note = " is immune.";
5427 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5431 if (r_ptr->flags1 & RF1_UNIQUE)
5434 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5436 note = "is unaffected!";
5442 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5443 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5445 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5447 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5452 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5462 /* Capture monster */
5466 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5467 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5470 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5472 msg_format("%^s is unaffected.", m_name);
5478 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5479 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5480 nokori_hp = m_ptr->maxhp * 3 / 10;
5482 nokori_hp = m_ptr->maxhp * 3 / 20;
5484 if (m_ptr->hp >= nokori_hp)
5487 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5489 msg_format("You need to weaken %s more.", m_name);
5493 else if (m_ptr->hp < randint0(nokori_hp))
5495 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5497 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5499 msg_format("You capture %^s!", m_name);
5501 cap_mon = m_list[c_ptr->m_idx].r_idx;
5502 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5503 cap_hp = m_list[c_ptr->m_idx].hp;
5504 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5505 if (m_list[c_ptr->m_idx].nickname)
5506 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5509 if (c_ptr->m_idx == p_ptr->riding)
5511 if (rakuba(-1, FALSE))
5514 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5516 msg_format("You have fallen from %s.", m_name);
5521 delete_monster_idx(c_ptr->m_idx);
5528 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5530 msg_format("You failed to capture %s.", m_name);
5537 /* Attack (Use "dam" as attack type) */
5540 /* Return this monster's death */
5541 return py_attack(y, x, dam);
5544 /* Sleep (Use "dam" as "power") */
5550 if (seen) obvious = TRUE;
5552 if (r_ptr->flagsr & RFR_RES_ALL)
5555 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5557 note = " is immune.";
5560 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5563 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5566 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5568 note = " is immune!";
5572 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5578 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5580 note = " is immune!";
5587 if (one_in_(5)) effect = 1;
5588 else if (one_in_(4)) effect = 2;
5589 else if (one_in_(3)) effect = 3;
5594 /* Powerful monsters can resist */
5595 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5596 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5599 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5601 note = " is unaffected!";
5607 /* Normal monsters slow down */
5613 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5615 note = " starts moving slower.";
5618 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5620 if (c_ptr->m_idx == p_ptr->riding)
5621 p_ptr->update |= (PU_BONUS);
5625 else if (effect == 2)
5627 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5629 /* Attempt a saving throw */
5630 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5631 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5636 /* No obvious effect */
5638 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5640 note = " is unaffected!";
5647 else if (effect == 3)
5649 /* Attempt a saving throw */
5650 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5651 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5652 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5654 /* Memorize a flag */
5655 if (r_ptr->flags3 & RF3_NO_SLEEP)
5657 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5660 /* No obvious effect */
5662 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5664 note = " is unaffected!";
5671 /* Go to sleep (much) later */
5673 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5675 note = " falls asleep!";
5685 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5687 note = " is immune!";
5691 /* No "real" damage */
5700 if (seen) obvious = TRUE;
5702 if (r_ptr->flagsr & RFR_RES_ALL)
5705 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5707 note = " is immune.";
5710 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5714 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (c_ptr->m_idx == p_ptr->riding)) || p_ptr->inside_arena || p_ptr->inside_quest)
5721 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG2_NOGENO))
5728 delete_monster_idx(c_ptr->m_idx);
5730 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5732 msg_format("%^s disappered!",m_name);
5736 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5738 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5742 chg_virtue(V_VITALITY, -1);
5747 p_ptr->redraw |= (PR_HP);
5750 p_ptr->window |= (PW_PLAYER);
5757 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5759 note = "is unaffected!";
5762 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
5770 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5772 if (!who) msg_format("You take a photograph of %s.", m_name);
5775 if (r_ptr->flags3 & (RF3_HURT_LITE))
5779 /* Obvious effect */
5782 /* Memorize the effects */
5783 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5786 /* Special effect */
5788 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5789 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5791 note = " cringes from the light!";
5792 note_dies = " shrivels away in the light!";
5797 /* Normally no damage */
5804 photo = m_ptr->r_idx;
5811 case GF_BLOOD_CURSE:
5813 if (seen) obvious = TRUE;
5815 if (r_ptr->flagsr & RFR_RES_ALL)
5818 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5820 note = " is immune.";
5823 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5831 bool success = FALSE;
5832 if (seen) obvious = TRUE;
5834 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5836 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5837 if (dam < 1) dam = 1;
5839 /* No need to tame your pet */
5843 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5845 note = " starts moving faster.";
5848 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5852 /* Attempt a saving throw */
5853 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5854 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5855 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5856 (p_ptr->cursed & TRC_AGGRAVATE) ||
5857 ((r_ptr->level+10) > randint1(dam)))
5860 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5865 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5867 note = " is tamed!";
5871 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5873 /* Learn about type */
5874 if (seen && is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5881 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5883 do_fear = randint1(90)+10;
5887 if (is_original_ap(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5891 /* No "real" damage */
5898 if (seen) obvious = TRUE;
5900 if (r_ptr->flagsr & RFR_RES_ALL)
5903 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5905 note = " is immune.";
5908 if (seen && is_original_ap(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5912 /* Attempt a saving throw */
5913 if (randint0(100 + dam) < (r_ptr->level + 50))
5917 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5919 note = "is unaffected!";
5940 /* Absolutely no effect */
5941 if (skipped) return (FALSE);
5943 /* "Unique" monsters cannot be polymorphed */
5944 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5946 /* Quest monsters cannot be polymorphed */
5947 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5949 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5951 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5952 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5954 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5959 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5960 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5963 /* Modify the damage */
5965 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5967 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5969 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5972 /* Check for death */
5973 if (dam > m_ptr->hp)
5975 /* Extract method of death */
5979 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5980 else if (do_poly && (randint1(90) > r_ptr->level))
5982 if (polymorph_monster(y, x))
5985 if (seen) obvious = TRUE;
5987 /* Monster polymorphs */
5989 note = "¤¬ÊѿȤ·¤¿¡ª";
5995 /* Turn off the damage */
5998 /* Hack -- Get new monster */
5999 m_ptr = &m_list[c_ptr->m_idx];
6001 /* Hack -- Get new race */
6002 r_ptr = &r_info[m_ptr->r_idx];
6008 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
6010 note = " is unaffected!";
6016 /* Handle "teleport" */
6020 if (seen) obvious = TRUE;
6024 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
6026 note = " disappears!";
6029 chg_virtue(V_VALOUR, -1);
6032 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
6034 /* Hack -- get new location */
6038 /* Hack -- get new grid */
6039 c_ptr = &cave[y][x];
6042 /* Sound and Impact resisters never stun */
6044 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
6045 !(r_ptr->flags3 & RF3_NO_STUN))
6048 if (seen) obvious = TRUE;
6054 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
6056 note = " is more dazed.";
6059 tmp = m_ptr->stunned + (do_stun / 2);
6064 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
6066 note = " is dazed.";
6073 m_ptr->stunned = (tmp < 200) ? tmp : 200;
6079 /* Confusion and Chaos resisters (and sleepers) never confuse */
6081 !(r_ptr->flags3 & RF3_NO_CONF) &&
6082 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
6085 if (seen) obvious = TRUE;
6087 /* Already partially confused */
6088 if (m_ptr->confused)
6091 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
6093 note = " looks more confused.";
6096 tmp = m_ptr->confused + (do_conf / 2);
6099 /* Was not confused */
6103 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
6105 note = " looks confused.";
6111 /* Apply confusion */
6112 m_ptr->confused = (tmp < 200) ? tmp : 200;
6121 if (seen) obvious = TRUE;
6123 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
6128 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
6130 note = " seems weakened.";
6132 m_ptr->maxhp -= do_time;
6133 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
6143 tmp = m_ptr->monfear + do_fear;
6146 m_ptr->monfear = (tmp < 200) ? tmp : 200;
6153 if (typ == GF_DRAIN_MANA)
6155 /* Drain mana does nothing */
6158 /* If another monster did the damage, hurt the monster by hand */
6161 /* Redraw (later) if needed */
6162 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
6163 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
6165 /* Wake the monster up */
6168 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
6170 /* Hurt the monster */
6178 if (is_pet(m_ptr) && !(m_ptr->ml))
6181 /* Give detailed messages if destroyed */
6184 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6187 msg_format("%^s%s", m_name, note);
6195 monster_gain_exp(who, m_ptr->r_idx);
6197 /* Generate treasure, etc */
6198 monster_death(c_ptr->m_idx, FALSE);
6200 /* Delete the monster */
6201 delete_monster_idx(c_ptr->m_idx);
6206 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6208 msg_print("You feel sad for a moment.");
6214 /* Damaged monster */
6217 /* Give detailed messages if visible or destroyed */
6218 if (note && seen) msg_format("%^s%s", m_name, note);
6220 /* Hack -- Pain message */
6223 message_pain(c_ptr->m_idx, dam);
6230 /* Hack -- handle sleep */
6231 if (do_sleep) m_ptr->csleep = do_sleep;
6235 else if (heal_leper)
6238 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6240 msg_print("The Mangy looking leper is healed!");
6243 delete_monster_idx(c_ptr->m_idx);
6246 /* If the player did it, give him experience, check fear */
6251 /* Hurt the monster, check for fear and death */
6252 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6257 /* Damaged monster */
6260 /* HACK - anger the monster before showing the sleep message */
6261 if (do_sleep) anger_monster(m_ptr);
6263 /* Give detailed messages if visible or destroyed */
6266 msg_format("%s%s", m_name, note);
6268 msg_format("%^s%s", m_name, note);
6272 /* Hack -- Pain message */
6273 else if (known && (dam || !do_fear))
6275 message_pain(c_ptr->m_idx, dam);
6278 /* Anger monsters */
6279 if (((dam > 0) || get_angry) && !do_sleep)
6280 anger_monster(m_ptr);
6283 if ((fear || do_fear) && (m_ptr->ml))
6290 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6292 msg_format("%^s flees in terror!", m_name);
6297 /* Hack -- handle sleep */
6298 if (do_sleep) m_ptr->csleep = do_sleep;
6302 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6304 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6308 switch (randint1(28))
6314 msg_print("ÃÏÌ̤¬Íɤ줿...");
6316 msg_print("The ground trembles...");
6319 earthquake(ty, tx, 4 + randint0(4));
6320 if (!one_in_(6)) break;
6322 case 3: case 4: case 5: case 6:
6325 int dam = damroll(10, 10);
6327 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6329 msg_print("A portal opens to a plane of raw mana!");
6332 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6333 if (!one_in_(6)) break;
6339 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6341 msg_print("Space warps about you!");
6344 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6345 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6346 if (!one_in_(6)) break;
6348 case 9: case 10: case 11:
6350 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6352 msg_print("You feel a surge of energy!");
6355 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6356 if (!one_in_(6)) break;
6357 case 12: case 13: case 14: case 15: case 16:
6358 aggravate_monsters(0);
6359 if (!one_in_(6)) break;
6361 count += activate_hi_summon(ty, tx, TRUE);
6362 if (!one_in_(6)) break;
6363 case 19: case 20: case 21: case 22:
6365 bool pet = !one_in_(3);
6366 u32b mode = PM_ALLOW_GROUP;
6368 if (pet) mode |= PM_FORCE_PET;
6369 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6371 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6372 if (!one_in_(6)) break;
6374 case 23: case 24: case 25:
6375 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6377 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6379 msg_print("You feel your life draining away...");
6382 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6383 else lose_exp(p_ptr->exp / 16);
6384 if (!one_in_(6)) break;
6385 case 26: case 27: case 28:
6394 (void)do_dec_stat(i);
6403 (void)do_dec_stat(randint0(6));
6412 if (p_ptr->inside_battle)
6414 p_ptr->health_who = c_ptr->m_idx;
6415 p_ptr->redraw |= (PR_HEALTH);
6419 /* XXX XXX XXX Verify this code */
6421 /* Update the monster */
6422 update_mon(c_ptr->m_idx, FALSE);
6424 /* Redraw the monster grid */
6428 /* Update monster recall window */
6429 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6432 p_ptr->window |= (PW_MONSTER);
6435 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6439 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6441 set_target(m_ptr, monster_target_y, monster_target_x);
6444 else if (is_pet(&m_list[who]) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6446 set_target(m_ptr, m_list[who].fy, m_list[who].fx);
6450 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6452 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6453 rakubadam_m = (dam > 200) ? 200 : dam;
6462 /* Get local object */
6465 /* Prepare to make a Blade of Chaos */
6466 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6468 q_ptr->pval = photo;
6470 /* Mark the item as fully known */
6471 q_ptr->ident |= (IDENT_MENTAL);
6473 /* Drop it in the dungeon */
6474 (void)drop_near(q_ptr, -1, py, px);
6482 /* Return "Anything seen?" */
6488 * Helper function for "project()" below.
6490 * Handle a beam/bolt/ball causing damage to the player.
6492 * This routine takes a "source monster" (by index), a "distance", a default
6493 * "damage", and a "damage type". See "project_m()" above.
6495 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6496 * is reduced (see "project_m()" above). This can happen if a monster breathes
6497 * at the player and hits a wall instead.
6499 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6500 * to know if this is actually a ball or a bolt spell
6503 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6504 * we just assume that the effects were obvious, for historical reasons.
6506 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6511 /* Hack -- assume obvious */
6512 bool obvious = TRUE;
6514 /* Player blind-ness */
6515 bool blind = (p_ptr->blind ? TRUE : FALSE);
6517 /* Player needs a "description" (he is blind) */
6520 /* Source monster */
6521 monster_type *m_ptr = NULL;
6523 /* Monster name (for attacks) */
6526 /* Monster name (for damage) */
6529 /* Hack -- messages */
6535 /* Player is not here */
6536 if (!player_bold(y, x)) return (FALSE);
6538 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6544 /* Player cannot hurt himself */
6545 if (!who) return (FALSE);
6546 if (who == p_ptr->riding) return (FALSE);
6548 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6551 int max_attempts = 10;
6554 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6555 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6556 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6558 if (blind) msg_print("Something bounces!");
6559 else msg_print("The attack bounces!");
6563 /* Choose 'new' target */
6566 t_y = m_list[who].fy - 1 + randint1(3);
6567 t_x = m_list[who].fx - 1 + randint1(3);
6570 while (max_attempts && in_bounds2u(t_y, t_x) &&
6571 !(player_has_los_bold(t_y, t_x)));
6573 if (max_attempts < 1)
6575 t_y = m_list[who].fy;
6576 t_x = m_list[who].fx;
6579 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6586 /* Limit maximum damage */
6587 if (dam > 1600) dam = 1600;
6589 /* Reduce damage by distance */
6590 dam = (dam + r) / (r + 1);
6593 /* If the player is blind, be more descriptive */
6594 if (blind) fuzzy = TRUE;
6599 /* Get the source monster */
6600 m_ptr = &m_list[who];
6601 /* Extract the monster level */
6602 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6604 /* Get the monster name */
6605 monster_desc(m_name, m_ptr, 0);
6607 /* Get the monster's real name (gotten before polymorph!) */
6608 strcpy(killer, who_name);
6613 strcpy(killer, "æ«");
6615 strcpy(killer, "a trap");
6619 /* Analyze the damage */
6622 /* Standard damage -- hurts inventory too */
6626 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6628 if (fuzzy) msg_print("You are hit by acid!");
6631 get_damage = acid_dam(dam, killer, monspell);
6635 /* Standard damage -- hurts inventory too */
6639 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6641 if (fuzzy) msg_print("You are hit by fire!");
6644 get_damage = fire_dam(dam, killer, monspell);
6648 /* Standard damage -- hurts inventory too */
6652 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6654 if (fuzzy) msg_print("You are hit by cold!");
6657 get_damage = cold_dam(dam, killer, monspell);
6661 /* Standard damage -- hurts inventory too */
6665 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6667 if (fuzzy) msg_print("You are hit by lightning!");
6670 get_damage = elec_dam(dam, killer, monspell);
6674 /* Standard damage -- also poisons player */
6677 bool double_resist = IS_OPPOSE_POIS();
6679 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6681 if (fuzzy) msg_print("You are hit by poison!");
6684 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6685 if (double_resist) dam = (dam + 2) / 3;
6687 if ((!(double_resist || p_ptr->resist_pois)) &&
6688 one_in_(HURT_CHANCE))
6693 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6695 if (!(double_resist || p_ptr->resist_pois))
6697 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6702 /* Standard damage -- also poisons / mutates player */
6705 bool double_resist = IS_OPPOSE_POIS();
6707 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6709 if (fuzzy) msg_print("You are hit by radiation!");
6712 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6713 if (double_resist) dam = (2 * dam + 2) / 5;
6714 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6715 if (!(double_resist || p_ptr->resist_pois))
6717 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6719 if (one_in_(5)) /* 6 */
6722 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6724 msg_print("You undergo a freakish metamorphosis!");
6727 if (one_in_(4)) /* 4 */
6735 inven_damage(set_acid_destroy, 2);
6741 /* Standard damage */
6745 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6747 if (fuzzy) msg_print("You are hit by something!");
6750 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6754 /* Holy Orb -- Player only takes partial damage */
6758 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6760 if (fuzzy) msg_print("You are hit by something!");
6763 if (p_ptr->align > 10)
6765 else if (p_ptr->align < -10)
6767 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6774 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6776 if (fuzzy) msg_print("You are hit by something!");
6779 if (p_ptr->align > 10)
6781 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6785 /* Arrow -- XXX no dodging */
6789 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6791 if (fuzzy) msg_print("You are hit by something sharp!");
6794 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6797 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6799 msg_print("You cut down the arrow!");
6803 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6807 /* Plasma -- XXX No resist */
6811 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6813 if (fuzzy) msg_print("You are hit by something *HOT*!");
6816 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6818 if (!p_ptr->resist_sound)
6820 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6821 (void)set_stun(p_ptr->stun + k);
6824 if (!(p_ptr->resist_fire ||
6826 p_ptr->immune_fire))
6828 inven_damage(set_acid_destroy, 3);
6834 /* Nether -- drain experience */
6838 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6840 if (fuzzy) msg_print("You are hit by nether forces!");
6844 if (p_ptr->resist_neth)
6846 if (!prace_is_(RACE_SPECTRE))
6847 dam *= 6; dam /= (randint1(4) + 7);
6849 else drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6851 if (prace_is_(RACE_SPECTRE))
6854 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6856 msg_print("You feel invigorated!");
6860 learn_spell(monspell);
6864 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6870 /* Water -- stun/confuse */
6874 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6876 if (fuzzy) msg_print("You are hit by something wet!");
6879 if (!p_ptr->resist_sound)
6881 set_stun(p_ptr->stun + randint1(40));
6883 if (!p_ptr->resist_conf)
6885 set_confused(p_ptr->confused + randint1(5) + 5);
6890 inven_damage(set_cold_destroy, 3);
6893 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6897 /* Chaos -- many effects */
6901 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6903 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6906 if (p_ptr->resist_chaos)
6908 dam *= 6; dam /= (randint1(4) + 7);
6910 if (!p_ptr->resist_conf)
6912 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6914 if (!p_ptr->resist_chaos)
6916 (void)set_image(p_ptr->image + randint1(10));
6920 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6922 msg_print("Your body is twisted by chaos!");
6925 (void)gain_random_mutation(0);
6928 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6930 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6932 if (!p_ptr->resist_chaos || one_in_(9))
6934 inven_damage(set_elec_destroy, 2);
6935 inven_damage(set_fire_destroy, 2);
6937 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6941 /* Shards -- mostly cutting */
6945 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6947 if (fuzzy) msg_print("You are hit by something sharp!");
6950 if (p_ptr->resist_shard)
6952 dam *= 6; dam /= (randint1(4) + 7);
6956 (void)set_cut(p_ptr->cut + dam);
6959 if (!p_ptr->resist_shard || one_in_(13))
6961 inven_damage(set_cold_destroy, 2);
6964 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6968 /* Sound -- mostly stunning */
6972 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6974 if (fuzzy) msg_print("You are hit by a loud noise!");
6977 if (p_ptr->resist_sound)
6979 dam *= 5; dam /= (randint1(4) + 7);
6983 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6984 (void)set_stun(p_ptr->stun + k);
6987 if (!p_ptr->resist_sound || one_in_(13))
6989 inven_damage(set_cold_destroy, 2);
6992 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6996 /* Pure confusion */
7000 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7002 if (fuzzy) msg_print("You are hit by something puzzling!");
7005 if (p_ptr->resist_conf)
7007 dam *= 5; dam /= (randint1(4) + 7);
7009 if (!p_ptr->resist_conf)
7011 (void)set_confused(p_ptr->confused + randint1(20) + 10);
7013 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7017 /* Disenchantment -- see above */
7021 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7023 if (fuzzy) msg_print("You are hit by something static!");
7026 if (p_ptr->resist_disen)
7028 dam *= 6; dam /= (randint1(4) + 7);
7032 (void)apply_disenchant(0);
7034 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7038 /* Nexus -- see above */
7042 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7044 if (fuzzy) msg_print("You are hit by something strange!");
7047 if (p_ptr->resist_nexus)
7049 dam *= 6; dam /= (randint1(4) + 7);
7055 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7059 /* Force -- mostly stun */
7063 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7065 if (fuzzy) msg_print("You are hit by kinetic force!");
7068 if (!p_ptr->resist_sound)
7070 (void)set_stun(p_ptr->stun + randint1(20));
7072 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7077 /* Rocket -- stun, cut */
7081 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
7083 if (fuzzy) msg_print("There is an explosion!");
7086 if (!p_ptr->resist_sound)
7088 (void)set_stun(p_ptr->stun + randint1(20));
7090 if (p_ptr->resist_shard)
7096 (void)set_cut(p_ptr-> cut + ( dam / 2));
7099 if ((!p_ptr->resist_shard) || one_in_(12))
7101 inven_damage(set_cold_destroy, 3);
7104 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7108 /* Inertia -- slowness */
7112 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7114 if (fuzzy) msg_print("You are hit by something slow!");
7117 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7118 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7122 /* Lite -- blinding */
7126 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7128 if (fuzzy) msg_print("You are hit by something!");
7131 if (p_ptr->resist_lite)
7133 dam *= 4; dam /= (randint1(4) + 7);
7135 else if (!blind && !p_ptr->resist_blind)
7137 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7139 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7142 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7144 msg_print("The light scorches your flesh!");
7149 else if (prace_is_(RACE_S_FAIRY))
7153 if (p_ptr->wraith_form) dam *= 2;
7154 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7156 if (p_ptr->wraith_form)
7158 p_ptr->wraith_form = 0;
7160 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7162 msg_print("The light forces you out of your incorporeal shadow form.");
7165 p_ptr->redraw |= PR_MAP;
7166 /* Update monsters */
7167 p_ptr->update |= (PU_MONSTERS);
7169 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7171 /* Redraw status bar */
7172 p_ptr->redraw |= (PR_STATUS);
7179 /* Dark -- blinding */
7183 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7185 if (fuzzy) msg_print("You are hit by something!");
7188 if (p_ptr->resist_dark)
7190 dam *= 4; dam /= (randint1(4) + 7);
7192 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7194 else if (!blind && !p_ptr->resist_blind)
7196 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7198 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7202 /* Time -- bolt fewer effects XXX */
7206 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7208 if (fuzzy) msg_print("You are hit by a blast from the past!");
7211 if (p_ptr->resist_time)
7214 dam /= (randint1(4) + 7);
7216 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7218 msg_print("You feel as if time is passing you by.");
7224 switch (randint1(10))
7226 case 1: case 2: case 3: case 4: case 5:
7228 if (p_ptr->prace == RACE_ANDROID) break;
7230 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7232 msg_print("You feel life has clocked back.");
7235 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7239 case 6: case 7: case 8: case 9:
7241 switch (randint1(6))
7244 case 1: k = A_STR; act = "¶¯¤¯"; break;
7245 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7246 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7247 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7248 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7249 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7251 case 1: k = A_STR; act = "strong"; break;
7252 case 2: k = A_INT; act = "bright"; break;
7253 case 3: k = A_WIS; act = "wise"; break;
7254 case 4: k = A_DEX; act = "agile"; break;
7255 case 5: k = A_CON; act = "hale"; break;
7256 case 6: k = A_CHR; act = "beautiful"; break;
7262 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7264 msg_format("You're not as %s as you used to be...", act);
7268 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7269 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7270 p_ptr->update |= (PU_BONUS);
7277 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7279 msg_print("You're not as powerful as you used to be...");
7283 for (k = 0; k < 6; k++)
7285 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7286 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7288 p_ptr->update |= (PU_BONUS);
7294 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7298 /* Gravity -- stun plus slowness plus teleport */
7302 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7303 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7305 if (fuzzy) msg_print("You are hit by something heavy!");
7306 msg_print("Gravity warps around you.");
7311 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7312 if (!(p_ptr->resist_sound || p_ptr->ffall))
7314 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7315 (void)set_stun(p_ptr->stun + k);
7319 dam = (dam * 2) / 3;
7322 if (!p_ptr->ffall || one_in_(13))
7324 inven_damage(set_cold_destroy, 2);
7327 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7331 /* Standard damage */
7332 case GF_DISINTEGRATE:
7335 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7337 if (fuzzy) msg_print("You are hit by pure energy!");
7340 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7347 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7349 if (fuzzy) msg_print("You are hit by something invigorating!");
7352 (void)hp_player(dam);
7360 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7362 if (fuzzy) msg_print("You are hit by something!");
7365 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7373 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7375 if (fuzzy) msg_print("You are hit by something slow!");
7378 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7384 if (p_ptr->free_act) break;
7386 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7388 if (fuzzy) msg_print("You fall asleep!");
7392 if (ironman_nightmare)
7395 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7397 msg_print("A horrible vision enters your mind.");
7401 /* Pick a nightmare */
7402 get_mon_num_prep(get_nightmare, NULL);
7404 /* Have some nightmares */
7405 have_nightmare(get_mon_num(MAX_DEPTH));
7407 /* Remove the monster restriction */
7408 get_mon_num_prep(NULL, NULL);
7411 set_paralyzed(p_ptr->paralyzed + dam);
7422 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7424 if (fuzzy) msg_print("You are hit by an aura of magic!");
7427 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7435 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7437 if (fuzzy) msg_print("You are hit by an energy!");
7440 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7448 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7450 if (fuzzy) msg_print("Something falls from the sky on you!");
7453 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7454 if (!p_ptr->resist_shard || one_in_(13))
7456 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7457 inven_damage(set_cold_destroy, 2);
7463 /* Ice -- cold plus stun plus cuts */
7467 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7469 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7472 cold_dam(dam, killer, monspell);
7473 if (!p_ptr->resist_shard)
7475 (void)set_cut(p_ptr->cut + damroll(5, 8));
7477 if (!p_ptr->resist_sound)
7479 (void)set_stun(p_ptr->stun + randint1(15));
7482 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7484 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7494 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7496 if (fuzzy) msg_print("You are hit by something extremely cold!");
7500 if (p_ptr->mimic_form)
7502 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7503 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7508 switch (p_ptr->prace)
7510 /* Some races are immune */
7524 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7540 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7541 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7543 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7544 else msg_print("Your psychic energy is drawn!");
7548 if (dam >= p_ptr->csp)
7552 p_ptr->csp_frac = 0;
7561 learn_spell(monspell);
7564 p_ptr->redraw |= (PR_MANA);
7567 p_ptr->window |= (PW_PLAYER);
7568 p_ptr->window |= (PW_SPELL);
7572 /* Heal the monster */
7573 if (m_ptr->hp < m_ptr->maxhp)
7576 m_ptr->hp += (6 * dam);
7577 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7579 /* Redraw (later) if needed */
7580 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7581 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7583 /* Special message */
7587 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7589 msg_format("%^s appears healthier.", m_name);
7603 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7606 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7608 msg_print("You resist the effects!");
7610 learn_spell(monspell);
7615 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7617 msg_print("Your mind is blasted by psyonic energy.");
7620 if (!p_ptr->resist_conf)
7622 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7625 if (!p_ptr->resist_chaos && one_in_(3))
7627 (void)set_image(p_ptr->image + randint0(250) + 150);
7634 p_ptr->csp_frac = 0;
7636 p_ptr->redraw |= PR_MANA;
7638 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7644 case GF_BRAIN_SMASH:
7646 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7649 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7651 msg_print("You resist the effects!");
7653 learn_spell(monspell);
7658 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7660 msg_print("Your mind is blasted by psionic energy.");
7667 p_ptr->csp_frac = 0;
7669 p_ptr->redraw |= PR_MANA;
7671 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7672 if (!p_ptr->resist_blind)
7674 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7676 if (!p_ptr->resist_conf)
7678 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7680 if (!p_ptr->free_act)
7682 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7684 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7686 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7687 (void)do_dec_stat(A_INT);
7688 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7689 (void)do_dec_stat(A_WIS);
7691 if (!p_ptr->resist_chaos)
7693 (void)set_image(p_ptr->image + randint0(250) + 150);
7702 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7705 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7707 msg_print("You resist the effects!");
7709 learn_spell(monspell);
7713 curse_equipment(15, 0);
7714 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7722 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7725 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7727 msg_print("You resist the effects!");
7729 learn_spell(monspell);
7733 curse_equipment(25, MIN(rlev/2-15, 5));
7734 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7742 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7745 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7747 msg_print("You resist the effects!");
7749 learn_spell(monspell);
7753 curse_equipment(33, MIN(rlev/2-15, 15));
7754 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7762 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
7765 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7767 msg_print("You resist the effects!");
7769 learn_spell(monspell);
7773 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7774 (void)set_cut(p_ptr->cut + damroll(10, 10));
7782 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7785 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7787 msg_format("You resist the effects!");
7789 learn_spell(monspell);
7794 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7796 msg_print("You feel your life fade away!");
7799 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7800 curse_equipment(40, 20);
7802 if (p_ptr->chp < 1) p_ptr->chp = 1;
7817 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
7820 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7822 char m_name_self[80];
7825 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7827 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7829 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7830 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7833 if (p_ptr->riding && dam > 0)
7835 rakubadam_p = (dam > 200) ? 200 : dam;
7843 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7849 /* Return "Anything seen?" */
7855 * Find the distance from (x, y) to a line.
7857 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7859 /* Vector from (x, y) to (x1, y1) */
7868 int pd = distance(y1, x1, y, x);
7869 int nd = distance(y1, x1, y2, x2);
7871 if (pd > nd) return distance(y, x, y2, x2);
7873 /* Component of P on N */
7874 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7876 /* Absolute value */
7877 return((nd >= 0) ? nd : 0 - nd);
7884 * Modified version of los() for calculation of disintegration balls.
7885 * Disintegration effects are stopped by permanent walls.
7887 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7907 /* Slope, or 1/Slope, of LOS */
7911 /* Extract the offset */
7915 /* Extract the absolute offset */
7920 /* Handle adjacent (or identical) grids */
7921 if ((ax < 2) && (ay < 2)) return (TRUE);
7924 /* Paranoia -- require "safe" origin */
7925 /* if (!in_bounds(y1, x1)) return (FALSE); */
7928 /* Directly South/North */
7931 /* South -- check for walls */
7934 for (ty = y1 + 1; ty < y2; ty++)
7936 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7940 /* North -- check for walls */
7943 for (ty = y1 - 1; ty > y2; ty--)
7945 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7953 /* Directly East/West */
7956 /* East -- check for walls */
7959 for (tx = x1 + 1; tx < x2; tx++)
7961 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7965 /* West -- check for walls */
7968 for (tx = x1 - 1; tx > x2; tx--)
7970 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7979 /* Extract some signs */
7980 sx = (dx < 0) ? -1 : 1;
7981 sy = (dy < 0) ? -1 : 1;
7984 /* Vertical "knights" */
7989 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7993 /* Horizontal "knights" */
7998 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
8003 /* Calculate scale factor div 2 */
8006 /* Calculate scale factor */
8010 /* Travel horizontally */
8013 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
8019 /* Consider the special case where slope == 1. */
8030 /* Note (below) the case (qy == f2), where */
8031 /* the LOS exactly meets the corner of a tile. */
8034 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8045 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8058 /* Travel vertically */
8061 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
8077 /* Note (below) the case (qx == f2), where */
8078 /* the LOS exactly meets the corner of a tile. */
8081 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8092 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8111 * Do disintegration effect on the terrain
8112 * before we decide the region of the effect.
8114 static bool do_disintegration(int by, int bx, int y, int x)
8118 /* Disintegration balls explosions are stopped by perma-walls */
8119 if (!in_disintegration_range(by, bx, y, x)) return FALSE;
8121 /* Permanent walls and artifacts don't get effect */
8122 /* But not protect monsters and other objects */
8123 if (!cave_valid_bold(y, x)) return TRUE;
8125 /* Destroy mirror/glyph */
8128 feat = cave[y][x].feat;
8130 if ((feat < FEAT_PATTERN_START || feat > FEAT_PATTERN_XTRA2) &&
8131 (feat < FEAT_DEEP_WATER || feat > FEAT_GRASS))
8133 if (feat == FEAT_TREES || feat == FEAT_FLOWER || feat == FEAT_DEEP_GRASS)
8134 cave_set_feat(y, x, FEAT_GRASS);
8136 cave_set_feat(y, x, floor_type[randint0(100)]);
8139 /* Update some things -- similar to GF_KILL_WALL */
8140 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8149 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, bool disint_ball, bool real_breath)
8154 int brev = rad * rad / dist;
8158 int tdis = distance(y1, x1, y2, x2);
8159 int mdis = tdis + rad;
8161 while (bdis <= mdis)
8165 if ((0 < dist) && (path_n < dist))
8167 int ny = GRID_Y(path_g[path_n]);
8168 int nx = GRID_X(path_g[path_n]);
8169 int nd = distance(ny, nx, y1, x1);
8171 /* Get next base point */
8180 /* Travel from center outward */
8181 for (cdis = 0; cdis <= brad; cdis++)
8183 /* Scan the maximal blast area of radius "cdis" */
8184 for (y = by - cdis; y <= by + cdis; y++)
8186 for (x = bx - cdis; x <= bx + cdis; x++)
8188 /* Ignore "illegal" locations */
8189 if (!in_bounds(y, x)) continue;
8191 /* Enforce a circular "ripple" */
8192 if (distance(y1, x1, y, x) != bdis) continue;
8194 /* Enforce an arc */
8195 if (distance(by, bx, y, x) != cdis) continue;
8200 /* Disintegration are stopped only by perma-walls */
8203 /* Destroy terrains */
8204 if (!do_disintegration(by, bx, y, x)) continue;
8208 /* No actual disintegration */
8209 if (!in_disintegration_range(by, bx, y, x)) continue;
8214 /* The blast is stopped by walls */
8215 if (!los(by, bx, y, x)) continue;
8218 /* Save this grid */
8226 /* Encode some more "radius" info */
8227 gm[bdis + 1] = *pgrids;
8229 /* Increase the size */
8230 brad = rad * (path_n + brev) / (dist + brev);
8232 /* Find the next ripple */
8236 /* Store the effect size */
8242 * Generic "beam"/"bolt"/"ball" projection routine.
8245 * who: Index of "source" monster (zero for "player")
8246 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8247 * y,x: Target location (or location to travel "towards")
8248 * dam: Base damage roll to apply to affected monsters (or player)
8249 * typ: Type of damage to apply to monsters (and objects)
8250 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8253 * TRUE if any "effects" of the projection were observed, else FALSE
8255 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8256 * towards a given location (optionally passing over the heads of interposing
8257 * monsters), and have it do a given amount of damage to the monsters (and
8258 * optionally objects) within the given radius of the final location.
8260 * A "bolt" travels from source to target and affects only the target grid.
8261 * A "beam" travels from source to target, affecting all grids passed through.
8262 * A "ball" travels from source to the target, exploding at the target, and
8263 * affecting everything within the given radius of the target location.
8265 * Traditionally, a "bolt" does not affect anything on the ground, and does
8266 * not pass over the heads of interposing monsters, much like a traditional
8267 * missile, and will "stop" abruptly at the "target" even if no monster is
8268 * positioned there, while a "ball", on the other hand, passes over the heads
8269 * of monsters between the source and target, and affects everything except
8270 * the source monster which lies within the final radius, while a "beam"
8271 * affects every monster between the source and target, except for the casting
8272 * monster (or player), and rarely affects things on the ground.
8274 * Two special flags allow us to use this function in special ways, the
8275 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8276 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8277 * actually projecting from the source monster (or player).
8279 * The player will only get "experience" for monsters killed by himself
8280 * Unique monsters can only be destroyed by attacks from the player
8282 * Only 256 grids can be affected per projection, limiting the effective
8283 * "radius" of standard ball attacks to nine units (diameter nineteen).
8285 * One can project in a given "direction" by combining PROJECT_THRU with small
8286 * offsets to the initial location (see "line_spell()"), or by calculating
8287 * "virtual targets" far away from the player.
8289 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8290 * continuing until it actually hits somethings (useful for "stone to mud").
8292 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8294 * Balls must explode BEFORE hitting walls, or they would affect monsters
8295 * on both sides of a wall. Some bug reports indicate that this is still
8296 * happening in 2.7.8 for Windows, though it appears to be impossible.
8298 * We "pre-calculate" the blast area only in part for efficiency.
8299 * More importantly, this lets us do "explosions" from the "inside" out.
8300 * This results in a more logical distribution of "blast" treasure.
8301 * It also produces a better (in my opinion) animation of the explosion.
8302 * It could be (but is not) used to have the treasure dropped by monsters
8303 * in the middle of the explosion fall "outwards", and then be damaged by
8304 * the blast as it spreads outwards towards the treasure drop location.
8306 * Walls and doors are included in the blast area, so that they can be
8307 * "burned" or "melted" in later versions.
8309 * This algorithm is intended to maximize simplicity, not necessarily
8310 * efficiency, since this function is not a bottleneck in the code.
8312 * We apply the blast effect from ground zero outwards, in several passes,
8313 * first affecting features, then objects, then monsters, then the player.
8314 * This allows walls to be removed before checking the object or monster
8315 * in the wall, and protects objects which are dropped by monsters killed
8316 * in the blast, and allows the player to see all affects before he is
8317 * killed or teleported away. The semantics of this method are open to
8318 * various interpretations, but they seem to work well in practice.
8320 * We process the blast area from ground-zero outwards to allow for better
8321 * distribution of treasure dropped by monsters, and because it provides a
8322 * pleasing visual effect at low cost.
8324 * Note that the damage done by "ball" explosions decreases with distance.
8325 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8327 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8328 * the target, and then the damage "flows" along this beam of destruction.
8329 * The damage at every grid is the same as at the "center" of a "ball"
8330 * explosion, since the "beam" grids are treated as if they ARE at the
8331 * center of a "ball" explosion.
8333 * Currently, specifying "beam" plus "ball" means that locations which are
8334 * covered by the initial "beam", and also covered by the final "ball", except
8335 * for the final grid (the epicenter of the ball), will be "hit twice", once
8336 * by the initial beam, and once by the exploding ball. For the grid right
8337 * next to the epicenter, this results in 150% damage being done. The center
8338 * does not have this problem, for the same reason the final grid in a "beam"
8339 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8340 * grids which are covered by the "ball" will NOT work, as then they will
8341 * receive LESS damage than they should. Do not combine "beam" with "ball".
8343 * The array "gy[],gx[]" with current size "grids" is used to hold the
8344 * collected locations of all grids in the "blast area" plus "beam path".
8346 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8347 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8348 * first blast grid (see above) with radius "N" from the blast center. Note
8349 * that only the first gm[1] grids in the blast area thus take full damage.
8350 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8351 * number of blast grids.
8353 * Note that once the projection is complete, (y2,x2) holds the final location
8354 * of bolts/beams, and the "epicenter" of balls.
8356 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8357 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8358 * implementation of the "distance" function. Also, a bolt can be properly
8359 * viewed as a "ball" with a "rad" of "zero".
8361 * Note that if no "target" is reached before the beam/bolt/ball travels the
8362 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8363 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8365 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8366 * to move from point A to point B, even if the player cannot see part of the
8367 * projection path. Note that in general, the player will *always* see part
8368 * of the path, since it either starts at the player or ends on the player.
8370 * Hack -- we assume that every "projection" is "self-illuminating".
8372 * Hack -- when only a single monster is affected, we automatically track
8373 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8375 * Note that all projections now "explode" at their final destination, even
8376 * if they were being projected at a more distant destination. This means
8377 * that "ball" spells will *always* explode.
8379 * Note that we must call "handle_stuff()" after affecting terrain features
8380 * in the blast radius, in case the "illumination" of the grid was changed,
8381 * and "update_view()" and "update_monsters()" need to be called.
8383 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8393 int y_saver, x_saver; /* For reflecting monsters */
8395 int msec = delay_factor * delay_factor * delay_factor;
8397 /* Assume the player sees nothing */
8398 bool notice = FALSE;
8400 /* Assume the player has seen nothing */
8401 bool visual = FALSE;
8403 /* Assume the player has seen no blast grids */
8406 /* Assume to be a normal ball spell */
8407 bool breath = FALSE;
8409 /* Is the player blind? */
8410 bool blind = (p_ptr->blind ? TRUE : FALSE);
8412 bool old_hide = FALSE;
8414 /* Number of grids in the "path" */
8417 /* Actual grids in the "path" */
8420 /* Number of grids in the "blast area" (including the "beam" path) */
8423 /* Coordinates of the affected grids */
8424 byte gx[1024], gy[1024];
8426 /* Encoded "radius" info (see above) */
8429 /* Actual radius encoded in gm[] */
8434 /* Attacker's name (prepared before polymorph)*/
8437 /* Initialize by null string */
8443 /* Default target of monsterspell is player */
8444 monster_target_y=py;
8445 monster_target_x=px;
8447 /* Hack -- Jump to target */
8448 if (flg & (PROJECT_JUMP))
8453 /* Clear the flag */
8454 flg &= ~(PROJECT_JUMP);
8459 /* Start at player */
8466 /* Start at monster */
8469 x1 = m_list[who].fx;
8470 y1 = m_list[who].fy;
8471 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8484 /* Default "destination" */
8489 /* Hack -- verify stuff */
8490 if (flg & (PROJECT_THRU))
8492 if ((x1 == x2) && (y1 == y2))
8494 flg &= ~(PROJECT_THRU);
8498 /* Handle a breath attack */
8503 if (flg & PROJECT_HIDE) old_hide = TRUE;
8504 flg |= PROJECT_HIDE;
8508 /* Hack -- Assume there will be no blast (max radius 32) */
8509 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8517 /* Collect beam grids */
8518 if (flg & (PROJECT_BEAM))
8525 if (breath && typ == GF_DISINTEGRATE)
8527 flg |= (PROJECT_DISI);
8530 /* Calculate the projection path */
8532 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8534 /* Hack -- Handle stuff */
8537 /* Giga-Hack SEEKER & SUPER_RAY */
8539 if( typ == GF_SEEKER )
8549 for (i = 0; i < path_n; ++i)
8554 int ny = GRID_Y(path_g[i]);
8555 int nx = GRID_X(path_g[i]);
8566 /* Only do visuals if requested */
8567 if (!blind && !(flg & (PROJECT_HIDE)))
8569 /* Only do visuals if the player can "see" the bolt */
8570 if (panel_contains(y, x) && player_has_los_bold(y, x))
8577 /* Obtain the bolt pict */
8578 p = bolt_pict(oy, ox, y, x, typ);
8580 /* Extract attr/char */
8584 /* Visual effects */
8585 print_rel(c, a, y, x);
8586 move_cursor_relative(y, x);
8587 /*if (fresh_before)*/ Term_fresh();
8588 Term_xtra(TERM_XTRA_DELAY, msec);
8590 /*if (fresh_before)*/ Term_fresh();
8592 /* Display "beam" grids */
8593 if (flg & (PROJECT_BEAM))
8595 /* Obtain the explosion pict */
8596 p = bolt_pict(y, x, y, x, typ);
8598 /* Extract attr/char */
8602 /* Visual effects */
8603 print_rel(c, a, y, x);
8606 /* Hack -- Activate delay */
8610 /* Hack -- delay anyway for consistency */
8613 /* Delay for consistency */
8614 Term_xtra(TERM_XTRA_DELAY, msec);
8617 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8618 if( is_mirror_grid(&cave[y][x]))
8620 /* The target of monsterspell becomes tha mirror(broken) */
8621 monster_target_y=(s16b)y;
8622 monster_target_x=(s16b)x;
8625 next_mirror( &oy,&ox,y,x );
8627 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8628 for( j = last_i; j <=i ; j++ )
8630 y = GRID_Y(path_g[j]);
8631 x = GRID_X(path_g[j]);
8632 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8633 if(!who && (project_m_n==1) && !jump ){
8634 if(cave[project_m_y][project_m_x].m_idx >0 ){
8635 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8637 /* Hack -- auto-recall */
8638 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8640 /* Hack - auto-track */
8641 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8644 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8649 for( i = last_i ; i < path_n ; i++ )
8652 y = GRID_Y(path_g[i]);
8653 x = GRID_X(path_g[i]);
8654 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8656 if(!who && (project_m_n==1) && !jump ){
8657 if(cave[project_m_y][project_m_x].m_idx >0 ){
8658 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8660 /* Hack -- auto-recall */
8661 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8663 /* Hack - auto-track */
8664 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8667 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8671 else if(typ == GF_SUPER_RAY){
8673 int second_step = 0;
8680 for (i = 0; i < path_n; ++i)
8685 int ny = GRID_Y(path_g[i]);
8686 int nx = GRID_X(path_g[i]);
8697 /* Only do visuals if requested */
8698 if (!blind && !(flg & (PROJECT_HIDE)))
8700 /* Only do visuals if the player can "see" the bolt */
8701 if (panel_contains(y, x) && player_has_los_bold(y, x))
8708 /* Obtain the bolt pict */
8709 p = bolt_pict(oy, ox, y, x, typ);
8711 /* Extract attr/char */
8715 /* Visual effects */
8716 print_rel(c, a, y, x);
8717 move_cursor_relative(y, x);
8718 /*if (fresh_before)*/ Term_fresh();
8719 Term_xtra(TERM_XTRA_DELAY, msec);
8721 /*if (fresh_before)*/ Term_fresh();
8723 /* Display "beam" grids */
8724 if (flg & (PROJECT_BEAM))
8726 /* Obtain the explosion pict */
8727 p = bolt_pict(y, x, y, x, typ);
8729 /* Extract attr/char */
8733 /* Visual effects */
8734 print_rel(c, a, y, x);
8737 /* Hack -- Activate delay */
8741 /* Hack -- delay anyway for consistency */
8744 /* Delay for consistency */
8745 Term_xtra(TERM_XTRA_DELAY, msec);
8748 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8749 if( cave[y][x].feat == FEAT_RUBBLE ||
8750 cave[y][x].feat == FEAT_DOOR_HEAD ||
8751 cave[y][x].feat == FEAT_DOOR_TAIL ||
8752 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8753 cave[y][x].feat <= FEAT_PERM_SOLID ))
8755 if( second_step )continue;
8758 if( is_mirror_grid(&cave[y][x]) && !second_step )
8760 /* The target of monsterspell becomes tha mirror(broken) */
8761 monster_target_y=(s16b)y;
8762 monster_target_x=(s16b)x;
8765 for( j = 0; j <=i ; j++ )
8767 y = GRID_Y(path_g[j]);
8768 x = GRID_X(path_g[j]);
8769 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8773 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8774 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8775 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8776 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8777 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8778 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8779 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8780 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8783 for( i = 0; i < path_n ; i++ )
8786 y = GRID_Y(path_g[i]);
8787 x = GRID_X(path_g[i]);
8788 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8789 if(!who && (project_m_n==1) && !jump ){
8790 if(cave[project_m_y][project_m_x].m_idx >0 ){
8791 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8793 /* Hack -- auto-recall */
8794 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8796 /* Hack - auto-track */
8797 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8800 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8805 /* Project along the path */
8806 for (i = 0; i < path_n; ++i)
8811 int ny = GRID_Y(path_g[i]);
8812 int nx = GRID_X(path_g[i]);
8814 if (flg & PROJECT_DISI)
8816 /* Hack -- Balls explode before reaching walls */
8817 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8821 /* Hack -- Balls explode before reaching walls */
8822 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8829 /* Collect beam grids */
8830 if (flg & (PROJECT_BEAM))
8837 /* Only do visuals if requested */
8838 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8840 /* Only do visuals if the player can "see" the bolt */
8841 if (panel_contains(y, x) && player_has_los_bold(y, x))
8848 /* Obtain the bolt pict */
8849 p = bolt_pict(oy, ox, y, x, typ);
8851 /* Extract attr/char */
8855 /* Visual effects */
8856 print_rel(c, a, y, x);
8857 move_cursor_relative(y, x);
8858 /*if (fresh_before)*/ Term_fresh();
8859 Term_xtra(TERM_XTRA_DELAY, msec);
8861 /*if (fresh_before)*/ Term_fresh();
8863 /* Display "beam" grids */
8864 if (flg & (PROJECT_BEAM))
8866 /* Obtain the explosion pict */
8867 p = bolt_pict(y, x, y, x, typ);
8869 /* Extract attr/char */
8873 /* Visual effects */
8874 print_rel(c, a, y, x);
8877 /* Hack -- Activate delay */
8881 /* Hack -- delay anyway for consistency */
8884 /* Delay for consistency */
8885 Term_xtra(TERM_XTRA_DELAY, msec);
8890 /* Save the "blast epicenter" */
8894 if (breath && (y1 == by) && (x1 == bx))
8900 flg &= ~(PROJECT_HIDE);
8904 /* Start the "explosion" */
8907 /* Hack -- make sure beams get to "explode" */
8915 /* If we found a "target", explode there */
8916 if (dist <= MAX_RANGE)
8918 /* Mega-Hack -- remove the final "beam" grid */
8919 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8922 * Create a conical breath attack
8933 flg &= ~(PROJECT_HIDE);
8935 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, (bool)(typ == GF_DISINTEGRATE), TRUE);
8939 /* Determine the blast area, work from the inside out */
8940 for (dist = 0; dist <= rad; dist++)
8942 /* Scan the maximal blast area of radius "dist" */
8943 for (y = by - dist; y <= by + dist; y++)
8945 for (x = bx - dist; x <= bx + dist; x++)
8947 /* Ignore "illegal" locations */
8948 if (!in_bounds2(y, x)) continue;
8950 /* Enforce a "circular" explosion */
8951 if (distance(by, bx, y, x) != dist) continue;
8953 if (typ == GF_DISINTEGRATE)
8955 /* Disintegration are stopped only by perma-walls */
8956 if (!do_disintegration(by, bx, y, x)) continue;
8960 /* Ball explosions are stopped by walls */
8961 if (!los(by, bx, y, x)) continue;
8964 /* Save this grid */
8971 /* Encode some more "radius" info */
8977 /* Speed -- ignore "non-explosions" */
8978 if (!grids) return (FALSE);
8981 /* Display the "blast area" if requested */
8982 if (!blind && !(flg & (PROJECT_HIDE)))
8984 /* Then do the "blast", from inside out */
8985 for (t = 0; t <= gm_rad; t++)
8987 /* Dump everything with this radius */
8988 for (i = gm[t]; i < gm[t+1]; i++)
8990 /* Extract the location */
8994 /* Only do visuals if the player can "see" the blast */
8995 if (panel_contains(y, x) && player_has_los_bold(y, x))
9004 /* Obtain the explosion pict */
9005 p = bolt_pict(y, x, y, x, typ);
9007 /* Extract attr/char */
9011 /* Visual effects -- Display */
9012 print_rel(c, a, y, x);
9016 /* Hack -- center the cursor */
9017 move_cursor_relative(by, bx);
9019 /* Flush each "radius" seperately */
9020 /*if (fresh_before)*/ Term_fresh();
9022 /* Delay (efficiently) */
9023 if (visual || drawn)
9025 Term_xtra(TERM_XTRA_DELAY, msec);
9029 /* Flush the erasing */
9032 /* Erase the explosion drawn above */
9033 for (i = 0; i < grids; i++)
9035 /* Extract the location */
9039 /* Hack -- Erase if needed */
9040 if (panel_contains(y, x) && player_has_los_bold(y, x))
9046 /* Hack -- center the cursor */
9047 move_cursor_relative(by, bx);
9049 /* Flush the explosion */
9050 /*if (fresh_before)*/ Term_fresh();
9055 /* Update stuff if needed */
9056 if (p_ptr->update) update_stuff();
9059 /* Check features */
9060 if (flg & (PROJECT_GRID))
9062 /* Start with "dist" of zero */
9065 /* Scan for features */
9066 for (i = 0; i < grids; i++)
9068 /* Hack -- Notice new "dist" values */
9069 if (gm[dist+1] == i) dist++;
9071 /* Get the grid location */
9075 /* Find the closest point in the blast */
9078 int d = dist_to_line(y, x, y1, x1, by, bx);
9080 /* Affect the grid */
9081 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
9085 /* Affect the grid */
9086 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
9093 if (flg & (PROJECT_ITEM))
9095 /* Start with "dist" of zero */
9098 /* Scan for objects */
9099 for (i = 0; i < grids; i++)
9101 /* Hack -- Notice new "dist" values */
9102 if (gm[dist+1] == i) dist++;
9104 /* Get the grid location */
9108 /* Find the closest point in the blast */
9111 int d = dist_to_line(y, x, y1, x1, by, bx);
9113 /* Affect the object in the grid */
9114 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
9118 /* Affect the object in the grid */
9119 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
9125 /* Check monsters */
9126 if (flg & (PROJECT_KILL))
9133 /* Start with "dist" of zero */
9136 /* Scan for monsters */
9137 for (i = 0; i < grids; i++)
9141 /* Hack -- Notice new "dist" values */
9142 if (gm[dist + 1] == i) dist++;
9144 /* Get the grid location */
9148 /* A single bolt may be reflected */
9151 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9152 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9154 if ((ref_ptr->flags2 & RF2_REFLECTING) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1) && !one_in_(10))
9157 int max_attempts = 10;
9159 /* Choose 'new' target */
9162 t_y = y_saver - 1 + randint1(3);
9163 t_x = x_saver - 1 + randint1(3);
9166 while (max_attempts && in_bounds2u(t_y, t_x) &&
9167 !(los(y, x, t_y, t_x)));
9169 if (max_attempts < 1)
9178 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9179 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9180 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9181 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9183 msg_print("The attack bounces!");
9186 if (is_original_ap(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9189 /* Reflected bolts randomly target either one */
9190 if (one_in_(2)) flg |= PROJECT_PLAYER;
9191 else flg &= ~(PROJECT_PLAYER);
9193 /* The bolt is reflected */
9194 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9196 /* Don't affect the monster any longer */
9202 /* Find the closest point in the blast */
9205 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9209 effective_dist = dist;
9213 /* There is the riding player on this monster */
9214 if (p_ptr->riding && player_bold(y, x))
9216 /* Aimed on the player */
9217 if (flg & PROJECT_PLAYER)
9219 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9222 * A beam or bolt is well aimed
9224 * So don't affects the mount.
9231 * The spell is not well aimed,
9232 * So partly affect the mount too.
9239 * This grid is the original target.
9240 * Or aimed on your horse.
9242 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9244 /* Hit the mount with full damage */
9248 * Otherwise this grid is not the
9249 * original target, it means that line
9250 * of fire is obstructed by this
9254 * A beam or bolt will hit either
9255 * player or mount. Choose randomly.
9257 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9261 /* Hit the mount with full damage */
9265 /* Hit the player later */
9266 flg |= PROJECT_PLAYER;
9268 /* Don't affect the mount */
9274 * The spell is not well aimed, so
9275 * partly affect both player and
9284 /* Affect the monster in the grid */
9285 if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
9289 /* Player affected one monster (without "jumping") */
9290 if (!who && (project_m_n == 1) && !jump)
9296 /* Track if possible */
9297 if (cave[y][x].m_idx > 0)
9299 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9301 /* Hack -- auto-recall */
9302 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
9304 /* Hack - auto-track */
9305 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9312 if (flg & (PROJECT_KILL))
9314 /* Start with "dist" of zero */
9317 /* Scan for player */
9318 for (i = 0; i < grids; i++)
9322 /* Hack -- Notice new "dist" values */
9323 if (gm[dist+1] == i) dist++;
9325 /* Get the grid location */
9329 /* Affect the player? */
9330 if (!player_bold(y, x)) continue;
9332 /* Find the closest point in the blast */
9335 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9339 effective_dist = dist;
9342 /* Target may be your horse */
9345 /* Aimed on the player */
9346 if (flg & PROJECT_PLAYER)
9348 /* Hit the player with full damage */
9352 * Hack -- When this grid was not the
9353 * original target, a beam or bolt
9354 * would hit either player or mount,
9355 * and should be choosen randomly.
9357 * But already choosen to hit the
9358 * mount at this point.
9360 * Or aimed on your horse.
9362 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9365 * A beam or bolt is well aimed
9367 * So don't affects the player.
9374 * The spell is not well aimed,
9375 * So partly affect the player too.
9381 /* Affect the player */
9382 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9390 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9392 if (rakubadam_m > 0)
9394 if (rakuba(rakubadam_m, FALSE))
9397 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9399 msg_format("%^s has thrown you off!", m_name);
9403 if (p_ptr->riding && rakubadam_p > 0)
9405 if(rakuba(rakubadam_p, FALSE))
9408 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9410 msg_format("You have fallen from %s.", m_name);
9416 /* Return "something was noticed" */
9420 bool binding_field( int dam )
9422 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9423 int mirror_num=0; /* ¶À¤Î¿ô */
9428 int msec= delay_factor*delay_factor*delay_factor;
9434 /* Default target of monsterspell is player */
9435 monster_target_y=py;
9436 monster_target_x=px;
9438 for( x=0 ; x < cur_wid ; x++ )
9440 for( y=0 ; y < cur_hgt ; y++ )
9442 if( is_mirror_grid(&cave[y][x]) &&
9443 distance(py,px,y,x) <= MAX_RANGE &&
9444 distance(py,px,y,x) != 0 &&
9445 player_has_los_bold(y,x)
9447 mirror_y[mirror_num]=y;
9448 mirror_x[mirror_num]=x;
9454 if( mirror_num < 2 )return FALSE;
9456 point_x[0] = randint0( mirror_num );
9458 point_x[1] = randint0( mirror_num );
9460 while( point_x[0] == point_x[1] );
9462 point_y[0]=mirror_y[point_x[0]];
9463 point_x[0]=mirror_x[point_x[0]];
9464 point_y[1]=mirror_y[point_x[1]];
9465 point_x[1]=mirror_x[point_x[1]];
9469 x=point_x[0]+point_x[1]+point_x[2];
9470 y=point_y[0]+point_y[1]+point_y[2];
9472 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9473 - (point_y[0]*3-y)*(point_x[1]*3-x);
9474 if( centersign == 0 )return FALSE;
9476 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9477 x1 = x1 < point_x[2] ? x1 : point_x[2];
9478 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9479 y1 = y1 < point_y[2] ? y1 : point_y[2];
9481 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9482 x2 = x2 > point_x[2] ? x2 : point_x[2];
9483 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9484 y2 = y2 > point_y[2] ? y2 : point_y[2];
9486 for( y=y1 ; y <=y2 ; y++ ){
9487 for( x=x1 ; x <=x2 ; x++ ){
9488 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9489 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9490 centersign*( (point_x[1]-x)*(point_y[2]-y)
9491 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9492 centersign*( (point_x[2]-x)*(point_y[0]-y)
9493 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9495 if( player_has_los_bold(y,x)){
9496 /* Visual effects */
9498 && panel_contains(y,x)){
9499 p = bolt_pict(y,x,y,x, GF_MANA );
9500 print_rel(PICT_C(p), PICT_A(p),y,x);
9501 move_cursor_relative(y, x);
9502 /*if (fresh_before)*/ Term_fresh();
9503 Term_xtra(TERM_XTRA_DELAY, msec);
9509 for( y=y1 ; y <=y2 ; y++ ){
9510 for( x=x1 ; x <=x2 ; x++ ){
9511 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9512 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9513 centersign*( (point_x[1]-x)*(point_y[2]-y)
9514 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9515 centersign*( (point_x[2]-x)*(point_y[0]-y)
9516 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9518 if( player_has_los_bold(y,x)){
9519 (void)project_f(0,0,y,x,dam,GF_MANA);
9524 for( y=y1 ; y <=y2 ; y++ ){
9525 for( x=x1 ; x <=x2 ; x++ ){
9526 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9527 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9528 centersign*( (point_x[1]-x)*(point_y[2]-y)
9529 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9530 centersign*( (point_x[2]-x)*(point_y[0]-y)
9531 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9533 if( player_has_los_bold(y,x)){
9534 (void)project_o(0,0,y,x,dam,GF_MANA);
9539 for( y=y1 ; y <=y2 ; y++ ){
9540 for( x=x1 ; x <=x2 ; x++ ){
9541 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9542 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9543 centersign*( (point_x[1]-x)*(point_y[2]-y)
9544 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9545 centersign*( (point_x[2]-x)*(point_y[0]-y)
9546 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9548 if( player_has_los_bold(y,x) ){
9549 (void)project_m(0,0,y,x,dam,GF_MANA,
9550 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP));
9557 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9559 msg_print("The field broke a mirror");
9561 remove_mirror(point_y[0],point_x[0]);
9567 void seal_of_mirror( int dam )
9571 for( x = 0 ; x < cur_wid ; x++ )
9573 for( y = 0 ; y < cur_hgt ; y++ )
9575 if( is_mirror_grid(&cave[y][x]))
9577 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9578 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP)))
9580 if( !cave[y][x].m_idx )