4 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies. Other copyrights may also apply.
11 /* Purpose: Spell projection */
15 /* ToDo: Make this global */
16 /* 1/x chance of reducing stats (for elemental attacks) */
17 #define HURT_CHANCE 16
20 static int rakubadam_m;
21 static int rakubadam_p;
23 int project_length = 0;
26 * Get another mirror. for SEEKER
28 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
30 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
31 int mirror_num=0; /* ¶À¤Î¿ô */
35 for( x=0 ; x < cur_wid ; x++ )
37 for( y=0 ; y < cur_hgt ; y++ )
39 if( is_mirror_grid(&cave[y][x])){
40 mirror_y[mirror_num]=y;
41 mirror_x[mirror_num]=x;
48 num=randint0(mirror_num);
49 *next_y=mirror_y[num];
50 *next_x=mirror_x[num];
53 *next_y=cury+randint0(5)-2;
54 *next_x=curx+randint0(5)-2;
59 * Get a legal "multi-hued" color for drawing "spells"
61 static byte mh_attr(int max)
63 switch (randint1(max))
65 case 1: return (TERM_RED);
66 case 2: return (TERM_GREEN);
67 case 3: return (TERM_BLUE);
68 case 4: return (TERM_YELLOW);
69 case 5: return (TERM_ORANGE);
70 case 6: return (TERM_VIOLET);
71 case 7: return (TERM_L_RED);
72 case 8: return (TERM_L_GREEN);
73 case 9: return (TERM_L_BLUE);
74 case 10: return (TERM_UMBER);
75 case 11: return (TERM_L_UMBER);
76 case 12: return (TERM_SLATE);
77 case 13: return (TERM_WHITE);
78 case 14: return (TERM_L_WHITE);
79 case 15: return (TERM_L_DARK);
87 * Return a color to use for the bolt/ball spells
89 static byte spell_color(int type)
91 /* Check if A.B.'s new graphics should be used (rr9) */
92 if (streq(ANGBAND_GRAF, "new"))
97 case GF_PSY_SPEAR: return (0x06);
98 case GF_MISSILE: return (0x0F);
99 case GF_ACID: return (0x04);
100 case GF_ELEC: return (0x02);
101 case GF_FIRE: return (0x00);
102 case GF_COLD: return (0x01);
103 case GF_POIS: return (0x03);
104 case GF_HOLY_FIRE: return (0x00);
105 case GF_HELL_FIRE: return (0x00);
106 case GF_MANA: return (0x0E);
108 case GF_SEEKER: return (0x0E);
109 case GF_SUPER_RAY: return (0x0E);
111 case GF_ARROW: return (0x0F);
112 case GF_WATER: return (0x04);
113 case GF_NETHER: return (0x07);
114 case GF_CHAOS: return (mh_attr(15));
115 case GF_DISENCHANT: return (0x05);
116 case GF_NEXUS: return (0x0C);
117 case GF_CONFUSION: return (mh_attr(4));
118 case GF_SOUND: return (0x09);
119 case GF_SHARDS: return (0x08);
120 case GF_FORCE: return (0x09);
121 case GF_INERTIA: return (0x09);
122 case GF_GRAVITY: return (0x09);
123 case GF_TIME: return (0x09);
124 case GF_LITE_WEAK: return (0x06);
125 case GF_LITE: return (0x06);
126 case GF_DARK_WEAK: return (0x07);
127 case GF_DARK: return (0x07);
128 case GF_PLASMA: return (0x0B);
129 case GF_METEOR: return (0x00);
130 case GF_ICE: return (0x01);
131 case GF_ROCKET: return (0x0F);
132 case GF_DEATH_RAY: return (0x07);
133 case GF_NUKE: return (mh_attr(2));
134 case GF_DISINTEGRATE: return (0x05);
146 case GF_CAUSE_4: return (0x0E);
147 case GF_HAND_DOOM: return (0x07);
148 case GF_CAPTURE : return (0x0E);
149 case GF_IDENTIFY: return (0x01);
150 case GF_ATTACK: return (0x0F);
151 case GF_PHOTO : return (0x06);
154 /* Normal tiles or ASCII */
160 /* Lookup the default colors for this type */
161 cptr s = quark_str(gf_color[type]);
164 if (!s) return (TERM_WHITE);
166 /* Pick a random color */
167 c = s[randint0(strlen(s))];
169 /* Lookup this color */
170 a = my_strchr(color_char, c) - color_char;
172 /* Invalid color (note check for < 0 removed, gave a silly
173 * warning because bytes are always >= 0 -- RG) */
174 if (a > 15) return (TERM_WHITE);
180 /* Standard "color" */
186 * Find the attr/char pair to use for a spell effect
188 * It is moving (or has moved) from (x,y) to (nx,ny).
190 * If the distance is not "one", we (may) return "*".
192 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
202 if ((ny == y) && (nx == x)) base = 0x30;
205 else if (nx == x) base = 0x40;
208 else if (ny == y) base = 0x50;
211 else if ((ny - y) == (x - nx)) base = 0x60;
214 else if ((ny - y) == (nx - x)) base = 0x70;
219 /* Basic spell color */
220 k = spell_color(typ);
222 /* Obtain attr/char */
223 a = misc_to_attr[base + k];
224 c = misc_to_char[base + k];
232 * Determine the path taken by a projection.
234 * The projection will always start from the grid (y1,x1), and will travel
235 * towards the grid (y2,x2), touching one grid per unit of distance along
236 * the major axis, and stopping when it enters the destination grid or a
237 * wall grid, or has travelled the maximum legal distance of "range".
239 * Note that "distance" in this function (as in the "update_view()" code)
240 * is defined as "MAX(dy,dx) + MIN(dy,dx)/2", which means that the player
241 * actually has an "octagon of projection" not a "circle of projection".
243 * The path grids are saved into the grid array pointed to by "gp", and
244 * there should be room for at least "range" grids in "gp". Note that
245 * due to the way in which distance is calculated, this function normally
246 * uses fewer than "range" grids for the projection path, so the result
247 * of this function should never be compared directly to "range". Note
248 * that the initial grid (y1,x1) is never saved into the grid array, not
249 * even if the initial grid is also the final grid. XXX XXX XXX
251 * The "flg" flags can be used to modify the behavior of this function.
253 * In particular, the "PROJECT_STOP" and "PROJECT_THRU" flags have the same
254 * semantics as they do for the "project" function, namely, that the path
255 * will stop as soon as it hits a monster, or that the path will continue
256 * through the destination grid, respectively.
258 * The "PROJECT_JUMP" flag, which for the "project()" function means to
259 * start at a special grid (which makes no sense in this function), means
260 * that the path should be "angled" slightly if needed to avoid any wall
261 * grids, allowing the player to "target" any grid which is in "view".
262 * This flag is non-trivial and has not yet been implemented, but could
263 * perhaps make use of the "vinfo" array (above). XXX XXX XXX
265 * This function returns the number of grids (if any) in the path. This
266 * function will return zero if and only if (y1,x1) and (y2,x2) are equal.
268 * This algorithm is similar to, but slightly different from, the one used
269 * by "update_view_los()", and very different from the one used by "los()".
271 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
293 /* No path necessary (or allowed) */
294 if ((x1 == x2) && (y1 == y2)) return (0);
322 /* Number of "units" in one "half" grid */
325 /* Number of "units" in one "full" grid */
331 /* Let m = ((dx/dy) * full) = (dx * dx * 2) */
342 /* Advance (X) part 2 */
345 /* Advance (X) part 3 */
352 /* Create the projection path */
356 gp[n++] = GRID(y, x);
358 /* Hack -- Check maximum range */
359 if ((n + (k >> 1)) >= range) break;
361 /* Sometimes stop at destination grid */
362 if (!(flg & (PROJECT_THRU)))
364 if ((x == x2) && (y == y2)) break;
367 if (flg & (PROJECT_DISI))
369 if ((n > 0) && cave_stop_disintegration(y, x)) break;
371 else if (flg & (PROJECT_LOS))
373 if ((n > 0) && !cave_los_bold(y, x)) break;
375 else if (!(flg & (PROJECT_PATH)))
377 /* Always stop at non-initial wall grids */
378 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
381 /* Sometimes stop at non-initial monsters/players */
382 if (flg & (PROJECT_STOP))
385 (player_bold(y, x) || cave[y][x].m_idx != 0))
389 if (!in_bounds(y, x)) break;
394 /* Advance (X) part 1 */
397 /* Horizontal change */
400 /* Advance (X) part 2 */
403 /* Advance (X) part 3 */
419 /* Let m = ((dy/dx) * full) = (dy * dy * 2) */
428 /* Vertical change */
431 /* Advance (Y) part 2 */
434 /* Advance (Y) part 3 */
441 /* Create the projection path */
445 gp[n++] = GRID(y, x);
447 /* Hack -- Check maximum range */
448 if ((n + (k >> 1)) >= range) break;
450 /* Sometimes stop at destination grid */
451 if (!(flg & (PROJECT_THRU)))
453 if ((x == x2) && (y == y2)) break;
456 if (flg & (PROJECT_DISI))
458 if ((n > 0) && cave_stop_disintegration(y, x)) break;
460 else if (flg & (PROJECT_LOS))
462 if ((n > 0) && !cave_los_bold(y, x)) break;
464 else if (!(flg & (PROJECT_PATH)))
466 /* Always stop at non-initial wall grids */
467 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
470 /* Sometimes stop at non-initial monsters/players */
471 if (flg & (PROJECT_STOP))
474 (player_bold(y, x) || cave[y][x].m_idx != 0))
478 if (!in_bounds(y, x)) break;
483 /* Advance (Y) part 1 */
486 /* Vertical change */
489 /* Advance (Y) part 2 */
492 /* Advance (Y) part 3 */
512 /* Create the projection path */
516 gp[n++] = GRID(y, x);
518 /* Hack -- Check maximum range */
519 if ((n + (n >> 1)) >= range) break;
521 /* Sometimes stop at destination grid */
522 if (!(flg & (PROJECT_THRU)))
524 if ((x == x2) && (y == y2)) break;
527 if (flg & (PROJECT_DISI))
529 if ((n > 0) && cave_stop_disintegration(y, x)) break;
531 else if (flg & (PROJECT_LOS))
533 if ((n > 0) && !cave_los_bold(y, x)) break;
535 else if (!(flg & (PROJECT_PATH)))
537 /* Always stop at non-initial wall grids */
538 if ((n > 0) && !cave_have_flag_bold(y, x, FF_PROJECT)) break;
541 /* Sometimes stop at non-initial monsters/players */
542 if (flg & (PROJECT_STOP))
545 (player_bold(y, x) || cave[y][x].m_idx != 0))
549 if (!in_bounds(y, x)) break;
566 * Mega-Hack -- track "affected" monsters (see "project()" comments)
568 static int project_m_n;
569 static int project_m_x;
570 static int project_m_y;
571 /* Mega-Hack -- monsters target */
572 static s16b monster_target_x;
573 static s16b monster_target_y;
577 * We are called from "project()" to "damage" terrain features
579 * We are called both for "beam" effects and "ball" effects.
581 * The "r" parameter is the "distance from ground zero".
583 * Note that we determine if the player can "see" anything that happens
584 * by taking into account: blindness, line-of-sight, and illumination.
586 * We return "TRUE" if the effect of the projection is "obvious".
588 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
590 * XXX XXX XXX Perhaps we should affect doors?
592 static bool project_f(int who, int r, int y, int x, int dam, int typ)
594 cave_type *c_ptr = &cave[y][x];
595 feature_type *f_ptr = &f_info[c_ptr->feat];
597 bool obvious = FALSE;
598 bool known = player_has_los_bold(y, x);
604 /* Reduce damage by distance */
605 dam = (dam + r) / (r + 1);
608 if (have_flag(f_ptr->flags, FF_TREE))
617 message = "¸Ï¤ì¤¿";break;
619 message = "was blasted.";break;
623 message = "½Ì¤ó¤À";break;
625 message = "shrank.";break;
629 message = "ÍϤ±¤¿";break;
631 message = "melted.";break;
636 message = "Åà¤ê¡¢ºÕ¤±»¶¤Ã¤¿";break;
638 message = "was frozen and smashed.";break;
644 message = "dz¤¨¤¿";break;
646 message = "burns up!";break;
660 message = "Ê´ºÕ¤µ¤ì¤¿";break;
662 message = "was crushed.";break;
665 message = NULL;break;
670 msg_format("ÌÚ¤Ï%s¡£", message);
672 msg_format("A tree %s", message);
674 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
677 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
681 /* Analyze the type */
684 /* Ignore most effects */
719 /* Destroy Traps (and Locks) */
722 /* Reveal secret doors */
723 if (is_hidden_door(c_ptr))
728 /* Check line of sight */
736 if (is_trap(c_ptr->feat))
738 /* Check line of sight */
742 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
744 msg_print("There is a bright flash of light!");
750 /* Destroy the trap */
751 cave_alter_feat(y, x, FF_DISARM);
754 /* Locked doors are unlocked */
755 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
757 s16b old_feat = c_ptr->feat;
759 /* Unlock the door */
760 cave_alter_feat(y, x, FF_DISARM);
762 /* Check line of sound */
763 if (known && (old_feat != c_ptr->feat))
766 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
775 /* Remove "unsafe" flag if player is not blind */
776 if (!p_ptr->blind && player_has_los_bold(y, x))
778 c_ptr->info &= ~(CAVE_UNSAFE);
789 /* Destroy Doors (and traps) */
792 /* Destroy all doors and traps */
793 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
795 /* Check line of sight */
800 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
802 msg_print("There is a bright flash of light!");
808 /* Destroy the feature */
809 cave_alter_feat(y, x, FF_TUNNEL);
812 /* Remove "unsafe" flag if player is not blind */
813 if (!p_ptr->blind && player_has_los_bold(y, x))
815 c_ptr->info &= ~(CAVE_UNSAFE);
826 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
828 if (have_flag(f_ptr->flags, FF_SPIKE))
830 s16b old_mimic = c_ptr->mimic;
831 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
833 cave_alter_feat(y, x, FF_SPIKE);
835 c_ptr->mimic = old_mimic;
843 /* Check line of sight */
844 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
848 msg_format("%s¤Ë²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ³«¤«¤Ê¤¯¤Ê¤Ã¤¿¡£", f_name + mimic_f_ptr->name);
850 msg_format("The %s seems stuck.", f_name + mimic_f_ptr->name);
859 /* Destroy walls (and doors) */
862 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
865 if (known && (c_ptr->info & (CAVE_MARK)))
868 msg_format("%s¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
870 msg_format("The %s turns into mud!", f_name + f_info[get_feat_mimic(c_ptr)].name);
876 /* Destroy the wall */
877 cave_alter_feat(y, x, FF_HURT_ROCK);
879 /* Update some things */
880 p_ptr->update |= (PU_FLOW);
889 /* Require a "naked" floor grid */
890 if (!cave_naked_bold(y, x)) break;
892 /* Not on the player */
893 if (player_bold(y, x)) break;
895 /* Create a closed door */
896 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
899 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
916 /* Require a "naked" floor grid */
917 if (!cave_naked_bold(y, x)) break;
919 /* Not on the player */
920 if (player_bold(y, x)) break;
922 /* Create a closed door */
923 cave_set_feat(y, x, feat_tree);
926 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
934 /* Require a "naked" floor grid */
935 if (!cave_naked_bold(y, x)) break;
938 c_ptr->info |= CAVE_OBJECT;
939 c_ptr->mimic = feat_glyph;
952 /* Require a "naked" floor grid */
953 if (!cave_naked_bold(y, x)) break;
955 /* Not on the player */
956 if (player_bold(y, x)) break;
959 cave_set_feat(y, x, feat_granite);
967 /* Ignore permanent grid */
968 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
973 /* Ignore grid without enough space */
974 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
976 /* Place a shallow lava */
977 cave_set_feat(y, x, feat_shallow_lava);
982 /* Place a deep lava */
983 cave_set_feat(y, x, feat_deep_lava);
990 /* Ignore permanent grid */
991 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
996 /* Ignore grid without enough space */
997 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
999 /* Place a shallow water */
1000 cave_set_feat(y, x, feat_shallow_water);
1005 /* Place a deep water */
1006 cave_set_feat(y, x, feat_deep_water);
1011 /* Lite up the grid */
1015 /* Turn on the light */
1016 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1018 c_ptr->info |= (CAVE_GLOW);
1026 update_local_illumination(y, x);
1029 if (player_can_see_bold(y, x)) obvious = TRUE;
1031 /* Mega-Hack -- Update the monster in the affected grid */
1032 /* This allows "spear of light" (etc) to work "correctly" */
1033 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1035 if (p_ptr->special_defense & NINJA_S_STEALTH)
1037 if (player_bold(y, x)) set_superstealth(FALSE);
1044 /* Darken the grid */
1048 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1051 /* Turn off the light. */
1054 if (dun_level || !is_daytime())
1056 for (j = 0; j < 9; j++)
1058 int by = y + ddy_ddd[j];
1059 int bx = x + ddx_ddd[j];
1061 if (in_bounds2(by, bx))
1063 cave_type *cc_ptr = &cave[by][bx];
1065 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1073 if (!do_dark) break;
1076 c_ptr->info &= ~(CAVE_GLOW);
1078 /* Hack -- Forget "boring" grids */
1079 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1082 c_ptr->info &= ~(CAVE_MARK);
1091 update_local_illumination(y, x);
1094 if (player_can_see_bold(y, x)) obvious = TRUE;
1096 /* Mega-Hack -- Update the monster in the affected grid */
1097 /* This allows "spear of light" (etc) to work "correctly" */
1098 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1108 if (is_mirror_grid(c_ptr))
1111 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1113 msg_print("The mirror was crashed!");
1116 remove_mirror(y, x);
1117 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1120 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
1123 if (known && (c_ptr->info & CAVE_MARK))
1126 msg_format("%s¤¬³ä¤ì¤¿¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
1128 msg_format("The %s was crashed!", f_name + f_info[get_feat_mimic(c_ptr)].name);
1133 /* Destroy the wall */
1134 cave_alter_feat(y, x, FF_HURT_ROCK);
1136 /* Update some things */
1137 p_ptr->update |= (PU_FLOW);
1144 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1147 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1149 msg_print("The mirror was crashed!");
1152 remove_mirror(y, x);
1153 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1156 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
1159 if (known && (c_ptr->info & CAVE_MARK))
1162 msg_format("%s¤¬³ä¤ì¤¿¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
1164 msg_format("The %s was crashed!", f_name + f_info[get_feat_mimic(c_ptr)].name);
1169 /* Destroy the wall */
1170 cave_alter_feat(y, x, FF_HURT_ROCK);
1172 /* Update some things */
1173 p_ptr->update |= (PU_FLOW);
1178 case GF_DISINTEGRATE:
1180 /* Destroy mirror/glyph */
1181 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
1182 remove_mirror(y, x);
1184 /* Permanent features don't get effect */
1185 /* But not protect monsters and other objects */
1186 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1188 cave_alter_feat(y, x, FF_HURT_DISI);
1190 /* Update some things -- similar to GF_KILL_WALL */
1191 p_ptr->update |= (PU_FLOW);
1198 /* Return "Anything seen?" */
1205 * We are called from "project()" to "damage" objects
1207 * We are called both for "beam" effects and "ball" effects.
1209 * Perhaps we should only SOMETIMES damage things on the ground.
1211 * The "r" parameter is the "distance from ground zero".
1213 * Note that we determine if the player can "see" anything that happens
1214 * by taking into account: blindness, line-of-sight, and illumination.
1216 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1218 * We return "TRUE" if the effect of the projection is "obvious".
1220 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1222 cave_type *c_ptr = &cave[y][x];
1224 s16b this_o_idx, next_o_idx = 0;
1226 bool obvious = FALSE;
1227 bool known = player_has_los_bold(y, x);
1229 u32b flgs[TR_FLAG_SIZE];
1231 char o_name[MAX_NLEN];
1234 bool is_potion = FALSE;
1238 who = who ? who : 0;
1240 /* Reduce damage by distance */
1241 dam = (dam + r) / (r + 1);
1244 /* Scan all objects in the grid */
1245 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1247 /* Acquire object */
1248 object_type *o_ptr = &o_list[this_o_idx];
1250 bool is_art = FALSE;
1251 bool ignore = FALSE;
1252 bool do_kill = FALSE;
1254 cptr note_kill = NULL;
1257 /* Get the "plural"-ness */
1258 bool plural = (o_ptr->number > 1);
1261 /* Acquire next object */
1262 next_o_idx = o_ptr->next_o_idx;
1264 /* Extract the flags */
1265 object_flags(o_ptr, flgs);
1267 /* Check for artifact */
1268 if (object_is_artifact(o_ptr)) is_art = TRUE;
1270 /* Analyze the type */
1273 /* Acid -- Lots of things */
1276 if (hates_acid(o_ptr))
1280 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1282 note_kill = (plural ? " melt!" : " melts!");
1285 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1290 /* Elec -- Rings and Wands */
1293 if (hates_elec(o_ptr))
1297 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1299 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1302 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1307 /* Fire -- Flammable objects */
1310 if (hates_fire(o_ptr))
1314 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1316 note_kill = (plural ? " burn up!" : " burns up!");
1319 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1324 /* Cold -- potions and flasks */
1327 if (hates_cold(o_ptr))
1330 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1332 note_kill = (plural ? " shatter!" : " shatters!");
1336 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1344 if (hates_fire(o_ptr))
1348 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1350 note_kill = (plural ? " burn up!" : " burns up!");
1353 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1355 if (hates_elec(o_ptr))
1360 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1362 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1365 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1373 if (hates_fire(o_ptr))
1377 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1379 note_kill = (plural ? " burn up!" : " burns up!");
1382 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1384 if (hates_cold(o_ptr))
1389 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1391 note_kill = (plural ? " shatter!" : " shatters!");
1394 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1399 /* Hack -- break potions and such */
1405 if (hates_cold(o_ptr))
1408 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1410 note_kill = (plural ? " shatter!" : " shatters!");
1418 /* Mana and Chaos -- destroy everything */
1425 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1427 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1433 case GF_DISINTEGRATE:
1437 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1439 note_kill = (plural ? " evaporate!" : " evaporates!");
1449 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1451 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1454 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1455 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1459 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1463 if (object_is_cursed(o_ptr))
1467 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1469 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1478 identify_item(o_ptr);
1480 /* Auto-inscription */
1481 autopick_alter_item((-this_o_idx), FALSE);
1489 /* Chests are noticed only if trapped or locked */
1490 if (o_ptr->tval == TV_CHEST)
1492 /* Disarm/Unlock traps */
1493 if (o_ptr->pval > 0)
1495 /* Disarm or Unlock */
1496 o_ptr->pval = (0 - o_ptr->pval);
1499 object_known(o_ptr);
1502 if (known && (o_ptr->marked & OM_FOUND))
1505 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1507 msg_print("Click!");
1519 if (o_ptr->tval == TV_CORPSE)
1524 if (!who || is_pet(&m_list[who]))
1525 mode |= PM_FORCE_PET;
1527 for (i = 0; i < o_ptr->number ; i++)
1529 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1530 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1535 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1537 note_kill = (plural ? " become dust." : " becomes dust.");
1542 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1545 note_kill = "À¸¤Ê֤ä¿¡£";
1547 note_kill = " revived.";
1550 else if (!note_kill)
1553 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1555 note_kill = (plural ? " become dust." : " becomes dust.");
1567 /* Attempt to destroy the object */
1570 /* Effect "observed" */
1571 if (known && (o_ptr->marked & OM_FOUND))
1574 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1577 /* Artifacts, and other objects, get to resist */
1578 if (is_art || ignore)
1580 /* Observe the resist */
1581 if (known && (o_ptr->marked & OM_FOUND))
1584 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1587 msg_format("The %s %s unaffected!",
1588 o_name, (plural ? "are" : "is"));
1597 /* Describe if needed */
1598 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1601 msg_format("%s¤Ï%s", o_name, note_kill);
1603 msg_format("The %s%s", o_name, note_kill);
1608 k_idx = o_ptr->k_idx;
1609 is_potion = object_is_potion(o_ptr);
1612 /* Delete the object */
1613 delete_object_idx(this_o_idx);
1615 /* Potions produce effects when 'shattered' */
1618 (void)potion_smash_effect(who, y, x, k_idx);
1627 /* Return "Anything seen?" */
1633 * Helper function for "project()" below.
1635 * Handle a beam/bolt/ball causing damage to a monster.
1637 * This routine takes a "source monster" (by index) which is mostly used to
1638 * determine if the player is causing the damage, and a "radius" (see below),
1639 * which is used to decrease the power of explosions with distance, and a
1640 * location, via integers which are modified by certain types of attacks
1641 * (polymorph and teleport being the obvious ones), a default damage, which
1642 * is modified as needed based on various properties, and finally a "damage
1643 * type" (see below).
1645 * Note that this routine can handle "no damage" attacks (like teleport) by
1646 * taking a "zero" damage, and can even take "parameters" to attacks (like
1647 * confuse) by accepting a "damage", using it to calculate the effect, and
1648 * then setting the damage to zero. Note that the "damage" parameter is
1649 * divided by the radius, so monsters not at the "epicenter" will not take
1650 * as much damage (or whatever)...
1652 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1653 * may result in a dereference of an invalid pointer. XXX XXX XXX
1655 * Various messages are produced, and damage is applied.
1657 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1658 * actually be "made" of that substance, or "breathe" big balls of it.
1660 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1663 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1664 * and hurts evil less. If can breath nether, then it resists it as well.
1666 * Damage reductions use the following formulas:
1667 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1668 * gives avg damage of .655, ranging from .858 to .500
1669 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1670 * gives avg damage of .544, ranging from .714 to .417
1671 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1672 * gives avg damage of .444, ranging from .556 to .333
1673 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1674 * gives avg damage of .327, ranging from .427 to .250
1675 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1676 * gives something simple.
1678 * In this function, "result" messages are postponed until the end, where
1679 * the "note" string is appended to the monster name, if not NULL. So,
1680 * to make a spell have "no effect" just set "note" to NULL. You should
1681 * also set "notice" to FALSE, or the player will learn what the spell does.
1683 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1685 /* "flg" was added. */
1686 static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
1690 cave_type *c_ptr = &cave[y][x];
1692 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1693 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1695 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1699 /* Is the monster "seen"? */
1700 bool seen = m_ptr->ml;
1701 bool seen_msg = is_seen(m_ptr);
1703 bool slept = (bool)MON_CSLEEP(m_ptr);
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 /* Were the effects "irrelevant"? */
1712 bool skipped = FALSE;
1714 /* Gets the monster angry at the source of the effect? */
1715 bool get_angry = FALSE;
1717 /* Polymorph setting (true or false) */
1718 bool do_poly = FALSE;
1720 /* Teleport setting (max distance) */
1723 /* Confusion setting (amount to confuse) */
1726 /* Stunning setting (amount to stun) */
1729 /* Sleep amount (amount to sleep) */
1732 /* Fear amount (amount to fear) */
1735 /* Time amount (amount to time) */
1738 bool heal_leper = FALSE;
1740 /* Hold the monster name */
1749 /* Assume no note */
1752 /* Assume a default death */
1753 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1758 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1761 if (!c_ptr->m_idx) return (FALSE);
1763 /* Never affect projector */
1764 if (who && (c_ptr->m_idx == who)) return (FALSE);
1765 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1766 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1768 /* Don't affect already death monsters */
1769 /* Prevents problems with chain reactions of exploding monsters */
1770 if (m_ptr->hp < 0) return (FALSE);
1772 /* Reduce damage by distance */
1773 dam = (dam + r) / (r + 1);
1776 /* Get the monster name (BEFORE polymorphing) */
1777 monster_desc(m_name, m_ptr, 0);
1780 /* Get the monster possessive ("his"/"her"/"its") */
1781 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1785 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1787 /* Analyze the damage type */
1790 /* Magic Missile -- pure damage */
1793 if (seen) obvious = TRUE;
1795 if (r_ptr->flagsr & RFR_RES_ALL)
1798 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1800 note = " is immune.";
1803 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1812 if (seen) obvious = TRUE;
1814 if (r_ptr->flagsr & RFR_RES_ALL)
1817 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1819 note = " is immune.";
1822 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1825 if (r_ptr->flagsr & RFR_IM_ACID)
1828 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1830 note = " resists a lot.";
1834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1842 if (seen) obvious = TRUE;
1844 if (r_ptr->flagsr & RFR_RES_ALL)
1847 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1849 note = " is immune.";
1852 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1855 if (r_ptr->flagsr & RFR_IM_ELEC)
1858 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1860 note = " resists a lot.";
1864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1872 if (seen) obvious = TRUE;
1874 if (r_ptr->flagsr & RFR_RES_ALL)
1877 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1879 note = " is immune.";
1882 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1885 if (r_ptr->flagsr & RFR_IM_FIRE)
1888 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1890 note = " resists a lot.";
1894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1896 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1899 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1901 note = " is hit hard.";
1905 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1913 if (seen) obvious = TRUE;
1915 if (r_ptr->flagsr & RFR_RES_ALL)
1918 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1920 note = " is immune.";
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1926 if (r_ptr->flagsr & RFR_IM_COLD)
1929 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1931 note = " resists a lot.";
1935 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1937 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1940 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1942 note = " is hit hard.";
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1954 if (seen) obvious = TRUE;
1956 if (r_ptr->flagsr & RFR_RES_ALL)
1959 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1961 note = " is immune.";
1964 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1967 if (r_ptr->flagsr & RFR_IM_POIS)
1970 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1972 note = " resists a lot.";
1976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1984 if (seen) obvious = TRUE;
1986 if (r_ptr->flagsr & RFR_RES_ALL)
1989 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1991 note = " is immune.";
1994 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1997 if (r_ptr->flagsr & RFR_IM_POIS)
2000 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2005 dam *= 3; dam /= randint1(6) + 6;
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
2008 else if (one_in_(3)) do_poly = TRUE;
2012 /* Hellfire -- hurts Evil */
2015 if (seen) obvious = TRUE;
2017 if (r_ptr->flagsr & RFR_RES_ALL)
2020 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2022 note = " is immune.";
2025 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2028 if (r_ptr->flags3 & RF3_GOOD)
2032 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2034 note = " is hit hard.";
2037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2042 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2045 if (seen) obvious = TRUE;
2047 if (r_ptr->flagsr & RFR_RES_ALL)
2050 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2052 note = " is immune.";
2055 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2058 if (r_ptr->flags3 & RF3_GOOD)
2062 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2064 note = " is immune.";
2067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2069 else if (r_ptr->flags3 & RF3_EVIL)
2073 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2075 note = " is hit hard.";
2078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2083 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2088 dam *= 3; dam /= randint1(6) + 6;
2093 /* Arrow -- XXX no defense */
2096 if (seen) obvious = TRUE;
2098 if (r_ptr->flagsr & RFR_RES_ALL)
2101 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2103 note = " is immune.";
2106 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2112 /* Plasma -- XXX perhaps check ELEC or FIRE */
2115 if (seen) obvious = TRUE;
2117 if (r_ptr->flagsr & RFR_RES_ALL)
2120 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2122 note = " is immune.";
2125 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2128 if (r_ptr->flagsr & RFR_RES_PLAS)
2131 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2136 dam *= 3; dam /= randint1(6) + 6;
2137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2142 /* Nether -- see above */
2145 if (seen) obvious = TRUE;
2147 if (r_ptr->flagsr & RFR_RES_ALL)
2150 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2152 note = " is immune.";
2155 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2158 if (r_ptr->flagsr & RFR_RES_NETH)
2160 if (r_ptr->flags3 & RF3_UNDEAD)
2163 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2165 note = " is immune.";
2169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2174 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2179 dam *= 3; dam /= randint1(6) + 6;
2181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2183 else if (r_ptr->flags3 & RF3_EVIL)
2187 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2189 note = " resists somewhat.";
2192 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2197 /* Water (acid) damage -- Water spirits/elementals are immune */
2200 if (seen) obvious = TRUE;
2202 if (r_ptr->flagsr & RFR_RES_ALL)
2205 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2207 note = " is immune.";
2210 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2213 if (r_ptr->flagsr & RFR_RES_WATE)
2215 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2218 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2220 note = " is immune.";
2228 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2233 dam *= 3; dam /= randint1(6) + 6;
2235 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2240 /* Chaos -- Chaos breathers resist */
2243 if (seen) obvious = TRUE;
2245 if (r_ptr->flagsr & RFR_RES_ALL)
2248 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2250 note = " is immune.";
2253 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2256 if (r_ptr->flagsr & RFR_RES_CHAO)
2259 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2264 dam *= 3; dam /= randint1(6) + 6;
2265 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2267 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2270 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2272 note = " resists somewhat.";
2275 dam *= 3; dam /= randint1(6) + 6;
2276 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2281 do_conf = (5 + randint1(11) + r) / (r + 1);
2286 /* Shards -- Shard breathers resist */
2289 if (seen) obvious = TRUE;
2291 if (r_ptr->flagsr & RFR_RES_ALL)
2294 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2296 note = " is immune.";
2299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2302 if (r_ptr->flagsr & RFR_RES_SHAR)
2305 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2310 dam *= 3; dam /= randint1(6) + 6;
2311 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2316 /* Rocket: Shard resistance helps */
2319 if (seen) obvious = TRUE;
2321 if (r_ptr->flagsr & RFR_RES_ALL)
2324 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2326 note = " is immune.";
2329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2332 if (r_ptr->flagsr & RFR_RES_SHAR)
2335 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2337 note = " resists somewhat.";
2341 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2347 /* Sound -- Sound breathers resist */
2350 if (seen) obvious = TRUE;
2352 if (r_ptr->flagsr & RFR_RES_ALL)
2355 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2357 note = " is immune.";
2360 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2363 if (r_ptr->flagsr & RFR_RES_SOUN)
2366 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2371 dam *= 2; dam /= randint1(6) + 6;
2372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2374 else do_stun = (10 + randint1(15) + r) / (r + 1);
2381 if (seen) obvious = TRUE;
2383 if (r_ptr->flagsr & RFR_RES_ALL)
2386 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2388 note = " is immune.";
2391 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2394 if (r_ptr->flags3 & RF3_NO_CONF)
2397 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2402 dam *= 3; dam /= randint1(6) + 6;
2403 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2405 else do_conf = (10 + randint1(15) + r) / (r + 1);
2409 /* Disenchantment -- Breathers and Disenchanters resist */
2412 if (seen) obvious = TRUE;
2414 if (r_ptr->flagsr & RFR_RES_ALL)
2417 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2419 note = " is immune.";
2422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2425 if (r_ptr->flagsr & RFR_RES_DISE)
2428 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2433 dam *= 3; dam /= randint1(6) + 6;
2434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2439 /* Nexus -- Breathers and Existers resist */
2442 if (seen) obvious = TRUE;
2444 if (r_ptr->flagsr & RFR_RES_ALL)
2447 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2449 note = " is immune.";
2452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2455 if (r_ptr->flagsr & RFR_RES_NEXU)
2458 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2463 dam *= 3; dam /= randint1(6) + 6;
2464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2472 if (seen) obvious = TRUE;
2474 if (r_ptr->flagsr & RFR_RES_ALL)
2477 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2479 note = " is immune.";
2482 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2485 if (r_ptr->flagsr & RFR_RES_WALL)
2488 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2493 dam *= 3; dam /= randint1(6) + 6;
2494 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2496 else do_stun = (randint1(15) + r) / (r + 1);
2500 /* Inertia -- breathers resist */
2503 if (seen) obvious = TRUE;
2505 if (r_ptr->flagsr & RFR_RES_ALL)
2508 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2510 note = " is immune.";
2513 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2516 if (r_ptr->flagsr & RFR_RES_INER)
2519 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2524 dam *= 3; dam /= randint1(6) + 6;
2525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2529 /* Powerful monsters can resist */
2530 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2531 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2535 /* Normal monsters slow down */
2538 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2541 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2543 note = " starts moving slower.";
2551 /* Time -- breathers resist */
2554 if (seen) obvious = TRUE;
2556 if (r_ptr->flagsr & RFR_RES_ALL)
2559 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2561 note = " is immune.";
2564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2567 if (r_ptr->flagsr & RFR_RES_TIME)
2570 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2575 dam *= 3; dam /= randint1(6) + 6;
2576 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2578 else do_time = (dam + 1) / 2;
2582 /* Gravity -- breathers resist */
2585 bool resist_tele = FALSE;
2587 if (seen) obvious = TRUE;
2589 if (r_ptr->flagsr & RFR_RES_ALL)
2592 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2594 note = " is immune.";
2597 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2600 if (r_ptr->flagsr & RFR_RES_TELE)
2602 if (r_ptr->flags1 & (RF1_UNIQUE))
2604 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2606 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2608 note = " is unaffected!";
2613 else if (r_ptr->level > randint1(100))
2615 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2617 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2626 if (!resist_tele) do_dist = 10;
2628 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2630 if (r_ptr->flagsr & RFR_RES_GRAV)
2633 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2638 dam *= 3; dam /= randint1(6) + 6;
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2645 /* Powerful monsters can resist */
2646 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2647 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2651 /* Normal monsters slow down */
2654 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2657 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2659 note = " starts moving slower.";
2665 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2667 /* Attempt a saving throw */
2668 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2669 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2673 /* No obvious effect */
2675 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2677 note = " is unaffected!";
2691 if (seen) obvious = TRUE;
2693 if (r_ptr->flagsr & RFR_RES_ALL)
2696 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2698 note = " is immune.";
2701 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2709 case GF_DISINTEGRATE:
2711 if (seen) obvious = TRUE;
2713 if (r_ptr->flagsr & RFR_RES_ALL)
2716 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2718 note = " is immune.";
2721 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2724 if (r_ptr->flags3 & RF3_HURT_ROCK)
2726 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2728 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2729 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2731 note = " loses some skin!";
2732 note_dies = " evaporates!";
2742 if (seen) obvious = TRUE;
2744 /* PSI only works if the monster can see you! -- RG */
2745 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2748 if (seen_msg) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2750 if (seen_msg) msg_format("%^s can't see you, and isn't affected!", m_name);
2756 if (r_ptr->flagsr & RFR_RES_ALL)
2759 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2761 note = " is immune.";
2764 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2767 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2771 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2773 note = " is immune!";
2775 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2778 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2779 (r_ptr->flags3 & RF3_ANIMAL) ||
2780 (r_ptr->level > randint1(3 * dam)))
2784 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2791 * Powerful demons & undead can turn a mindcrafter's
2792 * attacks back on them
2794 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2795 (r_ptr->level > p_ptr->lev / 2) &&
2800 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2802 msg_format("%^s%s corrupted mind backlashes your attack!",
2803 m_name, (seen ? "'s" : "s"));
2807 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2810 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2812 msg_print("You resist the effects!");
2818 /* Injure +/- confusion */
2819 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2820 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2821 if (one_in_(4) && !CHECK_MULTISHADOW())
2823 switch (randint1(4))
2826 set_confused(p_ptr->confused + 3 + randint1(dam));
2829 set_stun(p_ptr->stun + randint1(dam));
2833 if (r_ptr->flags3 & RF3_NO_FEAR)
2835 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2837 note = " is unaffected.";
2841 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2845 if (!p_ptr->free_act)
2846 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2855 if ((dam > 0) && one_in_(4))
2857 switch (randint1(4))
2860 do_conf = 3 + randint1(dam);
2863 do_stun = 3 + randint1(dam);
2866 do_fear = 3 + randint1(dam);
2870 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2872 note = " falls asleep!";
2875 do_sleep = 3 + randint1(dam);
2881 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2883 note_dies = " collapses, a mindless husk.";
2891 if (seen) obvious = TRUE;
2893 if (r_ptr->flagsr & RFR_RES_ALL)
2896 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2898 note = " is immune.";
2901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2904 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2908 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2910 note = " is immune!";
2914 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2915 (r_ptr->flags3 & RF3_ANIMAL) ||
2916 (r_ptr->level > randint1(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 | RF3_DEMON)) &&
2931 (r_ptr->level > p_ptr->lev / 2) &&
2936 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2938 msg_format("%^s%s corrupted mind backlashes your attack!",
2939 m_name, (seen ? "'s" : "s"));
2943 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2946 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2948 msg_print("You resist the effects!");
2953 /* Injure + mana drain */
2954 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2955 if (!CHECK_MULTISHADOW())
2958 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2960 msg_print("Your psychic energy is drained!");
2963 p_ptr->csp -= damroll(5, dam) / 2;
2964 if (p_ptr->csp < 0) p_ptr->csp = 0;
2965 p_ptr->redraw |= PR_MANA;
2966 p_ptr->window |= (PW_SPELL);
2968 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2975 int b = damroll(5, dam) / 4;
2977 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? "ĶǽÎϥѥ" : "ËâÎÏ";
2978 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤò%s¤ËÊÑ´¹¤·¤¿¡ª", m_name, str);
2980 cptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? "psychic energy" : "mana";
2981 msg_format("You convert %s%s pain into %s!",
2982 m_name, (seen ? "'s" : "s"), str);
2985 b = MIN(p_ptr->msp, p_ptr->csp + b);
2987 p_ptr->redraw |= PR_MANA;
2988 p_ptr->window |= (PW_SPELL);
2992 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2994 note_dies = " collapses, a mindless husk.";
3000 case GF_TELEKINESIS:
3002 if (seen) obvious = TRUE;
3004 if (r_ptr->flagsr & RFR_RES_ALL)
3007 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3009 note = " is immune.";
3012 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3017 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3022 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3024 /* Attempt a saving throw */
3025 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3026 (r_ptr->level > 5 + randint1(dam)))
3030 /* No obvious effect */
3036 /* Psycho-spear -- powerful magic missile */
3039 if (seen) obvious = TRUE;
3041 if (r_ptr->flagsr & RFR_RES_ALL)
3044 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3046 note = " is immune.";
3049 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3055 /* Meteor -- powerful magic missile */
3058 if (seen) obvious = TRUE;
3060 if (r_ptr->flagsr & RFR_RES_ALL)
3063 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3065 note = " is immune.";
3068 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3076 if (!is_hostile(m_ptr)) break;
3078 if (seen) obvious = TRUE;
3080 if (r_ptr->flagsr & RFR_RES_ALL)
3083 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3085 note = " is immune.";
3088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3091 /* Attempt a saving throw */
3092 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3093 (r_ptr->flags3 & RF3_NO_CONF) ||
3094 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3096 /* Memorize a flag */
3097 if (r_ptr->flags3 & RF3_NO_CONF)
3099 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3106 * Powerful demons & undead can turn a mindcrafter's
3107 * attacks back on them
3109 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3110 (r_ptr->level > p_ptr->lev / 2) &&
3115 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3117 msg_format("%^s%s corrupted mind backlashes your attack!",
3118 m_name, (seen ? "'s" : "s"));
3122 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3125 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3127 msg_print("You resist the effects!");
3133 /* Confuse, stun, terrify */
3134 switch (randint1(4))
3137 set_stun(p_ptr->stun + dam / 2);
3140 set_confused(p_ptr->confused + dam / 2);
3144 if (r_ptr->flags3 & RF3_NO_FEAR)
3146 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3148 note = " is unaffected.";
3152 set_afraid(p_ptr->afraid + dam);
3159 /* No obvious effect */
3161 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3163 note = " is unaffected!";
3171 if ((dam > 29) && (randint1(100) < dam))
3174 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3176 note = " is in your thrall!";
3183 switch (randint1(4))
3197 /* No "real" damage */
3204 /* Ice -- Cold + Cuts + Stun */
3207 if (seen) obvious = TRUE;
3209 if (r_ptr->flagsr & RFR_RES_ALL)
3212 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3214 note = " is immune.";
3217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3220 do_stun = (randint1(15) + 1) / (r + 1);
3221 if (r_ptr->flagsr & RFR_IM_COLD)
3224 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3226 note = " resists a lot.";
3230 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3232 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3235 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3237 note = " is hit hard.";
3241 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3250 if (seen) obvious = TRUE;
3252 if (r_ptr->flagsr & RFR_RES_ALL)
3255 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3257 note = " is immune.";
3260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3263 if (!monster_living(r_ptr))
3265 if (is_original_ap_and_seen(m_ptr))
3267 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3268 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3269 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3273 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3275 note = " is unaffected!";
3281 else do_time = (dam+7)/8;
3289 if (seen) obvious = TRUE;
3291 if (r_ptr->flagsr & RFR_RES_ALL)
3294 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3296 note = " is immune.";
3299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3302 if (!monster_living(r_ptr))
3304 if (is_original_ap_and_seen(m_ptr))
3306 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3307 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3308 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3312 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3314 note = " is immune.";
3320 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3321 (randint1(888) != 666)) ||
3322 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3323 randint1(100) != 66))
3326 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3338 /* Polymorph monster (Use "dam" as "power") */
3341 if (seen) obvious = TRUE;
3343 if (r_ptr->flagsr & RFR_RES_ALL)
3346 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3348 note = " is immune.";
3351 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3354 /* Attempt to polymorph (see below) */
3357 /* Powerful monsters can resist */
3358 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3359 (r_ptr->flags1 & RF1_QUESTOR) ||
3360 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3363 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3365 note = " is unaffected!";
3372 /* No "real" damage */
3379 /* Clone monsters (Ignore "dam") */
3382 if (seen) obvious = TRUE;
3384 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3387 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3389 note = " is unaffected!";
3395 m_ptr->hp = m_ptr->maxhp;
3397 /* Attempt to clone. */
3398 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3401 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3409 /* No "real" damage */
3416 /* Heal Monster (use "dam" as amount of healing) */
3419 if (seen) obvious = TRUE;
3422 (void)set_monster_csleep(c_ptr->m_idx, 0);
3424 if (m_ptr->maxhp < m_ptr->max_maxhp)
3427 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3429 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3431 m_ptr->maxhp = m_ptr->max_maxhp;
3436 /* Redraw (later) if needed */
3437 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3438 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3446 if (seen) obvious = TRUE;
3449 (void)set_monster_csleep(c_ptr->m_idx, 0);
3450 if (MON_STUNNED(m_ptr))
3453 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3455 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3457 (void)set_monster_stunned(c_ptr->m_idx, 0);
3459 if (MON_CONFUSED(m_ptr))
3462 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3464 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3466 (void)set_monster_confused(c_ptr->m_idx, 0);
3468 if (MON_MONFEAR(m_ptr))
3471 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3473 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3475 (void)set_monster_monfear(c_ptr->m_idx, 0);
3479 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3482 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3486 chg_virtue(V_VITALITY, 1);
3488 if (r_ptr->flags1 & RF1_UNIQUE)
3489 chg_virtue(V_INDIVIDUALISM, 1);
3491 if (is_friendly(m_ptr))
3492 chg_virtue(V_HONOUR, 1);
3493 else if (!(r_ptr->flags3 & RF3_EVIL))
3495 if (r_ptr->flags3 & RF3_GOOD)
3496 chg_virtue(V_COMPASSION, 2);
3498 chg_virtue(V_COMPASSION, 1);
3501 if (r_ptr->flags3 & RF3_ANIMAL)
3502 chg_virtue(V_NATURE, 1);
3505 if (m_ptr->r_idx == MON_LEPER)
3508 if (!who) chg_virtue(V_COMPASSION, 5);
3511 /* Redraw (later) if needed */
3512 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3513 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3517 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3519 note = " looks healthier.";
3522 /* No "real" damage */
3528 /* Speed Monster (Ignore "dam") */
3531 if (seen) obvious = TRUE;
3534 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3537 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3539 note = " starts moving faster.";
3545 if (r_ptr->flags1 & RF1_UNIQUE)
3546 chg_virtue(V_INDIVIDUALISM, 1);
3547 if (is_friendly(m_ptr))
3548 chg_virtue(V_HONOUR, 1);
3551 /* No "real" damage */
3557 /* Slow Monster (Use "dam" as "power") */
3560 if (seen) obvious = TRUE;
3562 if (r_ptr->flagsr & RFR_RES_ALL)
3565 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3567 note = " is immune.";
3570 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3573 /* Powerful monsters can resist */
3574 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3575 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3578 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3580 note = " is unaffected!";
3586 /* Normal monsters slow down */
3589 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3592 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3594 note = " starts moving slower.";
3599 /* No "real" damage */
3605 /* Sleep (Use "dam" as "power") */
3608 if (seen) obvious = TRUE;
3610 if (r_ptr->flagsr & RFR_RES_ALL)
3613 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3615 note = " is immune.";
3618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3621 /* Attempt a saving throw */
3622 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3623 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3624 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3626 /* Memorize a flag */
3627 if (r_ptr->flags3 & RF3_NO_SLEEP)
3629 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3632 /* No obvious effect */
3634 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3636 note = " is unaffected!";
3643 /* Go to sleep (much) later */
3645 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3647 note = " falls asleep!";
3653 /* No "real" damage */
3659 /* Sleep (Use "dam" as "power") */
3660 case GF_STASIS_EVIL:
3662 if (seen) obvious = TRUE;
3664 if (r_ptr->flagsr & RFR_RES_ALL)
3667 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3669 note = " is immune.";
3672 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3675 /* Attempt a saving throw */
3676 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3677 !(r_ptr->flags3 & RF3_EVIL) ||
3678 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3681 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3683 note = " is unaffected!";
3690 /* Go to sleep (much) later */
3692 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3694 note = " is suspended!";
3700 /* No "real" damage */
3705 /* Sleep (Use "dam" as "power") */
3708 if (seen) obvious = TRUE;
3710 if (r_ptr->flagsr & RFR_RES_ALL)
3713 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3715 note = " is immune.";
3718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3721 /* Attempt a saving throw */
3722 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3723 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3726 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3728 note = " is unaffected!";
3735 /* Go to sleep (much) later */
3737 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3739 note = " is suspended!";
3745 /* No "real" damage */
3754 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3755 vir = virtue_number(V_HARMONY);
3758 dam += p_ptr->virtues[vir-1]/10;
3761 vir = virtue_number(V_INDIVIDUALISM);
3764 dam -= p_ptr->virtues[vir-1]/20;
3767 if (seen) obvious = TRUE;
3769 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3772 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3774 note = " is immune.";
3777 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3781 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3784 /* Attempt a saving throw */
3785 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3786 (r_ptr->flags3 & RF3_NO_CONF) ||
3787 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3788 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3790 /* Memorize a flag */
3791 if (r_ptr->flags3 & RF3_NO_CONF)
3793 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3797 /* No obvious effect */
3799 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3801 note = " is unaffected!";
3806 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3808 else if (p_ptr->cursed & TRC_AGGRAVATE)
3811 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3813 note = " hates you too much!";
3816 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3821 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3823 note = " suddenly seems friendly!";
3828 chg_virtue(V_INDIVIDUALISM, -1);
3829 if (r_ptr->flags3 & RF3_ANIMAL)
3830 chg_virtue(V_NATURE, 1);
3833 /* No "real" damage */
3838 /* Control undead */
3839 case GF_CONTROL_UNDEAD:
3842 if (seen) obvious = TRUE;
3844 vir = virtue_number(V_UNLIFE);
3847 dam += p_ptr->virtues[vir-1]/10;
3850 vir = virtue_number(V_INDIVIDUALISM);
3853 dam -= p_ptr->virtues[vir-1]/20;
3856 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3859 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3861 note = " is immune.";
3864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3868 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3871 /* Attempt a saving throw */
3872 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3873 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3874 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3875 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3877 /* No obvious effect */
3879 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3881 note = " is unaffected!";
3885 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3887 else if (p_ptr->cursed & TRC_AGGRAVATE)
3890 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3892 note = " hates you too much!";
3895 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3900 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3902 note = " is in your thrall!";
3908 /* No "real" damage */
3914 case GF_CONTROL_DEMON:
3917 if (seen) obvious = TRUE;
3919 vir = virtue_number(V_UNLIFE);
3922 dam += p_ptr->virtues[vir-1]/10;
3925 vir = virtue_number(V_INDIVIDUALISM);
3928 dam -= p_ptr->virtues[vir-1]/20;
3931 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3934 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3936 note = " is immune.";
3939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3943 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3946 /* Attempt a saving throw */
3947 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3948 (!(r_ptr->flags3 & RF3_DEMON)) ||
3949 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3950 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3952 /* No obvious effect */
3954 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3956 note = " is unaffected!";
3960 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3962 else if (p_ptr->cursed & TRC_AGGRAVATE)
3965 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3967 note = " hates you too much!";
3970 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3975 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3977 note = " is in your thrall!";
3983 /* No "real" damage */
3989 case GF_CONTROL_ANIMAL:
3993 if (seen) obvious = TRUE;
3995 vir = virtue_number(V_NATURE);
3998 dam += p_ptr->virtues[vir-1]/10;
4001 vir = virtue_number(V_INDIVIDUALISM);
4004 dam -= p_ptr->virtues[vir-1]/20;
4007 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4010 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4012 note = " is immune.";
4015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4019 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4022 /* Attempt a saving throw */
4023 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4024 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4025 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4026 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4027 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4029 /* Memorize a flag */
4030 if (r_ptr->flags3 & (RF3_NO_CONF))
4032 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4036 /* No obvious effect */
4038 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4040 note = " is unaffected!";
4044 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4046 else if (p_ptr->cursed & TRC_AGGRAVATE)
4049 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4051 note = " hates you too much!";
4054 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4059 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4061 note = " is tamed!";
4066 if (r_ptr->flags3 & RF3_ANIMAL)
4067 chg_virtue(V_NATURE, 1);
4070 /* No "real" damage */
4076 case GF_CONTROL_LIVING:
4080 vir = virtue_number(V_UNLIFE);
4081 if (seen) obvious = TRUE;
4083 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4084 vir = virtue_number(V_UNLIFE);
4087 dam -= p_ptr->virtues[vir-1]/10;
4090 vir = virtue_number(V_INDIVIDUALISM);
4093 dam -= p_ptr->virtues[vir-1]/20;
4096 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4097 if (dam < 1) dam = 1;
4099 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4101 msg_format("You stare into %s.", m_name);
4103 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4106 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4108 note = " is immune.";
4111 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4115 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4118 /* Attempt a saving throw */
4119 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4120 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4121 !monster_living(r_ptr) ||
4122 ((r_ptr->level+10) > randint1(dam)))
4125 /* No obvious effect */
4127 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4129 note = " is unaffected!";
4133 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4135 else if (p_ptr->cursed & TRC_AGGRAVATE)
4138 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4140 note = " hates you too much!";
4143 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4148 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4150 note = " is tamed!";
4155 if (r_ptr->flags3 & RF3_ANIMAL)
4156 chg_virtue(V_NATURE, 1);
4159 /* No "real" damage */
4164 /* Confusion (Use "dam" as "power") */
4167 if (seen) obvious = TRUE;
4169 if (r_ptr->flagsr & RFR_RES_ALL)
4172 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4174 note = " is immune.";
4177 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4180 /* Get confused later */
4181 do_conf = damroll(3, (dam / 2)) + 1;
4183 /* Attempt a saving throw */
4184 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4185 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4186 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4188 /* Memorize a flag */
4189 if (r_ptr->flags3 & (RF3_NO_CONF))
4191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4197 /* No obvious effect */
4199 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4201 note = " is unaffected!";
4207 /* No "real" damage */
4214 if (seen) obvious = TRUE;
4216 if (r_ptr->flagsr & RFR_RES_ALL)
4219 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4221 note = " is immune.";
4224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4227 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4229 /* Attempt a saving throw */
4230 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4231 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4236 /* No obvious effect */
4238 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4240 note = " is unaffected!";
4246 /* No "real" damage */
4254 /* Lite, but only hurts susceptible creatures */
4262 if (r_ptr->flagsr & RFR_RES_ALL)
4268 if (r_ptr->flags3 & (RF3_HURT_LITE))
4270 /* Obvious effect */
4271 if (seen) obvious = TRUE;
4273 /* Memorize the effects */
4274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4276 /* Special effect */
4278 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4279 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4281 note = " cringes from the light!";
4282 note_dies = " shrivels away in the light!";
4287 /* Normally no damage */
4299 /* Lite -- opposite of Dark */
4302 if (seen) obvious = TRUE;
4304 if (r_ptr->flagsr & RFR_RES_ALL)
4307 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4309 note = " is immune.";
4312 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4315 if (r_ptr->flagsr & RFR_RES_LITE)
4318 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4323 dam *= 2; dam /= (randint1(6)+6);
4324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4326 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4328 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4330 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4331 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4333 note = " cringes from the light!";
4334 note_dies = " shrivels away in the light!";
4343 /* Dark -- opposite of Lite */
4346 if (seen) obvious = TRUE;
4348 if (r_ptr->flagsr & RFR_RES_ALL)
4351 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4353 note = " is immune.";
4356 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4359 if (r_ptr->flagsr & RFR_RES_DARK)
4362 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4367 dam *= 2; dam /= (randint1(6)+6);
4368 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4377 if (r_ptr->flagsr & RFR_RES_ALL)
4382 /* Hurt by rock remover */
4383 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4386 if (seen) obvious = TRUE;
4388 /* Memorize the effects */
4389 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4391 /* Cute little message */
4393 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4394 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4396 note = " loses some skin!";
4397 note_dies = " dissolves!";
4402 /* Usually, ignore the effects */
4413 /* Teleport undead (Use "dam" as "power") */
4414 case GF_AWAY_UNDEAD:
4416 /* Only affect undead */
4417 if (r_ptr->flags3 & (RF3_UNDEAD))
4419 bool resists_tele = FALSE;
4421 if (r_ptr->flagsr & RFR_RES_TELE)
4423 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4425 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4427 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4429 note = " is unaffected!";
4432 resists_tele = TRUE;
4434 else if (r_ptr->level > randint1(100))
4436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4438 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4443 resists_tele = TRUE;
4449 if (seen) obvious = TRUE;
4450 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4462 /* No "real" damage */
4468 /* Teleport evil (Use "dam" as "power") */
4471 /* Only affect evil */
4472 if (r_ptr->flags3 & (RF3_EVIL))
4474 bool resists_tele = FALSE;
4476 if (r_ptr->flagsr & RFR_RES_TELE)
4478 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4480 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4482 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4484 note = " is unaffected!";
4487 resists_tele = TRUE;
4489 else if (r_ptr->level > randint1(100))
4491 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4493 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4498 resists_tele = TRUE;
4504 if (seen) obvious = TRUE;
4505 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4517 /* No "real" damage */
4523 /* Teleport monster (Use "dam" as "power") */
4526 bool resists_tele = FALSE;
4527 if (r_ptr->flagsr & RFR_RES_TELE)
4529 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4533 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4535 note = " is unaffected!";
4538 resists_tele = TRUE;
4540 else if (r_ptr->level > randint1(100))
4542 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4544 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4549 resists_tele = TRUE;
4556 if (seen) obvious = TRUE;
4558 /* Prepare to teleport */
4562 /* No "real" damage */
4568 /* Turn undead (Use "dam" as "power") */
4569 case GF_TURN_UNDEAD:
4571 if (r_ptr->flagsr & RFR_RES_ALL)
4576 /* Only affect undead */
4577 if (r_ptr->flags3 & (RF3_UNDEAD))
4580 if (seen) obvious = TRUE;
4582 /* Learn about type */
4583 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4585 /* Apply some fear */
4586 do_fear = damroll(3, (dam / 2)) + 1;
4588 /* Attempt a saving throw */
4589 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4591 /* No obvious effect */
4593 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4595 note = " is unaffected!";
4610 /* No "real" damage */
4616 /* Turn evil (Use "dam" as "power") */
4619 if (r_ptr->flagsr & RFR_RES_ALL)
4624 /* Only affect evil */
4625 if (r_ptr->flags3 & (RF3_EVIL))
4628 if (seen) obvious = TRUE;
4630 /* Learn about type */
4631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4633 /* Apply some fear */
4634 do_fear = damroll(3, (dam / 2)) + 1;
4636 /* Attempt a saving throw */
4637 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4639 /* No obvious effect */
4641 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4643 note = " is unaffected!";
4658 /* No "real" damage */
4664 /* Turn monster (Use "dam" as "power") */
4667 if (r_ptr->flagsr & RFR_RES_ALL)
4673 if (seen) obvious = TRUE;
4675 /* Apply some fear */
4676 do_fear = damroll(3, (dam / 2)) + 1;
4678 /* Attempt a saving throw */
4679 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4680 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4681 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4683 /* No obvious effect */
4685 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4687 note = " is unaffected!";
4694 /* No "real" damage */
4701 case GF_DISP_UNDEAD:
4703 if (r_ptr->flagsr & RFR_RES_ALL)
4709 /* Only affect undead */
4710 if (r_ptr->flags3 & (RF3_UNDEAD))
4713 if (seen) obvious = TRUE;
4715 /* Learn about type */
4716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4720 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4721 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4723 note = " shudders.";
4724 note_dies = " dissolves!";
4745 if (r_ptr->flagsr & RFR_RES_ALL)
4751 /* Only affect evil */
4752 if (r_ptr->flags3 & (RF3_EVIL))
4755 if (seen) obvious = TRUE;
4757 /* Learn about type */
4758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4762 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4763 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4765 note = " shudders.";
4766 note_dies = " dissolves!";
4786 if (r_ptr->flagsr & RFR_RES_ALL)
4792 /* Only affect good */
4793 if (r_ptr->flags3 & (RF3_GOOD))
4796 if (seen) obvious = TRUE;
4798 /* Learn about type */
4799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4803 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4804 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4806 note = " shudders.";
4807 note_dies = " dissolves!";
4825 case GF_DISP_LIVING:
4827 if (r_ptr->flagsr & RFR_RES_ALL)
4833 /* Only affect non-undead */
4834 if (monster_living(r_ptr))
4837 if (seen) obvious = TRUE;
4841 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4842 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4844 note = " shudders.";
4845 note_dies = " dissolves!";
4866 if (r_ptr->flagsr & RFR_RES_ALL)
4872 /* Only affect demons */
4873 if (r_ptr->flags3 & (RF3_DEMON))
4876 if (seen) obvious = TRUE;
4878 /* Learn about type */
4879 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4883 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4884 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4886 note = " shudders.";
4887 note_dies = " dissolves!";
4904 /* Dispel monster */
4907 if (r_ptr->flagsr & RFR_RES_ALL)
4914 if (seen) obvious = TRUE;
4918 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4919 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4921 note = " shudders.";
4922 note_dies = " dissolves!";
4932 if (seen) obvious = TRUE;
4934 if (r_ptr->flagsr & RFR_RES_ALL)
4937 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4939 note = " is immune.";
4942 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4946 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4950 /* Heal the monster */
4951 if (caster_ptr->hp < caster_ptr->maxhp)
4954 caster_ptr->hp += 6 * dam;
4955 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4957 /* Redraw (later) if needed */
4958 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4959 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4961 /* Special message */
4964 /* Get the monster name */
4965 monster_desc(killer, caster_ptr, 0);
4967 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4969 msg_format("%^s appears healthier.", killer);
4978 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4980 msg_format("You draw psychic energy from %s.", m_name);
4983 (void)hp_player(dam);
4989 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4991 if (see_s_msg) msg_format("%s is unaffected.", m_name);
5001 if (seen) obvious = TRUE;
5004 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5006 if (!who) msg_format("You gaze intently at %s.", m_name);
5009 if (r_ptr->flagsr & RFR_RES_ALL)
5012 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5014 note = " is immune.";
5017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5021 /* Attempt a saving throw */
5022 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5023 (r_ptr->flags3 & RF3_NO_CONF) ||
5024 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5026 /* Memorize a flag */
5027 if (r_ptr->flags3 & (RF3_NO_CONF))
5029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5032 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5034 note = "is unaffected!";
5038 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5040 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5042 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5044 note = " is immune!";
5048 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5052 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5061 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5062 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5064 note = " is blasted by psionic energy.";
5065 note_dies = " collapses, a mindless husk.";
5068 if (who > 0) do_conf = randint0(4) + 4;
5069 else do_conf = randint0(8) + 8;
5075 case GF_BRAIN_SMASH:
5077 if (seen) obvious = TRUE;
5080 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5082 if (!who) msg_format("You gaze intently at %s.", m_name);
5085 if (r_ptr->flagsr & RFR_RES_ALL)
5088 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5090 note = " is immune.";
5093 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5097 /* Attempt a saving throw */
5098 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5099 (r_ptr->flags3 & RF3_NO_CONF) ||
5100 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5102 /* Memorize a flag */
5103 if (r_ptr->flags3 & (RF3_NO_CONF))
5105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5108 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5110 note = "is unaffected!";
5114 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5118 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5120 note = " is immune!";
5124 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5126 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5128 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5137 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5138 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5140 note = " is blasted by psionic energy.";
5141 note_dies = " collapses, a mindless husk.";
5146 do_conf = randint0(4) + 4;
5147 do_stun = randint0(4) + 4;
5151 do_conf = randint0(8) + 8;
5152 do_stun = randint0(8) + 8;
5154 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
5162 if (seen) obvious = TRUE;
5165 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5167 if (!who) msg_format("You point at %s and curse.", m_name);
5170 if (r_ptr->flagsr & RFR_RES_ALL)
5173 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5175 note = " is immune.";
5178 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5182 /* Attempt a saving throw */
5183 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5186 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5188 note = "is unaffected!";
5198 if (seen) obvious = TRUE;
5201 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5203 if (!who) msg_format("You point at %s and curse horribly.", m_name);
5206 if (r_ptr->flagsr & RFR_RES_ALL)
5209 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5211 note = " is immune.";
5214 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5218 /* Attempt a saving throw */
5219 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5222 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5224 note = "is unaffected!";
5234 if (seen) obvious = TRUE;
5237 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5239 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5242 if (r_ptr->flagsr & RFR_RES_ALL)
5245 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5247 note = " is immune.";
5250 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5254 /* Attempt a saving throw */
5255 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5258 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5260 note = "is unaffected!";
5270 if (seen) obvious = TRUE;
5273 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5275 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5278 if (r_ptr->flagsr & RFR_RES_ALL)
5281 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5283 note = " is immune.";
5286 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5290 /* Attempt a saving throw */
5291 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5294 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5296 note = "is unaffected!";
5306 if (seen) obvious = TRUE;
5308 if (r_ptr->flagsr & RFR_RES_ALL)
5311 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5313 note = " is immune.";
5316 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5320 if (r_ptr->flags1 & RF1_UNIQUE)
5323 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5325 note = "is unaffected!";
5331 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5332 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5334 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5336 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5341 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5351 /* Capture monster */
5355 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5356 (r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flags7 & (RF7_NAZGUL)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (r_ptr->flags1 & RF1_QUESTOR) || m_ptr->parent_m_idx)
5359 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5361 msg_format("%^s is unaffected.", m_name);
5367 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
5368 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5369 nokori_hp = m_ptr->maxhp * 3 / 10;
5371 nokori_hp = m_ptr->maxhp * 3 / 20;
5373 if (m_ptr->hp >= nokori_hp)
5376 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5378 msg_format("You need to weaken %s more.", m_name);
5382 else if (m_ptr->hp < randint0(nokori_hp))
5384 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5386 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5388 msg_format("You capture %^s!", m_name);
5390 cap_mon = m_ptr->r_idx;
5391 cap_mspeed = m_ptr->mspeed;
5393 cap_maxhp = m_ptr->max_maxhp;
5394 cap_nickname = m_ptr->nickname; /* Quark transfer */
5395 if (c_ptr->m_idx == p_ptr->riding)
5397 if (rakuba(-1, FALSE))
5400 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5402 msg_format("You have fallen from %s.", m_name);
5407 delete_monster_idx(c_ptr->m_idx);
5414 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5416 msg_format("You failed to capture %s.", m_name);
5423 /* Attack (Use "dam" as attack type) */
5426 /* Return this monster's death */
5427 return py_attack(y, x, dam);
5430 /* Sleep (Use "dam" as "power") */
5436 if (seen) obvious = TRUE;
5438 if (r_ptr->flagsr & RFR_RES_ALL)
5441 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5443 note = " is immune.";
5446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5449 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5452 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5454 note = " is immune!";
5458 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5461 if (MON_CSLEEP(m_ptr))
5464 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5466 note = " is immune!";
5473 if (one_in_(5)) effect = 1;
5474 else if (one_in_(4)) effect = 2;
5475 else if (one_in_(3)) effect = 3;
5480 /* Powerful monsters can resist */
5481 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5482 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5485 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5487 note = " is unaffected!";
5493 /* Normal monsters slow down */
5496 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
5499 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5501 note = " starts moving slower.";
5507 else if (effect == 2)
5509 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5511 /* Attempt a saving throw */
5512 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5513 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5518 /* No obvious effect */
5520 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5522 note = " is unaffected!";
5529 else if (effect == 3)
5531 /* Attempt a saving throw */
5532 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5533 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5534 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5536 /* Memorize a flag */
5537 if (r_ptr->flags3 & RF3_NO_SLEEP)
5539 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5542 /* No obvious effect */
5544 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5546 note = " is unaffected!";
5553 /* Go to sleep (much) later */
5555 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5557 note = " falls asleep!";
5567 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5569 note = " is immune!";
5573 /* No "real" damage */
5581 if (seen) obvious = TRUE;
5583 if (r_ptr->flagsr & RFR_RES_ALL)
5586 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5588 note = " is immune.";
5591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5596 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "¥â¥ó¥¹¥¿¡¼¾ÃÌÇ"))
5598 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "Genocide One"))
5602 if (seen_msg) msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª", m_name);
5604 if (seen_msg) msg_format("%^s disappered!", m_name);
5606 chg_virtue(V_VITALITY, -1);
5617 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5619 if (!who) msg_format("You take a photograph of %s.", m_name);
5622 if (r_ptr->flags3 & (RF3_HURT_LITE))
5624 /* Obvious effect */
5625 if (seen) obvious = TRUE;
5627 /* Memorize the effects */
5628 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5630 /* Special effect */
5632 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5633 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5635 note = " cringes from the light!";
5636 note_dies = " shrivels away in the light!";
5640 /* Normally no damage */
5647 photo = m_ptr->r_idx;
5654 case GF_BLOOD_CURSE:
5656 if (seen) obvious = TRUE;
5658 if (r_ptr->flagsr & RFR_RES_ALL)
5661 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5663 note = " is immune.";
5666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5674 bool success = FALSE;
5675 if (seen) obvious = TRUE;
5677 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5679 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5680 if (dam < 1) dam = 1;
5682 /* No need to tame your pet */
5686 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5688 note = " starts moving faster.";
5691 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5695 /* Attempt a saving throw */
5696 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5697 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5698 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5699 (p_ptr->cursed & TRC_AGGRAVATE) ||
5700 ((r_ptr->level+10) > randint1(dam)))
5703 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5708 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5710 note = " is tamed!";
5714 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5716 /* Learn about type */
5717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5724 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5726 do_fear = randint1(90)+10;
5728 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5731 /* No "real" damage */
5738 if (seen) obvious = TRUE;
5740 if (r_ptr->flagsr & RFR_RES_ALL)
5743 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5745 note = " is immune.";
5748 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5752 /* Attempt a saving throw */
5753 if (randint0(100 + dam) < (r_ptr->level + 50))
5757 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5759 note = "is unaffected!";
5780 /* Absolutely no effect */
5781 if (skipped) return (FALSE);
5783 /* "Unique" monsters cannot be polymorphed */
5784 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5786 /* Quest monsters cannot be polymorphed */
5787 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5789 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5791 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5792 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5794 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5799 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5800 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5803 /* Modify the damage */
5805 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5807 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5809 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5812 /* Check for death */
5813 if (dam > m_ptr->hp)
5815 /* Extract method of death */
5820 /* Sound and Impact resisters never stun */
5822 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5823 !(r_ptr->flags3 & RF3_NO_STUN))
5826 if (seen) obvious = TRUE;
5829 if (MON_STUNNED(m_ptr))
5832 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5834 note = " is more dazed.";
5837 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
5842 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5844 note = " is dazed.";
5851 (void)set_monster_stunned(c_ptr->m_idx, tmp);
5857 /* Confusion and Chaos resisters (and sleepers) never confuse */
5859 !(r_ptr->flags3 & RF3_NO_CONF) &&
5860 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5863 if (seen) obvious = TRUE;
5865 /* Already partially confused */
5866 if (MON_CONFUSED(m_ptr))
5869 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5871 note = " looks more confused.";
5874 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
5877 /* Was not confused */
5881 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5883 note = " looks confused.";
5889 /* Apply confusion */
5890 (void)set_monster_confused(c_ptr->m_idx, tmp);
5899 if (seen) obvious = TRUE;
5901 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5906 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5908 note = " seems weakened.";
5910 m_ptr->maxhp -= do_time;
5911 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5916 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5917 if (do_poly && (randint1(90) > r_ptr->level))
5919 if (polymorph_monster(y, x))
5922 if (seen) obvious = TRUE;
5924 /* Monster polymorphs */
5926 note = "¤¬ÊѿȤ·¤¿¡ª";
5931 /* Turn off the damage */
5938 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5940 note = " is unaffected!";
5944 /* Hack -- Get new monster */
5945 m_ptr = &m_list[c_ptr->m_idx];
5947 /* Hack -- Get new race */
5948 r_ptr = &r_info[m_ptr->r_idx];
5951 /* Handle "teleport" */
5955 if (seen) obvious = TRUE;
5959 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5961 note = " disappears!";
5964 if (!who) chg_virtue(V_VALOUR, -1);
5967 teleport_away(c_ptr->m_idx, do_dist,
5968 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
5970 /* Hack -- get new location */
5974 /* Hack -- get new grid */
5975 c_ptr = &cave[y][x];
5982 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
5989 if (typ == GF_DRAIN_MANA)
5991 /* Drain mana does nothing */
5994 /* If another monster did the damage, hurt the monster by hand */
5997 /* Redraw (later) if needed */
5998 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5999 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
6001 /* Wake the monster up */
6002 (void)set_monster_csleep(c_ptr->m_idx, 0);
6004 /* Hurt the monster */
6012 if (is_pet(m_ptr) && !(m_ptr->ml))
6015 /* Give detailed messages if destroyed */
6018 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6021 msg_format("%^s%s", m_name, note);
6029 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
6031 /* Generate treasure, etc */
6032 monster_death(c_ptr->m_idx, FALSE);
6034 /* Delete the monster */
6035 delete_monster_idx(c_ptr->m_idx);
6040 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6042 msg_print("You feel sad for a moment.");
6047 /* Damaged monster */
6050 /* Give detailed messages if visible or destroyed */
6051 if (note && seen_msg) msg_format("%^s%s", m_name, note);
6053 /* Hack -- Pain message */
6056 message_pain(c_ptr->m_idx, dam);
6063 /* Hack -- handle sleep */
6064 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6068 else if (heal_leper)
6071 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6073 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6076 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
6080 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
6081 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
6084 delete_monster_idx(c_ptr->m_idx);
6087 /* If the player did it, give him experience, check fear */
6092 /* Hurt the monster, check for fear and death */
6093 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6098 /* Damaged monster */
6101 /* HACK - anger the monster before showing the sleep message */
6102 if (do_sleep) anger_monster(m_ptr);
6104 /* Give detailed messages if visible or destroyed */
6105 if (note && seen_msg)
6107 msg_format("%s%s", m_name, note);
6109 msg_format("%^s%s", m_name, note);
6113 /* Hack -- Pain message */
6114 else if (known && (dam || !do_fear))
6116 message_pain(c_ptr->m_idx, dam);
6119 /* Anger monsters */
6120 if (((dam > 0) || get_angry) && !do_sleep)
6121 anger_monster(m_ptr);
6124 if ((fear || do_fear) && seen)
6131 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6133 msg_format("%^s flees in terror!", m_name);
6137 /* Hack -- handle sleep */
6138 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6142 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6144 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6148 switch (randint1(28))
6154 msg_print("ÃÏÌ̤¬Íɤ줿...");
6156 msg_print("The ground trembles...");
6159 earthquake(ty, tx, 4 + randint0(4));
6160 if (!one_in_(6)) break;
6162 case 3: case 4: case 5: case 6:
6165 int dam = damroll(10, 10);
6167 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6169 msg_print("A portal opens to a plane of raw mana!");
6172 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6173 if (!one_in_(6)) break;
6179 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6181 msg_print("Space warps about you!");
6184 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
6185 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6186 if (!one_in_(6)) break;
6188 case 9: case 10: case 11:
6190 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6192 msg_print("You feel a surge of energy!");
6195 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6196 if (!one_in_(6)) break;
6197 case 12: case 13: case 14: case 15: case 16:
6198 aggravate_monsters(0);
6199 if (!one_in_(6)) break;
6201 count += activate_hi_summon(ty, tx, TRUE);
6202 if (!one_in_(6)) break;
6203 case 19: case 20: case 21: case 22:
6205 bool pet = !one_in_(3);
6206 u32b mode = PM_ALLOW_GROUP;
6208 if (pet) mode |= PM_FORCE_PET;
6209 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6211 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6212 if (!one_in_(6)) break;
6214 case 23: case 24: case 25:
6215 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6217 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6219 msg_print("You feel your life draining away...");
6222 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6223 else lose_exp(p_ptr->exp / 16);
6224 if (!one_in_(6)) break;
6225 case 26: case 27: case 28:
6234 (void)do_dec_stat(i);
6243 (void)do_dec_stat(randint0(6));
6252 if (p_ptr->inside_battle)
6254 p_ptr->health_who = c_ptr->m_idx;
6255 p_ptr->redraw |= (PR_HEALTH);
6259 /* XXX XXX XXX Verify this code */
6261 /* Update the monster */
6262 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
6264 /* Redraw the monster grid */
6268 /* Update monster recall window */
6269 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
6272 p_ptr->window |= (PW_MONSTER);
6275 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6279 if (!(flg & PROJECT_NO_HANGEKI))
6281 set_target(m_ptr, monster_target_y, monster_target_x);
6284 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6286 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6290 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6292 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6293 rakubadam_m = (dam > 200) ? 200 : dam;
6302 /* Get local object */
6305 /* Prepare to make a Blade of Chaos */
6306 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6308 q_ptr->pval = photo;
6310 /* Mark the item as fully known */
6311 q_ptr->ident |= (IDENT_MENTAL);
6313 /* Drop it in the dungeon */
6314 (void)drop_near(q_ptr, -1, py, px);
6322 /* Return "Anything seen?" */
6328 * Helper function for "project()" below.
6330 * Handle a beam/bolt/ball causing damage to the player.
6332 * This routine takes a "source monster" (by index), a "distance", a default
6333 * "damage", and a "damage type". See "project_m()" above.
6335 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6336 * is reduced (see "project_m()" above). This can happen if a monster breathes
6337 * at the player and hits a wall instead.
6339 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6340 * to know if this is actually a ball or a bolt spell
6343 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6344 * we just assume that the effects were obvious, for historical reasons.
6346 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6351 /* Hack -- assume obvious */
6352 bool obvious = TRUE;
6354 /* Player blind-ness */
6355 bool blind = (p_ptr->blind ? TRUE : FALSE);
6357 /* Player needs a "description" (he is blind) */
6360 /* Source monster */
6361 monster_type *m_ptr = NULL;
6363 /* Monster name (for attacks) */
6366 /* Monster name (for damage) */
6369 /* Hack -- messages */
6375 /* Player is not here */
6376 if (!player_bold(y, x)) return (FALSE);
6378 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6380 if (kawarimi(TRUE)) return FALSE;
6383 /* Player cannot hurt himself */
6384 if (!who) return (FALSE);
6385 if (who == p_ptr->riding) return (FALSE);
6387 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6390 int max_attempts = 10;
6393 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6394 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6395 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6397 if (blind) msg_print("Something bounces!");
6398 else msg_print("The attack bounces!");
6402 /* Choose 'new' target */
6407 t_y = m_list[who].fy - 1 + randint1(3);
6408 t_x = m_list[who].fx - 1 + randint1(3);
6411 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6413 if (max_attempts < 1)
6415 t_y = m_list[who].fy;
6416 t_x = m_list[who].fx;
6421 t_y = py - 1 + randint1(3);
6422 t_x = px - 1 + randint1(3);
6425 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6432 /* Limit maximum damage */
6433 if (dam > 1600) dam = 1600;
6435 /* Reduce damage by distance */
6436 dam = (dam + r) / (r + 1);
6439 /* If the player is blind, be more descriptive */
6440 if (blind) fuzzy = TRUE;
6445 /* Get the source monster */
6446 m_ptr = &m_list[who];
6447 /* Extract the monster level */
6448 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6450 /* Get the monster name */
6451 monster_desc(m_name, m_ptr, 0);
6453 /* Get the monster's real name (gotten before polymorph!) */
6454 strcpy(killer, who_name);
6460 case PROJECT_WHO_UNCTRL_POWER:
6462 strcpy(killer, "À©¸æ¤Ç¤¤Ê¤¤ÎϤÎÈÅή");
6464 strcpy(killer, "uncontrollable power storm");
6468 case PROJECT_WHO_GLASS_SHARDS:
6470 strcpy(killer, "¥¬¥é¥¹¤ÎÇËÊÒ");
6472 strcpy(killer, "shards of glass");
6478 strcpy(killer, "æ«");
6480 strcpy(killer, "a trap");
6486 strcpy(m_name, killer);
6489 /* Analyze the damage */
6492 /* Standard damage -- hurts inventory too */
6496 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6498 if (fuzzy) msg_print("You are hit by acid!");
6501 get_damage = acid_dam(dam, killer, monspell);
6505 /* Standard damage -- hurts inventory too */
6509 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6511 if (fuzzy) msg_print("You are hit by fire!");
6514 get_damage = fire_dam(dam, killer, monspell);
6518 /* Standard damage -- hurts inventory too */
6522 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6524 if (fuzzy) msg_print("You are hit by cold!");
6527 get_damage = cold_dam(dam, killer, monspell);
6531 /* Standard damage -- hurts inventory too */
6535 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6537 if (fuzzy) msg_print("You are hit by lightning!");
6540 get_damage = elec_dam(dam, killer, monspell);
6544 /* Standard damage -- also poisons player */
6547 bool double_resist = IS_OPPOSE_POIS();
6549 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6551 if (fuzzy) msg_print("You are hit by poison!");
6554 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6555 if (double_resist) dam = (dam + 2) / 3;
6557 if ((!(double_resist || p_ptr->resist_pois)) &&
6558 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
6563 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6565 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6567 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6572 /* Standard damage -- also poisons / mutates player */
6575 bool double_resist = IS_OPPOSE_POIS();
6577 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6579 if (fuzzy) msg_print("You are hit by radiation!");
6582 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6583 if (double_resist) dam = (2 * dam + 2) / 5;
6584 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6585 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6587 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6589 if (one_in_(5)) /* 6 */
6592 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6594 msg_print("You undergo a freakish metamorphosis!");
6597 if (one_in_(4)) /* 4 */
6605 inven_damage(set_acid_destroy, 2);
6611 /* Standard damage */
6615 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6617 if (fuzzy) msg_print("You are hit by something!");
6620 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6624 /* Holy Orb -- Player only takes partial damage */
6628 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6630 if (fuzzy) msg_print("You are hit by something!");
6633 if (p_ptr->align > 10)
6635 else if (p_ptr->align < -10)
6637 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6644 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6646 if (fuzzy) msg_print("You are hit by something!");
6649 if (p_ptr->align > 10)
6651 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6655 /* Arrow -- XXX no dodging */
6659 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6661 if (fuzzy) msg_print("You are hit by something sharp!");
6664 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6667 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6669 msg_print("You cut down the arrow!");
6673 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6677 /* Plasma -- XXX No resist */
6681 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6683 if (fuzzy) msg_print("You are hit by something *HOT*!");
6686 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6688 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6690 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6691 (void)set_stun(p_ptr->stun + k);
6694 if (!(p_ptr->resist_fire ||
6696 p_ptr->immune_fire))
6698 inven_damage(set_acid_destroy, 3);
6704 /* Nether -- drain experience */
6708 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6710 if (fuzzy) msg_print("You are hit by nether forces!");
6713 if (p_ptr->resist_neth)
6715 if (!prace_is_(RACE_SPECTRE))
6716 dam *= 6; dam /= (randint1(4) + 7);
6718 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6720 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
6723 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6725 msg_print("You feel invigorated!");
6729 learn_spell(monspell);
6733 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6739 /* Water -- stun/confuse */
6743 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6745 if (fuzzy) msg_print("You are hit by something wet!");
6748 if (!CHECK_MULTISHADOW())
6750 if (!p_ptr->resist_sound)
6752 set_stun(p_ptr->stun + randint1(40));
6754 if (!p_ptr->resist_conf)
6756 set_confused(p_ptr->confused + randint1(5) + 5);
6761 inven_damage(set_cold_destroy, 3);
6765 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6769 /* Chaos -- many effects */
6773 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6775 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6778 if (p_ptr->resist_chaos)
6780 dam *= 6; dam /= (randint1(4) + 7);
6783 if (!CHECK_MULTISHADOW())
6785 if (!p_ptr->resist_conf)
6787 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6789 if (!p_ptr->resist_chaos)
6791 (void)set_image(p_ptr->image + randint1(10));
6795 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6797 msg_print("Your body is twisted by chaos!");
6800 (void)gain_random_mutation(0);
6803 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6805 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6808 if (!p_ptr->resist_chaos || one_in_(9))
6810 inven_damage(set_elec_destroy, 2);
6811 inven_damage(set_fire_destroy, 2);
6815 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6819 /* Shards -- mostly cutting */
6823 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6825 if (fuzzy) msg_print("You are hit by something sharp!");
6828 if (p_ptr->resist_shard)
6830 dam *= 6; dam /= (randint1(4) + 7);
6832 else if (!CHECK_MULTISHADOW())
6834 (void)set_cut(p_ptr->cut + dam);
6837 if (!p_ptr->resist_shard || one_in_(13))
6839 inven_damage(set_cold_destroy, 2);
6842 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6846 /* Sound -- mostly stunning */
6850 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6852 if (fuzzy) msg_print("You are hit by a loud noise!");
6855 if (p_ptr->resist_sound)
6857 dam *= 5; dam /= (randint1(4) + 7);
6859 else if (!CHECK_MULTISHADOW())
6861 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6862 (void)set_stun(p_ptr->stun + k);
6865 if (!p_ptr->resist_sound || one_in_(13))
6867 inven_damage(set_cold_destroy, 2);
6870 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6874 /* Pure confusion */
6878 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6880 if (fuzzy) msg_print("You are hit by something puzzling!");
6883 if (p_ptr->resist_conf)
6885 dam *= 5; dam /= (randint1(4) + 7);
6887 else if (!CHECK_MULTISHADOW())
6889 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6891 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6895 /* Disenchantment -- see above */
6899 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6901 if (fuzzy) msg_print("You are hit by something static!");
6904 if (p_ptr->resist_disen)
6906 dam *= 6; dam /= (randint1(4) + 7);
6908 else if (!CHECK_MULTISHADOW())
6910 (void)apply_disenchant(0);
6912 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6916 /* Nexus -- see above */
6920 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6922 if (fuzzy) msg_print("You are hit by something strange!");
6925 if (p_ptr->resist_nexus)
6927 dam *= 6; dam /= (randint1(4) + 7);
6929 else if (!CHECK_MULTISHADOW())
6933 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6937 /* Force -- mostly stun */
6941 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6943 if (fuzzy) msg_print("You are hit by kinetic force!");
6946 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6948 (void)set_stun(p_ptr->stun + randint1(20));
6950 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6955 /* Rocket -- stun, cut */
6959 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6961 if (fuzzy) msg_print("There is an explosion!");
6964 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6966 (void)set_stun(p_ptr->stun + randint1(20));
6969 if (p_ptr->resist_shard)
6973 else if (!CHECK_MULTISHADOW())
6975 (void)set_cut(p_ptr->cut + (dam / 2));
6978 if (!p_ptr->resist_shard || one_in_(12))
6980 inven_damage(set_cold_destroy, 3);
6983 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6987 /* Inertia -- slowness */
6991 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6993 if (fuzzy) msg_print("You are hit by something slow!");
6996 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6997 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7001 /* Lite -- blinding */
7005 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7007 if (fuzzy) msg_print("You are hit by something!");
7010 if (p_ptr->resist_lite)
7012 dam *= 4; dam /= (randint1(4) + 7);
7014 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7016 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7019 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7022 if (!CHECK_MULTISHADOW()) msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7024 if (!CHECK_MULTISHADOW()) msg_print("The light scorches your flesh!");
7029 else if (prace_is_(RACE_S_FAIRY))
7034 if (p_ptr->wraith_form) dam *= 2;
7035 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7037 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
7039 p_ptr->wraith_form = 0;
7041 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7043 msg_print("The light forces you out of your incorporeal shadow form.");
7046 p_ptr->redraw |= PR_MAP;
7047 /* Update monsters */
7048 p_ptr->update |= (PU_MONSTERS);
7050 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7052 /* Redraw status bar */
7053 p_ptr->redraw |= (PR_STATUS);
7060 /* Dark -- blinding */
7064 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7066 if (fuzzy) msg_print("You are hit by something!");
7069 if (p_ptr->resist_dark)
7071 dam *= 4; dam /= (randint1(4) + 7);
7073 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7075 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7077 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7079 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7083 /* Time -- bolt fewer effects XXX */
7087 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7089 if (fuzzy) msg_print("You are hit by a blast from the past!");
7092 if (p_ptr->resist_time)
7095 dam /= (randint1(4) + 7);
7097 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7099 msg_print("You feel as if time is passing you by.");
7102 else if (!CHECK_MULTISHADOW())
7104 switch (randint1(10))
7106 case 1: case 2: case 3: case 4: case 5:
7108 if (p_ptr->prace == RACE_ANDROID) break;
7110 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7112 msg_print("You feel life has clocked back.");
7115 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7119 case 6: case 7: case 8: case 9:
7121 switch (randint1(6))
7124 case 1: k = A_STR; act = "¶¯¤¯"; break;
7125 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7126 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7127 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7128 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7129 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7131 case 1: k = A_STR; act = "strong"; break;
7132 case 2: k = A_INT; act = "bright"; break;
7133 case 3: k = A_WIS; act = "wise"; break;
7134 case 4: k = A_DEX; act = "agile"; break;
7135 case 5: k = A_CON; act = "hale"; break;
7136 case 6: k = A_CHR; act = "beautiful"; break;
7141 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7143 msg_format("You're not as %s as you used to be...", act);
7146 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7147 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7148 p_ptr->update |= (PU_BONUS);
7155 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7157 msg_print("You're not as powerful as you used to be...");
7160 for (k = 0; k < 6; k++)
7162 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7163 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7165 p_ptr->update |= (PU_BONUS);
7171 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7175 /* Gravity -- stun plus slowness plus teleport */
7179 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7180 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7182 if (fuzzy) msg_print("You are hit by something heavy!");
7183 msg_print("Gravity warps around you.");
7186 if (!CHECK_MULTISHADOW())
7188 teleport_player(5, TELEPORT_PASSIVE);
7189 if (!p_ptr->levitation)
7190 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7191 if (!(p_ptr->resist_sound || p_ptr->levitation))
7193 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7194 (void)set_stun(p_ptr->stun + k);
7197 if (p_ptr->levitation)
7199 dam = (dam * 2) / 3;
7202 if (!p_ptr->levitation || one_in_(13))
7204 inven_damage(set_cold_destroy, 2);
7207 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7211 /* Standard damage */
7212 case GF_DISINTEGRATE:
7215 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7217 if (fuzzy) msg_print("You are hit by pure energy!");
7220 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7227 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7229 if (fuzzy) msg_print("You are hit by something invigorating!");
7232 (void)hp_player(dam);
7240 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7242 if (fuzzy) msg_print("You are hit by something!");
7245 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7253 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7255 if (fuzzy) msg_print("You are hit by something slow!");
7258 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7264 if (p_ptr->free_act) break;
7266 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7268 if (fuzzy) msg_print("You fall asleep!");
7272 if (ironman_nightmare)
7275 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7277 msg_print("A horrible vision enters your mind.");
7280 /* Pick a nightmare */
7281 get_mon_num_prep(get_nightmare, NULL);
7283 /* Have some nightmares */
7284 have_nightmare(get_mon_num(MAX_DEPTH));
7286 /* Remove the monster restriction */
7287 get_mon_num_prep(NULL, NULL);
7290 set_paralyzed(p_ptr->paralyzed + dam);
7301 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7303 if (fuzzy) msg_print("You are hit by an aura of magic!");
7306 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7314 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7316 if (fuzzy) msg_print("You are hit by an energy!");
7319 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7327 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7329 if (fuzzy) msg_print("Something falls from the sky on you!");
7332 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7333 if (!p_ptr->resist_shard || one_in_(13))
7335 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7336 inven_damage(set_cold_destroy, 2);
7342 /* Ice -- cold plus stun plus cuts */
7346 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7348 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7351 get_damage = cold_dam(dam, killer, monspell);
7352 if (!CHECK_MULTISHADOW())
7354 if (!p_ptr->resist_shard)
7356 (void)set_cut(p_ptr->cut + damroll(5, 8));
7358 if (!p_ptr->resist_sound)
7360 (void)set_stun(p_ptr->stun + randint1(15));
7363 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7365 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7376 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7378 if (fuzzy) msg_print("You are hit by something extremely cold!");
7382 if (p_ptr->mimic_form)
7384 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7385 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7390 switch (p_ptr->prace)
7392 /* Some races are immune */
7406 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7418 if (CHECK_MULTISHADOW())
7421 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
7423 msg_print("The attack hits Shadow, you are unharmed!");
7426 else if (p_ptr->csp)
7430 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7431 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7433 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7434 else msg_print("Your psychic energy is drawn!");
7438 if (dam >= p_ptr->csp)
7442 p_ptr->csp_frac = 0;
7451 learn_spell(monspell);
7454 p_ptr->redraw |= (PR_MANA);
7457 p_ptr->window |= (PW_PLAYER);
7458 p_ptr->window |= (PW_SPELL);
7462 /* Heal the monster */
7463 if (m_ptr->hp < m_ptr->maxhp)
7466 m_ptr->hp += (6 * dam);
7467 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7469 /* Redraw (later) if needed */
7470 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7471 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7473 /* Special message */
7477 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7479 msg_format("%^s appears healthier.", m_name);
7493 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7496 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7498 msg_print("You resist the effects!");
7500 learn_spell(monspell);
7504 if (!CHECK_MULTISHADOW())
7507 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7509 msg_print("Your mind is blasted by psyonic energy.");
7512 if (!p_ptr->resist_conf)
7514 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7517 if (!p_ptr->resist_chaos && one_in_(3))
7519 (void)set_image(p_ptr->image + randint0(250) + 150);
7526 p_ptr->csp_frac = 0;
7528 p_ptr->redraw |= PR_MANA;
7531 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7537 case GF_BRAIN_SMASH:
7539 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7542 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7544 msg_print("You resist the effects!");
7546 learn_spell(monspell);
7550 if (!CHECK_MULTISHADOW())
7553 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7555 msg_print("Your mind is blasted by psionic energy.");
7562 p_ptr->csp_frac = 0;
7564 p_ptr->redraw |= PR_MANA;
7567 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7568 if (!CHECK_MULTISHADOW())
7570 if (!p_ptr->resist_blind)
7572 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7574 if (!p_ptr->resist_conf)
7576 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7578 if (!p_ptr->free_act)
7580 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7582 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7584 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7585 (void)do_dec_stat(A_INT);
7586 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7587 (void)do_dec_stat(A_WIS);
7589 if (!p_ptr->resist_chaos)
7591 (void)set_image(p_ptr->image + randint0(250) + 150);
7601 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7604 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7606 msg_print("You resist the effects!");
7608 learn_spell(monspell);
7612 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
7613 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7621 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7624 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7626 msg_print("You resist the effects!");
7628 learn_spell(monspell);
7632 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
7633 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7641 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7644 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7646 msg_print("You resist the effects!");
7648 learn_spell(monspell);
7652 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
7653 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7661 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
7664 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7666 msg_print("You resist the effects!");
7668 learn_spell(monspell);
7672 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7673 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
7681 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7684 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7686 msg_format("You resist the effects!");
7688 learn_spell(monspell);
7692 if (!CHECK_MULTISHADOW())
7695 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7697 msg_print("You feel your life fade away!");
7699 curse_equipment(40, 20);
7702 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7704 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
7719 /* Hex - revenge damage stored */
7720 revenge_store(get_damage);
7722 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
7723 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
7726 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7728 char m_name_self[80];
7731 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7733 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7735 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7736 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7739 if (p_ptr->riding && dam > 0)
7741 rakubadam_p = (dam > 200) ? 200 : dam;
7749 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7751 (void)kawarimi(FALSE);
7754 /* Return "Anything seen?" */
7760 * Find the distance from (x, y) to a line.
7762 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7764 /* Vector from (x, y) to (x1, y1) */
7773 int pd = distance(y1, x1, y, x);
7774 int nd = distance(y1, x1, y2, x2);
7776 if (pd > nd) return distance(y, x, y2, x2);
7778 /* Component of P on N */
7779 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7781 /* Absolute value */
7782 return((nd >= 0) ? nd : 0 - nd);
7789 * Modified version of los() for calculation of disintegration balls.
7790 * Disintegration effects are stopped by permanent walls.
7792 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7812 /* Slope, or 1/Slope, of LOS */
7816 /* Extract the offset */
7820 /* Extract the absolute offset */
7825 /* Handle adjacent (or identical) grids */
7826 if ((ax < 2) && (ay < 2)) return (TRUE);
7829 /* Paranoia -- require "safe" origin */
7830 /* if (!in_bounds(y1, x1)) return (FALSE); */
7833 /* Directly South/North */
7836 /* South -- check for walls */
7839 for (ty = y1 + 1; ty < y2; ty++)
7841 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7845 /* North -- check for walls */
7848 for (ty = y1 - 1; ty > y2; ty--)
7850 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7858 /* Directly East/West */
7861 /* East -- check for walls */
7864 for (tx = x1 + 1; tx < x2; tx++)
7866 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7870 /* West -- check for walls */
7873 for (tx = x1 - 1; tx > x2; tx--)
7875 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7884 /* Extract some signs */
7885 sx = (dx < 0) ? -1 : 1;
7886 sy = (dy < 0) ? -1 : 1;
7889 /* Vertical "knights" */
7894 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7898 /* Horizontal "knights" */
7903 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7908 /* Calculate scale factor div 2 */
7911 /* Calculate scale factor */
7915 /* Travel horizontally */
7918 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7924 /* Consider the special case where slope == 1. */
7935 /* Note (below) the case (qy == f2), where */
7936 /* the LOS exactly meets the corner of a tile. */
7939 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7950 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7963 /* Travel vertically */
7966 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7982 /* Note (below) the case (qx == f2), where */
7983 /* the LOS exactly meets the corner of a tile. */
7986 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7997 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8018 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, int typ)
8023 int brev = rad * rad / dist;
8027 int mdis = distance(y1, x1, y2, x2) + rad;
8029 while (bdis <= mdis)
8033 if ((0 < dist) && (path_n < dist))
8035 int ny = GRID_Y(path_g[path_n]);
8036 int nx = GRID_X(path_g[path_n]);
8037 int nd = distance(ny, nx, y1, x1);
8039 /* Get next base point */
8048 /* Travel from center outward */
8049 for (cdis = 0; cdis <= brad; cdis++)
8051 /* Scan the maximal blast area of radius "cdis" */
8052 for (y = by - cdis; y <= by + cdis; y++)
8054 for (x = bx - cdis; x <= bx + cdis; x++)
8056 /* Ignore "illegal" locations */
8057 if (!in_bounds(y, x)) continue;
8059 /* Enforce a circular "ripple" */
8060 if (distance(y1, x1, y, x) != bdis) continue;
8062 /* Enforce an arc */
8063 if (distance(by, bx, y, x) != cdis) continue;
8069 /* Lights are stopped by opaque terrains */
8070 if (!los(by, bx, y, x)) continue;
8072 case GF_DISINTEGRATE:
8073 /* Disintegration are stopped only by perma-walls */
8074 if (!in_disintegration_range(by, bx, y, x)) continue;
8077 /* Ball explosions are stopped by walls */
8078 if (!projectable(by, bx, y, x)) continue;
8082 /* Save this grid */
8090 /* Encode some more "radius" info */
8091 gm[bdis + 1] = *pgrids;
8093 /* Increase the size */
8094 brad = rad * (path_n + brev) / (dist + brev);
8096 /* Find the next ripple */
8100 /* Store the effect size */
8106 * Generic "beam"/"bolt"/"ball" projection routine.
8109 * who: Index of "source" monster (zero for "player")
8110 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8111 * y,x: Target location (or location to travel "towards")
8112 * dam: Base damage roll to apply to affected monsters (or player)
8113 * typ: Type of damage to apply to monsters (and objects)
8114 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8117 * TRUE if any "effects" of the projection were observed, else FALSE
8119 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8120 * towards a given location (optionally passing over the heads of interposing
8121 * monsters), and have it do a given amount of damage to the monsters (and
8122 * optionally objects) within the given radius of the final location.
8124 * A "bolt" travels from source to target and affects only the target grid.
8125 * A "beam" travels from source to target, affecting all grids passed through.
8126 * A "ball" travels from source to the target, exploding at the target, and
8127 * affecting everything within the given radius of the target location.
8129 * Traditionally, a "bolt" does not affect anything on the ground, and does
8130 * not pass over the heads of interposing monsters, much like a traditional
8131 * missile, and will "stop" abruptly at the "target" even if no monster is
8132 * positioned there, while a "ball", on the other hand, passes over the heads
8133 * of monsters between the source and target, and affects everything except
8134 * the source monster which lies within the final radius, while a "beam"
8135 * affects every monster between the source and target, except for the casting
8136 * monster (or player), and rarely affects things on the ground.
8138 * Two special flags allow us to use this function in special ways, the
8139 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8140 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8141 * actually projecting from the source monster (or player).
8143 * The player will only get "experience" for monsters killed by himself
8144 * Unique monsters can only be destroyed by attacks from the player
8146 * Only 256 grids can be affected per projection, limiting the effective
8147 * "radius" of standard ball attacks to nine units (diameter nineteen).
8149 * One can project in a given "direction" by combining PROJECT_THRU with small
8150 * offsets to the initial location (see "line_spell()"), or by calculating
8151 * "virtual targets" far away from the player.
8153 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8154 * continuing until it actually hits somethings (useful for "stone to mud").
8156 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8158 * Balls must explode BEFORE hitting walls, or they would affect monsters
8159 * on both sides of a wall. Some bug reports indicate that this is still
8160 * happening in 2.7.8 for Windows, though it appears to be impossible.
8162 * We "pre-calculate" the blast area only in part for efficiency.
8163 * More importantly, this lets us do "explosions" from the "inside" out.
8164 * This results in a more logical distribution of "blast" treasure.
8165 * It also produces a better (in my opinion) animation of the explosion.
8166 * It could be (but is not) used to have the treasure dropped by monsters
8167 * in the middle of the explosion fall "outwards", and then be damaged by
8168 * the blast as it spreads outwards towards the treasure drop location.
8170 * Walls and doors are included in the blast area, so that they can be
8171 * "burned" or "melted" in later versions.
8173 * This algorithm is intended to maximize simplicity, not necessarily
8174 * efficiency, since this function is not a bottleneck in the code.
8176 * We apply the blast effect from ground zero outwards, in several passes,
8177 * first affecting features, then objects, then monsters, then the player.
8178 * This allows walls to be removed before checking the object or monster
8179 * in the wall, and protects objects which are dropped by monsters killed
8180 * in the blast, and allows the player to see all affects before he is
8181 * killed or teleported away. The semantics of this method are open to
8182 * various interpretations, but they seem to work well in practice.
8184 * We process the blast area from ground-zero outwards to allow for better
8185 * distribution of treasure dropped by monsters, and because it provides a
8186 * pleasing visual effect at low cost.
8188 * Note that the damage done by "ball" explosions decreases with distance.
8189 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8191 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8192 * the target, and then the damage "flows" along this beam of destruction.
8193 * The damage at every grid is the same as at the "center" of a "ball"
8194 * explosion, since the "beam" grids are treated as if they ARE at the
8195 * center of a "ball" explosion.
8197 * Currently, specifying "beam" plus "ball" means that locations which are
8198 * covered by the initial "beam", and also covered by the final "ball", except
8199 * for the final grid (the epicenter of the ball), will be "hit twice", once
8200 * by the initial beam, and once by the exploding ball. For the grid right
8201 * next to the epicenter, this results in 150% damage being done. The center
8202 * does not have this problem, for the same reason the final grid in a "beam"
8203 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8204 * grids which are covered by the "ball" will NOT work, as then they will
8205 * receive LESS damage than they should. Do not combine "beam" with "ball".
8207 * The array "gy[],gx[]" with current size "grids" is used to hold the
8208 * collected locations of all grids in the "blast area" plus "beam path".
8210 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8211 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8212 * first blast grid (see above) with radius "N" from the blast center. Note
8213 * that only the first gm[1] grids in the blast area thus take full damage.
8214 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8215 * number of blast grids.
8217 * Note that once the projection is complete, (y2,x2) holds the final location
8218 * of bolts/beams, and the "epicenter" of balls.
8220 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8221 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8222 * implementation of the "distance" function. Also, a bolt can be properly
8223 * viewed as a "ball" with a "rad" of "zero".
8225 * Note that if no "target" is reached before the beam/bolt/ball travels the
8226 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8227 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8229 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8230 * to move from point A to point B, even if the player cannot see part of the
8231 * projection path. Note that in general, the player will *always* see part
8232 * of the path, since it either starts at the player or ends on the player.
8234 * Hack -- we assume that every "projection" is "self-illuminating".
8236 * Hack -- when only a single monster is affected, we automatically track
8237 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8239 * Note that all projections now "explode" at their final destination, even
8240 * if they were being projected at a more distant destination. This means
8241 * that "ball" spells will *always* explode.
8243 * Note that we must call "handle_stuff()" after affecting terrain features
8244 * in the blast radius, in case the "illumination" of the grid was changed,
8245 * and "update_view()" and "update_monsters()" need to be called.
8247 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8257 int y_saver, x_saver; /* For reflecting monsters */
8259 int msec = delay_factor * delay_factor * delay_factor;
8261 /* Assume the player sees nothing */
8262 bool notice = FALSE;
8264 /* Assume the player has seen nothing */
8265 bool visual = FALSE;
8267 /* Assume the player has seen no blast grids */
8270 /* Assume to be a normal ball spell */
8271 bool breath = FALSE;
8273 /* Is the player blind? */
8274 bool blind = (p_ptr->blind ? TRUE : FALSE);
8276 bool old_hide = FALSE;
8278 /* Number of grids in the "path" */
8281 /* Actual grids in the "path" */
8284 /* Number of grids in the "blast area" (including the "beam" path) */
8287 /* Coordinates of the affected grids */
8288 byte gx[1024], gy[1024];
8290 /* Encoded "radius" info (see above) */
8293 /* Actual radius encoded in gm[] */
8298 /* Attacker's name (prepared before polymorph)*/
8301 /* Can the player see the source of this effect? */
8302 bool see_s_msg = TRUE;
8304 /* Initialize by null string */
8310 /* Default target of monsterspell is player */
8311 monster_target_y=py;
8312 monster_target_x=px;
8314 /* Hack -- Jump to target */
8315 if (flg & (PROJECT_JUMP))
8320 /* Clear the flag */
8321 flg &= ~(PROJECT_JUMP);
8326 /* Start at player */
8333 /* Start at monster */
8336 x1 = m_list[who].fx;
8337 y1 = m_list[who].fy;
8338 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8351 /* Default "destination" */
8356 /* Hack -- verify stuff */
8357 if (flg & (PROJECT_THRU))
8359 if ((x1 == x2) && (y1 == y2))
8361 flg &= ~(PROJECT_THRU);
8365 /* Handle a breath attack */
8370 if (flg & PROJECT_HIDE) old_hide = TRUE;
8371 flg |= PROJECT_HIDE;
8375 /* Hack -- Assume there will be no blast (max radius 32) */
8376 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8384 /* Collect beam grids */
8385 if (flg & (PROJECT_BEAM))
8396 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8398 case GF_DISINTEGRATE:
8399 flg |= (PROJECT_GRID);
8400 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8404 /* Calculate the projection path */
8406 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8408 /* Hack -- Handle stuff */
8411 /* Giga-Hack SEEKER & SUPER_RAY */
8413 if( typ == GF_SEEKER )
8423 for (i = 0; i < path_n; ++i)
8428 int ny = GRID_Y(path_g[i]);
8429 int nx = GRID_X(path_g[i]);
8440 /* Only do visuals if requested */
8441 if (!blind && !(flg & (PROJECT_HIDE)))
8443 /* Only do visuals if the player can "see" the bolt */
8444 if (panel_contains(y, x) && player_has_los_bold(y, x))
8451 /* Obtain the bolt pict */
8452 p = bolt_pict(oy, ox, y, x, typ);
8454 /* Extract attr/char */
8458 /* Visual effects */
8459 print_rel(c, a, y, x);
8460 move_cursor_relative(y, x);
8461 /*if (fresh_before)*/ Term_fresh();
8462 Term_xtra(TERM_XTRA_DELAY, msec);
8464 /*if (fresh_before)*/ Term_fresh();
8466 /* Display "beam" grids */
8467 if (flg & (PROJECT_BEAM))
8469 /* Obtain the explosion pict */
8470 p = bolt_pict(y, x, y, x, typ);
8472 /* Extract attr/char */
8476 /* Visual effects */
8477 print_rel(c, a, y, x);
8480 /* Hack -- Activate delay */
8484 /* Hack -- delay anyway for consistency */
8487 /* Delay for consistency */
8488 Term_xtra(TERM_XTRA_DELAY, msec);
8491 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8492 if( is_mirror_grid(&cave[y][x]))
8494 /* The target of monsterspell becomes tha mirror(broken) */
8495 monster_target_y=(s16b)y;
8496 monster_target_x=(s16b)x;
8499 next_mirror( &oy,&ox,y,x );
8501 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8502 for( j = last_i; j <=i ; j++ )
8504 y = GRID_Y(path_g[j]);
8505 x = GRID_X(path_g[j]);
8506 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
8507 if(!who && (project_m_n==1) && !jump ){
8508 if(cave[project_m_y][project_m_x].m_idx >0 ){
8509 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8513 /* Hack -- auto-recall */
8514 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8516 /* Hack - auto-track */
8517 health_track(cave[project_m_y][project_m_x].m_idx);
8521 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8526 for( i = last_i ; i < path_n ; i++ )
8529 y = GRID_Y(path_g[i]);
8530 x = GRID_X(path_g[i]);
8531 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
8533 if(!who && (project_m_n==1) && !jump ){
8534 if(cave[project_m_y][project_m_x].m_idx >0 ){
8535 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8539 /* Hack -- auto-recall */
8540 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8542 /* Hack - auto-track */
8543 health_track(cave[project_m_y][project_m_x].m_idx);
8547 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8551 else if(typ == GF_SUPER_RAY){
8553 int second_step = 0;
8560 for (i = 0; i < path_n; ++i)
8565 int ny = GRID_Y(path_g[i]);
8566 int nx = GRID_X(path_g[i]);
8577 /* Only do visuals if requested */
8578 if (!blind && !(flg & (PROJECT_HIDE)))
8580 /* Only do visuals if the player can "see" the bolt */
8581 if (panel_contains(y, x) && player_has_los_bold(y, x))
8588 /* Obtain the bolt pict */
8589 p = bolt_pict(oy, ox, y, x, typ);
8591 /* Extract attr/char */
8595 /* Visual effects */
8596 print_rel(c, a, y, x);
8597 move_cursor_relative(y, x);
8598 /*if (fresh_before)*/ Term_fresh();
8599 Term_xtra(TERM_XTRA_DELAY, msec);
8601 /*if (fresh_before)*/ Term_fresh();
8603 /* Display "beam" grids */
8604 if (flg & (PROJECT_BEAM))
8606 /* Obtain the explosion pict */
8607 p = bolt_pict(y, x, y, x, typ);
8609 /* Extract attr/char */
8613 /* Visual effects */
8614 print_rel(c, a, y, x);
8617 /* Hack -- Activate delay */
8621 /* Hack -- delay anyway for consistency */
8624 /* Delay for consistency */
8625 Term_xtra(TERM_XTRA_DELAY, msec);
8628 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8629 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8631 if( second_step )continue;
8634 if( is_mirror_grid(&cave[y][x]) && !second_step )
8636 /* The target of monsterspell becomes tha mirror(broken) */
8637 monster_target_y=(s16b)y;
8638 monster_target_x=(s16b)x;
8641 for( j = 0; j <=i ; j++ )
8643 y = GRID_Y(path_g[j]);
8644 x = GRID_X(path_g[j]);
8645 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8649 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8650 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8651 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8652 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8653 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8654 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8655 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8656 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8659 for( i = 0; i < path_n ; i++ )
8662 y = GRID_Y(path_g[i]);
8663 x = GRID_X(path_g[i]);
8664 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
8665 if(!who && (project_m_n==1) && !jump ){
8666 if(cave[project_m_y][project_m_x].m_idx >0 ){
8667 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8671 /* Hack -- auto-recall */
8672 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8674 /* Hack - auto-track */
8675 health_track(cave[project_m_y][project_m_x].m_idx);
8679 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8684 /* Project along the path */
8685 for (i = 0; i < path_n; ++i)
8690 int ny = GRID_Y(path_g[i]);
8691 int nx = GRID_X(path_g[i]);
8693 if (flg & PROJECT_DISI)
8695 /* Hack -- Balls explode before reaching walls */
8696 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8698 else if (flg & PROJECT_LOS)
8700 /* Hack -- Balls explode before reaching walls */
8701 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8705 /* Hack -- Balls explode before reaching walls */
8706 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8713 /* Collect beam grids */
8714 if (flg & (PROJECT_BEAM))
8721 /* Only do visuals if requested */
8722 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8724 /* Only do visuals if the player can "see" the bolt */
8725 if (panel_contains(y, x) && player_has_los_bold(y, x))
8732 /* Obtain the bolt pict */
8733 p = bolt_pict(oy, ox, y, x, typ);
8735 /* Extract attr/char */
8739 /* Visual effects */
8740 print_rel(c, a, y, x);
8741 move_cursor_relative(y, x);
8742 /*if (fresh_before)*/ Term_fresh();
8743 Term_xtra(TERM_XTRA_DELAY, msec);
8745 /*if (fresh_before)*/ Term_fresh();
8747 /* Display "beam" grids */
8748 if (flg & (PROJECT_BEAM))
8750 /* Obtain the explosion pict */
8751 p = bolt_pict(y, x, y, x, typ);
8753 /* Extract attr/char */
8757 /* Visual effects */
8758 print_rel(c, a, y, x);
8761 /* Hack -- Activate delay */
8765 /* Hack -- delay anyway for consistency */
8768 /* Delay for consistency */
8769 Term_xtra(TERM_XTRA_DELAY, msec);
8776 /* Save the "blast epicenter" */
8780 if (breath && !path_n)
8786 flg &= ~(PROJECT_HIDE);
8790 /* Start the "explosion" */
8793 /* Hack -- make sure beams get to "explode" */
8801 /* If we found a "target", explode there */
8802 if (dist <= MAX_RANGE)
8804 /* Mega-Hack -- remove the final "beam" grid */
8805 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8808 * Create a conical breath attack
8819 flg &= ~(PROJECT_HIDE);
8821 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8825 /* Determine the blast area, work from the inside out */
8826 for (dist = 0; dist <= rad; dist++)
8828 /* Scan the maximal blast area of radius "dist" */
8829 for (y = by - dist; y <= by + dist; y++)
8831 for (x = bx - dist; x <= bx + dist; x++)
8833 /* Ignore "illegal" locations */
8834 if (!in_bounds2(y, x)) continue;
8836 /* Enforce a "circular" explosion */
8837 if (distance(by, bx, y, x) != dist) continue;
8843 /* Lights are stopped by opaque terrains */
8844 if (!los(by, bx, y, x)) continue;
8846 case GF_DISINTEGRATE:
8847 /* Disintegration are stopped only by perma-walls */
8848 if (!in_disintegration_range(by, bx, y, x)) continue;
8851 /* Ball explosions are stopped by walls */
8852 if (!projectable(by, bx, y, x)) continue;
8856 /* Save this grid */
8863 /* Encode some more "radius" info */
8869 /* Speed -- ignore "non-explosions" */
8870 if (!grids) return (FALSE);
8873 /* Display the "blast area" if requested */
8874 if (!blind && !(flg & (PROJECT_HIDE)))
8876 /* Then do the "blast", from inside out */
8877 for (t = 0; t <= gm_rad; t++)
8879 /* Dump everything with this radius */
8880 for (i = gm[t]; i < gm[t+1]; i++)
8882 /* Extract the location */
8886 /* Only do visuals if the player can "see" the blast */
8887 if (panel_contains(y, x) && player_has_los_bold(y, x))
8896 /* Obtain the explosion pict */
8897 p = bolt_pict(y, x, y, x, typ);
8899 /* Extract attr/char */
8903 /* Visual effects -- Display */
8904 print_rel(c, a, y, x);
8908 /* Hack -- center the cursor */
8909 move_cursor_relative(by, bx);
8911 /* Flush each "radius" seperately */
8912 /*if (fresh_before)*/ Term_fresh();
8914 /* Delay (efficiently) */
8915 if (visual || drawn)
8917 Term_xtra(TERM_XTRA_DELAY, msec);
8921 /* Flush the erasing */
8924 /* Erase the explosion drawn above */
8925 for (i = 0; i < grids; i++)
8927 /* Extract the location */
8931 /* Hack -- Erase if needed */
8932 if (panel_contains(y, x) && player_has_los_bold(y, x))
8938 /* Hack -- center the cursor */
8939 move_cursor_relative(by, bx);
8941 /* Flush the explosion */
8942 /*if (fresh_before)*/ Term_fresh();
8947 /* Update stuff if needed */
8948 if (p_ptr->update) update_stuff();
8951 if (flg & PROJECT_KILL)
8953 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
8954 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
8958 /* Check features */
8959 if (flg & (PROJECT_GRID))
8961 /* Start with "dist" of zero */
8964 /* Scan for features */
8965 for (i = 0; i < grids; i++)
8967 /* Hack -- Notice new "dist" values */
8968 if (gm[dist+1] == i) dist++;
8970 /* Get the grid location */
8974 /* Find the closest point in the blast */
8977 int d = dist_to_line(y, x, y1, x1, by, bx);
8979 /* Affect the grid */
8980 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8984 /* Affect the grid */
8985 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8990 /* Update stuff if needed */
8991 if (p_ptr->update) update_stuff();
8994 if (flg & (PROJECT_ITEM))
8996 /* Start with "dist" of zero */
8999 /* Scan for objects */
9000 for (i = 0; i < grids; i++)
9002 /* Hack -- Notice new "dist" values */
9003 if (gm[dist+1] == i) dist++;
9005 /* Get the grid location */
9009 /* Find the closest point in the blast */
9012 int d = dist_to_line(y, x, y1, x1, by, bx);
9014 /* Affect the object in the grid */
9015 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
9019 /* Affect the object in the grid */
9020 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
9026 /* Check monsters */
9027 if (flg & (PROJECT_KILL))
9034 /* Start with "dist" of zero */
9037 /* Scan for monsters */
9038 for (i = 0; i < grids; i++)
9042 /* Hack -- Notice new "dist" values */
9043 if (gm[dist + 1] == i) dist++;
9045 /* Get the grid location */
9049 /* A single bolt may be reflected */
9052 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9053 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9055 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
9056 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
9057 (!who || dist_hack > 1) && !one_in_(10))
9060 int max_attempts = 10;
9062 /* Choose 'new' target */
9065 t_y = y_saver - 1 + randint1(3);
9066 t_x = x_saver - 1 + randint1(3);
9069 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9071 if (max_attempts < 1)
9080 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9081 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9082 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9083 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9085 msg_print("The attack bounces!");
9088 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9090 /* Reflected bolts randomly target either one */
9091 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
9092 else flg |= PROJECT_PLAYER;
9094 /* The bolt is reflected */
9095 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9097 /* Don't affect the monster any longer */
9103 /* Find the closest point in the blast */
9106 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9110 effective_dist = dist;
9114 /* There is the riding player on this monster */
9115 if (p_ptr->riding && player_bold(y, x))
9117 /* Aimed on the player */
9118 if (flg & PROJECT_PLAYER)
9120 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9123 * A beam or bolt is well aimed
9125 * So don't affects the mount.
9132 * The spell is not well aimed,
9133 * So partly affect the mount too.
9140 * This grid is the original target.
9141 * Or aimed on your horse.
9143 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9145 /* Hit the mount with full damage */
9149 * Otherwise this grid is not the
9150 * original target, it means that line
9151 * of fire is obstructed by this
9155 * A beam or bolt will hit either
9156 * player or mount. Choose randomly.
9158 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9162 /* Hit the mount with full damage */
9166 /* Hit the player later */
9167 flg |= PROJECT_PLAYER;
9169 /* Don't affect the mount */
9175 * The spell is not well aimed, so
9176 * partly affect both player and
9185 /* Affect the monster in the grid */
9186 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
9190 /* Player affected one monster (without "jumping") */
9191 if (!who && (project_m_n == 1) && !jump)
9197 /* Track if possible */
9198 if (cave[y][x].m_idx > 0)
9200 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9204 /* Hack -- auto-recall */
9205 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
9207 /* Hack - auto-track */
9208 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9216 if (flg & (PROJECT_KILL))
9218 /* Start with "dist" of zero */
9221 /* Scan for player */
9222 for (i = 0; i < grids; i++)
9226 /* Hack -- Notice new "dist" values */
9227 if (gm[dist+1] == i) dist++;
9229 /* Get the grid location */
9233 /* Affect the player? */
9234 if (!player_bold(y, x)) continue;
9236 /* Find the closest point in the blast */
9239 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9243 effective_dist = dist;
9246 /* Target may be your horse */
9249 /* Aimed on the player */
9250 if (flg & PROJECT_PLAYER)
9252 /* Hit the player with full damage */
9256 * Hack -- When this grid was not the
9257 * original target, a beam or bolt
9258 * would hit either player or mount,
9259 * and should be choosen randomly.
9261 * But already choosen to hit the
9262 * mount at this point.
9264 * Or aimed on your horse.
9266 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9269 * A beam or bolt is well aimed
9271 * So don't affects the player.
9278 * The spell is not well aimed,
9279 * So partly affect the player too.
9285 /* Affect the player */
9286 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9294 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9296 if (rakubadam_m > 0)
9298 if (rakuba(rakubadam_m, FALSE))
9301 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9303 msg_format("%^s has thrown you off!", m_name);
9307 if (p_ptr->riding && rakubadam_p > 0)
9309 if(rakuba(rakubadam_p, FALSE))
9312 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9314 msg_format("You have fallen from %s.", m_name);
9320 /* Return "something was noticed" */
9324 bool binding_field( int dam )
9326 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9327 int mirror_num=0; /* ¶À¤Î¿ô */
9332 int msec= delay_factor*delay_factor*delay_factor;
9338 /* Default target of monsterspell is player */
9339 monster_target_y=py;
9340 monster_target_x=px;
9342 for( x=0 ; x < cur_wid ; x++ )
9344 for( y=0 ; y < cur_hgt ; y++ )
9346 if( is_mirror_grid(&cave[y][x]) &&
9347 distance(py,px,y,x) <= MAX_RANGE &&
9348 distance(py,px,y,x) != 0 &&
9349 player_has_los_bold(y,x) &&
9350 projectable(py, px, y, x)
9352 mirror_y[mirror_num]=y;
9353 mirror_x[mirror_num]=x;
9359 if( mirror_num < 2 )return FALSE;
9361 point_x[0] = randint0( mirror_num );
9363 point_x[1] = randint0( mirror_num );
9365 while( point_x[0] == point_x[1] );
9367 point_y[0]=mirror_y[point_x[0]];
9368 point_x[0]=mirror_x[point_x[0]];
9369 point_y[1]=mirror_y[point_x[1]];
9370 point_x[1]=mirror_x[point_x[1]];
9374 x=point_x[0]+point_x[1]+point_x[2];
9375 y=point_y[0]+point_y[1]+point_y[2];
9377 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9378 - (point_y[0]*3-y)*(point_x[1]*3-x);
9379 if( centersign == 0 )return FALSE;
9381 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9382 x1 = x1 < point_x[2] ? x1 : point_x[2];
9383 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9384 y1 = y1 < point_y[2] ? y1 : point_y[2];
9386 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9387 x2 = x2 > point_x[2] ? x2 : point_x[2];
9388 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9389 y2 = y2 > point_y[2] ? y2 : point_y[2];
9391 for( y=y1 ; y <=y2 ; y++ ){
9392 for( x=x1 ; x <=x2 ; x++ ){
9393 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9394 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9395 centersign*( (point_x[1]-x)*(point_y[2]-y)
9396 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9397 centersign*( (point_x[2]-x)*(point_y[0]-y)
9398 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9400 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9401 /* Visual effects */
9403 && panel_contains(y,x)){
9404 p = bolt_pict(y,x,y,x, GF_MANA );
9405 print_rel(PICT_C(p), PICT_A(p),y,x);
9406 move_cursor_relative(y, x);
9407 /*if (fresh_before)*/ Term_fresh();
9408 Term_xtra(TERM_XTRA_DELAY, msec);
9414 for( y=y1 ; y <=y2 ; y++ ){
9415 for( x=x1 ; x <=x2 ; x++ ){
9416 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9417 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9418 centersign*( (point_x[1]-x)*(point_y[2]-y)
9419 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9420 centersign*( (point_x[2]-x)*(point_y[0]-y)
9421 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9423 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9424 (void)project_f(0,0,y,x,dam,GF_MANA);
9429 for( y=y1 ; y <=y2 ; y++ ){
9430 for( x=x1 ; x <=x2 ; x++ ){
9431 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9432 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9433 centersign*( (point_x[1]-x)*(point_y[2]-y)
9434 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9435 centersign*( (point_x[2]-x)*(point_y[0]-y)
9436 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9438 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9439 (void)project_o(0,0,y,x,dam,GF_MANA);
9444 for( y=y1 ; y <=y2 ; y++ ){
9445 for( x=x1 ; x <=x2 ; x++ ){
9446 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9447 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9448 centersign*( (point_x[1]-x)*(point_y[2]-y)
9449 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9450 centersign*( (point_x[2]-x)*(point_y[0]-y)
9451 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9453 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9454 (void)project_m(0,0,y,x,dam,GF_MANA,
9455 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
9462 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9464 msg_print("The field broke a mirror");
9466 remove_mirror(point_y[0],point_x[0]);
9472 void seal_of_mirror( int dam )
9476 for( x = 0 ; x < cur_wid ; x++ )
9478 for( y = 0 ; y < cur_hgt ; y++ )
9480 if( is_mirror_grid(&cave[y][x]))
9482 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9483 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
9485 if( !cave[y][x].m_idx )