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 else 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 else 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);
3278 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3281 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3283 note = " is hit hard.";
3287 if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3296 if (seen) obvious = TRUE;
3298 if (r_ptr->flags3 & (RF3_RES_ALL))
3301 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3303 note = " is immune.";
3306 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3309 if (!monster_living(r_ptr))
3311 if (r_ptr->flags3 & RF3_UNDEAD)
3313 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3316 if (r_ptr->flags3 & (RF3_DEMON))
3318 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
3322 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3324 note = " is unaffected!";
3330 else do_time = (dam+7)/8;
3338 if (seen) obvious = TRUE;
3340 if (r_ptr->flags3 & (RF3_RES_ALL))
3343 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3345 note = " is immune.";
3348 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3351 if ((r_ptr->flags3 & RF3_UNDEAD) ||
3352 (r_ptr->flags3 & RF3_NONLIVING))
3354 if (r_ptr->flags3 & RF3_UNDEAD)
3356 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3360 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3362 note = " is immune.";
3368 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3369 (randint1(888) != 666)) ||
3370 (((r_ptr->level + randint1(20)) > randint1(p_ptr->lev + randint1(10))) &&
3371 randint1(100) != 66))
3374 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3386 /* Polymorph monster (Use "dam" as "power") */
3389 if (seen) obvious = TRUE;
3391 if (r_ptr->flags3 & (RF3_RES_ALL))
3394 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3396 note = " is immune.";
3399 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3402 /* Attempt to polymorph (see below) */
3405 /* Powerful monsters can resist */
3406 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3407 (r_ptr->flags1 & RF1_QUESTOR) ||
3408 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3411 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3413 note = " is unaffected!";
3420 /* No "real" damage */
3427 /* Clone monsters (Ignore "dam") */
3430 bool friendly = FALSE;
3433 if (seen) obvious = TRUE;
3435 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
3438 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3440 note = " is unaffected!";
3446 m_ptr->hp = m_ptr->maxhp;
3448 /* Attempt to clone. */
3449 if (multiply_monster(c_ptr->m_idx, TRUE, friendly, pet))
3452 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3460 /* No "real" damage */
3467 /* Heal Monster (use "dam" as amount of healing) */
3470 if (seen) obvious = TRUE;
3475 if (m_ptr->maxhp < m_ptr->max_maxhp)
3478 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3480 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3482 m_ptr->maxhp = m_ptr->max_maxhp;
3488 if (seen) obvious = TRUE;
3496 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3498 msg_format("%^s is no longer stunned.", m_name);
3502 if (m_ptr->confused)
3505 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3507 msg_format("%^s is no longer confused.", m_name);
3509 m_ptr->confused = 0;
3514 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3516 msg_format("%^s recovers %s courage.", m_name, m_poss);
3522 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3525 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3527 chg_virtue(V_VITALITY, 1);
3529 if (r_ptr->flags1 & RF1_UNIQUE)
3530 chg_virtue(V_INDIVIDUALISM, 1);
3532 if (is_friendly(m_ptr))
3533 chg_virtue(V_HONOUR, 1);
3534 else if (!(r_ptr->flags3 & RF3_EVIL))
3536 if (r_ptr->flags3 & RF3_GOOD)
3537 chg_virtue(V_COMPASSION, 2);
3539 chg_virtue(V_COMPASSION, 1);
3542 if (m_ptr->r_idx == MON_LEPER)
3545 chg_virtue(V_COMPASSION, 5);
3548 if (r_ptr->flags3 & RF3_ANIMAL)
3549 chg_virtue(V_NATURE, 1);
3551 /* Redraw (later) if needed */
3552 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3553 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3557 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3559 note = " looks healthier.";
3563 /* No "real" damage */
3569 /* Speed Monster (Ignore "dam") */
3572 if (seen) obvious = TRUE;
3578 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3580 note = " starts moving faster.";
3583 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3585 if (c_ptr->m_idx == p_ptr->riding)
3586 p_ptr->update |= (PU_BONUS);
3588 if (r_ptr->flags1 & RF1_UNIQUE)
3589 chg_virtue(V_INDIVIDUALISM, 1);
3590 if (is_friendly(m_ptr))
3591 chg_virtue(V_HONOUR, 1);
3593 /* No "real" damage */
3599 /* Slow Monster (Use "dam" as "power") */
3602 if (seen) obvious = TRUE;
3604 if (r_ptr->flags3 & (RF3_RES_ALL))
3607 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3609 note = " is immune.";
3612 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3615 /* Powerful monsters can resist */
3616 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3617 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3620 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3622 note = " is unaffected!";
3628 /* Normal monsters slow down */
3634 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3636 note = " starts moving slower.";
3639 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3641 if (c_ptr->m_idx == p_ptr->riding)
3642 p_ptr->update |= (PU_BONUS);
3645 /* No "real" damage */
3651 /* Sleep (Use "dam" as "power") */
3654 if (seen) obvious = TRUE;
3656 if (r_ptr->flags3 & (RF3_RES_ALL))
3659 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3661 note = " is immune.";
3664 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3667 /* Attempt a saving throw */
3668 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3669 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3670 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3672 /* Memorize a flag */
3673 if (r_ptr->flags3 & RF3_NO_SLEEP)
3675 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3678 /* No obvious effect */
3680 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3682 note = " is unaffected!";
3689 /* Go to sleep (much) later */
3691 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3693 note = " falls asleep!";
3699 /* No "real" damage */
3705 /* Sleep (Use "dam" as "power") */
3708 if (seen) obvious = TRUE;
3710 if (r_ptr->flags3 & (RF3_RES_ALL))
3713 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3715 note = " is immune.";
3718 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3721 /* Attempt a saving throw */
3722 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3723 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3726 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3728 note = " is unaffected!";
3735 /* Go to sleep (much) later */
3737 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3739 note = " is suspended!";
3745 /* No "real" damage */
3754 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3755 vir = virtue_number(V_HARMONY);
3758 dam += p_ptr->virtues[vir-1]/10;
3761 vir = virtue_number(V_INDIVIDUALISM);
3764 dam -= p_ptr->virtues[vir-1]/20;
3767 if (seen) obvious = TRUE;
3769 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3772 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3774 note = " is immune.";
3777 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3781 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3784 /* Attempt a saving throw */
3785 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3786 (r_ptr->flags3 & RF3_NO_CONF) ||
3787 (m_ptr->mflag2 & MFLAG_NOPET) ||
3788 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3790 /* Memorize a flag */
3791 if (r_ptr->flags3 & RF3_NO_CONF)
3793 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3797 /* No obvious effect */
3799 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3801 note = " is unaffected!";
3806 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3808 else if (p_ptr->cursed & TRC_AGGRAVATE)
3811 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3813 note = " hates you too much!";
3816 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3821 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3823 note = " suddenly seems friendly!";
3828 chg_virtue(V_INDIVIDUALISM, -1);
3829 if (r_ptr->flags3 & RF3_ANIMAL)
3830 chg_virtue(V_NATURE, 1);
3833 /* No "real" damage */
3838 /* Control undead */
3839 case GF_CONTROL_UNDEAD:
3842 if (seen) obvious = TRUE;
3844 vir = virtue_number(V_UNLIFE);
3847 dam += p_ptr->virtues[vir-1]/10;
3850 vir = virtue_number(V_INDIVIDUALISM);
3853 dam -= p_ptr->virtues[vir-1]/20;
3856 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3859 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3861 note = " is immune.";
3864 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3868 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3871 /* Attempt a saving throw */
3872 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3873 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3874 (m_ptr->mflag2 & MFLAG_NOPET) ||
3875 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3877 /* No obvious effect */
3879 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3881 note = " is unaffected!";
3885 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3887 else if (p_ptr->cursed & TRC_AGGRAVATE)
3890 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3892 note = " hates you too much!";
3895 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3900 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3902 note = " is in your thrall!";
3908 /* No "real" damage */
3914 case GF_CONTROL_DEMON:
3917 if (seen) obvious = TRUE;
3919 vir = virtue_number(V_UNLIFE);
3922 dam += p_ptr->virtues[vir-1]/10;
3925 vir = virtue_number(V_INDIVIDUALISM);
3928 dam -= p_ptr->virtues[vir-1]/20;
3931 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3934 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3936 note = " is immune.";
3939 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3943 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3946 /* Attempt a saving throw */
3947 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3948 (!(r_ptr->flags3 & RF3_DEMON)) ||
3949 (m_ptr->mflag2 & MFLAG_NOPET) ||
3950 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3952 /* No obvious effect */
3954 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3956 note = " is unaffected!";
3960 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3962 else if (p_ptr->cursed & TRC_AGGRAVATE)
3965 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3967 note = " hates you too much!";
3970 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3975 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3977 note = " is in your thrall!";
3983 /* No "real" damage */
3989 case GF_CONTROL_ANIMAL:
3993 if (seen) obvious = TRUE;
3995 vir = virtue_number(V_NATURE);
3998 dam += p_ptr->virtues[vir-1]/10;
4001 vir = virtue_number(V_INDIVIDUALISM);
4004 dam -= p_ptr->virtues[vir-1]/20;
4007 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4010 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4012 note = " is immune.";
4015 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4019 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4022 /* Attempt a saving throw */
4023 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4024 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4025 (m_ptr->mflag2 & MFLAG_NOPET) ||
4026 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4027 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4029 /* Memorize a flag */
4030 if (r_ptr->flags3 & (RF3_NO_CONF))
4032 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4036 /* No obvious effect */
4038 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4040 note = " is unaffected!";
4044 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4046 else if (p_ptr->cursed & TRC_AGGRAVATE)
4049 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4051 note = " hates you too much!";
4054 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4059 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4061 note = " is tamed!";
4066 if (r_ptr->flags3 & RF3_ANIMAL)
4067 chg_virtue(V_NATURE, 1);
4070 /* No "real" damage */
4076 case GF_CONTROL_LIVING:
4080 vir = virtue_number(V_UNLIFE);
4081 if (seen) obvious = TRUE;
4083 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4084 vir = virtue_number(V_UNLIFE);
4087 dam -= p_ptr->virtues[vir-1]/10;
4090 vir = virtue_number(V_INDIVIDUALISM);
4093 dam -= p_ptr->virtues[vir-1]/20;
4096 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4097 if (dam < 1) dam = 1;
4099 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4101 msg_format("You stare into %s.", m_name);
4103 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4106 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4108 note = " is immune.";
4111 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4115 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4118 /* Attempt a saving throw */
4119 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4120 (m_ptr->mflag2 & MFLAG_NOPET) ||
4121 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
4122 ((r_ptr->level+10) > randint1(dam)))
4125 /* No obvious effect */
4127 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4129 note = " is unaffected!";
4133 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4135 else if (p_ptr->cursed & TRC_AGGRAVATE)
4138 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4140 note = " hates you too much!";
4143 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4148 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4150 note = " is tamed!";
4155 if (r_ptr->flags3 & RF3_ANIMAL)
4156 chg_virtue(V_NATURE, 1);
4159 /* No "real" damage */
4164 /* Confusion (Use "dam" as "power") */
4167 if (seen) obvious = TRUE;
4169 if (r_ptr->flags3 & (RF3_RES_ALL))
4172 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4174 note = " is immune.";
4177 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4180 /* Get confused later */
4181 do_conf = damroll(3, (dam / 2)) + 1;
4183 /* Attempt a saving throw */
4184 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4185 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4186 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4188 /* Memorize a flag */
4189 if (r_ptr->flags3 & (RF3_NO_CONF))
4191 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4197 /* No obvious effect */
4199 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4201 note = " is unaffected!";
4207 /* No "real" damage */
4214 if (seen) obvious = TRUE;
4216 if (r_ptr->flags3 & (RF3_RES_ALL))
4219 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4221 note = " is immune.";
4224 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4227 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4229 /* Attempt a saving throw */
4230 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4231 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4236 /* No obvious effect */
4238 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4240 note = " is unaffected!";
4246 /* No "real" damage */
4254 /* Lite, but only hurts susceptible creatures */
4262 if (r_ptr->flags3 & (RF3_RES_ALL))
4268 if (r_ptr->flags3 & (RF3_HURT_LITE))
4270 /* Obvious effect */
4271 if (seen) obvious = TRUE;
4273 /* Memorize the effects */
4274 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4276 /* Special effect */
4278 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4279 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4281 note = " cringes from the light!";
4282 note_dies = " shrivels away in the light!";
4287 /* Normally no damage */
4299 /* Lite -- opposite of Dark */
4302 if (seen) obvious = TRUE;
4303 if (r_ptr->flags3 & (RF3_RES_ALL))
4306 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4308 note = " is immune.";
4311 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4314 if (r_ptr->flags4 & (RF4_BR_LITE))
4317 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4322 dam *= 2; dam /= (randint1(6)+6);
4324 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4326 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4328 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4329 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4331 note = " cringes from the light!";
4332 note_dies = " shrivels away in the light!";
4341 /* Dark -- opposite of Lite */
4344 if (seen) obvious = TRUE;
4346 if (r_ptr->flags3 & (RF3_RES_ALL))
4349 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4351 note = " is immune.";
4354 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4357 /* Likes darkness... */
4358 if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
4359 (r_ptr->flags3 & RF3_ORC) ||
4360 (r_ptr->flags3 & RF3_HURT_LITE))
4363 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4368 dam *= 2; dam /= (randint1(6)+6);
4377 if (r_ptr->flags3 & (RF3_RES_ALL))
4382 /* Hurt by rock remover */
4383 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4386 if (seen) obvious = TRUE;
4388 /* Memorize the effects */
4389 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4391 /* Cute little message */
4393 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4394 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4396 note = " loses some skin!";
4397 note_dies = " dissolves!";
4402 /* Usually, ignore the effects */
4413 /* Teleport undead (Use "dam" as "power") */
4414 case GF_AWAY_UNDEAD:
4416 /* Only affect undead */
4417 if (r_ptr->flags3 & (RF3_UNDEAD))
4419 bool resists_tele = FALSE;
4421 if (r_ptr->flags3 & (RF3_RES_TELE))
4423 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4425 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4427 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4429 note = " is unaffected!";
4432 resists_tele = TRUE;
4434 else if (r_ptr->level > randint1(100))
4436 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4438 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4443 resists_tele = TRUE;
4449 if (seen) obvious = TRUE;
4450 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4462 /* No "real" damage */
4468 /* Teleport evil (Use "dam" as "power") */
4471 /* Only affect evil */
4472 if (r_ptr->flags3 & (RF3_EVIL))
4474 bool resists_tele = FALSE;
4476 if (r_ptr->flags3 & (RF3_RES_TELE))
4478 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4480 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4482 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4484 note = " is unaffected!";
4487 resists_tele = TRUE;
4489 else if (r_ptr->level > randint1(100))
4491 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4493 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4498 resists_tele = TRUE;
4504 if (seen) obvious = TRUE;
4505 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4517 /* No "real" damage */
4523 /* Teleport monster (Use "dam" as "power") */
4526 bool resists_tele = FALSE;
4527 if (r_ptr->flags3 & (RF3_RES_TELE))
4529 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4531 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4533 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4535 note = " is unaffected!";
4538 resists_tele = TRUE;
4540 else if (r_ptr->level > randint1(100))
4542 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4544 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4549 resists_tele = TRUE;
4556 if (seen) obvious = TRUE;
4558 /* Prepare to teleport */
4562 /* No "real" damage */
4568 /* Turn undead (Use "dam" as "power") */
4569 case GF_TURN_UNDEAD:
4571 if (r_ptr->flags3 & (RF3_RES_ALL))
4576 /* Only affect undead */
4577 if (r_ptr->flags3 & (RF3_UNDEAD))
4579 /* Learn about type */
4580 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4583 if (seen) obvious = TRUE;
4585 /* Apply some fear */
4586 do_fear = damroll(3, (dam / 2)) + 1;
4588 /* Attempt a saving throw */
4589 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4591 /* No obvious effect */
4593 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4595 note = " is unaffected!";
4610 /* No "real" damage */
4616 /* Turn evil (Use "dam" as "power") */
4619 if (r_ptr->flags3 & (RF3_RES_ALL))
4624 /* Only affect evil */
4625 if (r_ptr->flags3 & (RF3_EVIL))
4627 /* Learn about type */
4628 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4631 if (seen) obvious = TRUE;
4633 /* Apply some fear */
4634 do_fear = damroll(3, (dam / 2)) + 1;
4636 /* Attempt a saving throw */
4637 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4639 /* No obvious effect */
4641 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4643 note = " is unaffected!";
4658 /* No "real" damage */
4664 /* Turn monster (Use "dam" as "power") */
4667 if (r_ptr->flags3 & (RF3_RES_ALL))
4673 if (seen) obvious = TRUE;
4675 /* Apply some fear */
4676 do_fear = damroll(3, (dam / 2)) + 1;
4678 /* Attempt a saving throw */
4679 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4680 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4681 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4683 /* No obvious effect */
4685 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4687 note = " is unaffected!";
4694 /* No "real" damage */
4701 case GF_DISP_UNDEAD:
4703 if (r_ptr->flags3 & (RF3_RES_ALL))
4709 /* Only affect undead */
4710 if (r_ptr->flags3 & (RF3_UNDEAD))
4712 /* Learn about type */
4713 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4716 if (seen) obvious = TRUE;
4720 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4721 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4723 note = " shudders.";
4724 note_dies = " dissolves!";
4746 if (r_ptr->flags3 & (RF3_RES_ALL))
4752 /* Only affect evil */
4753 if (r_ptr->flags3 & (RF3_EVIL))
4755 /* Learn about type */
4756 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4759 if (seen) obvious = TRUE;
4763 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4764 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4766 note = " shudders.";
4767 note_dies = " dissolves!";
4788 if (r_ptr->flags3 & (RF3_RES_ALL))
4794 /* Only affect good */
4795 if (r_ptr->flags3 & (RF3_GOOD))
4797 /* Learn about type */
4798 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
4801 if (seen) obvious = TRUE;
4805 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4806 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4808 note = " shudders.";
4809 note_dies = " dissolves!";
4828 case GF_DISP_LIVING:
4830 if (r_ptr->flags3 & (RF3_RES_ALL))
4836 /* Only affect non-undead */
4837 if (monster_living(r_ptr))
4840 if (seen) obvious = TRUE;
4844 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4845 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4847 note = " shudders.";
4848 note_dies = " dissolves!";
4869 if (r_ptr->flags3 & (RF3_RES_ALL))
4875 /* Only affect demons */
4876 if (r_ptr->flags3 & (RF3_DEMON))
4878 /* Learn about type */
4879 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
4882 if (seen) obvious = TRUE;
4886 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4887 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4889 note = " shudders.";
4890 note_dies = " dissolves!";
4908 /* Dispel monster */
4911 if (r_ptr->flags3 & (RF3_RES_ALL))
4918 if (seen) obvious = TRUE;
4922 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4923 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4925 note = " shudders.";
4926 note_dies = " dissolves!";
4936 if (seen) obvious = TRUE;
4937 if (r_ptr->flags3 & (RF3_RES_ALL))
4940 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4942 note = " is immune.";
4945 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4949 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4953 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
4955 msg_format("You draws psychic energy from %s.", m_name);
4958 (void)hp_player(dam);
4963 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
4965 msg_format("%s is unaffected.", m_name);
4975 if (seen) obvious = TRUE;
4978 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4980 msg_format("You gazes intently at %s.", m_name);
4983 if (r_ptr->flags3 & (RF3_RES_ALL))
4986 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4988 note = " is immune.";
4991 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4995 /* Attempt a saving throw */
4996 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4997 (r_ptr->flags3 & RF3_NO_CONF) ||
4998 (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
5000 /* Memorize a flag */
5001 if (r_ptr->flags3 & (RF3_NO_CONF))
5003 r_ptr->r_flags3 |= (RF3_NO_CONF);
5006 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5008 note = "is unaffected!";
5015 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5016 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5018 msg_format("%^s is blasted by psionic energy.", m_name);
5019 note_dies = " collapses, a mindless husk.";
5022 do_conf = randint0(8) + 8;
5028 case GF_BRAIN_SMASH:
5030 if (seen) obvious = TRUE;
5033 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
5035 msg_format("You gazes intently at %s.", m_name);
5038 if (r_ptr->flags3 & (RF3_RES_ALL))
5041 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5043 note = " is immune.";
5046 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5050 /* Attempt a saving throw */
5051 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5052 (r_ptr->flags3 & RF3_NO_CONF) ||
5053 (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
5055 /* Memorize a flag */
5056 if (r_ptr->flags3 & (RF3_NO_CONF))
5058 r_ptr->r_flags3 |= (RF3_NO_CONF);
5061 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5063 note = "is unaffected!";
5070 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5071 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5073 msg_format("%^s is blasted by psionic energy.", m_name);
5074 note_dies = " collapses, a mindless husk.";
5077 do_conf = randint0(8) + 8;
5078 do_stun = randint0(8) + 8;
5079 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5080 if (c_ptr->m_idx == p_ptr->riding)
5081 p_ptr->update |= (PU_BONUS);
5089 if (seen) obvious = TRUE;
5092 msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5094 msg_format("You points at %s and curses.", m_name);
5097 if (r_ptr->flags3 & (RF3_RES_ALL))
5100 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5102 note = " is immune.";
5105 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5109 /* Attempt a saving throw */
5110 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5114 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5116 note = "is unaffected!";
5126 if (seen) obvious = TRUE;
5129 msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5131 msg_format("You points at %s and curses horribly.", m_name);
5134 if (r_ptr->flags3 & (RF3_RES_ALL))
5137 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5139 note = " is immune.";
5142 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5146 /* Attempt a saving throw */
5147 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5151 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5153 note = "is unaffected!";
5163 if (seen) obvious = TRUE;
5166 msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
5168 msg_format("You points at %s, incanting terribly!", m_name);
5171 if (r_ptr->flags3 & (RF3_RES_ALL))
5174 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5176 note = " is immune.";
5179 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5183 /* Attempt a saving throw */
5184 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5188 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5190 note = "is unaffected!";
5200 if (seen) obvious = TRUE;
5203 msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
5205 msg_format("You points at %s, screaming th word, 'DIE!'.", m_name);
5208 if (r_ptr->flags3 & (RF3_RES_ALL))
5211 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5213 note = " is immune.";
5216 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5220 /* Attempt a saving throw */
5221 if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
5225 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5227 note = "is unaffected!";
5237 if (seen) obvious = TRUE;
5239 if (r_ptr->flags3 & (RF3_RES_ALL))
5242 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5244 note = " is immune.";
5247 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5251 if (r_ptr->flags1 & RF1_UNIQUE)
5254 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5256 note = "is unaffected!";
5262 if ((p_ptr->lev + randint1(dam)) >
5263 (r_ptr->level + randint1(200)))
5265 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5267 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5272 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5282 /* Capture monster */
5286 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5287 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5290 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5292 msg_format("%^s is unaffected.", m_name);
5298 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5299 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
5300 nokori_hp = m_ptr->maxhp * 3 / 10;
5302 nokori_hp = m_ptr->maxhp * 3 / 20;
5304 if (m_ptr->hp >= nokori_hp)
5307 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5309 msg_format("You need to weaken %s more.", m_name);
5313 else if (m_ptr->hp < randint0(nokori_hp))
5315 if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5317 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5319 msg_format("You captures %^s!", m_name);
5321 cap_mon = m_list[c_ptr->m_idx].r_idx;
5322 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5323 cap_hp = m_list[c_ptr->m_idx].hp;
5324 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5325 if (m_list[c_ptr->m_idx].nickname)
5326 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5329 if (c_ptr->m_idx == p_ptr->riding)
5331 if (rakuba(-1, FALSE))
5334 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5336 msg_format("You have fallen from %s.", m_name);
5341 delete_monster_idx(c_ptr->m_idx);
5348 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5350 msg_format("You failed to capture %s.", m_name);
5359 if (seen) obvious = TRUE;
5361 if (dam == HISSATSU_NYUSIN)
5365 bool success = FALSE;
5366 for (i = 0; i < 8; i++)
5368 if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
5371 if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
5380 if ((ny != py) || (nx != px))
5382 teleport_player_to(ny, nx, FALSE);
5384 msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
5386 msg_format("You quickly jump in and attack %s!", m_name);
5393 msg_print("¼ºÇÔ¡ª");
5395 msg_print("Failed!");
5402 return (py_attack(y, x, dam));
5405 msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
5407 msg_print("You attack the empty air.");
5413 /* Sleep (Use "dam" as "power") */
5419 if (seen) obvious = TRUE;
5421 if (r_ptr->flags3 & (RF3_RES_ALL))
5424 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5426 note = " is immune.";
5429 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5432 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5435 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5437 note = " is immune!";
5441 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5447 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5449 note = " is immune!";
5456 if (one_in_(5)) effect = 1;
5457 else if (one_in_(4)) effect = 2;
5458 else if (one_in_(3)) effect = 3;
5463 /* Powerful monsters can resist */
5464 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5465 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5468 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5470 note = " is unaffected!";
5476 /* Normal monsters slow down */
5482 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5484 note = " starts moving slower.";
5487 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5489 if (c_ptr->m_idx == p_ptr->riding)
5490 p_ptr->update |= (PU_BONUS);
5494 else if (effect == 2)
5496 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5498 /* Attempt a saving throw */
5499 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5500 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5505 /* No obvious effect */
5507 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5509 note = " is unaffected!";
5516 else if (effect == 3)
5518 /* Attempt a saving throw */
5519 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5520 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5521 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5523 /* Memorize a flag */
5524 if (r_ptr->flags3 & RF3_NO_SLEEP)
5526 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5529 /* No obvious effect */
5531 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5533 note = " is unaffected!";
5540 /* Go to sleep (much) later */
5542 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5544 note = " falls asleep!";
5554 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5556 note = " is immune!";
5560 /* No "real" damage */
5569 if (seen) obvious = TRUE;
5571 if (r_ptr->flags3 & (RF3_RES_ALL))
5574 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5576 note = " is immune.";
5579 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5583 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)
5590 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
5597 delete_monster_idx(c_ptr->m_idx);
5599 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5601 msg_format("%^s disappered!",m_name);
5605 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5607 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5611 chg_virtue(V_VITALITY, -1);
5616 p_ptr->redraw |= (PR_HP);
5619 p_ptr->window |= (PW_PLAYER);
5626 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5628 note = "is unaffected!";
5631 if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
5639 msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
5641 msg_format("You take a photograph of %s.",m_name);
5644 if (r_ptr->flags3 & (RF3_HURT_LITE))
5646 /* Obvious effect */
5647 if (seen) obvious = TRUE;
5649 /* Memorize the effects */
5650 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5652 /* Special effect */
5654 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5655 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5657 note = " cringes from the light!";
5658 note_dies = " shrivels away in the light!";
5663 /* Normally no damage */
5670 photo = m_ptr->r_idx;
5677 case GF_BLOOD_CURSE:
5679 if (seen) obvious = TRUE;
5680 if (r_ptr->flags3 & (RF3_RES_ALL))
5683 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5685 note = " is immune.";
5688 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5708 /* Absolutely no effect */
5709 if (skipped) return (FALSE);
5711 /* "Unique" monsters cannot be polymorphed */
5712 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5714 /* Quest monsters cannot be polymorphed */
5715 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5717 if (p_ptr->riding & (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5719 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5720 if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
5722 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5727 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5728 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5731 /* Modify the damage */
5733 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5735 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
5737 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5740 /* Check for death */
5741 if (dam > m_ptr->hp)
5743 /* Extract method of death */
5747 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5748 else if (do_poly && (randint1(90) > r_ptr->level))
5750 if (polymorph_monster(y, x))
5753 if (seen) obvious = TRUE;
5755 /* Monster polymorphs */
5757 note = "¤¬ÊѿȤ·¤¿¡ª";
5763 /* Turn off the damage */
5766 /* Hack -- Get new monster */
5767 m_ptr = &m_list[c_ptr->m_idx];
5769 /* Hack -- Get new race */
5770 r_ptr = &r_info[m_ptr->r_idx];
5776 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5778 note = " is unaffected!";
5784 /* Handle "teleport" */
5788 if (seen) obvious = TRUE;
5792 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5794 note = " disappears!";
5797 chg_virtue(V_VALOUR, -1);
5800 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
5802 /* Hack -- get new location */
5806 /* Hack -- get new grid */
5807 c_ptr = &cave[y][x];
5810 /* Sound and Impact breathers never stun */
5812 !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
5813 !(r_ptr->flags4 & (RF4_BR_WALL)) &&
5814 !(r_ptr->flags3 & (RF3_NO_STUN)))
5817 if (seen) obvious = TRUE;
5823 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5825 note = " is more dazed.";
5828 tmp = m_ptr->stunned + (do_stun / 2);
5833 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5835 note = " is dazed.";
5842 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5848 /* Confusion and Chaos breathers (and sleepers) never confuse */
5850 !(r_ptr->flags3 & (RF3_NO_CONF)) &&
5851 !(r_ptr->flags4 & (RF4_BR_CONF)) &&
5852 !(r_ptr->flags4 & (RF4_BR_CHAO)))
5855 if (seen) obvious = TRUE;
5857 /* Already partially confused */
5858 if (m_ptr->confused)
5861 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5863 note = " looks more confused.";
5866 tmp = m_ptr->confused + (do_conf / 2);
5869 /* Was not confused */
5873 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5875 note = " looks confused.";
5881 /* Apply confusion */
5882 m_ptr->confused = (tmp < 200) ? tmp : 200;
5890 if (seen) obvious = TRUE;
5892 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
5897 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5899 note = " seems weakened.";
5901 m_ptr->maxhp -= do_time;
5902 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
5912 tmp = m_ptr->monfear + do_fear;
5915 m_ptr->monfear = (tmp < 200) ? tmp : 200;
5922 /* If another monster did the damage, hurt the monster by hand */
5925 /* Redraw (later) if needed */
5926 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5927 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5929 /* Wake the monster up */
5932 /* Hurt the monster */
5940 if (is_pet(m_ptr) && !(m_ptr->ml))
5943 /* Give detailed messages if destroyed */
5946 monster_desc(m_name, m_ptr, 0x100);
5949 msg_format("%^s%s", m_name, note);
5957 monster_gain_exp(who, m_ptr->r_idx);
5959 /* Generate treasure, etc */
5960 monster_death(c_ptr->m_idx, FALSE);
5962 /* Delete the monster */
5963 delete_monster_idx(c_ptr->m_idx);
5968 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
5970 msg_print("You feel sad for a moment.");
5976 /* Damaged monster */
5979 /* Give detailed messages if visible or destroyed */
5980 if (note && seen) msg_format("%^s%s", m_name, note);
5982 /* Hack -- Pain message */
5985 message_pain(c_ptr->m_idx, dam);
5992 /* Hack -- handle sleep */
5993 if (do_sleep) m_ptr->csleep = do_sleep;
5997 else if (heal_leper)
6000 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6002 msg_print("The Mangy looking leper is healed!");
6005 delete_monster_idx(c_ptr->m_idx);
6007 /* If the player did it, give him experience, check fear */
6008 else if (typ != GF_DRAIN_MANA)
6012 /* Hurt the monster, check for fear and death */
6013 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6018 /* Damaged monster */
6021 /* HACK - anger the monster before showing the sleep message */
6022 if (do_sleep) anger_monster(m_ptr);
6024 /* Give detailed messages if visible or destroyed */
6027 msg_format("%s%s", m_name, note);
6029 msg_format("%^s%s", m_name, note);
6033 /* Hack -- Pain message */
6036 message_pain(c_ptr->m_idx, dam);
6039 /* Anger monsters */
6040 if (((dam > 0) || get_angry) && !do_sleep)
6041 anger_monster(m_ptr);
6044 if ((fear || do_fear) && (m_ptr->ml))
6051 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6053 msg_format("%^s flees in terror!", m_name);
6058 /* Hack -- handle sleep */
6059 if (do_sleep) m_ptr->csleep = do_sleep;
6063 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6065 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6069 switch (randint1(28))
6075 msg_print("ÃÏÌ̤¬Íɤ줿...");
6077 msg_print("The ground trembles...");
6080 earthquake(ty, tx, 4 + randint0(4));
6081 if (!one_in_(6)) break;
6083 case 3: case 4: case 5: case 6:
6086 int dam = damroll(10, 10);
6088 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6090 msg_print("A portal opens to a plane of raw mana!");
6093 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6094 if (!one_in_(6)) break;
6100 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6102 msg_print("Space warps about you!");
6105 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6106 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6107 if (!one_in_(6)) break;
6109 case 9: case 10: case 11:
6111 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6113 msg_print("You feel a surge of energy!");
6116 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6117 if (!one_in_(6)) break;
6118 case 12: case 13: case 14: case 15: case 16:
6119 aggravate_monsters(0);
6120 if (!one_in_(6)) break;
6122 count += activate_hi_summon(ty, tx, TRUE);
6123 if (!one_in_(6)) break;
6124 case 19: case 20: case 21: case 22:
6126 bool pet = FALSE, friendly = FALSE;
6136 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));
6137 if (!one_in_(6)) break;
6139 case 23: case 24: case 25:
6140 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6142 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6144 msg_print("You feel your life draining away...");
6147 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6148 else lose_exp(p_ptr->exp / 16);
6149 if (!one_in_(6)) break;
6150 case 26: case 27: case 28:
6159 (void)do_dec_stat(i);
6168 (void)do_dec_stat(randint0(6));
6177 if (p_ptr->inside_battle)
6179 p_ptr->health_who = c_ptr->m_idx;
6180 p_ptr->redraw |= (PR_HEALTH);
6184 /* XXX XXX XXX Verify this code */
6186 /* Update the monster */
6187 update_mon(c_ptr->m_idx, FALSE);
6189 /* Redraw the monster grid */
6193 /* Update monster recall window */
6194 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6197 p_ptr->window |= (PW_MONSTER);
6200 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6204 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6206 set_target(m_ptr, monster_target_y, monster_target_x);
6209 else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
6211 set_target(m_ptr, m_list[who].fy, m_list[who].fx);
6215 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6217 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6218 rakubadam_m = (dam > 200) ? 200 : dam;
6227 /* Get local object */
6230 /* Prepare to make a Blade of Chaos */
6231 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6233 q_ptr->pval = photo;
6235 /* Mark the item as fully known */
6236 q_ptr->ident |= (IDENT_MENTAL);
6238 /* Drop it in the dungeon */
6239 (void)drop_near(q_ptr, -1, py, px);
6247 /* Return "Anything seen?" */
6253 * Helper function for "project()" below.
6255 * Handle a beam/bolt/ball causing damage to the player.
6257 * This routine takes a "source monster" (by index), a "distance", a default
6258 * "damage", and a "damage type". See "project_m()" above.
6260 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6261 * is reduced (see "project_m()" above). This can happen if a monster breathes
6262 * at the player and hits a wall instead.
6264 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6265 * to know if this is actually a ball or a bolt spell
6268 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6269 * we just assume that the effects were obvious, for historical reasons.
6271 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int a_rad, int monspell)
6275 /* Hack -- assume obvious */
6276 bool obvious = TRUE;
6278 /* Player blind-ness */
6279 bool blind = (p_ptr->blind ? TRUE : FALSE);
6281 /* Player needs a "description" (he is blind) */
6284 /* Source monster */
6285 monster_type *m_ptr;
6287 /* Monster name (for attacks) */
6290 /* Monster name (for damage) */
6293 /* Hack -- messages */
6297 /* Player is not here */
6298 if ((x != px) || (y != py)) return (FALSE);
6300 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6306 /* Player cannot hurt himself */
6307 if (!who) return (FALSE);
6308 if (who == p_ptr->riding) return (FALSE);
6310 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))
6313 int max_attempts = 10;
6316 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6317 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6318 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6320 if (blind) msg_print("Something bounces!");
6321 else msg_print("The attack bounces!");
6325 /* Choose 'new' target */
6328 t_y = m_list[who].fy - 1 + randint1(3);
6329 t_x = m_list[who].fx - 1 + randint1(3);
6332 while (max_attempts && in_bounds2u(t_y, t_x) &&
6333 !(player_has_los_bold(t_y, t_x)));
6335 if (max_attempts < 1)
6337 t_y = m_list[who].fy;
6338 t_x = m_list[who].fx;
6341 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL), monspell);
6348 /* Limit maximum damage */
6349 if (dam > 1600) dam = 1600;
6351 /* Reduce damage by distance */
6352 dam = (dam + r) / (r + 1);
6355 /* If the player is blind, be more descriptive */
6356 if (blind) fuzzy = TRUE;
6359 /* Get the source monster */
6360 m_ptr = &m_list[who];
6362 /* Get the monster name */
6363 monster_desc(m_name, m_ptr, 0);
6365 /* Get the monster's real name (gotten before polymorph!) */
6366 strcpy(killer, who_name);
6368 /* Analyze the damage */
6371 /* Standard damage -- hurts inventory too */
6375 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6377 if (fuzzy) msg_print("You are hit by acid!");
6380 acid_dam(dam, killer, monspell);
6384 /* Standard damage -- hurts inventory too */
6388 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6390 if (fuzzy) msg_print("You are hit by fire!");
6393 fire_dam(dam, killer, monspell);
6397 /* Standard damage -- hurts inventory too */
6401 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6403 if (fuzzy) msg_print("You are hit by cold!");
6406 cold_dam(dam, killer, monspell);
6410 /* Standard damage -- hurts inventory too */
6414 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6416 if (fuzzy) msg_print("You are hit by lightning!");
6419 elec_dam(dam, killer, monspell);
6423 /* Standard damage -- also poisons player */
6426 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6428 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6430 if (fuzzy) msg_print("You are hit by poison!");
6433 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6434 if (double_resist) dam = (dam + 2) / 3;
6436 if ((!(double_resist || p_ptr->resist_pois)) &&
6437 one_in_(HURT_CHANCE))
6442 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6444 if (!(double_resist || p_ptr->resist_pois))
6446 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6451 /* Standard damage -- also poisons / mutates player */
6454 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6456 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6458 if (fuzzy) msg_print("You are hit by radiation!");
6461 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6462 if (double_resist) dam = (2 * dam + 2) / 5;
6463 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6464 if (!(double_resist || p_ptr->resist_pois))
6466 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6468 if (one_in_(5)) /* 6 */
6471 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6473 msg_print("You undergo a freakish metamorphosis!");
6476 if (one_in_(4)) /* 4 */
6484 inven_damage(set_acid_destroy, 2);
6490 /* Standard damage */
6494 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6496 if (fuzzy) msg_print("You are hit by something!");
6499 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6503 /* Holy Orb -- Player only takes partial damage */
6507 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6509 if (fuzzy) msg_print("You are hit by something!");
6512 if (p_ptr->align > 10)
6514 else if (p_ptr->align < -10)
6516 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6523 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6525 if (fuzzy) msg_print("You are hit by something!");
6528 if (p_ptr->align > 10)
6530 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6534 /* Arrow -- XXX no dodging */
6538 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6540 if (fuzzy) msg_print("You are hit by something sharp!");
6543 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6546 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6548 msg_print("You cut down the arrow!");
6552 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6556 /* Plasma -- XXX No resist */
6560 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6562 if (fuzzy) msg_print("You are hit by something *HOT*!");
6565 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6567 if (!p_ptr->resist_sound)
6569 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6570 (void)set_stun(p_ptr->stun + k);
6573 if (!(p_ptr->resist_fire ||
6574 p_ptr->oppose_fire ||
6575 music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
6576 p_ptr->immune_fire))
6578 inven_damage(set_acid_destroy, 3);
6584 /* Nether -- drain experience */
6588 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6590 if (fuzzy) msg_print("You are hit by nether forces!");
6594 if (p_ptr->resist_neth)
6596 if (!prace_is_(RACE_SPECTRE))
6597 dam *= 6; dam /= (randint1(4) + 7);
6599 else if (p_ptr->prace != RACE_ANDROID)
6601 if (p_ptr->hold_life && (randint0(100) < 75))
6604 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6606 msg_print("You keep hold of your life force!");
6610 else if (p_ptr->hold_life)
6613 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6615 msg_print("You feel your life slipping away!");
6618 lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6623 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6625 msg_print("You feel your life draining away!");
6628 lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6632 if (prace_is_(RACE_SPECTRE))
6635 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6637 msg_print("You feel invigorated!");
6641 learn_spell(monspell);
6645 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6651 /* Water -- stun/confuse */
6655 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6657 if (fuzzy) msg_print("You are hit by something wet!");
6660 if (!p_ptr->resist_sound)
6662 set_stun(p_ptr->stun + randint1(40));
6664 if (!p_ptr->resist_conf)
6666 set_confused(p_ptr->confused + randint1(5) + 5);
6671 inven_damage(set_cold_destroy, 3);
6674 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6678 /* Chaos -- many effects */
6682 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6684 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6687 if (p_ptr->resist_chaos)
6689 dam *= 6; dam /= (randint1(4) + 7);
6691 if (!p_ptr->resist_conf)
6693 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6695 if (!p_ptr->resist_chaos)
6697 (void)set_image(p_ptr->image + randint1(10));
6701 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6703 msg_print("Your body is twisted by chaos!");
6706 (void)gain_random_mutation(0);
6709 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6711 if (p_ptr->prace == RACE_ANDROID)
6714 else if (p_ptr->hold_life && (randint0(100) < 75))
6717 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6719 msg_print("You keep hold of your life force!");
6723 else if (p_ptr->hold_life)
6726 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6728 msg_print("You feel your life slipping away!");
6731 lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6736 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6738 msg_print("You feel your life draining away!");
6741 lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6744 if (!p_ptr->resist_chaos || one_in_(9))
6746 inven_damage(set_elec_destroy, 2);
6747 inven_damage(set_fire_destroy, 2);
6749 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6753 /* Shards -- mostly cutting */
6757 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6759 if (fuzzy) msg_print("You are hit by something sharp!");
6762 if (p_ptr->resist_shard)
6764 dam *= 6; dam /= (randint1(4) + 7);
6768 (void)set_cut(p_ptr->cut + dam);
6771 if (!p_ptr->resist_shard || one_in_(13))
6773 inven_damage(set_cold_destroy, 2);
6776 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6780 /* Sound -- mostly stunning */
6784 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6786 if (fuzzy) msg_print("You are hit by a loud noise!");
6789 if (p_ptr->resist_sound)
6791 dam *= 5; dam /= (randint1(4) + 7);
6795 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6796 (void)set_stun(p_ptr->stun + k);
6799 if (!p_ptr->resist_sound || one_in_(13))
6801 inven_damage(set_cold_destroy, 2);
6804 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6808 /* Pure confusion */
6812 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6814 if (fuzzy) msg_print("You are hit by something puzzling!");
6817 if (p_ptr->resist_conf)
6819 dam *= 5; dam /= (randint1(4) + 7);
6821 if (!p_ptr->resist_conf)
6823 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6825 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6829 /* Disenchantment -- see above */
6833 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6835 if (fuzzy) msg_print("You are hit by something static!");
6838 if (p_ptr->resist_disen)
6840 dam *= 6; dam /= (randint1(4) + 7);
6844 (void)apply_disenchant(0);
6846 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6850 /* Nexus -- see above */
6854 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6856 if (fuzzy) msg_print("You are hit by something strange!");
6859 if (p_ptr->resist_nexus)
6861 dam *= 6; dam /= (randint1(4) + 7);
6867 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6871 /* Force -- mostly stun */
6875 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6877 if (fuzzy) msg_print("You are hit by kinetic force!");
6880 if (!p_ptr->resist_sound)
6882 (void)set_stun(p_ptr->stun + randint1(20));
6884 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6889 /* Rocket -- stun, cut */
6893 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6895 if (fuzzy) msg_print("There is an explosion!");
6898 if (!p_ptr->resist_sound)
6900 (void)set_stun(p_ptr->stun + randint1(20));
6902 if (p_ptr->resist_shard)
6908 (void)set_cut(p_ptr-> cut + ( dam / 2));
6911 if ((!p_ptr->resist_shard) || one_in_(12))
6913 inven_damage(set_cold_destroy, 3);
6916 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6920 /* Inertia -- slowness */
6924 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6926 if (fuzzy) msg_print("You are hit by something slow!");
6929 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6930 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6934 /* Lite -- blinding */
6938 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6940 if (fuzzy) msg_print("You are hit by something!");
6943 if (p_ptr->resist_lite)
6945 dam *= 4; dam /= (randint1(4) + 7);
6947 else if (!blind && !p_ptr->resist_blind)
6949 (void)set_blind(p_ptr->blind + randint1(5) + 2);
6951 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
6954 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
6956 msg_print("The light scorches your flesh!");
6961 else if (prace_is_(RACE_S_FAIRY))
6965 if (p_ptr->wraith_form) dam *= 2;
6966 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6968 if (p_ptr->wraith_form)
6970 p_ptr->wraith_form = 0;
6972 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
6974 msg_print("The light forces you out of your incorporeal shadow form.");
6977 p_ptr->redraw |= PR_MAP;
6978 /* Update monsters */
6979 p_ptr->update |= (PU_MONSTERS);
6981 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6983 /* Redraw status bar */
6984 p_ptr->redraw |= (PR_STATUS);
6991 /* Dark -- blinding */
6995 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6997 if (fuzzy) msg_print("You are hit by something!");
7000 if (p_ptr->resist_dark)
7002 dam *= 4; dam /= (randint1(4) + 7);
7004 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7006 else if (!blind && !p_ptr->resist_blind)
7008 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7010 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7014 /* Time -- bolt fewer effects XXX */
7018 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7020 if (fuzzy) msg_print("You are hit by a blast from the past!");
7023 if (p_ptr->resist_time)
7026 dam /= (randint1(4) + 7);
7028 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7030 msg_print("You feel as if time is passing you by.");
7036 switch (randint1(10))
7038 case 1: case 2: case 3: case 4: case 5:
7040 if (p_ptr->prace == RACE_ANDROID) break;
7042 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7044 msg_print("You feel life has clocked back.");
7047 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7051 case 6: case 7: case 8: case 9:
7053 switch (randint1(6))
7056 case 1: k = A_STR; act = "¶¯¤¯"; break;
7057 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7058 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7059 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7060 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7061 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7063 case 1: k = A_STR; act = "strong"; break;
7064 case 2: k = A_INT; act = "bright"; break;
7065 case 3: k = A_WIS; act = "wise"; break;
7066 case 4: k = A_DEX; act = "agile"; break;
7067 case 5: k = A_CON; act = "hale"; break;
7068 case 6: k = A_CHR; act = "beautiful"; break;
7074 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7076 msg_format("You're not as %s as you used to be...", act);
7080 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7081 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7082 p_ptr->update |= (PU_BONUS);
7089 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7091 msg_print("You're not as powerful as you used to be...");
7095 for (k = 0; k < 6; k++)
7097 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7098 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7100 p_ptr->update |= (PU_BONUS);
7106 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7110 /* Gravity -- stun plus slowness plus teleport */
7114 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7115 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7117 if (fuzzy) msg_print("You are hit by something heavy!");
7118 msg_print("Gravity warps around you.");
7123 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7124 if (!(p_ptr->resist_sound || p_ptr->ffall))
7126 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7127 (void)set_stun(p_ptr->stun + k);
7131 dam = (dam * 2) / 3;
7134 if (!p_ptr->ffall || one_in_(13))
7136 inven_damage(set_cold_destroy, 2);
7139 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7143 /* Standard damage */
7144 case GF_DISINTEGRATE:
7147 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7149 if (fuzzy) msg_print("You are hit by pure energy!");
7152 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7159 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7161 if (fuzzy) msg_print("You are hit by something invigorating!");
7164 (void)hp_player(dam);
7172 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7174 if (fuzzy) msg_print("You are hit by something!");
7177 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7185 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7187 if (fuzzy) msg_print("You are hit by something slow!");
7190 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7196 if (p_ptr->free_act) break;
7198 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7200 if (fuzzy) msg_print("You fall asleep!");
7204 if (ironman_nightmare)
7207 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7209 msg_print("A horrible vision enters your mind.");
7213 /* Pick a nightmare */
7214 get_mon_num_prep(get_nightmare, NULL);
7216 /* Have some nightmares */
7217 have_nightmare(get_mon_num(MAX_DEPTH));
7219 /* Remove the monster restriction */
7220 get_mon_num_prep(NULL, NULL);
7223 set_paralyzed(p_ptr->paralyzed + dam);
7234 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7236 if (fuzzy) msg_print("You are hit by an aura of magic!");
7239 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7247 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7249 if (fuzzy) msg_print("You are hit by an energy!");
7252 take_hit(DAMAGE_FORCE, dam, killer, monspell);
7260 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7262 if (fuzzy) msg_print("Something falls from the sky on you!");
7265 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7266 if (!p_ptr->resist_shard || one_in_(13))
7268 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7269 inven_damage(set_cold_destroy, 2);
7275 /* Ice -- cold plus stun plus cuts */
7279 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7281 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7284 cold_dam(dam, killer, monspell);
7285 if (!p_ptr->resist_shard)
7287 (void)set_cut(p_ptr->cut + damroll(5, 8));
7289 if (!p_ptr->resist_sound)
7291 (void)set_stun(p_ptr->stun + randint1(15));
7294 if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
7296 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7306 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7308 if (fuzzy) msg_print("You are hit by something extremely cold!");
7312 if (p_ptr->mimic_form)
7314 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7315 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7320 switch (p_ptr->prace)
7322 /* Some races are immune */
7336 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7356 if (p_ptr->riding && dam > 0)
7358 rakubadam_p = (dam > 200) ? 200 : dam;
7366 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7372 /* Return "Anything seen?" */
7378 * Find the distance from (x, y) to a line.
7380 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7382 /* Vector from (x, y) to (x1, y1) */
7391 int pd = distance(y1, x1, y, x);
7392 int nd = distance(y1, x1, y2, x2);
7394 if (pd > nd) return distance(y, x, y2, x2);
7396 /* Component of P on N */
7397 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7399 /* Absolute value */
7400 return((nd >= 0) ? nd : 0 - nd);
7407 * Modified version of los() for calculation of disintegration balls.
7408 * Disintegration effects are stopped by permanent walls.
7410 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7430 /* Slope, or 1/Slope, of LOS */
7434 /* Extract the offset */
7438 /* Extract the absolute offset */
7443 /* Handle adjacent (or identical) grids */
7444 if ((ax < 2) && (ay < 2)) return (TRUE);
7447 /* Paranoia -- require "safe" origin */
7448 /* if (!in_bounds(y1, x1)) return (FALSE); */
7451 /* Directly South/North */
7454 /* South -- check for walls */
7457 for (ty = y1 + 1; ty < y2; ty++)
7459 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7463 /* North -- check for walls */
7466 for (ty = y1 - 1; ty > y2; ty--)
7468 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7476 /* Directly East/West */
7479 /* East -- check for walls */
7482 for (tx = x1 + 1; tx < x2; tx++)
7484 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7488 /* West -- check for walls */
7491 for (tx = x1 - 1; tx > x2; tx--)
7493 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7502 /* Extract some signs */
7503 sx = (dx < 0) ? -1 : 1;
7504 sy = (dy < 0) ? -1 : 1;
7507 /* Vertical "knights" */
7512 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7516 /* Horizontal "knights" */
7521 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7526 /* Calculate scale factor div 2 */
7529 /* Calculate scale factor */
7533 /* Travel horizontally */
7536 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7542 /* Consider the special case where slope == 1. */
7553 /* Note (below) the case (qy == f2), where */
7554 /* the LOS exactly meets the corner of a tile. */
7557 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7568 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7581 /* Travel vertically */
7584 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7600 /* Note (below) the case (qx == f2), where */
7601 /* the LOS exactly meets the corner of a tile. */
7604 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7615 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7635 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)
7648 while (bdis <= distance(y1, x1, y2, x2) + rad)
7650 /* Travel from center outward */
7651 for (cdis = 0; cdis <= brad; cdis++)
7654 /* Scan the maximal blast area of radius "cdis" */
7655 for (y = by - cdis; y <= by + cdis; y++)
7657 for (x = bx - cdis; x <= bx + cdis; x++)
7659 /* Ignore "illegal" locations */
7660 if (!in_bounds(y, x)) continue;
7662 /* Enforce a circular "ripple" */
7663 if (distance(y1, x1, y, x) != bdis) continue;
7665 /* Enforce an arc */
7666 if (distance(by, bx, y, x) != cdis) continue;
7670 /* Disintegration balls explosions are stopped by perma-walls */
7671 if (!in_disintegration_range(by, bx, y, x)) continue;
7673 if (real_breath && cave_valid_bold(y, x) &&
7674 (cave[y][x].feat < FEAT_PATTERN_START ||
7675 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
7676 (cave[y][x].feat < FEAT_DEEP_WATER ||
7677 cave[y][x].feat > FEAT_GRASS))
7679 if (cave[y][x].feat == FEAT_TREES)
7680 cave_set_feat(y, x, FEAT_GRASS);
7683 cave[y][x].feat = floor_type[randint0(100)];
7684 cave[y][x].info &= ~(CAVE_MASK);
7685 cave[y][x].info |= CAVE_FLOOR;
7688 /* Update some things -- similar to GF_KILL_WALL */
7689 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
7693 /* The blast is stopped by walls */
7694 if (!los(by, bx, y, x)) continue;
7697 /* Save this grid */
7705 /* Encode some more "radius" info */
7706 gm[bdis + 1] = *pgrids;
7709 if ((by == y2) && (bx == x2)) done = TRUE;
7718 /* Ripple outwards */
7719 /* mmove2(&by, &bx, y1, x1, y2, x2); */
7721 by = GRID_Y(path_g[bdis]);
7722 bx = GRID_X(path_g[bdis]);
7724 /* Find the next ripple */
7727 /* Increase the size */
7728 brad = (rad * bdis) / dist;
7731 /* Store the effect size */
7737 * Generic "beam"/"bolt"/"ball" projection routine.
7740 * who: Index of "source" monster (zero for "player")
7741 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
7742 * y,x: Target location (or location to travel "towards")
7743 * dam: Base damage roll to apply to affected monsters (or player)
7744 * typ: Type of damage to apply to monsters (and objects)
7745 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
7748 * TRUE if any "effects" of the projection were observed, else FALSE
7750 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
7751 * towards a given location (optionally passing over the heads of interposing
7752 * monsters), and have it do a given amount of damage to the monsters (and
7753 * optionally objects) within the given radius of the final location.
7755 * A "bolt" travels from source to target and affects only the target grid.
7756 * A "beam" travels from source to target, affecting all grids passed through.
7757 * A "ball" travels from source to the target, exploding at the target, and
7758 * affecting everything within the given radius of the target location.
7760 * Traditionally, a "bolt" does not affect anything on the ground, and does
7761 * not pass over the heads of interposing monsters, much like a traditional
7762 * missile, and will "stop" abruptly at the "target" even if no monster is
7763 * positioned there, while a "ball", on the other hand, passes over the heads
7764 * of monsters between the source and target, and affects everything except
7765 * the source monster which lies within the final radius, while a "beam"
7766 * affects every monster between the source and target, except for the casting
7767 * monster (or player), and rarely affects things on the ground.
7769 * Two special flags allow us to use this function in special ways, the
7770 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
7771 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
7772 * actually projecting from the source monster (or player).
7774 * The player will only get "experience" for monsters killed by himself
7775 * Unique monsters can only be destroyed by attacks from the player
7777 * Only 256 grids can be affected per projection, limiting the effective
7778 * "radius" of standard ball attacks to nine units (diameter nineteen).
7780 * One can project in a given "direction" by combining PROJECT_THRU with small
7781 * offsets to the initial location (see "line_spell()"), or by calculating
7782 * "virtual targets" far away from the player.
7784 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
7785 * continuing until it actually hits somethings (useful for "stone to mud").
7787 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
7789 * Balls must explode BEFORE hitting walls, or they would affect monsters
7790 * on both sides of a wall. Some bug reports indicate that this is still
7791 * happening in 2.7.8 for Windows, though it appears to be impossible.
7793 * We "pre-calculate" the blast area only in part for efficiency.
7794 * More importantly, this lets us do "explosions" from the "inside" out.
7795 * This results in a more logical distribution of "blast" treasure.
7796 * It also produces a better (in my opinion) animation of the explosion.
7797 * It could be (but is not) used to have the treasure dropped by monsters
7798 * in the middle of the explosion fall "outwards", and then be damaged by
7799 * the blast as it spreads outwards towards the treasure drop location.
7801 * Walls and doors are included in the blast area, so that they can be
7802 * "burned" or "melted" in later versions.
7804 * This algorithm is intended to maximize simplicity, not necessarily
7805 * efficiency, since this function is not a bottleneck in the code.
7807 * We apply the blast effect from ground zero outwards, in several passes,
7808 * first affecting features, then objects, then monsters, then the player.
7809 * This allows walls to be removed before checking the object or monster
7810 * in the wall, and protects objects which are dropped by monsters killed
7811 * in the blast, and allows the player to see all affects before he is
7812 * killed or teleported away. The semantics of this method are open to
7813 * various interpretations, but they seem to work well in practice.
7815 * We process the blast area from ground-zero outwards to allow for better
7816 * distribution of treasure dropped by monsters, and because it provides a
7817 * pleasing visual effect at low cost.
7819 * Note that the damage done by "ball" explosions decreases with distance.
7820 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
7822 * Notice the "napalm" effect of "beam" weapons. First they "project" to
7823 * the target, and then the damage "flows" along this beam of destruction.
7824 * The damage at every grid is the same as at the "center" of a "ball"
7825 * explosion, since the "beam" grids are treated as if they ARE at the
7826 * center of a "ball" explosion.
7828 * Currently, specifying "beam" plus "ball" means that locations which are
7829 * covered by the initial "beam", and also covered by the final "ball", except
7830 * for the final grid (the epicenter of the ball), will be "hit twice", once
7831 * by the initial beam, and once by the exploding ball. For the grid right
7832 * next to the epicenter, this results in 150% damage being done. The center
7833 * does not have this problem, for the same reason the final grid in a "beam"
7834 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
7835 * grids which are covered by the "ball" will NOT work, as then they will
7836 * receive LESS damage than they should. Do not combine "beam" with "ball".
7838 * The array "gy[],gx[]" with current size "grids" is used to hold the
7839 * collected locations of all grids in the "blast area" plus "beam path".
7841 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
7842 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
7843 * first blast grid (see above) with radius "N" from the blast center. Note
7844 * that only the first gm[1] grids in the blast area thus take full damage.
7845 * Also, note that gm[rad+1] is always equal to "grids", which is the total
7846 * number of blast grids.
7848 * Note that once the projection is complete, (y2,x2) holds the final location
7849 * of bolts/beams, and the "epicenter" of balls.
7851 * Note also that "rad" specifies the "inclusive" radius of projection blast,
7852 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
7853 * implementation of the "distance" function. Also, a bolt can be properly
7854 * viewed as a "ball" with a "rad" of "zero".
7856 * Note that if no "target" is reached before the beam/bolt/ball travels the
7857 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
7858 * may be relevant even for bolts, since they have a "1x1" mini-blast.
7860 * Note that for consistency, we "pretend" that the bolt actually takes "time"
7861 * to move from point A to point B, even if the player cannot see part of the
7862 * projection path. Note that in general, the player will *always* see part
7863 * of the path, since it either starts at the player or ends on the player.
7865 * Hack -- we assume that every "projection" is "self-illuminating".
7867 * Hack -- when only a single monster is affected, we automatically track
7868 * (and recall) that monster, unless "PROJECT_JUMP" is used.
7870 * Note that all projections now "explode" at their final destination, even
7871 * if they were being projected at a more distant destination. This means
7872 * that "ball" spells will *always* explode.
7874 * Note that we must call "handle_stuff()" after affecting terrain features
7875 * in the blast radius, in case the "illumination" of the grid was changed,
7876 * and "update_view()" and "update_monsters()" need to be called.
7878 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
7887 int y_saver, x_saver; /* For reflecting monsters */
7889 int msec = delay_factor * delay_factor * delay_factor;
7891 /* Assume the player sees nothing */
7892 bool notice = FALSE;
7894 /* Assume the player has seen nothing */
7895 bool visual = FALSE;
7897 /* Assume the player has seen no blast grids */
7900 /* Assume to be a normal ball spell */
7901 bool breath = FALSE;
7903 /* Is the player blind? */
7904 bool blind = (p_ptr->blind ? TRUE : FALSE);
7906 bool old_hide = FALSE;
7908 /* Number of grids in the "path" */
7911 /* Actual grids in the "path" */
7914 /* Number of grids in the "blast area" (including the "beam" path) */
7917 /* Coordinates of the affected grids */
7918 byte gx[1024], gy[1024];
7920 /* Encoded "radius" info (see above) */
7923 /* Actual radius encoded in gm[] */
7928 /* Attacker's name (prepared before polymorph)*/
7934 /* Default target of monsterspell is player */
7935 monster_target_y=py;
7936 monster_target_x=px;
7938 /* Hack -- Jump to target */
7939 if (flg & (PROJECT_JUMP))
7944 /* Clear the flag */
7945 flg &= ~(PROJECT_JUMP);
7950 /* Start at player */
7957 /* Start at monster */
7960 x1 = m_list[who].fx;
7961 y1 = m_list[who].fy;
7962 monster_desc(who_name, &m_list[who], 0x288);
7975 /* Default "destination" */
7980 /* Hack -- verify stuff */
7981 if (flg & (PROJECT_THRU))
7983 if ((x1 == x2) && (y1 == y2))
7985 flg &= ~(PROJECT_THRU);
7989 /* Handle a breath attack */
7994 if (flg & PROJECT_HIDE) old_hide = TRUE;
7995 flg |= PROJECT_HIDE;
7999 /* Hack -- Assume there will be no blast (max radius 32) */
8000 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8008 /* Collect beam grids */
8009 if (flg & (PROJECT_BEAM))
8016 if (breath && typ == GF_DISINTEGRATE)
8018 flg |= (PROJECT_DISI);
8021 /* Calculate the projection path */
8023 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8025 /* Hack -- Handle stuff */
8028 /* Giga-Hack SEEKER & SUPER_RAY */
8030 if( typ == GF_SEEKER )
8040 for (i = 0; i < path_n; ++i)
8045 int ny = GRID_Y(path_g[i]);
8046 int nx = GRID_X(path_g[i]);
8057 /* Only do visuals if requested */
8058 if (!blind && !(flg & (PROJECT_HIDE)))
8060 /* Only do visuals if the player can "see" the bolt */
8061 if (panel_contains(y, x) && player_has_los_bold(y, x))
8068 /* Obtain the bolt pict */
8069 p = bolt_pict(oy, ox, y, x, typ);
8071 /* Extract attr/char */
8075 /* Visual effects */
8076 print_rel(c, a, y, x);
8077 move_cursor_relative(y, x);
8078 /*if (fresh_before)*/ Term_fresh();
8079 Term_xtra(TERM_XTRA_DELAY, msec);
8081 /*if (fresh_before)*/ Term_fresh();
8083 /* Display "beam" grids */
8084 if (flg & (PROJECT_BEAM))
8086 /* Obtain the explosion pict */
8087 p = bolt_pict(y, x, y, x, typ);
8089 /* Extract attr/char */
8093 /* Visual effects */
8094 print_rel(c, a, y, x);
8097 /* Hack -- Activate delay */
8101 /* Hack -- delay anyway for consistency */
8104 /* Delay for consistency */
8105 Term_xtra(TERM_XTRA_DELAY, msec);
8108 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8109 if( cave[y][x].feat == FEAT_MIRROR )
8111 /* The target of monsterspell becomes tha mirror(broken) */
8112 monster_target_y=(s16b)y;
8113 monster_target_x=(s16b)x;
8115 cave_set_feat( y, x , FEAT_FLOOR );
8116 next_mirror( &oy,&ox );
8118 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8119 for( j = last_i; j <=i ; j++ )
8121 y = GRID_Y(path_g[j]);
8122 x = GRID_X(path_g[j]);
8123 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8124 if(!who && (project_m_n==1) && !jump ){
8125 if(cave[project_m_y][project_m_x].m_idx >0 ){
8126 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8128 /* Hack -- auto-recall */
8129 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8131 /* Hack - auto-track */
8132 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8135 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8140 for( i = last_i ; i < path_n ; i++ )
8143 y = GRID_Y(path_g[i]);
8144 x = GRID_X(path_g[i]);
8145 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8147 if(!who && (project_m_n==1) && !jump ){
8148 if(cave[project_m_y][project_m_x].m_idx >0 ){
8149 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8151 /* Hack -- auto-recall */
8152 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8154 /* Hack - auto-track */
8155 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8158 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8162 else if(typ == GF_SUPER_RAY){
8164 int second_step = 0;
8171 for (i = 0; i < path_n; ++i)
8176 int ny = GRID_Y(path_g[i]);
8177 int nx = GRID_X(path_g[i]);
8188 /* Only do visuals if requested */
8189 if (!blind && !(flg & (PROJECT_HIDE)))
8191 /* Only do visuals if the player can "see" the bolt */
8192 if (panel_contains(y, x) && player_has_los_bold(y, x))
8199 /* Obtain the bolt pict */
8200 p = bolt_pict(oy, ox, y, x, typ);
8202 /* Extract attr/char */
8206 /* Visual effects */
8207 print_rel(c, a, y, x);
8208 move_cursor_relative(y, x);
8209 /*if (fresh_before)*/ Term_fresh();
8210 Term_xtra(TERM_XTRA_DELAY, msec);
8212 /*if (fresh_before)*/ Term_fresh();
8214 /* Display "beam" grids */
8215 if (flg & (PROJECT_BEAM))
8217 /* Obtain the explosion pict */
8218 p = bolt_pict(y, x, y, x, typ);
8220 /* Extract attr/char */
8224 /* Visual effects */
8225 print_rel(c, a, y, x);
8228 /* Hack -- Activate delay */
8232 /* Hack -- delay anyway for consistency */
8235 /* Delay for consistency */
8236 Term_xtra(TERM_XTRA_DELAY, msec);
8239 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8240 if( cave[y][x].feat == FEAT_RUBBLE ||
8241 cave[y][x].feat == FEAT_DOOR_HEAD ||
8242 cave[y][x].feat == FEAT_DOOR_TAIL ||
8243 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8244 cave[y][x].feat <= FEAT_PERM_SOLID ))
8246 if( second_step )continue;
8249 if( cave[y][x].feat == FEAT_MIRROR && !second_step )
8251 /* The target of monsterspell becomes tha mirror(broken) */
8252 monster_target_y=(s16b)y;
8253 monster_target_x=(s16b)x;
8255 cave_set_feat( y, x , FEAT_FLOOR );
8256 for( j = 0; j <=i ; j++ )
8258 y = GRID_Y(path_g[j]);
8259 x = GRID_X(path_g[j]);
8260 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8264 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8265 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8266 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8267 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8268 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8269 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8270 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8271 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8274 for( i = 0; i < path_n ; i++ )
8277 y = GRID_Y(path_g[i]);
8278 x = GRID_X(path_g[i]);
8279 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8280 if(!who && (project_m_n==1) && !jump ){
8281 if(cave[project_m_y][project_m_x].m_idx >0 ){
8282 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8284 /* Hack -- auto-recall */
8285 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8287 /* Hack - auto-track */
8288 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8291 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8296 /* Project along the path */
8297 for (i = 0; i < path_n; ++i)
8302 int ny = GRID_Y(path_g[i]);
8303 int nx = GRID_X(path_g[i]);
8305 if (flg & PROJECT_DISI)
8307 /* Hack -- Balls explode before reaching walls */
8308 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8312 /* Hack -- Balls explode before reaching walls */
8313 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8320 /* Collect beam grids */
8321 if (flg & (PROJECT_BEAM))
8328 /* Only do visuals if requested */
8329 if (!blind && !(flg & (PROJECT_HIDE)))
8331 /* Only do visuals if the player can "see" the bolt */
8332 if (panel_contains(y, x) && player_has_los_bold(y, x))
8339 /* Obtain the bolt pict */
8340 p = bolt_pict(oy, ox, y, x, typ);
8342 /* Extract attr/char */
8346 /* Visual effects */
8347 print_rel(c, a, y, x);
8348 move_cursor_relative(y, x);
8349 /*if (fresh_before)*/ Term_fresh();
8350 Term_xtra(TERM_XTRA_DELAY, msec);
8352 /*if (fresh_before)*/ Term_fresh();
8354 /* Display "beam" grids */
8355 if (flg & (PROJECT_BEAM))
8357 /* Obtain the explosion pict */
8358 p = bolt_pict(y, x, y, x, typ);
8360 /* Extract attr/char */
8364 /* Visual effects */
8365 print_rel(c, a, y, x);
8368 /* Hack -- Activate delay */
8372 /* Hack -- delay anyway for consistency */
8375 /* Delay for consistency */
8376 Term_xtra(TERM_XTRA_DELAY, msec);
8379 if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
8381 if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
8386 /* Save the "blast epicenter" */
8390 if (breath && (y1 == y2) && (x1 == x2))
8396 flg &= ~(PROJECT_HIDE);
8400 /* Start the "explosion" */
8403 /* Hack -- make sure beams get to "explode" */
8411 /* If we found a "target", explode there */
8412 if (dist <= MAX_RANGE)
8414 /* Mega-Hack -- remove the final "beam" grid */
8415 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8418 * Create a conical breath attack
8429 flg &= ~(PROJECT_HIDE);
8431 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (bool)(typ == GF_DISINTEGRATE), TRUE);
8435 /* Determine the blast area, work from the inside out */
8436 for (dist = 0; dist <= rad; dist++)
8438 /* Scan the maximal blast area of radius "dist" */
8439 for (y = y2 - dist; y <= y2 + dist; y++)
8441 for (x = x2 - dist; x <= x2 + dist; x++)
8443 /* Ignore "illegal" locations */
8444 if (!in_bounds2(y, x)) continue;
8446 /* Enforce a "circular" explosion */
8447 if (distance(y2, x2, y, x) != dist) continue;
8449 if (typ == GF_DISINTEGRATE)
8451 /* Disintegration balls explosions are stopped by perma-walls */
8452 if (!in_disintegration_range(y2, x2, y, x)) continue;
8454 if (cave_valid_bold(y, x) &&
8455 (cave[y][x].feat < FEAT_PATTERN_START ||
8456 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
8457 (cave[y][x].feat < FEAT_DEEP_WATER ||
8458 cave[y][x].feat > FEAT_GRASS))
8460 if (cave[y][x].feat == FEAT_TREES)
8461 cave_set_feat(y, x, FEAT_GRASS);
8464 cave[y][x].feat = floor_type[randint0(100)];
8465 cave[y][x].info &= ~(CAVE_MASK);
8466 cave[y][x].info |= CAVE_FLOOR;
8470 /* Update some things -- similar to GF_KILL_WALL */
8471 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8475 /* Ball explosions are stopped by walls */
8476 if (!los(y2, x2, y, x)) continue;
8479 /* Save this grid */
8486 /* Encode some more "radius" info */
8492 /* Speed -- ignore "non-explosions" */
8493 if (!grids) return (FALSE);
8496 /* Display the "blast area" if requested */
8497 if (!blind && !(flg & (PROJECT_HIDE)))
8499 /* Then do the "blast", from inside out */
8500 for (t = 0; t <= gm_rad; t++)
8502 /* Dump everything with this radius */
8503 for (i = gm[t]; i < gm[t+1]; i++)
8505 /* Extract the location */
8509 /* Only do visuals if the player can "see" the blast */
8510 if (panel_contains(y, x) && player_has_los_bold(y, x))
8519 /* Obtain the explosion pict */
8520 p = bolt_pict(y, x, y, x, typ);
8522 /* Extract attr/char */
8526 /* Visual effects -- Display */
8527 print_rel(c, a, y, x);
8531 /* Hack -- center the cursor */
8532 move_cursor_relative(y2, x2);
8534 /* Flush each "radius" seperately */
8535 /*if (fresh_before)*/ Term_fresh();
8537 /* Delay (efficiently) */
8538 if (visual || drawn)
8540 Term_xtra(TERM_XTRA_DELAY, msec);
8544 /* Flush the erasing */
8547 /* Erase the explosion drawn above */
8548 for (i = 0; i < grids; i++)
8550 /* Extract the location */
8554 /* Hack -- Erase if needed */
8555 if (panel_contains(y, x) && player_has_los_bold(y, x))
8561 /* Hack -- center the cursor */
8562 move_cursor_relative(y2, x2);
8564 /* Flush the explosion */
8565 /*if (fresh_before)*/ Term_fresh();
8570 /* Update stuff if needed */
8571 if (p_ptr->update) update_stuff();
8574 /* Check features */
8575 if (flg & (PROJECT_GRID))
8577 /* Start with "dist" of zero */
8580 /* Scan for features */
8581 for (i = 0; i < grids; i++)
8583 /* Hack -- Notice new "dist" values */
8584 if (gm[dist+1] == i) dist++;
8586 /* Get the grid location */
8590 /* Find the closest point in the blast */
8593 int d = dist_to_line(y, x, y1, x1, y2, x2);
8595 /* Affect the grid */
8596 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8600 /* Affect the grid */
8601 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8608 if (flg & (PROJECT_ITEM))
8610 /* Start with "dist" of zero */
8613 /* Scan for objects */
8614 for (i = 0; i < grids; i++)
8616 /* Hack -- Notice new "dist" values */
8617 if (gm[dist+1] == i) dist++;
8619 /* Get the grid location */
8623 /* Find the closest point in the blast */
8626 int d = dist_to_line(y, x, y1, x1, y2, x2);
8628 /* Affect the object in the grid */
8629 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8633 /* Affect the object in the grid */
8634 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8640 /* Check monsters */
8641 if (flg & (PROJECT_KILL))
8648 /* Start with "dist" of zero */
8651 /* Scan for monsters */
8652 for (i = 0; i < grids; i++)
8654 /* Hack -- Notice new "dist" values */
8655 if (gm[dist + 1] == i) dist++;
8657 /* Get the grid location */
8663 /* Find the closest point in the blast */
8666 int d = dist_to_line(y, x, y1, x1, y2, x2);
8668 /* Affect the monster in the grid */
8669 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8671 if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
8673 else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
8677 /* Affect the monster in the grid */
8678 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8680 if (!(flg & PROJECT_BEAM))
8682 if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
8685 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8690 monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
8692 if ((ref_ptr->flags2 & RF2_REFLECTING) && (!one_in_(10) && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
8695 int max_attempts = 10;
8697 /* Choose 'new' target */
8700 t_y = y_saver - 1 + randint1(3);
8701 t_x = x_saver - 1 + randint1(3);
8705 while (max_attempts && in_bounds2u(t_y, t_x) &&
8706 !(los(y, x, t_y, t_x)));
8708 if (max_attempts < 1)
8714 if (m_list[cave[y][x].m_idx].ml)
8717 if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
8718 || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
8719 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
8720 if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
8721 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
8723 msg_print("The attack bounces!");
8726 ref_ptr->r_flags2 |= RF2_REFLECTING;
8728 flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
8729 if (one_in_(2)) flg |= PROJECT_MONSTER;
8730 else flg |= PROJECT_PLAYER;
8732 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
8736 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8739 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8744 /* Player affected one monster (without "jumping") */
8745 if (!who && (project_m_n == 1) && !jump)
8751 /* Track if possible */
8752 if (cave[y][x].m_idx > 0)
8754 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8756 /* Hack -- auto-recall */
8757 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8759 /* Hack - auto-track */
8760 if (m_ptr->ml) health_track(cave[y][x].m_idx);
8767 if (flg & (PROJECT_KILL))
8769 /* Start with "dist" of zero */
8772 /* Scan for player */
8773 for (i = 0; i < grids; i++)
8775 /* Hack -- Notice new "dist" values */
8776 if (gm[dist+1] == i) dist++;
8778 /* Get the grid location */
8782 /* Find the closest point in the blast */
8785 int d = dist_to_line(y, x, y1, x1, y2, x2);
8787 /* Affect the player */
8788 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8790 if (project_p(who, who_name, d+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8792 else if (project_p(who, who_name, d, y, x, dam, typ, rad, monspell)) notice = TRUE;
8796 /* Affect the player */
8797 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8799 if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
8801 if (project_p(who, who_name, dist+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8804 else if (project_p(who, who_name, dist, y, x, dam, typ, rad, monspell)) notice = TRUE;
8813 monster_desc(m_name, &m_list[p_ptr->riding], 0);
8815 if (rakubadam_m > 0)
8817 if (rakuba(rakubadam_m, FALSE))
8820 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
8822 msg_format("%^s has thrown you off!", m_name);
8826 if (p_ptr->riding && rakubadam_p > 0)
8828 if(rakuba(rakubadam_p, FALSE))
8831 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
8833 msg_format("You have fallen from %s.", m_name);
8839 /* Return "something was noticed" */
8843 bool binding_field( int dam )
8845 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
8846 int mirror_num=0; /* ¶À¤Î¿ô */
8851 int msec= delay_factor*delay_factor*delay_factor;
8857 /* Default target of monsterspell is player */
8858 monster_target_y=py;
8859 monster_target_x=px;
8861 for( x=0 ; x < cur_wid ; x++ )
8863 for( y=0 ; y < cur_hgt ; y++ )
8865 if( cave[y][x].feat == FEAT_MIRROR &&
8866 distance(py,px,y,x) <= MAX_RANGE &&
8867 distance(py,px,y,x) != 0 &&
8868 player_has_los_bold(y,x)
8870 mirror_y[mirror_num]=y;
8871 mirror_x[mirror_num]=x;
8877 if( mirror_num < 2 )return FALSE;
8879 point_x[0] = randint0( mirror_num );
8881 point_x[1] = randint0( mirror_num );
8883 while( point_x[0] == point_x[1] );
8885 point_y[0]=mirror_y[point_x[0]];
8886 point_x[0]=mirror_x[point_x[0]];
8887 point_y[1]=mirror_y[point_x[1]];
8888 point_x[1]=mirror_x[point_x[1]];
8892 x=point_x[0]+point_x[1]+point_x[2];
8893 y=point_y[0]+point_y[1]+point_y[2];
8895 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
8896 - (point_y[0]*3-y)*(point_x[1]*3-x);
8897 if( centersign == 0 )return FALSE;
8899 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
8900 x1 = x1 < point_x[2] ? x1 : point_x[2];
8901 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
8902 y1 = y1 < point_y[2] ? y1 : point_y[2];
8904 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
8905 x2 = x2 > point_x[2] ? x2 : point_x[2];
8906 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
8907 y2 = y2 > point_y[2] ? y2 : point_y[2];
8909 for( y=y1 ; y <=y2 ; y++ ){
8910 for( x=x1 ; x <=x2 ; x++ ){
8911 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8912 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8913 centersign*( (point_x[1]-x)*(point_y[2]-y)
8914 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8915 centersign*( (point_x[2]-x)*(point_y[0]-y)
8916 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8918 if( player_has_los_bold(y,x)){
8919 /* Visual effects */
8921 && panel_contains(y,x)){
8922 p = bolt_pict(y,x,y,x, GF_MANA );
8923 print_rel(PICT_C(p), PICT_A(p),y,x);
8924 move_cursor_relative(y, x);
8925 /*if (fresh_before)*/ Term_fresh();
8926 Term_xtra(TERM_XTRA_DELAY, msec);
8932 for( y=y1 ; y <=y2 ; y++ ){
8933 for( x=x1 ; x <=x2 ; x++ ){
8934 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8935 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8936 centersign*( (point_x[1]-x)*(point_y[2]-y)
8937 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8938 centersign*( (point_x[2]-x)*(point_y[0]-y)
8939 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8941 if( player_has_los_bold(y,x)){
8942 (void)project_f(0,0,y,x,dam,GF_MANA);
8947 for( y=y1 ; y <=y2 ; y++ ){
8948 for( x=x1 ; x <=x2 ; x++ ){
8949 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8950 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8951 centersign*( (point_x[1]-x)*(point_y[2]-y)
8952 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8953 centersign*( (point_x[2]-x)*(point_y[0]-y)
8954 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8956 if( player_has_los_bold(y,x)){
8957 (void)project_o(0,0,y,x,dam,GF_MANA);
8962 for( y=y1 ; y <=y2 ; y++ ){
8963 for( x=x1 ; x <=x2 ; x++ ){
8964 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8965 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8966 centersign*( (point_x[1]-x)*(point_y[2]-y)
8967 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8968 centersign*( (point_x[2]-x)*(point_y[0]-y)
8969 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8971 if( player_has_los_bold(y,x) ){
8972 (void)project_m(0,0,y,x,dam,GF_MANA,
8973 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF));
8980 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
8982 msg_print("The field broke a mirror");
8984 cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
8990 void seal_of_mirror( int dam )
8994 for( x = 0 ; x < cur_wid ; x++ )
8996 for( y = 0 ; y < cur_hgt ; y++ )
8998 if( cave[y][x].feat == FEAT_MIRROR )
9000 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9001 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
9003 if( !cave[y][x].m_idx )
9005 cave_set_feat( y,x, FEAT_FLOOR );