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 */
1118 /* Lite up the grid */
1122 /* Turn on the light */
1123 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= (CAVE_GLOW);
1132 if (player_can_see_bold(y, x)) obvious = TRUE;
1134 /* Mega-Hack -- Update the monster in the affected grid */
1135 /* This allows "spear of light" (etc) to work "correctly" */
1136 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1141 /* Darken the grid */
1145 if (!p_ptr->inside_battle)
1148 if (player_can_see_bold(y, x)) obvious = TRUE;
1150 /* Turn off the light. */
1151 c_ptr->info &= ~(CAVE_GLOW);
1153 /* Hack -- Forget "boring" grids */
1154 if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
1157 c_ptr->info &= ~(CAVE_MARK);
1166 /* Mega-Hack -- Update the monster in the affected grid */
1167 /* This allows "spear of light" (etc) to work "correctly" */
1168 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1177 if( cave[y][x].feat == FEAT_MIRROR )
1180 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1182 msg_print("The mirror was chashed!");
1184 cave_set_feat(y,x, FEAT_FLOOR);
1185 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);
1191 if( cave[y][x].feat == FEAT_MIRROR && p_ptr->lev < 40 )
1194 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1196 msg_print("The mirror was chashed!");
1198 cave_set_feat(y,x, FEAT_FLOOR);
1205 /* Return "Anything seen?" */
1212 * We are called from "project()" to "damage" objects
1214 * We are called both for "beam" effects and "ball" effects.
1216 * Perhaps we should only SOMETIMES damage things on the ground.
1218 * The "r" parameter is the "distance from ground zero".
1220 * Note that we determine if the player can "see" anything that happens
1221 * by taking into account: blindness, line-of-sight, and illumination.
1223 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1225 * We return "TRUE" if the effect of the projection is "obvious".
1227 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1229 cave_type *c_ptr = &cave[y][x];
1231 s16b this_o_idx, next_o_idx = 0;
1233 bool obvious = FALSE;
1234 bool known = player_has_los_bold(y, x);
1238 char o_name[MAX_NLEN];
1241 bool is_potion = FALSE;
1245 who = who ? who : 0;
1247 /* Reduce damage by distance */
1248 dam = (dam + r) / (r + 1);
1251 /* Scan all objects in the grid */
1252 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1256 bool is_art = FALSE;
1257 bool ignore = FALSE;
1258 bool plural = FALSE;
1259 bool do_kill = FALSE;
1261 cptr note_kill = NULL;
1263 /* Acquire object */
1264 o_ptr = &o_list[this_o_idx];
1266 /* Acquire next object */
1267 next_o_idx = o_ptr->next_o_idx;
1269 /* Extract the flags */
1270 object_flags(o_ptr, &f1, &f2, &f3);
1272 /* Get the "plural"-ness */
1273 if (o_ptr->number > 1) plural = TRUE;
1275 /* Check for artifact */
1276 if ((artifact_p(o_ptr) || o_ptr->art_name)) is_art = TRUE;
1278 /* Analyze the type */
1281 /* Acid -- Lots of things */
1284 if (hates_acid(o_ptr))
1288 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1290 note_kill = (plural ? " melt!" : " melts!");
1293 if (f3 & (TR3_IGNORE_ACID)) ignore = TRUE;
1298 /* Elec -- Rings and Wands */
1301 if (hates_elec(o_ptr))
1305 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1307 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1310 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1315 /* Fire -- Flammable objects */
1318 if (hates_fire(o_ptr))
1322 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1324 note_kill = (plural ? " burn up!" : " burns up!");
1327 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1332 /* Cold -- potions and flasks */
1335 if (hates_cold(o_ptr))
1338 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1340 note_kill = (plural ? " shatter!" : " shatters!");
1344 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1352 if (hates_fire(o_ptr))
1356 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1358 note_kill = (plural ? " burn up!" : " burns up!");
1361 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1363 if (hates_elec(o_ptr))
1368 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1370 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1373 if (f3 & (TR3_IGNORE_ELEC)) ignore = TRUE;
1381 if (hates_fire(o_ptr))
1385 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1387 note_kill = (plural ? " burn up!" : " burns up!");
1390 if (f3 & (TR3_IGNORE_FIRE)) ignore = TRUE;
1392 if (hates_cold(o_ptr))
1397 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1399 note_kill = (plural ? " shatter!" : " shatters!");
1402 if (f3 & (TR3_IGNORE_COLD)) ignore = TRUE;
1407 /* Hack -- break potions and such */
1413 if (hates_cold(o_ptr))
1416 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1418 note_kill = (plural ? " shatter!" : " shatters!");
1426 /* Mana and Chaos -- destroy everything */
1433 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1435 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1441 case GF_DISINTEGRATE:
1445 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1447 note_kill = (plural ? " evaporate!" : " evaporates!");
1457 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1459 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1462 if (f2 & (TR2_RES_CHAOS)) ignore = TRUE;
1463 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1467 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1471 if (cursed_p(o_ptr))
1475 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1477 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1486 identify_item(o_ptr);
1494 /* Chests are noticed only if trapped or locked */
1495 if (o_ptr->tval == TV_CHEST)
1497 /* Disarm/Unlock traps */
1498 if (o_ptr->pval > 0)
1500 /* Disarm or Unlock */
1501 o_ptr->pval = (0 - o_ptr->pval);
1504 object_known(o_ptr);
1507 if (known && o_ptr->marked)
1510 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1512 msg_print("Click!");
1524 if (o_ptr->tval == TV_CORPSE)
1527 bool friendly = (!who || is_friendly(&m_list[who]));
1528 bool pet = (!who || is_pet(&m_list[who]));
1529 for (i = 0; i < o_ptr->number ; i++)
1531 if (((o_ptr->sval == SV_CORPSE) && (randint(100) > 80)) ||
1532 ((o_ptr->sval == SV_SKELETON) && (randint(100) > 60)))
1537 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1539 note_kill = (plural ? " become dust." : " becomes dust.");
1544 else if (summon_named_creature(y, x, o_ptr->pval, FALSE, FALSE, friendly, pet))
1547 note_kill = "À¸¤Ê֤ä¿¡£";
1549 note_kill = "rivived.";
1552 else if (!note_kill)
1555 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1557 note_kill = (plural ? " become dust." : " becomes dust.");
1569 /* Attempt to destroy the object */
1572 /* Effect "observed" */
1573 if (known && o_ptr->marked)
1576 object_desc(o_name, o_ptr, FALSE, 0);
1579 /* Artifacts, and other objects, get to resist */
1580 if (is_art || ignore)
1582 /* Observe the resist */
1583 if (known && o_ptr->marked)
1586 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1589 msg_format("The %s %s unaffected!",
1590 o_name, (plural ? "are" : "is"));
1599 /* Describe if needed */
1600 if (known && o_ptr->marked && note_kill)
1603 msg_format("%s¤Ï%s", o_name, note_kill);
1605 msg_format("The %s%s", o_name, note_kill);
1610 k_idx = o_ptr->k_idx;
1611 is_potion = object_is_potion(o_ptr);
1614 /* Delete the object */
1615 delete_object_idx(this_o_idx);
1617 /* Potions produce effects when 'shattered' */
1620 (void)potion_smash_effect(who, y, x, k_idx);
1629 /* Return "Anything seen?" */
1635 * Helper function for "project()" below.
1637 * Handle a beam/bolt/ball causing damage to a monster.
1639 * This routine takes a "source monster" (by index) which is mostly used to
1640 * determine if the player is causing the damage, and a "radius" (see below),
1641 * which is used to decrease the power of explosions with distance, and a
1642 * location, via integers which are modified by certain types of attacks
1643 * (polymorph and teleport being the obvious ones), a default damage, which
1644 * is modified as needed based on various properties, and finally a "damage
1645 * type" (see below).
1647 * Note that this routine can handle "no damage" attacks (like teleport) by
1648 * taking a "zero" damage, and can even take "parameters" to attacks (like
1649 * confuse) by accepting a "damage", using it to calculate the effect, and
1650 * then setting the damage to zero. Note that the "damage" parameter is
1651 * divided by the radius, so monsters not at the "epicenter" will not take
1652 * as much damage (or whatever)...
1654 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1655 * may result in a dereference of an invalid pointer. XXX XXX XXX
1657 * Various messages are produced, and damage is applied.
1659 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1660 * actually be "made" of that substance, or "breathe" big balls of it.
1662 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1665 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1666 * and hurts evil less. If can breath nether, then it resists it as well.
1668 * Damage reductions use the following formulas:
1669 * Note that "dam = dam * 6 / (randint(6) + 6);"
1670 * gives avg damage of .655, ranging from .858 to .500
1671 * Note that "dam = dam * 5 / (randint(6) + 6);"
1672 * gives avg damage of .544, ranging from .714 to .417
1673 * Note that "dam = dam * 4 / (randint(6) + 6);"
1674 * gives avg damage of .444, ranging from .556 to .333
1675 * Note that "dam = dam * 3 / (randint(6) + 6);"
1676 * gives avg damage of .327, ranging from .427 to .250
1677 * Note that "dam = dam * 2 / (randint(6) + 6);"
1678 * gives something simple.
1680 * In this function, "result" messages are postponed until the end, where
1681 * the "note" string is appended to the monster name, if not NULL. So,
1682 * to make a spell have "no effect" just set "note" to NULL. You should
1683 * also set "notice" to FALSE, or the player will learn what the spell does.
1685 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1687 /* "flg" was added. */
1688 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1692 cave_type *c_ptr = &cave[y][x];
1694 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1696 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1700 /* Is the monster "seen"? */
1701 bool seen = m_ptr->ml;
1703 bool slept = (bool)(m_ptr->csleep > 0);
1705 /* Were the effects "obvious" (if seen)? */
1706 bool obvious = FALSE;
1708 /* Can the player know about this effect? */
1709 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1711 /* Can the player see the source of this effect? */
1712 bool see_s = ((who <= 0) || m_list[who].ml);
1714 /* Were the effects "irrelevant"? */
1715 bool skipped = FALSE;
1717 /* Gets the monster angry at the source of the effect? */
1718 bool get_angry = FALSE;
1720 /* Polymorph setting (true or false) */
1723 /* Teleport setting (max distance) */
1726 /* Confusion setting (amount to confuse) */
1729 /* Stunning setting (amount to stun) */
1732 /* Sleep amount (amount to sleep) */
1735 /* Fear amount (amount to fear) */
1738 /* Time amount (amount to time) */
1741 bool heal_leper = FALSE;
1743 /* Hold the monster name */
1750 /* Assume no note */
1753 /* Assume a default death */
1755 cptr note_dies = "¤Ï»à¤ó¤À¡£";
1757 cptr note_dies = " dies.";
1765 if (!c_ptr->m_idx) return (FALSE);
1767 /* Never affect projector */
1768 if (who && (c_ptr->m_idx == who)) return (FALSE);
1769 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1770 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1772 /* Don't affect already death monsters */
1773 /* Prevents problems with chain reactions of exploding monsters */
1774 if (m_ptr->hp < 0) return (FALSE);
1776 /* Reduce damage by distance */
1777 dam = (dam + r) / (r + 1);
1780 /* Get the monster name (BEFORE polymorphing) */
1781 monster_desc(m_name, m_ptr, 0);
1783 /* Get the monster possessive ("his"/"her"/"its") */
1784 monster_desc(m_poss, m_ptr, 0x22);
1787 /* Some monsters get "destroyed" */
1788 if (!monster_living(r_ptr))
1791 bool explode = FALSE;
1793 for (i = 0; i < 4; i++)
1795 if (r_ptr->blow[i].method == RBM_EXPLODE) explode = TRUE;
1798 /* Special note at death */
1801 note_dies = "¤ÏÇúȯ¤·¤ÆÊ´¡¹¤Ë¤Ê¤Ã¤¿¡£";
1803 note_dies = " explodes into tiny shreds.";
1807 note_dies = "¤òÅݤ·¤¿¡£";
1809 note_dies = " is destroyed.";
1813 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1815 /* Analyze the damage type */
1818 /* Magic Missile -- pure damage */
1821 if (seen) obvious = TRUE;
1822 if (r_ptr->flags3 & (RF3_RES_ALL))
1825 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1827 note = " is immune.";
1830 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1839 if (seen) obvious = TRUE;
1840 if (r_ptr->flags3 & (RF3_RES_ALL))
1843 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1845 note = " is immune.";
1848 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1851 if (r_ptr->flags3 & (RF3_IM_ACID))
1854 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1856 note = " resists a lot.";
1860 if (seen) r_ptr->r_flags3 |= (RF3_IM_ACID);
1868 if (seen) obvious = TRUE;
1869 if (r_ptr->flags3 & (RF3_RES_ALL))
1872 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1874 note = " is immune.";
1877 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1880 if (r_ptr->flags3 & (RF3_IM_ELEC))
1883 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1885 note = " resists a lot.";
1889 if (seen) r_ptr->r_flags3 |= (RF3_IM_ELEC);
1897 if (seen) obvious = TRUE;
1898 if (r_ptr->flags3 & (RF3_RES_ALL))
1901 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1903 note = " is immune.";
1906 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1909 if (r_ptr->flags3 & (RF3_IM_FIRE))
1912 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1914 note = " resists a lot.";
1918 if (seen) r_ptr->r_flags3 |= (RF3_IM_FIRE);
1920 if (r_ptr->flags3 & (RF3_HURT_FIRE))
1923 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1925 note = " is hit hard.";
1929 if (seen) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1937 if (seen) obvious = TRUE;
1938 if (r_ptr->flags3 & (RF3_RES_ALL))
1941 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1943 note = " is immune.";
1946 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1949 if (r_ptr->flags3 & (RF3_IM_COLD))
1952 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1954 note = " resists a lot.";
1958 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
1960 if (r_ptr->flags3 & (RF3_HURT_COLD))
1963 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1965 note = " is hit hard.";
1969 if (seen) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1977 if (seen) obvious = TRUE;
1978 if (r_ptr->flags3 & (RF3_RES_ALL))
1981 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1983 note = " is immune.";
1986 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
1989 if (r_ptr->flags3 & RF3_IM_POIS)
1992 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1994 note = " resists a lot.";
1998 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2006 if (seen) obvious = TRUE;
2008 if (r_ptr->flags3 & (RF3_RES_ALL))
2011 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2013 note = " is immune.";
2016 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2019 if (r_ptr->flags3 & RF3_IM_POIS)
2022 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2027 dam *= 3; dam /= randint(6) + 6;
2028 if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
2030 else if (randint(3) == 1) do_poly = TRUE;
2034 /* Hellfire -- hurts Evil */
2037 if (seen) obvious = TRUE;
2038 if (r_ptr->flags3 & (RF3_RES_ALL))
2041 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2043 note = " is immune.";
2046 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2049 if (r_ptr->flags3 & RF3_GOOD)
2053 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2055 note = " is hit hard.";
2058 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
2063 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2066 if (seen) obvious = TRUE;
2067 if (r_ptr->flags3 & (RF3_RES_ALL))
2070 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2072 note = " is immune.";
2075 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2078 if (r_ptr->flags3 & RF3_GOOD)
2082 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2084 note = " is immune.";
2087 if (seen) r_ptr->r_flags3 |= RF3_GOOD;
2089 else if (r_ptr->flags3 & RF3_EVIL)
2093 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2095 note = " is hit hard.";
2098 if (seen) r_ptr->r_flags3 |= RF3_EVIL;
2103 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2108 dam *= 3; dam /= randint(6) + 6;
2113 /* Arrow -- XXX no defense */
2116 if (seen) obvious = TRUE;
2117 if (r_ptr->flags3 & (RF3_RES_ALL))
2120 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2122 note = " is immune.";
2125 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2131 /* Plasma -- XXX perhaps check ELEC or FIRE */
2134 if (seen) obvious = TRUE;
2135 if (r_ptr->flags3 & (RF3_RES_ALL))
2138 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2140 note = " is immune.";
2143 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2146 if (r_ptr->flags3 & RF3_RES_PLAS)
2149 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2154 dam *= 3; dam /= randint(6) + 6;
2156 r_ptr->r_flags3 |= (RF3_RES_PLAS);
2161 /* Nether -- see above */
2164 if (seen) obvious = TRUE;
2165 if (r_ptr->flags3 & (RF3_RES_ALL))
2168 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2170 note = " is immune.";
2173 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2176 if (r_ptr->flags3 & RF3_UNDEAD)
2179 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2181 note = " is immune.";
2185 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
2187 else if (r_ptr->flags3 & RF3_RES_NETH)
2190 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2195 dam *= 3; dam /= randint(6) + 6;
2197 if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
2199 else if (r_ptr->flags3 & RF3_EVIL)
2203 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2205 note = " resists somewhat.";
2208 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
2213 /* Water (acid) damage -- Water spirits/elementals are immune */
2216 if (seen) obvious = TRUE;
2217 if (r_ptr->flags3 & (RF3_RES_ALL))
2220 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2222 note = " is immune.";
2225 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2228 if (m_ptr->r_idx == MON_WATER_ELEM || m_ptr->r_idx == MON_UNMAKER)
2231 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2233 note = " is immune.";
2238 else if (r_ptr->flags3 & RF3_RES_WATE)
2241 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2246 dam *= 3; dam /= randint(6) + 6;
2247 if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
2252 /* Chaos -- Chaos breathers resist */
2255 if (seen) obvious = TRUE;
2256 if (r_ptr->flags3 & (RF3_RES_ALL))
2259 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2261 note = " is immune.";
2264 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2268 do_conf = (5 + randint(11) + r) / (r + 1);
2269 if ((r_ptr->flags4 & RF4_BR_CHAO) ||
2270 (m_ptr->r_idx == MON_STORMBRINGER) ||
2271 ((r_ptr->flags3 & RF3_DEMON) && (randint(3) == 1)))
2274 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2279 dam *= 3; dam /= randint(6) + 6;
2285 /* Shards -- Shard breathers resist */
2288 if (seen) obvious = TRUE;
2289 if (r_ptr->flags3 & (RF3_RES_ALL))
2292 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2294 note = " is immune.";
2297 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2300 if (r_ptr->flags4 & RF4_BR_SHAR)
2303 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2308 dam *= 3; dam /= randint(6) + 6;
2313 /* Rocket: Shard resistance helps */
2316 if (seen) obvious = TRUE;
2318 if (r_ptr->flags3 & (RF3_RES_ALL))
2321 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2323 note = " is immune.";
2326 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2329 if (r_ptr->flags4 & RF4_BR_SHAR)
2332 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2334 note = " resists somewhat.";
2343 /* Sound -- Sound breathers resist */
2346 if (seen) obvious = TRUE;
2347 if (r_ptr->flags3 & (RF3_RES_ALL))
2350 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2352 note = " is immune.";
2355 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2358 do_stun = (10 + randint(15) + r) / (r + 1);
2359 if (r_ptr->flags4 & RF4_BR_SOUN)
2362 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2367 dam *= 2; dam /= randint(6) + 6;
2375 if (seen) obvious = TRUE;
2376 if (r_ptr->flags3 & (RF3_RES_ALL))
2379 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2381 note = " is immune.";
2384 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2387 do_conf = (10 + randint(15) + r) / (r + 1);
2388 if (r_ptr->flags4 & RF4_BR_CONF)
2391 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2396 dam *= 2; dam /= randint(6) + 6;
2398 else if (r_ptr->flags3 & RF3_NO_CONF)
2401 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2403 note = " resists somewhat.";
2411 /* Disenchantment -- Breathers and Disenchanters resist */
2414 if (seen) obvious = TRUE;
2415 if (r_ptr->flags3 & (RF3_RES_ALL))
2418 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2420 note = " is immune.";
2423 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2426 if (r_ptr->flags3 & RF3_RES_DISE)
2429 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2434 dam *= 3; dam /= randint(6) + 6;
2435 if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
2440 /* Nexus -- Breathers and Existers resist */
2443 if (seen) obvious = TRUE;
2444 if (r_ptr->flags3 & (RF3_RES_ALL))
2447 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2449 note = " is immune.";
2452 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2455 if (r_ptr->flags3 & RF3_RES_NEXU)
2458 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2463 dam *= 3; dam /= randint(6) + 6;
2464 if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
2472 if (seen) obvious = TRUE;
2473 if (r_ptr->flags3 & (RF3_RES_ALL))
2476 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2478 note = " is immune.";
2481 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2484 do_stun = (randint(15) + r) / (r + 1);
2485 if (r_ptr->flags4 & RF4_BR_WALL)
2488 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2493 dam *= 3; dam /= randint(6) + 6;
2498 /* Inertia -- breathers resist */
2501 if (seen) obvious = TRUE;
2502 if (r_ptr->flags3 & (RF3_RES_ALL))
2505 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2507 note = " is immune.";
2510 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2513 if (r_ptr->flags4 & (RF4_BR_INER))
2516 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2521 dam *= 3; dam /= randint(6) + 6;
2525 /* Powerful monsters can resist */
2526 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2527 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2531 /* Normal monsters slow down */
2537 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2539 note = " starts moving slower.";
2542 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2543 if (c_ptr->m_idx == p_ptr->riding)
2544 p_ptr->update |= (PU_BONUS);
2550 /* Time -- breathers resist */
2553 if (seen) obvious = TRUE;
2554 if (r_ptr->flags3 & (RF3_RES_ALL))
2557 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2559 note = " is immune.";
2562 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2565 if (r_ptr->flags4 & (RF4_BR_TIME))
2568 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2573 dam *= 3; dam /= randint(6) + 6;
2575 else do_time = (dam+1)/2;
2579 /* Gravity -- breathers resist */
2582 bool resist_tele = FALSE;
2584 if (seen) obvious = TRUE;
2586 if (r_ptr->flags3 & (RF3_RES_ALL))
2589 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2591 note = " is immune.";
2594 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2597 if (r_ptr->flags3 & (RF3_RES_TELE))
2599 if (r_ptr->flags1 & (RF1_UNIQUE))
2601 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2603 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2605 note = " is unaffected!";
2610 else if (r_ptr->level > randint(100))
2612 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
2614 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2623 if (!resist_tele) do_dist = 10;
2625 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2627 if (r_ptr->flags4 & (RF4_BR_GRAV))
2630 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2635 dam *= 3; dam /= randint(6) + 6;
2641 /* Powerful monsters can resist */
2642 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2643 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2647 /* Normal monsters slow down */
2653 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2655 note = " starts moving slower.";
2658 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2659 if (c_ptr->m_idx == p_ptr->riding)
2660 p_ptr->update |= (PU_BONUS);
2664 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
2666 /* Attempt a saving throw */
2667 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2668 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2672 /* No obvious effect */
2674 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2676 note = " is unaffected!";
2690 if (seen) obvious = TRUE;
2691 if (r_ptr->flags3 & (RF3_RES_ALL))
2694 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2696 note = " is immune.";
2699 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2707 case GF_DISINTEGRATE:
2709 if (seen) obvious = TRUE;
2710 if (r_ptr->flags3 & (RF3_RES_ALL))
2713 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2715 note = " is immune.";
2718 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2721 if (r_ptr->flags3 & RF3_HURT_ROCK)
2723 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2725 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2726 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2728 note = " loses some skin!";
2729 note_dies = " evaporates!";
2739 if (seen) obvious = TRUE;
2741 /* PSI only works if the monster can see you! -- RG */
2742 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2746 note = "¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª";
2748 note = " can't see you, and isn't affected!";
2753 if (r_ptr->flags3 & (RF3_RES_ALL))
2756 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2758 note = " is immune.";
2761 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2764 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2768 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2770 note = " is immune!";
2772 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2775 else if ((r_ptr->flags2 & RF2_STUPID) ||
2776 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2777 (r_ptr->flags3 & RF3_ANIMAL) ||
2778 (r_ptr->level > randint(3 * dam)))
2782 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2789 * Powerful demons & undead can turn a mindcrafter's
2790 * attacks back on them
2792 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2793 (r_ptr->flags3 & RF3_DEMON)) &&
2794 (r_ptr->level > p_ptr->lev / 2) &&
2799 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2802 msg_format("%^s%s corrupted mind backlashes your attack!",
2803 m_name, (seen ? "'s" : "s"));
2807 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
2810 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2812 msg_print("You resist the effects!");
2818 /* Injure +/- confusion */
2819 monster_desc(killer, m_ptr, 0x88);
2820 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2821 if (randint(4) == 1)
2826 set_confused(p_ptr->confused + 3 + randint(dam));
2829 set_stun(p_ptr->stun + randint(dam));
2833 if (r_ptr->flags3 & RF3_NO_FEAR)
2835 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2837 note = " is unaffected.";
2841 set_afraid(p_ptr->afraid + 3 + randint(dam));
2845 if (!p_ptr->free_act)
2846 (void)set_paralyzed(p_ptr->paralyzed + randint(dam));
2855 if ((dam > 0) && (randint(4) == 1))
2860 do_conf = 3 + randint(dam);
2863 do_stun = 3 + randint(dam);
2866 do_fear = 3 + randint(dam);
2870 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2872 note = " falls asleep!";
2875 do_sleep = 3 + randint(dam);
2881 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2883 note_dies = " collapses, a mindless husk.";
2891 if (seen) obvious = TRUE;
2892 if (r_ptr->flags3 & (RF3_RES_ALL))
2895 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2897 note = " is immune.";
2900 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
2903 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2907 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2909 note = " is immune!";
2913 else if ((r_ptr->flags2 & RF2_STUPID) ||
2914 (r_ptr->flags2 & RF2_WEIRD_MIND) ||
2915 (r_ptr->flags3 & RF3_ANIMAL) ||
2916 (r_ptr->level > randint(3 * dam)))
2920 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2927 * Powerful demons & undead can turn a mindcrafter's
2928 * attacks back on them
2930 if (((r_ptr->flags3 & RF3_UNDEAD) ||
2931 (r_ptr->flags3 & RF3_DEMON)) &&
2932 (r_ptr->level > p_ptr->lev / 2) &&
2937 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
2940 msg_format("%^s%s corrupted mind backlashes your attack!",
2941 m_name, (seen ? "'s" : "s"));
2945 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
2948 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2950 msg_print("You resist the effects!");
2956 /* Injure + mana drain */
2957 monster_desc(killer, m_ptr, 0x88);
2959 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2961 msg_print("Your psychic energy is drained!");
2964 p_ptr->csp = MAX(0, p_ptr->csp - damroll(5, dam) / 2);
2965 p_ptr->redraw |= PR_MANA;
2966 p_ptr->window |= (PW_SPELL);
2967 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2974 int b = damroll(5, dam) / 4;
2976 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª",
2979 msg_format("You convert %s%s pain into psychic energy!",
2980 m_name, (seen ? "'s" : "s"));
2983 b = MIN(p_ptr->msp, p_ptr->csp + b);
2985 p_ptr->redraw |= PR_MANA;
2986 p_ptr->window |= (PW_SPELL);
2990 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2992 note_dies = " collapses, a mindless husk.";
2998 case GF_TELEKINESIS:
3000 if (seen) obvious = TRUE;
3001 if (r_ptr->flags3 & (RF3_RES_ALL))
3004 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3006 note = " is immune.";
3009 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3014 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3019 do_stun = damroll((p_ptr->lev / 10) + 3 , dam) + 1;
3021 /* Attempt a saving throw */
3022 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3023 (r_ptr->level > 5 + randint(dam)))
3027 /* No obvious effect */
3033 /* Psycho-spear -- powerful magic missile */
3036 if (seen) obvious = TRUE;
3037 if (r_ptr->flags3 & (RF3_RES_ALL))
3040 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3042 note = " is immune.";
3045 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3051 /* Meteor -- powerful magic missile */
3054 if (seen) obvious = TRUE;
3055 if (r_ptr->flags3 & (RF3_RES_ALL))
3058 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3060 note = " is immune.";
3063 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3071 if (!is_hostile(m_ptr)) break;
3072 if (seen) obvious = TRUE;
3074 if (r_ptr->flags3 & (RF3_RES_ALL))
3077 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3079 note = " is immune.";
3082 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3085 /* Attempt a saving throw */
3086 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3087 (r_ptr->flags1 & RF1_QUESTOR) ||
3088 (r_ptr->flags3 & RF3_NO_CONF) ||
3089 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3091 /* Memorize a flag */
3092 if (r_ptr->flags3 & RF3_NO_CONF)
3094 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3101 * Powerful demons & undead can turn a mindcrafter's
3102 * attacks back on them
3104 if (((r_ptr->flags3 & RF3_UNDEAD) ||
3105 (r_ptr->flags3 & RF3_DEMON)) &&
3106 (r_ptr->level > p_ptr->lev / 2) &&
3111 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª",
3114 msg_format("%^s%s corrupted mind backlashes your attack!",
3115 m_name, (seen ? "'s" : "s"));
3119 if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
3122 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3124 msg_print("You resist the effects!");
3130 /* Confuse, stun, terrify */
3134 set_stun(p_ptr->stun + dam / 2);
3137 set_confused(p_ptr->confused + dam / 2);
3141 if (r_ptr->flags3 & RF3_NO_FEAR)
3143 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3145 note = " is unaffected.";
3149 set_afraid(p_ptr->afraid + dam);
3156 /* No obvious effect */
3158 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3160 note = " is unaffected!";
3168 if ((dam > 29) && (randint(100) < dam))
3171 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3173 note = " is in your thrall!";
3194 /* No "real" damage */
3201 /* Ice -- Cold + Cuts + Stun */
3204 if (seen) obvious = TRUE;
3205 if (r_ptr->flags3 & (RF3_RES_ALL))
3208 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3210 note = " is immune.";
3213 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3216 do_stun = (randint(15) + 1) / (r + 1);
3217 if (r_ptr->flags3 & RF3_IM_COLD)
3220 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3222 note = " resists a lot.";
3226 if (seen) r_ptr->r_flags3 |= (RF3_IM_COLD);
3235 if (seen) obvious = TRUE;
3237 if (r_ptr->flags3 & (RF3_RES_ALL))
3240 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3242 note = " is immune.";
3245 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3248 if (!monster_living(r_ptr))
3250 if (r_ptr->flags3 & RF3_UNDEAD)
3252 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3255 if (r_ptr->flags3 & (RF3_DEMON))
3257 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
3261 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3263 note = " is unaffected!";
3269 else do_time = (dam+7)/8;
3277 if (seen) obvious = TRUE;
3279 if (r_ptr->flags3 & (RF3_RES_ALL))
3282 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3284 note = " is immune.";
3287 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3290 if ((r_ptr->flags3 & RF3_UNDEAD) ||
3291 (r_ptr->flags3 & RF3_NONLIVING))
3293 if (r_ptr->flags3 & RF3_UNDEAD)
3295 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
3299 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3301 note = " is immune.";
3307 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3308 (randint(888) != 666)) ||
3309 (((r_ptr->level + randint(20)) > randint(p_ptr->lev + randint(10))) &&
3310 randint(100) != 66))
3313 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3325 /* Polymorph monster (Use "dam" as "power") */
3328 if (seen) obvious = TRUE;
3330 if (r_ptr->flags3 & (RF3_RES_ALL))
3333 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3335 note = " is immune.";
3338 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3341 /* Attempt to polymorph (see below) */
3344 /* Powerful monsters can resist */
3345 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3346 (r_ptr->flags1 & RF1_QUESTOR) ||
3347 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3350 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3352 note = " is unaffected!";
3359 /* No "real" damage */
3366 /* Clone monsters (Ignore "dam") */
3369 bool friendly = FALSE;
3372 if (seen) obvious = TRUE;
3374 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)))
3377 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3379 note = " is unaffected!";
3385 m_ptr->hp = m_ptr->maxhp;
3387 /* Attempt to clone. */
3388 if (multiply_monster(c_ptr->m_idx, TRUE, friendly, pet))
3391 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3399 /* No "real" damage */
3406 /* Heal Monster (use "dam" as amount of healing) */
3409 if (seen) obvious = TRUE;
3414 if (m_ptr->maxhp < m_ptr->max_maxhp)
3417 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3419 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3421 m_ptr->maxhp = m_ptr->max_maxhp;
3427 if (seen) obvious = TRUE;
3435 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3437 msg_format("%^s is no longer stunned.", m_name);
3441 if (m_ptr->confused)
3444 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3446 msg_format("%^s is no longer confused.", m_name);
3448 m_ptr->confused = 0;
3453 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3455 msg_format("%^s recovers %s courage.", m_name, m_poss);
3461 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3464 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3466 chg_virtue(V_VITALITY, 1);
3468 if (r_ptr->flags1 & RF1_UNIQUE)
3469 chg_virtue(V_INDIVIDUALISM, 1);
3471 if (is_friendly(m_ptr))
3472 chg_virtue(V_HONOUR, 1);
3473 else if (!(r_ptr->flags3 & RF3_EVIL))
3475 if (r_ptr->flags3 & RF3_GOOD)
3476 chg_virtue(V_COMPASSION, 2);
3478 chg_virtue(V_COMPASSION, 1);
3481 if (m_ptr->r_idx == MON_LEPER)
3484 chg_virtue(V_COMPASSION, 5);
3487 if (r_ptr->flags3 & RF3_ANIMAL)
3488 chg_virtue(V_NATURE, 1);
3490 /* Redraw (later) if needed */
3491 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3492 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3496 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3498 note = " looks healthier.";
3502 /* No "real" damage */
3508 /* Speed Monster (Ignore "dam") */
3511 if (seen) obvious = TRUE;
3517 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3519 note = " starts moving faster.";
3522 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3524 if (c_ptr->m_idx == p_ptr->riding)
3525 p_ptr->update |= (PU_BONUS);
3527 if (r_ptr->flags1 & RF1_UNIQUE)
3528 chg_virtue(V_INDIVIDUALISM, 1);
3529 if (is_friendly(m_ptr))
3530 chg_virtue(V_HONOUR, 1);
3532 /* No "real" damage */
3538 /* Slow Monster (Use "dam" as "power") */
3541 if (seen) obvious = TRUE;
3543 if (r_ptr->flags3 & (RF3_RES_ALL))
3546 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3548 note = " is immune.";
3551 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3554 /* Powerful monsters can resist */
3555 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3556 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3559 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3561 note = " is unaffected!";
3567 /* Normal monsters slow down */
3573 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3575 note = " starts moving slower.";
3578 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3580 if (c_ptr->m_idx == p_ptr->riding)
3581 p_ptr->update |= (PU_BONUS);
3584 /* No "real" damage */
3590 /* Sleep (Use "dam" as "power") */
3593 if (seen) obvious = TRUE;
3595 if (r_ptr->flags3 & (RF3_RES_ALL))
3598 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3600 note = " is immune.";
3603 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3606 /* Attempt a saving throw */
3607 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3608 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3609 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3611 /* Memorize a flag */
3612 if (r_ptr->flags3 & RF3_NO_SLEEP)
3614 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3617 /* No obvious effect */
3619 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3621 note = " is unaffected!";
3628 /* Go to sleep (much) later */
3630 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3632 note = " falls asleep!";
3638 /* No "real" damage */
3644 /* Sleep (Use "dam" as "power") */
3647 if (seen) obvious = TRUE;
3649 if (r_ptr->flags3 & (RF3_RES_ALL))
3652 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3654 note = " is immune.";
3657 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3660 /* Attempt a saving throw */
3661 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3662 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3665 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3667 note = " is unaffected!";
3674 /* Go to sleep (much) later */
3676 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3678 note = " is suspended!";
3684 /* No "real" damage */
3693 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3694 vir = virtue_number(V_HARMONY);
3697 dam += p_ptr->virtues[vir-1]/10;
3700 vir = virtue_number(V_INDIVIDUALISM);
3703 dam -= p_ptr->virtues[vir-1]/20;
3706 if (seen) obvious = TRUE;
3708 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3711 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3713 note = " is immune.";
3716 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3720 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3723 /* Attempt a saving throw */
3724 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3725 (r_ptr->flags3 & RF3_NO_CONF) ||
3726 (m_ptr->mflag2 & MFLAG_NOPET) ||
3727 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3729 /* Memorize a flag */
3730 if (r_ptr->flags3 & RF3_NO_CONF)
3732 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3736 /* No obvious effect */
3738 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3740 note = " is unaffected!";
3745 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3747 else if (p_ptr->aggravate)
3750 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3752 note = " hates you too much!";
3755 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3760 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3762 note = " suddenly seems friendly!";
3767 chg_virtue(V_INDIVIDUALISM, -1);
3768 if (r_ptr->flags3 & RF3_ANIMAL)
3769 chg_virtue(V_NATURE, 1);
3772 /* No "real" damage */
3777 /* Control undead */
3778 case GF_CONTROL_UNDEAD:
3781 if (seen) obvious = TRUE;
3783 vir = virtue_number(V_UNLIFE);
3786 dam += p_ptr->virtues[vir-1]/10;
3789 vir = virtue_number(V_INDIVIDUALISM);
3792 dam -= p_ptr->virtues[vir-1]/20;
3795 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3798 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3800 note = " is immune.";
3803 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3807 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3810 /* Attempt a saving throw */
3811 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3812 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3813 (m_ptr->mflag2 & MFLAG_NOPET) ||
3814 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3816 /* No obvious effect */
3818 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3820 note = " is unaffected!";
3824 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3826 else if (p_ptr->aggravate)
3829 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3831 note = " hates you too much!";
3834 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3839 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3841 note = " is in your thrall!";
3847 /* No "real" damage */
3853 case GF_CONTROL_DEMON:
3856 if (seen) obvious = TRUE;
3858 vir = virtue_number(V_UNLIFE);
3861 dam += p_ptr->virtues[vir-1]/10;
3864 vir = virtue_number(V_INDIVIDUALISM);
3867 dam -= p_ptr->virtues[vir-1]/20;
3870 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3873 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3875 note = " is immune.";
3878 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3882 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3885 /* Attempt a saving throw */
3886 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3887 (!(r_ptr->flags3 & RF3_DEMON)) ||
3888 (m_ptr->mflag2 & MFLAG_NOPET) ||
3889 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3891 /* No obvious effect */
3893 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3895 note = " is unaffected!";
3899 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3901 else if (p_ptr->aggravate)
3904 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3906 note = " hates you too much!";
3909 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3914 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3916 note = " is in your thrall!";
3922 /* No "real" damage */
3928 case GF_CONTROL_ANIMAL:
3932 if (seen) obvious = TRUE;
3934 vir = virtue_number(V_NATURE);
3937 dam += p_ptr->virtues[vir-1]/10;
3940 vir = virtue_number(V_INDIVIDUALISM);
3943 dam -= p_ptr->virtues[vir-1]/20;
3946 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3949 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3951 note = " is immune.";
3954 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3958 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3961 /* Attempt a saving throw */
3962 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3963 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3964 (m_ptr->mflag2 & MFLAG_NOPET) ||
3965 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3966 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3968 /* Memorize a flag */
3969 if (r_ptr->flags3 & (RF3_NO_CONF))
3971 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3975 /* No obvious effect */
3977 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3979 note = " is unaffected!";
3983 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3985 else if (p_ptr->aggravate)
3988 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3990 note = " hates you too much!";
3993 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3998 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4000 note = " is tamed!";
4005 if (r_ptr->flags3 & RF3_ANIMAL)
4006 chg_virtue(V_NATURE, 1);
4009 /* No "real" damage */
4015 case GF_CONTROL_LIVING:
4019 vir = virtue_number(V_UNLIFE);
4020 if (seen) obvious = TRUE;
4022 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4023 vir = virtue_number(V_UNLIFE);
4026 dam -= p_ptr->virtues[vir-1]/10;
4029 vir = virtue_number(V_INDIVIDUALISM);
4032 dam -= p_ptr->virtues[vir-1]/20;
4035 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4036 if (dam < 1) dam = 1;
4038 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4040 msg_format("You stare into %s.", m_name);
4042 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4045 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4047 note = " is immune.";
4050 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4054 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4057 /* Attempt a saving throw */
4058 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4059 (m_ptr->mflag2 & MFLAG_NOPET) ||
4060 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
4061 ((r_ptr->level+10) > randint(dam)))
4064 /* No obvious effect */
4066 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4068 note = " is unaffected!";
4072 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4074 else if (p_ptr->aggravate)
4077 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4079 note = " hates you too much!";
4082 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4087 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4089 note = " is tamed!";
4094 if (r_ptr->flags3 & RF3_ANIMAL)
4095 chg_virtue(V_NATURE, 1);
4098 /* No "real" damage */
4103 /* Confusion (Use "dam" as "power") */
4106 if (seen) obvious = TRUE;
4108 if (r_ptr->flags3 & (RF3_RES_ALL))
4111 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4113 note = " is immune.";
4116 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4119 /* Get confused later */
4120 do_conf = damroll(3, (dam / 2)) + 1;
4122 /* Attempt a saving throw */
4123 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4124 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4125 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4127 /* Memorize a flag */
4128 if (r_ptr->flags3 & (RF3_NO_CONF))
4130 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4136 /* No obvious effect */
4138 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4140 note = " is unaffected!";
4146 /* No "real" damage */
4153 if (seen) obvious = TRUE;
4155 if (r_ptr->flags3 & (RF3_RES_ALL))
4158 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4160 note = " is immune.";
4163 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4166 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4168 /* Attempt a saving throw */
4169 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4170 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4175 /* No obvious effect */
4177 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4179 note = " is unaffected!";
4185 /* No "real" damage */
4193 /* Lite, but only hurts susceptible creatures */
4201 if (r_ptr->flags3 & (RF3_RES_ALL))
4207 if (r_ptr->flags3 & (RF3_HURT_LITE))
4209 /* Obvious effect */
4210 if (seen) obvious = TRUE;
4212 /* Memorize the effects */
4213 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4215 /* Special effect */
4217 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4218 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4220 note = " cringes from the light!";
4221 note_dies = " shrivels away in the light!";
4226 /* Normally no damage */
4238 /* Lite -- opposite of Dark */
4241 if (seen) obvious = TRUE;
4242 if (r_ptr->flags3 & (RF3_RES_ALL))
4245 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4247 note = " is immune.";
4250 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4253 if (r_ptr->flags4 & (RF4_BR_LITE))
4256 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4261 dam *= 2; dam /= (randint(6)+6);
4263 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4265 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4267 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4268 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4270 note = " cringes from the light!";
4271 note_dies = " shrivels away in the light!";
4280 /* Dark -- opposite of Lite */
4283 if (seen) obvious = TRUE;
4285 if (r_ptr->flags3 & (RF3_RES_ALL))
4288 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4290 note = " is immune.";
4293 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4296 /* Likes darkness... */
4297 if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
4298 (r_ptr->flags3 & RF3_ORC) ||
4299 (r_ptr->flags3 & RF3_HURT_LITE))
4302 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4307 dam *= 2; dam /= (randint(6)+6);
4316 if (r_ptr->flags3 & (RF3_RES_ALL))
4321 /* Hurt by rock remover */
4322 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4325 if (seen) obvious = TRUE;
4327 /* Memorize the effects */
4328 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4330 /* Cute little message */
4332 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4333 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4335 note = " loses some skin!";
4336 note_dies = " dissolves!";
4341 /* Usually, ignore the effects */
4352 /* Teleport undead (Use "dam" as "power") */
4353 case GF_AWAY_UNDEAD:
4355 /* Only affect undead */
4356 if (r_ptr->flags3 & (RF3_UNDEAD))
4358 bool resists_tele = FALSE;
4360 if (r_ptr->flags3 & (RF3_RES_TELE))
4362 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4364 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4366 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4368 note = " is unaffected!";
4371 resists_tele = TRUE;
4373 else if (r_ptr->level > randint(100))
4375 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4377 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4382 resists_tele = TRUE;
4388 if (seen) obvious = TRUE;
4389 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4401 /* No "real" damage */
4407 /* Teleport evil (Use "dam" as "power") */
4410 /* Only affect evil */
4411 if (r_ptr->flags3 & (RF3_EVIL))
4413 bool resists_tele = FALSE;
4415 if (r_ptr->flags3 & (RF3_RES_TELE))
4417 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4419 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4421 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4423 note = " is unaffected!";
4426 resists_tele = TRUE;
4428 else if (r_ptr->level > randint(100))
4430 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4432 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4437 resists_tele = TRUE;
4443 if (seen) obvious = TRUE;
4444 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4456 /* No "real" damage */
4462 /* Teleport monster (Use "dam" as "power") */
4465 bool resists_tele = FALSE;
4466 if (r_ptr->flags3 & (RF3_RES_TELE))
4468 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4470 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4472 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4474 note = " is unaffected!";
4477 resists_tele = TRUE;
4479 else if (r_ptr->level > randint(100))
4481 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4483 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4488 resists_tele = TRUE;
4495 if (seen) obvious = TRUE;
4497 /* Prepare to teleport */
4501 /* No "real" damage */
4507 /* Turn undead (Use "dam" as "power") */
4508 case GF_TURN_UNDEAD:
4510 if (r_ptr->flags3 & (RF3_RES_ALL))
4515 /* Only affect undead */
4516 if (r_ptr->flags3 & (RF3_UNDEAD))
4518 /* Learn about type */
4519 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4522 if (seen) obvious = TRUE;
4524 /* Apply some fear */
4525 do_fear = damroll(3, (dam / 2)) + 1;
4527 /* Attempt a saving throw */
4528 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4530 /* No obvious effect */
4532 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4534 note = " is unaffected!";
4549 /* No "real" damage */
4555 /* Turn evil (Use "dam" as "power") */
4558 if (r_ptr->flags3 & (RF3_RES_ALL))
4563 /* Only affect evil */
4564 if (r_ptr->flags3 & (RF3_EVIL))
4566 /* Learn about type */
4567 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4570 if (seen) obvious = TRUE;
4572 /* Apply some fear */
4573 do_fear = damroll(3, (dam / 2)) + 1;
4575 /* Attempt a saving throw */
4576 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4578 /* No obvious effect */
4580 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4582 note = " is unaffected!";
4597 /* No "real" damage */
4603 /* Turn monster (Use "dam" as "power") */
4606 if (r_ptr->flags3 & (RF3_RES_ALL))
4612 if (seen) obvious = TRUE;
4614 /* Apply some fear */
4615 do_fear = damroll(3, (dam / 2)) + 1;
4617 /* Attempt a saving throw */
4618 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4619 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4620 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4622 /* No obvious effect */
4624 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4626 note = " is unaffected!";
4633 /* No "real" damage */
4640 case GF_DISP_UNDEAD:
4642 if (r_ptr->flags3 & (RF3_RES_ALL))
4648 /* Only affect undead */
4649 if (r_ptr->flags3 & (RF3_UNDEAD))
4651 /* Learn about type */
4652 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4655 if (seen) obvious = TRUE;
4659 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4660 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4662 note = " shudders.";
4663 note_dies = " dissolves!";
4685 if (r_ptr->flags3 & (RF3_RES_ALL))
4691 /* Only affect evil */
4692 if (r_ptr->flags3 & (RF3_EVIL))
4694 /* Learn about type */
4695 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4698 if (seen) obvious = TRUE;
4702 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4703 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4705 note = " shudders.";
4706 note_dies = " dissolves!";
4727 if (r_ptr->flags3 & (RF3_RES_ALL))
4733 /* Only affect good */
4734 if (r_ptr->flags3 & (RF3_GOOD))
4736 /* Learn about type */
4737 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
4740 if (seen) obvious = TRUE;
4744 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4745 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4747 note = " shudders.";
4748 note_dies = " dissolves!";
4767 case GF_DISP_LIVING:
4769 if (r_ptr->flags3 & (RF3_RES_ALL))
4775 /* Only affect non-undead */
4776 if (monster_living(r_ptr))
4779 if (seen) obvious = TRUE;
4783 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4784 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4786 note = " shudders.";
4787 note_dies = " dissolves!";
4808 if (r_ptr->flags3 & (RF3_RES_ALL))
4814 /* Only affect demons */
4815 if (r_ptr->flags3 & (RF3_DEMON))
4817 /* Learn about type */
4818 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
4821 if (seen) obvious = TRUE;
4825 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4826 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4828 note = " shudders.";
4829 note_dies = " dissolves!";
4847 /* Dispel monster */
4850 if (r_ptr->flags3 & (RF3_RES_ALL))
4857 if (seen) obvious = TRUE;
4861 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4862 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4864 note = " shudders.";
4865 note_dies = " dissolves!";
4875 if (seen) obvious = TRUE;
4876 if (r_ptr->flags3 & (RF3_RES_ALL))
4879 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4881 note = " is immune.";
4884 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4888 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4892 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
4894 msg_format("You draws psychic energy from %s.", m_name);
4897 (void)hp_player(dam);
4902 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
4904 msg_format("%s is unaffected.", m_name);
4914 if (seen) obvious = TRUE;
4917 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4919 msg_format("You gazes intently at %s.", m_name);
4922 if (r_ptr->flags3 & (RF3_RES_ALL))
4925 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4927 note = " is immune.";
4930 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4934 /* Attempt a saving throw */
4935 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4936 (r_ptr->flags3 & RF3_NO_CONF) ||
4937 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4939 /* Memorize a flag */
4940 if (r_ptr->flags3 & (RF3_NO_CONF))
4942 r_ptr->r_flags3 |= (RF3_NO_CONF);
4945 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
4947 note = "is unaffected!";
4954 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
4955 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
4957 msg_format("%^s is blasted by psionic energy.", m_name);
4958 note_dies = " collapses, a mindless husk.";
4961 do_conf = rand_int(8) + 8;
4967 case GF_BRAIN_SMASH:
4969 if (seen) obvious = TRUE;
4972 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4974 msg_format("You gazes intently at %s.", m_name);
4977 if (r_ptr->flags3 & (RF3_RES_ALL))
4980 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4982 note = " is immune.";
4985 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4989 /* Attempt a saving throw */
4990 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4991 (r_ptr->flags3 & RF3_NO_CONF) ||
4992 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4994 /* Memorize a flag */
4995 if (r_ptr->flags3 & (RF3_NO_CONF))
4997 r_ptr->r_flags3 |= (RF3_NO_CONF);
5000 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5002 note = "is unaffected!";
5009 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5010 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5012 msg_format("%^s is blasted by psionic energy.", m_name);
5013 note_dies = " collapses, a mindless husk.";
5016 do_conf = rand_int(8) + 8;
5017 do_stun = rand_int(8) + 8;
5018 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5019 if (c_ptr->m_idx == p_ptr->riding)
5020 p_ptr->update |= (PU_BONUS);
5028 if (seen) obvious = TRUE;
5031 msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5033 msg_format("You points at %s and curses.", m_name);
5036 if (r_ptr->flags3 & (RF3_RES_ALL))
5039 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5041 note = " is immune.";
5044 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5048 /* Attempt a saving throw */
5049 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5053 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5055 note = "is unaffected!";
5065 if (seen) obvious = TRUE;
5068 msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5070 msg_format("You points at %s and curses horribly.", m_name);
5073 if (r_ptr->flags3 & (RF3_RES_ALL))
5076 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5078 note = " is immune.";
5081 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5085 /* Attempt a saving throw */
5086 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5090 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5092 note = "is unaffected!";
5102 if (seen) obvious = TRUE;
5105 msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
5107 msg_format("You points at %s, incanting terribly!", m_name);
5110 if (r_ptr->flags3 & (RF3_RES_ALL))
5113 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5115 note = " is immune.";
5118 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5122 /* Attempt a saving throw */
5123 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5127 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5129 note = "is unaffected!";
5139 if (seen) obvious = TRUE;
5142 msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
5144 msg_format("You points at %s, screaming th word, 'DIE!'.", m_name);
5147 if (r_ptr->flags3 & (RF3_RES_ALL))
5150 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5152 note = " is immune.";
5155 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5159 /* Attempt a saving throw */
5160 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5164 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5166 note = "is unaffected!";
5176 if (seen) obvious = TRUE;
5178 if (r_ptr->flags3 & (RF3_RES_ALL))
5181 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5183 note = " is immune.";
5186 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5190 if (r_ptr->flags1 & RF1_UNIQUE)
5193 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5195 note = "is unaffected!";
5201 if ((p_ptr->lev + randint(dam)) >
5202 (r_ptr->level + randint(200)))
5204 dam = ((40 + randint(20)) * m_ptr->hp) / 100;
5206 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5211 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5221 /* Capture monster */
5225 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5226 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5229 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5231 msg_format("%^s is unaffected.", m_name);
5237 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5238 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
5239 nokori_hp = m_ptr->maxhp * 3 / 10;
5241 nokori_hp = m_ptr->maxhp * 3 / 20;
5243 if (m_ptr->hp >= nokori_hp)
5246 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5248 msg_format("You need to weaken %s more.", m_name);
5252 else if (m_ptr->hp < rand_int(nokori_hp))
5254 if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5256 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5258 msg_format("You captures %^s!", m_name);
5260 cap_mon = m_list[c_ptr->m_idx].r_idx;
5261 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5262 cap_hp = m_list[c_ptr->m_idx].hp;
5263 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5264 if (m_list[c_ptr->m_idx].nickname)
5265 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5268 if (c_ptr->m_idx == p_ptr->riding)
5270 if (rakuba(-1, FALSE))
5273 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5275 msg_format("You have fallen from %s.", m_name);
5280 delete_monster_idx(c_ptr->m_idx);
5287 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5289 msg_format("You failed to capture %s.", m_name);
5298 if (seen) obvious = TRUE;
5300 if (dam == HISSATSU_NYUSIN)
5304 bool success = FALSE;
5305 for (i = 0; i < 8; i++)
5307 if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
5310 if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
5319 if ((ny != py) || (nx != px))
5321 teleport_player_to(ny, nx, FALSE);
5323 msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
5325 msg_format("You quickly jump in and attack %s!", m_name);
5332 msg_print("¼ºÇÔ¡ª");
5334 msg_print("Failed!");
5341 return (py_attack(y, x, dam));
5344 msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
5346 msg_print("You attack the empty air.");
5352 /* Sleep (Use "dam" as "power") */
5358 if (seen) obvious = TRUE;
5360 if (r_ptr->flags3 & (RF3_RES_ALL))
5363 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5365 note = " is immune.";
5368 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5371 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5374 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5376 note = " is immune!";
5380 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5386 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5388 note = " is immune!";
5395 if (one_in_(5)) effect = 1;
5396 else if (one_in_(4)) effect = 2;
5397 else if (one_in_(3)) effect = 3;
5402 /* Powerful monsters can resist */
5403 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5404 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5407 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5409 note = " is unaffected!";
5415 /* Normal monsters slow down */
5421 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5423 note = " starts moving slower.";
5426 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5428 if (c_ptr->m_idx == p_ptr->riding)
5429 p_ptr->update |= (PU_BONUS);
5433 else if (effect == 2)
5435 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5437 /* Attempt a saving throw */
5438 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5439 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5444 /* No obvious effect */
5446 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5448 note = " is unaffected!";
5455 else if (effect == 3)
5457 /* Attempt a saving throw */
5458 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5459 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5460 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5462 /* Memorize a flag */
5463 if (r_ptr->flags3 & RF3_NO_SLEEP)
5465 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5468 /* No obvious effect */
5470 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5472 note = " is unaffected!";
5479 /* Go to sleep (much) later */
5481 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5483 note = " falls asleep!";
5493 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5495 note = " is immune!";
5499 /* No "real" damage */
5508 if (seen) obvious = TRUE;
5510 if (r_ptr->flags3 & (RF3_RES_ALL))
5513 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5515 note = " is immune.";
5518 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5522 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)
5529 if ((r_ptr->level > rand_int(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
5536 delete_monster_idx(c_ptr->m_idx);
5538 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5540 msg_format("%^s disappered!",m_name);
5544 take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5546 take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5550 chg_virtue(V_VITALITY, -1);
5555 p_ptr->redraw |= (PR_HP);
5558 p_ptr->window |= (PW_PLAYER);
5565 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5567 note = "is unaffected!";
5570 if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
5578 msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
5580 msg_format("You take a photograph of %s.",m_name);
5583 if (r_ptr->flags3 & (RF3_HURT_LITE))
5585 /* Obvious effect */
5586 if (seen) obvious = TRUE;
5588 /* Memorize the effects */
5589 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5591 /* Special effect */
5593 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5594 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5596 note = " cringes from the light!";
5597 note_dies = " shrivels away in the light!";
5602 /* Normally no damage */
5609 photo = m_ptr->r_idx;
5616 case GF_BLOOD_CURSE:
5618 if (seen) obvious = TRUE;
5619 if (r_ptr->flags3 & (RF3_RES_ALL))
5622 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5624 note = " is immune.";
5627 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5647 /* Absolutely no effect */
5648 if (skipped) return (FALSE);
5650 /* "Unique" monsters cannot be polymorphed */
5651 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5653 /* Quest monsters cannot be polymorphed */
5654 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5656 if (p_ptr->riding & (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5658 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5659 if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
5661 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5666 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5667 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5670 /* Modify the damage */
5672 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5674 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
5676 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5679 /* Check for death */
5680 if (dam > m_ptr->hp)
5682 /* Extract method of death */
5686 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5687 else if (do_poly && (randint(90) > r_ptr->level))
5689 if (polymorph_monster(y, x))
5692 if (seen) obvious = TRUE;
5694 /* Monster polymorphs */
5696 note = "¤¬ÊѿȤ·¤¿¡ª";
5702 /* Turn off the damage */
5705 /* Hack -- Get new monster */
5706 m_ptr = &m_list[c_ptr->m_idx];
5708 /* Hack -- Get new race */
5709 r_ptr = &r_info[m_ptr->r_idx];
5715 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5717 note = " is unaffected!";
5723 /* Handle "teleport" */
5727 if (seen) obvious = TRUE;
5731 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5733 note = " disappears!";
5736 chg_virtue(V_VALOUR, -1);
5739 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who));
5741 /* Hack -- get new location */
5745 /* Hack -- get new grid */
5746 c_ptr = &cave[y][x];
5749 /* Sound and Impact breathers never stun */
5751 !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
5752 !(r_ptr->flags4 & (RF4_BR_WALL)) &&
5753 !(r_ptr->flags3 & (RF3_NO_STUN)))
5756 if (seen) obvious = TRUE;
5762 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5764 note = " is more dazed.";
5767 tmp = m_ptr->stunned + (do_stun / 2);
5772 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5774 note = " is dazed.";
5781 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5787 /* Confusion and Chaos breathers (and sleepers) never confuse */
5789 !(r_ptr->flags3 & (RF3_NO_CONF)) &&
5790 !(r_ptr->flags4 & (RF4_BR_CONF)) &&
5791 !(r_ptr->flags4 & (RF4_BR_CHAO)))
5794 if (seen) obvious = TRUE;
5796 /* Already partially confused */
5797 if (m_ptr->confused)
5800 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5802 note = " looks more confused.";
5805 tmp = m_ptr->confused + (do_conf / 2);
5808 /* Was not confused */
5812 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5814 note = " looks confused.";
5820 /* Apply confusion */
5821 m_ptr->confused = (tmp < 200) ? tmp : 200;
5829 if (seen) obvious = TRUE;
5831 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
5836 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5838 note = " seems weakened.";
5840 m_ptr->maxhp -= do_time;
5841 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
5851 tmp = m_ptr->monfear + do_fear;
5854 m_ptr->monfear = (tmp < 200) ? tmp : 200;
5861 /* If another monster did the damage, hurt the monster by hand */
5864 /* Redraw (later) if needed */
5865 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5866 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5868 /* Wake the monster up */
5871 /* Hurt the monster */
5879 if (is_pet(m_ptr) && !(m_ptr->ml))
5882 /* Give detailed messages if destroyed */
5885 monster_desc(m_name, m_ptr, 0x100);
5888 msg_format("%^s%s", m_name, note);
5896 monster_gain_exp(who, m_ptr->r_idx);
5898 /* Generate treasure, etc */
5899 monster_death(c_ptr->m_idx, FALSE);
5901 /* Delete the monster */
5902 delete_monster_idx(c_ptr->m_idx);
5907 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
5909 msg_print("You feel sad for a moment.");
5915 /* Damaged monster */
5918 /* Give detailed messages if visible or destroyed */
5919 if (note && seen) msg_format("%^s%s", m_name, note);
5921 /* Hack -- Pain message */
5924 message_pain(c_ptr->m_idx, dam);
5931 /* Hack -- handle sleep */
5932 if (do_sleep) m_ptr->csleep = do_sleep;
5936 else if (heal_leper)
5939 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
5941 msg_print("The Mangy looking leper is healed!");
5944 delete_monster_idx(c_ptr->m_idx);
5946 /* If the player did it, give him experience, check fear */
5947 else if (typ != GF_DRAIN_MANA)
5951 /* Hurt the monster, check for fear and death */
5952 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
5957 /* Damaged monster */
5960 /* HACK - anger the monster before showing the sleep message */
5961 if (do_sleep) anger_monster(m_ptr);
5963 /* Give detailed messages if visible or destroyed */
5966 msg_format("%s%s", m_name, note);
5968 msg_format("%^s%s", m_name, note);
5972 /* Hack -- Pain message */
5975 message_pain(c_ptr->m_idx, dam);
5978 /* Anger monsters */
5979 if (((dam > 0) || get_angry) && !do_sleep)
5980 anger_monster(m_ptr);
5983 if ((fear || do_fear) && (m_ptr->ml))
5990 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
5992 msg_format("%^s flees in terror!", m_name);
5997 /* Hack -- handle sleep */
5998 if (do_sleep) m_ptr->csleep = do_sleep;
6002 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6004 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6008 switch (randint(28))
6014 msg_print("ÃÏÌ̤¬Íɤ줿...");
6016 msg_print("The ground trembles...");
6019 earthquake(ty, tx, 4 + rand_int(4));
6020 if (randint(6) != 1) break;
6022 case 3: case 4: case 5: case 6:
6025 int dam = damroll(10, 10);
6027 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6029 msg_print("A portal opens to a plane of raw mana!");
6032 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6033 if (randint(6) != 1) break;
6039 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6041 msg_print("Space warps about you!");
6044 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6045 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6046 if (randint(6) != 1) break;
6048 case 9: case 10: case 11:
6050 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6052 msg_print("You feel a surge of energy!");
6055 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6056 if (randint(6) != 1) break;
6057 case 12: case 13: case 14: case 15: case 16:
6058 aggravate_monsters(0);
6059 if (randint(6) != 1) break;
6061 count += activate_hi_summon(ty, tx, TRUE);
6062 if (randint(6) != 1) break;
6063 case 19: case 20: case 21: case 22:
6065 bool pet = FALSE, friendly = FALSE;
6075 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));
6076 if (randint(6) != 1) break;
6078 case 23: case 24: case 25:
6079 if (p_ptr->hold_life && (rand_int(100) < 75)) break;
6081 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6083 msg_print("You feel your life draining away...");
6086 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6087 else lose_exp(p_ptr->exp / 16);
6088 if (randint(6) != 1) break;
6089 case 26: case 27: case 28:
6098 (void)do_dec_stat(i);
6100 while (randint(2) == 1);
6107 (void)do_dec_stat(rand_int(6));
6113 while (randint(5) == 1);
6116 if (p_ptr->inside_battle)
6118 p_ptr->health_who = c_ptr->m_idx;
6119 p_ptr->redraw |= (PR_HEALTH);
6123 /* XXX XXX XXX Verify this code */
6125 /* Update the monster */
6126 update_mon(c_ptr->m_idx, FALSE);
6128 /* Redraw the monster grid */
6132 /* Update monster recall window */
6133 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6136 p_ptr->window |= (PW_MONSTER);
6139 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6143 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6145 m_ptr->target_y = monster_target_y;
6146 m_ptr->target_x = monster_target_x;
6149 else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
6151 m_ptr->target_y = m_list[who].fy;
6152 m_ptr->target_x = m_list[who].fx;
6156 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6158 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6159 rakubadam_m = (dam > 200) ? 200 : dam;
6168 /* Get local object */
6171 /* Prepare to make a Blade of Chaos */
6172 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6174 q_ptr->pval = photo;
6176 /* Mark the item as fully known */
6177 q_ptr->ident |= (IDENT_MENTAL);
6180 q_ptr->python = object_create_callback(q_ptr);
6181 #endif /* USE_SCRIPT */
6183 /* Drop it in the dungeon */
6184 (void)drop_near(q_ptr, -1, py, px);
6192 /* Return "Anything seen?" */
6198 * Helper function for "project()" below.
6200 * Handle a beam/bolt/ball causing damage to the player.
6202 * This routine takes a "source monster" (by index), a "distance", a default
6203 * "damage", and a "damage type". See "project_m()" above.
6205 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6206 * is reduced (see "project_m()" above). This can happen if a monster breathes
6207 * at the player and hits a wall instead.
6209 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6210 * to know if this is actually a ball or a bolt spell
6213 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6214 * we just assume that the effects were obvious, for historical reasons.
6216 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int a_rad, int monspell)
6220 /* Hack -- assume obvious */
6221 bool obvious = TRUE;
6223 /* Player blind-ness */
6224 bool blind = (p_ptr->blind ? TRUE : FALSE);
6226 /* Player needs a "description" (he is blind) */
6229 /* Source monster */
6230 monster_type *m_ptr;
6232 /* Monster name (for attacks) */
6235 /* Monster name (for damage) */
6238 /* Hack -- messages */
6242 /* Player is not here */
6243 if ((x != px) || (y != py)) return (FALSE);
6245 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (rand_int(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6251 /* Player cannot hurt himself */
6252 if (!who) return (FALSE);
6253 if (who == p_ptr->riding) return (FALSE);
6255 if ((p_ptr->reflect || p_ptr->tim_reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && !a_rad && (randint(10) != 1) && (typ != GF_PSY_SPEAR))
6258 int max_attempts = 10;
6261 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6262 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6263 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6265 if (blind) msg_print("Something bounces!");
6266 else msg_print("The attack bounces!");
6270 /* Choose 'new' target */
6273 t_y = m_list[who].fy - 1 + randint(3);
6274 t_x = m_list[who].fx - 1 + randint(3);
6277 while (max_attempts && in_bounds2u(t_y, t_x) &&
6278 !(player_has_los_bold(t_y, t_x)));
6280 if (max_attempts < 1)
6282 t_y = m_list[who].fy;
6283 t_x = m_list[who].fx;
6286 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL), monspell);
6293 /* Limit maximum damage */
6294 if (dam > 1600) dam = 1600;
6296 /* Reduce damage by distance */
6297 dam = (dam + r) / (r + 1);
6300 /* If the player is blind, be more descriptive */
6301 if (blind) fuzzy = TRUE;
6304 /* Get the source monster */
6305 m_ptr = &m_list[who];
6307 /* Get the monster name */
6308 monster_desc(m_name, m_ptr, 0);
6310 /* Get the monster's real name (gotten before polymorph!) */
6311 strcpy(killer, who_name);
6313 /* Analyze the damage */
6316 /* Standard damage -- hurts inventory too */
6320 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6322 if (fuzzy) msg_print("You are hit by acid!");
6325 acid_dam(dam, killer, monspell);
6329 /* Standard damage -- hurts inventory too */
6333 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6335 if (fuzzy) msg_print("You are hit by fire!");
6338 fire_dam(dam, killer, monspell);
6342 /* Standard damage -- hurts inventory too */
6346 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6348 if (fuzzy) msg_print("You are hit by cold!");
6351 cold_dam(dam, killer, monspell);
6355 /* Standard damage -- hurts inventory too */
6359 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6361 if (fuzzy) msg_print("You are hit by lightning!");
6364 elec_dam(dam, killer, monspell);
6368 /* Standard damage -- also poisons player */
6371 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6373 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6375 if (fuzzy) msg_print("You are hit by poison!");
6378 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6379 if (double_resist) dam = (dam + 2) / 3;
6381 if ((!(double_resist || p_ptr->resist_pois)) &&
6382 randint(HURT_CHANCE) == 1)
6387 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6389 if (!(double_resist || p_ptr->resist_pois))
6391 set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
6396 /* Standard damage -- also poisons / mutates player */
6399 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6401 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6403 if (fuzzy) msg_print("You are hit by radiation!");
6406 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6407 if (double_resist) dam = (2 * dam + 2) / 5;
6408 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);
6413 if (randint(5) == 1) /* 6 */
6416 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6418 msg_print("You undergo a freakish metamorphosis!");
6421 if (randint(4) == 1) /* 4 */
6427 if (randint(6) == 1)
6429 inven_damage(set_acid_destroy, 2);
6435 /* Standard damage */
6439 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6441 if (fuzzy) msg_print("You are hit by something!");
6444 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6448 /* Holy Orb -- Player only takes partial damage */
6452 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6454 if (fuzzy) msg_print("You are hit by something!");
6457 if (p_ptr->align > 10)
6459 else if (p_ptr->align < -10)
6461 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6468 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6470 if (fuzzy) msg_print("You are hit by something!");
6473 if (p_ptr->align > 10)
6475 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6479 /* Arrow -- XXX no dodging */
6483 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6485 if (fuzzy) msg_print("You are hit by something sharp!");
6488 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6491 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6493 msg_print("You cut down the arrow!");
6497 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6501 /* Plasma -- XXX No resist */
6505 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6507 if (fuzzy) msg_print("You are hit by something *HOT*!");
6510 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6512 if (!p_ptr->resist_sound)
6514 int k = (randint((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6515 (void)set_stun(p_ptr->stun + k);
6518 if (!(p_ptr->resist_fire ||
6519 p_ptr->oppose_fire ||
6520 music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
6521 p_ptr->immune_fire))
6523 inven_damage(set_acid_destroy, 3);
6529 /* Nether -- drain experience */
6533 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6535 if (fuzzy) msg_print("You are hit by nether forces!");
6539 if (p_ptr->resist_neth)
6541 if (!prace_is_(RACE_SPECTRE))
6542 dam *= 6; dam /= (randint(4) + 7);
6544 else if (p_ptr->prace != RACE_ANDROID)
6546 if (p_ptr->hold_life && (rand_int(100) < 75))
6549 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6551 msg_print("You keep hold of your life force!");
6555 else if (p_ptr->hold_life)
6558 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6560 msg_print("You feel your life slipping away!");
6563 lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6568 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6570 msg_print("You feel your life draining away!");
6573 lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6577 if (prace_is_(RACE_SPECTRE))
6580 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6582 msg_print("You feel invigorated!");
6586 learn_spell(monspell);
6590 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6596 /* Water -- stun/confuse */
6600 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6602 if (fuzzy) msg_print("You are hit by something wet!");
6605 if (!p_ptr->resist_sound)
6607 set_stun(p_ptr->stun + randint(40));
6609 if (!p_ptr->resist_conf)
6611 set_confused(p_ptr->confused + randint(5) + 5);
6614 if (randint(5) == 1)
6616 inven_damage(set_cold_destroy, 3);
6619 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6623 /* Chaos -- many effects */
6627 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6629 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6632 if (p_ptr->resist_chaos)
6634 dam *= 6; dam /= (randint(4) + 7);
6636 if (!p_ptr->resist_conf)
6638 (void)set_confused(p_ptr->confused + rand_int(20) + 10);
6640 if (!p_ptr->resist_chaos)
6642 (void)set_image(p_ptr->image + randint(10));
6643 if (randint(3) == 1)
6646 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6648 msg_print("Your body is twisted by chaos!");
6651 (void)gain_random_mutation(0);
6654 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6656 if (p_ptr->prace == RACE_ANDROID)
6659 else if (p_ptr->hold_life && (rand_int(100) < 75))
6662 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6664 msg_print("You keep hold of your life force!");
6668 else if (p_ptr->hold_life)
6671 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6673 msg_print("You feel your life slipping away!");
6676 lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6681 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6683 msg_print("You feel your life draining away!");
6686 lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6689 if (!p_ptr->resist_chaos || (randint(9) == 1))
6691 inven_damage(set_elec_destroy, 2);
6692 inven_damage(set_fire_destroy, 2);
6694 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6698 /* Shards -- mostly cutting */
6702 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6704 if (fuzzy) msg_print("You are hit by something sharp!");
6707 if (p_ptr->resist_shard)
6709 dam *= 6; dam /= (randint(4) + 7);
6713 (void)set_cut(p_ptr->cut + dam);
6716 if (!p_ptr->resist_shard || (randint(13) == 1))
6718 inven_damage(set_cold_destroy, 2);
6721 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6725 /* Sound -- mostly stunning */
6729 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6731 if (fuzzy) msg_print("You are hit by a loud noise!");
6734 if (p_ptr->resist_sound)
6736 dam *= 5; dam /= (randint(4) + 7);
6740 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
6741 (void)set_stun(p_ptr->stun + k);
6744 if (!p_ptr->resist_sound || (randint(13) == 1))
6746 inven_damage(set_cold_destroy, 2);
6749 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6753 /* Pure confusion */
6757 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6759 if (fuzzy) msg_print("You are hit by something puzzling!");
6762 if (p_ptr->resist_conf)
6764 dam *= 5; dam /= (randint(4) + 7);
6766 if (!p_ptr->resist_conf)
6768 (void)set_confused(p_ptr->confused + randint(20) + 10);
6770 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6774 /* Disenchantment -- see above */
6778 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6780 if (fuzzy) msg_print("You are hit by something static!");
6783 if (p_ptr->resist_disen)
6785 dam *= 6; dam /= (randint(4) + 7);
6789 (void)apply_disenchant(0);
6791 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6795 /* Nexus -- see above */
6799 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6801 if (fuzzy) msg_print("You are hit by something strange!");
6804 if (p_ptr->resist_nexus)
6806 dam *= 6; dam /= (randint(4) + 7);
6812 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6816 /* Force -- mostly stun */
6820 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6822 if (fuzzy) msg_print("You are hit by kinetic force!");
6825 if (!p_ptr->resist_sound)
6827 (void)set_stun(p_ptr->stun + randint(20));
6829 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6834 /* Rocket -- stun, cut */
6838 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6840 if (fuzzy) msg_print("There is an explosion!");
6843 if (!p_ptr->resist_sound)
6845 (void)set_stun(p_ptr->stun + randint(20));
6847 if (p_ptr->resist_shard)
6853 (void)set_cut(p_ptr-> cut + ( dam / 2));
6856 if ((!p_ptr->resist_shard) || (randint(12) == 1))
6858 inven_damage(set_cold_destroy, 3);
6861 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6865 /* Inertia -- slowness */
6869 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6871 if (fuzzy) msg_print("You are hit by something slow!");
6874 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
6875 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6879 /* Lite -- blinding */
6883 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6885 if (fuzzy) msg_print("You are hit by something!");
6888 if (p_ptr->resist_lite)
6890 dam *= 4; dam /= (randint(4) + 7);
6892 else if (!blind && !p_ptr->resist_blind)
6894 (void)set_blind(p_ptr->blind + randint(5) + 2);
6896 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
6899 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
6901 msg_print("The light scorches your flesh!");
6906 else if (prace_is_(RACE_S_FAIRY))
6910 if (p_ptr->wraith_form) dam *= 2;
6911 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6913 if (p_ptr->wraith_form)
6915 p_ptr->wraith_form = 0;
6917 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
6919 msg_print("The light forces you out of your incorporeal shadow form.");
6922 p_ptr->redraw |= PR_MAP;
6923 /* Update monsters */
6924 p_ptr->update |= (PU_MONSTERS);
6926 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6928 /* Redraw status bar */
6929 p_ptr->redraw |= (PR_STATUS);
6936 /* Dark -- blinding */
6940 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6942 if (fuzzy) msg_print("You are hit by something!");
6945 if (p_ptr->resist_dark)
6947 dam *= 4; dam /= (randint(4) + 7);
6949 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
6951 else if (!blind && !p_ptr->resist_blind)
6953 (void)set_blind(p_ptr->blind + randint(5) + 2);
6955 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6959 /* Time -- bolt fewer effects XXX */
6963 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
6965 if (fuzzy) msg_print("You are hit by a blast from the past!");
6968 if (p_ptr->resist_time)
6971 dam /= (randint(4) + 7);
6973 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
6975 msg_print("You feel as if time is passing you by.");
6981 switch (randint(10))
6983 case 1: case 2: case 3: case 4: case 5:
6985 if (p_ptr->prace == RACE_ANDROID) break;
6987 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
6989 msg_print("You feel life has clocked back.");
6992 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6996 case 6: case 7: case 8: case 9:
7001 case 1: k = A_STR; act = "¶¯¤¯"; break;
7002 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7003 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7004 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7005 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7006 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7008 case 1: k = A_STR; act = "strong"; break;
7009 case 2: k = A_INT; act = "bright"; break;
7010 case 3: k = A_WIS; act = "wise"; break;
7011 case 4: k = A_DEX; act = "agile"; break;
7012 case 5: k = A_CON; act = "hale"; break;
7013 case 6: k = A_CHR; act = "beautiful"; break;
7019 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7021 msg_format("You're not as %s as you used to be...", act);
7025 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7026 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7027 p_ptr->update |= (PU_BONUS);
7034 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7036 msg_print("You're not as powerful as you used to be...");
7040 for (k = 0; k < 6; k++)
7042 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7043 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7045 p_ptr->update |= (PU_BONUS);
7051 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7055 /* Gravity -- stun plus slowness plus teleport */
7059 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7060 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7062 if (fuzzy) msg_print("You are hit by something heavy!");
7063 msg_print("Gravity warps around you.");
7068 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7069 if (!(p_ptr->resist_sound || p_ptr->ffall))
7071 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
7072 (void)set_stun(p_ptr->stun + k);
7076 dam = (dam * 2) / 3;
7079 if (!p_ptr->ffall || (randint(13) == 1))
7081 inven_damage(set_cold_destroy, 2);
7084 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7088 /* Standard damage */
7089 case GF_DISINTEGRATE:
7092 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7094 if (fuzzy) msg_print("You are hit by pure energy!");
7097 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7104 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7106 if (fuzzy) msg_print("You are hit by something invigorating!");
7109 (void)hp_player(dam);
7117 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7119 if (fuzzy) msg_print("You are hit by something!");
7122 (void)set_fast(p_ptr->fast + randint(5), FALSE);
7130 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7132 if (fuzzy) msg_print("You are hit by something slow!");
7135 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7141 if (p_ptr->free_act) break;
7143 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7145 if (fuzzy) msg_print("You fall asleep!");
7149 if (ironman_nightmare)
7152 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7154 msg_print("A horrible vision enters your mind.");
7158 /* Pick a nightmare */
7159 get_mon_num_prep(get_nightmare, NULL);
7161 /* Have some nightmares */
7162 have_nightmare(get_mon_num(MAX_DEPTH));
7164 /* Remove the monster restriction */
7165 get_mon_num_prep(NULL, NULL);
7168 set_paralyzed(p_ptr->paralyzed + dam);
7179 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7181 if (fuzzy) msg_print("You are hit by an aura of magic!");
7184 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7192 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7194 if (fuzzy) msg_print("You are hit by an energy!");
7197 take_hit(DAMAGE_FORCE, dam, killer, monspell);
7205 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7207 if (fuzzy) msg_print("Something falls from the sky on you!");
7210 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7211 if (!p_ptr->resist_shard || (randint(13) == 1))
7213 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7214 inven_damage(set_cold_destroy, 2);
7220 /* Ice -- cold plus stun plus cuts */
7224 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7226 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7229 cold_dam(dam, killer, monspell);
7230 if (!p_ptr->resist_shard)
7232 (void)set_cut(p_ptr->cut + damroll(5, 8));
7234 if (!p_ptr->resist_sound)
7236 (void)set_stun(p_ptr->stun + randint(15));
7239 if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || (randint(12) == 1))
7241 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7251 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7253 if (fuzzy) msg_print("You are hit by something extremely cold!");
7257 if (p_ptr->mimic_form)
7259 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7260 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7265 switch (p_ptr->prace)
7267 /* Some races are immune */
7281 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7301 if (p_ptr->riding && dam > 0)
7303 rakubadam_p = (dam > 200) ? 200 : dam;
7311 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7317 /* Return "Anything seen?" */
7323 * Find the distance from (x, y) to a line.
7325 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7327 /* Vector from (x, y) to (x1, y1) */
7336 int pd = distance(y1, x1, y, x);
7337 int nd = distance(y1, x1, y2, x2);
7339 if (pd > nd) return distance(y, x, y2, x2);
7341 /* Component of P on N */
7342 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7344 /* Absolute value */
7345 return((nd >= 0) ? nd : 0 - nd);
7352 * Modified version of los() for calculation of disintegration balls.
7353 * Disintegration effects are stopped by permanent walls.
7355 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7375 /* Slope, or 1/Slope, of LOS */
7379 /* Extract the offset */
7383 /* Extract the absolute offset */
7388 /* Handle adjacent (or identical) grids */
7389 if ((ax < 2) && (ay < 2)) return (TRUE);
7392 /* Paranoia -- require "safe" origin */
7393 /* if (!in_bounds(y1, x1)) return (FALSE); */
7396 /* Directly South/North */
7399 /* South -- check for walls */
7402 for (ty = y1 + 1; ty < y2; ty++)
7404 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7408 /* North -- check for walls */
7411 for (ty = y1 - 1; ty > y2; ty--)
7413 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7421 /* Directly East/West */
7424 /* East -- check for walls */
7427 for (tx = x1 + 1; tx < x2; tx++)
7429 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7433 /* West -- check for walls */
7436 for (tx = x1 - 1; tx > x2; tx--)
7438 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7447 /* Extract some signs */
7448 sx = (dx < 0) ? -1 : 1;
7449 sy = (dy < 0) ? -1 : 1;
7452 /* Vertical "knights" */
7457 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7461 /* Horizontal "knights" */
7466 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7471 /* Calculate scale factor div 2 */
7474 /* Calculate scale factor */
7478 /* Travel horizontally */
7481 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7487 /* Consider the special case where slope == 1. */
7498 /* Note (below) the case (qy == f2), where */
7499 /* the LOS exactly meets the corner of a tile. */
7502 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7513 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7526 /* Travel vertically */
7529 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7545 /* Note (below) the case (qx == f2), where */
7546 /* the LOS exactly meets the corner of a tile. */
7549 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7560 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7580 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)
7593 while (bdis <= distance(y1, x1, y2, x2) + rad)
7595 /* Travel from center outward */
7596 for (cdis = 0; cdis <= brad; cdis++)
7599 /* Scan the maximal blast area of radius "cdis" */
7600 for (y = by - cdis; y <= by + cdis; y++)
7602 for (x = bx - cdis; x <= bx + cdis; x++)
7604 /* Ignore "illegal" locations */
7605 if (!in_bounds(y, x)) continue;
7607 /* Enforce a circular "ripple" */
7608 if (distance(y1, x1, y, x) != bdis) continue;
7610 /* Enforce an arc */
7611 if (distance(by, bx, y, x) != cdis) continue;
7615 /* Disintegration balls explosions are stopped by perma-walls */
7616 if (!in_disintegration_range(by, bx, y, x)) continue;
7618 if (real_breath && cave_valid_bold(y, x) &&
7619 (cave[y][x].feat < FEAT_PATTERN_START ||
7620 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
7621 (cave[y][x].feat < FEAT_DEEP_WATER ||
7622 cave[y][x].feat > FEAT_GRASS))
7624 if (cave[y][x].feat == FEAT_TREES)
7625 cave_set_feat(y, x, FEAT_GRASS);
7628 cave[y][x].feat = floor_type[rand_int(100)];
7629 cave[y][x].info &= ~(CAVE_MASK);
7630 cave[y][x].info |= CAVE_FLOOR;
7633 /* Update some things -- similar to GF_KILL_WALL */
7634 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
7638 /* The blast is stopped by walls */
7639 if (!los(by, bx, y, x)) continue;
7642 /* Save this grid */
7650 /* Encode some more "radius" info */
7651 gm[bdis + 1] = *pgrids;
7654 if ((by == y2) && (bx == x2)) done = TRUE;
7663 /* Ripple outwards */
7664 /* mmove2(&by, &bx, y1, x1, y2, x2); */
7666 by = GRID_Y(path_g[bdis]);
7667 bx = GRID_X(path_g[bdis]);
7669 /* Find the next ripple */
7672 /* Increase the size */
7673 brad = (rad * bdis) / dist;
7676 /* Store the effect size */
7682 * Generic "beam"/"bolt"/"ball" projection routine.
7685 * who: Index of "source" monster (zero for "player")
7686 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
7687 * y,x: Target location (or location to travel "towards")
7688 * dam: Base damage roll to apply to affected monsters (or player)
7689 * typ: Type of damage to apply to monsters (and objects)
7690 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
7693 * TRUE if any "effects" of the projection were observed, else FALSE
7695 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
7696 * towards a given location (optionally passing over the heads of interposing
7697 * monsters), and have it do a given amount of damage to the monsters (and
7698 * optionally objects) within the given radius of the final location.
7700 * A "bolt" travels from source to target and affects only the target grid.
7701 * A "beam" travels from source to target, affecting all grids passed through.
7702 * A "ball" travels from source to the target, exploding at the target, and
7703 * affecting everything within the given radius of the target location.
7705 * Traditionally, a "bolt" does not affect anything on the ground, and does
7706 * not pass over the heads of interposing monsters, much like a traditional
7707 * missile, and will "stop" abruptly at the "target" even if no monster is
7708 * positioned there, while a "ball", on the other hand, passes over the heads
7709 * of monsters between the source and target, and affects everything except
7710 * the source monster which lies within the final radius, while a "beam"
7711 * affects every monster between the source and target, except for the casting
7712 * monster (or player), and rarely affects things on the ground.
7714 * Two special flags allow us to use this function in special ways, the
7715 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
7716 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
7717 * actually projecting from the source monster (or player).
7719 * The player will only get "experience" for monsters killed by himself
7720 * Unique monsters can only be destroyed by attacks from the player
7722 * Only 256 grids can be affected per projection, limiting the effective
7723 * "radius" of standard ball attacks to nine units (diameter nineteen).
7725 * One can project in a given "direction" by combining PROJECT_THRU with small
7726 * offsets to the initial location (see "line_spell()"), or by calculating
7727 * "virtual targets" far away from the player.
7729 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
7730 * continuing until it actually hits somethings (useful for "stone to mud").
7732 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
7734 * Balls must explode BEFORE hitting walls, or they would affect monsters
7735 * on both sides of a wall. Some bug reports indicate that this is still
7736 * happening in 2.7.8 for Windows, though it appears to be impossible.
7738 * We "pre-calculate" the blast area only in part for efficiency.
7739 * More importantly, this lets us do "explosions" from the "inside" out.
7740 * This results in a more logical distribution of "blast" treasure.
7741 * It also produces a better (in my opinion) animation of the explosion.
7742 * It could be (but is not) used to have the treasure dropped by monsters
7743 * in the middle of the explosion fall "outwards", and then be damaged by
7744 * the blast as it spreads outwards towards the treasure drop location.
7746 * Walls and doors are included in the blast area, so that they can be
7747 * "burned" or "melted" in later versions.
7749 * This algorithm is intended to maximize simplicity, not necessarily
7750 * efficiency, since this function is not a bottleneck in the code.
7752 * We apply the blast effect from ground zero outwards, in several passes,
7753 * first affecting features, then objects, then monsters, then the player.
7754 * This allows walls to be removed before checking the object or monster
7755 * in the wall, and protects objects which are dropped by monsters killed
7756 * in the blast, and allows the player to see all affects before he is
7757 * killed or teleported away. The semantics of this method are open to
7758 * various interpretations, but they seem to work well in practice.
7760 * We process the blast area from ground-zero outwards to allow for better
7761 * distribution of treasure dropped by monsters, and because it provides a
7762 * pleasing visual effect at low cost.
7764 * Note that the damage done by "ball" explosions decreases with distance.
7765 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
7767 * Notice the "napalm" effect of "beam" weapons. First they "project" to
7768 * the target, and then the damage "flows" along this beam of destruction.
7769 * The damage at every grid is the same as at the "center" of a "ball"
7770 * explosion, since the "beam" grids are treated as if they ARE at the
7771 * center of a "ball" explosion.
7773 * Currently, specifying "beam" plus "ball" means that locations which are
7774 * covered by the initial "beam", and also covered by the final "ball", except
7775 * for the final grid (the epicenter of the ball), will be "hit twice", once
7776 * by the initial beam, and once by the exploding ball. For the grid right
7777 * next to the epicenter, this results in 150% damage being done. The center
7778 * does not have this problem, for the same reason the final grid in a "beam"
7779 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
7780 * grids which are covered by the "ball" will NOT work, as then they will
7781 * receive LESS damage than they should. Do not combine "beam" with "ball".
7783 * The array "gy[],gx[]" with current size "grids" is used to hold the
7784 * collected locations of all grids in the "blast area" plus "beam path".
7786 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
7787 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
7788 * first blast grid (see above) with radius "N" from the blast center. Note
7789 * that only the first gm[1] grids in the blast area thus take full damage.
7790 * Also, note that gm[rad+1] is always equal to "grids", which is the total
7791 * number of blast grids.
7793 * Note that once the projection is complete, (y2,x2) holds the final location
7794 * of bolts/beams, and the "epicenter" of balls.
7796 * Note also that "rad" specifies the "inclusive" radius of projection blast,
7797 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
7798 * implementation of the "distance" function. Also, a bolt can be properly
7799 * viewed as a "ball" with a "rad" of "zero".
7801 * Note that if no "target" is reached before the beam/bolt/ball travels the
7802 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
7803 * may be relevant even for bolts, since they have a "1x1" mini-blast.
7805 * Note that for consistency, we "pretend" that the bolt actually takes "time"
7806 * to move from point A to point B, even if the player cannot see part of the
7807 * projection path. Note that in general, the player will *always* see part
7808 * of the path, since it either starts at the player or ends on the player.
7810 * Hack -- we assume that every "projection" is "self-illuminating".
7812 * Hack -- when only a single monster is affected, we automatically track
7813 * (and recall) that monster, unless "PROJECT_JUMP" is used.
7815 * Note that all projections now "explode" at their final destination, even
7816 * if they were being projected at a more distant destination. This means
7817 * that "ball" spells will *always* explode.
7819 * Note that we must call "handle_stuff()" after affecting terrain features
7820 * in the blast radius, in case the "illumination" of the grid was changed,
7821 * and "update_view()" and "update_monsters()" need to be called.
7823 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
7832 int y_saver, x_saver; /* For reflecting monsters */
7834 int msec = delay_factor * delay_factor * delay_factor;
7836 /* Assume the player sees nothing */
7837 bool notice = FALSE;
7839 /* Assume the player has seen nothing */
7840 bool visual = FALSE;
7842 /* Assume the player has seen no blast grids */
7845 /* Assume to be a normal ball spell */
7846 bool breath = FALSE;
7848 /* Is the player blind? */
7849 bool blind = (p_ptr->blind ? TRUE : FALSE);
7851 bool old_hide = FALSE;
7853 /* Number of grids in the "path" */
7856 /* Actual grids in the "path" */
7859 /* Number of grids in the "blast area" (including the "beam" path) */
7862 /* Coordinates of the affected grids */
7863 byte gx[1024], gy[1024];
7865 /* Encoded "radius" info (see above) */
7868 /* Actual radius encoded in gm[] */
7873 /* Attacker's name (prepared before polymorph)*/
7879 /* Default target of monsterspell is player */
7880 monster_target_y=py;
7881 monster_target_x=px;
7883 /* Hack -- Jump to target */
7884 if (flg & (PROJECT_JUMP))
7889 /* Clear the flag */
7890 flg &= ~(PROJECT_JUMP);
7895 /* Start at player */
7902 /* Start at monster */
7905 x1 = m_list[who].fx;
7906 y1 = m_list[who].fy;
7907 monster_desc(who_name, &m_list[who], 0x88);
7920 /* Default "destination" */
7925 /* Hack -- verify stuff */
7926 if (flg & (PROJECT_THRU))
7928 if ((x1 == x2) && (y1 == y2))
7930 flg &= ~(PROJECT_THRU);
7934 /* Handle a breath attack */
7939 if (flg & PROJECT_HIDE) old_hide = TRUE;
7940 flg |= PROJECT_HIDE;
7944 /* Hack -- Assume there will be no blast (max radius 32) */
7945 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
7953 /* Collect beam grids */
7954 if (flg & (PROJECT_BEAM))
7961 if (breath && typ == GF_DISINTEGRATE)
7963 flg |= (PROJECT_DISI);
7966 /* Calculate the projection path */
7968 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
7970 /* Hack -- Handle stuff */
7973 /* Giga-Hack SEEKER & SUPER_RAY */
7975 if( typ == GF_SEEKER )
7985 for (i = 0; i < path_n; ++i)
7990 int ny = GRID_Y(path_g[i]);
7991 int nx = GRID_X(path_g[i]);
8002 /* Only do visuals if requested */
8003 if (!blind && !(flg & (PROJECT_HIDE)))
8005 /* Only do visuals if the player can "see" the bolt */
8006 if (panel_contains(y, x) && player_has_los_bold(y, x))
8013 /* Obtain the bolt pict */
8014 p = bolt_pict(oy, ox, y, x, typ);
8016 /* Extract attr/char */
8020 /* Visual effects */
8021 print_rel(c, a, y, x);
8022 move_cursor_relative(y, x);
8023 /*if (fresh_before)*/ Term_fresh();
8024 Term_xtra(TERM_XTRA_DELAY, msec);
8026 /*if (fresh_before)*/ Term_fresh();
8028 /* Display "beam" grids */
8029 if (flg & (PROJECT_BEAM))
8031 /* Obtain the explosion pict */
8032 p = bolt_pict(y, x, y, x, typ);
8034 /* Extract attr/char */
8038 /* Visual effects */
8039 print_rel(c, a, y, x);
8042 /* Hack -- Activate delay */
8046 /* Hack -- delay anyway for consistency */
8049 /* Delay for consistency */
8050 Term_xtra(TERM_XTRA_DELAY, msec);
8053 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8054 if( cave[y][x].feat == FEAT_MIRROR )
8056 /* The target of monsterspell becomes tha mirror(broken) */
8057 monster_target_y=(s16b)y;
8058 monster_target_x=(s16b)x;
8060 cave_set_feat( y, x , FEAT_FLOOR );
8061 next_mirror( &oy,&ox );
8063 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8064 for( j = last_i; j <=i ; j++ )
8066 y = GRID_Y(path_g[j]);
8067 x = GRID_X(path_g[j]);
8068 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8069 if(!who && (project_m_n==1) && !jump ){
8070 if(cave[project_m_y][project_m_x].m_idx >0 ){
8071 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8073 /* Hack -- auto-recall */
8074 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8076 /* Hack - auto-track */
8077 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8080 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8085 for( i = last_i ; i < path_n ; i++ )
8088 y = GRID_Y(path_g[i]);
8089 x = GRID_X(path_g[i]);
8090 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8092 if(!who && (project_m_n==1) && !jump ){
8093 if(cave[project_m_y][project_m_x].m_idx >0 ){
8094 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8096 /* Hack -- auto-recall */
8097 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8099 /* Hack - auto-track */
8100 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8103 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8107 else if(typ == GF_SUPER_RAY){
8109 int second_step = 0;
8116 for (i = 0; i < path_n; ++i)
8121 int ny = GRID_Y(path_g[i]);
8122 int nx = GRID_X(path_g[i]);
8133 /* Only do visuals if requested */
8134 if (!blind && !(flg & (PROJECT_HIDE)))
8136 /* Only do visuals if the player can "see" the bolt */
8137 if (panel_contains(y, x) && player_has_los_bold(y, x))
8144 /* Obtain the bolt pict */
8145 p = bolt_pict(oy, ox, y, x, typ);
8147 /* Extract attr/char */
8151 /* Visual effects */
8152 print_rel(c, a, y, x);
8153 move_cursor_relative(y, x);
8154 /*if (fresh_before)*/ Term_fresh();
8155 Term_xtra(TERM_XTRA_DELAY, msec);
8157 /*if (fresh_before)*/ Term_fresh();
8159 /* Display "beam" grids */
8160 if (flg & (PROJECT_BEAM))
8162 /* Obtain the explosion pict */
8163 p = bolt_pict(y, x, y, x, typ);
8165 /* Extract attr/char */
8169 /* Visual effects */
8170 print_rel(c, a, y, x);
8173 /* Hack -- Activate delay */
8177 /* Hack -- delay anyway for consistency */
8180 /* Delay for consistency */
8181 Term_xtra(TERM_XTRA_DELAY, msec);
8184 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8185 if( cave[y][x].feat == FEAT_RUBBLE ||
8186 cave[y][x].feat == FEAT_DOOR_HEAD ||
8187 cave[y][x].feat == FEAT_DOOR_TAIL ||
8188 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8189 cave[y][x].feat <= FEAT_PERM_SOLID ))
8191 if( second_step )continue;
8194 if( cave[y][x].feat == FEAT_MIRROR && !second_step )
8196 /* The target of monsterspell becomes tha mirror(broken) */
8197 monster_target_y=(s16b)y;
8198 monster_target_x=(s16b)x;
8200 cave_set_feat( y, x , FEAT_FLOOR );
8201 for( j = 0; j <=i ; j++ )
8203 y = GRID_Y(path_g[j]);
8204 x = GRID_X(path_g[j]);
8205 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8209 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8210 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8211 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8212 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8213 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8214 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8215 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8216 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8219 for( i = 0; i < path_n ; i++ )
8222 y = GRID_Y(path_g[i]);
8223 x = GRID_X(path_g[i]);
8224 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8225 if(!who && (project_m_n==1) && !jump ){
8226 if(cave[project_m_y][project_m_x].m_idx >0 ){
8227 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8229 /* Hack -- auto-recall */
8230 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8232 /* Hack - auto-track */
8233 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8236 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8241 /* Project along the path */
8242 for (i = 0; i < path_n; ++i)
8247 int ny = GRID_Y(path_g[i]);
8248 int nx = GRID_X(path_g[i]);
8250 if (flg & PROJECT_DISI)
8252 /* Hack -- Balls explode before reaching walls */
8253 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8257 /* Hack -- Balls explode before reaching walls */
8258 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8265 /* Collect beam grids */
8266 if (flg & (PROJECT_BEAM))
8273 /* Only do visuals if requested */
8274 if (!blind && !(flg & (PROJECT_HIDE)))
8276 /* Only do visuals if the player can "see" the bolt */
8277 if (panel_contains(y, x) && player_has_los_bold(y, x))
8284 /* Obtain the bolt pict */
8285 p = bolt_pict(oy, ox, y, x, typ);
8287 /* Extract attr/char */
8291 /* Visual effects */
8292 print_rel(c, a, y, x);
8293 move_cursor_relative(y, x);
8294 /*if (fresh_before)*/ Term_fresh();
8295 Term_xtra(TERM_XTRA_DELAY, msec);
8297 /*if (fresh_before)*/ Term_fresh();
8299 /* Display "beam" grids */
8300 if (flg & (PROJECT_BEAM))
8302 /* Obtain the explosion pict */
8303 p = bolt_pict(y, x, y, x, typ);
8305 /* Extract attr/char */
8309 /* Visual effects */
8310 print_rel(c, a, y, x);
8313 /* Hack -- Activate delay */
8317 /* Hack -- delay anyway for consistency */
8320 /* Delay for consistency */
8321 Term_xtra(TERM_XTRA_DELAY, msec);
8324 if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
8326 if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
8331 /* Save the "blast epicenter" */
8335 if (breath && (y1 == y2) && (x1 == x2))
8341 flg &= ~(PROJECT_HIDE);
8345 /* Start the "explosion" */
8348 /* Hack -- make sure beams get to "explode" */
8356 /* If we found a "target", explode there */
8357 if (dist <= MAX_RANGE)
8359 /* Mega-Hack -- remove the final "beam" grid */
8360 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8363 * Create a conical breath attack
8374 flg &= ~(PROJECT_HIDE);
8376 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (bool)(typ == GF_DISINTEGRATE), TRUE);
8380 /* Determine the blast area, work from the inside out */
8381 for (dist = 0; dist <= rad; dist++)
8383 /* Scan the maximal blast area of radius "dist" */
8384 for (y = y2 - dist; y <= y2 + dist; y++)
8386 for (x = x2 - dist; x <= x2 + dist; x++)
8388 /* Ignore "illegal" locations */
8389 if (!in_bounds2(y, x)) continue;
8391 /* Enforce a "circular" explosion */
8392 if (distance(y2, x2, y, x) != dist) continue;
8394 if (typ == GF_DISINTEGRATE)
8396 /* Disintegration balls explosions are stopped by perma-walls */
8397 if (!in_disintegration_range(y2, x2, y, x)) continue;
8399 if (cave_valid_bold(y, x) &&
8400 (cave[y][x].feat < FEAT_PATTERN_START ||
8401 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
8402 (cave[y][x].feat < FEAT_DEEP_WATER ||
8403 cave[y][x].feat > FEAT_GRASS))
8405 if (cave[y][x].feat == FEAT_TREES)
8406 cave_set_feat(y, x, FEAT_GRASS);
8409 cave[y][x].feat = floor_type[rand_int(100)];
8410 cave[y][x].info &= ~(CAVE_MASK);
8411 cave[y][x].info |= CAVE_FLOOR;
8415 /* Update some things -- similar to GF_KILL_WALL */
8416 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8420 /* Ball explosions are stopped by walls */
8421 if (!los(y2, x2, y, x)) continue;
8424 /* Save this grid */
8431 /* Encode some more "radius" info */
8437 /* Speed -- ignore "non-explosions" */
8438 if (!grids) return (FALSE);
8441 /* Display the "blast area" if requested */
8442 if (!blind && !(flg & (PROJECT_HIDE)))
8444 /* Then do the "blast", from inside out */
8445 for (t = 0; t <= gm_rad; t++)
8447 /* Dump everything with this radius */
8448 for (i = gm[t]; i < gm[t+1]; i++)
8450 /* Extract the location */
8454 /* Only do visuals if the player can "see" the blast */
8455 if (panel_contains(y, x) && player_has_los_bold(y, x))
8464 /* Obtain the explosion pict */
8465 p = bolt_pict(y, x, y, x, typ);
8467 /* Extract attr/char */
8471 /* Visual effects -- Display */
8472 print_rel(c, a, y, x);
8476 /* Hack -- center the cursor */
8477 move_cursor_relative(y2, x2);
8479 /* Flush each "radius" seperately */
8480 /*if (fresh_before)*/ Term_fresh();
8482 /* Delay (efficiently) */
8483 if (visual || drawn)
8485 Term_xtra(TERM_XTRA_DELAY, msec);
8489 /* Flush the erasing */
8492 /* Erase the explosion drawn above */
8493 for (i = 0; i < grids; i++)
8495 /* Extract the location */
8499 /* Hack -- Erase if needed */
8500 if (panel_contains(y, x) && player_has_los_bold(y, x))
8506 /* Hack -- center the cursor */
8507 move_cursor_relative(y2, x2);
8509 /* Flush the explosion */
8510 /*if (fresh_before)*/ Term_fresh();
8515 /* Update stuff if needed */
8516 if (p_ptr->update) update_stuff();
8519 /* Check features */
8520 if (flg & (PROJECT_GRID))
8522 /* Start with "dist" of zero */
8525 /* Scan for features */
8526 for (i = 0; i < grids; i++)
8528 /* Hack -- Notice new "dist" values */
8529 if (gm[dist+1] == i) dist++;
8531 /* Get the grid location */
8535 /* Find the closest point in the blast */
8538 int d = dist_to_line(y, x, y1, x1, y2, x2);
8540 /* Affect the grid */
8541 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8545 /* Affect the grid */
8546 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8553 if (flg & (PROJECT_ITEM))
8555 /* Start with "dist" of zero */
8558 /* Scan for objects */
8559 for (i = 0; i < grids; i++)
8561 /* Hack -- Notice new "dist" values */
8562 if (gm[dist+1] == i) dist++;
8564 /* Get the grid location */
8568 /* Find the closest point in the blast */
8571 int d = dist_to_line(y, x, y1, x1, y2, x2);
8573 /* Affect the object in the grid */
8574 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8578 /* Affect the object in the grid */
8579 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8585 /* Check monsters */
8586 if (flg & (PROJECT_KILL))
8593 /* Start with "dist" of zero */
8596 /* Scan for monsters */
8597 for (i = 0; i < grids; i++)
8599 /* Hack -- Notice new "dist" values */
8600 if (gm[dist + 1] == i) dist++;
8602 /* Get the grid location */
8608 /* Find the closest point in the blast */
8611 int d = dist_to_line(y, x, y1, x1, y2, x2);
8613 /* Affect the monster in the grid */
8614 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8616 if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
8618 else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
8622 /* Affect the monster in the grid */
8623 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8625 if (!(flg & PROJECT_BEAM))
8627 if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
8630 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8635 monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
8637 if ((ref_ptr->flags2 & RF2_REFLECTING) && (randint(10) != 1 && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
8640 int max_attempts = 10;
8642 /* Choose 'new' target */
8645 t_y = y_saver - 1 + randint(3);
8646 t_x = x_saver - 1 + randint(3);
8650 while (max_attempts && in_bounds2u(t_y, t_x) &&
8651 !(los(y, x, t_y, t_x)));
8653 if (max_attempts < 1)
8659 if (m_list[cave[y][x].m_idx].ml)
8662 if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
8663 || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
8664 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
8665 if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
8666 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
8668 msg_print("The attack bounces!");
8671 ref_ptr->r_flags2 |= RF2_REFLECTING;
8673 flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
8674 if (one_in_(2)) flg |= PROJECT_MONSTER;
8675 else flg |= PROJECT_PLAYER;
8677 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
8681 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8684 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8689 /* Player affected one monster (without "jumping") */
8690 if (!who && (project_m_n == 1) && !jump)
8696 /* Track if possible */
8697 if (cave[y][x].m_idx > 0)
8699 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8701 /* Hack -- auto-recall */
8702 if (m_ptr->ml) monster_race_track((bool)(m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8704 /* Hack - auto-track */
8705 if (m_ptr->ml) health_track(cave[y][x].m_idx);
8712 if (flg & (PROJECT_KILL))
8714 /* Start with "dist" of zero */
8717 /* Scan for player */
8718 for (i = 0; i < grids; i++)
8720 /* Hack -- Notice new "dist" values */
8721 if (gm[dist+1] == i) dist++;
8723 /* Get the grid location */
8727 /* Find the closest point in the blast */
8730 int d = dist_to_line(y, x, y1, x1, y2, x2);
8732 /* Affect the player */
8733 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8735 if (project_p(who, who_name, d+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8737 else if (project_p(who, who_name, d, y, x, dam, typ, rad, monspell)) notice = TRUE;
8741 /* Affect the player */
8742 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8744 if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
8746 if (project_p(who, who_name, dist+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8749 else if (project_p(who, who_name, dist, y, x, dam, typ, rad, monspell)) notice = TRUE;
8758 monster_desc(m_name, &m_list[p_ptr->riding], 0);
8760 if (rakubadam_m > 0)
8762 if (rakuba(rakubadam_m, FALSE))
8765 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
8767 msg_format("%^s has thrown you off!", m_name);
8771 if (p_ptr->riding && rakubadam_p > 0)
8773 if(rakuba(rakubadam_p, FALSE))
8776 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
8778 msg_format("You have fallen from %s.", m_name);
8784 /* Return "something was noticed" */
8788 bool binding_field( int dam )
8790 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
8791 int mirror_num=0; /* ¶À¤Î¿ô */
8796 int msec= delay_factor*delay_factor*delay_factor;
8802 /* Default target of monsterspell is player */
8803 monster_target_y=py;
8804 monster_target_x=px;
8806 for( x=0 ; x < cur_wid ; x++ )
8808 for( y=0 ; y < cur_hgt ; y++ )
8810 if( cave[y][x].feat == FEAT_MIRROR &&
8811 distance(py,px,y,x) <= MAX_RANGE &&
8812 distance(py,px,y,x) != 0 &&
8813 player_has_los_bold(y,x)
8815 mirror_y[mirror_num]=y;
8816 mirror_x[mirror_num]=x;
8822 if( mirror_num < 2 )return FALSE;
8824 point_x[0] = rand_int( mirror_num );
8826 point_x[1] = rand_int( mirror_num );
8828 while( point_x[0] == point_x[1] );
8830 point_y[0]=mirror_y[point_x[0]];
8831 point_x[0]=mirror_x[point_x[0]];
8832 point_y[1]=mirror_y[point_x[1]];
8833 point_x[1]=mirror_x[point_x[1]];
8837 x=point_x[0]+point_x[1]+point_x[2];
8838 y=point_y[0]+point_y[1]+point_y[2];
8840 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
8841 - (point_y[0]*3-y)*(point_x[1]*3-x);
8842 if( centersign == 0 )return FALSE;
8844 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
8845 x1 = x1 < point_x[2] ? x1 : point_x[2];
8846 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
8847 y1 = y1 < point_y[2] ? y1 : point_y[2];
8849 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
8850 x2 = x2 > point_x[2] ? x2 : point_x[2];
8851 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
8852 y2 = y2 > point_y[2] ? y2 : point_y[2];
8854 for( y=y1 ; y <=y2 ; y++ ){
8855 for( x=x1 ; x <=x2 ; x++ ){
8856 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8857 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8858 centersign*( (point_x[1]-x)*(point_y[2]-y)
8859 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8860 centersign*( (point_x[2]-x)*(point_y[0]-y)
8861 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8863 if( player_has_los_bold(y,x)){
8864 /* Visual effects */
8866 && panel_contains(y,x)){
8867 p = bolt_pict(y,x,y,x, GF_MANA );
8868 print_rel(PICT_C(p), PICT_A(p),y,x);
8869 move_cursor_relative(y, x);
8870 /*if (fresh_before)*/ Term_fresh();
8871 Term_xtra(TERM_XTRA_DELAY, msec);
8877 for( y=y1 ; y <=y2 ; y++ ){
8878 for( x=x1 ; x <=x2 ; x++ ){
8879 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8880 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8881 centersign*( (point_x[1]-x)*(point_y[2]-y)
8882 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8883 centersign*( (point_x[2]-x)*(point_y[0]-y)
8884 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8886 if( player_has_los_bold(y,x)){
8887 (void)project_f(0,0,y,x,dam,GF_MANA);
8892 for( y=y1 ; y <=y2 ; y++ ){
8893 for( x=x1 ; x <=x2 ; x++ ){
8894 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8895 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8896 centersign*( (point_x[1]-x)*(point_y[2]-y)
8897 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8898 centersign*( (point_x[2]-x)*(point_y[0]-y)
8899 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8901 if( player_has_los_bold(y,x)){
8902 (void)project_o(0,0,y,x,dam,GF_MANA);
8907 for( y=y1 ; y <=y2 ; y++ ){
8908 for( x=x1 ; x <=x2 ; x++ ){
8909 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8910 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8911 centersign*( (point_x[1]-x)*(point_y[2]-y)
8912 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8913 centersign*( (point_x[2]-x)*(point_y[0]-y)
8914 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8916 if( player_has_los_bold(y,x) ){
8917 (void)project_m(0,0,y,x,dam,GF_MANA,
8918 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF));
8925 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
8927 msg_print("The field broke a mirror");
8929 cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
8935 void seal_of_mirror( int dam )
8939 for( x = 0 ; x < cur_wid ; x++ )
8941 for( y = 0 ; y < cur_hgt ; y++ )
8943 if( cave[y][x].feat == FEAT_MIRROR )
8945 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8946 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
8948 if( !cave[y][x].m_idx )
8950 cave_set_feat( y,x, FEAT_FLOOR );