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 = m_ptr->csleep;
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)))
3376 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3381 m_ptr->hp = m_ptr->maxhp;
3383 /* Attempt to clone. */
3384 if (multiply_monster(c_ptr->m_idx, TRUE, friendly, pet))
3387 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3395 /* No "real" damage */
3402 /* Heal Monster (use "dam" as amount of healing) */
3405 if (seen) obvious = TRUE;
3410 if (m_ptr->maxhp < m_ptr->max_maxhp)
3413 msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3415 msg_format("%^s recovers %s vitality.", m_name, m_poss);
3417 m_ptr->maxhp = m_ptr->max_maxhp;
3423 if (seen) obvious = TRUE;
3431 msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3433 msg_format("%^s is no longer stunned.", m_name);
3437 if (m_ptr->confused)
3440 msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3442 msg_format("%^s is no longer confused.", m_name);
3444 m_ptr->confused = 0;
3449 msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3451 msg_format("%^s recovers %s courage.", m_name, m_poss);
3457 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3460 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3462 chg_virtue(V_VITALITY, 1);
3464 if (r_ptr->flags1 & RF1_UNIQUE)
3465 chg_virtue(V_INDIVIDUALISM, 1);
3467 if (is_friendly(m_ptr))
3468 chg_virtue(V_HONOUR, 1);
3469 else if (!(r_ptr->flags3 & RF3_EVIL))
3471 if (r_ptr->flags3 & RF3_GOOD)
3472 chg_virtue(V_COMPASSION, 2);
3474 chg_virtue(V_COMPASSION, 1);
3477 if (m_ptr->r_idx == MON_LEPER)
3480 chg_virtue(V_COMPASSION, 5);
3483 if (r_ptr->flags3 & RF3_ANIMAL)
3484 chg_virtue(V_NATURE, 1);
3486 /* Redraw (later) if needed */
3487 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3488 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3492 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3494 note = " looks healthier.";
3498 /* No "real" damage */
3504 /* Speed Monster (Ignore "dam") */
3507 if (seen) obvious = TRUE;
3513 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3515 note = " starts moving faster.";
3518 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3520 if (c_ptr->m_idx == p_ptr->riding)
3521 p_ptr->update |= (PU_BONUS);
3523 if (r_ptr->flags1 & RF1_UNIQUE)
3524 chg_virtue(V_INDIVIDUALISM, 1);
3525 if (is_friendly(m_ptr))
3526 chg_virtue(V_HONOUR, 1);
3528 /* No "real" damage */
3534 /* Slow Monster (Use "dam" as "power") */
3537 if (seen) obvious = TRUE;
3539 if (r_ptr->flags3 & (RF3_RES_ALL))
3542 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3544 note = " is immune.";
3547 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3550 /* Powerful monsters can resist */
3551 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3552 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3555 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3557 note = " is unaffected!";
3563 /* Normal monsters slow down */
3569 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3571 note = " starts moving slower.";
3574 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3576 if (c_ptr->m_idx == p_ptr->riding)
3577 p_ptr->update |= (PU_BONUS);
3580 /* No "real" damage */
3586 /* Sleep (Use "dam" as "power") */
3589 if (seen) obvious = TRUE;
3591 if (r_ptr->flags3 & (RF3_RES_ALL))
3594 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3596 note = " is immune.";
3599 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3602 /* Attempt a saving throw */
3603 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3604 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3605 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3607 /* Memorize a flag */
3608 if (r_ptr->flags3 & RF3_NO_SLEEP)
3610 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3613 /* No obvious effect */
3615 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3617 note = " is unaffected!";
3624 /* Go to sleep (much) later */
3626 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3628 note = " falls asleep!";
3634 /* No "real" damage */
3640 /* Sleep (Use "dam" as "power") */
3643 if (seen) obvious = TRUE;
3645 if (r_ptr->flags3 & (RF3_RES_ALL))
3648 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3650 note = " is immune.";
3653 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3656 /* Attempt a saving throw */
3657 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3658 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3661 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3663 note = " is unaffected!";
3670 /* Go to sleep (much) later */
3672 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3674 note = " is suspended!";
3680 /* No "real" damage */
3689 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3690 vir = virtue_number(V_HARMONY);
3693 dam += p_ptr->virtues[vir-1]/10;
3696 vir = virtue_number(V_INDIVIDUALISM);
3699 dam -= p_ptr->virtues[vir-1]/20;
3702 if (seen) obvious = TRUE;
3704 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3707 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3709 note = " is immune.";
3712 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3716 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3719 /* Attempt a saving throw */
3720 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3721 (r_ptr->flags3 & RF3_NO_CONF) ||
3722 (m_ptr->mflag2 & MFLAG_NOPET) ||
3723 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3725 /* Memorize a flag */
3726 if (r_ptr->flags3 & RF3_NO_CONF)
3728 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3732 /* No obvious effect */
3734 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3736 note = " is unaffected!";
3741 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3743 else if (p_ptr->aggravate)
3746 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3748 note = " hates you too much!";
3751 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3756 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3758 note = " suddenly seems friendly!";
3763 chg_virtue(V_INDIVIDUALISM, -1);
3764 if (r_ptr->flags3 & RF3_ANIMAL)
3765 chg_virtue(V_NATURE, 1);
3768 /* No "real" damage */
3773 /* Control undead */
3774 case GF_CONTROL_UNDEAD:
3777 if (seen) obvious = TRUE;
3779 vir = virtue_number(V_UNLIFE);
3782 dam += p_ptr->virtues[vir-1]/10;
3785 vir = virtue_number(V_INDIVIDUALISM);
3788 dam -= p_ptr->virtues[vir-1]/20;
3791 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3794 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3796 note = " is immune.";
3799 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3803 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3806 /* Attempt a saving throw */
3807 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3808 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3809 (m_ptr->mflag2 & MFLAG_NOPET) ||
3810 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3812 /* No obvious effect */
3814 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3816 note = " is unaffected!";
3820 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3822 else if (p_ptr->aggravate)
3825 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3827 note = " hates you too much!";
3830 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3835 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3837 note = " is in your thrall!";
3843 /* No "real" damage */
3849 case GF_CONTROL_DEMON:
3852 if (seen) obvious = TRUE;
3854 vir = virtue_number(V_UNLIFE);
3857 dam += p_ptr->virtues[vir-1]/10;
3860 vir = virtue_number(V_INDIVIDUALISM);
3863 dam -= p_ptr->virtues[vir-1]/20;
3866 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3869 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3871 note = " is immune.";
3874 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3878 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3881 /* Attempt a saving throw */
3882 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3883 (!(r_ptr->flags3 & RF3_DEMON)) ||
3884 (m_ptr->mflag2 & MFLAG_NOPET) ||
3885 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3887 /* No obvious effect */
3889 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3891 note = " is unaffected!";
3895 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3897 else if (p_ptr->aggravate)
3900 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3902 note = " hates you too much!";
3905 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3910 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3912 note = " is in your thrall!";
3918 /* No "real" damage */
3924 case GF_CONTROL_ANIMAL:
3928 if (seen) obvious = TRUE;
3930 vir = virtue_number(V_NATURE);
3933 dam += p_ptr->virtues[vir-1]/10;
3936 vir = virtue_number(V_INDIVIDUALISM);
3939 dam -= p_ptr->virtues[vir-1]/20;
3942 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
3945 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3947 note = " is immune.";
3950 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
3954 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
3957 /* Attempt a saving throw */
3958 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3959 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
3960 (m_ptr->mflag2 & MFLAG_NOPET) ||
3961 (r_ptr->flags3 & (RF3_NO_CONF)) ||
3962 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3964 /* Memorize a flag */
3965 if (r_ptr->flags3 & (RF3_NO_CONF))
3967 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
3971 /* No obvious effect */
3973 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3975 note = " is unaffected!";
3979 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3981 else if (p_ptr->aggravate)
3984 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3986 note = " hates you too much!";
3989 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
3994 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
3996 note = " is tamed!";
4001 if (r_ptr->flags3 & RF3_ANIMAL)
4002 chg_virtue(V_NATURE, 1);
4005 /* No "real" damage */
4011 case GF_CONTROL_LIVING:
4015 vir = virtue_number(V_UNLIFE);
4016 if (seen) obvious = TRUE;
4018 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4019 vir = virtue_number(V_UNLIFE);
4022 dam -= p_ptr->virtues[vir-1]/10;
4025 vir = virtue_number(V_INDIVIDUALISM);
4028 dam -= p_ptr->virtues[vir-1]/20;
4031 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4032 if (dam < 1) dam = 1;
4034 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4036 msg_format("You stare into %s.", m_name);
4038 if ((r_ptr->flags3 & (RF3_RES_ALL)) || p_ptr->inside_arena)
4041 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4043 note = " is immune.";
4046 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4050 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7))
4053 /* Attempt a saving throw */
4054 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4055 (m_ptr->mflag2 & MFLAG_NOPET) ||
4056 (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
4057 ((r_ptr->level+10) > randint(dam)))
4060 /* No obvious effect */
4062 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4064 note = " is unaffected!";
4068 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4070 else if (p_ptr->aggravate)
4073 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4075 note = " hates you too much!";
4078 if (one_in_(4)) m_ptr->mflag2 |= MFLAG_NOPET;
4083 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4085 note = " is tamed!";
4090 if (r_ptr->flags3 & RF3_ANIMAL)
4091 chg_virtue(V_NATURE, 1);
4094 /* No "real" damage */
4099 /* Confusion (Use "dam" as "power") */
4102 if (seen) obvious = TRUE;
4104 if (r_ptr->flags3 & (RF3_RES_ALL))
4107 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4109 note = " is immune.";
4112 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4115 /* Get confused later */
4116 do_conf = damroll(3, (dam / 2)) + 1;
4118 /* Attempt a saving throw */
4119 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4120 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4121 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4123 /* Memorize a flag */
4124 if (r_ptr->flags3 & (RF3_NO_CONF))
4126 if (seen) r_ptr->r_flags3 |= (RF3_NO_CONF);
4132 /* No obvious effect */
4134 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4136 note = " is unaffected!";
4142 /* No "real" damage */
4149 if (seen) obvious = TRUE;
4151 if (r_ptr->flags3 & (RF3_RES_ALL))
4154 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4156 note = " is immune.";
4159 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4162 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4164 /* Attempt a saving throw */
4165 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4166 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4171 /* No obvious effect */
4173 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4175 note = " is unaffected!";
4181 /* No "real" damage */
4189 /* Lite, but only hurts susceptible creatures */
4197 if (r_ptr->flags3 & (RF3_RES_ALL))
4203 if (r_ptr->flags3 & (RF3_HURT_LITE))
4205 /* Obvious effect */
4206 if (seen) obvious = TRUE;
4208 /* Memorize the effects */
4209 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4211 /* Special effect */
4213 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4214 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4216 note = " cringes from the light!";
4217 note_dies = " shrivels away in the light!";
4222 /* Normally no damage */
4234 /* Lite -- opposite of Dark */
4237 if (seen) obvious = TRUE;
4238 if (r_ptr->flags3 & (RF3_RES_ALL))
4241 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4243 note = " is immune.";
4246 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4249 if (r_ptr->flags4 & (RF4_BR_LITE))
4252 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4257 dam *= 2; dam /= (randint(6)+6);
4259 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4261 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4263 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4264 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4266 note = " cringes from the light!";
4267 note_dies = " shrivels away in the light!";
4276 /* Dark -- opposite of Lite */
4279 if (seen) obvious = TRUE;
4281 if (r_ptr->flags3 & (RF3_RES_ALL))
4284 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4286 note = " is immune.";
4289 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4292 /* Likes darkness... */
4293 if ((r_ptr->flags4 & (RF4_BR_DARK)) ||
4294 (r_ptr->flags3 & RF3_ORC) ||
4295 (r_ptr->flags3 & RF3_HURT_LITE))
4298 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4303 dam *= 2; dam /= (randint(6)+6);
4312 if (r_ptr->flags3 & (RF3_RES_ALL))
4317 /* Hurt by rock remover */
4318 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4321 if (seen) obvious = TRUE;
4323 /* Memorize the effects */
4324 if (seen) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4326 /* Cute little message */
4328 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4329 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4331 note = " loses some skin!";
4332 note_dies = " dissolves!";
4337 /* Usually, ignore the effects */
4348 /* Teleport undead (Use "dam" as "power") */
4349 case GF_AWAY_UNDEAD:
4351 /* Only affect undead */
4352 if (r_ptr->flags3 & (RF3_UNDEAD))
4354 bool resists_tele = FALSE;
4356 if (r_ptr->flags3 & (RF3_RES_TELE))
4358 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4360 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4362 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4364 note = " is unaffected!";
4367 resists_tele = TRUE;
4369 else if (r_ptr->level > randint(100))
4371 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4373 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4378 resists_tele = TRUE;
4384 if (seen) obvious = TRUE;
4385 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4397 /* No "real" damage */
4403 /* Teleport evil (Use "dam" as "power") */
4406 /* Only affect evil */
4407 if (r_ptr->flags3 & (RF3_EVIL))
4409 bool resists_tele = FALSE;
4411 if (r_ptr->flags3 & (RF3_RES_TELE))
4413 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4415 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4417 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4419 note = " is unaffected!";
4422 resists_tele = TRUE;
4424 else if (r_ptr->level > randint(100))
4426 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4428 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4433 resists_tele = TRUE;
4439 if (seen) obvious = TRUE;
4440 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4452 /* No "real" damage */
4458 /* Teleport monster (Use "dam" as "power") */
4461 bool resists_tele = FALSE;
4462 if (r_ptr->flags3 & (RF3_RES_TELE))
4464 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags3 & (RF3_RES_ALL)))
4466 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4468 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4470 note = " is unaffected!";
4473 resists_tele = TRUE;
4475 else if (r_ptr->level > randint(100))
4477 if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
4479 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4484 resists_tele = TRUE;
4491 if (seen) obvious = TRUE;
4493 /* Prepare to teleport */
4497 /* No "real" damage */
4503 /* Turn undead (Use "dam" as "power") */
4504 case GF_TURN_UNDEAD:
4506 if (r_ptr->flags3 & (RF3_RES_ALL))
4511 /* Only affect undead */
4512 if (r_ptr->flags3 & (RF3_UNDEAD))
4514 /* Learn about type */
4515 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4518 if (seen) obvious = TRUE;
4520 /* Apply some fear */
4521 do_fear = damroll(3, (dam / 2)) + 1;
4523 /* Attempt a saving throw */
4524 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4526 /* No obvious effect */
4528 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4530 note = " is unaffected!";
4545 /* No "real" damage */
4551 /* Turn evil (Use "dam" as "power") */
4554 if (r_ptr->flags3 & (RF3_RES_ALL))
4559 /* Only affect evil */
4560 if (r_ptr->flags3 & (RF3_EVIL))
4562 /* Learn about type */
4563 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4566 if (seen) obvious = TRUE;
4568 /* Apply some fear */
4569 do_fear = damroll(3, (dam / 2)) + 1;
4571 /* Attempt a saving throw */
4572 if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4574 /* No obvious effect */
4576 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4578 note = " is unaffected!";
4593 /* No "real" damage */
4599 /* Turn monster (Use "dam" as "power") */
4602 if (r_ptr->flags3 & (RF3_RES_ALL))
4608 if (seen) obvious = TRUE;
4610 /* Apply some fear */
4611 do_fear = damroll(3, (dam / 2)) + 1;
4613 /* Attempt a saving throw */
4614 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4615 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4616 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4618 /* No obvious effect */
4620 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4622 note = " is unaffected!";
4629 /* No "real" damage */
4636 case GF_DISP_UNDEAD:
4638 if (r_ptr->flags3 & (RF3_RES_ALL))
4644 /* Only affect undead */
4645 if (r_ptr->flags3 & (RF3_UNDEAD))
4647 /* Learn about type */
4648 if (seen) r_ptr->r_flags3 |= (RF3_UNDEAD);
4651 if (seen) obvious = TRUE;
4655 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4656 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4658 note = " shudders.";
4659 note_dies = " dissolves!";
4681 if (r_ptr->flags3 & (RF3_RES_ALL))
4687 /* Only affect evil */
4688 if (r_ptr->flags3 & (RF3_EVIL))
4690 /* Learn about type */
4691 if (seen) r_ptr->r_flags3 |= (RF3_EVIL);
4694 if (seen) obvious = TRUE;
4698 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4699 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4701 note = " shudders.";
4702 note_dies = " dissolves!";
4723 if (r_ptr->flags3 & (RF3_RES_ALL))
4729 /* Only affect good */
4730 if (r_ptr->flags3 & (RF3_GOOD))
4732 /* Learn about type */
4733 if (seen) r_ptr->r_flags3 |= (RF3_GOOD);
4736 if (seen) obvious = TRUE;
4740 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4741 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4743 note = " shudders.";
4744 note_dies = " dissolves!";
4763 case GF_DISP_LIVING:
4765 if (r_ptr->flags3 & (RF3_RES_ALL))
4771 /* Only affect non-undead */
4772 if (monster_living(r_ptr))
4775 if (seen) obvious = TRUE;
4779 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4780 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4782 note = " shudders.";
4783 note_dies = " dissolves!";
4804 if (r_ptr->flags3 & (RF3_RES_ALL))
4810 /* Only affect demons */
4811 if (r_ptr->flags3 & (RF3_DEMON))
4813 /* Learn about type */
4814 if (seen) r_ptr->r_flags3 |= (RF3_DEMON);
4817 if (seen) obvious = TRUE;
4821 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4822 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4824 note = " shudders.";
4825 note_dies = " dissolves!";
4843 /* Dispel monster */
4846 if (r_ptr->flags3 & (RF3_RES_ALL))
4853 if (seen) obvious = TRUE;
4857 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4858 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4860 note = " shudders.";
4861 note_dies = " dissolves!";
4871 if (seen) obvious = TRUE;
4872 if (r_ptr->flags3 & (RF3_RES_ALL))
4875 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4877 note = " is immune.";
4880 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4884 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4888 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£",m_name);
4890 msg_format("You draws psychic energy from %s.", m_name);
4893 (void)hp_player(dam);
4898 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
4900 msg_format("%s is unaffected.", m_name);
4910 if (seen) obvious = TRUE;
4913 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4915 msg_format("You gazes intently at %s.", m_name);
4918 if (r_ptr->flags3 & (RF3_RES_ALL))
4921 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4923 note = " is immune.";
4926 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4930 /* Attempt a saving throw */
4931 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4932 (r_ptr->flags3 & RF3_NO_CONF) ||
4933 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4935 /* Memorize a flag */
4936 if (r_ptr->flags3 & (RF3_NO_CONF))
4938 r_ptr->r_flags3 |= (RF3_NO_CONF);
4941 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
4943 note = "is unaffected!";
4950 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
4951 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
4953 msg_format("%^s is blasted by psionic energy.", m_name);
4954 note_dies = " collapses, a mindless husk.";
4957 do_conf = rand_int(8) + 8;
4963 case GF_BRAIN_SMASH:
4965 if (seen) obvious = TRUE;
4968 msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£",m_name);
4970 msg_format("You gazes intently at %s.", m_name);
4973 if (r_ptr->flags3 & (RF3_RES_ALL))
4976 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4978 note = " is immune.";
4981 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
4985 /* Attempt a saving throw */
4986 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4987 (r_ptr->flags3 & RF3_NO_CONF) ||
4988 (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
4990 /* Memorize a flag */
4991 if (r_ptr->flags3 & (RF3_NO_CONF))
4993 r_ptr->r_flags3 |= (RF3_NO_CONF);
4996 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
4998 note = "is unaffected!";
5005 msg_format("%s¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£",m_name);
5006 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£";
5008 msg_format("%^s is blasted by psionic energy.", m_name);
5009 note_dies = " collapses, a mindless husk.";
5012 do_conf = rand_int(8) + 8;
5013 do_stun = rand_int(8) + 8;
5014 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5015 if (c_ptr->m_idx == p_ptr->riding)
5016 p_ptr->update |= (PU_BONUS);
5024 if (seen) obvious = TRUE;
5027 msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5029 msg_format("You points at %s and curses.", m_name);
5032 if (r_ptr->flags3 & (RF3_RES_ALL))
5035 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5037 note = " is immune.";
5040 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5044 /* Attempt a saving throw */
5045 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5049 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5051 note = "is unaffected!";
5061 if (seen) obvious = TRUE;
5064 msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£",m_name);
5066 msg_format("You points at %s and curses horribly.", m_name);
5069 if (r_ptr->flags3 & (RF3_RES_ALL))
5072 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5074 note = " is immune.";
5077 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5081 /* Attempt a saving throw */
5082 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5086 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5088 note = "is unaffected!";
5098 if (seen) obvious = TRUE;
5101 msg_format("%s¤ò»Øº¹¤·¡¢¶²¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª",m_name);
5103 msg_format("You points at %s, incanting terribly!", m_name);
5106 if (r_ptr->flags3 & (RF3_RES_ALL))
5109 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5111 note = " is immune.";
5114 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5118 /* Attempt a saving throw */
5119 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5123 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5125 note = "is unaffected!";
5135 if (seen) obvious = TRUE;
5138 msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£",m_name);
5140 msg_format("You points at %s, screaming th word, 'DIE!'.", m_name);
5143 if (r_ptr->flags3 & (RF3_RES_ALL))
5146 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5148 note = " is immune.";
5151 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5155 /* Attempt a saving throw */
5156 if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
5160 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5162 note = "is unaffected!";
5172 if (seen) obvious = TRUE;
5174 if (r_ptr->flags3 & (RF3_RES_ALL))
5177 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5179 note = " is immune.";
5182 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5186 if (r_ptr->flags1 & RF1_UNIQUE)
5189 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5191 note = "is unaffected!";
5197 if ((p_ptr->lev + randint(dam)) >
5198 (r_ptr->level + randint(200)))
5200 dam = ((40 + randint(20)) * m_ptr->hp) / 100;
5202 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5207 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5217 /* Capture monster */
5221 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5222 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_UNIQUE_7)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR))
5225 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5227 msg_format("%^s is unaffected.", m_name);
5233 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5234 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && (r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)))
5235 nokori_hp = m_ptr->maxhp * 3 / 10;
5237 nokori_hp = m_ptr->maxhp * 3 / 20;
5239 if (m_ptr->hp >= nokori_hp)
5242 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5244 msg_format("You need to weaken %s more.", m_name);
5248 else if (m_ptr->hp < rand_int(nokori_hp))
5250 if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5252 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5254 msg_format("You captures %^s!", m_name);
5256 cap_mon = m_list[c_ptr->m_idx].r_idx;
5257 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5258 cap_hp = m_list[c_ptr->m_idx].hp;
5259 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5260 if (m_list[c_ptr->m_idx].nickname)
5261 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5264 if (c_ptr->m_idx == p_ptr->riding)
5266 if (rakuba(-1, FALSE))
5269 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5271 msg_format("You have fallen from %s.", m_name);
5276 delete_monster_idx(c_ptr->m_idx);
5283 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5285 msg_format("You failed to capture %s.", m_name);
5294 if (seen) obvious = TRUE;
5296 if (dam == HISSATSU_NYUSIN)
5300 bool success = FALSE;
5301 for (i = 0; i < 8; i++)
5303 if (cave_empty_bold(y+ddy[i], x+ddx[i]) || ((y+ddy[i] == py) && (x+ddx[i] == px)))
5306 if (distance(py, px, ny, nx) > distance(py, px, y+ddy[i], x+ddx[i]))
5315 if ((ny != py) || (nx != px))
5317 teleport_player_to(ny, nx, FALSE);
5319 msg_print("ÁÇÁ᤯Áê¼ê¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª");
5321 msg_format("You quickly jump in and attack %s!", m_name);
5328 msg_print("¼ºÇÔ¡ª");
5330 msg_print("Failed!");
5337 return (py_attack(y, x, dam));
5340 msg_print("¹¶·â¤Ï¶õ¤òÀڤä¿¡£");
5342 msg_print("You attack the empty air.");
5348 /* Sleep (Use "dam" as "power") */
5354 if (seen) obvious = TRUE;
5356 if (r_ptr->flags3 & (RF3_RES_ALL))
5359 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5361 note = " is immune.";
5364 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5367 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5370 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5372 note = " is immune!";
5376 if (seen) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5382 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5384 note = " is immune!";
5391 if (one_in_(5)) effect = 1;
5392 else if (one_in_(4)) effect = 2;
5393 else if (one_in_(3)) effect = 3;
5398 /* Powerful monsters can resist */
5399 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5400 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5403 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5405 note = " is unaffected!";
5411 /* Normal monsters slow down */
5417 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5419 note = " starts moving slower.";
5422 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5424 if (c_ptr->m_idx == p_ptr->riding)
5425 p_ptr->update |= (PU_BONUS);
5429 else if (effect == 2)
5431 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5433 /* Attempt a saving throw */
5434 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5435 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5440 /* No obvious effect */
5442 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5444 note = " is unaffected!";
5451 else if (effect == 3)
5453 /* Attempt a saving throw */
5454 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5455 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5456 (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5458 /* Memorize a flag */
5459 if (r_ptr->flags3 & RF3_NO_SLEEP)
5461 if (seen) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5464 /* No obvious effect */
5466 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5468 note = " is unaffected!";
5475 /* Go to sleep (much) later */
5477 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5479 note = " falls asleep!";
5489 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5491 note = " is immune!";
5495 /* No "real" damage */
5504 if (seen) obvious = TRUE;
5506 if (r_ptr->flags3 & (RF3_RES_ALL))
5509 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5511 note = " is immune.";
5514 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5518 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)
5525 if ((r_ptr->level > rand_int(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
5532 delete_monster_idx(c_ptr->m_idx);
5533 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5535 take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5538 chg_virtue(V_VITALITY, -1);
5543 p_ptr->redraw |= (PR_HP);
5546 p_ptr->window |= (PW_PLAYER);
5553 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5555 note = "is unaffected!";
5558 if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO;
5566 msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£",m_name);
5568 msg_format("You take a photograph of %s.",m_name);
5571 if (r_ptr->flags3 & (RF3_HURT_LITE))
5573 /* Obvious effect */
5574 if (seen) obvious = TRUE;
5576 /* Memorize the effects */
5577 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5579 /* Special effect */
5581 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5582 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5584 note = " cringes from the light!";
5585 note_dies = " shrivels away in the light!";
5590 /* Normally no damage */
5597 photo = m_ptr->r_idx;
5604 case GF_BLOOD_CURSE:
5606 if (seen) obvious = TRUE;
5607 if (r_ptr->flags3 & (RF3_RES_ALL))
5610 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5612 note = " is immune.";
5615 if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
5635 /* Absolutely no effect */
5636 if (skipped) return (FALSE);
5638 /* "Unique" monsters cannot be polymorphed */
5639 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5641 /* Quest monsters cannot be polymorphed */
5642 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5644 if (p_ptr->riding & (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5646 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5647 if (((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE_7) || (r_ptr->flags1 & RF1_QUESTOR)) && !p_ptr->inside_battle)
5649 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5654 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5655 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5658 /* Modify the damage */
5660 dam = mon_damage_mod(m_ptr, dam, (typ == GF_PSY_SPEAR));
5662 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤";
5664 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5667 /* Check for death */
5668 if (dam > m_ptr->hp)
5670 /* Extract method of death */
5674 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5675 else if (do_poly && (randint(90) > r_ptr->level))
5677 if (polymorph_monster(y, x))
5680 if (seen) obvious = TRUE;
5682 /* Monster polymorphs */
5684 note = "¤¬ÊѿȤ·¤¿¡ª";
5690 /* Turn off the damage */
5693 /* Hack -- Get new monster */
5694 m_ptr = &m_list[c_ptr->m_idx];
5696 /* Hack -- Get new race */
5697 r_ptr = &r_info[m_ptr->r_idx];
5703 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5705 note = " is unaffected!";
5711 /* Handle "teleport" */
5715 if (seen) obvious = TRUE;
5719 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5721 note = " disappears!";
5724 chg_virtue(V_VALOUR, -1);
5727 teleport_away(c_ptr->m_idx, do_dist, !who);
5729 /* Hack -- get new location */
5733 /* Hack -- get new grid */
5734 c_ptr = &cave[y][x];
5737 /* Sound and Impact breathers never stun */
5739 !(r_ptr->flags4 & (RF4_BR_SOUN)) &&
5740 !(r_ptr->flags4 & (RF4_BR_WALL)) &&
5741 !(r_ptr->flags3 & (RF3_NO_STUN)))
5744 if (seen) obvious = TRUE;
5750 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5752 note = " is more dazed.";
5755 tmp = m_ptr->stunned + (do_stun / 2);
5760 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5762 note = " is dazed.";
5769 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5775 /* Confusion and Chaos breathers (and sleepers) never confuse */
5777 !(r_ptr->flags3 & (RF3_NO_CONF)) &&
5778 !(r_ptr->flags4 & (RF4_BR_CONF)) &&
5779 !(r_ptr->flags4 & (RF4_BR_CHAO)))
5782 if (seen) obvious = TRUE;
5784 /* Already partially confused */
5785 if (m_ptr->confused)
5788 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5790 note = " looks more confused.";
5793 tmp = m_ptr->confused + (do_conf / 2);
5796 /* Was not confused */
5800 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5802 note = " looks confused.";
5808 /* Apply confusion */
5809 m_ptr->confused = (tmp < 200) ? tmp : 200;
5817 if (seen) obvious = TRUE;
5819 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp-1;
5824 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5826 note = " seems weakened.";
5828 m_ptr->maxhp -= do_time;
5829 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp-m_ptr->maxhp;
5839 tmp = m_ptr->monfear + do_fear;
5842 m_ptr->monfear = (tmp < 200) ? tmp : 200;
5849 /* If another monster did the damage, hurt the monster by hand */
5852 /* Redraw (later) if needed */
5853 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5854 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5856 /* Wake the monster up */
5859 /* Hurt the monster */
5867 if (is_pet(m_ptr) && !(m_ptr->ml))
5870 /* Give detailed messages if destroyed */
5873 monster_desc(m_name, m_ptr, 0x100);
5876 msg_format("%^s%s", m_name, note);
5884 monster_gain_exp(who, m_ptr->r_idx);
5886 /* Generate treasure, etc */
5887 monster_death(c_ptr->m_idx, FALSE);
5889 /* Delete the monster */
5890 delete_monster_idx(c_ptr->m_idx);
5895 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
5897 msg_print("You feel sad for a moment.");
5903 /* Damaged monster */
5906 /* Give detailed messages if visible or destroyed */
5907 if (note && seen) msg_format("%^s%s", m_name, note);
5909 /* Hack -- Pain message */
5912 message_pain(c_ptr->m_idx, dam);
5919 /* Hack -- handle sleep */
5920 if (do_sleep) m_ptr->csleep = do_sleep;
5924 else if (heal_leper)
5927 msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
5929 msg_print("The Mangy looking leper is healed!");
5932 delete_monster_idx(c_ptr->m_idx);
5934 /* If the player did it, give him experience, check fear */
5935 else if (typ != GF_DRAIN_MANA)
5939 /* Hurt the monster, check for fear and death */
5940 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
5945 /* Damaged monster */
5948 /* HACK - anger the monster before showing the sleep message */
5949 if (do_sleep) anger_monster(m_ptr);
5951 /* Give detailed messages if visible or destroyed */
5954 msg_format("%s%s", m_name, note);
5956 msg_format("%^s%s", m_name, note);
5960 /* Hack -- Pain message */
5963 message_pain(c_ptr->m_idx, dam);
5966 /* Anger monsters */
5967 if (((dam > 0) || get_angry) && !do_sleep)
5968 anger_monster(m_ptr);
5971 if ((fear || do_fear) && (m_ptr->ml))
5978 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
5980 msg_format("%^s flees in terror!", m_name);
5985 /* Hack -- handle sleep */
5986 if (do_sleep) m_ptr->csleep = do_sleep;
5990 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
5992 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
5996 switch (randint(28))
6002 msg_print("ÃÏÌ̤¬Íɤ줿...");
6004 msg_print("The ground trembles...");
6007 earthquake(ty, tx, 4 + rand_int(4));
6008 if (randint(6) != 1) break;
6010 case 3: case 4: case 5: case 6:
6013 int dam = damroll(10, 10);
6015 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6017 msg_print("A portal opens to a plane of raw mana!");
6020 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6021 if (randint(6) != 1) break;
6027 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6029 msg_print("Space warps about you!");
6032 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
6033 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6034 if (randint(6) != 1) break;
6036 case 9: case 10: case 11:
6038 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6040 msg_print("You feel a surge of energy!");
6043 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6044 if (randint(6) != 1) break;
6045 case 12: case 13: case 14: case 15: case 16:
6046 aggravate_monsters(0);
6047 if (randint(6) != 1) break;
6049 count += activate_hi_summon(ty, tx, TRUE);
6050 if (randint(6) != 1) break;
6051 case 19: case 20: case 21: case 22:
6053 bool pet = FALSE, friendly = FALSE;
6063 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, !pet);
6064 if (randint(6) != 1) break;
6066 case 23: case 24: case 25:
6067 if (p_ptr->hold_life && (rand_int(100) < 75)) break;
6069 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6071 msg_print("You feel your life draining away...");
6074 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6075 else lose_exp(p_ptr->exp / 16);
6076 if (randint(6) != 1) break;
6077 case 26: case 27: case 28:
6086 (void)do_dec_stat(i);
6088 while (randint(2) == 1);
6095 (void)do_dec_stat(rand_int(6));
6101 while (randint(5) == 1);
6104 if (p_ptr->inside_battle)
6106 p_ptr->health_who = c_ptr->m_idx;
6107 p_ptr->redraw |= (PR_HEALTH);
6111 /* XXX XXX XXX Verify this code */
6113 /* Update the monster */
6114 update_mon(c_ptr->m_idx, FALSE);
6116 /* Redraw the monster grid */
6120 /* Update monster recall window */
6121 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6124 p_ptr->window |= (PW_MONSTER);
6127 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6131 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6133 m_ptr->target_y = monster_target_y;
6134 m_ptr->target_x = monster_target_x;
6137 else if (is_pet(&m_list[who]) && (m_ptr->target_y != py) && (m_ptr->target_x != px))
6139 m_ptr->target_y = m_list[who].fy;
6140 m_ptr->target_x = m_list[who].fx;
6144 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6146 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6147 rakubadam_m = (dam > 200) ? 200 : dam;
6156 /* Get local object */
6159 /* Prepare to make a Blade of Chaos */
6160 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6162 q_ptr->pval = photo;
6164 /* Mark the item as fully known */
6165 q_ptr->ident |= (IDENT_MENTAL);
6168 q_ptr->python = object_create_callback(q_ptr);
6169 #endif /* USE_SCRIPT */
6171 /* Drop it in the dungeon */
6172 (void)drop_near(q_ptr, -1, py, px);
6180 /* Return "Anything seen?" */
6186 * Helper function for "project()" below.
6188 * Handle a beam/bolt/ball causing damage to the player.
6190 * This routine takes a "source monster" (by index), a "distance", a default
6191 * "damage", and a "damage type". See "project_m()" above.
6193 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6194 * is reduced (see "project_m()" above). This can happen if a monster breathes
6195 * at the player and hits a wall instead.
6197 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6198 * to know if this is actually a ball or a bolt spell
6201 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6202 * we just assume that the effects were obvious, for historical reasons.
6204 static bool project_p(int who, int r, int y, int x, int dam, int typ, int a_rad, int monspell)
6208 /* Hack -- assume obvious */
6209 bool obvious = TRUE;
6211 /* Player blind-ness */
6212 bool blind = (p_ptr->blind ? TRUE : FALSE);
6214 /* Player needs a "description" (he is blind) */
6217 /* Source monster */
6218 monster_type *m_ptr;
6220 /* Monster name (for attacks) */
6223 /* Monster name (for damage) */
6226 /* Hack -- messages */
6230 /* Player is not here */
6231 if ((x != px) || (y != py)) return (FALSE);
6233 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (rand_int(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6239 /* Player cannot hurt himself */
6240 if (!who) return (FALSE);
6241 if (who == p_ptr->riding) return (FALSE);
6243 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))
6246 int max_attempts = 10;
6249 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6250 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6251 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6253 if (blind) msg_print("Something bounces!");
6254 else msg_print("The attack bounces!");
6258 /* Choose 'new' target */
6261 t_y = m_list[who].fy - 1 + randint(3);
6262 t_x = m_list[who].fx - 1 + randint(3);
6265 while (max_attempts && in_bounds2u(t_y, t_x) &&
6266 !(player_has_los_bold(t_y, t_x)));
6268 if (max_attempts < 1)
6270 t_y = m_list[who].fy;
6271 t_x = m_list[who].fx;
6274 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL), monspell);
6281 /* Limit maximum damage */
6282 if (dam > 1600) dam = 1600;
6284 /* Reduce damage by distance */
6285 dam = (dam + r) / (r + 1);
6288 /* If the player is blind, be more descriptive */
6289 if (blind) fuzzy = TRUE;
6292 /* Get the source monster */
6293 m_ptr = &m_list[who];
6295 /* Get the monster name */
6296 monster_desc(m_name, m_ptr, 0);
6298 /* Get the monster's real name */
6299 monster_desc(killer, m_ptr, 0x88);
6302 /* Analyze the damage */
6305 /* Standard damage -- hurts inventory too */
6309 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6311 if (fuzzy) msg_print("You are hit by acid!");
6314 acid_dam(dam, killer, monspell);
6318 /* Standard damage -- hurts inventory too */
6322 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6324 if (fuzzy) msg_print("You are hit by fire!");
6327 fire_dam(dam, killer, monspell);
6331 /* Standard damage -- hurts inventory too */
6335 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6337 if (fuzzy) msg_print("You are hit by cold!");
6340 cold_dam(dam, killer, monspell);
6344 /* Standard damage -- hurts inventory too */
6348 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6350 if (fuzzy) msg_print("You are hit by lightning!");
6353 elec_dam(dam, killer, monspell);
6357 /* Standard damage -- also poisons player */
6360 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6362 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6364 if (fuzzy) msg_print("You are hit by poison!");
6367 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6368 if (double_resist) dam = (dam + 2) / 3;
6370 if ((!(double_resist || p_ptr->resist_pois)) &&
6371 randint(HURT_CHANCE) == 1)
6376 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6378 if (!(double_resist || p_ptr->resist_pois))
6380 set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
6385 /* Standard damage -- also poisons / mutates player */
6388 bool double_resist = (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
6390 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6392 if (fuzzy) msg_print("You are hit by radiation!");
6395 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6396 if (double_resist) dam = (2 * dam + 2) / 5;
6397 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6398 if (!(double_resist || p_ptr->resist_pois))
6400 set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
6402 if (randint(5) == 1) /* 6 */
6405 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6407 msg_print("You undergo a freakish metamorphosis!");
6410 if (randint(4) == 1) /* 4 */
6416 if (randint(6) == 1)
6418 inven_damage(set_acid_destroy, 2);
6424 /* Standard damage */
6428 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6430 if (fuzzy) msg_print("You are hit by something!");
6433 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6437 /* Holy Orb -- Player only takes partial damage */
6441 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6443 if (fuzzy) msg_print("You are hit by something!");
6446 if (p_ptr->align > 10)
6448 else if (p_ptr->align < -10)
6450 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6457 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6459 if (fuzzy) msg_print("You are hit by something!");
6462 if (p_ptr->align > 10)
6464 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6468 /* Arrow -- XXX no dodging */
6472 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6474 if (fuzzy) msg_print("You are hit by something sharp!");
6477 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6479 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6482 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6486 /* Plasma -- XXX No resist */
6490 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6492 if (fuzzy) msg_print("You are hit by something *HOT*!");
6495 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6497 if (!p_ptr->resist_sound)
6499 int k = (randint((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6500 (void)set_stun(p_ptr->stun + k);
6503 if (!(p_ptr->resist_fire ||
6504 p_ptr->oppose_fire ||
6505 music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU) ||
6506 p_ptr->immune_fire))
6508 inven_damage(set_acid_destroy, 3);
6514 /* Nether -- drain experience */
6518 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6520 if (fuzzy) msg_print("You are hit by nether forces!");
6524 if (p_ptr->resist_neth)
6526 if (!prace_is_(RACE_SPECTRE))
6527 dam *= 6; dam /= (randint(4) + 7);
6529 else if (p_ptr->prace != RACE_ANDROID)
6531 if (p_ptr->hold_life && (rand_int(100) < 75))
6534 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6536 msg_print("You keep hold of your life force!");
6540 else if (p_ptr->hold_life)
6543 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6545 msg_print("You feel your life slipping away!");
6548 lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6553 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6555 msg_print("You feel your life draining away!");
6558 lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6562 if (prace_is_(RACE_SPECTRE))
6565 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6567 msg_print("You feel invigorated!");
6571 learn_spell(monspell);
6575 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6581 /* Water -- stun/confuse */
6585 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6587 if (fuzzy) msg_print("You are hit by something wet!");
6590 if (!p_ptr->resist_sound)
6592 set_stun(p_ptr->stun + randint(40));
6594 if (!p_ptr->resist_conf)
6596 set_confused(p_ptr->confused + randint(5) + 5);
6599 if (randint(5) == 1)
6601 inven_damage(set_cold_destroy, 3);
6604 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6608 /* Chaos -- many effects */
6612 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6614 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6617 if (p_ptr->resist_chaos)
6619 dam *= 6; dam /= (randint(4) + 7);
6621 if (!p_ptr->resist_conf)
6623 (void)set_confused(p_ptr->confused + rand_int(20) + 10);
6625 if (!p_ptr->resist_chaos)
6627 (void)set_image(p_ptr->image + randint(10));
6628 if (randint(3) == 1)
6631 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6633 msg_print("Your body is twisted by chaos!");
6636 (void)gain_random_mutation(0);
6639 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6641 if (p_ptr->prace == RACE_ANDROID)
6644 else if (p_ptr->hold_life && (rand_int(100) < 75))
6647 msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
6649 msg_print("You keep hold of your life force!");
6653 else if (p_ptr->hold_life)
6656 msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª");
6658 msg_print("You feel your life slipping away!");
6661 lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE);
6666 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6668 msg_print("You feel your life draining away!");
6671 lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6674 if (!p_ptr->resist_chaos || (randint(9) == 1))
6676 inven_damage(set_elec_destroy, 2);
6677 inven_damage(set_fire_destroy, 2);
6679 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6683 /* Shards -- mostly cutting */
6687 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6689 if (fuzzy) msg_print("You are hit by something sharp!");
6692 if (p_ptr->resist_shard)
6694 dam *= 6; dam /= (randint(4) + 7);
6698 (void)set_cut(p_ptr->cut + dam);
6701 if (!p_ptr->resist_shard || (randint(13) == 1))
6703 inven_damage(set_cold_destroy, 2);
6706 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6710 /* Sound -- mostly stunning */
6714 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6716 if (fuzzy) msg_print("You are hit by a loud noise!");
6719 if (p_ptr->resist_sound)
6721 dam *= 5; dam /= (randint(4) + 7);
6725 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
6726 (void)set_stun(p_ptr->stun + k);
6729 if (!p_ptr->resist_sound || (randint(13) == 1))
6731 inven_damage(set_cold_destroy, 2);
6734 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6738 /* Pure confusion */
6742 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6744 if (fuzzy) msg_print("You are hit by something puzzling!");
6747 if (p_ptr->resist_conf)
6749 dam *= 5; dam /= (randint(4) + 7);
6751 if (!p_ptr->resist_conf)
6753 (void)set_confused(p_ptr->confused + randint(20) + 10);
6755 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6759 /* Disenchantment -- see above */
6763 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6765 if (fuzzy) msg_print("You are hit by something static!");
6768 if (p_ptr->resist_disen)
6770 dam *= 6; dam /= (randint(4) + 7);
6774 (void)apply_disenchant(0);
6776 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6780 /* Nexus -- see above */
6784 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6786 if (fuzzy) msg_print("You are hit by something strange!");
6789 if (p_ptr->resist_nexus)
6791 dam *= 6; dam /= (randint(4) + 7);
6797 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6801 /* Force -- mostly stun */
6805 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6807 if (fuzzy) msg_print("You are hit by kinetic force!");
6810 if (!p_ptr->resist_sound)
6812 (void)set_stun(p_ptr->stun + randint(20));
6814 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6819 /* Rocket -- stun, cut */
6823 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6825 if (fuzzy) msg_print("There is an explosion!");
6828 if (!p_ptr->resist_sound)
6830 (void)set_stun(p_ptr->stun + randint(20));
6832 if (p_ptr->resist_shard)
6838 (void)set_cut(p_ptr-> cut + ( dam / 2));
6841 if ((!p_ptr->resist_shard) || (randint(12) == 1))
6843 inven_damage(set_cold_destroy, 3);
6846 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6850 /* Inertia -- slowness */
6854 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6856 if (fuzzy) msg_print("You are hit by something slow!");
6859 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
6860 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6864 /* Lite -- blinding */
6868 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6870 if (fuzzy) msg_print("You are hit by something!");
6873 if (p_ptr->resist_lite)
6875 dam *= 4; dam /= (randint(4) + 7);
6877 else if (!blind && !p_ptr->resist_blind)
6879 (void)set_blind(p_ptr->blind + randint(5) + 2);
6881 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
6884 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
6886 msg_print("The light scorches your flesh!");
6891 else if (prace_is_(RACE_S_FAIRY))
6895 if (p_ptr->wraith_form) dam *= 2;
6896 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6898 if (p_ptr->wraith_form)
6900 p_ptr->wraith_form = 0;
6902 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
6904 msg_print("The light forces you out of your incorporeal shadow form.");
6907 p_ptr->redraw |= PR_MAP;
6908 /* Update monsters */
6909 p_ptr->update |= (PU_MONSTERS);
6911 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
6913 /* Redraw status bar */
6914 p_ptr->redraw |= (PR_STATUS);
6921 /* Dark -- blinding */
6925 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6927 if (fuzzy) msg_print("You are hit by something!");
6930 if (p_ptr->resist_dark)
6932 dam *= 4; dam /= (randint(4) + 7);
6934 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
6936 else if (!blind && !p_ptr->resist_blind)
6938 (void)set_blind(p_ptr->blind + randint(5) + 2);
6940 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6944 /* Time -- bolt fewer effects XXX */
6948 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
6950 if (fuzzy) msg_print("You are hit by a blast from the past!");
6953 if (p_ptr->resist_time)
6956 dam /= (randint(4) + 7);
6958 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
6960 msg_print("You feel as if time is passing you by.");
6966 switch (randint(10))
6968 case 1: case 2: case 3: case 4: case 5:
6970 if (p_ptr->prace == RACE_ANDROID) break;
6972 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
6974 msg_print("You feel life has clocked back.");
6977 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
6981 case 6: case 7: case 8: case 9:
6986 case 1: k = A_STR; act = "¶¯¤¯"; break;
6987 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
6988 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
6989 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
6990 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
6991 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
6993 case 1: k = A_STR; act = "strong"; break;
6994 case 2: k = A_INT; act = "bright"; break;
6995 case 3: k = A_WIS; act = "wise"; break;
6996 case 4: k = A_DEX; act = "agile"; break;
6997 case 5: k = A_CON; act = "hale"; break;
6998 case 6: k = A_CHR; act = "beautiful"; break;
7004 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7006 msg_format("You're not as %s as you used to be...", act);
7010 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7011 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7012 p_ptr->update |= (PU_BONUS);
7019 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7021 msg_print("You're not as powerful as you used to be...");
7025 for (k = 0; k < 6; k++)
7027 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7028 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7030 p_ptr->update |= (PU_BONUS);
7036 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7040 /* Gravity -- stun plus slowness plus teleport */
7044 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7045 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7047 if (fuzzy) msg_print("You are hit by something heavy!");
7048 msg_print("Gravity warps around you.");
7053 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7054 if (!(p_ptr->resist_sound || p_ptr->ffall))
7056 int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
7057 (void)set_stun(p_ptr->stun + k);
7061 dam = (dam * 2) / 3;
7064 if (!p_ptr->ffall || (randint(13) == 1))
7066 inven_damage(set_cold_destroy, 2);
7069 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7073 /* Standard damage */
7074 case GF_DISINTEGRATE:
7077 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7079 if (fuzzy) msg_print("You are hit by pure energy!");
7082 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7089 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7091 if (fuzzy) msg_print("You are hit by something invigorating!");
7094 (void)hp_player(dam);
7102 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7104 if (fuzzy) msg_print("You are hit by something!");
7107 (void)set_fast(p_ptr->fast + randint(5), FALSE);
7115 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7117 if (fuzzy) msg_print("You are hit by something slow!");
7120 (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
7126 if (p_ptr->free_act) break;
7128 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7130 if (fuzzy) msg_print("You fall asleep!");
7134 if (ironman_nightmare)
7137 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7139 msg_print("A horrible vision enters your mind.");
7143 /* Pick a nightmare */
7144 get_mon_num_prep(get_nightmare, NULL);
7146 /* Have some nightmares */
7147 have_nightmare(get_mon_num(MAX_DEPTH));
7149 /* Remove the monster restriction */
7150 get_mon_num_prep(NULL, NULL);
7153 set_paralyzed(p_ptr->paralyzed + dam);
7164 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7166 if (fuzzy) msg_print("You are hit by an aura of magic!");
7169 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7177 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7179 if (fuzzy) msg_print("You are hit by an energy!");
7182 take_hit(DAMAGE_FORCE, dam, killer, monspell);
7190 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7192 if (fuzzy) msg_print("Something falls from the sky on you!");
7195 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7196 if (!p_ptr->resist_shard || (randint(13) == 1))
7198 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7199 inven_damage(set_cold_destroy, 2);
7205 /* Ice -- cold plus stun plus cuts */
7209 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7211 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7214 cold_dam(dam, killer, monspell);
7215 if (!p_ptr->resist_shard)
7217 (void)set_cut(p_ptr->cut + damroll(5, 8));
7219 if (!p_ptr->resist_sound)
7221 (void)set_stun(p_ptr->stun + randint(15));
7224 if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || (randint(12) == 1))
7226 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7236 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7238 if (fuzzy) msg_print("You are hit by something extremely cold!");
7242 if (p_ptr->mimic_form)
7244 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7245 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7250 switch (p_ptr->prace)
7252 /* Some races are immune */
7266 take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7286 if (p_ptr->riding && dam > 0)
7288 rakubadam_p = (dam > 200) ? 200 : dam;
7296 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7302 /* Return "Anything seen?" */
7308 * Find the distance from (x, y) to a line.
7310 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7312 /* Vector from (x, y) to (x1, y1) */
7321 int pd = distance(y1, x1, y, x);
7322 int nd = distance(y1, x1, y2, x2);
7324 if (pd > nd) return distance(y, x, y2, x2);
7326 /* Component of P on N */
7327 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7329 /* Absolute value */
7330 return((nd >= 0) ? nd : 0 - nd);
7337 * Modified version of los() for calculation of disintegration balls.
7338 * Disintegration effects are stopped by permanent walls.
7340 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7360 /* Slope, or 1/Slope, of LOS */
7364 /* Extract the offset */
7368 /* Extract the absolute offset */
7373 /* Handle adjacent (or identical) grids */
7374 if ((ax < 2) && (ay < 2)) return (TRUE);
7377 /* Paranoia -- require "safe" origin */
7378 /* if (!in_bounds(y1, x1)) return (FALSE); */
7381 /* Directly South/North */
7384 /* South -- check for walls */
7387 for (ty = y1 + 1; ty < y2; ty++)
7389 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7393 /* North -- check for walls */
7396 for (ty = y1 - 1; ty > y2; ty--)
7398 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7406 /* Directly East/West */
7409 /* East -- check for walls */
7412 for (tx = x1 + 1; tx < x2; tx++)
7414 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7418 /* West -- check for walls */
7421 for (tx = x1 - 1; tx > x2; tx--)
7423 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7432 /* Extract some signs */
7433 sx = (dx < 0) ? -1 : 1;
7434 sy = (dy < 0) ? -1 : 1;
7437 /* Vertical "knights" */
7442 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7446 /* Horizontal "knights" */
7451 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7456 /* Calculate scale factor div 2 */
7459 /* Calculate scale factor */
7463 /* Travel horizontally */
7466 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7472 /* Consider the special case where slope == 1. */
7483 /* Note (below) the case (qy == f2), where */
7484 /* the LOS exactly meets the corner of a tile. */
7487 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7498 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7511 /* Travel vertically */
7514 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7530 /* Note (below) the case (qx == f2), where */
7531 /* the LOS exactly meets the corner of a tile. */
7534 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7545 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7565 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)
7578 while (bdis <= distance(y1, x1, y2, x2) + rad)
7580 /* Travel from center outward */
7581 for (cdis = 0; cdis <= brad; cdis++)
7584 /* Scan the maximal blast area of radius "cdis" */
7585 for (y = by - cdis; y <= by + cdis; y++)
7587 for (x = bx - cdis; x <= bx + cdis; x++)
7589 /* Ignore "illegal" locations */
7590 if (!in_bounds(y, x)) continue;
7592 /* Enforce a circular "ripple" */
7593 if (distance(y1, x1, y, x) != bdis) continue;
7595 /* Enforce an arc */
7596 if (distance(by, bx, y, x) != cdis) continue;
7600 /* Disintegration balls explosions are stopped by perma-walls */
7601 if (!in_disintegration_range(by, bx, y, x)) continue;
7603 if (real_breath && cave_valid_bold(y, x) &&
7604 (cave[y][x].feat < FEAT_PATTERN_START ||
7605 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
7606 (cave[y][x].feat < FEAT_DEEP_WATER ||
7607 cave[y][x].feat > FEAT_GRASS))
7609 if (cave[y][x].feat == FEAT_TREES)
7610 cave_set_feat(y, x, FEAT_GRASS);
7613 cave[y][x].feat = floor_type[rand_int(100)];
7614 cave[y][x].info &= ~(CAVE_MASK);
7615 cave[y][x].info |= CAVE_FLOOR;
7618 /* Update some things -- similar to GF_KILL_WALL */
7619 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
7623 /* The blast is stopped by walls */
7624 if (!los(by, bx, y, x)) continue;
7627 /* Save this grid */
7635 /* Encode some more "radius" info */
7636 gm[bdis + 1] = *pgrids;
7639 if ((by == y2) && (bx == x2)) done = TRUE;
7648 /* Ripple outwards */
7649 // mmove2(&by, &bx, y1, x1, y2, x2);
7651 by = GRID_Y(path_g[bdis]);
7652 bx = GRID_X(path_g[bdis]);
7654 /* Find the next ripple */
7657 /* Increase the size */
7658 brad = (rad * bdis) / dist;
7661 /* Store the effect size */
7667 * Generic "beam"/"bolt"/"ball" projection routine.
7670 * who: Index of "source" monster (zero for "player")
7671 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
7672 * y,x: Target location (or location to travel "towards")
7673 * dam: Base damage roll to apply to affected monsters (or player)
7674 * typ: Type of damage to apply to monsters (and objects)
7675 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
7678 * TRUE if any "effects" of the projection were observed, else FALSE
7680 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
7681 * towards a given location (optionally passing over the heads of interposing
7682 * monsters), and have it do a given amount of damage to the monsters (and
7683 * optionally objects) within the given radius of the final location.
7685 * A "bolt" travels from source to target and affects only the target grid.
7686 * A "beam" travels from source to target, affecting all grids passed through.
7687 * A "ball" travels from source to the target, exploding at the target, and
7688 * affecting everything within the given radius of the target location.
7690 * Traditionally, a "bolt" does not affect anything on the ground, and does
7691 * not pass over the heads of interposing monsters, much like a traditional
7692 * missile, and will "stop" abruptly at the "target" even if no monster is
7693 * positioned there, while a "ball", on the other hand, passes over the heads
7694 * of monsters between the source and target, and affects everything except
7695 * the source monster which lies within the final radius, while a "beam"
7696 * affects every monster between the source and target, except for the casting
7697 * monster (or player), and rarely affects things on the ground.
7699 * Two special flags allow us to use this function in special ways, the
7700 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
7701 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
7702 * actually projecting from the source monster (or player).
7704 * The player will only get "experience" for monsters killed by himself
7705 * Unique monsters can only be destroyed by attacks from the player
7707 * Only 256 grids can be affected per projection, limiting the effective
7708 * "radius" of standard ball attacks to nine units (diameter nineteen).
7710 * One can project in a given "direction" by combining PROJECT_THRU with small
7711 * offsets to the initial location (see "line_spell()"), or by calculating
7712 * "virtual targets" far away from the player.
7714 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
7715 * continuing until it actually hits somethings (useful for "stone to mud").
7717 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
7719 * Balls must explode BEFORE hitting walls, or they would affect monsters
7720 * on both sides of a wall. Some bug reports indicate that this is still
7721 * happening in 2.7.8 for Windows, though it appears to be impossible.
7723 * We "pre-calculate" the blast area only in part for efficiency.
7724 * More importantly, this lets us do "explosions" from the "inside" out.
7725 * This results in a more logical distribution of "blast" treasure.
7726 * It also produces a better (in my opinion) animation of the explosion.
7727 * It could be (but is not) used to have the treasure dropped by monsters
7728 * in the middle of the explosion fall "outwards", and then be damaged by
7729 * the blast as it spreads outwards towards the treasure drop location.
7731 * Walls and doors are included in the blast area, so that they can be
7732 * "burned" or "melted" in later versions.
7734 * This algorithm is intended to maximize simplicity, not necessarily
7735 * efficiency, since this function is not a bottleneck in the code.
7737 * We apply the blast effect from ground zero outwards, in several passes,
7738 * first affecting features, then objects, then monsters, then the player.
7739 * This allows walls to be removed before checking the object or monster
7740 * in the wall, and protects objects which are dropped by monsters killed
7741 * in the blast, and allows the player to see all affects before he is
7742 * killed or teleported away. The semantics of this method are open to
7743 * various interpretations, but they seem to work well in practice.
7745 * We process the blast area from ground-zero outwards to allow for better
7746 * distribution of treasure dropped by monsters, and because it provides a
7747 * pleasing visual effect at low cost.
7749 * Note that the damage done by "ball" explosions decreases with distance.
7750 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
7752 * Notice the "napalm" effect of "beam" weapons. First they "project" to
7753 * the target, and then the damage "flows" along this beam of destruction.
7754 * The damage at every grid is the same as at the "center" of a "ball"
7755 * explosion, since the "beam" grids are treated as if they ARE at the
7756 * center of a "ball" explosion.
7758 * Currently, specifying "beam" plus "ball" means that locations which are
7759 * covered by the initial "beam", and also covered by the final "ball", except
7760 * for the final grid (the epicenter of the ball), will be "hit twice", once
7761 * by the initial beam, and once by the exploding ball. For the grid right
7762 * next to the epicenter, this results in 150% damage being done. The center
7763 * does not have this problem, for the same reason the final grid in a "beam"
7764 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
7765 * grids which are covered by the "ball" will NOT work, as then they will
7766 * receive LESS damage than they should. Do not combine "beam" with "ball".
7768 * The array "gy[],gx[]" with current size "grids" is used to hold the
7769 * collected locations of all grids in the "blast area" plus "beam path".
7771 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
7772 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
7773 * first blast grid (see above) with radius "N" from the blast center. Note
7774 * that only the first gm[1] grids in the blast area thus take full damage.
7775 * Also, note that gm[rad+1] is always equal to "grids", which is the total
7776 * number of blast grids.
7778 * Note that once the projection is complete, (y2,x2) holds the final location
7779 * of bolts/beams, and the "epicenter" of balls.
7781 * Note also that "rad" specifies the "inclusive" radius of projection blast,
7782 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
7783 * implementation of the "distance" function. Also, a bolt can be properly
7784 * viewed as a "ball" with a "rad" of "zero".
7786 * Note that if no "target" is reached before the beam/bolt/ball travels the
7787 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
7788 * may be relevant even for bolts, since they have a "1x1" mini-blast.
7790 * Note that for consistency, we "pretend" that the bolt actually takes "time"
7791 * to move from point A to point B, even if the player cannot see part of the
7792 * projection path. Note that in general, the player will *always* see part
7793 * of the path, since it either starts at the player or ends on the player.
7795 * Hack -- we assume that every "projection" is "self-illuminating".
7797 * Hack -- when only a single monster is affected, we automatically track
7798 * (and recall) that monster, unless "PROJECT_JUMP" is used.
7800 * Note that all projections now "explode" at their final destination, even
7801 * if they were being projected at a more distant destination. This means
7802 * that "ball" spells will *always* explode.
7804 * Note that we must call "handle_stuff()" after affecting terrain features
7805 * in the blast radius, in case the "illumination" of the grid was changed,
7806 * and "update_view()" and "update_monsters()" need to be called.
7808 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
7817 int y_saver, x_saver; /* For reflecting monsters */
7819 int msec = delay_factor * delay_factor * delay_factor;
7821 /* Assume the player sees nothing */
7822 bool notice = FALSE;
7824 /* Assume the player has seen nothing */
7825 bool visual = FALSE;
7827 /* Assume the player has seen no blast grids */
7830 /* Assume to be a normal ball spell */
7831 bool breath = FALSE;
7833 /* Is the player blind? */
7834 bool blind = (p_ptr->blind ? TRUE : FALSE);
7836 bool old_hide = FALSE;
7838 /* Number of grids in the "path" */
7841 /* Actual grids in the "path" */
7844 /* Number of grids in the "blast area" (including the "beam" path) */
7847 /* Coordinates of the affected grids */
7848 byte gx[1024], gy[1024];
7850 /* Encoded "radius" info (see above) */
7853 /* Actual radius encoded in gm[] */
7861 /* Default target of monsterspell is player */
7862 monster_target_y=py;
7863 monster_target_x=px;
7865 /* Hack -- Jump to target */
7866 if (flg & (PROJECT_JUMP))
7871 /* Clear the flag */
7872 flg &= ~(PROJECT_JUMP);
7877 /* Start at player */
7884 /* Start at monster */
7887 x1 = m_list[who].fx;
7888 y1 = m_list[who].fy;
7901 /* Default "destination" */
7906 /* Hack -- verify stuff */
7907 if (flg & (PROJECT_THRU))
7909 if ((x1 == x2) && (y1 == y2))
7911 flg &= ~(PROJECT_THRU);
7915 /* Handle a breath attack */
7920 if (flg & PROJECT_HIDE) old_hide = TRUE;
7921 flg |= PROJECT_HIDE;
7925 /* Hack -- Assume there will be no blast (max radius 32) */
7926 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
7934 /* Collect beam grids */
7935 if (flg & (PROJECT_BEAM))
7942 if (breath && typ == GF_DISINTEGRATE)
7944 flg |= (PROJECT_DISI);
7947 /* Calculate the projection path */
7949 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
7951 /* Hack -- Handle stuff */
7954 /* Giga-Hack SEEKER & SUPER_RAY */
7956 if( typ == GF_SEEKER )
7966 for (i = 0; i < path_n; ++i)
7971 int ny = GRID_Y(path_g[i]);
7972 int nx = GRID_X(path_g[i]);
7983 /* Only do visuals if requested */
7984 if (!blind && !(flg & (PROJECT_HIDE)))
7986 /* Only do visuals if the player can "see" the bolt */
7987 if (panel_contains(y, x) && player_has_los_bold(y, x))
7994 /* Obtain the bolt pict */
7995 p = bolt_pict(oy, ox, y, x, typ);
7997 /* Extract attr/char */
8001 /* Visual effects */
8002 print_rel(c, a, y, x);
8003 move_cursor_relative(y, x);
8004 /*if (fresh_before)*/ Term_fresh();
8005 Term_xtra(TERM_XTRA_DELAY, msec);
8007 /*if (fresh_before)*/ Term_fresh();
8009 /* Display "beam" grids */
8010 if (flg & (PROJECT_BEAM))
8012 /* Obtain the explosion pict */
8013 p = bolt_pict(y, x, y, x, typ);
8015 /* Extract attr/char */
8019 /* Visual effects */
8020 print_rel(c, a, y, x);
8023 /* Hack -- Activate delay */
8027 /* Hack -- delay anyway for consistency */
8030 /* Delay for consistency */
8031 Term_xtra(TERM_XTRA_DELAY, msec);
8034 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8035 if( cave[y][x].feat == FEAT_MIRROR )
8037 /* The target of monsterspell becomes tha mirror(broken) */
8038 monster_target_y=(s16b)y;
8039 monster_target_x=(s16b)x;
8041 cave_set_feat( y, x , FEAT_FLOOR );
8042 next_mirror( &oy,&ox );
8044 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8045 for( j = last_i; j <=i ; j++ )
8047 y = GRID_Y(path_g[j]);
8048 x = GRID_X(path_g[j]);
8049 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8050 if(!who && (project_m_n==1) && !jump ){
8051 if(cave[project_m_y][project_m_x].m_idx >0 ){
8052 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8054 /* Hack -- auto-recall */
8055 if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8057 /* Hack - auto-track */
8058 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8061 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8066 for( i = last_i ; i < path_n ; i++ )
8069 y = GRID_Y(path_g[i]);
8070 x = GRID_X(path_g[i]);
8071 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8073 if(!who && (project_m_n==1) && !jump ){
8074 if(cave[project_m_y][project_m_x].m_idx >0 ){
8075 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8077 /* Hack -- auto-recall */
8078 if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8080 /* Hack - auto-track */
8081 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8084 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8088 else if(typ == GF_SUPER_RAY){
8090 int second_step = 0;
8097 for (i = 0; i < path_n; ++i)
8102 int ny = GRID_Y(path_g[i]);
8103 int nx = GRID_X(path_g[i]);
8114 /* Only do visuals if requested */
8115 if (!blind && !(flg & (PROJECT_HIDE)))
8117 /* Only do visuals if the player can "see" the bolt */
8118 if (panel_contains(y, x) && player_has_los_bold(y, x))
8125 /* Obtain the bolt pict */
8126 p = bolt_pict(oy, ox, y, x, typ);
8128 /* Extract attr/char */
8132 /* Visual effects */
8133 print_rel(c, a, y, x);
8134 move_cursor_relative(y, x);
8135 /*if (fresh_before)*/ Term_fresh();
8136 Term_xtra(TERM_XTRA_DELAY, msec);
8138 /*if (fresh_before)*/ Term_fresh();
8140 /* Display "beam" grids */
8141 if (flg & (PROJECT_BEAM))
8143 /* Obtain the explosion pict */
8144 p = bolt_pict(y, x, y, x, typ);
8146 /* Extract attr/char */
8150 /* Visual effects */
8151 print_rel(c, a, y, x);
8154 /* Hack -- Activate delay */
8158 /* Hack -- delay anyway for consistency */
8161 /* Delay for consistency */
8162 Term_xtra(TERM_XTRA_DELAY, msec);
8165 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8166 if( cave[y][x].feat == FEAT_RUBBLE ||
8167 cave[y][x].feat == FEAT_DOOR_HEAD ||
8168 cave[y][x].feat == FEAT_DOOR_TAIL ||
8169 (cave[y][x].feat >= FEAT_WALL_EXTRA &&
8170 cave[y][x].feat <= FEAT_PERM_SOLID ))
8172 if( second_step )continue;
8175 if( cave[y][x].feat == FEAT_MIRROR && !second_step )
8177 /* The target of monsterspell becomes tha mirror(broken) */
8178 monster_target_y=(s16b)y;
8179 monster_target_x=(s16b)x;
8181 cave_set_feat( y, x , FEAT_FLOOR );
8182 for( j = 0; j <=i ; j++ )
8184 y = GRID_Y(path_g[j]);
8185 x = GRID_X(path_g[j]);
8186 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8190 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8191 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8192 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8193 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8194 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8195 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8196 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8197 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8200 for( i = 0; i < path_n ; i++ )
8203 y = GRID_Y(path_g[i]);
8204 x = GRID_X(path_g[i]);
8205 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8206 if(!who && (project_m_n==1) && !jump ){
8207 if(cave[project_m_y][project_m_x].m_idx >0 ){
8208 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8210 /* Hack -- auto-recall */
8211 if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8213 /* Hack - auto-track */
8214 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8217 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8222 /* Project along the path */
8223 for (i = 0; i < path_n; ++i)
8228 int ny = GRID_Y(path_g[i]);
8229 int nx = GRID_X(path_g[i]);
8231 if (flg & PROJECT_DISI)
8233 /* Hack -- Balls explode before reaching walls */
8234 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8238 /* Hack -- Balls explode before reaching walls */
8239 if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
8246 /* Collect beam grids */
8247 if (flg & (PROJECT_BEAM))
8254 /* Only do visuals if requested */
8255 if (!blind && !(flg & (PROJECT_HIDE)))
8257 /* Only do visuals if the player can "see" the bolt */
8258 if (panel_contains(y, x) && player_has_los_bold(y, x))
8265 /* Obtain the bolt pict */
8266 p = bolt_pict(oy, ox, y, x, typ);
8268 /* Extract attr/char */
8272 /* Visual effects */
8273 print_rel(c, a, y, x);
8274 move_cursor_relative(y, x);
8275 /*if (fresh_before)*/ Term_fresh();
8276 Term_xtra(TERM_XTRA_DELAY, msec);
8278 /*if (fresh_before)*/ Term_fresh();
8280 /* Display "beam" grids */
8281 if (flg & (PROJECT_BEAM))
8283 /* Obtain the explosion pict */
8284 p = bolt_pict(y, x, y, x, typ);
8286 /* Extract attr/char */
8290 /* Visual effects */
8291 print_rel(c, a, y, x);
8294 /* Hack -- Activate delay */
8298 /* Hack -- delay anyway for consistency */
8301 /* Delay for consistency */
8302 Term_xtra(TERM_XTRA_DELAY, msec);
8305 if ((typ == GF_ATTACK) && (dam == HISSATSU_NYUSIN) && ((i+1) == path_n))
8307 if (cave_empty_bold(y, x)) teleport_player_to(ny, nx, FALSE);
8312 /* Save the "blast epicenter" */
8316 if (breath && (y1 == y2) && (x1 == x2))
8322 flg &= ~(PROJECT_HIDE);
8326 /* Start the "explosion" */
8329 /* Hack -- make sure beams get to "explode" */
8337 /* If we found a "target", explode there */
8338 if (dist <= MAX_RANGE)
8340 /* Mega-Hack -- remove the final "beam" grid */
8341 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8344 * Create a conical breath attack
8355 flg &= ~(PROJECT_HIDE);
8357 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, (typ == GF_DISINTEGRATE), TRUE);
8361 /* Determine the blast area, work from the inside out */
8362 for (dist = 0; dist <= rad; dist++)
8364 /* Scan the maximal blast area of radius "dist" */
8365 for (y = y2 - dist; y <= y2 + dist; y++)
8367 for (x = x2 - dist; x <= x2 + dist; x++)
8369 /* Ignore "illegal" locations */
8370 if (!in_bounds2(y, x)) continue;
8372 /* Enforce a "circular" explosion */
8373 if (distance(y2, x2, y, x) != dist) continue;
8375 if (typ == GF_DISINTEGRATE)
8377 /* Disintegration balls explosions are stopped by perma-walls */
8378 if (!in_disintegration_range(y2, x2, y, x)) continue;
8380 if (cave_valid_bold(y, x) &&
8381 (cave[y][x].feat < FEAT_PATTERN_START ||
8382 cave[y][x].feat > FEAT_PATTERN_XTRA2) &&
8383 (cave[y][x].feat < FEAT_DEEP_WATER ||
8384 cave[y][x].feat > FEAT_GRASS))
8386 if (cave[y][x].feat == FEAT_TREES)
8387 cave_set_feat(y, x, FEAT_GRASS);
8390 cave[y][x].feat = floor_type[rand_int(100)];
8391 cave[y][x].info &= ~(CAVE_MASK);
8392 cave[y][x].info |= CAVE_FLOOR;
8396 /* Update some things -- similar to GF_KILL_WALL */
8397 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
8401 /* Ball explosions are stopped by walls */
8402 if (!los(y2, x2, y, x)) continue;
8405 /* Save this grid */
8412 /* Encode some more "radius" info */
8418 /* Speed -- ignore "non-explosions" */
8419 if (!grids) return (FALSE);
8422 /* Display the "blast area" if requested */
8423 if (!blind && !(flg & (PROJECT_HIDE)))
8425 /* Then do the "blast", from inside out */
8426 for (t = 0; t <= gm_rad; t++)
8428 /* Dump everything with this radius */
8429 for (i = gm[t]; i < gm[t+1]; i++)
8431 /* Extract the location */
8435 /* Only do visuals if the player can "see" the blast */
8436 if (panel_contains(y, x) && player_has_los_bold(y, x))
8445 /* Obtain the explosion pict */
8446 p = bolt_pict(y, x, y, x, typ);
8448 /* Extract attr/char */
8452 /* Visual effects -- Display */
8453 print_rel(c, a, y, x);
8457 /* Hack -- center the cursor */
8458 move_cursor_relative(y2, x2);
8460 /* Flush each "radius" seperately */
8461 /*if (fresh_before)*/ Term_fresh();
8463 /* Delay (efficiently) */
8464 if (visual || drawn)
8466 Term_xtra(TERM_XTRA_DELAY, msec);
8470 /* Flush the erasing */
8473 /* Erase the explosion drawn above */
8474 for (i = 0; i < grids; i++)
8476 /* Extract the location */
8480 /* Hack -- Erase if needed */
8481 if (panel_contains(y, x) && player_has_los_bold(y, x))
8487 /* Hack -- center the cursor */
8488 move_cursor_relative(y2, x2);
8490 /* Flush the explosion */
8491 /*if (fresh_before)*/ Term_fresh();
8496 /* Update stuff if needed */
8497 if (p_ptr->update) update_stuff();
8500 /* Check features */
8501 if (flg & (PROJECT_GRID))
8503 /* Start with "dist" of zero */
8506 /* Scan for features */
8507 for (i = 0; i < grids; i++)
8509 /* Hack -- Notice new "dist" values */
8510 if (gm[dist+1] == i) dist++;
8512 /* Get the grid location */
8516 /* Find the closest point in the blast */
8519 int d = dist_to_line(y, x, y1, x1, y2, x2);
8521 /* Affect the grid */
8522 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8526 /* Affect the grid */
8527 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8534 if (flg & (PROJECT_ITEM))
8536 /* Start with "dist" of zero */
8539 /* Scan for objects */
8540 for (i = 0; i < grids; i++)
8542 /* Hack -- Notice new "dist" values */
8543 if (gm[dist+1] == i) dist++;
8545 /* Get the grid location */
8549 /* Find the closest point in the blast */
8552 int d = dist_to_line(y, x, y1, x1, y2, x2);
8554 /* Affect the object in the grid */
8555 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8559 /* Affect the object in the grid */
8560 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8566 /* Check monsters */
8567 if (flg & (PROJECT_KILL))
8574 /* Start with "dist" of zero */
8577 /* Scan for monsters */
8578 for (i = 0; i < grids; i++)
8580 /* Hack -- Notice new "dist" values */
8581 if (gm[dist + 1] == i) dist++;
8583 /* Get the grid location */
8589 /* Find the closest point in the blast */
8592 int d = dist_to_line(y, x, y1, x1, y2, x2);
8594 /* Affect the monster in the grid */
8595 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8597 if (project_m(who, d+1, y, x, dam, typ,flg)) notice = TRUE;
8599 else if (project_m(who, d, y, x, dam, typ,flg)) notice = TRUE;
8603 /* Affect the monster in the grid */
8604 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8606 if (!(flg & PROJECT_BEAM))
8608 if (project_m(who, dist+1, y, x, dam, typ,flg)) notice = TRUE;
8611 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8616 monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
8618 if ((ref_ptr->flags2 & RF2_REFLECTING) && (randint(10) != 1 && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
8621 int max_attempts = 10;
8623 /* Choose 'new' target */
8626 t_y = y_saver - 1 + randint(3);
8627 t_x = x_saver - 1 + randint(3);
8631 while (max_attempts && in_bounds2u(t_y, t_x) &&
8632 !(los(y, x, t_y, t_x)));
8634 if (max_attempts < 1)
8640 if (m_list[cave[y][x].m_idx].ml)
8643 if ((m_list[cave[y][x].m_idx].r_idx == MON_KENSHIROU)
8644 || (m_list[cave[y][x].m_idx].r_idx == MON_RAOU))
8645 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
8646 if (m_list[cave[y][x].m_idx].r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
8647 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
8649 msg_print("The attack bounces!");
8652 ref_ptr->r_flags2 |= RF2_REFLECTING;
8654 flg &= ~(PROJECT_MONSTER | PROJECT_PLAYER);
8655 if (one_in_(2)) flg |= PROJECT_MONSTER;
8656 else flg |= PROJECT_PLAYER;
8658 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
8662 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_PLAYER))
8665 else if (project_m(who, dist, y, x, dam, typ,flg)) notice = TRUE;
8670 /* Player affected one monster (without "jumping") */
8671 if (!who && (project_m_n == 1) && !jump)
8677 /* Track if possible */
8678 if (cave[y][x].m_idx > 0)
8680 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8682 /* Hack -- auto-recall */
8683 if (m_ptr->ml) monster_race_track((m_ptr->mflag2 & MFLAG_KAGE), m_ptr->r_idx);
8685 /* Hack - auto-track */
8686 if (m_ptr->ml) health_track(cave[y][x].m_idx);
8693 if (flg & (PROJECT_KILL))
8695 /* Start with "dist" of zero */
8698 /* Scan for player */
8699 for (i = 0; i < grids; i++)
8701 /* Hack -- Notice new "dist" values */
8702 if (gm[dist+1] == i) dist++;
8704 /* Get the grid location */
8708 /* Find the closest point in the blast */
8711 int d = dist_to_line(y, x, y1, x1, y2, x2);
8713 /* Affect the player */
8714 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8716 if (project_p(who, d+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8718 else if (project_p(who, d, y, x, dam, typ, rad, monspell)) notice = TRUE;
8722 /* Affect the player */
8723 if ((y == y2) && (x == x2) && (y == py) && (x == px) && (flg & PROJECT_MONSTER))
8725 if (!((flg & PROJECT_BEAM) || (flg & PROJECT_STOP)))
8727 if (project_p(who, dist+1, y, x, dam, typ, rad, monspell)) notice = TRUE;
8730 else if (project_p(who, dist, y, x, dam, typ, rad, monspell)) notice = TRUE;
8739 monster_desc(m_name, &m_list[p_ptr->riding], 0);
8741 if (rakubadam_m > 0)
8743 if (rakuba(rakubadam_m, FALSE))
8746 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
8748 msg_format("%^s has thrown you off!", m_name);
8752 if (p_ptr->riding && rakubadam_p > 0)
8754 if(rakuba(rakubadam_p, FALSE))
8757 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
8759 msg_format("You have fallen from %s.", m_name);
8765 /* Return "something was noticed" */
8769 bool binding_field( int dam )
8771 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
8772 int mirror_num=0; /* ¶À¤Î¿ô */
8777 int msec= delay_factor*delay_factor*delay_factor;
8783 /* Default target of monsterspell is player */
8784 monster_target_y=py;
8785 monster_target_x=px;
8787 for( x=0 ; x < cur_wid ; x++ )
8789 for( y=0 ; y < cur_hgt ; y++ )
8791 if( cave[y][x].feat == FEAT_MIRROR &&
8792 distance(py,px,y,x) <= MAX_RANGE &&
8793 distance(py,px,y,x) != 0 &&
8794 player_has_los_bold(y,x)
8796 mirror_y[mirror_num]=y;
8797 mirror_x[mirror_num]=x;
8803 if( mirror_num < 2 )return FALSE;
8805 point_x[0] = rand_int( mirror_num );
8807 point_x[1] = rand_int( mirror_num );
8809 while( point_x[0] == point_x[1] );
8811 point_y[0]=mirror_y[point_x[0]];
8812 point_x[0]=mirror_x[point_x[0]];
8813 point_y[1]=mirror_y[point_x[1]];
8814 point_x[1]=mirror_x[point_x[1]];
8818 x=point_x[0]+point_x[1]+point_x[2];
8819 y=point_y[0]+point_y[1]+point_y[2];
8821 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
8822 - (point_y[0]*3-y)*(point_x[1]*3-x);
8823 if( centersign == 0 )return FALSE;
8825 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
8826 x1 = x1 < point_x[2] ? x1 : point_x[2];
8827 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
8828 y1 = y1 < point_y[2] ? y1 : point_y[2];
8830 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
8831 x2 = x2 > point_x[2] ? x2 : point_x[2];
8832 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
8833 y2 = y2 > point_y[2] ? y2 : point_y[2];
8835 for( y=y1 ; y <=y2 ; y++ ){
8836 for( x=x1 ; x <=x2 ; x++ ){
8837 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8838 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8839 centersign*( (point_x[1]-x)*(point_y[2]-y)
8840 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8841 centersign*( (point_x[2]-x)*(point_y[0]-y)
8842 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8844 if( player_has_los_bold(y,x)){
8845 /* Visual effects */
8847 && panel_contains(y,x)){
8848 p = bolt_pict(y,x,y,x, GF_MANA );
8849 print_rel(PICT_C(p), PICT_A(p),y,x);
8850 move_cursor_relative(y, x);
8851 /*if (fresh_before)*/ Term_fresh();
8852 Term_xtra(TERM_XTRA_DELAY, msec);
8858 for( y=y1 ; y <=y2 ; y++ ){
8859 for( x=x1 ; x <=x2 ; x++ ){
8860 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8861 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8862 centersign*( (point_x[1]-x)*(point_y[2]-y)
8863 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8864 centersign*( (point_x[2]-x)*(point_y[0]-y)
8865 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8867 if( player_has_los_bold(y,x)){
8868 (void)project_f(0,0,y,x,dam,GF_MANA);
8873 for( y=y1 ; y <=y2 ; y++ ){
8874 for( x=x1 ; x <=x2 ; x++ ){
8875 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8876 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8877 centersign*( (point_x[1]-x)*(point_y[2]-y)
8878 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8879 centersign*( (point_x[2]-x)*(point_y[0]-y)
8880 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8882 if( player_has_los_bold(y,x)){
8883 (void)project_o(0,0,y,x,dam,GF_MANA);
8888 for( y=y1 ; y <=y2 ; y++ ){
8889 for( x=x1 ; x <=x2 ; x++ ){
8890 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
8891 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
8892 centersign*( (point_x[1]-x)*(point_y[2]-y)
8893 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
8894 centersign*( (point_x[2]-x)*(point_y[0]-y)
8895 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
8897 if( player_has_los_bold(y,x) ){
8898 (void)project_m(0,0,y,x,dam,GF_MANA,
8899 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF));
8906 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
8908 msg_print("The field broke a mirror");
8910 cave_set_feat( point_y[0] , point_x[0] , FEAT_FLOOR );
8916 void seal_of_mirror( int dam )
8920 for( x = 0 ; x < cur_wid ; x++ )
8922 for( y = 0 ; y < cur_hgt ; y++ )
8924 if( cave[y][x].feat == FEAT_MIRROR )
8926 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
8927 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF)))
8929 if( !cave[y][x].m_idx )
8931 cave_set_feat( y,x, FEAT_FLOOR );