3 /* Purpose: Spell projection */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
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 )
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( cave[y][x].feat == FEAT_MIRROR ){
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=randint0(cur_hgt);
67 *next_x=randint0(cur_wid);
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))
393 if ((n > 0) && (cave[y][x].m_idx != 0)) break;
396 if (!in_bounds(y, x)) break;
401 /* Advance (X) part 1 */
404 /* Horizontal change */
407 /* Advance (X) part 2 */
410 /* Advance (X) part 3 */
426 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
435 /* Vertical change */
438 /* Advance (Y) part 2 */
441 /* Advance (Y) part 3 */
448 /* Create the projection path */
452 gp[n++] = GRID(y, x);
454 /* Hack -- Check maximum range */
455 if ((n + (k >> 1)) >= range) break;
457 /* Sometimes stop at destination grid */
458 if (!(flg & (PROJECT_THRU)))
460 if ((x == x2) && (y == y2)) break;
463 if (flg & (PROJECT_DISI))
465 if ((n > 0) && cave_stop_disintegration(y, x)) break;
467 else if (!(flg & (PROJECT_PATH)))
469 /* Always stop at non-initial wall grids */
470 if ((n > 0) && !cave_floor_bold(y, x)) break;
473 /* Sometimes stop at non-initial monsters/players */
474 if (flg & (PROJECT_STOP))
476 if ((n > 0) && (cave[y][x].m_idx != 0)) break;
479 if (!in_bounds(y, x)) break;
484 /* Advance (Y) part 1 */
487 /* Vertical change */
490 /* Advance (Y) part 2 */
493 /* Advance (Y) part 3 */
513 /* Create the projection path */
517 gp[n++] = GRID(y, x);
519 /* Hack -- Check maximum range */
520 if ((n + (n >> 1)) >= range) break;
522 /* Sometimes stop at destination grid */
523 if (!(flg & (PROJECT_THRU)))
525 if ((x == x2) && (y == y2)) break;
528 if (flg & (PROJECT_DISI))
530 if ((n > 0) && cave_stop_disintegration(y, x)) break;
532 else if (!(flg & (PROJECT_PATH)))
534 /* Always stop at non-initial wall grids */
535 if ((n > 0) && !cave_floor_bold(y, x)) break;
538 /* Sometimes stop at non-initial monsters/players */
539 if (flg & (PROJECT_STOP))
541 if ((n > 0) && (cave[y][x].m_idx != 0)) break;
544 if (!in_bounds(y, x)) break;
561 * Mega-Hack -- track "affected" monsters (see "project()" comments)
563 static int project_m_n;
564 static int project_m_x;
565 static int project_m_y;
566 /* Mega-Hack -- monsters target */
567 static s16b monster_target_x;
568 static s16b monster_target_y;
572 * We are called from "project()" to "damage" terrain features
574 * We are called both for "beam" effects and "ball" effects.
576 * The "r" parameter is the "distance from ground zero".
578 * Note that we determine if the player can "see" anything that happens
579 * by taking into account: blindness, line-of-sight, and illumination.
581 * We return "TRUE" if the effect of the projection is "obvious".
583 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
585 * XXX XXX XXX Perhaps we should affect doors?
587 static bool project_f(int who, int r, int y, int x, int dam, int typ)
589 cave_type *c_ptr = &cave[y][x];
591 bool obvious = FALSE;
592 bool known = player_has_los_bold(y, x);
598 /* Reduce damage by distance */
599 dam = (dam + r) / (r + 1);
602 if (c_ptr->feat == FEAT_TREES)
611 message = "¸Ï¤ì¤¿";break;
613 message = "was blasted.";break;
617 message = "½Ì¤ó¤À";break;
619 message = "shrank.";break;
623 message = "ÍϤ±¤¿";break;
625 message = "melted.";break;
630 message = "Åà¤ê¡¢ºÕ¤±»¶¤Ã¤¿";break;
632 message = "was frozen and smashed.";break;
638 message = "dz¤¨¤¿";break;
640 message = "burns up!";break;
654 message = "Ê´ºÕ¤µ¤ì¤¿";break;
656 message = "was crushed.";break;
659 message = NULL;break;
664 msg_format("ÌÚ¤Ï%s¡£", message);
666 msg_format("A tree %s", message);
668 c_ptr->feat = (one_in_(3) ? FEAT_DEEP_GRASS : FEAT_GRASS);
669 c_ptr->info &= ~(CAVE_MASK);
670 c_ptr->info |= CAVE_FLOOR;
673 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
675 /* Update some things */
676 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
680 /* Analyze the type */
683 /* Ignore most effects */
697 case GF_DISINTEGRATE:
719 /* Destroy Traps (and Locks) */
722 /* Reveal secret doors */
723 if (c_ptr->feat == FEAT_SECRET)
726 place_closed_door(y, x);
728 /* Check line of sight */
736 if ((c_ptr->info & CAVE_TRAP) || is_trap(c_ptr->feat))
738 /* Check line of sight */
742 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
744 msg_print("There is a bright flash of light!");
750 /* Forget the trap */
751 c_ptr->info &= ~(CAVE_MARK);
753 /* Destroy the trap */
754 if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
757 c_ptr->feat = floor_type[randint0(100)];
758 c_ptr->info &= ~(CAVE_MASK);
759 c_ptr->info |= CAVE_FLOOR;
763 /* Locked doors are unlocked */
764 else if ((c_ptr->feat >= FEAT_DOOR_HEAD + 0x01) &&
765 (c_ptr->feat <= FEAT_DOOR_HEAD + 0x07))
767 /* Unlock the door */
768 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
770 /* Check line of sound */
774 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
789 /* Destroy Doors (and traps) */
792 /* Destroy all doors and traps */
793 if ((c_ptr->feat == FEAT_OPEN) ||
794 (c_ptr->feat == FEAT_BROKEN) ||
795 (c_ptr->info & CAVE_TRAP) ||
796 (is_trap(c_ptr->feat)) ||
797 ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
798 (c_ptr->feat <= FEAT_DOOR_TAIL)))
800 /* Check line of sight */
805 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
807 msg_print("There is a bright flash of light!");
812 /* Visibility change */
813 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
814 (c_ptr->feat <= FEAT_DOOR_TAIL))
816 /* Update some things */
817 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
821 /* Forget the door */
822 c_ptr->info &= ~(CAVE_MARK);
824 /* Destroy the feature */
825 if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
828 c_ptr->feat = floor_type[randint0(100)];
829 c_ptr->info &= ~(CAVE_MASK);
830 c_ptr->info |= CAVE_FLOOR;
840 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
842 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
843 (c_ptr->feat <= FEAT_DOOR_TAIL))
845 /* Convert "locked" to "stuck" XXX XXX XXX */
846 if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08) c_ptr->feat += 0x08;
848 /* Add one spike to the door */
849 if (c_ptr->feat < FEAT_DOOR_TAIL) c_ptr->feat++;
851 /* Check line of sight */
856 msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ¥É¥¢¤¬³«¤«¤Ê¤¤¡£");
858 msg_print("The door seems stuck.");
867 /* Destroy walls (and doors) */
870 /* Non-walls (etc) */
871 if (cave_floor_bold(y, x)) break;
873 /* Permanent walls */
874 if (c_ptr->feat >= FEAT_PERM_EXTRA) break;
877 if (c_ptr->feat >= FEAT_WALL_EXTRA)
880 if (known && (c_ptr->info & (CAVE_MARK)))
883 msg_print("Êɤ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
885 msg_print("The wall turns into mud!");
891 /* Forget the wall */
892 c_ptr->info &= ~(CAVE_MARK);
894 /* Destroy the wall */
895 c_ptr->feat = floor_type[randint0(100)];
896 c_ptr->info &= ~(CAVE_MASK);
897 c_ptr->info |= CAVE_FLOOR;
900 /* Quartz / Magma with treasure */
901 else if (c_ptr->feat >= FEAT_MAGMA_H)
904 if (known && (c_ptr->info & (CAVE_MARK)))
907 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
908 msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
910 msg_print("The vein turns into mud!");
911 msg_print("You have found something!");
917 /* Forget the wall */
918 c_ptr->info &= ~(CAVE_MARK);
920 /* Destroy the wall */
921 c_ptr->feat = floor_type[randint0(100)];
922 c_ptr->info &= ~(CAVE_MASK);
923 c_ptr->info |= CAVE_FLOOR;
925 /* Place some gold */
930 else if (c_ptr->feat >= FEAT_MAGMA)
933 if (known && (c_ptr->info & (CAVE_MARK)))
936 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
938 msg_print("The vein turns into mud!");
944 /* Forget the wall */
945 c_ptr->info &= ~(CAVE_MARK);
947 /* Destroy the wall */
948 c_ptr->feat = floor_type[randint0(100)];
949 c_ptr->info &= ~(CAVE_MASK);
950 c_ptr->info |= CAVE_FLOOR;
954 else if (c_ptr->feat == FEAT_RUBBLE)
957 if (known && (c_ptr->info & (CAVE_MARK)))
960 msg_print("´äÀФ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
962 msg_print("The rubble turns into mud!");
968 /* Forget the wall */
969 c_ptr->info &= ~(CAVE_MARK);
971 /* Destroy the rubble */
972 c_ptr->feat = floor_type[randint0(100)];
973 c_ptr->info &= ~(CAVE_MASK);
974 c_ptr->info |= CAVE_FLOOR;
976 /* Hack -- place an object */
977 if (randint0(100) < 10)
979 /* Found something */
980 if (player_can_see_bold(y, x))
983 msg_print("´äÀФβ¼¤Ë²¿¤«±£¤µ¤ì¤Æ¤¤¤¿¡ª");
985 msg_print("There was something buried in the rubble!");
992 place_object(y, x, FALSE, FALSE);
996 /* Destroy doors (and secret doors) */
997 else /* if (c_ptr->feat >= FEAT_DOOR_HEAD) */
999 /* Hack -- special message */
1000 if (known && (c_ptr->info & (CAVE_MARK)))
1003 msg_print("¥É¥¢¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
1005 msg_print("The door turns into mud!");
1011 /* Forget the wall */
1012 c_ptr->info &= ~(CAVE_MARK);
1014 /* Destroy the feature */
1015 c_ptr->feat = floor_type[randint0(100)];
1016 c_ptr->info &= ~(CAVE_MASK);
1017 c_ptr->info |= CAVE_FLOOR;
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 ((y == py) && (x == px)) 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))
1070 /* Require a "naked" floor grid */
1071 if (!cave_naked_bold(y, x)) break;
1073 /* Not on the player */
1074 if ((y == py) && (x == px)) 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 cave_set_feat(y, x, FEAT_GLYPH);
1100 /* Require a "naked" floor grid */
1101 if (!cave_naked_bold(y, x)) break;
1103 /* Not on the player */
1104 if ((y == py) && (x == px)) break;
1107 cave_set_feat(y, x, FEAT_WALL_EXTRA);
1109 /* Update some things */
1110 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1121 /* Require a "naked" floor grid */
1122 if (!cave_naked_bold(y, x)) break;
1124 /* Place a shallow lava */
1125 cave_set_feat(y, x, FEAT_SHAL_LAVA);
1130 /* Require a "naked" floor grid */
1131 if (cave_perma_bold(y, x) || !dam) break;
1133 /* Place a deep lava */
1134 cave_set_feat(y, x, FEAT_DEEP_LAVA);
1136 /* Dam is used as a counter for the number of grid to convert */
1147 /* Require a "naked" floor grid */
1148 if (!cave_naked_bold(y, x)) break;
1150 /* Place a shallow lava */
1151 cave_set_feat(y, x, FEAT_SHAL_WATER);
1156 /* Require a "naked" floor grid */
1157 if (cave_perma_bold(y, x) || !dam) break;
1159 /* Place a deep lava */
1160 cave_set_feat(y, x, FEAT_DEEP_WATER);
1162 /* Dam is used as a counter for the number of grid to convert */
1168 /* Lite up the grid */
1172 /* Turn on the light */
1173 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= (CAVE_GLOW);
1182 if (player_can_see_bold(y, x)) obvious = TRUE;
1184 /* Mega-Hack -- Update the monster in the affected grid */
1185 /* This allows "spear of light" (etc) to work "correctly" */
1186 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1191 /* Darken the grid */
1195 if (!p_ptr->inside_battle)
1198 if (player_can_see_bold(y, x)) obvious = TRUE;
1200 /* Turn off the light. */
1201 c_ptr->info &= ~(CAVE_GLOW);
1203 /* Hack -- Forget "boring" grids */
1204 if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
1207 c_ptr->info &= ~(CAVE_MARK);
1216 /* Mega-Hack -- Update the monster in the affected grid */
1217 /* This allows "spear of light" (etc) to work "correctly" */
1218 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1227 if( cave[y][x].feat == FEAT_MIRROR )
1230 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1232 msg_print("The mirror was chashed!");
1234 cave_set_feat(y,x, FEAT_FLOOR);
1235 project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
1241 if( cave[y][x].feat == FEAT_MIRROR && p_ptr->lev < 40 )
1244 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1246 msg_print("The mirror was chashed!");
1248 cave_set_feat(y,x, FEAT_FLOOR);
1255 /* Return "Anything seen?" */
1262 * We are called from "project()" to "damage" objects
1264 * We are called both for "beam" effects and "ball" effects.
1266 * Perhaps we should only SOMETIMES damage things on the ground.
1268 * The "r" parameter is the "distance from ground zero".
1270 * Note that we determine if the player can "see" anything that happens
1271 * by taking into account: blindness, line-of-sight, and illumination.
1273 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1275 * We return "TRUE" if the effect of the projection is "obvious".
1277 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1279 cave_type *c_ptr = &cave[y][x];
1281 s16b this_o_idx, next_o_idx = 0;
1283 bool obvious = FALSE;
1284 bool known = player_has_los_bold(y, x);
1288 char o_name[MAX_NLEN];
1291 bool is_potion = FALSE;
1295 who = who ? who : 0;
1297 /* Reduce damage by distance */
1298 dam = (dam + r) / (r + 1);
1301 /* Scan all objects in the grid */
1302 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1306 bool is_art = FALSE;
1307 bool ignore = FALSE;
1308 bool plural = FALSE;
1309 bool do_kill = FALSE;
1311 cptr note_kill = NULL;
1313 /* Acquire object */
1314 o_ptr = &o_list[this_o_idx];
1316 /* Acquire next object */
1317 next_o_idx = o_ptr->next_o_idx;
1319 /* Extract the flags */
1320 object_flags(o_ptr, &f1, &f2, &f3);
1322 /* Get the "plural"-ness */
1323 if (o_ptr->number > 1) plural = TRUE;
1325 /* Check for artifact */
1326 if ((artifact_p(o_ptr) || o_ptr->art_name)) is_art = TRUE;
1328 /* Analyze the type */
1331 /* Acid -- Lots of things */
1334 if (hates_acid(o_ptr))
1338 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1340 note_kill = (plural ? " melt!" : " melts!");
1343 if (f3 & (TR3_IGNORE_ACID)) ignore = TRUE;
1348 /* Elec -- Rings and Wands */
1351 if (hates_elec(o_ptr))
1355 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1357 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1360 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1365 /* Fire -- Flammable objects */
1368 if (hates_fire(o_ptr))
1372 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1374 note_kill = (plural ? " burn up!" : " burns up!");
1377 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1382 /* Cold -- potions and flasks */
1385 if (hates_cold(o_ptr))
1388 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1390 note_kill = (plural ? " shatter!" : " shatters!");
1394 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1402 if (hates_fire(o_ptr))
1406 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1408 note_kill = (plural ? " burn up!" : " burns up!");
1411 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1413 if (hates_elec(o_ptr))
1418 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1420 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1423 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1431 if (hates_fire(o_ptr))
1435 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1437 note_kill = (plural ? " burn up!" : " burns up!");
1440 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1442 if (hates_cold(o_ptr))
1447 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1449 note_kill = (plural ? " shatter!" : " shatters!");
1452 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1457 /* Hack -- break potions and such */
1463 if (hates_cold(o_ptr))
1466 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1468 note_kill = (plural ? " shatter!" : " shatters!");
1476 /* Mana and Chaos -- destroy everything */
1483 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1485 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1491 case GF_DISINTEGRATE:
1495 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1497 note_kill = (plural ? " evaporate!" : " evaporates!");
1507 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1509 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1512 if (f2 & (TR2_RES_CHAOS)) ignore = TRUE;
1513 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1517 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1521 if (cursed_p(o_ptr))
1525 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1527 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1536 identify_item(o_ptr);
1544 /* Chests are noticed only if trapped or locked */
1545 if (o_ptr->tval == TV_CHEST)
1547 /* Disarm/Unlock traps */
1548 if (o_ptr->pval > 0)
1550 /* Disarm or Unlock */
1551 o_ptr->pval = (0 - o_ptr->pval);
1554 object_known(o_ptr);
1557 if (known && o_ptr->marked)
1560 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1562 msg_print("Click!");
1574 if (o_ptr->tval == TV_CORPSE)
1577 bool friendly = (!who || is_friendly(&m_list[who]));
1578 bool pet = (!who || is_pet(&m_list[who]));
1579 for (i = 0; i < o_ptr->number ; i++)
1581 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1582 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1587 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1589 note_kill = (plural ? " become dust." : " becomes dust.");
1594 else if (summon_named_creature(y, x, o_ptr->pval, FALSE, FALSE, friendly, pet))
1597 note_kill = "À¸¤Ê֤ä¿¡£";
1599 note_kill = "rivived.";
1602 else if (!note_kill)
1605 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1607 note_kill = (plural ? " become dust." : " becomes dust.");
1619 /* Attempt to destroy the object */
1622 /* Effect "observed" */
1623 if (known && o_ptr->marked)
1626 object_desc(o_name, o_ptr, FALSE, 0);
1629 /* Artifacts, and other objects, get to resist */
1630 if (is_art || ignore)
1632 /* Observe the resist */
1633 if (known && o_ptr->marked)
1636 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1639 msg_format("The %s %s unaffected!",
1640 o_name, (plural ? "are" : "is"));
1649 /* Describe if needed */
1650 if (known && o_ptr->marked && note_kill)
1653 msg_format("%s¤Ï%s", o_name, note_kill);
1655 msg_format("The %s%s", o_name, note_kill);
1660 k_idx = o_ptr->k_idx;
1661 is_potion = object_is_potion(o_ptr);
1664 /* Delete the object */
1665 delete_object_idx(this_o_idx);
1667 /* Potions produce effects when 'shattered' */
1670 (void)potion_smash_effect(who, y, x, k_idx);
1679 /* Return "Anything seen?" */
1685 * Helper function for "project()" below.
1687 * Handle a beam/bolt/ball causing damage to a monster.
1689 * This routine takes a "source monster" (by index) which is mostly used to
1690 * determine if the player is causing the damage, and a "radius" (see below),
1691 * which is used to decrease the power of explosions with distance, and a
1692 * location, via integers which are modified by certain types of attacks
1693 * (polymorph and teleport being the obvious ones), a default damage, which
1694 * is modified as needed based on various properties, and finally a "damage
1695 * type" (see below).
1697 * Note that this routine can handle "no damage" attacks (like teleport) by
1698 * taking a "zero" damage, and can even take "parameters" to attacks (like
1699 * confuse) by accepting a "damage", using it to calculate the effect, and
1700 * then setting the damage to zero. Note that the "damage" parameter is
1701 * divided by the radius, so monsters not at the "epicenter" will not take
1702 * as much damage (or whatever)...
1704 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1705 * may result in a dereference of an invalid pointer. XXX XXX XXX
1707 * Various messages are produced, and damage is applied.
1709 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1710 * actually be "made" of that substance, or "breathe" big balls of it.
1712 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1715 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1716 * and hurts evil less. If can breath nether, then it resists it as well.
1718 * Damage reductions use the following formulas:
1719 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1720 * gives avg damage of .655, ranging from .858 to .500
1721 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1722 * gives avg damage of .544, ranging from .714 to .417
1723 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1724 * gives avg damage of .444, ranging from .556 to .333
1725 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1726 * gives avg damage of .327, ranging from .427 to .250
1727 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1728 * gives something simple.
1730 * In this function, "result" messages are postponed until the end, where
1731 * the "note" string is appended to the monster name, if not NULL. So,
1732 * to make a spell have "no effect" just set "note" to NULL. You should
1733 * also set "notice" to FALSE, or the player will learn what the spell does.
1735 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1737 /* "flg" was added. */
1738 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1742 cave_type *c_ptr = &cave[y][x];
1744 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1746 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1750 /* Is the monster "seen"? */
1751 bool seen = m_ptr->ml;
1753 bool slept = (bool)(m_ptr->csleep > 0);
1755 /* Were the effects "obvious" (if seen)? */
1756 bool obvious = FALSE;
1758 /* Can the player know about this effect? */
1759 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1761 /* Can the player see the source of this effect? */
1762 bool see_s = ((who <= 0) || m_list[who].ml);
1764 /* Were the effects "irrelevant"? */
1765 bool skipped = FALSE;
1767 /* Gets the monster angry at the source of the effect? */
1768 bool get_angry = FALSE;
1770 /* Polymorph setting (true or false) */
1773 /* Teleport setting (max distance) */
1776 /* Confusion setting (amount to confuse) */
1779 /* Stunning setting (amount to stun) */
1782 /* Sleep amount (amount to sleep) */
1785 /* Fear amount (amount to fear) */
1788 /* Time amount (amount to time) */
1791 bool heal_leper = FALSE;
1793 /* Hold the monster name */
1800 /* Assume no note */
1803 /* Assume a default death */
1805 cptr note_dies = "¤Ï»à¤ó¤À¡£";
1807 cptr note_dies = " dies.";
1815 if (!c_ptr->m_idx) return (FALSE);
1817 /* Never affect projector */
1818 if (who && (c_ptr->m_idx == who)) return (FALSE);
1819 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1820 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1822 /* Don't affect already death monsters */
1823 /* Prevents problems with chain reactions of exploding monsters */
1824 if (m_ptr->hp < 0) return (FALSE);
1826 /* Reduce damage by distance */
1827 dam = (dam + r) / (r + 1);
1830 /* Get the monster name (BEFORE polymorphing) */
1831 monster_desc(m_name, m_ptr, 0);
1833 /* Get the monster possessive ("his"/"her"/"its") */
1834 monster_desc(m_poss, m_ptr, 0x22);
1837 /* Some monsters get "destroyed" */
1838 if (!monster_living(r_ptr))
1841 bool explode = FALSE;
1843 for (i = 0; i < 4; i++)
1845 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
1848 /* Special note at death */
1851 note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
1853 note_dies = " explodes into tiny shreds.";
1857 note_dies = "¤òÅݤ·¤¿¡£";
1859 note_dies = " is destroyed.";
1863 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1865 /* Analyze the damage type */
1868 /* Magic Missile -- pure damage */
1871 if (seen) obvious = TRUE;
1872 if (r_ptr->flags3 & (RF3_RES_ALL))
1875 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1877 note = " is immune.";
1880 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1889 if (seen) obvious = TRUE;
1890 if (r_ptr->flags3 & (RF3_RES_ALL))
1893 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1895 note = " is immune.";
1898 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1901 if (r_ptr->flags3 & (RF3_IM_ACID))
1904 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1906 note = " resists a lot.";
1910 if (seen) r_ptr->r_flags3 |= (RF3_IM_ACID);
1918 if (seen) obvious = TRUE;
1919 if (r_ptr->flags3 & (RF3_RES_ALL))
1922 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1924 note = " is immune.";
1927 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1930 if (r_ptr->flags3 & (RF3_IM_ELEC))
1933 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1935 note = " resists a lot.";
1939 if (seen) r_ptr->r_flags3 |= (RF3_IM_ELEC);
1947 if (seen) obvious = TRUE;
1948 if (r_ptr->flags3 & (RF3_RES_ALL))
1951 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1953 note = " is immune.";
1956 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1959 if (r_ptr->flags3 & (RF3_IM_FIRE))
1962 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1964 note = " resists a lot.";
1968 if (seen) r_ptr->r_flags3 |= (RF3_IM_FIRE);
1970 if (r_ptr->flags3 & (RF3_HURT_FIRE))
1973 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1975 note = " is hit hard.";
1979 if (seen) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1987 if (seen) obvious = TRUE;
1988 if (r_ptr->flags3 & (RF3_RES_ALL))
1991 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1993 note = " is immune.";
1996 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1999 if (r_ptr->flags3 & (RF3_IM_COLD))
2002 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
2004 note = " resists a lot.";
2008 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
2010 if (r_ptr->flags3 & (RF3_HURT_COLD))
2013 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
2015 note = " is hit hard.";
2019 if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2027 if (seen) obvious = TRUE;
2028 if (r_ptr->flags3 & (RF3_RES_ALL))
2031 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2033 note = " is immune.";
2036 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2039 if (r_ptr->flags3 & RF3_IM_POIS)
2042 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
2044 note = " resists a lot.";
2048 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2056 if (seen) obvious = TRUE;
2058 if (r_ptr->flags3 & (RF3_RES_ALL))
2061 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2063 note = " is immune.";
2066 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2069 if (r_ptr->flags3 & RF3_IM_POIS)
2072 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2077 dam *= 3; dam /= randint1(6) + 6;
2078 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2080 else if (one_in_(3)) do_poly = TRUE;
2084 /* Hellfire -- hurts Evil */
2087 if (seen) obvious = TRUE;
2088 if (r_ptr->flags3 & (RF3_RES_ALL))
2091 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2093 note = " is immune.";
2096 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2099 if (r_ptr->flags3 & RF3_GOOD)
2103 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2105 note = " is hit hard.";
2108 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
2113 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2116 if (seen) obvious = TRUE;
2117 if (r_ptr->flags3 & (RF3_RES_ALL))
2120 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2122 note = " is immune.";
2125 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2128 if (r_ptr->flags3 & RF3_GOOD)
2132 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2134 note = " is immune.";
2137 if (seen) r_ptr->r_flags3 |= RF3_GOOD;
2139 else if (r_ptr->flags3 & RF3_EVIL)
2143 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2145 note = " is hit hard.";
2148 if (seen) r_ptr->r_flags3 |= RF3_EVIL;
2153 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2158 dam *= 3; dam /= randint1(6) + 6;
2163 /* Arrow -- XXX no defense */
2166 if (seen) obvious = TRUE;
2167 if (r_ptr->flags3 & (RF3_RES_ALL))
2170 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2172 note = " is immune.";
2175 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2181 /* Plasma -- XXX perhaps check ELEC or FIRE */
2184 if (seen) obvious = TRUE;
2185 if (r_ptr->flags3 & (RF3_RES_ALL))
2188 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2190 note = " is immune.";
2193 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2196 if (r_ptr->flags3 & RF3_RES_PLAS)
2199 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2204 dam *= 3; dam /= randint1(6) + 6;
2206 r_ptr->r_flags3 |= (RF3_RES_PLAS);
2211 /* Nether -- see above */
2214 if (seen) obvious = TRUE;
2215 if (r_ptr->flags3 & (RF3_RES_ALL))
2218 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2220 note = " is immune.";
2223 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2226 if (r_ptr->flags3 & RF3_UNDEAD)
2229 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2231 note = " is immune.";
2235 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
2237 else if (r_ptr->flags3 & RF3_RES_NETH)
2240 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2245 dam *= 3; dam /= randint1(6) + 6;
2247 if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
2249 else if (r_ptr->flags3 & RF3_EVIL)
2253 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2255 note = " resists somewhat.";
2258 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
2263 /* Water (acid) damage -- Water spirits/elementals are immune */
2266 if (seen) obvious = TRUE;
2267 if (r_ptr->flags3 & (RF3_RES_ALL))
2270 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2272 note = " is immune.";
2275 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2278 if (m_ptr->r_idx == MON_WATER_ELEM || m_ptr->r_idx == MON_UNMAKER)
2281 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2283 note = " is immune.";
2288 else if (r_ptr->flags3 & RF3_RES_WATE)
2291 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2296 dam *= 3; dam /= randint1(6) + 6;
2297 if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
2302 /* Chaos -- Chaos breathers resist */
2305 if (seen) obvious = TRUE;
2306 if (r_ptr->flags3 & (RF3_RES_ALL))
2309 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2311 note = " is immune.";
2314 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2318 do_conf = (5 + randint1(11) + r) / (r + 1);
2319 if ((r_ptr->flags4 & RF4_BR_CHAO) ||
2320 (m_ptr->r_idx == MON_STORMBRINGER) ||
2321 ((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
2324 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2329 dam *= 3; dam /= randint1(6) + 6;
2335 /* Shards -- Shard breathers resist */
2338 if (seen) obvious = TRUE;
2339 if (r_ptr->flags3 & (RF3_RES_ALL))
2342 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2344 note = " is immune.";
2347 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2350 if (r_ptr->flags4 & RF4_BR_SHAR)
2353 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2358 dam *= 3; dam /= randint1(6) + 6;
2363 /* Rocket: Shard resistance helps */
2366 if (seen) obvious = TRUE;
2368 if (r_ptr->flags3 & (RF3_RES_ALL))
2371 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2373 note = " is immune.";
2376 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2379 if (r_ptr->flags4 & RF4_BR_SHAR)
2382 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2384 note = " resists somewhat.";
2393 /* Sound -- Sound breathers resist */
2396 if (seen) obvious = TRUE;
2397 if (r_ptr->flags3 & (RF3_RES_ALL))
2400 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2402 note = " is immune.";
2405 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2408 do_stun = (10 + randint1(15) + r) / (r + 1);
2409 if (r_ptr->flags4 & RF4_BR_SOUN)
2412 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2417 dam *= 2; dam /= randint1(6) + 6;
2425 if (seen) obvious = TRUE;
2426 if (r_ptr->flags3 & (RF3_RES_ALL))
2429 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2431 note = " is immune.";
2434 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2437 do_conf = (10 + randint1(15) + r) / (r + 1);
2438 if (r_ptr->flags4 & RF4_BR_CONF)
2441 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2446 dam *= 2; dam /= randint1(6) + 6;
2448 else if (r_ptr->flags3 & RF3_NO_CONF)
2451 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2453 note = " resists somewhat.";
2461 /* Disenchantment -- Breathers and Disenchanters resist */
2464 if (seen) obvious = TRUE;
2465 if (r_ptr->flags3 & (RF3_RES_ALL))
2468 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2470 note = " is immune.";
2473 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2476 if (r_ptr->flags3 & RF3_RES_DISE)
2479 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2484 dam *= 3; dam /= randint1(6) + 6;
2485 if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
2490 /* Nexus -- Breathers and Existers resist */
2493 if (seen) obvious = TRUE;
2494 if (r_ptr->flags3 & (RF3_RES_ALL))
2497 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2499 note = " is immune.";
2502 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2505 if (r_ptr->flags3 & RF3_RES_NEXU)
2508 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2513 dam *= 3; dam /= randint1(6) + 6;
2514 if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
2522 if (seen) obvious = TRUE;
2523 if (r_ptr->flags3 & (RF3_RES_ALL))
2526 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2528 note = " is immune.";
2531 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2534 do_stun = (randint1(15) + r) / (r + 1);
2535 if (r_ptr->flags4 & RF4_BR_WALL)
2538 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2543 dam *= 3; dam /= randint1(6) + 6;
2548 /* Inertia -- breathers resist */
2551 if (seen) obvious = TRUE;
2552 if (r_ptr->flags3 & (RF3_RES_ALL))
2555 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2557 note = " is immune.";
2560 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2563 if (r_ptr->flags4 & (RF4_BR_INER))
2566 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2571 dam *= 3; dam /= randint1(6) + 6;
2575 /* Powerful monsters can resist */
2576 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2577 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2581 /* Normal monsters slow down */
2587 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2589 note = " starts moving slower.";
2592 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2593 if (c_ptr->m_idx == p_ptr->riding)
2594 p_ptr->update |= (PU_BONUS);
2600 /* Time -- breathers resist */
2603 if (seen) obvious = TRUE;
2604 if (r_ptr->flags3 & (RF3_RES_ALL))
2607 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2609 note = " is immune.";
2612 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2615 if (r_ptr->flags4 & (RF4_BR_TIME))
2618 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2623 dam *= 3; dam /= randint1(6) + 6;
2625 else do_time = (dam+1)/2;
2629 /* Gravity -- breathers resist */
2632 bool resist_tele = FALSE;
2634 if (seen) obvious = TRUE;
2636 if (r_ptr->flags3 & (RF3_RES_ALL))
2639 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2641 note = " is immune.";
2644 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2647 if (r_ptr->flags3 & (RF3_RES_TELE))
2649 if (r_ptr->flags1 & (RF1_UNIQUE))
2651 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2653 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2655 note = " is unaffected!";
2660 else if (r_ptr->level > randint1(100))
2662 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2664 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2673 if (!resist_tele) do_dist = 10;
2675 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2677 if (r_ptr->flags4 & (RF4_BR_GRAV))
2680 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2685 dam *= 3; dam /= randint1(6) + 6;
2691 /* Powerful monsters can resist */
2692 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2693 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2697 /* Normal monsters slow down */
2703 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2705 note = " starts moving slower.";
2708 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2709 if (c_ptr->m_idx == p_ptr->riding)
2710 p_ptr->update |= (PU_BONUS);
2714 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
2716 /* Attempt a saving throw */
2717 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2718 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2722 /* No obvious effect */
2724 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2726 note = " is unaffected!";
2740 if (seen) obvious = TRUE;
2741 if (r_ptr->flags3 & (RF3_RES_ALL))
2744 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2746 note = " is immune.";
2749 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2757 case GF_DISINTEGRATE:
2759 if (seen) obvious = TRUE;
2760 if (r_ptr->flags3 & (RF3_RES_ALL))
2763 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2765 note = " is immune.";
2768 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2771 if (r_ptr->flags3 & RF3_HURT_ROCK)
2773 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2775 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2776 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2778 note = " loses some skin!";
2779 note_dies = " evaporates!";
2789 if (seen) obvious = TRUE;
2791 /* PSI only works if the monster can see you! -- RG */
2792 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2796 note = "¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª";
2798 note = " can't see you, and isn't affected!";
2803 if (r_ptr->flags3 & (RF3_RES_ALL))
2806 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2808 note = " is immune.";
2811 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2814 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2818 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2820 note = " is immune!";
2822 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2825 else if ((r_ptr->flags2 & RF2_STUPID) ||
2826 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2827 (r_ptr->flags3 & RF3_ANIMAL) ||
2828 (r_ptr->level > randint1(3 * dam)))
2832 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2839 * Powerful demons & undead can turn a mindcrafter's
2840 * attacks back on them
2842 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2843 (r_ptr->flags3 & RF3_DEMON)) &&
2844 (r_ptr->level > p_ptr->lev / 2) &&
2849 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2852 msg_format("%^s%s corrupted mind backlashes your attack!",
2853 m_name, (seen ? "'s" : "s"));
2857 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2860 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2862 msg_print("You resist the effects!");
2868 /* Injure +/- confusion */
2869 monster_desc(killer, m_ptr, 0x288);
2870 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2873 switch (randint1(4))
2876 set_confused(p_ptr->confused + 3 + randint1(dam));
2879 set_stun(p_ptr->stun + randint1(dam));
2883 if (r_ptr->flags3 & RF3_NO_FEAR)
2885 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2887 note = " is unaffected.";
2891 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2895 if (!p_ptr->free_act)
2896 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2905 if ((dam > 0) && one_in_(4))
2907 switch (randint1(4))
2910 do_conf = 3 + randint1(dam);
2913 do_stun = 3 + randint1(dam);
2916 do_fear = 3 + randint1(dam);
2920 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2922 note = " falls asleep!";
2925 do_sleep = 3 + randint1(dam);
2931 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2933 note_dies = " collapses, a mindless husk.";
2941 if (seen) obvious = TRUE;
2942 if (r_ptr->flags3 & (RF3_RES_ALL))
2945 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2947 note = " is immune.";
2950 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2953 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2957 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2959 note = " is immune!";
2963 else if ((r_ptr->flags2 & RF2_STUPID) ||
2964 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2965 (r_ptr->flags3 & RF3_ANIMAL) ||
2966 (r_ptr->level > randint1(3 * dam)))
2970 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2977 * Powerful demons & undead can turn a mindcrafter's
2978 * attacks back on them
2980 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2981 (r_ptr->flags3 & RF3_DEMON)) &&
2982 (r_ptr->level > p_ptr->lev / 2) &&
2987 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2990 msg_format("%^s%s corrupted mind backlashes your attack!",
2991 m_name, (seen ? "'s" : "s"));
2995 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2998 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3000 msg_print("You resist the effects!");
3006 /* Injure + mana drain */
3007 monster_desc(killer, m_ptr, 0x288);
3009 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
3011 msg_print("Your psychic energy is drained!");
3014 p_ptr->csp = MAX(0, p_ptr->csp - damroll(5, dam) / 2);
3015 p_ptr->redraw |= PR_MANA;
3016 p_ptr->window |= (PW_SPELL);
3017 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
3024 int b = damroll(5, dam) / 4;
3026 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª",
3029 msg_format("You convert %s%s pain into psychic energy!",
3030 m_name, (seen ? "'s" : "s"));
3033 b = MIN(p_ptr->msp, p_ptr->csp + b);
3035 p_ptr->redraw |= PR_MANA;
3036 p_ptr->window |= (PW_SPELL);
3040 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
3042 note_dies = " collapses, a mindless husk.";
3048 case GF_TELEKINESIS:
3050 if (seen) obvious = TRUE;
3051 if (r_ptr->flags3 & (RF3_RES_ALL))
3054 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3056 note = " is immune.";
3059 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3064 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3069 do_stun = damroll((p_ptr->lev / 10) + 3 , dam) + 1;
3071 /* Attempt a saving throw */
3072 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3073 (r_ptr->level > 5 + randint1(dam)))
3077 /* No obvious effect */
3083 /* Psycho-spear -- powerful magic missile */
3086 if (seen) obvious = TRUE;
3087 if (r_ptr->flags3 & (RF3_RES_ALL))
3090 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3092 note = " is immune.";
3095 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3101 /* Meteor -- powerful magic missile */
3104 if (seen) obvious = TRUE;
3105 if (r_ptr->flags3 & (RF3_RES_ALL))
3108 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3110 note = " is immune.";
3113 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3121 if (!is_hostile(m_ptr)) break;
3122 if (seen) obvious = TRUE;
3124 if (r_ptr->flags3 & (RF3_RES_ALL))
3127 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3129 note = " is immune.";
3132 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3135 /* Attempt a saving throw */
3136 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3137 (r_ptr->flags1 & RF1_QUESTOR) ||
3138 (r_ptr->flags3 & RF3_NO_CONF) ||
3139 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3141 /* Memorize a flag */
3142 if (r_ptr->flags3 & RF3_NO_CONF)
3144 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3151 * Powerful demons & undead can turn a mindcrafter's
3152 * attacks back on them
3154 if (((r_ptr->flags3 & RF3_UNDEAD) ||
3155 (r_ptr->flags3 & RF3_DEMON)) &&
3156 (r_ptr->level > p_ptr->lev / 2) &&
3161 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3164 msg_format("%^s%s corrupted mind backlashes your attack!",
3165 m_name, (seen ? "'s" : "s"));
3169 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3172 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3174 msg_print("You resist the effects!");
3180 /* Confuse, stun, terrify */
3181 switch (randint1(4))
3184 set_stun(p_ptr->stun + dam / 2);
3187 set_confused(p_ptr->confused + dam / 2);
3191 if (r_ptr->flags3 & RF3_NO_FEAR)
3193 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3195 note = " is unaffected.";
3199 set_afraid(p_ptr->afraid + dam);
3206 /* No obvious effect */
3208 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3210 note = " is unaffected!";
3218 if ((dam > 29) && (randint1(100) < dam))
3221 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3223 note = " is in your thrall!";
3230 switch (randint1(4))
3244 /* No "real" damage */
3251 /* Ice -- Cold + Cuts + Stun */
3254 if (seen) obvious = TRUE;
3255 if (r_ptr->flags3 & (RF3_RES_ALL))
3258 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3260 note = " is immune.";
3263 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3266 do_stun = (randint1(15) + 1) / (r + 1);
3267 if (r_ptr->flags3 & RF3_IM_COLD)
3270 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3272 note = " resists a lot.";
3276 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
3285 if (seen) obvious = TRUE;
3287 if (r_ptr->flags3 & (RF3_RES_ALL))
3290 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3292 note = " is immune.";
3295 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3298 if (!monster_living(r_ptr))
3300 if (r_ptr->flags3 & RF3_UNDEAD)
3302 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3305 if (r_ptr->flags3 & (RF3_DEMON))
3307 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
3311 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3313 note = " is unaffected!";
3319 else do_time = (dam+7)/8;
3327 if (seen) obvious = TRUE;
3329 if (r_ptr->flags3 & (RF3_RES_ALL))
3332 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3334 note = " is immune.";
3337 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3340 if ((r_ptr->flags3 & RF3_UNDEAD) ||
3341 (r_ptr->flags3 & RF3_NONLIVING))
3343 if (r_ptr->flags3 & RF3_UNDEAD)
3345 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3349 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3351 note = " is immune.";
3357 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3358 (randint1(888) != 666)) ||
3359 (((r_ptr->level + randint1(20)) > randint1(p_ptr->lev + randint1(10))) &&
3360 randint1(100) != 66))
3363 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3375 /* Polymorph monster (Use "dam" as "power") */
3378 if (seen) obvious = TRUE;
3380 if (r_ptr->flags3 & (RF3_RES_ALL))
3383 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3385 note = " is immune.";
3388 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3391 /* Attempt to polymorph (see below) */
3394 /* Powerful monsters can resist */
3395 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3396 (r_ptr->flags1 & RF1_QUESTOR) ||
3397 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3400 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3402 note = " is unaffected!";
3409 /* No "real" damage */
3416 /* Clone monsters (Ignore "dam") */
3419 bool friendly = FALSE;
3422 if (seen) obvious = TRUE;
3424 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
3427 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3429 note = " is unaffected!";
3435 m_ptr->hp = m_ptr->maxhp;
3437 /* Attempt to clone. */
3438 if (multiply_monster(c_ptr->m_idx, TRUE, friendly, pet))
3441 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3449 /* No "real" damage */
3456 /* Heal Monster (use "dam" as amount of healing) */
3459 if (seen) obvious = TRUE;
3464 if (m_ptr->maxhp < m_ptr->max_maxhp)
3467 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3469 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3471 m_ptr->maxhp = m_ptr->max_maxhp;
3477 if (seen) obvious = TRUE;
3485 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3487 msg_format("%^s is no longer stunned.", m_name);
3491 if (m_ptr->confused)
3494 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3496 msg_format("%^s is no longer confused.", m_name);
3498 m_ptr->confused = 0;
3503 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3505 msg_format("%^s recovers %s courage.", m_name, m_poss);
3511 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3514 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3516 chg_virtue(V_VITALITY, 1);
3518 if (r_ptr->flags1 & RF1_UNIQUE)
3519 chg_virtue(V_INDIVIDUALISM, 1);
3521 if (is_friendly(m_ptr))
3522 chg_virtue(V_HONOUR, 1);
3523 else if (!(r_ptr->flags3 & RF3_EVIL))
3525 if (r_ptr->flags3 & RF3_GOOD)
3526 chg_virtue(V_COMPASSION, 2);
3528 chg_virtue(V_COMPASSION, 1);
3531 if (m_ptr->r_idx == MON_LEPER)
3534 chg_virtue(V_COMPASSION, 5);
3537 if (r_ptr->flags3 & RF3_ANIMAL)
3538 chg_virtue(V_NATURE, 1);
3540 /* Redraw (later) if needed */
3541 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3542 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3546 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3548 note = " looks healthier.";
3552 /* No "real" damage */
3558 /* Speed Monster (Ignore "dam") */
3561 if (seen) obvious = TRUE;
3567 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3569 note = " starts moving faster.";
3572 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3574 if (c_ptr->m_idx == p_ptr->riding)
3575 p_ptr->update |= (PU_BONUS);
3577 if (r_ptr->flags1 & RF1_UNIQUE)
3578 chg_virtue(V_INDIVIDUALISM, 1);
3579 if (is_friendly(m_ptr))
3580 chg_virtue(V_HONOUR, 1);
3582 /* No "real" damage */
3588 /* Slow Monster (Use "dam" as "power") */
3591 if (seen) obvious = TRUE;
3593 if (r_ptr->flags3 & (RF3_RES_ALL))
3596 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3598 note = " is immune.";
3601 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3604 /* Powerful monsters can resist */
3605 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3606 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3609 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3611 note = " is unaffected!";
3617 /* Normal monsters slow down */
3623 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3625 note = " starts moving slower.";
3628 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3630 if (c_ptr->m_idx == p_ptr->riding)
3631 p_ptr->update |= (PU_BONUS);
3634 /* No "real" damage */
3640 /* Sleep (Use "dam" as "power") */
3643 if (seen) obvious = TRUE;
3645 if (r_ptr->flags3 & (RF3_RES_ALL))
3648 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3650 note = " is immune.";
3653 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3656 /* Attempt a saving throw */
3657 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3658 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3659 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3661 /* Memorize a flag */
3662 if (r_ptr->flags3 & RF3_NO_SLEEP)
3664 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3667 /* No obvious effect */
3669 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3671 note = " is unaffected!";
3678 /* Go to sleep (much) later */
3680 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3682 note = " falls asleep!";
3688 /* No "real" damage */
3694 /* Sleep (Use "dam" as "power") */
3697 if (seen) obvious = TRUE;
3699 if (r_ptr->flags3 & (RF3_RES_ALL))
3702 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3704 note = " is immune.";
3707 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3710 /* Attempt a saving throw */
3711 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3712 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3715 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3717 note = " is unaffected!";
3724 /* Go to sleep (much) later */
3726 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3728 note = " is suspended!";
3734 /* No "real" damage */
3743 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3744 vir = virtue_number(V_HARMONY);
3747 dam += p_ptr->virtues[vir-1]/10;
3750 vir = virtue_number(V_INDIVIDUALISM);
3753 dam -= p_ptr->virtues[vir-1]/20;
3756 if (seen) obvious = TRUE;
3758 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3761 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3763 note = " is immune.";
3766 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3770 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3773 /* Attempt a saving throw */
3774 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3775 (r_ptr->flags3 & RF3_NO_CONF) ||
3776 (m_ptr->mflag2 & MFLAG_NOPET) ||
3777 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3779 /* Memorize a flag */
3780 if (r_ptr->flags3 & RF3_NO_CONF)
3782 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3786 /* No obvious effect */
3788 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3790 note = " is unaffected!";
3795 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3797 else if (p_ptr->cursed & TRC_AGGRAVATE)
3800 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3802 note = " hates you too much!";
3805 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3810 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3812 note = " suddenly seems friendly!";
3817 chg_virtue(V_INDIVIDUALISM, -1);
3818 if (r_ptr->flags3 & RF3_ANIMAL)
3819 chg_virtue(V_NATURE, 1);
3822 /* No "real" damage */
3827 /* Control undead */
3828 case GF_CONTROL_UNDEAD:
3831 if (seen) obvious = TRUE;
3833 vir = virtue_number(V_UNLIFE);
3836 dam += p_ptr->virtues[vir-1]/10;
3839 vir = virtue_number(V_INDIVIDUALISM);
3842 dam -= p_ptr->virtues[vir-1]/20;
3845 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3848 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3850 note = " is immune.";
3853 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3857 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3860 /* Attempt a saving throw */
3861 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3862 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3863 (m_ptr->mflag2 & MFLAG_NOPET) ||
3864 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3866 /* No obvious effect */
3868 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3870 note = " is unaffected!";
3874 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3876 else if (p_ptr->cursed & TRC_AGGRAVATE)
3879 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3881 note = " hates you too much!";
3884 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3889 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3891 note = " is in your thrall!";
3897 /* No "real" damage */
3903 case GF_CONTROL_DEMON:
3906 if (seen) obvious = TRUE;
3908 vir = virtue_number(V_UNLIFE);
3911 dam += p_ptr->virtues[vir-1]/10;
3914 vir = virtue_number(V_INDIVIDUALISM);
3917 dam -= p_ptr->virtues[vir-1]/20;
3920 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3923 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3925 note = " is immune.";
3928 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3932 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3935 /* Attempt a saving throw */
3936 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3937 (!(r_ptr->flags3 & RF3_DEMON)) ||
3938 (m_ptr->mflag2 & MFLAG_NOPET) ||
3939 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3941 /* No obvious effect */
3943 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3945 note = " is unaffected!";
3949 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3951 else if (p_ptr->cursed & TRC_AGGRAVATE)
3954 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3956 note = " hates you too much!";
3959 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3964 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3966 note = " is in your thrall!";
3972 /* No "real" damage */
3978 case GF_CONTROL_ANIMAL:
3982 if (seen) obvious = TRUE;
3984 vir = virtue_number(V_NATURE);
3987 dam += p_ptr->virtues[vir-1]/10;
3990 vir = virtue_number(V_INDIVIDUALISM);
3993 dam -= p_ptr->virtues[vir-1]/20;
3996 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3999 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4001 note = " is immune.";
4004 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4008 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4011 /* Attempt a saving throw */
4012 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4013 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4014 (m_ptr->mflag2 & MFLAG_NOPET) ||
4015 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4016 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4018 /* Memorize a flag */
4019 if (r_ptr->flags3 & (RF3_NO_CONF))
4021 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4025 /* No obvious effect */
4027 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4029 note = " is unaffected!";
4033 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_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 |= MFLAG_NOPET;
4048 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4050 note = " is tamed!";
4055 if (r_ptr->flags3 & RF3_ANIMAL)
4056 chg_virtue(V_NATURE, 1);
4059 /* No "real" damage */
4065 case GF_CONTROL_LIVING:
4069 vir = virtue_number(V_UNLIFE);
4070 if (seen) obvious = TRUE;
4072 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4073 vir = virtue_number(V_UNLIFE);
4076 dam -= p_ptr->virtues[vir-1]/10;
4079 vir = virtue_number(V_INDIVIDUALISM);
4082 dam -= p_ptr->virtues[vir-1]/20;
4085 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4086 if (dam < 1) dam = 1;
4088 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4090 msg_format("You stare into %s.", m_name);
4092 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4095 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4097 note = " is immune.";
4100 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4104 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4107 /* Attempt a saving throw */
4108 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4109 (m_ptr->mflag2 & MFLAG_NOPET) ||
4110 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
4111 ((r_ptr->level+10) > randint1(dam)))
4114 /* No obvious effect */
4116 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4118 note = " is unaffected!";
4122 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4124 else if (p_ptr->cursed & TRC_AGGRAVATE)
4127 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4129 note = " hates you too much!";
4132 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4137 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4139 note = " is tamed!";
4144 if (r_ptr->flags3 & RF3_ANIMAL)
4145 chg_virtue(V_NATURE, 1);
4148 /* No "real" damage */
4153 /* Confusion (Use "dam" as "power") */
4156 if (seen) obvious = TRUE;
4158 if (r_ptr->flags3 & (RF3_RES_ALL))
4161 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4163 note = " is immune.";
4166 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4169 /* Get confused later */
4170 do_conf = damroll(3, (dam / 2)) + 1;
4172 /* Attempt a saving throw */
4173 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4174 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4175 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4177 /* Memorize a flag */
4178 if (r_ptr->flags3 & (RF3_NO_CONF))
4180 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4186 /* No obvious effect */
4188 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4190 note = " is unaffected!";
4196 /* No "real" damage */
4203 if (seen) obvious = TRUE;
4205 if (r_ptr->flags3 & (RF3_RES_ALL))
4208 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4210 note = " is immune.";
4213 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4216 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4218 /* Attempt a saving throw */
4219 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4220 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4225 /* No obvious effect */
4227 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4229 note = " is unaffected!";
4235 /* No "real" damage */
4243 /* Lite, but only hurts susceptible creatures */
4251 if (r_ptr->flags3 & (RF3_RES_ALL))
4257 if (r_ptr->flags3 & (RF3_HURT_LITE))
4259 /* Obvious effect */
4260 if (seen) obvious = TRUE;
4262 /* Memorize the effects */
4263 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4265 /* Special effect */
4267 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4268 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4270 note = " cringes from the light!";
4271 note_dies = " shrivels away in the light!";
4276 /* Normally no damage */
4288 /* Lite -- opposite of Dark */
4291 if (seen) obvious = TRUE;
4292 if (r_ptr->flags3 & (RF3_RES_ALL))
4295 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4297 note = " is immune.";
4300 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4303 if (r_ptr->flags4 & (RF4_BR_LITE))
4306 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4311 dam *= 2; dam /= (randint1(6)+6);
4313 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4315 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4317 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4318 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4320 note = " cringes from the light!";
4321 note_dies = " shrivels away in the light!";
4330 /* Dark -- opposite of Lite */
4333 if (seen) obvious = TRUE;
4335 if (r_ptr->flags3 & (RF3_RES_ALL))
4338 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4340 note = " is immune.";
4343 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4346 /* Likes darkness... */
4347 if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
4348 (r_ptr->flags3 & RF3_ORC) ||
4349 (r_ptr->flags3 & RF3_HURT_LITE))
4352 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4357 dam *= 2; dam /= (randint1(6)+6);
4366 if (r_ptr->flags3 & (RF3_RES_ALL))
4371 /* Hurt by rock remover */
4372 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4375 if (seen) obvious = TRUE;
4377 /* Memorize the effects */
4378 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4380 /* Cute little message */
4382 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4383 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4385 note = " loses some skin!";
4386 note_dies = " dissolves!";
4391 /* Usually, ignore the effects */
4402 /* Teleport undead (Use "dam" as "power") */
4403 case GF_AWAY_UNDEAD:
4405 /* Only affect undead */
4406 if (r_ptr->flags3 & (RF3_UNDEAD))
4408 bool resists_tele = FALSE;
4410 if (r_ptr->flags3 & (RF3_RES_TELE))
4412 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4414 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4416 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4418 note = " is unaffected!";
4421 resists_tele = TRUE;
4423 else if (r_ptr->level > randint1(100))
4425 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4427 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4432 resists_tele = TRUE;
4438 if (seen) obvious = TRUE;
4439 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4451 /* No "real" damage */
4457 /* Teleport evil (Use "dam" as "power") */
4460 /* Only affect evil */
4461 if (r_ptr->flags3 & (RF3_EVIL))
4463 bool resists_tele = FALSE;
4465 if (r_ptr->flags3 & (RF3_RES_TELE))
4467 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4469 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4471 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4473 note = " is unaffected!";
4476 resists_tele = TRUE;
4478 else if (r_ptr->level > randint1(100))
4480 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4482 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4487 resists_tele = TRUE;
4493 if (seen) obvious = TRUE;
4494 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4506 /* No "real" damage */
4512 /* Teleport monster (Use "dam" as "power") */
4515 bool resists_tele = FALSE;
4516 if (r_ptr->flags3 & (RF3_RES_TELE))
4518 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4520 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4522 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4524 note = " is unaffected!";
4527 resists_tele = TRUE;
4529 else if (r_ptr->level > randint1(100))
4531 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4533 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4538 resists_tele = TRUE;
4545 if (seen) obvious = TRUE;
4547 /* Prepare to teleport */
4551 /* No "real" damage */
4557 /* Turn undead (Use "dam" as "power") */
4558 case GF_TURN_UNDEAD:
4560 if (r_ptr->flags3 & (RF3_RES_ALL))
4565 /* Only affect undead */
4566 if (r_ptr->flags3 & (RF3_UNDEAD))
4568 /* Learn about type */
4569 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4572 if (seen) obvious = TRUE;
4574 /* Apply some fear */
4575 do_fear = damroll(3, (dam / 2)) + 1;
4577 /* Attempt a saving throw */
4578 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4580 /* No obvious effect */
4582 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4584 note = " is unaffected!";
4599 /* No "real" damage */
4605 /* Turn evil (Use "dam" as "power") */
4608 if (r_ptr->flags3 & (RF3_RES_ALL))
4613 /* Only affect evil */
4614 if (r_ptr->flags3 & (RF3_EVIL))
4616 /* Learn about type */
4617 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4620 if (seen) obvious = TRUE;
4622 /* Apply some fear */
4623 do_fear = damroll(3, (dam / 2)) + 1;
4625 /* Attempt a saving throw */
4626 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4628 /* No obvious effect */
4630 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4632 note = " is unaffected!";
4647 /* No "real" damage */
4653 /* Turn monster (Use "dam" as "power") */
4656 if (r_ptr->flags3 & (RF3_RES_ALL))
4662 if (seen) obvious = TRUE;
4664 /* Apply some fear */
4665 do_fear = damroll(3, (dam / 2)) + 1;
4667 /* Attempt a saving throw */
4668 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4669 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4670 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4672 /* No obvious effect */
4674 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4676 note = " is unaffected!";
4683 /* No "real" damage */
4690 case GF_DISP_UNDEAD:
4692 if (r_ptr->flags3 & (RF3_RES_ALL))
4698 /* Only affect undead */
4699 if (r_ptr->flags3 & (RF3_UNDEAD))
4701 /* Learn about type */
4702 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4705 if (seen) obvious = TRUE;
4709 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4710 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4712 note = " shudders.";
4713 note_dies = " dissolves!";
4735 if (r_ptr->flags3 & (RF3_RES_ALL))
4741 /* Only affect evil */
4742 if (r_ptr->flags3 & (RF3_EVIL))
4744 /* Learn about type */
4745 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4748 if (seen) obvious = TRUE;
4752 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4753 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4755 note = " shudders.";
4756 note_dies = " dissolves!";
4777 if (r_ptr->flags3 & (RF3_RES_ALL))
4783 /* Only affect good */
4784 if (r_ptr->flags3 & (RF3_GOOD))
4786 /* Learn about type */
4787 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
4790 if (seen) obvious = TRUE;
4794 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4795 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4797 note = " shudders.";
4798 note_dies = " dissolves!";
4817 case GF_DISP_LIVING:
4819 if (r_ptr->flags3 & (RF3_RES_ALL))
4825 /* Only affect non-undead */
4826 if (monster_living(r_ptr))
4829 if (seen) obvious = TRUE;
4833 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4834 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4836 note = " shudders.";
4837 note_dies = " dissolves!";
4858 if (r_ptr->flags3 & (RF3_RES_ALL))
4864 /* Only affect demons */
4865 if (r_ptr->flags3 & (RF3_DEMON))
4867 /* Learn about type */
4868 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
4871 if (seen) obvious = TRUE;
4875 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4876 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4878 note = " shudders.";
4879 note_dies = " dissolves!";
4897 /* Dispel monster */
4900 if (r_ptr->flags3 & (RF3_RES_ALL))
4907 if (seen) obvious = TRUE;
4911 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4912 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4914 note = " shudders.";
4915 note_dies = " dissolves!";
4925 if (seen) obvious = TRUE;
4926 if (r_ptr->flags3 & (RF3_RES_ALL))
4929 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4931 note = " is immune.";
4934 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4938 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4942 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
4944 msg_format("You draws psychic energy from %s.", m_name);
4947 (void)hp_player(dam);
4952 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
4954 msg_format("%s is unaffected.", m_name);
4964 if (seen) obvious = TRUE;
4967 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4969 msg_format("You gazes intently at %s.", m_name);
4972 if (r_ptr->flags3 & (RF3_RES_ALL))
4975 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4977 note = " is immune.";
4980 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4984 /* Attempt a saving throw */
4985 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4986 (r_ptr->flags3 & RF3_NO_CONF) ||
4987 (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4989 /* Memorize a flag */
4990 if (r_ptr->flags3 & (RF3_NO_CONF))
4992 r_ptr->r_flags3 |= (RF3_NO_CONF);
4995 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
4997 note = "is unaffected!";
5004 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5005 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5007 msg_format("%^s is blasted by psionic energy.", m_name);
5008 note_dies = " collapses, a mindless husk.";
5011 do_conf = randint0(8) + 8;
5017 case GF_BRAIN_SMASH:
5019 if (seen) obvious = TRUE;
5022 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
5024 msg_format("You gazes intently at %s.", m_name);
5027 if (r_ptr->flags3 & (RF3_RES_ALL))
5030 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5032 note = " is immune.";
5035 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5039 /* Attempt a saving throw */
5040 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5041 (r_ptr->flags3 & RF3_NO_CONF) ||
5042 (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
5044 /* Memorize a flag */
5045 if (r_ptr->flags3 & (RF3_NO_CONF))
5047 r_ptr->r_flags3 |= (RF3_NO_CONF);
5050 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5052 note = "is unaffected!";
5059 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5060 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5062 msg_format("%^s is blasted by psionic energy.", m_name);
5063 note_dies = " collapses, a mindless husk.";
5066 do_conf = randint0(8) + 8;
5067 do_stun = randint0(8) + 8;
5068 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5069 if (c_ptr->m_idx == p_ptr->riding)
5070 p_ptr->update |= (PU_BONUS);
5078 if (seen) obvious = TRUE;
5081 msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5083 msg_format("You points at %s and curses.", m_name);
5086 if (r_ptr->flags3 & (RF3_RES_ALL))
5089 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5091 note = " is immune.";
5094 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5098 /* Attempt a saving throw */
5099 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5103 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5105 note = "is unaffected!";
5115 if (seen) obvious = TRUE;
5118 msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5120 msg_format("You points at %s and curses horribly.", m_name);
5123 if (r_ptr->flags3 & (RF3_RES_ALL))
5126 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5128 note = " is immune.";
5131 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5135 /* Attempt a saving throw */
5136 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5140 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5142 note = "is unaffected!";
5152 if (seen) obvious = TRUE;
5155 msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
5157 msg_format("You points at %s, incanting terribly!", m_name);
5160 if (r_ptr->flags3 & (RF3_RES_ALL))
5163 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5165 note = " is immune.";
5168 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5172 /* Attempt a saving throw */
5173 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5177 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5179 note = "is unaffected!";
5189 if (seen) obvious = TRUE;
5192 msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
5194 msg_format("You points at %s, screaming th word, 'DIE!'.", m_name);
5197 if (r_ptr->flags3 & (RF3_RES_ALL))
5200 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5202 note = " is immune.";
5205 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5209 /* Attempt a saving throw */
5210 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5214 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5216 note = "is unaffected!";
5226 if (seen) obvious = TRUE;
5228 if (r_ptr->flags3 & (RF3_RES_ALL))
5231 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5233 note = " is immune.";
5236 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5240 if (r_ptr->flags1 & RF1_UNIQUE)
5243 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5245 note = "is unaffected!";
5251 if ((p_ptr->lev + randint1(dam)) >
5252 (r_ptr->level + randint1(200)))
5254 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5256 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5261 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5271 /* Capture monster */
5275 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5276 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5279 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5281 msg_format("%^s is unaffected.", m_name);
5287 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5288 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
5289 nokori_hp = m_ptr->maxhp * 3 / 10;
5291 nokori_hp = m_ptr->maxhp * 3 / 20;
5293 if (m_ptr->hp >= nokori_hp)
5296 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5298 msg_format("You need to weaken %s more.", m_name);
5302 else if (m_ptr->hp < randint0(nokori_hp))
5304 if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5306 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5308 msg_format("You captures %^s!", m_name);
5310 cap_mon = m_list[c_ptr->m_idx].r_idx;
5311 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5312 cap_hp = m_list[c_ptr->m_idx].hp;
5313 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5314 if (m_list[c_ptr->m_idx].nickname)
5315 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5318 if (c_ptr->m_idx == p_ptr->riding)
5320 if (rakuba(-1, FALSE))
5323 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5325 msg_format("You have fallen from %s.", m_name);
5330 delete_monster_idx(c_ptr->m_idx);
5337 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5339 msg_format("You failed to capture %s.", m_name);
5348 if (seen) obvious = TRUE;
5350 if (dam == HISSATSU_NYUSIN)
5354 bool success = FALSE;
5355 for (i = 0; i < 8; i++)
5357 if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
5360 if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
5369 if ((ny != py) || (nx != px))
5371 teleport_player_to(ny, nx, FALSE);
5373 msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
5375 msg_format("You quickly jump in and attack %s!", m_name);
5382 msg_print("¼ºÇÔ¡ª");
5384 msg_print("Failed!");
5391 return (py_attack(y, x, dam));
5394 msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
5396 msg_print("You attack the empty air.");
5402 /* Sleep (Use "dam" as "power") */
5408 if (seen) obvious = TRUE;
5410 if (r_ptr->flags3 & (RF3_RES_ALL))
5413 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5415 note = " is immune.";
5418 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5421 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5424 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5426 note = " is immune!";
5430 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5436 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5438 note = " is immune!";
5445 if (one_in_(5)) effect = 1;
5446 else if (one_in_(4)) effect = 2;
5447 else if (one_in_(3)) effect = 3;
5452 /* Powerful monsters can resist */
5453 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5454 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5457 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5459 note = " is unaffected!";
5465 /* Normal monsters slow down */
5471 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5473 note = " starts moving slower.";
5476 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5478 if (c_ptr->m_idx == p_ptr->riding)
5479 p_ptr->update |= (PU_BONUS);
5483 else if (effect == 2)
5485 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5487 /* Attempt a saving throw */
5488 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5489 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5494 /* No obvious effect */
5496 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5498 note = " is unaffected!";
5505 else if (effect == 3)
5507 /* Attempt a saving throw */
5508 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5509 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5510 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5512 /* Memorize a flag */
5513 if (r_ptr->flags3 & RF3_NO_SLEEP)
5515 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5518 /* No obvious effect */
5520 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5522 note = " is unaffected!";
5529 /* Go to sleep (much) later */
5531 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5533 note = " falls asleep!";
5543 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5545 note = " is immune!";
5549 /* No "real" damage */
5558 if (seen) obvious = TRUE;
5560 if (r_ptr->flags3 & (RF3_RES_ALL))
5563 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5565 note = " is immune.";
5568 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5572 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)
5579 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
5586 delete_monster_idx(c_ptr->m_idx);
5588 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5590 msg_format("%^s disappered!",m_name);
5594 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5596 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5600 chg_virtue(V_VITALITY, -1);
5605 p_ptr->redraw |= (PR_HP);
5608 p_ptr->window |= (PW_PLAYER);
5615 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5617 note = "is unaffected!";
5620 if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
5628 msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
5630 msg_format("You take a photograph of %s.",m_name);
5633 if (r_ptr->flags3 & (RF3_HURT_LITE))
5635 /* Obvious effect */
5636 if (seen) obvious = TRUE;
5638 /* Memorize the effects */
5639 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5641 /* Special effect */
5643 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5644 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5646 note = " cringes from the light!";
5647 note_dies = " shrivels away in the light!";
5652 /* Normally no damage */
5659 photo = m_ptr->r_idx;
5666 case GF_BLOOD_CURSE:
5668 if (seen) obvious = TRUE;
5669 if (r_ptr->flags3 & (RF3_RES_ALL))
5672 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5674 note = " is immune.";
5677 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5697 /* Absolutely no effect */
5698 if (skipped) return (FALSE);
5700 /* "Unique" monsters cannot be polymorphed */
5701 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5703 /* Quest monsters cannot be polymorphed */
5704 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5706 if (p_ptr->riding & (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5708 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5709 if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
5711 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5716 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5717 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5720 /* Modify the damage */
5722 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5724 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
5726 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5729 /* Check for death */
5730 if (dam > m_ptr->hp)
5732 /* Extract method of death */
5736 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5737 else if (do_poly && (randint1(90) > r_ptr->level))
5739 if (polymorph_monster(y, x))
5742 if (seen) obvious = TRUE;
5744 /* Monster polymorphs */
5746 note = "¤¬ÊѿȤ·¤¿¡ª";
5752 /* Turn off the damage */
5755 /* Hack -- Get new monster */
5756 m_ptr = &m_list[c_ptr->m_idx];
5758 /* Hack -- Get new race */
5759 r_ptr = &r_info[m_ptr->r_idx];
5765 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5767 note = " is unaffected!";
5773 /* Handle "teleport" */
5777 if (seen) obvious = TRUE;
5781 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5783 note = " disappears!";
5786 chg_virtue(V_VALOUR, -1);
5789 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
5791 /* Hack -- get new location */
5795 /* Hack -- get new grid */
5796 c_ptr = &cave[y][x];
5799 /* Sound and Impact breathers never stun */
5801 !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
5802 !(r_ptr->flags4 & (RF4_BR_WALL)) &&
5803 !(r_ptr->flags3 & (RF3_NO_STUN)))
5806 if (seen) obvious = TRUE;
5812 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5814 note = " is more dazed.";
5817 tmp = m_ptr->stunned + (do_stun / 2);
5822 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5824 note = " is dazed.";
5831 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5837 /* Confusion and Chaos breathers (and sleepers) never confuse */
5839 !(r_ptr->flags3 & (RF3_NO_CONF)) &&
5840 !(r_ptr->flags4 & (RF4_BR_CONF)) &&
5841 !(r_ptr->flags4 & (RF4_BR_CHAO)))
5844 if (seen) obvious = TRUE;
5846 /* Already partially confused */
5847 if (m_ptr->confused)
5850 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5852 note = " looks more confused.";
5855 tmp = m_ptr->confused + (do_conf / 2);
5858 /* Was not confused */
5862 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5864 note = " looks confused.";
5870 /* Apply confusion */
5871 m_ptr->confused = (tmp < 200) ? tmp : 200;
5879 if (seen) obvious = TRUE;
5881 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
5886 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5888 note = " seems weakened.";
5890 m_ptr->maxhp -= do_time;
5891 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
5901 tmp = m_ptr->monfear + do_fear;
5904 m_ptr->monfear = (tmp < 200) ? tmp : 200;
5911 /* If another monster did the damage, hurt the monster by hand */
5914 /* Redraw (later) if needed */
5915 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5916 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5918 /* Wake the monster up */
5921 /* Hurt the monster */
5929 if (is_pet(m_ptr) && !(m_ptr->ml))
5932 /* Give detailed messages if destroyed */
5935 monster_desc(m_name, m_ptr, 0x100);
5938 msg_format("%^s%s", m_name, note);
5946 monster_gain_exp(who, m_ptr->r_idx);
5948 /* Generate treasure, etc */
5949 monster_death(c_ptr->m_idx, FALSE);
5951 /* Delete the monster */
5952 delete_monster_idx(c_ptr->m_idx);
5957 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
5959 msg_print("You feel sad for a moment.");
5965 /* Damaged monster */
5968 /* Give detailed messages if visible or destroyed */
5969 if (note && seen) msg_format("%^s%s", m_name, note);
5971 /* Hack -- Pain message */
5974 message_pain(c_ptr->m_idx, dam);
5981 /* Hack -- handle sleep */
5982 if (do_sleep) m_ptr->csleep = do_sleep;
5986 else if (heal_leper)
5989 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
5991 msg_print("The Mangy looking leper is healed!");
5994 delete_monster_idx(c_ptr->m_idx);
5996 /* If the player did it, give him experience, check fear */
5997 else if (typ != GF_DRAIN_MANA)
6001 /* Hurt the monster, check for fear and death */
6002 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6007 /* Damaged monster */
6010 /* HACK - anger the monster before showing the sleep message */
6011 if (do_sleep) anger_monster(m_ptr);
6013 /* Give detailed messages if visible or destroyed */
6016 msg_format("%s%s", m_name, note);
6018 msg_format("%^s%s", m_name, note);
6022 /* Hack -- Pain message */
6025 message_pain(c_ptr->m_idx, dam);
6028 /* Anger monsters */
6029 if (((dam > 0) || get_angry) && !do_sleep)
6030 anger_monster(m_ptr);
6033 if ((fear || do_fear) && (m_ptr->ml))
6040 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6042 msg_format("%^s flees in terror!", m_name);
6047 /* Hack -- handle sleep */
6048 if (do_sleep) m_ptr->csleep = do_sleep;
6052 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6054 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6058 switch (randint1(28))
6064 msg_print("ÃÏÌ̤¬Íɤ줿...");
6066 msg_print("The ground trembles...");
6069 earthquake(ty, tx, 4 + randint0(4));
6070 if (!one_in_(6)) break;
6072 case 3: case 4: case 5: case 6:
6075 int dam = damroll(10, 10);
6077 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6079 msg_print("A portal opens to a plane of raw mana!");
6082 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6083 if (!one_in_(6)) break;
6089 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6091 msg_print("Space warps about you!");
6094 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6095 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6096 if (!one_in_(6)) break;
6098 case 9: case 10: case 11:
6100 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6102 msg_print("You feel a surge of energy!");
6105 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6106 if (!one_in_(6)) break;
6107 case 12: case 13: case 14: case 15: case 16:
6108 aggravate_monsters(0);
6109 if (!one_in_(6)) break;
6111 count += activate_hi_summon(ty, tx, TRUE);
6112 if (!one_in_(6)) break;
6113 case 19: case 20: case 21: case 22:
6115 bool pet = FALSE, friendly = FALSE;
6125 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
6126 if (!one_in_(6)) break;
6128 case 23: case 24: case 25:
6129 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6131 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6133 msg_print("You feel your life draining away...");
6136 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6137 else lose_exp(p_ptr->exp / 16);
6138 if (!one_in_(6)) break;
6139 case 26: case 27: case 28:
6148 (void)do_dec_stat(i);
6157 (void)do_dec_stat(randint0(6));
6166 if (p_ptr->inside_battle)
6168 p_ptr->health_who = c_ptr->m_idx;
6169 p_ptr->redraw |= (PR_HEALTH);
6173 /* XXX XXX XXX Verify this code */
6175 /* Update the monster */
6176 update_mon(c_ptr->m_idx, FALSE);
6178 /* Redraw the monster grid */
6182 /* Update monster recall window */
6183 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6186 p_ptr->window |= (PW_MONSTER);
6189 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6193 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6195 set_target(m_ptr, monster_target_y, monster_target_x);
6198 else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
6200 set_target(m_ptr, m_list[who].fy, m_list[who].fx);
6204 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6206 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6207 rakubadam_m = (dam > 200) ? 200 : dam;
6216 /* Get local object */
6219 /* Prepare to make a Blade of Chaos */
6220 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6222 q_ptr->pval = photo;
6224 /* Mark the item as fully known */
6225 q_ptr->ident |= (IDENT_MENTAL);
6227 /* Drop it in the dungeon */
6228 (void)drop_near(q_ptr, -1, py, px);
6236 /* Return "Anything seen?" */
6242 * Helper function for "project()" below.
6244 * Handle a beam/bolt/ball causing damage to the player.
6246 * This routine takes a "source monster" (by index), a "distance", a default
6247 * "damage", and a "damage type". See "project_m()" above.
6249 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6250 * is reduced (see "project_m()" above). This can happen if a monster breathes
6251 * at the player and hits a wall instead.
6253 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6254 * to know if this is actually a ball or a bolt spell
6257 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6258 * we just assume that the effects were obvious, for historical reasons.
6260 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int a_rad, int monspell)
6264 /* Hack -- assume obvious */
6265 bool obvious = TRUE;
6267 /* Player blind-ness */
6268 bool blind = (p_ptr->blind ? TRUE : FALSE);
6270 /* Player needs a "description" (he is blind) */
6273 /* Source monster */
6274 monster_type *m_ptr;
6276 /* Monster name (for attacks) */
6279 /* Monster name (for damage) */
6282 /* Hack -- messages */
6286 /* Player is not here */
6287 if ((x != px) || (y != py)) return (FALSE);
6289 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6295 /* Player cannot hurt himself */
6296 if (!who) return (FALSE);
6297 if (who == p_ptr->riding) return (FALSE);
6299 if ((p_ptr->reflect || p_ptr->tim_reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && !a_rad && !one_in_(10) && (typ != GF_PSY_SPEAR))
6302 int max_attempts = 10;
6305 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6306 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6307 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6309 if (blind) msg_print("Something bounces!");
6310 else msg_print("The attack bounces!");
6314 /* Choose 'new' target */
6317 t_y = m_list[who].fy - 1 + randint1(3);
6318 t_x = m_list[who].fx - 1 + randint1(3);
6321 while (max_attempts && in_bounds2u(t_y, t_x) &&
6322 !(player_has_los_bold(t_y, t_x)));
6324 if (max_attempts < 1)
6326 t_y = m_list[who].fy;
6327 t_x = m_list[who].fx;
6330 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL), monspell);
6337 /* Limit maximum damage */
6338 if (dam > 1600) dam = 1600;
6340 /* Reduce damage by distance */
6341 dam = (dam + r) / (r + 1);
6344 /* If the player is blind, be more descriptive */
6345 if (blind) fuzzy = TRUE;
6348 /* Get the source monster */
6349 m_ptr = &m_list[who];
6351 /* Get the monster name */
6352 monster_desc(m_name, m_ptr, 0);
6354 /* Get the monster's real name (gotten before polymorph!) */
6355 strcpy(killer, who_name);
6357 /* Analyze the damage */
6360 /* Standard damage -- hurts inventory too */
6364 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6366 if (fuzzy) msg_print("You are hit by acid!");
6369 acid_dam(dam, killer, monspell);
6373 /* Standard damage -- hurts inventory too */
6377 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6379 if (fuzzy) msg_print("You are hit by fire!");
6382 fire_dam(dam, killer, monspell);
6386 /* Standard damage -- hurts inventory too */
6390 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6392 if (fuzzy) msg_print("You are hit by cold!");
6395 cold_dam(dam, killer, monspell);
6399 /* Standard damage -- hurts inventory too */
6403 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6405 if (fuzzy) msg_print("You are hit by lightning!");
6408 elec_dam(dam, killer, monspell);
6412 /* Standard damage -- also poisons player */
6415 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6417 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6419 if (fuzzy) msg_print("You are hit by poison!");
6422 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6423 if (double_resist) dam = (dam + 2) / 3;
6425 if ((!(double_resist || p_ptr->resist_pois)) &&
6426 one_in_(HURT_CHANCE))
6431 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6433 if (!(double_resist || p_ptr->resist_pois))
6435 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6440 /* Standard damage -- also poisons / mutates player */
6443 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6445 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6447 if (fuzzy) msg_print("You are hit by radiation!");
6450 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6451 if (double_resist) dam = (2 * dam + 2) / 5;
6452 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6453 if (!(double_resist || p_ptr->resist_pois))
6455 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6457 if (one_in_(5)) /* 6 */
6460 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6462 msg_print("You undergo a freakish metamorphosis!");
6465 if (one_in_(4)) /* 4 */
6473 inven_damage(set_acid_destroy, 2);
6479 /* Standard damage */
6483 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6485 if (fuzzy) msg_print("You are hit by something!");
6488 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6492 /* Holy Orb -- Player only takes partial damage */
6496 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6498 if (fuzzy) msg_print("You are hit by something!");
6501 if (p_ptr->align > 10)
6503 else if (p_ptr->align < -10)
6505 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6512 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6514 if (fuzzy) msg_print("You are hit by something!");
6517 if (p_ptr->align > 10)
6519 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6523 /* Arrow -- XXX no dodging */
6527 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6529 if (fuzzy) msg_print("You are hit by something sharp!");
6532 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6535 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6537 msg_print("You cut down the arrow!");
6541 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6545 /* Plasma -- XXX No resist */
6549 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6551 if (fuzzy) msg_print("You are hit by something *HOT*!");
6554 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6556 if (!p_ptr->resist_sound)
6558 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6559 (void)set_stun(p_ptr->stun + k);
6562 if (!(p_ptr->resist_fire ||
6563 p_ptr->oppose_fire ||
6564 music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
6565 p_ptr->immune_fire))
6567 inven_damage(set_acid_destroy, 3);
6573 /* Nether -- drain experience */
6577 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6579 if (fuzzy) msg_print("You are hit by nether forces!");
6583 if (p_ptr->resist_neth)
6585 if (!prace_is_(RACE_SPECTRE))
6586 dam *= 6; dam /= (randint1(4) + 7);
6588 else if (p_ptr->prace != RACE_ANDROID)
6590 if (p_ptr->hold_life && (randint0(100) < 75))
6593 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6595 msg_print("You keep hold of your life force!");
6599 else if (p_ptr->hold_life)
6602 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6604 msg_print("You feel your life slipping away!");
6607 lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6612 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6614 msg_print("You feel your life draining away!");
6617 lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6621 if (prace_is_(RACE_SPECTRE))
6624 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6626 msg_print("You feel invigorated!");
6630 learn_spell(monspell);
6634 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6640 /* Water -- stun/confuse */
6644 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6646 if (fuzzy) msg_print("You are hit by something wet!");
6649 if (!p_ptr->resist_sound)
6651 set_stun(p_ptr->stun + randint1(40));
6653 if (!p_ptr->resist_conf)
6655 set_confused(p_ptr->confused + randint1(5) + 5);
6660 inven_damage(set_cold_destroy, 3);
6663 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6667 /* Chaos -- many effects */
6671 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6673 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6676 if (p_ptr->resist_chaos)
6678 dam *= 6; dam /= (randint1(4) + 7);
6680 if (!p_ptr->resist_conf)
6682 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6684 if (!p_ptr->resist_chaos)
6686 (void)set_image(p_ptr->image + randint1(10));
6690 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6692 msg_print("Your body is twisted by chaos!");
6695 (void)gain_random_mutation(0);
6698 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6700 if (p_ptr->prace == RACE_ANDROID)
6703 else if (p_ptr->hold_life && (randint0(100) < 75))
6706 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6708 msg_print("You keep hold of your life force!");
6712 else if (p_ptr->hold_life)
6715 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6717 msg_print("You feel your life slipping away!");
6720 lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6725 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6727 msg_print("You feel your life draining away!");
6730 lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6733 if (!p_ptr->resist_chaos || one_in_(9))
6735 inven_damage(set_elec_destroy, 2);
6736 inven_damage(set_fire_destroy, 2);
6738 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6742 /* Shards -- mostly cutting */
6746 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6748 if (fuzzy) msg_print("You are hit by something sharp!");
6751 if (p_ptr->resist_shard)
6753 dam *= 6; dam /= (randint1(4) + 7);
6757 (void)set_cut(p_ptr->cut + dam);
6760 if (!p_ptr->resist_shard || one_in_(13))
6762 inven_damage(set_cold_destroy, 2);
6765 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6769 /* Sound -- mostly stunning */
6773 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6775 if (fuzzy) msg_print("You are hit by a loud noise!");
6778 if (p_ptr->resist_sound)
6780 dam *= 5; dam /= (randint1(4) + 7);
6784 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6785 (void)set_stun(p_ptr->stun + k);
6788 if (!p_ptr->resist_sound || one_in_(13))
6790 inven_damage(set_cold_destroy, 2);
6793 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6797 /* Pure confusion */
6801 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6803 if (fuzzy) msg_print("You are hit by something puzzling!");
6806 if (p_ptr->resist_conf)
6808 dam *= 5; dam /= (randint1(4) + 7);
6810 if (!p_ptr->resist_conf)
6812 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6814 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6818 /* Disenchantment -- see above */
6822 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6824 if (fuzzy) msg_print("You are hit by something static!");
6827 if (p_ptr->resist_disen)
6829 dam *= 6; dam /= (randint1(4) + 7);
6833 (void)apply_disenchant(0);
6835 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6839 /* Nexus -- see above */
6843 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6845 if (fuzzy) msg_print("You are hit by something strange!");
6848 if (p_ptr->resist_nexus)
6850 dam *= 6; dam /= (randint1(4) + 7);
6856 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6860 /* Force -- mostly stun */
6864 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6866 if (fuzzy) msg_print("You are hit by kinetic force!");
6869 if (!p_ptr->resist_sound)
6871 (void)set_stun(p_ptr->stun + randint1(20));
6873 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6878 /* Rocket -- stun, cut */
6882 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6884 if (fuzzy) msg_print("There is an explosion!");
6887 if (!p_ptr->resist_sound)
6889 (void)set_stun(p_ptr->stun + randint1(20));
6891 if (p_ptr->resist_shard)
6897 (void)set_cut(p_ptr-> cut + ( dam / 2));
6900 if ((!p_ptr->resist_shard) || one_in_(12))
6902 inven_damage(set_cold_destroy, 3);
6905 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6909 /* Inertia -- slowness */
6913 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6915 if (fuzzy) msg_print("You are hit by something slow!");
6918 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6919 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6923 /* Lite -- blinding */
6927 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6929 if (fuzzy) msg_print("You are hit by something!");
6932 if (p_ptr->resist_lite)
6934 dam *= 4; dam /= (randint1(4) + 7);
6936 else if (!blind && !p_ptr->resist_blind)
6938 (void)set_blind(p_ptr->blind + randint1(5) + 2);
6940 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
6943 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
6945 msg_print("The light scorches your flesh!");
6950 else if (prace_is_(RACE_S_FAIRY))
6954 if (p_ptr->wraith_form) dam *= 2;
6955 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6957 if (p_ptr->wraith_form)
6959 p_ptr->wraith_form = 0;
6961 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
6963 msg_print("The light forces you out of your incorporeal shadow form.");
6966 p_ptr->redraw |= PR_MAP;
6967 /* Update monsters */
6968 p_ptr->update |= (PU_MONSTERS);
6970 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6972 /* Redraw status bar */
6973 p_ptr->redraw |= (PR_STATUS);
6980 /* Dark -- blinding */
6984 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6986 if (fuzzy) msg_print("You are hit by something!");
6989 if (p_ptr->resist_dark)
6991 dam *= 4; dam /= (randint1(4) + 7);
6993 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
6995 else if (!blind && !p_ptr->resist_blind)
6997 (void)set_blind(p_ptr->blind + randint1(5) + 2);
6999 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7003 /* Time -- bolt fewer effects XXX */
7007 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7009 if (fuzzy) msg_print("You are hit by a blast from the past!");
7012 if (p_ptr->resist_time)
7015 dam /= (randint1(4) + 7);
7017 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7019 msg_print("You feel as if time is passing you by.");
7025 switch (randint1(10))
7027 case 1: case 2: case 3: case 4: case 5:
7029 if (p_ptr->prace == RACE_ANDROID) break;
7031 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7033 msg_print("You feel life has clocked back.");
7036 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7040 case 6: case 7: case 8: case 9:
7042 switch (randint1(6))
7045 case 1: k = A_STR; act = "¶¯¤¯"; break;
7046 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7047 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7048 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7049 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7050 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7052 case 1: k = A_STR; act = "strong"; break;
7053 case 2: k = A_INT; act = "bright"; break;
7054 case 3: k = A_WIS; act = "wise"; break;
7055 case 4: k = A_DEX; act = "agile"; break;
7056 case 5: k = A_CON; act = "hale"; break;
7057 case 6: k = A_CHR; act = "beautiful"; break;
7063 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7065 msg_format("You're not as %s as you used to be...", act);
7069 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7070 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7071 p_ptr->update |= (PU_BONUS);
7078 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7080 msg_print("You're not as powerful as you used to be...");
7084 for (k = 0; k < 6; k++)
7086 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7087 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7089 p_ptr->update |= (PU_BONUS);
7095 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7099 /* Gravity -- stun plus slowness plus teleport */
7103 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7104 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7106 if (fuzzy) msg_print("You are hit by something heavy!");
7107 msg_print("Gravity warps around you.");
7112 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7113 if (!(p_ptr->resist_sound || p_ptr->ffall))
7115 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7116 (void)set_stun(p_ptr->stun + k);
7120 dam = (dam * 2) / 3;
7123 if (!p_ptr->ffall || one_in_(13))
7125 inven_damage(set_cold_destroy, 2);
7128 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7132 /* Standard damage */
7133 case GF_DISINTEGRATE:
7136 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7138 if (fuzzy) msg_print("You are hit by pure energy!");
7141 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7148 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7150 if (fuzzy) msg_print("You are hit by something invigorating!");
7153 (void)hp_player(dam);
7161 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7163 if (fuzzy) msg_print("You are hit by something!");
7166 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7174 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7176 if (fuzzy) msg_print("You are hit by something slow!");
7179 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7185 if (p_ptr->free_act) break;
7187 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7189 if (fuzzy) msg_print("You fall asleep!");
7193 if (ironman_nightmare)
7196 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7198 msg_print("A horrible vision enters your mind.");
7202 /* Pick a nightmare */
7203 get_mon_num_prep(get_nightmare, NULL);
7205 /* Have some nightmares */
7206 have_nightmare(get_mon_num(MAX_DEPTH));
7208 /* Remove the monster restriction */
7209 get_mon_num_prep(NULL, NULL);
7212 set_paralyzed(p_ptr->paralyzed + dam);
7223 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7225 if (fuzzy) msg_print("You are hit by an aura of magic!");
7228 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7236 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7238 if (fuzzy) msg_print("You are hit by an energy!");
7241 take_hit(DAMAGE_FORCE, dam, killer, monspell);
7249 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7251 if (fuzzy) msg_print("Something falls from the sky on you!");
7254 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7255 if (!p_ptr->resist_shard || one_in_(13))
7257 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7258 inven_damage(set_cold_destroy, 2);
7264 /* Ice -- cold plus stun plus cuts */
7268 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7270 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7273 cold_dam(dam, killer, monspell);
7274 if (!p_ptr->resist_shard)
7276 (void)set_cut(p_ptr->cut + damroll(5, 8));
7278 if (!p_ptr->resist_sound)
7280 (void)set_stun(p_ptr->stun + randint1(15));
7283 if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
7285 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7295 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7297 if (fuzzy) msg_print("You are hit by something extremely cold!");
7301 if (p_ptr->mimic_form)
7303 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7304 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7309 switch (p_ptr->prace)
7311 /* Some races are immune */
7325 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7345 if (p_ptr->riding && dam > 0)
7347 rakubadam_p = (dam > 200) ? 200 : dam;
7355 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7361 /* Return "Anything seen?" */
7367 * Find the distance from (x, y) to a line.
7369 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7371 /* Vector from (x, y) to (x1, y1) */
7380 int pd = distance(y1, x1, y, x);
7381 int nd = distance(y1, x1, y2, x2);
7383 if (pd > nd) return distance(y, x, y2, x2);
7385 /* Component of P on N */
7386 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7388 /* Absolute value */
7389 return((nd >= 0) ? nd : 0 - nd);
7396 * Modified version of los() for calculation of disintegration balls.
7397 * Disintegration effects are stopped by permanent walls.
7399 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7419 /* Slope, or 1/Slope, of LOS */
7423 /* Extract the offset */
7427 /* Extract the absolute offset */
7432 /* Handle adjacent (or identical) grids */
7433 if ((ax < 2) && (ay < 2)) return (TRUE);
7436 /* Paranoia -- require "safe" origin */
7437 /* if (!in_bounds(y1, x1)) return (FALSE); */
7440 /* Directly South/North */
7443 /* South -- check for walls */
7446 for (ty = y1 + 1; ty < y2; ty++)
7448 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7452 /* North -- check for walls */
7455 for (ty = y1 - 1; ty > y2; ty--)
7457 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7465 /* Directly East/West */
7468 /* East -- check for walls */
7471 for (tx = x1 + 1; tx < x2; tx++)
7473 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7477 /* West -- check for walls */
7480 for (tx = x1 - 1; tx > x2; tx--)
7482 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7491 /* Extract some signs */
7492 sx = (dx < 0) ? -1 : 1;
7493 sy = (dy < 0) ? -1 : 1;
7496 /* Vertical "knights" */
7501 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7505 /* Horizontal "knights" */
7510 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7515 /* Calculate scale factor div 2 */
7518 /* Calculate scale factor */
7522 /* Travel horizontally */
7525 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7531 /* Consider the special case where slope == 1. */
7542 /* Note (below) the case (qy == f2), where */
7543 /* the LOS exactly meets the corner of a tile. */
7546 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7557 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7570 /* Travel vertically */
7573 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7589 /* Note (below) the case (qx == f2), where */
7590 /* the LOS exactly meets the corner of a tile. */
7593 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7604 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7624 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)
7637 while (bdis <= distance(y1, x1, y2, x2) + rad)
7639 /* Travel from center outward */
7640 for (cdis = 0; cdis <= brad; cdis++)
7643 /* Scan the maximal blast area of radius "cdis" */
7644 for (y = by - cdis; y <= by + cdis; y++)
7646 for (x = bx - cdis; x <= bx + cdis; x++)
7648 /* Ignore "illegal" locations */
7649 if (!in_bounds(y, x)) continue;
7651 /* Enforce a circular "ripple" */
7652 if (distance(y1, x1, y, x) != bdis) continue;
7654 /* Enforce an arc */
7655 if (distance(by, bx, y, x) != cdis) continue;
7659 /* Disintegration balls explosions are stopped by perma-walls */
7660 if (!in_disintegration_range(by, bx, y, x)) continue;
7662 if (real_breath && cave_valid_bold(y, x) &&
7663 (cave[y][x].feat < FEAT_PATTERN_START ||
7664 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
7665 (cave[y][x].feat < FEAT_DEEP_WATER ||
7666 cave[y][x].feat > FEAT_GRASS))
7668 if (cave[y][x].feat == FEAT_TREES)
7669 cave_set_feat(y, x, FEAT_GRASS);
7672 cave[y][x].feat = floor_type[randint0(100)];
7673 cave[y][x].info &= ~(CAVE_MASK);
7674 cave[y][x].info |= CAVE_FLOOR;
7677 /* Update some things -- similar to GF_KILL_WALL */
7678 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
7682 /* The blast is stopped by walls */
7683 if (!los(by, bx, y, x)) continue;
7686 /* Save this grid */
7694 /* Encode some more "radius" info */
7695 gm[bdis + 1] = *pgrids;
7698 if ((by == y2) && (bx == x2)) done = TRUE;
7707 /* Ripple outwards */
7708 /* mmove2(&by, &bx, y1, x1, y2, x2); */
7710 by = GRID_Y(path_g[bdis]);
7711 bx = GRID_X(path_g[bdis]);
7713 /* Find the next ripple */
7716 /* Increase the size */
7717 brad = (rad * bdis) / dist;
7720 /* Store the effect size */
7726 * Generic "beam"/"bolt"/"ball" projection routine.
7729 * who: Index of "source" monster (zero for "player")
7730 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
7731 * y,x: Target location (or location to travel "towards")
7732 * dam: Base damage roll to apply to affected monsters (or player)
7733 * typ: Type of damage to apply to monsters (and objects)
7734 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
7737 * TRUE if any "effects" of the projection were observed, else FALSE
7739 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
7740 * towards a given location (optionally passing over the heads of interposing
7741 * monsters), and have it do a given amount of damage to the monsters (and
7742 * optionally objects) within the given radius of the final location.
7744 * A "bolt" travels from source to target and affects only the target grid.
7745 * A "beam" travels from source to target, affecting all grids passed through.
7746 * A "ball" travels from source to the target, exploding at the target, and
7747 * affecting everything within the given radius of the target location.
7749 * Traditionally, a "bolt" does not affect anything on the ground, and does
7750 * not pass over the heads of interposing monsters, much like a traditional
7751 * missile, and will "stop" abruptly at the "target" even if no monster is
7752 * positioned there, while a "ball", on the other hand, passes over the heads
7753 * of monsters between the source and target, and affects everything except
7754 * the source monster which lies within the final radius, while a "beam"
7755 * affects every monster between the source and target, except for the casting
7756 * monster (or player), and rarely affects things on the ground.
7758 * Two special flags allow us to use this function in special ways, the
7759 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
7760 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
7761 * actually projecting from the source monster (or player).
7763 * The player will only get "experience" for monsters killed by himself
7764 * Unique monsters can only be destroyed by attacks from the player
7766 * Only 256 grids can be affected per projection, limiting the effective
7767 * "radius" of standard ball attacks to nine units (diameter nineteen).
7769 * One can project in a given "direction" by combining PROJECT_THRU with small
7770 * offsets to the initial location (see "line_spell()"), or by calculating
7771 * "virtual targets" far away from the player.
7773 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
7774 * continuing until it actually hits somethings (useful for "stone to mud").
7776 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
7778 * Balls must explode BEFORE hitting walls, or they would affect monsters
7779 * on both sides of a wall. Some bug reports indicate that this is still
7780 * happening in 2.7.8 for Windows, though it appears to be impossible.
7782 * We "pre-calculate" the blast area only in part for efficiency.
7783 * More importantly, this lets us do "explosions" from the "inside" out.
7784 * This results in a more logical distribution of "blast" treasure.
7785 * It also produces a better (in my opinion) animation of the explosion.
7786 * It could be (but is not) used to have the treasure dropped by monsters
7787 * in the middle of the explosion fall "outwards", and then be damaged by
7788 * the blast as it spreads outwards towards the treasure drop location.
7790 * Walls and doors are included in the blast area, so that they can be
7791 * "burned" or "melted" in later versions.
7793 * This algorithm is intended to maximize simplicity, not necessarily
7794 * efficiency, since this function is not a bottleneck in the code.
7796 * We apply the blast effect from ground zero outwards, in several passes,
7797 * first affecting features, then objects, then monsters, then the player.
7798 * This allows walls to be removed before checking the object or monster
7799 * in the wall, and protects objects which are dropped by monsters killed
7800 * in the blast, and allows the player to see all affects before he is
7801 * killed or teleported away. The semantics of this method are open to
7802 * various interpretations, but they seem to work well in practice.
7804 * We process the blast area from ground-zero outwards to allow for better
7805 * distribution of treasure dropped by monsters, and because it provides a
7806 * pleasing visual effect at low cost.
7808 * Note that the damage done by "ball" explosions decreases with distance.
7809 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
7811 * Notice the "napalm" effect of "beam" weapons. First they "project" to
7812 * the target, and then the damage "flows" along this beam of destruction.
7813 * The damage at every grid is the same as at the "center" of a "ball"
7814 * explosion, since the "beam" grids are treated as if they ARE at the
7815 * center of a "ball" explosion.
7817 * Currently, specifying "beam" plus "ball" means that locations which are
7818 * covered by the initial "beam", and also covered by the final "ball", except
7819 * for the final grid (the epicenter of the ball), will be "hit twice", once
7820 * by the initial beam, and once by the exploding ball. For the grid right
7821 * next to the epicenter, this results in 150% damage being done. The center
7822 * does not have this problem, for the same reason the final grid in a "beam"
7823 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
7824 * grids which are covered by the "ball" will NOT work, as then they will
7825 * receive LESS damage than they should. Do not combine "beam" with "ball".
7827 * The array "gy[],gx[]" with current size "grids" is used to hold the
7828 * collected locations of all grids in the "blast area" plus "beam path".
7830 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
7831 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
7832 * first blast grid (see above) with radius "N" from the blast center. Note
7833 * that only the first gm[1] grids in the blast area thus take full damage.
7834 * Also, note that gm[rad+1] is always equal to "grids", which is the total
7835 * number of blast grids.
7837 * Note that once the projection is complete, (y2,x2) holds the final location
7838 * of bolts/beams, and the "epicenter" of balls.
7840 * Note also that "rad" specifies the "inclusive" radius of projection blast,
7841 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
7842 * implementation of the "distance" function. Also, a bolt can be properly
7843 * viewed as a "ball" with a "rad" of "zero".
7845 * Note that if no "target" is reached before the beam/bolt/ball travels the
7846 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
7847 * may be relevant even for bolts, since they have a "1x1" mini-blast.
7849 * Note that for consistency, we "pretend" that the bolt actually takes "time"
7850 * to move from point A to point B, even if the player cannot see part of the
7851 * projection path. Note that in general, the player will *always* see part
7852 * of the path, since it either starts at the player or ends on the player.
7854 * Hack -- we assume that every "projection" is "self-illuminating".
7856 * Hack -- when only a single monster is affected, we automatically track
7857 * (and recall) that monster, unless "PROJECT_JUMP" is used.
7859 * Note that all projections now "explode" at their final destination, even
7860 * if they were being projected at a more distant destination. This means
7861 * that "ball" spells will *always* explode.
7863 * Note that we must call "handle_stuff()" after affecting terrain features
7864 * in the blast radius, in case the "illumination" of the grid was changed,
7865 * and "update_view()" and "update_monsters()" need to be called.
7867 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
7876 int y_saver, x_saver; /* For reflecting monsters */
7878 int msec = delay_factor * delay_factor * delay_factor;
7880 /* Assume the player sees nothing */
7881 bool notice = FALSE;
7883 /* Assume the player has seen nothing */
7884 bool visual = FALSE;
7886 /* Assume the player has seen no blast grids */
7889 /* Assume to be a normal ball spell */
7890 bool breath = FALSE;
7892 /* Is the player blind? */
7893 bool blind = (p_ptr->blind ? TRUE : FALSE);
7895 bool old_hide = FALSE;
7897 /* Number of grids in the "path" */
7900 /* Actual grids in the "path" */
7903 /* Number of grids in the "blast area" (including the "beam" path) */
7906 /* Coordinates of the affected grids */
7907 byte gx[1024], gy[1024];
7909 /* Encoded "radius" info (see above) */
7912 /* Actual radius encoded in gm[] */
7917 /* Attacker's name (prepared before polymorph)*/
7923 /* Default target of monsterspell is player */
7924 monster_target_y=py;
7925 monster_target_x=px;
7927 /* Hack -- Jump to target */
7928 if (flg & (PROJECT_JUMP))
7933 /* Clear the flag */
7934 flg &= ~(PROJECT_JUMP);
7939 /* Start at player */
7946 /* Start at monster */
7949 x1 = m_list[who].fx;
7950 y1 = m_list[who].fy;
7951 monster_desc(who_name, &m_list[who], 0x288);
7964 /* Default "destination" */
7969 /* Hack -- verify stuff */
7970 if (flg & (PROJECT_THRU))
7972 if ((x1 == x2) && (y1 == y2))
7974 flg &= ~(PROJECT_THRU);
7978 /* Handle a breath attack */
7983 if (flg & PROJECT_HIDE) old_hide = TRUE;
7984 flg |= PROJECT_HIDE;
7988 /* Hack -- Assume there will be no blast (max radius 32) */
7989 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
7997 /* Collect beam grids */
7998 if (flg & (PROJECT_BEAM))
8005 if (breath && typ == GF_DISINTEGRATE)
8007 flg |= (PROJECT_DISI);
8010 /* Calculate the projection path */
8012 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8014 /* Hack -- Handle stuff */
8017 /* Giga-Hack SEEKER & SUPER_RAY */
8019 if( typ == GF_SEEKER )
8029 for (i = 0; i < path_n; ++i)
8034 int ny = GRID_Y(path_g[i]);
8035 int nx = GRID_X(path_g[i]);
8046 /* Only do visuals if requested */
8047 if (!blind && !(flg & (PROJECT_HIDE)))
8049 /* Only do visuals if the player can "see" the bolt */
8050 if (panel_contains(y, x) && player_has_los_bold(y, x))
8057 /* Obtain the bolt pict */
8058 p = bolt_pict(oy, ox, y, x, typ);
8060 /* Extract attr/char */
8064 /* Visual effects */
8065 print_rel(c, a, y, x);
8066 move_cursor_relative(y, x);
8067 /*if (fresh_before)*/ Term_fresh();
8068 Term_xtra(TERM_XTRA_DELAY, msec);
8070 /*if (fresh_before)*/ Term_fresh();
8072 /* Display "beam" grids */
8073 if (flg & (PROJECT_BEAM))
8075 /* Obtain the explosion pict */
8076 p = bolt_pict(y, x, y, x, typ);
8078 /* Extract attr/char */
8082 /* Visual effects */
8083 print_rel(c, a, y, x);
8086 /* Hack -- Activate delay */
8090 /* Hack -- delay anyway for consistency */
8093 /* Delay for consistency */
8094 Term_xtra(TERM_XTRA_DELAY, msec);
8097 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8098 if( cave[y][x].feat == FEAT_MIRROR )
8100 /* The target of monsterspell becomes tha mirror(broken) */
8101 monster_target_y=(s16b)y;
8102 monster_target_x=(s16b)x;
8104 cave_set_feat( y, x , FEAT_FLOOR );
8105 next_mirror( &oy,&ox );
8107 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8108 for( j = last_i; j <=i ; j++ )
8110 y = GRID_Y(path_g[j]);
8111 x = GRID_X(path_g[j]);
8112 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8113 if(!who && (project_m_n==1) && !jump ){
8114 if(cave[project_m_y][project_m_x].m_idx >0 ){
8115 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8117 /* Hack -- auto-recall */
8118 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8120 /* Hack - auto-track */
8121 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8124 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8129 for( i = last_i ; i < path_n ; i++ )
8132 y = GRID_Y(path_g[i]);
8133 x = GRID_X(path_g[i]);
8134 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8136 if(!who && (project_m_n==1) && !jump ){
8137 if(cave[project_m_y][project_m_x].m_idx >0 ){
8138 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8140 /* Hack -- auto-recall */
8141 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8143 /* Hack - auto-track */
8144 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8147 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8151 else if(typ == GF_SUPER_RAY){
8153 int second_step = 0;
8160 for (i = 0; i < path_n; ++i)
8165 int ny = GRID_Y(path_g[i]);
8166 int nx = GRID_X(path_g[i]);
8177 /* Only do visuals if requested */
8178 if (!blind && !(flg & (PROJECT_HIDE)))
8180 /* Only do visuals if the player can "see" the bolt */
8181 if (panel_contains(y, x) && player_has_los_bold(y, x))
8188 /* Obtain the bolt pict */
8189 p = bolt_pict(oy, ox, y, x, typ);
8191 /* Extract attr/char */
8195 /* Visual effects */
8196 print_rel(c, a, y, x);
8197 move_cursor_relative(y, x);
8198 /*if (fresh_before)*/ Term_fresh();
8199 Term_xtra(TERM_XTRA_DELAY, msec);
8201 /*if (fresh_before)*/ Term_fresh();
8203 /* Display "beam" grids */
8204 if (flg & (PROJECT_BEAM))
8206 /* Obtain the explosion pict */
8207 p = bolt_pict(y, x, y, x, typ);
8209 /* Extract attr/char */
8213 /* Visual effects */
8214 print_rel(c, a, y, x);
8217 /* Hack -- Activate delay */
8221 /* Hack -- delay anyway for consistency */
8224 /* Delay for consistency */
8225 Term_xtra(TERM_XTRA_DELAY, msec);
8228 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8229 if( cave[y][x].feat == FEAT_RUBBLE ||
8230 cave[y][x].feat == FEAT_DOOR_HEAD ||
8231 cave[y][x].feat == FEAT_DOOR_TAIL ||
8232 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8233 cave[y][x].feat <= FEAT_PERM_SOLID ))
8235 if( second_step )continue;
8238 if( cave[y][x].feat == FEAT_MIRROR && !second_step )
8240 /* The target of monsterspell becomes tha mirror(broken) */
8241 monster_target_y=(s16b)y;
8242 monster_target_x=(s16b)x;
8244 cave_set_feat( y, x , FEAT_FLOOR );
8245 for( j = 0; j <=i ; j++ )
8247 y = GRID_Y(path_g[j]);
8248 x = GRID_X(path_g[j]);
8249 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8253 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8254 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8255 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8256 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8257 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8258 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8259 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8260 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8263 for( i = 0; i < path_n ; i++ )
8266 y = GRID_Y(path_g[i]);
8267 x = GRID_X(path_g[i]);
8268 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8269 if(!who && (project_m_n==1) && !jump ){
8270 if(cave[project_m_y][project_m_x].m_idx >0 ){
8271 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8273 /* Hack -- auto-recall */
8274 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8276 /* Hack - auto-track */
8277 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8280 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8285 /* Project along the path */
8286 for (i = 0; i < path_n; ++i)
8291 int ny = GRID_Y(path_g[i]);
8292 int nx = GRID_X(path_g[i]);
8294 if (flg & PROJECT_DISI)
8296 /* Hack -- Balls explode before reaching walls */
8297 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8301 /* Hack -- Balls explode before reaching walls */
8302 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8309 /* Collect beam grids */
8310 if (flg & (PROJECT_BEAM))
8317 /* Only do visuals if requested */
8318 if (!blind && !(flg & (PROJECT_HIDE)))
8320 /* Only do visuals if the player can "see" the bolt */
8321 if (panel_contains(y, x) && player_has_los_bold(y, x))
8328 /* Obtain the bolt pict */
8329 p = bolt_pict(oy, ox, y, x, typ);
8331 /* Extract attr/char */
8335 /* Visual effects */
8336 print_rel(c, a, y, x);
8337 move_cursor_relative(y, x);
8338 /*if (fresh_before)*/ Term_fresh();
8339 Term_xtra(TERM_XTRA_DELAY, msec);
8341 /*if (fresh_before)*/ Term_fresh();
8343 /* Display "beam" grids */
8344 if (flg & (PROJECT_BEAM))
8346 /* Obtain the explosion pict */
8347 p = bolt_pict(y, x, y, x, typ);
8349 /* Extract attr/char */
8353 /* Visual effects */
8354 print_rel(c, a, y, x);
8357 /* Hack -- Activate delay */
8361 /* Hack -- delay anyway for consistency */
8364 /* Delay for consistency */
8365 Term_xtra(TERM_XTRA_DELAY, msec);
8368 if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
8370 if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
8375 /* Save the "blast epicenter" */
8379 if (breath && (y1 == y2) && (x1 == x2))
8385 flg &= ~(PROJECT_HIDE);
8389 /* Start the "explosion" */
8392 /* Hack -- make sure beams get to "explode" */
8400 /* If we found a "target", explode there */
8401 if (dist <= MAX_RANGE)
8403 /* Mega-Hack -- remove the final "beam" grid */
8404 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8407 * Create a conical breath attack
8418 flg &= ~(PROJECT_HIDE);
8420 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (bool)(typ == GF_DISINTEGRATE), TRUE);
8424 /* Determine the blast area, work from the inside out */
8425 for (dist = 0; dist <= rad; dist++)
8427 /* Scan the maximal blast area of radius "dist" */
8428 for (y = y2 - dist; y <= y2 + dist; y++)
8430 for (x = x2 - dist; x <= x2 + dist; x++)
8432 /* Ignore "illegal" locations */
8433 if (!in_bounds2(y, x)) continue;
8435 /* Enforce a "circular" explosion */
8436 if (distance(y2, x2, y, x) != dist) continue;
8438 if (typ == GF_DISINTEGRATE)
8440 /* Disintegration balls explosions are stopped by perma-walls */
8441 if (!in_disintegration_range(y2, x2, y, x)) continue;
8443 if (cave_valid_bold(y, x) &&
8444 (cave[y][x].feat < FEAT_PATTERN_START ||
8445 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
8446 (cave[y][x].feat < FEAT_DEEP_WATER ||
8447 cave[y][x].feat > FEAT_GRASS))
8449 if (cave[y][x].feat == FEAT_TREES)
8450 cave_set_feat(y, x, FEAT_GRASS);
8453 cave[y][x].feat = floor_type[randint0(100)];
8454 cave[y][x].info &= ~(CAVE_MASK);
8455 cave[y][x].info |= CAVE_FLOOR;
8459 /* Update some things -- similar to GF_KILL_WALL */
8460 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8464 /* Ball explosions are stopped by walls */
8465 if (!los(y2, x2, y, x)) continue;
8468 /* Save this grid */
8475 /* Encode some more "radius" info */
8481 /* Speed -- ignore "non-explosions" */
8482 if (!grids) return (FALSE);
8485 /* Display the "blast area" if requested */
8486 if (!blind && !(flg & (PROJECT_HIDE)))
8488 /* Then do the "blast", from inside out */
8489 for (t = 0; t <= gm_rad; t++)
8491 /* Dump everything with this radius */
8492 for (i = gm[t]; i < gm[t+1]; i++)
8494 /* Extract the location */
8498 /* Only do visuals if the player can "see" the blast */
8499 if (panel_contains(y, x) && player_has_los_bold(y, x))
8508 /* Obtain the explosion pict */
8509 p = bolt_pict(y, x, y, x, typ);
8511 /* Extract attr/char */
8515 /* Visual effects -- Display */
8516 print_rel(c, a, y, x);
8520 /* Hack -- center the cursor */
8521 move_cursor_relative(y2, x2);
8523 /* Flush each "radius" seperately */
8524 /*if (fresh_before)*/ Term_fresh();
8526 /* Delay (efficiently) */
8527 if (visual || drawn)
8529 Term_xtra(TERM_XTRA_DELAY, msec);
8533 /* Flush the erasing */
8536 /* Erase the explosion drawn above */
8537 for (i = 0; i < grids; i++)
8539 /* Extract the location */
8543 /* Hack -- Erase if needed */
8544 if (panel_contains(y, x) && player_has_los_bold(y, x))
8550 /* Hack -- center the cursor */
8551 move_cursor_relative(y2, x2);
8553 /* Flush the explosion */
8554 /*if (fresh_before)*/ Term_fresh();
8559 /* Update stuff if needed */
8560 if (p_ptr->update) update_stuff();
8563 /* Check features */
8564 if (flg & (PROJECT_GRID))
8566 /* Start with "dist" of zero */
8569 /* Scan for features */
8570 for (i = 0; i < grids; i++)
8572 /* Hack -- Notice new "dist" values */
8573 if (gm[dist+1] == i) dist++;
8575 /* Get the grid location */
8579 /* Find the closest point in the blast */
8582 int d = dist_to_line(y, x, y1, x1, y2, x2);
8584 /* Affect the grid */
8585 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8589 /* Affect the grid */
8590 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8597 if (flg & (PROJECT_ITEM))
8599 /* Start with "dist" of zero */
8602 /* Scan for objects */
8603 for (i = 0; i < grids; i++)
8605 /* Hack -- Notice new "dist" values */
8606 if (gm[dist+1] == i) dist++;
8608 /* Get the grid location */
8612 /* Find the closest point in the blast */
8615 int d = dist_to_line(y, x, y1, x1, y2, x2);
8617 /* Affect the object in the grid */
8618 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8622 /* Affect the object in the grid */
8623 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8629 /* Check monsters */
8630 if (flg & (PROJECT_KILL))
8637 /* Start with "dist" of zero */
8640 /* Scan for monsters */
8641 for (i = 0; i < grids; i++)
8643 /* Hack -- Notice new "dist" values */
8644 if (gm[dist + 1] == i) dist++;
8646 /* Get the grid location */
8652 /* Find the closest point in the blast */
8655 int d = dist_to_line(y, x, y1, x1, y2, x2);
8657 /* Affect the monster in the grid */
8658 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8660 if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
8662 else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
8666 /* Affect the monster in the grid */
8667 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8669 if (!(flg & PROJECT_BEAM))
8671 if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
8674 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8679 monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
8681 if ((ref_ptr->flags2 & RF2_REFLECTING) && (!one_in_(10) && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
8684 int max_attempts = 10;
8686 /* Choose 'new' target */
8689 t_y = y_saver - 1 + randint1(3);
8690 t_x = x_saver - 1 + randint1(3);
8694 while (max_attempts && in_bounds2u(t_y, t_x) &&
8695 !(los(y, x, t_y, t_x)));
8697 if (max_attempts < 1)
8703 if (m_list[cave[y][x].m_idx].ml)
8706 if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
8707 || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
8708 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
8709 if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
8710 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
8712 msg_print("The attack bounces!");
8715 ref_ptr->r_flags2 |= RF2_REFLECTING;
8717 flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
8718 if (one_in_(2)) flg |= PROJECT_MONSTER;
8719 else flg |= PROJECT_PLAYER;
8721 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
8725 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8728 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8733 /* Player affected one monster (without "jumping") */
8734 if (!who && (project_m_n == 1) && !jump)
8740 /* Track if possible */
8741 if (cave[y][x].m_idx > 0)
8743 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8745 /* Hack -- auto-recall */
8746 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8748 /* Hack - auto-track */
8749 if (m_ptr->ml) health_track(cave[y][x].m_idx);
8756 if (flg & (PROJECT_KILL))
8758 /* Start with "dist" of zero */
8761 /* Scan for player */
8762 for (i = 0; i < grids; i++)
8764 /* Hack -- Notice new "dist" values */
8765 if (gm[dist+1] == i) dist++;
8767 /* Get the grid location */
8771 /* Find the closest point in the blast */
8774 int d = dist_to_line(y, x, y1, x1, y2, x2);
8776 /* Affect the player */
8777 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8779 if (project_p(who, who_name, d+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8781 else if (project_p(who, who_name, d, y, x, dam, typ, rad, monspell)) notice = TRUE;
8785 /* Affect the player */
8786 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8788 if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
8790 if (project_p(who, who_name, dist+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8793 else if (project_p(who, who_name, dist, y, x, dam, typ, rad, monspell)) notice = TRUE;
8802 monster_desc(m_name, &m_list[p_ptr->riding], 0);
8804 if (rakubadam_m > 0)
8806 if (rakuba(rakubadam_m, FALSE))
8809 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
8811 msg_format("%^s has thrown you off!", m_name);
8815 if (p_ptr->riding && rakubadam_p > 0)
8817 if(rakuba(rakubadam_p, FALSE))
8820 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
8822 msg_format("You have fallen from %s.", m_name);
8828 /* Return "something was noticed" */
8832 bool binding_field( int dam )
8834 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
8835 int mirror_num=0; /* ¶À¤Î¿ô */
8840 int msec= delay_factor*delay_factor*delay_factor;
8846 /* Default target of monsterspell is player */
8847 monster_target_y=py;
8848 monster_target_x=px;
8850 for( x=0 ; x < cur_wid ; x++ )
8852 for( y=0 ; y < cur_hgt ; y++ )
8854 if( cave[y][x].feat == FEAT_MIRROR &&
8855 distance(py,px,y,x) <= MAX_RANGE &&
8856 distance(py,px,y,x) != 0 &&
8857 player_has_los_bold(y,x)
8859 mirror_y[mirror_num]=y;
8860 mirror_x[mirror_num]=x;
8866 if( mirror_num < 2 )return FALSE;
8868 point_x[0] = randint0( mirror_num );
8870 point_x[1] = randint0( mirror_num );
8872 while( point_x[0] == point_x[1] );
8874 point_y[0]=mirror_y[point_x[0]];
8875 point_x[0]=mirror_x[point_x[0]];
8876 point_y[1]=mirror_y[point_x[1]];
8877 point_x[1]=mirror_x[point_x[1]];
8881 x=point_x[0]+point_x[1]+point_x[2];
8882 y=point_y[0]+point_y[1]+point_y[2];
8884 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
8885 - (point_y[0]*3-y)*(point_x[1]*3-x);
8886 if( centersign == 0 )return FALSE;
8888 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
8889 x1 = x1 < point_x[2] ? x1 : point_x[2];
8890 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
8891 y1 = y1 < point_y[2] ? y1 : point_y[2];
8893 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
8894 x2 = x2 > point_x[2] ? x2 : point_x[2];
8895 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
8896 y2 = y2 > point_y[2] ? y2 : point_y[2];
8898 for( y=y1 ; y <=y2 ; y++ ){
8899 for( x=x1 ; x <=x2 ; x++ ){
8900 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8901 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8902 centersign*( (point_x[1]-x)*(point_y[2]-y)
8903 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8904 centersign*( (point_x[2]-x)*(point_y[0]-y)
8905 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8907 if( player_has_los_bold(y,x)){
8908 /* Visual effects */
8910 && panel_contains(y,x)){
8911 p = bolt_pict(y,x,y,x, GF_MANA );
8912 print_rel(PICT_C(p), PICT_A(p),y,x);
8913 move_cursor_relative(y, x);
8914 /*if (fresh_before)*/ Term_fresh();
8915 Term_xtra(TERM_XTRA_DELAY, msec);
8921 for( y=y1 ; y <=y2 ; y++ ){
8922 for( x=x1 ; x <=x2 ; x++ ){
8923 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8924 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8925 centersign*( (point_x[1]-x)*(point_y[2]-y)
8926 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8927 centersign*( (point_x[2]-x)*(point_y[0]-y)
8928 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8930 if( player_has_los_bold(y,x)){
8931 (void)project_f(0,0,y,x,dam,GF_MANA);
8936 for( y=y1 ; y <=y2 ; y++ ){
8937 for( x=x1 ; x <=x2 ; x++ ){
8938 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8939 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8940 centersign*( (point_x[1]-x)*(point_y[2]-y)
8941 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8942 centersign*( (point_x[2]-x)*(point_y[0]-y)
8943 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8945 if( player_has_los_bold(y,x)){
8946 (void)project_o(0,0,y,x,dam,GF_MANA);
8951 for( y=y1 ; y <=y2 ; y++ ){
8952 for( x=x1 ; x <=x2 ; x++ ){
8953 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8954 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8955 centersign*( (point_x[1]-x)*(point_y[2]-y)
8956 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8957 centersign*( (point_x[2]-x)*(point_y[0]-y)
8958 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8960 if( player_has_los_bold(y,x) ){
8961 (void)project_m(0,0,y,x,dam,GF_MANA,
8962 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF));
8969 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
8971 msg_print("The field broke a mirror");
8973 cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
8979 void seal_of_mirror( int dam )
8983 for( x = 0 ; x < cur_wid ; x++ )
8985 for( y = 0 ; y < cur_hgt ; y++ )
8987 if( cave[y][x].feat == FEAT_MIRROR )
8989 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8990 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
8992 if( !cave[y][x].m_idx )
8994 cave_set_feat( y,x, FEAT_FLOOR );