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=rand_int(mirror_num);
62 *next_y=mirror_y[num];
63 *next_x=mirror_x[num];
66 *next_y=rand_int(cur_hgt);
67 *next_x=rand_int(cur_wid);
72 * Get a legal "multi-hued" color for drawing "spells"
74 static byte mh_attr(int 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[rand_int(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 /* Analyze the type */
605 /* Ignore most effects */
622 case GF_DISINTEGRATE:
643 if (c_ptr->feat == FEAT_TREES)
649 message = "ÍϤ±¤¿";break;
651 message = "melted.";break;
656 message = "dz¤¨¤¿";break;
658 message = "burns up!";break;
666 message = "Ê´ºÕ¤µ¤ì¤¿";break;
668 message = "was crushed.";break;
672 message = "dz¤¨¤¿";break;
674 message = "burns up!";break;
678 msg_format("ÌÚ¤Ï%s¡£", message);
680 msg_format("A tree %s", message);
682 c_ptr->feat = (one_in_(3) ? FEAT_DEEP_GRASS : FEAT_GRASS);
683 c_ptr->info &= ~(CAVE_MASK);
684 c_ptr->info |= CAVE_FLOOR;
687 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
689 /* Update some things */
690 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
695 /* Destroy Traps (and Locks) */
698 /* Reveal secret doors */
699 if (c_ptr->feat == FEAT_SECRET)
702 place_closed_door(y, x);
704 /* Check line of sight */
712 if ((c_ptr->info & CAVE_TRAP) || is_trap(c_ptr->feat))
714 /* Check line of sight */
718 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
720 msg_print("There is a bright flash of light!");
726 /* Forget the trap */
727 c_ptr->info &= ~(CAVE_MARK);
729 /* Destroy the trap */
730 if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
733 c_ptr->feat = floor_type[rand_int(100)];
734 c_ptr->info &= ~(CAVE_MASK);
735 c_ptr->info |= CAVE_FLOOR;
739 /* Locked doors are unlocked */
740 else if ((c_ptr->feat >= FEAT_DOOR_HEAD + 0x01) &&
741 (c_ptr->feat <= FEAT_DOOR_HEAD + 0x07))
743 /* Unlock the door */
744 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
746 /* Check line of sound */
750 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
765 /* Destroy Doors (and traps) */
768 /* Destroy all doors and traps */
769 if ((c_ptr->feat == FEAT_OPEN) ||
770 (c_ptr->feat == FEAT_BROKEN) ||
771 (c_ptr->info & CAVE_TRAP) ||
772 (is_trap(c_ptr->feat)) ||
773 ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
774 (c_ptr->feat <= FEAT_DOOR_TAIL)))
776 /* Check line of sight */
781 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
783 msg_print("There is a bright flash of light!");
788 /* Visibility change */
789 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
790 (c_ptr->feat <= FEAT_DOOR_TAIL))
792 /* Update some things */
793 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
797 /* Forget the door */
798 c_ptr->info &= ~(CAVE_MARK);
800 /* Destroy the feature */
801 if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
804 c_ptr->feat = floor_type[rand_int(100)];
805 c_ptr->info &= ~(CAVE_MASK);
806 c_ptr->info |= CAVE_FLOOR;
816 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
818 if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
819 (c_ptr->feat <= FEAT_DOOR_TAIL))
821 /* Convert "locked" to "stuck" XXX XXX XXX */
822 if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08) c_ptr->feat += 0x08;
824 /* Add one spike to the door */
825 if (c_ptr->feat < FEAT_DOOR_TAIL) c_ptr->feat++;
827 /* Check line of sight */
832 msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ¥É¥¢¤¬³«¤«¤Ê¤¤¡£");
834 msg_print("The door seems stuck.");
843 /* Destroy walls (and doors) */
846 /* Non-walls (etc) */
847 if (cave_floor_bold(y, x)) break;
849 /* Permanent walls */
850 if (c_ptr->feat >= FEAT_PERM_EXTRA) break;
853 if (c_ptr->feat >= FEAT_WALL_EXTRA)
856 if (known && (c_ptr->info & (CAVE_MARK)))
859 msg_print("Êɤ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
861 msg_print("The wall turns into mud!");
867 /* Forget the wall */
868 c_ptr->info &= ~(CAVE_MARK);
870 /* Destroy the wall */
871 c_ptr->feat = floor_type[rand_int(100)];
872 c_ptr->info &= ~(CAVE_MASK);
873 c_ptr->info |= CAVE_FLOOR;
876 /* Quartz / Magma with treasure */
877 else if (c_ptr->feat >= FEAT_MAGMA_H)
880 if (known && (c_ptr->info & (CAVE_MARK)))
883 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
884 msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
886 msg_print("The vein turns into mud!");
887 msg_print("You have found something!");
893 /* Forget the wall */
894 c_ptr->info &= ~(CAVE_MARK);
896 /* Destroy the wall */
897 c_ptr->feat = floor_type[rand_int(100)];
898 c_ptr->info &= ~(CAVE_MASK);
899 c_ptr->info |= CAVE_FLOOR;
901 /* Place some gold */
906 else if (c_ptr->feat >= FEAT_MAGMA)
909 if (known && (c_ptr->info & (CAVE_MARK)))
912 msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
914 msg_print("The vein turns into mud!");
920 /* Forget the wall */
921 c_ptr->info &= ~(CAVE_MARK);
923 /* Destroy the wall */
924 c_ptr->feat = floor_type[rand_int(100)];
925 c_ptr->info &= ~(CAVE_MASK);
926 c_ptr->info |= CAVE_FLOOR;
930 else if (c_ptr->feat == FEAT_RUBBLE)
933 if (known && (c_ptr->info & (CAVE_MARK)))
936 msg_print("´äÀФ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
938 msg_print("The rubble turns into mud!");
944 /* Forget the wall */
945 c_ptr->info &= ~(CAVE_MARK);
947 /* Destroy the rubble */
948 c_ptr->feat = floor_type[rand_int(100)];
949 c_ptr->info &= ~(CAVE_MASK);
950 c_ptr->info |= CAVE_FLOOR;
952 /* Hack -- place an object */
953 if (rand_int(100) < 10)
955 /* Found something */
956 if (player_can_see_bold(y, x))
959 msg_print("´äÀФβ¼¤Ë²¿¤«±£¤µ¤ì¤Æ¤¤¤¿¡ª");
961 msg_print("There was something buried in the rubble!");
968 place_object(y, x, FALSE, FALSE);
972 /* Destroy doors (and secret doors) */
973 else /* if (c_ptr->feat >= FEAT_DOOR_HEAD) */
975 /* Hack -- special message */
976 if (known && (c_ptr->info & (CAVE_MARK)))
979 msg_print("¥É¥¢¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
981 msg_print("The door turns into mud!");
987 /* Forget the wall */
988 c_ptr->info &= ~(CAVE_MARK);
990 /* Destroy the feature */
991 c_ptr->feat = floor_type[rand_int(100)];
992 c_ptr->info &= ~(CAVE_MASK);
993 c_ptr->info |= CAVE_FLOOR;
999 /* Update some things */
1000 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
1008 /* Require a "naked" floor grid */
1009 if (!cave_naked_bold(y, x)) break;
1011 /* Not on the player */
1012 if ((y == py) && (x == px)) break;
1014 /* Create a closed door */
1015 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
1018 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
1020 /* Update some things */
1021 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1029 /* Require a "naked" floor grid */
1030 if ((cave[y][x].feat != FEAT_FLOOR) &&
1031 (cave[y][x].feat != FEAT_GRASS) &&
1032 (cave[y][x].feat != FEAT_DIRT) &&
1033 (cave[y][x].o_idx == 0) &&
1034 (cave[y][x].m_idx == 0))
1046 /* Require a "naked" floor grid */
1047 if (!cave_naked_bold(y, x)) break;
1049 /* Not on the player */
1050 if ((y == py) && (x == px)) break;
1052 /* Create a closed door */
1053 cave_set_feat(y, x, FEAT_TREES);
1056 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
1058 /* Update some things */
1059 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1066 /* Require a "naked" floor grid */
1067 if (!cave_naked_bold(y, x)) break;
1069 cave_set_feat(y, x, FEAT_GLYPH);
1076 /* Require a "naked" floor grid */
1077 if (!cave_naked_bold(y, x)) break;
1079 /* Not on the player */
1080 if ((y == py) && (x == px)) break;
1083 cave_set_feat(y, x, FEAT_WALL_EXTRA);
1085 /* Update some things */
1086 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
1097 /* Require a "naked" floor grid */
1098 if (!cave_naked_bold(y, x)) break;
1100 /* Place a shallow lava */
1101 cave_set_feat(y, x, FEAT_SHAL_LAVA);
1106 /* Require a "naked" floor grid */
1107 if (cave_perma_bold(y, x) || !dam) break;
1109 /* Place a deep lava */
1110 cave_set_feat(y, x, FEAT_DEEP_LAVA);
1112 /* Dam is used as a counter for the number of grid to convert */
1123 /* Require a "naked" floor grid */
1124 if (!cave_naked_bold(y, x)) break;
1126 /* Place a shallow lava */
1127 cave_set_feat(y, x, FEAT_SHAL_WATER);
1132 /* Require a "naked" floor grid */
1133 if (cave_perma_bold(y, x) || !dam) break;
1135 /* Place a deep lava */
1136 cave_set_feat(y, x, FEAT_DEEP_WATER);
1138 /* Dam is used as a counter for the number of grid to convert */
1144 /* Lite up the grid */
1148 /* Turn on the light */
1149 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= (CAVE_GLOW);
1158 if (player_can_see_bold(y, x)) obvious = TRUE;
1160 /* Mega-Hack -- Update the monster in the affected grid */
1161 /* This allows "spear of light" (etc) to work "correctly" */
1162 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1167 /* Darken the grid */
1171 if (!p_ptr->inside_battle)
1174 if (player_can_see_bold(y, x)) obvious = TRUE;
1176 /* Turn off the light. */
1177 c_ptr->info &= ~(CAVE_GLOW);
1179 /* Hack -- Forget "boring" grids */
1180 if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
1183 c_ptr->info &= ~(CAVE_MARK);
1192 /* Mega-Hack -- Update the monster in the affected grid */
1193 /* This allows "spear of light" (etc) to work "correctly" */
1194 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1203 if( cave[y][x].feat == FEAT_MIRROR )
1206 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1208 msg_print("The mirror was chashed!");
1210 cave_set_feat(y,x, FEAT_FLOOR);
1211 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);
1217 if( cave[y][x].feat == FEAT_MIRROR && p_ptr->lev < 40 )
1220 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1222 msg_print("The mirror was chashed!");
1224 cave_set_feat(y,x, FEAT_FLOOR);
1231 /* Return "Anything seen?" */
1238 * We are called from "project()" to "damage" objects
1240 * We are called both for "beam" effects and "ball" effects.
1242 * Perhaps we should only SOMETIMES damage things on the ground.
1244 * The "r" parameter is the "distance from ground zero".
1246 * Note that we determine if the player can "see" anything that happens
1247 * by taking into account: blindness, line-of-sight, and illumination.
1249 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1251 * We return "TRUE" if the effect of the projection is "obvious".
1253 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1255 cave_type *c_ptr = &cave[y][x];
1257 s16b this_o_idx, next_o_idx = 0;
1259 bool obvious = FALSE;
1260 bool known = player_has_los_bold(y, x);
1264 char o_name[MAX_NLEN];
1267 bool is_potion = FALSE;
1271 who = who ? who : 0;
1273 /* Reduce damage by distance */
1274 dam = (dam + r) / (r + 1);
1277 /* Scan all objects in the grid */
1278 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1282 bool is_art = FALSE;
1283 bool ignore = FALSE;
1284 bool plural = FALSE;
1285 bool do_kill = FALSE;
1287 cptr note_kill = NULL;
1289 /* Acquire object */
1290 o_ptr = &o_list[this_o_idx];
1292 /* Acquire next object */
1293 next_o_idx = o_ptr->next_o_idx;
1295 /* Extract the flags */
1296 object_flags(o_ptr, &f1, &f2, &f3);
1298 /* Get the "plural"-ness */
1299 if (o_ptr->number > 1) plural = TRUE;
1301 /* Check for artifact */
1302 if ((artifact_p(o_ptr) || o_ptr->art_name)) is_art = TRUE;
1304 /* Analyze the type */
1307 /* Acid -- Lots of things */
1310 if (hates_acid(o_ptr))
1314 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1316 note_kill = (plural ? " melt!" : " melts!");
1319 if (f3 & (TR3_IGNORE_ACID)) ignore = TRUE;
1324 /* Elec -- Rings and Wands */
1327 if (hates_elec(o_ptr))
1331 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1333 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1336 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1341 /* Fire -- Flammable objects */
1344 if (hates_fire(o_ptr))
1348 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1350 note_kill = (plural ? " burn up!" : " burns up!");
1353 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1358 /* Cold -- potions and flasks */
1361 if (hates_cold(o_ptr))
1364 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1366 note_kill = (plural ? " shatter!" : " shatters!");
1370 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1378 if (hates_fire(o_ptr))
1382 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1384 note_kill = (plural ? " burn up!" : " burns up!");
1387 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1389 if (hates_elec(o_ptr))
1394 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1396 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1399 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1407 if (hates_fire(o_ptr))
1411 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1413 note_kill = (plural ? " burn up!" : " burns up!");
1416 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1418 if (hates_cold(o_ptr))
1423 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1425 note_kill = (plural ? " shatter!" : " shatters!");
1428 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1433 /* Hack -- break potions and such */
1439 if (hates_cold(o_ptr))
1442 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1444 note_kill = (plural ? " shatter!" : " shatters!");
1452 /* Mana and Chaos -- destroy everything */
1459 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1461 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1467 case GF_DISINTEGRATE:
1471 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1473 note_kill = (plural ? " evaporate!" : " evaporates!");
1483 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1485 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1488 if (f2 & (TR2_RES_CHAOS)) ignore = TRUE;
1489 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1493 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1497 if (cursed_p(o_ptr))
1501 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1503 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1512 identify_item(o_ptr);
1520 /* Chests are noticed only if trapped or locked */
1521 if (o_ptr->tval == TV_CHEST)
1523 /* Disarm/Unlock traps */
1524 if (o_ptr->pval > 0)
1526 /* Disarm or Unlock */
1527 o_ptr->pval = (0 - o_ptr->pval);
1530 object_known(o_ptr);
1533 if (known && o_ptr->marked)
1536 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1538 msg_print("Click!");
1550 if (o_ptr->tval == TV_CORPSE)
1553 bool friendly = (!who || is_friendly(&m_list[who]));
1554 bool pet = (!who || is_pet(&m_list[who]));
1555 for (i = 0; i < o_ptr->number ; i++)
1557 if (((o_ptr->sval == SV_CORPSE) && (randint(100) > 80)) ||
1558 ((o_ptr->sval == SV_SKELETON) && (randint(100) > 60)))
1563 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1565 note_kill = (plural ? " become dust." : " becomes dust.");
1570 else if (summon_named_creature(y, x, o_ptr->pval, FALSE, FALSE, friendly, pet))
1573 note_kill = "À¸¤Ê֤ä¿¡£";
1575 note_kill = "rivived.";
1578 else if (!note_kill)
1581 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1583 note_kill = (plural ? " become dust." : " becomes dust.");
1595 /* Attempt to destroy the object */
1598 /* Effect "observed" */
1599 if (known && o_ptr->marked)
1602 object_desc(o_name, o_ptr, FALSE, 0);
1605 /* Artifacts, and other objects, get to resist */
1606 if (is_art || ignore)
1608 /* Observe the resist */
1609 if (known && o_ptr->marked)
1612 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1615 msg_format("The %s %s unaffected!",
1616 o_name, (plural ? "are" : "is"));
1625 /* Describe if needed */
1626 if (known && o_ptr->marked && note_kill)
1629 msg_format("%s¤Ï%s", o_name, note_kill);
1631 msg_format("The %s%s", o_name, note_kill);
1636 k_idx = o_ptr->k_idx;
1637 is_potion = object_is_potion(o_ptr);
1640 /* Delete the object */
1641 delete_object_idx(this_o_idx);
1643 /* Potions produce effects when 'shattered' */
1646 (void)potion_smash_effect(who, y, x, k_idx);
1655 /* Return "Anything seen?" */
1661 * Helper function for "project()" below.
1663 * Handle a beam/bolt/ball causing damage to a monster.
1665 * This routine takes a "source monster" (by index) which is mostly used to
1666 * determine if the player is causing the damage, and a "radius" (see below),
1667 * which is used to decrease the power of explosions with distance, and a
1668 * location, via integers which are modified by certain types of attacks
1669 * (polymorph and teleport being the obvious ones), a default damage, which
1670 * is modified as needed based on various properties, and finally a "damage
1671 * type" (see below).
1673 * Note that this routine can handle "no damage" attacks (like teleport) by
1674 * taking a "zero" damage, and can even take "parameters" to attacks (like
1675 * confuse) by accepting a "damage", using it to calculate the effect, and
1676 * then setting the damage to zero. Note that the "damage" parameter is
1677 * divided by the radius, so monsters not at the "epicenter" will not take
1678 * as much damage (or whatever)...
1680 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1681 * may result in a dereference of an invalid pointer. XXX XXX XXX
1683 * Various messages are produced, and damage is applied.
1685 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1686 * actually be "made" of that substance, or "breathe" big balls of it.
1688 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1691 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1692 * and hurts evil less. If can breath nether, then it resists it as well.
1694 * Damage reductions use the following formulas:
1695 * Note that "dam = dam * 6 / (randint(6) + 6);"
1696 * gives avg damage of .655, ranging from .858 to .500
1697 * Note that "dam = dam * 5 / (randint(6) + 6);"
1698 * gives avg damage of .544, ranging from .714 to .417
1699 * Note that "dam = dam * 4 / (randint(6) + 6);"
1700 * gives avg damage of .444, ranging from .556 to .333
1701 * Note that "dam = dam * 3 / (randint(6) + 6);"
1702 * gives avg damage of .327, ranging from .427 to .250
1703 * Note that "dam = dam * 2 / (randint(6) + 6);"
1704 * gives something simple.
1706 * In this function, "result" messages are postponed until the end, where
1707 * the "note" string is appended to the monster name, if not NULL. So,
1708 * to make a spell have "no effect" just set "note" to NULL. You should
1709 * also set "notice" to FALSE, or the player will learn what the spell does.
1711 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1713 /* "flg" was added. */
1714 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1718 cave_type *c_ptr = &cave[y][x];
1720 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1722 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1726 /* Is the monster "seen"? */
1727 bool seen = m_ptr->ml;
1729 bool slept = (bool)(m_ptr->csleep > 0);
1731 /* Were the effects "obvious" (if seen)? */
1732 bool obvious = FALSE;
1734 /* Can the player know about this effect? */
1735 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1737 /* Can the player see the source of this effect? */
1738 bool see_s = ((who <= 0) || m_list[who].ml);
1740 /* Were the effects "irrelevant"? */
1741 bool skipped = FALSE;
1743 /* Gets the monster angry at the source of the effect? */
1744 bool get_angry = FALSE;
1746 /* Polymorph setting (true or false) */
1749 /* Teleport setting (max distance) */
1752 /* Confusion setting (amount to confuse) */
1755 /* Stunning setting (amount to stun) */
1758 /* Sleep amount (amount to sleep) */
1761 /* Fear amount (amount to fear) */
1764 /* Time amount (amount to time) */
1767 bool heal_leper = FALSE;
1769 /* Hold the monster name */
1776 /* Assume no note */
1779 /* Assume a default death */
1781 cptr note_dies = "¤Ï»à¤ó¤À¡£";
1783 cptr note_dies = " dies.";
1791 if (!c_ptr->m_idx) return (FALSE);
1793 /* Never affect projector */
1794 if (who && (c_ptr->m_idx == who)) return (FALSE);
1795 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1796 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1798 /* Don't affect already death monsters */
1799 /* Prevents problems with chain reactions of exploding monsters */
1800 if (m_ptr->hp < 0) return (FALSE);
1802 /* Reduce damage by distance */
1803 dam = (dam + r) / (r + 1);
1806 /* Get the monster name (BEFORE polymorphing) */
1807 monster_desc(m_name, m_ptr, 0);
1809 /* Get the monster possessive ("his"/"her"/"its") */
1810 monster_desc(m_poss, m_ptr, 0x22);
1813 /* Some monsters get "destroyed" */
1814 if (!monster_living(r_ptr))
1817 bool explode = FALSE;
1819 for (i = 0; i < 4; i++)
1821 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
1824 /* Special note at death */
1827 note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
1829 note_dies = " explodes into tiny shreds.";
1833 note_dies = "¤òÅݤ·¤¿¡£";
1835 note_dies = " is destroyed.";
1839 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1841 /* Analyze the damage type */
1844 /* Magic Missile -- pure damage */
1847 if (seen) obvious = TRUE;
1848 if (r_ptr->flags3 & (RF3_RES_ALL))
1851 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1853 note = " is immune.";
1856 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1865 if (seen) obvious = TRUE;
1866 if (r_ptr->flags3 & (RF3_RES_ALL))
1869 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1871 note = " is immune.";
1874 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1877 if (r_ptr->flags3 & (RF3_IM_ACID))
1880 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1882 note = " resists a lot.";
1886 if (seen) r_ptr->r_flags3 |= (RF3_IM_ACID);
1894 if (seen) obvious = TRUE;
1895 if (r_ptr->flags3 & (RF3_RES_ALL))
1898 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1900 note = " is immune.";
1903 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1906 if (r_ptr->flags3 & (RF3_IM_ELEC))
1909 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1911 note = " resists a lot.";
1915 if (seen) r_ptr->r_flags3 |= (RF3_IM_ELEC);
1923 if (seen) obvious = TRUE;
1924 if (r_ptr->flags3 & (RF3_RES_ALL))
1927 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1929 note = " is immune.";
1932 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1935 if (r_ptr->flags3 & (RF3_IM_FIRE))
1938 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1940 note = " resists a lot.";
1944 if (seen) r_ptr->r_flags3 |= (RF3_IM_FIRE);
1946 if (r_ptr->flags3 & (RF3_HURT_FIRE))
1949 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1951 note = " is hit hard.";
1955 if (seen) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1963 if (seen) obvious = TRUE;
1964 if (r_ptr->flags3 & (RF3_RES_ALL))
1967 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1969 note = " is immune.";
1972 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1975 if (r_ptr->flags3 & (RF3_IM_COLD))
1978 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1980 note = " resists a lot.";
1984 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
1986 if (r_ptr->flags3 & (RF3_HURT_COLD))
1989 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1991 note = " is hit hard.";
1995 if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2003 if (seen) obvious = TRUE;
2004 if (r_ptr->flags3 & (RF3_RES_ALL))
2007 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2009 note = " is immune.";
2012 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2015 if (r_ptr->flags3 & RF3_IM_POIS)
2018 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
2020 note = " resists a lot.";
2024 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2032 if (seen) obvious = TRUE;
2034 if (r_ptr->flags3 & (RF3_RES_ALL))
2037 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2039 note = " is immune.";
2042 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2045 if (r_ptr->flags3 & RF3_IM_POIS)
2048 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2053 dam *= 3; dam /= randint(6) + 6;
2054 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2056 else if (one_in_(3)) do_poly = TRUE;
2060 /* Hellfire -- hurts Evil */
2063 if (seen) obvious = TRUE;
2064 if (r_ptr->flags3 & (RF3_RES_ALL))
2067 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2069 note = " is immune.";
2072 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2075 if (r_ptr->flags3 & RF3_GOOD)
2079 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2081 note = " is hit hard.";
2084 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
2089 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2092 if (seen) obvious = TRUE;
2093 if (r_ptr->flags3 & (RF3_RES_ALL))
2096 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2098 note = " is immune.";
2101 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2104 if (r_ptr->flags3 & RF3_GOOD)
2108 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2110 note = " is immune.";
2113 if (seen) r_ptr->r_flags3 |= RF3_GOOD;
2115 else if (r_ptr->flags3 & RF3_EVIL)
2119 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2121 note = " is hit hard.";
2124 if (seen) r_ptr->r_flags3 |= RF3_EVIL;
2129 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2134 dam *= 3; dam /= randint(6) + 6;
2139 /* Arrow -- XXX no defense */
2142 if (seen) obvious = TRUE;
2143 if (r_ptr->flags3 & (RF3_RES_ALL))
2146 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2148 note = " is immune.";
2151 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2157 /* Plasma -- XXX perhaps check ELEC or FIRE */
2160 if (seen) obvious = TRUE;
2161 if (r_ptr->flags3 & (RF3_RES_ALL))
2164 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2166 note = " is immune.";
2169 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2172 if (r_ptr->flags3 & RF3_RES_PLAS)
2175 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2180 dam *= 3; dam /= randint(6) + 6;
2182 r_ptr->r_flags3 |= (RF3_RES_PLAS);
2187 /* Nether -- see above */
2190 if (seen) obvious = TRUE;
2191 if (r_ptr->flags3 & (RF3_RES_ALL))
2194 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2196 note = " is immune.";
2199 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2202 if (r_ptr->flags3 & RF3_UNDEAD)
2205 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2207 note = " is immune.";
2211 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
2213 else if (r_ptr->flags3 & RF3_RES_NETH)
2216 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2221 dam *= 3; dam /= randint(6) + 6;
2223 if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
2225 else if (r_ptr->flags3 & RF3_EVIL)
2229 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2231 note = " resists somewhat.";
2234 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
2239 /* Water (acid) damage -- Water spirits/elementals are immune */
2242 if (seen) obvious = TRUE;
2243 if (r_ptr->flags3 & (RF3_RES_ALL))
2246 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2248 note = " is immune.";
2251 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2254 if (m_ptr->r_idx == MON_WATER_ELEM || m_ptr->r_idx == MON_UNMAKER)
2257 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2259 note = " is immune.";
2264 else if (r_ptr->flags3 & RF3_RES_WATE)
2267 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2272 dam *= 3; dam /= randint(6) + 6;
2273 if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
2278 /* Chaos -- Chaos breathers resist */
2281 if (seen) obvious = TRUE;
2282 if (r_ptr->flags3 & (RF3_RES_ALL))
2285 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2287 note = " is immune.";
2290 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2294 do_conf = (5 + randint(11) + r) / (r + 1);
2295 if ((r_ptr->flags4 & RF4_BR_CHAO) ||
2296 (m_ptr->r_idx == MON_STORMBRINGER) ||
2297 ((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
2300 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2305 dam *= 3; dam /= randint(6) + 6;
2311 /* Shards -- Shard breathers resist */
2314 if (seen) obvious = TRUE;
2315 if (r_ptr->flags3 & (RF3_RES_ALL))
2318 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2320 note = " is immune.";
2323 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2326 if (r_ptr->flags4 & RF4_BR_SHAR)
2329 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2334 dam *= 3; dam /= randint(6) + 6;
2339 /* Rocket: Shard resistance helps */
2342 if (seen) obvious = TRUE;
2344 if (r_ptr->flags3 & (RF3_RES_ALL))
2347 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2349 note = " is immune.";
2352 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2355 if (r_ptr->flags4 & RF4_BR_SHAR)
2358 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2360 note = " resists somewhat.";
2369 /* Sound -- Sound breathers resist */
2372 if (seen) obvious = TRUE;
2373 if (r_ptr->flags3 & (RF3_RES_ALL))
2376 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2378 note = " is immune.";
2381 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2384 do_stun = (10 + randint(15) + r) / (r + 1);
2385 if (r_ptr->flags4 & RF4_BR_SOUN)
2388 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2393 dam *= 2; dam /= randint(6) + 6;
2401 if (seen) obvious = TRUE;
2402 if (r_ptr->flags3 & (RF3_RES_ALL))
2405 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2407 note = " is immune.";
2410 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2413 do_conf = (10 + randint(15) + r) / (r + 1);
2414 if (r_ptr->flags4 & RF4_BR_CONF)
2417 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2422 dam *= 2; dam /= randint(6) + 6;
2424 else if (r_ptr->flags3 & RF3_NO_CONF)
2427 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2429 note = " resists somewhat.";
2437 /* Disenchantment -- Breathers and Disenchanters resist */
2440 if (seen) obvious = TRUE;
2441 if (r_ptr->flags3 & (RF3_RES_ALL))
2444 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2446 note = " is immune.";
2449 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2452 if (r_ptr->flags3 & RF3_RES_DISE)
2455 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2460 dam *= 3; dam /= randint(6) + 6;
2461 if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
2466 /* Nexus -- Breathers and Existers resist */
2469 if (seen) obvious = TRUE;
2470 if (r_ptr->flags3 & (RF3_RES_ALL))
2473 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2475 note = " is immune.";
2478 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2481 if (r_ptr->flags3 & RF3_RES_NEXU)
2484 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2489 dam *= 3; dam /= randint(6) + 6;
2490 if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
2498 if (seen) obvious = TRUE;
2499 if (r_ptr->flags3 & (RF3_RES_ALL))
2502 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2504 note = " is immune.";
2507 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2510 do_stun = (randint(15) + r) / (r + 1);
2511 if (r_ptr->flags4 & RF4_BR_WALL)
2514 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2519 dam *= 3; dam /= randint(6) + 6;
2524 /* Inertia -- breathers resist */
2527 if (seen) obvious = TRUE;
2528 if (r_ptr->flags3 & (RF3_RES_ALL))
2531 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2533 note = " is immune.";
2536 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2539 if (r_ptr->flags4 & (RF4_BR_INER))
2542 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2547 dam *= 3; dam /= randint(6) + 6;
2551 /* Powerful monsters can resist */
2552 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2553 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2557 /* Normal monsters slow down */
2563 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2565 note = " starts moving slower.";
2568 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2569 if (c_ptr->m_idx == p_ptr->riding)
2570 p_ptr->update |= (PU_BONUS);
2576 /* Time -- breathers resist */
2579 if (seen) obvious = TRUE;
2580 if (r_ptr->flags3 & (RF3_RES_ALL))
2583 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2585 note = " is immune.";
2588 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2591 if (r_ptr->flags4 & (RF4_BR_TIME))
2594 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2599 dam *= 3; dam /= randint(6) + 6;
2601 else do_time = (dam+1)/2;
2605 /* Gravity -- breathers resist */
2608 bool resist_tele = FALSE;
2610 if (seen) obvious = TRUE;
2612 if (r_ptr->flags3 & (RF3_RES_ALL))
2615 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2617 note = " is immune.";
2620 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2623 if (r_ptr->flags3 & (RF3_RES_TELE))
2625 if (r_ptr->flags1 & (RF1_UNIQUE))
2627 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2629 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2631 note = " is unaffected!";
2636 else if (r_ptr->level > randint(100))
2638 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2640 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2649 if (!resist_tele) do_dist = 10;
2651 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2653 if (r_ptr->flags4 & (RF4_BR_GRAV))
2656 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2661 dam *= 3; dam /= randint(6) + 6;
2667 /* Powerful monsters can resist */
2668 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2669 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2673 /* Normal monsters slow down */
2679 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2681 note = " starts moving slower.";
2684 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2685 if (c_ptr->m_idx == p_ptr->riding)
2686 p_ptr->update |= (PU_BONUS);
2690 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
2692 /* Attempt a saving throw */
2693 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2694 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2698 /* No obvious effect */
2700 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2702 note = " is unaffected!";
2716 if (seen) obvious = TRUE;
2717 if (r_ptr->flags3 & (RF3_RES_ALL))
2720 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2722 note = " is immune.";
2725 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2733 case GF_DISINTEGRATE:
2735 if (seen) obvious = TRUE;
2736 if (r_ptr->flags3 & (RF3_RES_ALL))
2739 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2741 note = " is immune.";
2744 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2747 if (r_ptr->flags3 & RF3_HURT_ROCK)
2749 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2751 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2752 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2754 note = " loses some skin!";
2755 note_dies = " evaporates!";
2765 if (seen) obvious = TRUE;
2767 /* PSI only works if the monster can see you! -- RG */
2768 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2772 note = "¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª";
2774 note = " can't see you, and isn't affected!";
2779 if (r_ptr->flags3 & (RF3_RES_ALL))
2782 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2784 note = " is immune.";
2787 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2790 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2794 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2796 note = " is immune!";
2798 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2801 else if ((r_ptr->flags2 & RF2_STUPID) ||
2802 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2803 (r_ptr->flags3 & RF3_ANIMAL) ||
2804 (r_ptr->level > randint(3 * dam)))
2808 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2815 * Powerful demons & undead can turn a mindcrafter's
2816 * attacks back on them
2818 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2819 (r_ptr->flags3 & RF3_DEMON)) &&
2820 (r_ptr->level > p_ptr->lev / 2) &&
2825 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2828 msg_format("%^s%s corrupted mind backlashes your attack!",
2829 m_name, (seen ? "'s" : "s"));
2833 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
2836 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2838 msg_print("You resist the effects!");
2844 /* Injure +/- confusion */
2845 monster_desc(killer, m_ptr, 0x88);
2846 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2852 set_confused(p_ptr->confused + 3 + randint(dam));
2855 set_stun(p_ptr->stun + randint(dam));
2859 if (r_ptr->flags3 & RF3_NO_FEAR)
2861 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2863 note = " is unaffected.";
2867 set_afraid(p_ptr->afraid + 3 + randint(dam));
2871 if (!p_ptr->free_act)
2872 (void)set_paralyzed(p_ptr->paralyzed + randint(dam));
2881 if ((dam > 0) && one_in_(4))
2886 do_conf = 3 + randint(dam);
2889 do_stun = 3 + randint(dam);
2892 do_fear = 3 + randint(dam);
2896 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2898 note = " falls asleep!";
2901 do_sleep = 3 + randint(dam);
2907 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2909 note_dies = " collapses, a mindless husk.";
2917 if (seen) obvious = TRUE;
2918 if (r_ptr->flags3 & (RF3_RES_ALL))
2921 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2923 note = " is immune.";
2926 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2929 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2933 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2935 note = " is immune!";
2939 else if ((r_ptr->flags2 & RF2_STUPID) ||
2940 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2941 (r_ptr->flags3 & RF3_ANIMAL) ||
2942 (r_ptr->level > randint(3 * dam)))
2946 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2953 * Powerful demons & undead can turn a mindcrafter's
2954 * attacks back on them
2956 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2957 (r_ptr->flags3 & RF3_DEMON)) &&
2958 (r_ptr->level > p_ptr->lev / 2) &&
2963 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2966 msg_format("%^s%s corrupted mind backlashes your attack!",
2967 m_name, (seen ? "'s" : "s"));
2971 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
2974 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2976 msg_print("You resist the effects!");
2982 /* Injure + mana drain */
2983 monster_desc(killer, m_ptr, 0x88);
2985 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2987 msg_print("Your psychic energy is drained!");
2990 p_ptr->csp = MAX(0, p_ptr->csp - damroll(5, dam) / 2);
2991 p_ptr->redraw |= PR_MANA;
2992 p_ptr->window |= (PW_SPELL);
2993 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
3000 int b = damroll(5, dam) / 4;
3002 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª",
3005 msg_format("You convert %s%s pain into psychic energy!",
3006 m_name, (seen ? "'s" : "s"));
3009 b = MIN(p_ptr->msp, p_ptr->csp + b);
3011 p_ptr->redraw |= PR_MANA;
3012 p_ptr->window |= (PW_SPELL);
3016 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
3018 note_dies = " collapses, a mindless husk.";
3024 case GF_TELEKINESIS:
3026 if (seen) obvious = TRUE;
3027 if (r_ptr->flags3 & (RF3_RES_ALL))
3030 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3032 note = " is immune.";
3035 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3040 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3045 do_stun = damroll((p_ptr->lev / 10) + 3 , dam) + 1;
3047 /* Attempt a saving throw */
3048 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3049 (r_ptr->level > 5 + randint(dam)))
3053 /* No obvious effect */
3059 /* Psycho-spear -- powerful magic missile */
3062 if (seen) obvious = TRUE;
3063 if (r_ptr->flags3 & (RF3_RES_ALL))
3066 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3068 note = " is immune.";
3071 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3077 /* Meteor -- powerful magic missile */
3080 if (seen) obvious = TRUE;
3081 if (r_ptr->flags3 & (RF3_RES_ALL))
3084 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3086 note = " is immune.";
3089 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3097 if (!is_hostile(m_ptr)) break;
3098 if (seen) obvious = TRUE;
3100 if (r_ptr->flags3 & (RF3_RES_ALL))
3103 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3105 note = " is immune.";
3108 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3111 /* Attempt a saving throw */
3112 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3113 (r_ptr->flags1 & RF1_QUESTOR) ||
3114 (r_ptr->flags3 & RF3_NO_CONF) ||
3115 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3117 /* Memorize a flag */
3118 if (r_ptr->flags3 & RF3_NO_CONF)
3120 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3127 * Powerful demons & undead can turn a mindcrafter's
3128 * attacks back on them
3130 if (((r_ptr->flags3 & RF3_UNDEAD) ||
3131 (r_ptr->flags3 & RF3_DEMON)) &&
3132 (r_ptr->level > p_ptr->lev / 2) &&
3137 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3140 msg_format("%^s%s corrupted mind backlashes your attack!",
3141 m_name, (seen ? "'s" : "s"));
3145 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
3148 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3150 msg_print("You resist the effects!");
3156 /* Confuse, stun, terrify */
3160 set_stun(p_ptr->stun + dam / 2);
3163 set_confused(p_ptr->confused + dam / 2);
3167 if (r_ptr->flags3 & RF3_NO_FEAR)
3169 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3171 note = " is unaffected.";
3175 set_afraid(p_ptr->afraid + dam);
3182 /* No obvious effect */
3184 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3186 note = " is unaffected!";
3194 if ((dam > 29) && (randint(100) < dam))
3197 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3199 note = " is in your thrall!";
3220 /* No "real" damage */
3227 /* Ice -- Cold + Cuts + Stun */
3230 if (seen) obvious = TRUE;
3231 if (r_ptr->flags3 & (RF3_RES_ALL))
3234 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3236 note = " is immune.";
3239 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3242 do_stun = (randint(15) + 1) / (r + 1);
3243 if (r_ptr->flags3 & RF3_IM_COLD)
3246 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3248 note = " resists a lot.";
3252 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
3261 if (seen) obvious = TRUE;
3263 if (r_ptr->flags3 & (RF3_RES_ALL))
3266 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3268 note = " is immune.";
3271 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3274 if (!monster_living(r_ptr))
3276 if (r_ptr->flags3 & RF3_UNDEAD)
3278 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3281 if (r_ptr->flags3 & (RF3_DEMON))
3283 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
3287 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3289 note = " is unaffected!";
3295 else do_time = (dam+7)/8;
3303 if (seen) obvious = TRUE;
3305 if (r_ptr->flags3 & (RF3_RES_ALL))
3308 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3310 note = " is immune.";
3313 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3316 if ((r_ptr->flags3 & RF3_UNDEAD) ||
3317 (r_ptr->flags3 & RF3_NONLIVING))
3319 if (r_ptr->flags3 & RF3_UNDEAD)
3321 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3325 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3327 note = " is immune.";
3333 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3334 (randint(888) != 666)) ||
3335 (((r_ptr->level + randint(20)) > randint(p_ptr->lev + randint(10))) &&
3336 randint(100) != 66))
3339 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3351 /* Polymorph monster (Use "dam" as "power") */
3354 if (seen) obvious = TRUE;
3356 if (r_ptr->flags3 & (RF3_RES_ALL))
3359 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3361 note = " is immune.";
3364 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3367 /* Attempt to polymorph (see below) */
3370 /* Powerful monsters can resist */
3371 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3372 (r_ptr->flags1 & RF1_QUESTOR) ||
3373 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3376 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3378 note = " is unaffected!";
3385 /* No "real" damage */
3392 /* Clone monsters (Ignore "dam") */
3395 bool friendly = FALSE;
3398 if (seen) obvious = TRUE;
3400 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
3403 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3405 note = " is unaffected!";
3411 m_ptr->hp = m_ptr->maxhp;
3413 /* Attempt to clone. */
3414 if (multiply_monster(c_ptr->m_idx, TRUE, friendly, pet))
3417 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3425 /* No "real" damage */
3432 /* Heal Monster (use "dam" as amount of healing) */
3435 if (seen) obvious = TRUE;
3440 if (m_ptr->maxhp < m_ptr->max_maxhp)
3443 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3445 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3447 m_ptr->maxhp = m_ptr->max_maxhp;
3453 if (seen) obvious = TRUE;
3461 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3463 msg_format("%^s is no longer stunned.", m_name);
3467 if (m_ptr->confused)
3470 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3472 msg_format("%^s is no longer confused.", m_name);
3474 m_ptr->confused = 0;
3479 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3481 msg_format("%^s recovers %s courage.", m_name, m_poss);
3487 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3490 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3492 chg_virtue(V_VITALITY, 1);
3494 if (r_ptr->flags1 & RF1_UNIQUE)
3495 chg_virtue(V_INDIVIDUALISM, 1);
3497 if (is_friendly(m_ptr))
3498 chg_virtue(V_HONOUR, 1);
3499 else if (!(r_ptr->flags3 & RF3_EVIL))
3501 if (r_ptr->flags3 & RF3_GOOD)
3502 chg_virtue(V_COMPASSION, 2);
3504 chg_virtue(V_COMPASSION, 1);
3507 if (m_ptr->r_idx == MON_LEPER)
3510 chg_virtue(V_COMPASSION, 5);
3513 if (r_ptr->flags3 & RF3_ANIMAL)
3514 chg_virtue(V_NATURE, 1);
3516 /* Redraw (later) if needed */
3517 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3518 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3522 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3524 note = " looks healthier.";
3528 /* No "real" damage */
3534 /* Speed Monster (Ignore "dam") */
3537 if (seen) obvious = TRUE;
3543 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3545 note = " starts moving faster.";
3548 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3550 if (c_ptr->m_idx == p_ptr->riding)
3551 p_ptr->update |= (PU_BONUS);
3553 if (r_ptr->flags1 & RF1_UNIQUE)
3554 chg_virtue(V_INDIVIDUALISM, 1);
3555 if (is_friendly(m_ptr))
3556 chg_virtue(V_HONOUR, 1);
3558 /* No "real" damage */
3564 /* Slow Monster (Use "dam" as "power") */
3567 if (seen) obvious = TRUE;
3569 if (r_ptr->flags3 & (RF3_RES_ALL))
3572 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3574 note = " is immune.";
3577 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3580 /* Powerful monsters can resist */
3581 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3582 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3585 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3587 note = " is unaffected!";
3593 /* Normal monsters slow down */
3599 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3601 note = " starts moving slower.";
3604 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3606 if (c_ptr->m_idx == p_ptr->riding)
3607 p_ptr->update |= (PU_BONUS);
3610 /* No "real" damage */
3616 /* Sleep (Use "dam" as "power") */
3619 if (seen) obvious = TRUE;
3621 if (r_ptr->flags3 & (RF3_RES_ALL))
3624 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3626 note = " is immune.";
3629 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3632 /* Attempt a saving throw */
3633 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3634 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3635 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3637 /* Memorize a flag */
3638 if (r_ptr->flags3 & RF3_NO_SLEEP)
3640 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3643 /* No obvious effect */
3645 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3647 note = " is unaffected!";
3654 /* Go to sleep (much) later */
3656 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3658 note = " falls asleep!";
3664 /* No "real" damage */
3670 /* Sleep (Use "dam" as "power") */
3673 if (seen) obvious = TRUE;
3675 if (r_ptr->flags3 & (RF3_RES_ALL))
3678 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3680 note = " is immune.";
3683 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3686 /* Attempt a saving throw */
3687 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3688 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3691 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3693 note = " is unaffected!";
3700 /* Go to sleep (much) later */
3702 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3704 note = " is suspended!";
3710 /* No "real" damage */
3719 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3720 vir = virtue_number(V_HARMONY);
3723 dam += p_ptr->virtues[vir-1]/10;
3726 vir = virtue_number(V_INDIVIDUALISM);
3729 dam -= p_ptr->virtues[vir-1]/20;
3732 if (seen) obvious = TRUE;
3734 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3737 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3739 note = " is immune.";
3742 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3746 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3749 /* Attempt a saving throw */
3750 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3751 (r_ptr->flags3 & RF3_NO_CONF) ||
3752 (m_ptr->mflag2 & MFLAG_NOPET) ||
3753 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3755 /* Memorize a flag */
3756 if (r_ptr->flags3 & RF3_NO_CONF)
3758 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3762 /* No obvious effect */
3764 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3766 note = " is unaffected!";
3771 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3773 else if (p_ptr->aggravate)
3776 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3778 note = " hates you too much!";
3781 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3786 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3788 note = " suddenly seems friendly!";
3793 chg_virtue(V_INDIVIDUALISM, -1);
3794 if (r_ptr->flags3 & RF3_ANIMAL)
3795 chg_virtue(V_NATURE, 1);
3798 /* No "real" damage */
3803 /* Control undead */
3804 case GF_CONTROL_UNDEAD:
3807 if (seen) obvious = TRUE;
3809 vir = virtue_number(V_UNLIFE);
3812 dam += p_ptr->virtues[vir-1]/10;
3815 vir = virtue_number(V_INDIVIDUALISM);
3818 dam -= p_ptr->virtues[vir-1]/20;
3821 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3824 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3826 note = " is immune.";
3829 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3833 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3836 /* Attempt a saving throw */
3837 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3838 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3839 (m_ptr->mflag2 & MFLAG_NOPET) ||
3840 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3842 /* No obvious effect */
3844 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3846 note = " is unaffected!";
3850 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3852 else if (p_ptr->aggravate)
3855 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3857 note = " hates you too much!";
3860 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3865 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3867 note = " is in your thrall!";
3873 /* No "real" damage */
3879 case GF_CONTROL_DEMON:
3882 if (seen) obvious = TRUE;
3884 vir = virtue_number(V_UNLIFE);
3887 dam += p_ptr->virtues[vir-1]/10;
3890 vir = virtue_number(V_INDIVIDUALISM);
3893 dam -= p_ptr->virtues[vir-1]/20;
3896 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3899 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3901 note = " is immune.";
3904 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3908 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3911 /* Attempt a saving throw */
3912 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3913 (!(r_ptr->flags3 & RF3_DEMON)) ||
3914 (m_ptr->mflag2 & MFLAG_NOPET) ||
3915 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3917 /* No obvious effect */
3919 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3921 note = " is unaffected!";
3925 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3927 else if (p_ptr->aggravate)
3930 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3932 note = " hates you too much!";
3935 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3940 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3942 note = " is in your thrall!";
3948 /* No "real" damage */
3954 case GF_CONTROL_ANIMAL:
3958 if (seen) obvious = TRUE;
3960 vir = virtue_number(V_NATURE);
3963 dam += p_ptr->virtues[vir-1]/10;
3966 vir = virtue_number(V_INDIVIDUALISM);
3969 dam -= p_ptr->virtues[vir-1]/20;
3972 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3975 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3977 note = " is immune.";
3980 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3984 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3987 /* Attempt a saving throw */
3988 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3989 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3990 (m_ptr->mflag2 & MFLAG_NOPET) ||
3991 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3992 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3994 /* Memorize a flag */
3995 if (r_ptr->flags3 & (RF3_NO_CONF))
3997 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4001 /* No obvious effect */
4003 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4005 note = " is unaffected!";
4009 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4011 else if (p_ptr->aggravate)
4014 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4016 note = " hates you too much!";
4019 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4024 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4026 note = " is tamed!";
4031 if (r_ptr->flags3 & RF3_ANIMAL)
4032 chg_virtue(V_NATURE, 1);
4035 /* No "real" damage */
4041 case GF_CONTROL_LIVING:
4045 vir = virtue_number(V_UNLIFE);
4046 if (seen) obvious = TRUE;
4048 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4049 vir = virtue_number(V_UNLIFE);
4052 dam -= p_ptr->virtues[vir-1]/10;
4055 vir = virtue_number(V_INDIVIDUALISM);
4058 dam -= p_ptr->virtues[vir-1]/20;
4061 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4062 if (dam < 1) dam = 1;
4064 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4066 msg_format("You stare into %s.", m_name);
4068 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4071 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4073 note = " is immune.";
4076 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4080 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4083 /* Attempt a saving throw */
4084 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4085 (m_ptr->mflag2 & MFLAG_NOPET) ||
4086 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
4087 ((r_ptr->level+10) > randint(dam)))
4090 /* No obvious effect */
4092 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4094 note = " is unaffected!";
4098 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4100 else if (p_ptr->aggravate)
4103 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4105 note = " hates you too much!";
4108 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4113 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4115 note = " is tamed!";
4120 if (r_ptr->flags3 & RF3_ANIMAL)
4121 chg_virtue(V_NATURE, 1);
4124 /* No "real" damage */
4129 /* Confusion (Use "dam" as "power") */
4132 if (seen) obvious = TRUE;
4134 if (r_ptr->flags3 & (RF3_RES_ALL))
4137 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4139 note = " is immune.";
4142 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4145 /* Get confused later */
4146 do_conf = damroll(3, (dam / 2)) + 1;
4148 /* Attempt a saving throw */
4149 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4150 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4151 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4153 /* Memorize a flag */
4154 if (r_ptr->flags3 & (RF3_NO_CONF))
4156 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4162 /* No obvious effect */
4164 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4166 note = " is unaffected!";
4172 /* No "real" damage */
4179 if (seen) obvious = TRUE;
4181 if (r_ptr->flags3 & (RF3_RES_ALL))
4184 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4186 note = " is immune.";
4189 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4192 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4194 /* Attempt a saving throw */
4195 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4196 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4201 /* No obvious effect */
4203 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4205 note = " is unaffected!";
4211 /* No "real" damage */
4219 /* Lite, but only hurts susceptible creatures */
4227 if (r_ptr->flags3 & (RF3_RES_ALL))
4233 if (r_ptr->flags3 & (RF3_HURT_LITE))
4235 /* Obvious effect */
4236 if (seen) obvious = TRUE;
4238 /* Memorize the effects */
4239 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4241 /* Special effect */
4243 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4244 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4246 note = " cringes from the light!";
4247 note_dies = " shrivels away in the light!";
4252 /* Normally no damage */
4264 /* Lite -- opposite of Dark */
4267 if (seen) obvious = TRUE;
4268 if (r_ptr->flags3 & (RF3_RES_ALL))
4271 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4273 note = " is immune.";
4276 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4279 if (r_ptr->flags4 & (RF4_BR_LITE))
4282 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4287 dam *= 2; dam /= (randint(6)+6);
4289 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4291 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4293 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4294 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4296 note = " cringes from the light!";
4297 note_dies = " shrivels away in the light!";
4306 /* Dark -- opposite of Lite */
4309 if (seen) obvious = TRUE;
4311 if (r_ptr->flags3 & (RF3_RES_ALL))
4314 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4316 note = " is immune.";
4319 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4322 /* Likes darkness... */
4323 if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
4324 (r_ptr->flags3 & RF3_ORC) ||
4325 (r_ptr->flags3 & RF3_HURT_LITE))
4328 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4333 dam *= 2; dam /= (randint(6)+6);
4342 if (r_ptr->flags3 & (RF3_RES_ALL))
4347 /* Hurt by rock remover */
4348 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4351 if (seen) obvious = TRUE;
4353 /* Memorize the effects */
4354 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4356 /* Cute little message */
4358 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4359 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4361 note = " loses some skin!";
4362 note_dies = " dissolves!";
4367 /* Usually, ignore the effects */
4378 /* Teleport undead (Use "dam" as "power") */
4379 case GF_AWAY_UNDEAD:
4381 /* Only affect undead */
4382 if (r_ptr->flags3 & (RF3_UNDEAD))
4384 bool resists_tele = FALSE;
4386 if (r_ptr->flags3 & (RF3_RES_TELE))
4388 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4390 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4392 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4394 note = " is unaffected!";
4397 resists_tele = TRUE;
4399 else if (r_ptr->level > randint(100))
4401 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4403 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4408 resists_tele = TRUE;
4414 if (seen) obvious = TRUE;
4415 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4427 /* No "real" damage */
4433 /* Teleport evil (Use "dam" as "power") */
4436 /* Only affect evil */
4437 if (r_ptr->flags3 & (RF3_EVIL))
4439 bool resists_tele = FALSE;
4441 if (r_ptr->flags3 & (RF3_RES_TELE))
4443 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4445 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4447 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4449 note = " is unaffected!";
4452 resists_tele = TRUE;
4454 else if (r_ptr->level > randint(100))
4456 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4458 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4463 resists_tele = TRUE;
4469 if (seen) obvious = TRUE;
4470 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4482 /* No "real" damage */
4488 /* Teleport monster (Use "dam" as "power") */
4491 bool resists_tele = FALSE;
4492 if (r_ptr->flags3 & (RF3_RES_TELE))
4494 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4496 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4498 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4500 note = " is unaffected!";
4503 resists_tele = TRUE;
4505 else if (r_ptr->level > randint(100))
4507 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4509 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4514 resists_tele = TRUE;
4521 if (seen) obvious = TRUE;
4523 /* Prepare to teleport */
4527 /* No "real" damage */
4533 /* Turn undead (Use "dam" as "power") */
4534 case GF_TURN_UNDEAD:
4536 if (r_ptr->flags3 & (RF3_RES_ALL))
4541 /* Only affect undead */
4542 if (r_ptr->flags3 & (RF3_UNDEAD))
4544 /* Learn about type */
4545 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4548 if (seen) obvious = TRUE;
4550 /* Apply some fear */
4551 do_fear = damroll(3, (dam / 2)) + 1;
4553 /* Attempt a saving throw */
4554 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4556 /* No obvious effect */
4558 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4560 note = " is unaffected!";
4575 /* No "real" damage */
4581 /* Turn evil (Use "dam" as "power") */
4584 if (r_ptr->flags3 & (RF3_RES_ALL))
4589 /* Only affect evil */
4590 if (r_ptr->flags3 & (RF3_EVIL))
4592 /* Learn about type */
4593 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4596 if (seen) obvious = TRUE;
4598 /* Apply some fear */
4599 do_fear = damroll(3, (dam / 2)) + 1;
4601 /* Attempt a saving throw */
4602 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4604 /* No obvious effect */
4606 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4608 note = " is unaffected!";
4623 /* No "real" damage */
4629 /* Turn monster (Use "dam" as "power") */
4632 if (r_ptr->flags3 & (RF3_RES_ALL))
4638 if (seen) obvious = TRUE;
4640 /* Apply some fear */
4641 do_fear = damroll(3, (dam / 2)) + 1;
4643 /* Attempt a saving throw */
4644 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4645 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4646 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4648 /* No obvious effect */
4650 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4652 note = " is unaffected!";
4659 /* No "real" damage */
4666 case GF_DISP_UNDEAD:
4668 if (r_ptr->flags3 & (RF3_RES_ALL))
4674 /* Only affect undead */
4675 if (r_ptr->flags3 & (RF3_UNDEAD))
4677 /* Learn about type */
4678 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4681 if (seen) obvious = TRUE;
4685 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4686 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4688 note = " shudders.";
4689 note_dies = " dissolves!";
4711 if (r_ptr->flags3 & (RF3_RES_ALL))
4717 /* Only affect evil */
4718 if (r_ptr->flags3 & (RF3_EVIL))
4720 /* Learn about type */
4721 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4724 if (seen) obvious = TRUE;
4728 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4729 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4731 note = " shudders.";
4732 note_dies = " dissolves!";
4753 if (r_ptr->flags3 & (RF3_RES_ALL))
4759 /* Only affect good */
4760 if (r_ptr->flags3 & (RF3_GOOD))
4762 /* Learn about type */
4763 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
4766 if (seen) obvious = TRUE;
4770 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4771 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4773 note = " shudders.";
4774 note_dies = " dissolves!";
4793 case GF_DISP_LIVING:
4795 if (r_ptr->flags3 & (RF3_RES_ALL))
4801 /* Only affect non-undead */
4802 if (monster_living(r_ptr))
4805 if (seen) obvious = TRUE;
4809 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4810 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4812 note = " shudders.";
4813 note_dies = " dissolves!";
4834 if (r_ptr->flags3 & (RF3_RES_ALL))
4840 /* Only affect demons */
4841 if (r_ptr->flags3 & (RF3_DEMON))
4843 /* Learn about type */
4844 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
4847 if (seen) obvious = TRUE;
4851 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4852 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4854 note = " shudders.";
4855 note_dies = " dissolves!";
4873 /* Dispel monster */
4876 if (r_ptr->flags3 & (RF3_RES_ALL))
4883 if (seen) obvious = TRUE;
4887 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4888 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4890 note = " shudders.";
4891 note_dies = " dissolves!";
4901 if (seen) obvious = TRUE;
4902 if (r_ptr->flags3 & (RF3_RES_ALL))
4905 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4907 note = " is immune.";
4910 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4914 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4918 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
4920 msg_format("You draws psychic energy from %s.", m_name);
4923 (void)hp_player(dam);
4928 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
4930 msg_format("%s is unaffected.", m_name);
4940 if (seen) obvious = TRUE;
4943 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4945 msg_format("You gazes intently at %s.", m_name);
4948 if (r_ptr->flags3 & (RF3_RES_ALL))
4951 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4953 note = " is immune.";
4956 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4960 /* Attempt a saving throw */
4961 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4962 (r_ptr->flags3 & RF3_NO_CONF) ||
4963 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4965 /* Memorize a flag */
4966 if (r_ptr->flags3 & (RF3_NO_CONF))
4968 r_ptr->r_flags3 |= (RF3_NO_CONF);
4971 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
4973 note = "is unaffected!";
4980 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
4981 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
4983 msg_format("%^s is blasted by psionic energy.", m_name);
4984 note_dies = " collapses, a mindless husk.";
4987 do_conf = rand_int(8) + 8;
4993 case GF_BRAIN_SMASH:
4995 if (seen) obvious = TRUE;
4998 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
5000 msg_format("You gazes intently at %s.", m_name);
5003 if (r_ptr->flags3 & (RF3_RES_ALL))
5006 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5008 note = " is immune.";
5011 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5015 /* Attempt a saving throw */
5016 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5017 (r_ptr->flags3 & RF3_NO_CONF) ||
5018 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
5020 /* Memorize a flag */
5021 if (r_ptr->flags3 & (RF3_NO_CONF))
5023 r_ptr->r_flags3 |= (RF3_NO_CONF);
5026 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5028 note = "is unaffected!";
5035 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5036 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5038 msg_format("%^s is blasted by psionic energy.", m_name);
5039 note_dies = " collapses, a mindless husk.";
5042 do_conf = rand_int(8) + 8;
5043 do_stun = rand_int(8) + 8;
5044 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5045 if (c_ptr->m_idx == p_ptr->riding)
5046 p_ptr->update |= (PU_BONUS);
5054 if (seen) obvious = TRUE;
5057 msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5059 msg_format("You points at %s and curses.", m_name);
5062 if (r_ptr->flags3 & (RF3_RES_ALL))
5065 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5067 note = " is immune.";
5070 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5074 /* Attempt a saving throw */
5075 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5079 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5081 note = "is unaffected!";
5091 if (seen) obvious = TRUE;
5094 msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5096 msg_format("You points at %s and curses horribly.", m_name);
5099 if (r_ptr->flags3 & (RF3_RES_ALL))
5102 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5104 note = " is immune.";
5107 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5111 /* Attempt a saving throw */
5112 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5116 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5118 note = "is unaffected!";
5128 if (seen) obvious = TRUE;
5131 msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
5133 msg_format("You points at %s, incanting terribly!", m_name);
5136 if (r_ptr->flags3 & (RF3_RES_ALL))
5139 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5141 note = " is immune.";
5144 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5148 /* Attempt a saving throw */
5149 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5153 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5155 note = "is unaffected!";
5165 if (seen) obvious = TRUE;
5168 msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
5170 msg_format("You points at %s, screaming th word, 'DIE!'.", m_name);
5173 if (r_ptr->flags3 & (RF3_RES_ALL))
5176 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5178 note = " is immune.";
5181 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5185 /* Attempt a saving throw */
5186 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5190 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5192 note = "is unaffected!";
5202 if (seen) obvious = TRUE;
5204 if (r_ptr->flags3 & (RF3_RES_ALL))
5207 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5209 note = " is immune.";
5212 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5216 if (r_ptr->flags1 & RF1_UNIQUE)
5219 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5221 note = "is unaffected!";
5227 if ((p_ptr->lev + randint(dam)) >
5228 (r_ptr->level + randint(200)))
5230 dam = ((40 + randint(20)) * m_ptr->hp) / 100;
5232 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5237 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5247 /* Capture monster */
5251 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5252 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5255 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5257 msg_format("%^s is unaffected.", m_name);
5263 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5264 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
5265 nokori_hp = m_ptr->maxhp * 3 / 10;
5267 nokori_hp = m_ptr->maxhp * 3 / 20;
5269 if (m_ptr->hp >= nokori_hp)
5272 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5274 msg_format("You need to weaken %s more.", m_name);
5278 else if (m_ptr->hp < rand_int(nokori_hp))
5280 if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5282 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5284 msg_format("You captures %^s!", m_name);
5286 cap_mon = m_list[c_ptr->m_idx].r_idx;
5287 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5288 cap_hp = m_list[c_ptr->m_idx].hp;
5289 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5290 if (m_list[c_ptr->m_idx].nickname)
5291 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5294 if (c_ptr->m_idx == p_ptr->riding)
5296 if (rakuba(-1, FALSE))
5299 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5301 msg_format("You have fallen from %s.", m_name);
5306 delete_monster_idx(c_ptr->m_idx);
5313 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5315 msg_format("You failed to capture %s.", m_name);
5324 if (seen) obvious = TRUE;
5326 if (dam == HISSATSU_NYUSIN)
5330 bool success = FALSE;
5331 for (i = 0; i < 8; i++)
5333 if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
5336 if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
5345 if ((ny != py) || (nx != px))
5347 teleport_player_to(ny, nx, FALSE);
5349 msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
5351 msg_format("You quickly jump in and attack %s!", m_name);
5358 msg_print("¼ºÇÔ¡ª");
5360 msg_print("Failed!");
5367 return (py_attack(y, x, dam));
5370 msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
5372 msg_print("You attack the empty air.");
5378 /* Sleep (Use "dam" as "power") */
5384 if (seen) obvious = TRUE;
5386 if (r_ptr->flags3 & (RF3_RES_ALL))
5389 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5391 note = " is immune.";
5394 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5397 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5400 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5402 note = " is immune!";
5406 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5412 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5414 note = " is immune!";
5421 if (one_in_(5)) effect = 1;
5422 else if (one_in_(4)) effect = 2;
5423 else if (one_in_(3)) effect = 3;
5428 /* Powerful monsters can resist */
5429 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5430 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5433 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5435 note = " is unaffected!";
5441 /* Normal monsters slow down */
5447 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5449 note = " starts moving slower.";
5452 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5454 if (c_ptr->m_idx == p_ptr->riding)
5455 p_ptr->update |= (PU_BONUS);
5459 else if (effect == 2)
5461 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5463 /* Attempt a saving throw */
5464 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5465 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5470 /* No obvious effect */
5472 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5474 note = " is unaffected!";
5481 else if (effect == 3)
5483 /* Attempt a saving throw */
5484 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5485 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5486 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5488 /* Memorize a flag */
5489 if (r_ptr->flags3 & RF3_NO_SLEEP)
5491 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5494 /* No obvious effect */
5496 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5498 note = " is unaffected!";
5505 /* Go to sleep (much) later */
5507 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5509 note = " falls asleep!";
5519 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5521 note = " is immune!";
5525 /* No "real" damage */
5534 if (seen) obvious = TRUE;
5536 if (r_ptr->flags3 & (RF3_RES_ALL))
5539 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5541 note = " is immune.";
5544 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5548 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)
5555 if ((r_ptr->level > rand_int(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
5562 delete_monster_idx(c_ptr->m_idx);
5564 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5566 msg_format("%^s disappered!",m_name);
5570 take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5572 take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5576 chg_virtue(V_VITALITY, -1);
5581 p_ptr->redraw |= (PR_HP);
5584 p_ptr->window |= (PW_PLAYER);
5591 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5593 note = "is unaffected!";
5596 if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
5604 msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
5606 msg_format("You take a photograph of %s.",m_name);
5609 if (r_ptr->flags3 & (RF3_HURT_LITE))
5611 /* Obvious effect */
5612 if (seen) obvious = TRUE;
5614 /* Memorize the effects */
5615 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5617 /* Special effect */
5619 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5620 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5622 note = " cringes from the light!";
5623 note_dies = " shrivels away in the light!";
5628 /* Normally no damage */
5635 photo = m_ptr->r_idx;
5642 case GF_BLOOD_CURSE:
5644 if (seen) obvious = TRUE;
5645 if (r_ptr->flags3 & (RF3_RES_ALL))
5648 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5650 note = " is immune.";
5653 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5673 /* Absolutely no effect */
5674 if (skipped) return (FALSE);
5676 /* "Unique" monsters cannot be polymorphed */
5677 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5679 /* Quest monsters cannot be polymorphed */
5680 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5682 if (p_ptr->riding & (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5684 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5685 if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
5687 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5692 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5693 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5696 /* Modify the damage */
5698 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5700 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
5702 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5705 /* Check for death */
5706 if (dam > m_ptr->hp)
5708 /* Extract method of death */
5712 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5713 else if (do_poly && (randint(90) > r_ptr->level))
5715 if (polymorph_monster(y, x))
5718 if (seen) obvious = TRUE;
5720 /* Monster polymorphs */
5722 note = "¤¬ÊѿȤ·¤¿¡ª";
5728 /* Turn off the damage */
5731 /* Hack -- Get new monster */
5732 m_ptr = &m_list[c_ptr->m_idx];
5734 /* Hack -- Get new race */
5735 r_ptr = &r_info[m_ptr->r_idx];
5741 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5743 note = " is unaffected!";
5749 /* Handle "teleport" */
5753 if (seen) obvious = TRUE;
5757 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5759 note = " disappears!";
5762 chg_virtue(V_VALOUR, -1);
5765 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
5767 /* Hack -- get new location */
5771 /* Hack -- get new grid */
5772 c_ptr = &cave[y][x];
5775 /* Sound and Impact breathers never stun */
5777 !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
5778 !(r_ptr->flags4 & (RF4_BR_WALL)) &&
5779 !(r_ptr->flags3 & (RF3_NO_STUN)))
5782 if (seen) obvious = TRUE;
5788 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5790 note = " is more dazed.";
5793 tmp = m_ptr->stunned + (do_stun / 2);
5798 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5800 note = " is dazed.";
5807 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5813 /* Confusion and Chaos breathers (and sleepers) never confuse */
5815 !(r_ptr->flags3 & (RF3_NO_CONF)) &&
5816 !(r_ptr->flags4 & (RF4_BR_CONF)) &&
5817 !(r_ptr->flags4 & (RF4_BR_CHAO)))
5820 if (seen) obvious = TRUE;
5822 /* Already partially confused */
5823 if (m_ptr->confused)
5826 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5828 note = " looks more confused.";
5831 tmp = m_ptr->confused + (do_conf / 2);
5834 /* Was not confused */
5838 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5840 note = " looks confused.";
5846 /* Apply confusion */
5847 m_ptr->confused = (tmp < 200) ? tmp : 200;
5855 if (seen) obvious = TRUE;
5857 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
5862 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5864 note = " seems weakened.";
5866 m_ptr->maxhp -= do_time;
5867 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
5877 tmp = m_ptr->monfear + do_fear;
5880 m_ptr->monfear = (tmp < 200) ? tmp : 200;
5887 /* If another monster did the damage, hurt the monster by hand */
5890 /* Redraw (later) if needed */
5891 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5892 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5894 /* Wake the monster up */
5897 /* Hurt the monster */
5905 if (is_pet(m_ptr) && !(m_ptr->ml))
5908 /* Give detailed messages if destroyed */
5911 monster_desc(m_name, m_ptr, 0x100);
5914 msg_format("%^s%s", m_name, note);
5922 monster_gain_exp(who, m_ptr->r_idx);
5924 /* Generate treasure, etc */
5925 monster_death(c_ptr->m_idx, FALSE);
5927 /* Delete the monster */
5928 delete_monster_idx(c_ptr->m_idx);
5933 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
5935 msg_print("You feel sad for a moment.");
5941 /* Damaged monster */
5944 /* Give detailed messages if visible or destroyed */
5945 if (note && seen) msg_format("%^s%s", m_name, note);
5947 /* Hack -- Pain message */
5950 message_pain(c_ptr->m_idx, dam);
5957 /* Hack -- handle sleep */
5958 if (do_sleep) m_ptr->csleep = do_sleep;
5962 else if (heal_leper)
5965 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
5967 msg_print("The Mangy looking leper is healed!");
5970 delete_monster_idx(c_ptr->m_idx);
5972 /* If the player did it, give him experience, check fear */
5973 else if (typ != GF_DRAIN_MANA)
5977 /* Hurt the monster, check for fear and death */
5978 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
5983 /* Damaged monster */
5986 /* HACK - anger the monster before showing the sleep message */
5987 if (do_sleep) anger_monster(m_ptr);
5989 /* Give detailed messages if visible or destroyed */
5992 msg_format("%s%s", m_name, note);
5994 msg_format("%^s%s", m_name, note);
5998 /* Hack -- Pain message */
6001 message_pain(c_ptr->m_idx, dam);
6004 /* Anger monsters */
6005 if (((dam > 0) || get_angry) && !do_sleep)
6006 anger_monster(m_ptr);
6009 if ((fear || do_fear) && (m_ptr->ml))
6016 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6018 msg_format("%^s flees in terror!", m_name);
6023 /* Hack -- handle sleep */
6024 if (do_sleep) m_ptr->csleep = do_sleep;
6028 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6030 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6034 switch (randint(28))
6040 msg_print("ÃÏÌ̤¬Íɤ줿...");
6042 msg_print("The ground trembles...");
6045 earthquake(ty, tx, 4 + rand_int(4));
6046 if (!one_in_(6)) break;
6048 case 3: case 4: case 5: case 6:
6051 int dam = damroll(10, 10);
6053 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6055 msg_print("A portal opens to a plane of raw mana!");
6058 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6059 if (!one_in_(6)) break;
6065 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6067 msg_print("Space warps about you!");
6070 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6071 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6072 if (!one_in_(6)) break;
6074 case 9: case 10: case 11:
6076 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6078 msg_print("You feel a surge of energy!");
6081 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6082 if (!one_in_(6)) break;
6083 case 12: case 13: case 14: case 15: case 16:
6084 aggravate_monsters(0);
6085 if (!one_in_(6)) break;
6087 count += activate_hi_summon(ty, tx, TRUE);
6088 if (!one_in_(6)) break;
6089 case 19: case 20: case 21: case 22:
6091 bool pet = FALSE, friendly = FALSE;
6101 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
6102 if (!one_in_(6)) break;
6104 case 23: case 24: case 25:
6105 if (p_ptr->hold_life && (rand_int(100) < 75)) break;
6107 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6109 msg_print("You feel your life draining away...");
6112 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6113 else lose_exp(p_ptr->exp / 16);
6114 if (!one_in_(6)) break;
6115 case 26: case 27: case 28:
6124 (void)do_dec_stat(i);
6133 (void)do_dec_stat(rand_int(6));
6142 if (p_ptr->inside_battle)
6144 p_ptr->health_who = c_ptr->m_idx;
6145 p_ptr->redraw |= (PR_HEALTH);
6149 /* XXX XXX XXX Verify this code */
6151 /* Update the monster */
6152 update_mon(c_ptr->m_idx, FALSE);
6154 /* Redraw the monster grid */
6158 /* Update monster recall window */
6159 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6162 p_ptr->window |= (PW_MONSTER);
6165 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6169 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6171 set_target(m_ptr, monster_target_y, monster_target_x);
6174 else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
6176 set_target(m_ptr, m_list[who].fy, m_list[who].fx);
6180 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6182 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6183 rakubadam_m = (dam > 200) ? 200 : dam;
6192 /* Get local object */
6195 /* Prepare to make a Blade of Chaos */
6196 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6198 q_ptr->pval = photo;
6200 /* Mark the item as fully known */
6201 q_ptr->ident |= (IDENT_MENTAL);
6203 /* Drop it in the dungeon */
6204 (void)drop_near(q_ptr, -1, py, px);
6212 /* Return "Anything seen?" */
6218 * Helper function for "project()" below.
6220 * Handle a beam/bolt/ball causing damage to the player.
6222 * This routine takes a "source monster" (by index), a "distance", a default
6223 * "damage", and a "damage type". See "project_m()" above.
6225 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6226 * is reduced (see "project_m()" above). This can happen if a monster breathes
6227 * at the player and hits a wall instead.
6229 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6230 * to know if this is actually a ball or a bolt spell
6233 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6234 * we just assume that the effects were obvious, for historical reasons.
6236 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int a_rad, int monspell)
6240 /* Hack -- assume obvious */
6241 bool obvious = TRUE;
6243 /* Player blind-ness */
6244 bool blind = (p_ptr->blind ? TRUE : FALSE);
6246 /* Player needs a "description" (he is blind) */
6249 /* Source monster */
6250 monster_type *m_ptr;
6252 /* Monster name (for attacks) */
6255 /* Monster name (for damage) */
6258 /* Hack -- messages */
6262 /* Player is not here */
6263 if ((x != px) || (y != py)) return (FALSE);
6265 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (rand_int(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6271 /* Player cannot hurt himself */
6272 if (!who) return (FALSE);
6273 if (who == p_ptr->riding) return (FALSE);
6275 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))
6278 int max_attempts = 10;
6281 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6282 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6283 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6285 if (blind) msg_print("Something bounces!");
6286 else msg_print("The attack bounces!");
6290 /* Choose 'new' target */
6293 t_y = m_list[who].fy - 1 + randint(3);
6294 t_x = m_list[who].fx - 1 + randint(3);
6297 while (max_attempts && in_bounds2u(t_y, t_x) &&
6298 !(player_has_los_bold(t_y, t_x)));
6300 if (max_attempts < 1)
6302 t_y = m_list[who].fy;
6303 t_x = m_list[who].fx;
6306 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL), monspell);
6313 /* Limit maximum damage */
6314 if (dam > 1600) dam = 1600;
6316 /* Reduce damage by distance */
6317 dam = (dam + r) / (r + 1);
6320 /* If the player is blind, be more descriptive */
6321 if (blind) fuzzy = TRUE;
6324 /* Get the source monster */
6325 m_ptr = &m_list[who];
6327 /* Get the monster name */
6328 monster_desc(m_name, m_ptr, 0);
6330 /* Get the monster's real name (gotten before polymorph!) */
6331 strcpy(killer, who_name);
6333 /* Analyze the damage */
6336 /* Standard damage -- hurts inventory too */
6340 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6342 if (fuzzy) msg_print("You are hit by acid!");
6345 acid_dam(dam, killer, monspell);
6349 /* Standard damage -- hurts inventory too */
6353 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6355 if (fuzzy) msg_print("You are hit by fire!");
6358 fire_dam(dam, killer, monspell);
6362 /* Standard damage -- hurts inventory too */
6366 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6368 if (fuzzy) msg_print("You are hit by cold!");
6371 cold_dam(dam, killer, monspell);
6375 /* Standard damage -- hurts inventory too */
6379 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6381 if (fuzzy) msg_print("You are hit by lightning!");
6384 elec_dam(dam, killer, monspell);
6388 /* Standard damage -- also poisons player */
6391 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6393 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6395 if (fuzzy) msg_print("You are hit by poison!");
6398 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6399 if (double_resist) dam = (dam + 2) / 3;
6401 if ((!(double_resist || p_ptr->resist_pois)) &&
6402 one_in_(HURT_CHANCE))
6407 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6409 if (!(double_resist || p_ptr->resist_pois))
6411 set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
6416 /* Standard damage -- also poisons / mutates player */
6419 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6421 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6423 if (fuzzy) msg_print("You are hit by radiation!");
6426 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6427 if (double_resist) dam = (2 * dam + 2) / 5;
6428 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6429 if (!(double_resist || p_ptr->resist_pois))
6431 set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
6433 if (one_in_(5)) /* 6 */
6436 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6438 msg_print("You undergo a freakish metamorphosis!");
6441 if (one_in_(4)) /* 4 */
6449 inven_damage(set_acid_destroy, 2);
6455 /* Standard damage */
6459 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6461 if (fuzzy) msg_print("You are hit by something!");
6464 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6468 /* Holy Orb -- Player only takes partial damage */
6472 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6474 if (fuzzy) msg_print("You are hit by something!");
6477 if (p_ptr->align > 10)
6479 else if (p_ptr->align < -10)
6481 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6488 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6490 if (fuzzy) msg_print("You are hit by something!");
6493 if (p_ptr->align > 10)
6495 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6499 /* Arrow -- XXX no dodging */
6503 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6505 if (fuzzy) msg_print("You are hit by something sharp!");
6508 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6511 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6513 msg_print("You cut down the arrow!");
6517 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6521 /* Plasma -- XXX No resist */
6525 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6527 if (fuzzy) msg_print("You are hit by something *HOT*!");
6530 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6532 if (!p_ptr->resist_sound)
6534 int k = (randint((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6535 (void)set_stun(p_ptr->stun + k);
6538 if (!(p_ptr->resist_fire ||
6539 p_ptr->oppose_fire ||
6540 music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
6541 p_ptr->immune_fire))
6543 inven_damage(set_acid_destroy, 3);
6549 /* Nether -- drain experience */
6553 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6555 if (fuzzy) msg_print("You are hit by nether forces!");
6559 if (p_ptr->resist_neth)
6561 if (!prace_is_(RACE_SPECTRE))
6562 dam *= 6; dam /= (randint(4) + 7);
6564 else if (p_ptr->prace != RACE_ANDROID)
6566 if (p_ptr->hold_life && (rand_int(100) < 75))
6569 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6571 msg_print("You keep hold of your life force!");
6575 else if (p_ptr->hold_life)
6578 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6580 msg_print("You feel your life slipping away!");
6583 lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6588 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6590 msg_print("You feel your life draining away!");
6593 lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6597 if (prace_is_(RACE_SPECTRE))
6600 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6602 msg_print("You feel invigorated!");
6606 learn_spell(monspell);
6610 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6616 /* Water -- stun/confuse */
6620 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6622 if (fuzzy) msg_print("You are hit by something wet!");
6625 if (!p_ptr->resist_sound)
6627 set_stun(p_ptr->stun + randint(40));
6629 if (!p_ptr->resist_conf)
6631 set_confused(p_ptr->confused + randint(5) + 5);
6636 inven_damage(set_cold_destroy, 3);
6639 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6643 /* Chaos -- many effects */
6647 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6649 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6652 if (p_ptr->resist_chaos)
6654 dam *= 6; dam /= (randint(4) + 7);
6656 if (!p_ptr->resist_conf)
6658 (void)set_confused(p_ptr->confused + rand_int(20) + 10);
6660 if (!p_ptr->resist_chaos)
6662 (void)set_image(p_ptr->image + randint(10));
6666 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6668 msg_print("Your body is twisted by chaos!");
6671 (void)gain_random_mutation(0);
6674 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6676 if (p_ptr->prace == RACE_ANDROID)
6679 else if (p_ptr->hold_life && (rand_int(100) < 75))
6682 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6684 msg_print("You keep hold of your life force!");
6688 else if (p_ptr->hold_life)
6691 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6693 msg_print("You feel your life slipping away!");
6696 lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6701 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6703 msg_print("You feel your life draining away!");
6706 lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6709 if (!p_ptr->resist_chaos || one_in_(9))
6711 inven_damage(set_elec_destroy, 2);
6712 inven_damage(set_fire_destroy, 2);
6714 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6718 /* Shards -- mostly cutting */
6722 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6724 if (fuzzy) msg_print("You are hit by something sharp!");
6727 if (p_ptr->resist_shard)
6729 dam *= 6; dam /= (randint(4) + 7);
6733 (void)set_cut(p_ptr->cut + dam);
6736 if (!p_ptr->resist_shard || one_in_(13))
6738 inven_damage(set_cold_destroy, 2);
6741 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6745 /* Sound -- mostly stunning */
6749 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6751 if (fuzzy) msg_print("You are hit by a loud noise!");
6754 if (p_ptr->resist_sound)
6756 dam *= 5; dam /= (randint(4) + 7);
6760 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
6761 (void)set_stun(p_ptr->stun + k);
6764 if (!p_ptr->resist_sound || one_in_(13))
6766 inven_damage(set_cold_destroy, 2);
6769 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6773 /* Pure confusion */
6777 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6779 if (fuzzy) msg_print("You are hit by something puzzling!");
6782 if (p_ptr->resist_conf)
6784 dam *= 5; dam /= (randint(4) + 7);
6786 if (!p_ptr->resist_conf)
6788 (void)set_confused(p_ptr->confused + randint(20) + 10);
6790 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6794 /* Disenchantment -- see above */
6798 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6800 if (fuzzy) msg_print("You are hit by something static!");
6803 if (p_ptr->resist_disen)
6805 dam *= 6; dam /= (randint(4) + 7);
6809 (void)apply_disenchant(0);
6811 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6815 /* Nexus -- see above */
6819 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6821 if (fuzzy) msg_print("You are hit by something strange!");
6824 if (p_ptr->resist_nexus)
6826 dam *= 6; dam /= (randint(4) + 7);
6832 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6836 /* Force -- mostly stun */
6840 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6842 if (fuzzy) msg_print("You are hit by kinetic force!");
6845 if (!p_ptr->resist_sound)
6847 (void)set_stun(p_ptr->stun + randint(20));
6849 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6854 /* Rocket -- stun, cut */
6858 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6860 if (fuzzy) msg_print("There is an explosion!");
6863 if (!p_ptr->resist_sound)
6865 (void)set_stun(p_ptr->stun + randint(20));
6867 if (p_ptr->resist_shard)
6873 (void)set_cut(p_ptr-> cut + ( dam / 2));
6876 if ((!p_ptr->resist_shard) || one_in_(12))
6878 inven_damage(set_cold_destroy, 3);
6881 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6885 /* Inertia -- slowness */
6889 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6891 if (fuzzy) msg_print("You are hit by something slow!");
6894 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
6895 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6899 /* Lite -- blinding */
6903 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6905 if (fuzzy) msg_print("You are hit by something!");
6908 if (p_ptr->resist_lite)
6910 dam *= 4; dam /= (randint(4) + 7);
6912 else if (!blind && !p_ptr->resist_blind)
6914 (void)set_blind(p_ptr->blind + randint(5) + 2);
6916 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
6919 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
6921 msg_print("The light scorches your flesh!");
6926 else if (prace_is_(RACE_S_FAIRY))
6930 if (p_ptr->wraith_form) dam *= 2;
6931 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6933 if (p_ptr->wraith_form)
6935 p_ptr->wraith_form = 0;
6937 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
6939 msg_print("The light forces you out of your incorporeal shadow form.");
6942 p_ptr->redraw |= PR_MAP;
6943 /* Update monsters */
6944 p_ptr->update |= (PU_MONSTERS);
6946 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6948 /* Redraw status bar */
6949 p_ptr->redraw |= (PR_STATUS);
6956 /* Dark -- blinding */
6960 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6962 if (fuzzy) msg_print("You are hit by something!");
6965 if (p_ptr->resist_dark)
6967 dam *= 4; dam /= (randint(4) + 7);
6969 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
6971 else if (!blind && !p_ptr->resist_blind)
6973 (void)set_blind(p_ptr->blind + randint(5) + 2);
6975 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6979 /* Time -- bolt fewer effects XXX */
6983 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
6985 if (fuzzy) msg_print("You are hit by a blast from the past!");
6988 if (p_ptr->resist_time)
6991 dam /= (randint(4) + 7);
6993 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
6995 msg_print("You feel as if time is passing you by.");
7001 switch (randint(10))
7003 case 1: case 2: case 3: case 4: case 5:
7005 if (p_ptr->prace == RACE_ANDROID) break;
7007 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7009 msg_print("You feel life has clocked back.");
7012 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7016 case 6: case 7: case 8: case 9:
7021 case 1: k = A_STR; act = "¶¯¤¯"; break;
7022 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7023 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7024 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7025 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7026 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7028 case 1: k = A_STR; act = "strong"; break;
7029 case 2: k = A_INT; act = "bright"; break;
7030 case 3: k = A_WIS; act = "wise"; break;
7031 case 4: k = A_DEX; act = "agile"; break;
7032 case 5: k = A_CON; act = "hale"; break;
7033 case 6: k = A_CHR; act = "beautiful"; break;
7039 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7041 msg_format("You're not as %s as you used to be...", act);
7045 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7046 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7047 p_ptr->update |= (PU_BONUS);
7054 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7056 msg_print("You're not as powerful as you used to be...");
7060 for (k = 0; k < 6; k++)
7062 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7063 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7065 p_ptr->update |= (PU_BONUS);
7071 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7075 /* Gravity -- stun plus slowness plus teleport */
7079 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7080 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7082 if (fuzzy) msg_print("You are hit by something heavy!");
7083 msg_print("Gravity warps around you.");
7088 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7089 if (!(p_ptr->resist_sound || p_ptr->ffall))
7091 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
7092 (void)set_stun(p_ptr->stun + k);
7096 dam = (dam * 2) / 3;
7099 if (!p_ptr->ffall || one_in_(13))
7101 inven_damage(set_cold_destroy, 2);
7104 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7108 /* Standard damage */
7109 case GF_DISINTEGRATE:
7112 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7114 if (fuzzy) msg_print("You are hit by pure energy!");
7117 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7124 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7126 if (fuzzy) msg_print("You are hit by something invigorating!");
7129 (void)hp_player(dam);
7137 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7139 if (fuzzy) msg_print("You are hit by something!");
7142 (void)set_fast(p_ptr->fast + randint(5), FALSE);
7150 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7152 if (fuzzy) msg_print("You are hit by something slow!");
7155 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7161 if (p_ptr->free_act) break;
7163 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7165 if (fuzzy) msg_print("You fall asleep!");
7169 if (ironman_nightmare)
7172 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7174 msg_print("A horrible vision enters your mind.");
7178 /* Pick a nightmare */
7179 get_mon_num_prep(get_nightmare, NULL);
7181 /* Have some nightmares */
7182 have_nightmare(get_mon_num(MAX_DEPTH));
7184 /* Remove the monster restriction */
7185 get_mon_num_prep(NULL, NULL);
7188 set_paralyzed(p_ptr->paralyzed + dam);
7199 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7201 if (fuzzy) msg_print("You are hit by an aura of magic!");
7204 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7212 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7214 if (fuzzy) msg_print("You are hit by an energy!");
7217 take_hit(DAMAGE_FORCE, dam, killer, monspell);
7225 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7227 if (fuzzy) msg_print("Something falls from the sky on you!");
7230 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7231 if (!p_ptr->resist_shard || one_in_(13))
7233 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7234 inven_damage(set_cold_destroy, 2);
7240 /* Ice -- cold plus stun plus cuts */
7244 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7246 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7249 cold_dam(dam, killer, monspell);
7250 if (!p_ptr->resist_shard)
7252 (void)set_cut(p_ptr->cut + damroll(5, 8));
7254 if (!p_ptr->resist_sound)
7256 (void)set_stun(p_ptr->stun + randint(15));
7259 if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
7261 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7271 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7273 if (fuzzy) msg_print("You are hit by something extremely cold!");
7277 if (p_ptr->mimic_form)
7279 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7280 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7285 switch (p_ptr->prace)
7287 /* Some races are immune */
7301 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7321 if (p_ptr->riding && dam > 0)
7323 rakubadam_p = (dam > 200) ? 200 : dam;
7331 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7337 /* Return "Anything seen?" */
7343 * Find the distance from (x, y) to a line.
7345 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7347 /* Vector from (x, y) to (x1, y1) */
7356 int pd = distance(y1, x1, y, x);
7357 int nd = distance(y1, x1, y2, x2);
7359 if (pd > nd) return distance(y, x, y2, x2);
7361 /* Component of P on N */
7362 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7364 /* Absolute value */
7365 return((nd >= 0) ? nd : 0 - nd);
7372 * Modified version of los() for calculation of disintegration balls.
7373 * Disintegration effects are stopped by permanent walls.
7375 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7395 /* Slope, or 1/Slope, of LOS */
7399 /* Extract the offset */
7403 /* Extract the absolute offset */
7408 /* Handle adjacent (or identical) grids */
7409 if ((ax < 2) && (ay < 2)) return (TRUE);
7412 /* Paranoia -- require "safe" origin */
7413 /* if (!in_bounds(y1, x1)) return (FALSE); */
7416 /* Directly South/North */
7419 /* South -- check for walls */
7422 for (ty = y1 + 1; ty < y2; ty++)
7424 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7428 /* North -- check for walls */
7431 for (ty = y1 - 1; ty > y2; ty--)
7433 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7441 /* Directly East/West */
7444 /* East -- check for walls */
7447 for (tx = x1 + 1; tx < x2; tx++)
7449 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7453 /* West -- check for walls */
7456 for (tx = x1 - 1; tx > x2; tx--)
7458 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7467 /* Extract some signs */
7468 sx = (dx < 0) ? -1 : 1;
7469 sy = (dy < 0) ? -1 : 1;
7472 /* Vertical "knights" */
7477 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7481 /* Horizontal "knights" */
7486 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7491 /* Calculate scale factor div 2 */
7494 /* Calculate scale factor */
7498 /* Travel horizontally */
7501 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7507 /* Consider the special case where slope == 1. */
7518 /* Note (below) the case (qy == f2), where */
7519 /* the LOS exactly meets the corner of a tile. */
7522 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7533 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7546 /* Travel vertically */
7549 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7565 /* Note (below) the case (qx == f2), where */
7566 /* the LOS exactly meets the corner of a tile. */
7569 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7580 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7600 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)
7613 while (bdis <= distance(y1, x1, y2, x2) + rad)
7615 /* Travel from center outward */
7616 for (cdis = 0; cdis <= brad; cdis++)
7619 /* Scan the maximal blast area of radius "cdis" */
7620 for (y = by - cdis; y <= by + cdis; y++)
7622 for (x = bx - cdis; x <= bx + cdis; x++)
7624 /* Ignore "illegal" locations */
7625 if (!in_bounds(y, x)) continue;
7627 /* Enforce a circular "ripple" */
7628 if (distance(y1, x1, y, x) != bdis) continue;
7630 /* Enforce an arc */
7631 if (distance(by, bx, y, x) != cdis) continue;
7635 /* Disintegration balls explosions are stopped by perma-walls */
7636 if (!in_disintegration_range(by, bx, y, x)) continue;
7638 if (real_breath && cave_valid_bold(y, x) &&
7639 (cave[y][x].feat < FEAT_PATTERN_START ||
7640 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
7641 (cave[y][x].feat < FEAT_DEEP_WATER ||
7642 cave[y][x].feat > FEAT_GRASS))
7644 if (cave[y][x].feat == FEAT_TREES)
7645 cave_set_feat(y, x, FEAT_GRASS);
7648 cave[y][x].feat = floor_type[rand_int(100)];
7649 cave[y][x].info &= ~(CAVE_MASK);
7650 cave[y][x].info |= CAVE_FLOOR;
7653 /* Update some things -- similar to GF_KILL_WALL */
7654 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
7658 /* The blast is stopped by walls */
7659 if (!los(by, bx, y, x)) continue;
7662 /* Save this grid */
7670 /* Encode some more "radius" info */
7671 gm[bdis + 1] = *pgrids;
7674 if ((by == y2) && (bx == x2)) done = TRUE;
7683 /* Ripple outwards */
7684 /* mmove2(&by, &bx, y1, x1, y2, x2); */
7686 by = GRID_Y(path_g[bdis]);
7687 bx = GRID_X(path_g[bdis]);
7689 /* Find the next ripple */
7692 /* Increase the size */
7693 brad = (rad * bdis) / dist;
7696 /* Store the effect size */
7702 * Generic "beam"/"bolt"/"ball" projection routine.
7705 * who: Index of "source" monster (zero for "player")
7706 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
7707 * y,x: Target location (or location to travel "towards")
7708 * dam: Base damage roll to apply to affected monsters (or player)
7709 * typ: Type of damage to apply to monsters (and objects)
7710 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
7713 * TRUE if any "effects" of the projection were observed, else FALSE
7715 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
7716 * towards a given location (optionally passing over the heads of interposing
7717 * monsters), and have it do a given amount of damage to the monsters (and
7718 * optionally objects) within the given radius of the final location.
7720 * A "bolt" travels from source to target and affects only the target grid.
7721 * A "beam" travels from source to target, affecting all grids passed through.
7722 * A "ball" travels from source to the target, exploding at the target, and
7723 * affecting everything within the given radius of the target location.
7725 * Traditionally, a "bolt" does not affect anything on the ground, and does
7726 * not pass over the heads of interposing monsters, much like a traditional
7727 * missile, and will "stop" abruptly at the "target" even if no monster is
7728 * positioned there, while a "ball", on the other hand, passes over the heads
7729 * of monsters between the source and target, and affects everything except
7730 * the source monster which lies within the final radius, while a "beam"
7731 * affects every monster between the source and target, except for the casting
7732 * monster (or player), and rarely affects things on the ground.
7734 * Two special flags allow us to use this function in special ways, the
7735 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
7736 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
7737 * actually projecting from the source monster (or player).
7739 * The player will only get "experience" for monsters killed by himself
7740 * Unique monsters can only be destroyed by attacks from the player
7742 * Only 256 grids can be affected per projection, limiting the effective
7743 * "radius" of standard ball attacks to nine units (diameter nineteen).
7745 * One can project in a given "direction" by combining PROJECT_THRU with small
7746 * offsets to the initial location (see "line_spell()"), or by calculating
7747 * "virtual targets" far away from the player.
7749 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
7750 * continuing until it actually hits somethings (useful for "stone to mud").
7752 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
7754 * Balls must explode BEFORE hitting walls, or they would affect monsters
7755 * on both sides of a wall. Some bug reports indicate that this is still
7756 * happening in 2.7.8 for Windows, though it appears to be impossible.
7758 * We "pre-calculate" the blast area only in part for efficiency.
7759 * More importantly, this lets us do "explosions" from the "inside" out.
7760 * This results in a more logical distribution of "blast" treasure.
7761 * It also produces a better (in my opinion) animation of the explosion.
7762 * It could be (but is not) used to have the treasure dropped by monsters
7763 * in the middle of the explosion fall "outwards", and then be damaged by
7764 * the blast as it spreads outwards towards the treasure drop location.
7766 * Walls and doors are included in the blast area, so that they can be
7767 * "burned" or "melted" in later versions.
7769 * This algorithm is intended to maximize simplicity, not necessarily
7770 * efficiency, since this function is not a bottleneck in the code.
7772 * We apply the blast effect from ground zero outwards, in several passes,
7773 * first affecting features, then objects, then monsters, then the player.
7774 * This allows walls to be removed before checking the object or monster
7775 * in the wall, and protects objects which are dropped by monsters killed
7776 * in the blast, and allows the player to see all affects before he is
7777 * killed or teleported away. The semantics of this method are open to
7778 * various interpretations, but they seem to work well in practice.
7780 * We process the blast area from ground-zero outwards to allow for better
7781 * distribution of treasure dropped by monsters, and because it provides a
7782 * pleasing visual effect at low cost.
7784 * Note that the damage done by "ball" explosions decreases with distance.
7785 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
7787 * Notice the "napalm" effect of "beam" weapons. First they "project" to
7788 * the target, and then the damage "flows" along this beam of destruction.
7789 * The damage at every grid is the same as at the "center" of a "ball"
7790 * explosion, since the "beam" grids are treated as if they ARE at the
7791 * center of a "ball" explosion.
7793 * Currently, specifying "beam" plus "ball" means that locations which are
7794 * covered by the initial "beam", and also covered by the final "ball", except
7795 * for the final grid (the epicenter of the ball), will be "hit twice", once
7796 * by the initial beam, and once by the exploding ball. For the grid right
7797 * next to the epicenter, this results in 150% damage being done. The center
7798 * does not have this problem, for the same reason the final grid in a "beam"
7799 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
7800 * grids which are covered by the "ball" will NOT work, as then they will
7801 * receive LESS damage than they should. Do not combine "beam" with "ball".
7803 * The array "gy[],gx[]" with current size "grids" is used to hold the
7804 * collected locations of all grids in the "blast area" plus "beam path".
7806 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
7807 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
7808 * first blast grid (see above) with radius "N" from the blast center. Note
7809 * that only the first gm[1] grids in the blast area thus take full damage.
7810 * Also, note that gm[rad+1] is always equal to "grids", which is the total
7811 * number of blast grids.
7813 * Note that once the projection is complete, (y2,x2) holds the final location
7814 * of bolts/beams, and the "epicenter" of balls.
7816 * Note also that "rad" specifies the "inclusive" radius of projection blast,
7817 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
7818 * implementation of the "distance" function. Also, a bolt can be properly
7819 * viewed as a "ball" with a "rad" of "zero".
7821 * Note that if no "target" is reached before the beam/bolt/ball travels the
7822 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
7823 * may be relevant even for bolts, since they have a "1x1" mini-blast.
7825 * Note that for consistency, we "pretend" that the bolt actually takes "time"
7826 * to move from point A to point B, even if the player cannot see part of the
7827 * projection path. Note that in general, the player will *always* see part
7828 * of the path, since it either starts at the player or ends on the player.
7830 * Hack -- we assume that every "projection" is "self-illuminating".
7832 * Hack -- when only a single monster is affected, we automatically track
7833 * (and recall) that monster, unless "PROJECT_JUMP" is used.
7835 * Note that all projections now "explode" at their final destination, even
7836 * if they were being projected at a more distant destination. This means
7837 * that "ball" spells will *always* explode.
7839 * Note that we must call "handle_stuff()" after affecting terrain features
7840 * in the blast radius, in case the "illumination" of the grid was changed,
7841 * and "update_view()" and "update_monsters()" need to be called.
7843 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
7852 int y_saver, x_saver; /* For reflecting monsters */
7854 int msec = delay_factor * delay_factor * delay_factor;
7856 /* Assume the player sees nothing */
7857 bool notice = FALSE;
7859 /* Assume the player has seen nothing */
7860 bool visual = FALSE;
7862 /* Assume the player has seen no blast grids */
7865 /* Assume to be a normal ball spell */
7866 bool breath = FALSE;
7868 /* Is the player blind? */
7869 bool blind = (p_ptr->blind ? TRUE : FALSE);
7871 bool old_hide = FALSE;
7873 /* Number of grids in the "path" */
7876 /* Actual grids in the "path" */
7879 /* Number of grids in the "blast area" (including the "beam" path) */
7882 /* Coordinates of the affected grids */
7883 byte gx[1024], gy[1024];
7885 /* Encoded "radius" info (see above) */
7888 /* Actual radius encoded in gm[] */
7893 /* Attacker's name (prepared before polymorph)*/
7899 /* Default target of monsterspell is player */
7900 monster_target_y=py;
7901 monster_target_x=px;
7903 /* Hack -- Jump to target */
7904 if (flg & (PROJECT_JUMP))
7909 /* Clear the flag */
7910 flg &= ~(PROJECT_JUMP);
7915 /* Start at player */
7922 /* Start at monster */
7925 x1 = m_list[who].fx;
7926 y1 = m_list[who].fy;
7927 monster_desc(who_name, &m_list[who], 0x88);
7940 /* Default "destination" */
7945 /* Hack -- verify stuff */
7946 if (flg & (PROJECT_THRU))
7948 if ((x1 == x2) && (y1 == y2))
7950 flg &= ~(PROJECT_THRU);
7954 /* Handle a breath attack */
7959 if (flg & PROJECT_HIDE) old_hide = TRUE;
7960 flg |= PROJECT_HIDE;
7964 /* Hack -- Assume there will be no blast (max radius 32) */
7965 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
7973 /* Collect beam grids */
7974 if (flg & (PROJECT_BEAM))
7981 if (breath && typ == GF_DISINTEGRATE)
7983 flg |= (PROJECT_DISI);
7986 /* Calculate the projection path */
7988 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
7990 /* Hack -- Handle stuff */
7993 /* Giga-Hack SEEKER & SUPER_RAY */
7995 if( typ == GF_SEEKER )
8005 for (i = 0; i < path_n; ++i)
8010 int ny = GRID_Y(path_g[i]);
8011 int nx = GRID_X(path_g[i]);
8022 /* Only do visuals if requested */
8023 if (!blind && !(flg & (PROJECT_HIDE)))
8025 /* Only do visuals if the player can "see" the bolt */
8026 if (panel_contains(y, x) && player_has_los_bold(y, x))
8033 /* Obtain the bolt pict */
8034 p = bolt_pict(oy, ox, y, x, typ);
8036 /* Extract attr/char */
8040 /* Visual effects */
8041 print_rel(c, a, y, x);
8042 move_cursor_relative(y, x);
8043 /*if (fresh_before)*/ Term_fresh();
8044 Term_xtra(TERM_XTRA_DELAY, msec);
8046 /*if (fresh_before)*/ Term_fresh();
8048 /* Display "beam" grids */
8049 if (flg & (PROJECT_BEAM))
8051 /* Obtain the explosion pict */
8052 p = bolt_pict(y, x, y, x, typ);
8054 /* Extract attr/char */
8058 /* Visual effects */
8059 print_rel(c, a, y, x);
8062 /* Hack -- Activate delay */
8066 /* Hack -- delay anyway for consistency */
8069 /* Delay for consistency */
8070 Term_xtra(TERM_XTRA_DELAY, msec);
8073 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8074 if( cave[y][x].feat == FEAT_MIRROR )
8076 /* The target of monsterspell becomes tha mirror(broken) */
8077 monster_target_y=(s16b)y;
8078 monster_target_x=(s16b)x;
8080 cave_set_feat( y, x , FEAT_FLOOR );
8081 next_mirror( &oy,&ox );
8083 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8084 for( j = last_i; j <=i ; j++ )
8086 y = GRID_Y(path_g[j]);
8087 x = GRID_X(path_g[j]);
8088 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8089 if(!who && (project_m_n==1) && !jump ){
8090 if(cave[project_m_y][project_m_x].m_idx >0 ){
8091 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8093 /* Hack -- auto-recall */
8094 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8096 /* Hack - auto-track */
8097 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8100 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8105 for( i = last_i ; i < path_n ; i++ )
8108 y = GRID_Y(path_g[i]);
8109 x = GRID_X(path_g[i]);
8110 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8112 if(!who && (project_m_n==1) && !jump ){
8113 if(cave[project_m_y][project_m_x].m_idx >0 ){
8114 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8116 /* Hack -- auto-recall */
8117 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8119 /* Hack - auto-track */
8120 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8123 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8127 else if(typ == GF_SUPER_RAY){
8129 int second_step = 0;
8136 for (i = 0; i < path_n; ++i)
8141 int ny = GRID_Y(path_g[i]);
8142 int nx = GRID_X(path_g[i]);
8153 /* Only do visuals if requested */
8154 if (!blind && !(flg & (PROJECT_HIDE)))
8156 /* Only do visuals if the player can "see" the bolt */
8157 if (panel_contains(y, x) && player_has_los_bold(y, x))
8164 /* Obtain the bolt pict */
8165 p = bolt_pict(oy, ox, y, x, typ);
8167 /* Extract attr/char */
8171 /* Visual effects */
8172 print_rel(c, a, y, x);
8173 move_cursor_relative(y, x);
8174 /*if (fresh_before)*/ Term_fresh();
8175 Term_xtra(TERM_XTRA_DELAY, msec);
8177 /*if (fresh_before)*/ Term_fresh();
8179 /* Display "beam" grids */
8180 if (flg & (PROJECT_BEAM))
8182 /* Obtain the explosion pict */
8183 p = bolt_pict(y, x, y, x, typ);
8185 /* Extract attr/char */
8189 /* Visual effects */
8190 print_rel(c, a, y, x);
8193 /* Hack -- Activate delay */
8197 /* Hack -- delay anyway for consistency */
8200 /* Delay for consistency */
8201 Term_xtra(TERM_XTRA_DELAY, msec);
8204 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8205 if( cave[y][x].feat == FEAT_RUBBLE ||
8206 cave[y][x].feat == FEAT_DOOR_HEAD ||
8207 cave[y][x].feat == FEAT_DOOR_TAIL ||
8208 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8209 cave[y][x].feat <= FEAT_PERM_SOLID ))
8211 if( second_step )continue;
8214 if( cave[y][x].feat == FEAT_MIRROR && !second_step )
8216 /* The target of monsterspell becomes tha mirror(broken) */
8217 monster_target_y=(s16b)y;
8218 monster_target_x=(s16b)x;
8220 cave_set_feat( y, x , FEAT_FLOOR );
8221 for( j = 0; j <=i ; j++ )
8223 y = GRID_Y(path_g[j]);
8224 x = GRID_X(path_g[j]);
8225 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8229 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8230 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8231 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8232 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8233 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8234 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8235 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8236 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8239 for( i = 0; i < path_n ; i++ )
8242 y = GRID_Y(path_g[i]);
8243 x = GRID_X(path_g[i]);
8244 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8245 if(!who && (project_m_n==1) && !jump ){
8246 if(cave[project_m_y][project_m_x].m_idx >0 ){
8247 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8249 /* Hack -- auto-recall */
8250 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8252 /* Hack - auto-track */
8253 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8256 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8261 /* Project along the path */
8262 for (i = 0; i < path_n; ++i)
8267 int ny = GRID_Y(path_g[i]);
8268 int nx = GRID_X(path_g[i]);
8270 if (flg & PROJECT_DISI)
8272 /* Hack -- Balls explode before reaching walls */
8273 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8277 /* Hack -- Balls explode before reaching walls */
8278 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8285 /* Collect beam grids */
8286 if (flg & (PROJECT_BEAM))
8293 /* Only do visuals if requested */
8294 if (!blind && !(flg & (PROJECT_HIDE)))
8296 /* Only do visuals if the player can "see" the bolt */
8297 if (panel_contains(y, x) && player_has_los_bold(y, x))
8304 /* Obtain the bolt pict */
8305 p = bolt_pict(oy, ox, y, x, typ);
8307 /* Extract attr/char */
8311 /* Visual effects */
8312 print_rel(c, a, y, x);
8313 move_cursor_relative(y, x);
8314 /*if (fresh_before)*/ Term_fresh();
8315 Term_xtra(TERM_XTRA_DELAY, msec);
8317 /*if (fresh_before)*/ Term_fresh();
8319 /* Display "beam" grids */
8320 if (flg & (PROJECT_BEAM))
8322 /* Obtain the explosion pict */
8323 p = bolt_pict(y, x, y, x, typ);
8325 /* Extract attr/char */
8329 /* Visual effects */
8330 print_rel(c, a, y, x);
8333 /* Hack -- Activate delay */
8337 /* Hack -- delay anyway for consistency */
8340 /* Delay for consistency */
8341 Term_xtra(TERM_XTRA_DELAY, msec);
8344 if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
8346 if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
8351 /* Save the "blast epicenter" */
8355 if (breath && (y1 == y2) && (x1 == x2))
8361 flg &= ~(PROJECT_HIDE);
8365 /* Start the "explosion" */
8368 /* Hack -- make sure beams get to "explode" */
8376 /* If we found a "target", explode there */
8377 if (dist <= MAX_RANGE)
8379 /* Mega-Hack -- remove the final "beam" grid */
8380 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8383 * Create a conical breath attack
8394 flg &= ~(PROJECT_HIDE);
8396 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (bool)(typ == GF_DISINTEGRATE), TRUE);
8400 /* Determine the blast area, work from the inside out */
8401 for (dist = 0; dist <= rad; dist++)
8403 /* Scan the maximal blast area of radius "dist" */
8404 for (y = y2 - dist; y <= y2 + dist; y++)
8406 for (x = x2 - dist; x <= x2 + dist; x++)
8408 /* Ignore "illegal" locations */
8409 if (!in_bounds2(y, x)) continue;
8411 /* Enforce a "circular" explosion */
8412 if (distance(y2, x2, y, x) != dist) continue;
8414 if (typ == GF_DISINTEGRATE)
8416 /* Disintegration balls explosions are stopped by perma-walls */
8417 if (!in_disintegration_range(y2, x2, y, x)) continue;
8419 if (cave_valid_bold(y, x) &&
8420 (cave[y][x].feat < FEAT_PATTERN_START ||
8421 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
8422 (cave[y][x].feat < FEAT_DEEP_WATER ||
8423 cave[y][x].feat > FEAT_GRASS))
8425 if (cave[y][x].feat == FEAT_TREES)
8426 cave_set_feat(y, x, FEAT_GRASS);
8429 cave[y][x].feat = floor_type[rand_int(100)];
8430 cave[y][x].info &= ~(CAVE_MASK);
8431 cave[y][x].info |= CAVE_FLOOR;
8435 /* Update some things -- similar to GF_KILL_WALL */
8436 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8440 /* Ball explosions are stopped by walls */
8441 if (!los(y2, x2, y, x)) continue;
8444 /* Save this grid */
8451 /* Encode some more "radius" info */
8457 /* Speed -- ignore "non-explosions" */
8458 if (!grids) return (FALSE);
8461 /* Display the "blast area" if requested */
8462 if (!blind && !(flg & (PROJECT_HIDE)))
8464 /* Then do the "blast", from inside out */
8465 for (t = 0; t <= gm_rad; t++)
8467 /* Dump everything with this radius */
8468 for (i = gm[t]; i < gm[t+1]; i++)
8470 /* Extract the location */
8474 /* Only do visuals if the player can "see" the blast */
8475 if (panel_contains(y, x) && player_has_los_bold(y, x))
8484 /* Obtain the explosion pict */
8485 p = bolt_pict(y, x, y, x, typ);
8487 /* Extract attr/char */
8491 /* Visual effects -- Display */
8492 print_rel(c, a, y, x);
8496 /* Hack -- center the cursor */
8497 move_cursor_relative(y2, x2);
8499 /* Flush each "radius" seperately */
8500 /*if (fresh_before)*/ Term_fresh();
8502 /* Delay (efficiently) */
8503 if (visual || drawn)
8505 Term_xtra(TERM_XTRA_DELAY, msec);
8509 /* Flush the erasing */
8512 /* Erase the explosion drawn above */
8513 for (i = 0; i < grids; i++)
8515 /* Extract the location */
8519 /* Hack -- Erase if needed */
8520 if (panel_contains(y, x) && player_has_los_bold(y, x))
8526 /* Hack -- center the cursor */
8527 move_cursor_relative(y2, x2);
8529 /* Flush the explosion */
8530 /*if (fresh_before)*/ Term_fresh();
8535 /* Update stuff if needed */
8536 if (p_ptr->update) update_stuff();
8539 /* Check features */
8540 if (flg & (PROJECT_GRID))
8542 /* Start with "dist" of zero */
8545 /* Scan for features */
8546 for (i = 0; i < grids; i++)
8548 /* Hack -- Notice new "dist" values */
8549 if (gm[dist+1] == i) dist++;
8551 /* Get the grid location */
8555 /* Find the closest point in the blast */
8558 int d = dist_to_line(y, x, y1, x1, y2, x2);
8560 /* Affect the grid */
8561 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8565 /* Affect the grid */
8566 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8573 if (flg & (PROJECT_ITEM))
8575 /* Start with "dist" of zero */
8578 /* Scan for objects */
8579 for (i = 0; i < grids; i++)
8581 /* Hack -- Notice new "dist" values */
8582 if (gm[dist+1] == i) dist++;
8584 /* Get the grid location */
8588 /* Find the closest point in the blast */
8591 int d = dist_to_line(y, x, y1, x1, y2, x2);
8593 /* Affect the object in the grid */
8594 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8598 /* Affect the object in the grid */
8599 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8605 /* Check monsters */
8606 if (flg & (PROJECT_KILL))
8613 /* Start with "dist" of zero */
8616 /* Scan for monsters */
8617 for (i = 0; i < grids; i++)
8619 /* Hack -- Notice new "dist" values */
8620 if (gm[dist + 1] == i) dist++;
8622 /* Get the grid location */
8628 /* Find the closest point in the blast */
8631 int d = dist_to_line(y, x, y1, x1, y2, x2);
8633 /* Affect the monster in the grid */
8634 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8636 if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
8638 else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
8642 /* Affect the monster in the grid */
8643 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8645 if (!(flg & PROJECT_BEAM))
8647 if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
8650 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8655 monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
8657 if ((ref_ptr->flags2 & RF2_REFLECTING) && (!one_in_(10) && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
8660 int max_attempts = 10;
8662 /* Choose 'new' target */
8665 t_y = y_saver - 1 + randint(3);
8666 t_x = x_saver - 1 + randint(3);
8670 while (max_attempts && in_bounds2u(t_y, t_x) &&
8671 !(los(y, x, t_y, t_x)));
8673 if (max_attempts < 1)
8679 if (m_list[cave[y][x].m_idx].ml)
8682 if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
8683 || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
8684 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
8685 if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
8686 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
8688 msg_print("The attack bounces!");
8691 ref_ptr->r_flags2 |= RF2_REFLECTING;
8693 flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
8694 if (one_in_(2)) flg |= PROJECT_MONSTER;
8695 else flg |= PROJECT_PLAYER;
8697 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
8701 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8704 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8709 /* Player affected one monster (without "jumping") */
8710 if (!who && (project_m_n == 1) && !jump)
8716 /* Track if possible */
8717 if (cave[y][x].m_idx > 0)
8719 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8721 /* Hack -- auto-recall */
8722 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8724 /* Hack - auto-track */
8725 if (m_ptr->ml) health_track(cave[y][x].m_idx);
8732 if (flg & (PROJECT_KILL))
8734 /* Start with "dist" of zero */
8737 /* Scan for player */
8738 for (i = 0; i < grids; i++)
8740 /* Hack -- Notice new "dist" values */
8741 if (gm[dist+1] == i) dist++;
8743 /* Get the grid location */
8747 /* Find the closest point in the blast */
8750 int d = dist_to_line(y, x, y1, x1, y2, x2);
8752 /* Affect the player */
8753 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8755 if (project_p(who, who_name, d+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8757 else if (project_p(who, who_name, d, y, x, dam, typ, rad, monspell)) notice = TRUE;
8761 /* Affect the player */
8762 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8764 if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
8766 if (project_p(who, who_name, dist+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8769 else if (project_p(who, who_name, dist, y, x, dam, typ, rad, monspell)) notice = TRUE;
8778 monster_desc(m_name, &m_list[p_ptr->riding], 0);
8780 if (rakubadam_m > 0)
8782 if (rakuba(rakubadam_m, FALSE))
8785 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
8787 msg_format("%^s has thrown you off!", m_name);
8791 if (p_ptr->riding && rakubadam_p > 0)
8793 if(rakuba(rakubadam_p, FALSE))
8796 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
8798 msg_format("You have fallen from %s.", m_name);
8804 /* Return "something was noticed" */
8808 bool binding_field( int dam )
8810 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
8811 int mirror_num=0; /* ¶À¤Î¿ô */
8816 int msec= delay_factor*delay_factor*delay_factor;
8822 /* Default target of monsterspell is player */
8823 monster_target_y=py;
8824 monster_target_x=px;
8826 for( x=0 ; x < cur_wid ; x++ )
8828 for( y=0 ; y < cur_hgt ; y++ )
8830 if( cave[y][x].feat == FEAT_MIRROR &&
8831 distance(py,px,y,x) <= MAX_RANGE &&
8832 distance(py,px,y,x) != 0 &&
8833 player_has_los_bold(y,x)
8835 mirror_y[mirror_num]=y;
8836 mirror_x[mirror_num]=x;
8842 if( mirror_num < 2 )return FALSE;
8844 point_x[0] = rand_int( mirror_num );
8846 point_x[1] = rand_int( mirror_num );
8848 while( point_x[0] == point_x[1] );
8850 point_y[0]=mirror_y[point_x[0]];
8851 point_x[0]=mirror_x[point_x[0]];
8852 point_y[1]=mirror_y[point_x[1]];
8853 point_x[1]=mirror_x[point_x[1]];
8857 x=point_x[0]+point_x[1]+point_x[2];
8858 y=point_y[0]+point_y[1]+point_y[2];
8860 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
8861 - (point_y[0]*3-y)*(point_x[1]*3-x);
8862 if( centersign == 0 )return FALSE;
8864 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
8865 x1 = x1 < point_x[2] ? x1 : point_x[2];
8866 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
8867 y1 = y1 < point_y[2] ? y1 : point_y[2];
8869 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
8870 x2 = x2 > point_x[2] ? x2 : point_x[2];
8871 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
8872 y2 = y2 > point_y[2] ? y2 : point_y[2];
8874 for( y=y1 ; y <=y2 ; y++ ){
8875 for( x=x1 ; x <=x2 ; x++ ){
8876 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8877 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8878 centersign*( (point_x[1]-x)*(point_y[2]-y)
8879 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8880 centersign*( (point_x[2]-x)*(point_y[0]-y)
8881 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8883 if( player_has_los_bold(y,x)){
8884 /* Visual effects */
8886 && panel_contains(y,x)){
8887 p = bolt_pict(y,x,y,x, GF_MANA );
8888 print_rel(PICT_C(p), PICT_A(p),y,x);
8889 move_cursor_relative(y, x);
8890 /*if (fresh_before)*/ Term_fresh();
8891 Term_xtra(TERM_XTRA_DELAY, msec);
8897 for( y=y1 ; y <=y2 ; y++ ){
8898 for( x=x1 ; x <=x2 ; x++ ){
8899 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8900 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8901 centersign*( (point_x[1]-x)*(point_y[2]-y)
8902 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8903 centersign*( (point_x[2]-x)*(point_y[0]-y)
8904 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8906 if( player_has_los_bold(y,x)){
8907 (void)project_f(0,0,y,x,dam,GF_MANA);
8912 for( y=y1 ; y <=y2 ; y++ ){
8913 for( x=x1 ; x <=x2 ; x++ ){
8914 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8915 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8916 centersign*( (point_x[1]-x)*(point_y[2]-y)
8917 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8918 centersign*( (point_x[2]-x)*(point_y[0]-y)
8919 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8921 if( player_has_los_bold(y,x)){
8922 (void)project_o(0,0,y,x,dam,GF_MANA);
8927 for( y=y1 ; y <=y2 ; y++ ){
8928 for( x=x1 ; x <=x2 ; x++ ){
8929 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8930 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8931 centersign*( (point_x[1]-x)*(point_y[2]-y)
8932 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8933 centersign*( (point_x[2]-x)*(point_y[0]-y)
8934 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8936 if( player_has_los_bold(y,x) ){
8937 (void)project_m(0,0,y,x,dam,GF_MANA,
8938 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF));
8945 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
8947 msg_print("The field broke a mirror");
8949 cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
8955 void seal_of_mirror( int dam )
8959 for( x = 0 ; x < cur_wid ; x++ )
8961 for( y = 0 ; y < cur_hgt ; y++ )
8963 if( cave[y][x].feat == FEAT_MIRROR )
8965 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8966 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
8968 if( !cave[y][x].m_idx )
8970 cave_set_feat( y,x, FEAT_FLOOR );