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 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
2979 msg_format("You convert %s%s pain into psychic energy!",
2980 m_name, (seen ? "'s" : "s"));
2983 b = MIN(p_ptr->msp, p_ptr->csp + b);
2985 p_ptr->redraw |= PR_MANA;
2986 p_ptr->window |= (PW_SPELL);
2990 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2992 note_dies = " collapses, a mindless husk.";
2998 case GF_TELEKINESIS:
3000 if (seen) obvious = TRUE;
3002 if (r_ptr->flagsr & RFR_RES_ALL)
3005 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3007 note = " is immune.";
3010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3015 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3020 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3022 /* Attempt a saving throw */
3023 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3024 (r_ptr->level > 5 + randint1(dam)))
3028 /* No obvious effect */
3034 /* Psycho-spear -- powerful magic missile */
3037 if (seen) obvious = TRUE;
3039 if (r_ptr->flagsr & RFR_RES_ALL)
3042 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3044 note = " is immune.";
3047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3053 /* Meteor -- powerful magic missile */
3056 if (seen) obvious = TRUE;
3058 if (r_ptr->flagsr & RFR_RES_ALL)
3061 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3063 note = " is immune.";
3066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3074 if (!is_hostile(m_ptr)) break;
3076 if (seen) obvious = TRUE;
3078 if (r_ptr->flagsr & RFR_RES_ALL)
3081 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3083 note = " is immune.";
3086 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3089 /* Attempt a saving throw */
3090 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3091 (r_ptr->flags3 & RF3_NO_CONF) ||
3092 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3094 /* Memorize a flag */
3095 if (r_ptr->flags3 & RF3_NO_CONF)
3097 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3104 * Powerful demons & undead can turn a mindcrafter's
3105 * attacks back on them
3107 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3108 (r_ptr->level > p_ptr->lev / 2) &&
3113 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3115 msg_format("%^s%s corrupted mind backlashes your attack!",
3116 m_name, (seen ? "'s" : "s"));
3120 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3123 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3125 msg_print("You resist the effects!");
3131 /* Confuse, stun, terrify */
3132 switch (randint1(4))
3135 set_stun(p_ptr->stun + dam / 2);
3138 set_confused(p_ptr->confused + dam / 2);
3142 if (r_ptr->flags3 & RF3_NO_FEAR)
3144 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3146 note = " is unaffected.";
3150 set_afraid(p_ptr->afraid + dam);
3157 /* No obvious effect */
3159 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3161 note = " is unaffected!";
3169 if ((dam > 29) && (randint1(100) < dam))
3172 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3174 note = " is in your thrall!";
3181 switch (randint1(4))
3195 /* No "real" damage */
3202 /* Ice -- Cold + Cuts + Stun */
3205 if (seen) obvious = TRUE;
3207 if (r_ptr->flagsr & RFR_RES_ALL)
3210 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3212 note = " is immune.";
3215 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3218 do_stun = (randint1(15) + 1) / (r + 1);
3219 if (r_ptr->flagsr & RFR_IM_COLD)
3222 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3224 note = " resists a lot.";
3228 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3230 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3233 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3235 note = " is hit hard.";
3239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3248 if (seen) obvious = TRUE;
3250 if (r_ptr->flagsr & RFR_RES_ALL)
3253 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3255 note = " is immune.";
3258 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3261 if (!monster_living(r_ptr))
3263 if (is_original_ap_and_seen(m_ptr))
3265 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3266 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3267 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3271 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3273 note = " is unaffected!";
3279 else do_time = (dam+7)/8;
3287 if (seen) obvious = TRUE;
3289 if (r_ptr->flagsr & RFR_RES_ALL)
3292 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3294 note = " is immune.";
3297 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3300 if (!monster_living(r_ptr))
3302 if (is_original_ap_and_seen(m_ptr))
3304 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3305 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3306 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3310 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3312 note = " is immune.";
3318 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3319 (randint1(888) != 666)) ||
3320 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3321 randint1(100) != 66))
3324 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3336 /* Polymorph monster (Use "dam" as "power") */
3339 if (seen) obvious = TRUE;
3341 if (r_ptr->flagsr & RFR_RES_ALL)
3344 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3346 note = " is immune.";
3349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3352 /* Attempt to polymorph (see below) */
3355 /* Powerful monsters can resist */
3356 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3357 (r_ptr->flags1 & RF1_QUESTOR) ||
3358 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3361 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3363 note = " is unaffected!";
3370 /* No "real" damage */
3377 /* Clone monsters (Ignore "dam") */
3380 if (seen) obvious = TRUE;
3382 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3385 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3387 note = " is unaffected!";
3393 m_ptr->hp = m_ptr->maxhp;
3395 /* Attempt to clone. */
3396 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3399 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3407 /* No "real" damage */
3414 /* Heal Monster (use "dam" as amount of healing) */
3417 if (seen) obvious = TRUE;
3420 (void)set_monster_csleep(c_ptr->m_idx, 0);
3422 if (m_ptr->maxhp < m_ptr->max_maxhp)
3425 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3427 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3429 m_ptr->maxhp = m_ptr->max_maxhp;
3434 /* Redraw (later) if needed */
3435 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3436 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3444 if (seen) obvious = TRUE;
3447 (void)set_monster_csleep(c_ptr->m_idx, 0);
3448 if (MON_STUNNED(m_ptr))
3451 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3453 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3455 (void)set_monster_stunned(c_ptr->m_idx, 0);
3457 if (MON_CONFUSED(m_ptr))
3460 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3462 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3464 (void)set_monster_confused(c_ptr->m_idx, 0);
3466 if (MON_MONFEAR(m_ptr))
3469 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3471 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3473 (void)set_monster_monfear(c_ptr->m_idx, 0);
3477 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3480 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3484 chg_virtue(V_VITALITY, 1);
3486 if (r_ptr->flags1 & RF1_UNIQUE)
3487 chg_virtue(V_INDIVIDUALISM, 1);
3489 if (is_friendly(m_ptr))
3490 chg_virtue(V_HONOUR, 1);
3491 else if (!(r_ptr->flags3 & RF3_EVIL))
3493 if (r_ptr->flags3 & RF3_GOOD)
3494 chg_virtue(V_COMPASSION, 2);
3496 chg_virtue(V_COMPASSION, 1);
3499 if (r_ptr->flags3 & RF3_ANIMAL)
3500 chg_virtue(V_NATURE, 1);
3503 if (m_ptr->r_idx == MON_LEPER)
3506 if (!who) chg_virtue(V_COMPASSION, 5);
3509 /* Redraw (later) if needed */
3510 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3511 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3515 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3517 note = " looks healthier.";
3520 /* No "real" damage */
3526 /* Speed Monster (Ignore "dam") */
3529 if (seen) obvious = TRUE;
3532 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3535 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3537 note = " starts moving faster.";
3543 if (r_ptr->flags1 & RF1_UNIQUE)
3544 chg_virtue(V_INDIVIDUALISM, 1);
3545 if (is_friendly(m_ptr))
3546 chg_virtue(V_HONOUR, 1);
3549 /* No "real" damage */
3555 /* Slow Monster (Use "dam" as "power") */
3558 if (seen) obvious = TRUE;
3560 if (r_ptr->flagsr & RFR_RES_ALL)
3563 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3565 note = " is immune.";
3568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3571 /* Powerful monsters can resist */
3572 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3573 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3576 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3578 note = " is unaffected!";
3584 /* Normal monsters slow down */
3587 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3590 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3592 note = " starts moving slower.";
3597 /* No "real" damage */
3603 /* Sleep (Use "dam" as "power") */
3606 if (seen) obvious = TRUE;
3608 if (r_ptr->flagsr & RFR_RES_ALL)
3611 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3613 note = " is immune.";
3616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3619 /* Attempt a saving throw */
3620 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3621 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3622 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3624 /* Memorize a flag */
3625 if (r_ptr->flags3 & RF3_NO_SLEEP)
3627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3630 /* No obvious effect */
3632 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3634 note = " is unaffected!";
3641 /* Go to sleep (much) later */
3643 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3645 note = " falls asleep!";
3651 /* No "real" damage */
3657 /* Sleep (Use "dam" as "power") */
3658 case GF_STASIS_EVIL:
3660 if (seen) obvious = TRUE;
3662 if (r_ptr->flagsr & RFR_RES_ALL)
3665 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3667 note = " is immune.";
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3673 /* Attempt a saving throw */
3674 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3675 !(r_ptr->flags3 & RF3_EVIL) ||
3676 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3679 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3681 note = " is unaffected!";
3688 /* Go to sleep (much) later */
3690 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3692 note = " is suspended!";
3698 /* No "real" damage */
3703 /* Sleep (Use "dam" as "power") */
3706 if (seen) obvious = TRUE;
3708 if (r_ptr->flagsr & RFR_RES_ALL)
3711 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3713 note = " is immune.";
3716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3719 /* Attempt a saving throw */
3720 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3721 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3724 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3726 note = " is unaffected!";
3733 /* Go to sleep (much) later */
3735 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3737 note = " is suspended!";
3743 /* No "real" damage */
3752 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3753 vir = virtue_number(V_HARMONY);
3756 dam += p_ptr->virtues[vir-1]/10;
3759 vir = virtue_number(V_INDIVIDUALISM);
3762 dam -= p_ptr->virtues[vir-1]/20;
3765 if (seen) obvious = TRUE;
3767 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3770 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3772 note = " is immune.";
3775 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3779 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3782 /* Attempt a saving throw */
3783 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3784 (r_ptr->flags3 & RF3_NO_CONF) ||
3785 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3786 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3788 /* Memorize a flag */
3789 if (r_ptr->flags3 & RF3_NO_CONF)
3791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3795 /* No obvious effect */
3797 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3799 note = " is unaffected!";
3804 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3806 else if (p_ptr->cursed & TRC_AGGRAVATE)
3809 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3811 note = " hates you too much!";
3814 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3819 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3821 note = " suddenly seems friendly!";
3826 chg_virtue(V_INDIVIDUALISM, -1);
3827 if (r_ptr->flags3 & RF3_ANIMAL)
3828 chg_virtue(V_NATURE, 1);
3831 /* No "real" damage */
3836 /* Control undead */
3837 case GF_CONTROL_UNDEAD:
3840 if (seen) obvious = TRUE;
3842 vir = virtue_number(V_UNLIFE);
3845 dam += p_ptr->virtues[vir-1]/10;
3848 vir = virtue_number(V_INDIVIDUALISM);
3851 dam -= p_ptr->virtues[vir-1]/20;
3854 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3857 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3859 note = " is immune.";
3862 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3866 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3869 /* Attempt a saving throw */
3870 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3871 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3872 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3873 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3875 /* No obvious effect */
3877 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3879 note = " is unaffected!";
3883 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3885 else if (p_ptr->cursed & TRC_AGGRAVATE)
3888 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3890 note = " hates you too much!";
3893 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3898 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3900 note = " is in your thrall!";
3906 /* No "real" damage */
3912 case GF_CONTROL_DEMON:
3915 if (seen) obvious = TRUE;
3917 vir = virtue_number(V_UNLIFE);
3920 dam += p_ptr->virtues[vir-1]/10;
3923 vir = virtue_number(V_INDIVIDUALISM);
3926 dam -= p_ptr->virtues[vir-1]/20;
3929 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3932 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3934 note = " is immune.";
3937 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3941 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3944 /* Attempt a saving throw */
3945 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3946 (!(r_ptr->flags3 & RF3_DEMON)) ||
3947 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3948 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3950 /* No obvious effect */
3952 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3954 note = " is unaffected!";
3958 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3960 else if (p_ptr->cursed & TRC_AGGRAVATE)
3963 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3965 note = " hates you too much!";
3968 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3973 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3975 note = " is in your thrall!";
3981 /* No "real" damage */
3987 case GF_CONTROL_ANIMAL:
3991 if (seen) obvious = TRUE;
3993 vir = virtue_number(V_NATURE);
3996 dam += p_ptr->virtues[vir-1]/10;
3999 vir = virtue_number(V_INDIVIDUALISM);
4002 dam -= p_ptr->virtues[vir-1]/20;
4005 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4008 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4010 note = " is immune.";
4013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4017 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4020 /* Attempt a saving throw */
4021 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4022 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4023 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4024 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4025 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4027 /* Memorize a flag */
4028 if (r_ptr->flags3 & (RF3_NO_CONF))
4030 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4034 /* No obvious effect */
4036 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4038 note = " is unaffected!";
4042 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4044 else if (p_ptr->cursed & TRC_AGGRAVATE)
4047 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4049 note = " hates you too much!";
4052 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4057 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4059 note = " is tamed!";
4064 if (r_ptr->flags3 & RF3_ANIMAL)
4065 chg_virtue(V_NATURE, 1);
4068 /* No "real" damage */
4074 case GF_CONTROL_LIVING:
4078 vir = virtue_number(V_UNLIFE);
4079 if (seen) obvious = TRUE;
4081 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4082 vir = virtue_number(V_UNLIFE);
4085 dam -= p_ptr->virtues[vir-1]/10;
4088 vir = virtue_number(V_INDIVIDUALISM);
4091 dam -= p_ptr->virtues[vir-1]/20;
4094 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4095 if (dam < 1) dam = 1;
4097 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4099 msg_format("You stare into %s.", m_name);
4101 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4104 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4106 note = " is immune.";
4109 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4113 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4116 /* Attempt a saving throw */
4117 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4118 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4119 !monster_living(r_ptr) ||
4120 ((r_ptr->level+10) > randint1(dam)))
4123 /* No obvious effect */
4125 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4127 note = " is unaffected!";
4131 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4133 else if (p_ptr->cursed & TRC_AGGRAVATE)
4136 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4138 note = " hates you too much!";
4141 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4146 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4148 note = " is tamed!";
4153 if (r_ptr->flags3 & RF3_ANIMAL)
4154 chg_virtue(V_NATURE, 1);
4157 /* No "real" damage */
4162 /* Confusion (Use "dam" as "power") */
4165 if (seen) obvious = TRUE;
4167 if (r_ptr->flagsr & RFR_RES_ALL)
4170 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4172 note = " is immune.";
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4178 /* Get confused later */
4179 do_conf = damroll(3, (dam / 2)) + 1;
4181 /* Attempt a saving throw */
4182 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4183 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4184 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4186 /* Memorize a flag */
4187 if (r_ptr->flags3 & (RF3_NO_CONF))
4189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4195 /* No obvious effect */
4197 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4199 note = " is unaffected!";
4205 /* No "real" damage */
4212 if (seen) obvious = TRUE;
4214 if (r_ptr->flagsr & RFR_RES_ALL)
4217 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4219 note = " is immune.";
4222 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4225 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4227 /* Attempt a saving throw */
4228 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4229 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4234 /* No obvious effect */
4236 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4238 note = " is unaffected!";
4244 /* No "real" damage */
4252 /* Lite, but only hurts susceptible creatures */
4260 if (r_ptr->flagsr & RFR_RES_ALL)
4266 if (r_ptr->flags3 & (RF3_HURT_LITE))
4268 /* Obvious effect */
4269 if (seen) obvious = TRUE;
4271 /* Memorize the effects */
4272 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4274 /* Special effect */
4276 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4277 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4279 note = " cringes from the light!";
4280 note_dies = " shrivels away in the light!";
4285 /* Normally no damage */
4297 /* Lite -- opposite of Dark */
4300 if (seen) obvious = TRUE;
4302 if (r_ptr->flagsr & RFR_RES_ALL)
4305 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4307 note = " is immune.";
4310 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4313 if (r_ptr->flagsr & RFR_RES_LITE)
4316 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4321 dam *= 2; dam /= (randint1(6)+6);
4322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4324 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4326 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4328 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4329 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4331 note = " cringes from the light!";
4332 note_dies = " shrivels away in the light!";
4341 /* Dark -- opposite of Lite */
4344 if (seen) obvious = TRUE;
4346 if (r_ptr->flagsr & RFR_RES_ALL)
4349 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4351 note = " is immune.";
4354 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4357 if (r_ptr->flagsr & RFR_RES_DARK)
4360 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4365 dam *= 2; dam /= (randint1(6)+6);
4366 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4375 if (r_ptr->flagsr & RFR_RES_ALL)
4380 /* Hurt by rock remover */
4381 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4384 if (seen) obvious = TRUE;
4386 /* Memorize the effects */
4387 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4389 /* Cute little message */
4391 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4392 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4394 note = " loses some skin!";
4395 note_dies = " dissolves!";
4400 /* Usually, ignore the effects */
4411 /* Teleport undead (Use "dam" as "power") */
4412 case GF_AWAY_UNDEAD:
4414 /* Only affect undead */
4415 if (r_ptr->flags3 & (RF3_UNDEAD))
4417 bool resists_tele = FALSE;
4419 if (r_ptr->flagsr & RFR_RES_TELE)
4421 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4425 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4427 note = " is unaffected!";
4430 resists_tele = TRUE;
4432 else if (r_ptr->level > randint1(100))
4434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4436 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4441 resists_tele = TRUE;
4447 if (seen) obvious = TRUE;
4448 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4460 /* No "real" damage */
4466 /* Teleport evil (Use "dam" as "power") */
4469 /* Only affect evil */
4470 if (r_ptr->flags3 & (RF3_EVIL))
4472 bool resists_tele = FALSE;
4474 if (r_ptr->flagsr & RFR_RES_TELE)
4476 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4478 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4480 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4482 note = " is unaffected!";
4485 resists_tele = TRUE;
4487 else if (r_ptr->level > randint1(100))
4489 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4491 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4496 resists_tele = TRUE;
4502 if (seen) obvious = TRUE;
4503 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4515 /* No "real" damage */
4521 /* Teleport monster (Use "dam" as "power") */
4524 bool resists_tele = FALSE;
4525 if (r_ptr->flagsr & RFR_RES_TELE)
4527 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4529 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4531 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4533 note = " is unaffected!";
4536 resists_tele = TRUE;
4538 else if (r_ptr->level > randint1(100))
4540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4542 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4547 resists_tele = TRUE;
4554 if (seen) obvious = TRUE;
4556 /* Prepare to teleport */
4560 /* No "real" damage */
4566 /* Turn undead (Use "dam" as "power") */
4567 case GF_TURN_UNDEAD:
4569 if (r_ptr->flagsr & RFR_RES_ALL)
4574 /* Only affect undead */
4575 if (r_ptr->flags3 & (RF3_UNDEAD))
4578 if (seen) obvious = TRUE;
4580 /* Learn about type */
4581 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4583 /* Apply some fear */
4584 do_fear = damroll(3, (dam / 2)) + 1;
4586 /* Attempt a saving throw */
4587 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4589 /* No obvious effect */
4591 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4593 note = " is unaffected!";
4608 /* No "real" damage */
4614 /* Turn evil (Use "dam" as "power") */
4617 if (r_ptr->flagsr & RFR_RES_ALL)
4622 /* Only affect evil */
4623 if (r_ptr->flags3 & (RF3_EVIL))
4626 if (seen) obvious = TRUE;
4628 /* Learn about type */
4629 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4631 /* Apply some fear */
4632 do_fear = damroll(3, (dam / 2)) + 1;
4634 /* Attempt a saving throw */
4635 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4637 /* No obvious effect */
4639 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4641 note = " is unaffected!";
4656 /* No "real" damage */
4662 /* Turn monster (Use "dam" as "power") */
4665 if (r_ptr->flagsr & RFR_RES_ALL)
4671 if (seen) obvious = TRUE;
4673 /* Apply some fear */
4674 do_fear = damroll(3, (dam / 2)) + 1;
4676 /* Attempt a saving throw */
4677 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4678 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4679 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4681 /* No obvious effect */
4683 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4685 note = " is unaffected!";
4692 /* No "real" damage */
4699 case GF_DISP_UNDEAD:
4701 if (r_ptr->flagsr & RFR_RES_ALL)
4707 /* Only affect undead */
4708 if (r_ptr->flags3 & (RF3_UNDEAD))
4711 if (seen) obvious = TRUE;
4713 /* Learn about type */
4714 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4718 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4719 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4721 note = " shudders.";
4722 note_dies = " dissolves!";
4743 if (r_ptr->flagsr & RFR_RES_ALL)
4749 /* Only affect evil */
4750 if (r_ptr->flags3 & (RF3_EVIL))
4753 if (seen) obvious = TRUE;
4755 /* Learn about type */
4756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4760 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4761 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4763 note = " shudders.";
4764 note_dies = " dissolves!";
4784 if (r_ptr->flagsr & RFR_RES_ALL)
4790 /* Only affect good */
4791 if (r_ptr->flags3 & (RF3_GOOD))
4794 if (seen) obvious = TRUE;
4796 /* Learn about type */
4797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4801 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4802 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4804 note = " shudders.";
4805 note_dies = " dissolves!";
4823 case GF_DISP_LIVING:
4825 if (r_ptr->flagsr & RFR_RES_ALL)
4831 /* Only affect non-undead */
4832 if (monster_living(r_ptr))
4835 if (seen) obvious = TRUE;
4839 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4840 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4842 note = " shudders.";
4843 note_dies = " dissolves!";
4864 if (r_ptr->flagsr & RFR_RES_ALL)
4870 /* Only affect demons */
4871 if (r_ptr->flags3 & (RF3_DEMON))
4874 if (seen) obvious = TRUE;
4876 /* Learn about type */
4877 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4881 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4882 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4884 note = " shudders.";
4885 note_dies = " dissolves!";
4902 /* Dispel monster */
4905 if (r_ptr->flagsr & RFR_RES_ALL)
4912 if (seen) obvious = TRUE;
4916 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4917 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4919 note = " shudders.";
4920 note_dies = " dissolves!";
4930 if (seen) obvious = TRUE;
4932 if (r_ptr->flagsr & RFR_RES_ALL)
4935 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4937 note = " is immune.";
4940 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4944 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4948 /* Heal the monster */
4949 if (caster_ptr->hp < caster_ptr->maxhp)
4952 caster_ptr->hp += 6 * dam;
4953 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4955 /* Redraw (later) if needed */
4956 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4957 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4959 /* Special message */
4962 /* Get the monster name */
4963 monster_desc(killer, caster_ptr, 0);
4965 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4967 msg_format("%^s appears healthier.", killer);
4976 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4978 msg_format("You draw psychic energy from %s.", m_name);
4981 (void)hp_player(dam);
4987 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4989 if (see_s_msg) msg_format("%s is unaffected.", m_name);
4999 if (seen) obvious = TRUE;
5002 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5004 if (!who) msg_format("You gaze intently at %s.", m_name);
5007 if (r_ptr->flagsr & RFR_RES_ALL)
5010 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5012 note = " is immune.";
5015 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5019 /* Attempt a saving throw */
5020 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5021 (r_ptr->flags3 & RF3_NO_CONF) ||
5022 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5024 /* Memorize a flag */
5025 if (r_ptr->flags3 & (RF3_NO_CONF))
5027 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5030 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5032 note = "is unaffected!";
5036 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5038 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5040 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5042 note = " is immune!";
5046 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5048 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5050 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5059 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5060 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5062 note = " is blasted by psionic energy.";
5063 note_dies = " collapses, a mindless husk.";
5066 if (who > 0) do_conf = randint0(4) + 4;
5067 else do_conf = randint0(8) + 8;
5073 case GF_BRAIN_SMASH:
5075 if (seen) obvious = TRUE;
5078 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5080 if (!who) msg_format("You gaze intently at %s.", m_name);
5083 if (r_ptr->flagsr & RFR_RES_ALL)
5086 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5088 note = " is immune.";
5091 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5095 /* Attempt a saving throw */
5096 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5097 (r_ptr->flags3 & RF3_NO_CONF) ||
5098 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5100 /* Memorize a flag */
5101 if (r_ptr->flags3 & (RF3_NO_CONF))
5103 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5106 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5108 note = "is unaffected!";
5112 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5116 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5118 note = " is immune!";
5122 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5126 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5135 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5136 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5138 note = " is blasted by psionic energy.";
5139 note_dies = " collapses, a mindless husk.";
5144 do_conf = randint0(4) + 4;
5145 do_stun = randint0(4) + 4;
5149 do_conf = randint0(8) + 8;
5150 do_stun = randint0(8) + 8;
5152 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
5160 if (seen) obvious = TRUE;
5163 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5165 if (!who) msg_format("You point at %s and curse.", m_name);
5168 if (r_ptr->flagsr & RFR_RES_ALL)
5171 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5173 note = " is immune.";
5176 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5180 /* Attempt a saving throw */
5181 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5184 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5186 note = "is unaffected!";
5196 if (seen) obvious = TRUE;
5199 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5201 if (!who) msg_format("You point at %s and curse horribly.", m_name);
5204 if (r_ptr->flagsr & RFR_RES_ALL)
5207 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5209 note = " is immune.";
5212 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5216 /* Attempt a saving throw */
5217 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5220 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5222 note = "is unaffected!";
5232 if (seen) obvious = TRUE;
5235 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5237 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5240 if (r_ptr->flagsr & RFR_RES_ALL)
5243 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5245 note = " is immune.";
5248 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5252 /* Attempt a saving throw */
5253 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5256 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5258 note = "is unaffected!";
5268 if (seen) obvious = TRUE;
5271 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5273 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5276 if (r_ptr->flagsr & RFR_RES_ALL)
5279 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5281 note = " is immune.";
5284 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5288 /* Attempt a saving throw */
5289 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5292 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5294 note = "is unaffected!";
5304 if (seen) obvious = TRUE;
5306 if (r_ptr->flagsr & RFR_RES_ALL)
5309 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5311 note = " is immune.";
5314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5318 if (r_ptr->flags1 & RF1_UNIQUE)
5321 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5323 note = "is unaffected!";
5329 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5330 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5332 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5334 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5339 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5349 /* Capture monster */
5353 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5354 (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)
5357 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5359 msg_format("%^s is unaffected.", m_name);
5365 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
5366 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5367 nokori_hp = m_ptr->maxhp * 3 / 10;
5369 nokori_hp = m_ptr->maxhp * 3 / 20;
5371 if (m_ptr->hp >= nokori_hp)
5374 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5376 msg_format("You need to weaken %s more.", m_name);
5380 else if (m_ptr->hp < randint0(nokori_hp))
5382 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5384 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5386 msg_format("You capture %^s!", m_name);
5388 cap_mon = m_ptr->r_idx;
5389 cap_mspeed = m_ptr->mspeed;
5391 cap_maxhp = m_ptr->max_maxhp;
5392 cap_nickname = m_ptr->nickname; /* Quark transfer */
5393 if (c_ptr->m_idx == p_ptr->riding)
5395 if (rakuba(-1, FALSE))
5398 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5400 msg_format("You have fallen from %s.", m_name);
5405 delete_monster_idx(c_ptr->m_idx);
5412 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5414 msg_format("You failed to capture %s.", m_name);
5421 /* Attack (Use "dam" as attack type) */
5424 /* Return this monster's death */
5425 return py_attack(y, x, dam);
5428 /* Sleep (Use "dam" as "power") */
5434 if (seen) obvious = TRUE;
5436 if (r_ptr->flagsr & RFR_RES_ALL)
5439 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5441 note = " is immune.";
5444 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5447 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5450 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5452 note = " is immune!";
5456 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5459 if (MON_CSLEEP(m_ptr))
5462 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5464 note = " is immune!";
5471 if (one_in_(5)) effect = 1;
5472 else if (one_in_(4)) effect = 2;
5473 else if (one_in_(3)) effect = 3;
5478 /* Powerful monsters can resist */
5479 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5480 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5483 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5485 note = " is unaffected!";
5491 /* Normal monsters slow down */
5494 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
5497 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5499 note = " starts moving slower.";
5505 else if (effect == 2)
5507 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5509 /* Attempt a saving throw */
5510 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5511 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5516 /* No obvious effect */
5518 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5520 note = " is unaffected!";
5527 else if (effect == 3)
5529 /* Attempt a saving throw */
5530 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5531 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5532 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5534 /* Memorize a flag */
5535 if (r_ptr->flags3 & RF3_NO_SLEEP)
5537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5540 /* No obvious effect */
5542 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5544 note = " is unaffected!";
5551 /* Go to sleep (much) later */
5553 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5555 note = " falls asleep!";
5565 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5567 note = " is immune!";
5571 /* No "real" damage */
5579 if (seen) obvious = TRUE;
5581 if (r_ptr->flagsr & RFR_RES_ALL)
5584 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5586 note = " is immune.";
5589 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5594 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "¥â¥ó¥¹¥¿¡¼¾ÃÌÇ"))
5596 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "Genocide One"))
5600 if (seen_msg) msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª", m_name);
5602 if (seen_msg) msg_format("%^s disappered!", m_name);
5604 chg_virtue(V_VITALITY, -1);
5615 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5617 if (!who) msg_format("You take a photograph of %s.", m_name);
5620 if (r_ptr->flags3 & (RF3_HURT_LITE))
5622 /* Obvious effect */
5623 if (seen) obvious = TRUE;
5625 /* Memorize the effects */
5626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5628 /* Special effect */
5630 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5631 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5633 note = " cringes from the light!";
5634 note_dies = " shrivels away in the light!";
5638 /* Normally no damage */
5645 photo = m_ptr->r_idx;
5652 case GF_BLOOD_CURSE:
5654 if (seen) obvious = TRUE;
5656 if (r_ptr->flagsr & RFR_RES_ALL)
5659 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5661 note = " is immune.";
5664 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5672 bool success = FALSE;
5673 if (seen) obvious = TRUE;
5675 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5677 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5678 if (dam < 1) dam = 1;
5680 /* No need to tame your pet */
5684 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5686 note = " starts moving faster.";
5689 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5693 /* Attempt a saving throw */
5694 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5695 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5696 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5697 (p_ptr->cursed & TRC_AGGRAVATE) ||
5698 ((r_ptr->level+10) > randint1(dam)))
5701 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5706 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5708 note = " is tamed!";
5712 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5714 /* Learn about type */
5715 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5722 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5724 do_fear = randint1(90)+10;
5726 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5729 /* No "real" damage */
5736 if (seen) obvious = TRUE;
5738 if (r_ptr->flagsr & RFR_RES_ALL)
5741 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5743 note = " is immune.";
5746 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5750 /* Attempt a saving throw */
5751 if (randint0(100 + dam) < (r_ptr->level + 50))
5755 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5757 note = "is unaffected!";
5778 /* Absolutely no effect */
5779 if (skipped) return (FALSE);
5781 /* "Unique" monsters cannot be polymorphed */
5782 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5784 /* Quest monsters cannot be polymorphed */
5785 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5787 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5789 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5790 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5792 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5797 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5798 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5801 /* Modify the damage */
5803 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5805 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5807 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5810 /* Check for death */
5811 if (dam > m_ptr->hp)
5813 /* Extract method of death */
5818 /* Sound and Impact resisters never stun */
5820 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5821 !(r_ptr->flags3 & RF3_NO_STUN))
5824 if (seen) obvious = TRUE;
5827 if (MON_STUNNED(m_ptr))
5830 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5832 note = " is more dazed.";
5835 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
5840 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5842 note = " is dazed.";
5849 (void)set_monster_stunned(c_ptr->m_idx, tmp);
5855 /* Confusion and Chaos resisters (and sleepers) never confuse */
5857 !(r_ptr->flags3 & RF3_NO_CONF) &&
5858 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5861 if (seen) obvious = TRUE;
5863 /* Already partially confused */
5864 if (MON_CONFUSED(m_ptr))
5867 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5869 note = " looks more confused.";
5872 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
5875 /* Was not confused */
5879 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5881 note = " looks confused.";
5887 /* Apply confusion */
5888 (void)set_monster_confused(c_ptr->m_idx, tmp);
5897 if (seen) obvious = TRUE;
5899 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5904 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5906 note = " seems weakened.";
5908 m_ptr->maxhp -= do_time;
5909 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5914 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5915 if (do_poly && (randint1(90) > r_ptr->level))
5917 if (polymorph_monster(y, x))
5920 if (seen) obvious = TRUE;
5922 /* Monster polymorphs */
5924 note = "¤¬ÊѿȤ·¤¿¡ª";
5929 /* Turn off the damage */
5936 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5938 note = " is unaffected!";
5942 /* Hack -- Get new monster */
5943 m_ptr = &m_list[c_ptr->m_idx];
5945 /* Hack -- Get new race */
5946 r_ptr = &r_info[m_ptr->r_idx];
5949 /* Handle "teleport" */
5953 if (seen) obvious = TRUE;
5957 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5959 note = " disappears!";
5962 if (!who) chg_virtue(V_VALOUR, -1);
5965 teleport_away(c_ptr->m_idx, do_dist,
5966 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
5968 /* Hack -- get new location */
5972 /* Hack -- get new grid */
5973 c_ptr = &cave[y][x];
5980 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
5987 if (typ == GF_DRAIN_MANA)
5989 /* Drain mana does nothing */
5992 /* If another monster did the damage, hurt the monster by hand */
5995 /* Redraw (later) if needed */
5996 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5997 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5999 /* Wake the monster up */
6000 (void)set_monster_csleep(c_ptr->m_idx, 0);
6002 /* Hurt the monster */
6010 if (is_pet(m_ptr) && !(m_ptr->ml))
6013 /* Give detailed messages if destroyed */
6016 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6019 msg_format("%^s%s", m_name, note);
6027 monster_gain_exp(who, m_ptr->r_idx);
6029 /* Generate treasure, etc */
6030 monster_death(c_ptr->m_idx, FALSE);
6032 /* Delete the monster */
6033 delete_monster_idx(c_ptr->m_idx);
6038 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6040 msg_print("You feel sad for a moment.");
6045 /* Damaged monster */
6048 /* Give detailed messages if visible or destroyed */
6049 if (note && seen_msg) msg_format("%^s%s", m_name, note);
6051 /* Hack -- Pain message */
6054 message_pain(c_ptr->m_idx, dam);
6061 /* Hack -- handle sleep */
6062 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6066 else if (heal_leper)
6069 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6071 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6074 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
6078 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
6079 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
6082 delete_monster_idx(c_ptr->m_idx);
6085 /* If the player did it, give him experience, check fear */
6090 /* Hurt the monster, check for fear and death */
6091 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6096 /* Damaged monster */
6099 /* HACK - anger the monster before showing the sleep message */
6100 if (do_sleep) anger_monster(m_ptr);
6102 /* Give detailed messages if visible or destroyed */
6103 if (note && seen_msg)
6105 msg_format("%s%s", m_name, note);
6107 msg_format("%^s%s", m_name, note);
6111 /* Hack -- Pain message */
6112 else if (known && (dam || !do_fear))
6114 message_pain(c_ptr->m_idx, dam);
6117 /* Anger monsters */
6118 if (((dam > 0) || get_angry) && !do_sleep)
6119 anger_monster(m_ptr);
6122 if ((fear || do_fear) && seen)
6129 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6131 msg_format("%^s flees in terror!", m_name);
6135 /* Hack -- handle sleep */
6136 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6140 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6142 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6146 switch (randint1(28))
6152 msg_print("ÃÏÌ̤¬Íɤ줿...");
6154 msg_print("The ground trembles...");
6157 earthquake(ty, tx, 4 + randint0(4));
6158 if (!one_in_(6)) break;
6160 case 3: case 4: case 5: case 6:
6163 int dam = damroll(10, 10);
6165 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6167 msg_print("A portal opens to a plane of raw mana!");
6170 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6171 if (!one_in_(6)) break;
6177 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6179 msg_print("Space warps about you!");
6182 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
6183 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6184 if (!one_in_(6)) break;
6186 case 9: case 10: case 11:
6188 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6190 msg_print("You feel a surge of energy!");
6193 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6194 if (!one_in_(6)) break;
6195 case 12: case 13: case 14: case 15: case 16:
6196 aggravate_monsters(0);
6197 if (!one_in_(6)) break;
6199 count += activate_hi_summon(ty, tx, TRUE);
6200 if (!one_in_(6)) break;
6201 case 19: case 20: case 21: case 22:
6203 bool pet = !one_in_(3);
6204 u32b mode = PM_ALLOW_GROUP;
6206 if (pet) mode |= PM_FORCE_PET;
6207 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6209 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6210 if (!one_in_(6)) break;
6212 case 23: case 24: case 25:
6213 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6215 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6217 msg_print("You feel your life draining away...");
6220 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6221 else lose_exp(p_ptr->exp / 16);
6222 if (!one_in_(6)) break;
6223 case 26: case 27: case 28:
6232 (void)do_dec_stat(i);
6241 (void)do_dec_stat(randint0(6));
6250 if (p_ptr->inside_battle)
6252 p_ptr->health_who = c_ptr->m_idx;
6253 p_ptr->redraw |= (PR_HEALTH);
6257 /* XXX XXX XXX Verify this code */
6259 /* Update the monster */
6260 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
6262 /* Redraw the monster grid */
6266 /* Update monster recall window */
6267 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
6270 p_ptr->window |= (PW_MONSTER);
6273 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6277 if (!(flg & PROJECT_NO_HANGEKI))
6279 set_target(m_ptr, monster_target_y, monster_target_x);
6282 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6284 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6288 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6290 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6291 rakubadam_m = (dam > 200) ? 200 : dam;
6300 /* Get local object */
6303 /* Prepare to make a Blade of Chaos */
6304 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6306 q_ptr->pval = photo;
6308 /* Mark the item as fully known */
6309 q_ptr->ident |= (IDENT_MENTAL);
6311 /* Drop it in the dungeon */
6312 (void)drop_near(q_ptr, -1, py, px);
6320 /* Return "Anything seen?" */
6326 * Helper function for "project()" below.
6328 * Handle a beam/bolt/ball causing damage to the player.
6330 * This routine takes a "source monster" (by index), a "distance", a default
6331 * "damage", and a "damage type". See "project_m()" above.
6333 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6334 * is reduced (see "project_m()" above). This can happen if a monster breathes
6335 * at the player and hits a wall instead.
6337 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6338 * to know if this is actually a ball or a bolt spell
6341 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6342 * we just assume that the effects were obvious, for historical reasons.
6344 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6349 /* Hack -- assume obvious */
6350 bool obvious = TRUE;
6352 /* Player blind-ness */
6353 bool blind = (p_ptr->blind ? TRUE : FALSE);
6355 /* Player needs a "description" (he is blind) */
6358 /* Source monster */
6359 monster_type *m_ptr = NULL;
6361 /* Monster name (for attacks) */
6364 /* Monster name (for damage) */
6367 /* Hack -- messages */
6373 /* Player is not here */
6374 if (!player_bold(y, x)) return (FALSE);
6376 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6378 if (kawarimi(TRUE)) return FALSE;
6381 /* Player cannot hurt himself */
6382 if (!who) return (FALSE);
6383 if (who == p_ptr->riding) return (FALSE);
6385 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6388 int max_attempts = 10;
6391 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6392 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6393 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6395 if (blind) msg_print("Something bounces!");
6396 else msg_print("The attack bounces!");
6400 /* Choose 'new' target */
6405 t_y = m_list[who].fy - 1 + randint1(3);
6406 t_x = m_list[who].fx - 1 + randint1(3);
6409 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6411 if (max_attempts < 1)
6413 t_y = m_list[who].fy;
6414 t_x = m_list[who].fx;
6419 t_y = py - 1 + randint1(3);
6420 t_x = px - 1 + randint1(3);
6423 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6430 /* Limit maximum damage */
6431 if (dam > 1600) dam = 1600;
6433 /* Reduce damage by distance */
6434 dam = (dam + r) / (r + 1);
6437 /* If the player is blind, be more descriptive */
6438 if (blind) fuzzy = TRUE;
6443 /* Get the source monster */
6444 m_ptr = &m_list[who];
6445 /* Extract the monster level */
6446 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6448 /* Get the monster name */
6449 monster_desc(m_name, m_ptr, 0);
6451 /* Get the monster's real name (gotten before polymorph!) */
6452 strcpy(killer, who_name);
6458 case PROJECT_WHO_UNCTRL_POWER:
6460 strcpy(killer, "À©¸æ¤Ç¤¤Ê¤¤ÎϤÎÈÅή");
6462 strcpy(killer, "uncontrollable power storm");
6466 case PROJECT_WHO_GLASS_SHARDS:
6468 strcpy(killer, "¥¬¥é¥¹¤ÎÇËÊÒ");
6470 strcpy(killer, "shards of glass");
6476 strcpy(killer, "æ«");
6478 strcpy(killer, "a trap");
6484 strcpy(m_name, killer);
6487 /* Analyze the damage */
6490 /* Standard damage -- hurts inventory too */
6494 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6496 if (fuzzy) msg_print("You are hit by acid!");
6499 get_damage = acid_dam(dam, killer, monspell);
6503 /* Standard damage -- hurts inventory too */
6507 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6509 if (fuzzy) msg_print("You are hit by fire!");
6512 get_damage = fire_dam(dam, killer, monspell);
6516 /* Standard damage -- hurts inventory too */
6520 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6522 if (fuzzy) msg_print("You are hit by cold!");
6525 get_damage = cold_dam(dam, killer, monspell);
6529 /* Standard damage -- hurts inventory too */
6533 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6535 if (fuzzy) msg_print("You are hit by lightning!");
6538 get_damage = elec_dam(dam, killer, monspell);
6542 /* Standard damage -- also poisons player */
6545 bool double_resist = IS_OPPOSE_POIS();
6547 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6549 if (fuzzy) msg_print("You are hit by poison!");
6552 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6553 if (double_resist) dam = (dam + 2) / 3;
6555 if ((!(double_resist || p_ptr->resist_pois)) &&
6556 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
6561 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6563 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6565 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6570 /* Standard damage -- also poisons / mutates player */
6573 bool double_resist = IS_OPPOSE_POIS();
6575 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6577 if (fuzzy) msg_print("You are hit by radiation!");
6580 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6581 if (double_resist) dam = (2 * dam + 2) / 5;
6582 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6583 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6585 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6587 if (one_in_(5)) /* 6 */
6590 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6592 msg_print("You undergo a freakish metamorphosis!");
6595 if (one_in_(4)) /* 4 */
6603 inven_damage(set_acid_destroy, 2);
6609 /* Standard damage */
6613 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6615 if (fuzzy) msg_print("You are hit by something!");
6618 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6622 /* Holy Orb -- Player only takes partial damage */
6626 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6628 if (fuzzy) msg_print("You are hit by something!");
6631 if (p_ptr->align > 10)
6633 else if (p_ptr->align < -10)
6635 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6642 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6644 if (fuzzy) msg_print("You are hit by something!");
6647 if (p_ptr->align > 10)
6649 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6653 /* Arrow -- XXX no dodging */
6657 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6659 if (fuzzy) msg_print("You are hit by something sharp!");
6662 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6665 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6667 msg_print("You cut down the arrow!");
6671 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6675 /* Plasma -- XXX No resist */
6679 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6681 if (fuzzy) msg_print("You are hit by something *HOT*!");
6684 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6686 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6688 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6689 (void)set_stun(p_ptr->stun + k);
6692 if (!(p_ptr->resist_fire ||
6694 p_ptr->immune_fire))
6696 inven_damage(set_acid_destroy, 3);
6702 /* Nether -- drain experience */
6706 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6708 if (fuzzy) msg_print("You are hit by nether forces!");
6711 if (p_ptr->resist_neth)
6713 if (!prace_is_(RACE_SPECTRE))
6714 dam *= 6; dam /= (randint1(4) + 7);
6716 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6718 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
6721 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6723 msg_print("You feel invigorated!");
6727 learn_spell(monspell);
6731 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6737 /* Water -- stun/confuse */
6741 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6743 if (fuzzy) msg_print("You are hit by something wet!");
6746 if (!CHECK_MULTISHADOW())
6748 if (!p_ptr->resist_sound)
6750 set_stun(p_ptr->stun + randint1(40));
6752 if (!p_ptr->resist_conf)
6754 set_confused(p_ptr->confused + randint1(5) + 5);
6759 inven_damage(set_cold_destroy, 3);
6763 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6767 /* Chaos -- many effects */
6771 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6773 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6776 if (p_ptr->resist_chaos)
6778 dam *= 6; dam /= (randint1(4) + 7);
6781 if (!CHECK_MULTISHADOW())
6783 if (!p_ptr->resist_conf)
6785 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6787 if (!p_ptr->resist_chaos)
6789 (void)set_image(p_ptr->image + randint1(10));
6793 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6795 msg_print("Your body is twisted by chaos!");
6798 (void)gain_random_mutation(0);
6801 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6803 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6806 if (!p_ptr->resist_chaos || one_in_(9))
6808 inven_damage(set_elec_destroy, 2);
6809 inven_damage(set_fire_destroy, 2);
6813 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6817 /* Shards -- mostly cutting */
6821 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6823 if (fuzzy) msg_print("You are hit by something sharp!");
6826 if (p_ptr->resist_shard)
6828 dam *= 6; dam /= (randint1(4) + 7);
6830 else if (!CHECK_MULTISHADOW())
6832 (void)set_cut(p_ptr->cut + dam);
6835 if (!p_ptr->resist_shard || one_in_(13))
6837 inven_damage(set_cold_destroy, 2);
6840 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6844 /* Sound -- mostly stunning */
6848 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6850 if (fuzzy) msg_print("You are hit by a loud noise!");
6853 if (p_ptr->resist_sound)
6855 dam *= 5; dam /= (randint1(4) + 7);
6857 else if (!CHECK_MULTISHADOW())
6859 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6860 (void)set_stun(p_ptr->stun + k);
6863 if (!p_ptr->resist_sound || one_in_(13))
6865 inven_damage(set_cold_destroy, 2);
6868 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6872 /* Pure confusion */
6876 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6878 if (fuzzy) msg_print("You are hit by something puzzling!");
6881 if (p_ptr->resist_conf)
6883 dam *= 5; dam /= (randint1(4) + 7);
6885 else if (!CHECK_MULTISHADOW())
6887 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6889 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6893 /* Disenchantment -- see above */
6897 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6899 if (fuzzy) msg_print("You are hit by something static!");
6902 if (p_ptr->resist_disen)
6904 dam *= 6; dam /= (randint1(4) + 7);
6906 else if (!CHECK_MULTISHADOW())
6908 (void)apply_disenchant(0);
6910 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6914 /* Nexus -- see above */
6918 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6920 if (fuzzy) msg_print("You are hit by something strange!");
6923 if (p_ptr->resist_nexus)
6925 dam *= 6; dam /= (randint1(4) + 7);
6927 else if (!CHECK_MULTISHADOW())
6931 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6935 /* Force -- mostly stun */
6939 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6941 if (fuzzy) msg_print("You are hit by kinetic force!");
6944 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6946 (void)set_stun(p_ptr->stun + randint1(20));
6948 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6953 /* Rocket -- stun, cut */
6957 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6959 if (fuzzy) msg_print("There is an explosion!");
6962 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6964 (void)set_stun(p_ptr->stun + randint1(20));
6967 if (p_ptr->resist_shard)
6971 else if (!CHECK_MULTISHADOW())
6973 (void)set_cut(p_ptr->cut + (dam / 2));
6976 if (!p_ptr->resist_shard || one_in_(12))
6978 inven_damage(set_cold_destroy, 3);
6981 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6985 /* Inertia -- slowness */
6989 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6991 if (fuzzy) msg_print("You are hit by something slow!");
6994 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6995 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6999 /* Lite -- blinding */
7003 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7005 if (fuzzy) msg_print("You are hit by something!");
7008 if (p_ptr->resist_lite)
7010 dam *= 4; dam /= (randint1(4) + 7);
7012 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7014 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7017 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7020 if (!CHECK_MULTISHADOW()) msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7022 if (!CHECK_MULTISHADOW()) msg_print("The light scorches your flesh!");
7027 else if (prace_is_(RACE_S_FAIRY))
7032 if (p_ptr->wraith_form) dam *= 2;
7033 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7035 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
7037 p_ptr->wraith_form = 0;
7039 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7041 msg_print("The light forces you out of your incorporeal shadow form.");
7044 p_ptr->redraw |= PR_MAP;
7045 /* Update monsters */
7046 p_ptr->update |= (PU_MONSTERS);
7048 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7050 /* Redraw status bar */
7051 p_ptr->redraw |= (PR_STATUS);
7058 /* Dark -- blinding */
7062 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7064 if (fuzzy) msg_print("You are hit by something!");
7067 if (p_ptr->resist_dark)
7069 dam *= 4; dam /= (randint1(4) + 7);
7071 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7073 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7075 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7077 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7081 /* Time -- bolt fewer effects XXX */
7085 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7087 if (fuzzy) msg_print("You are hit by a blast from the past!");
7090 if (p_ptr->resist_time)
7093 dam /= (randint1(4) + 7);
7095 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7097 msg_print("You feel as if time is passing you by.");
7100 else if (!CHECK_MULTISHADOW())
7102 switch (randint1(10))
7104 case 1: case 2: case 3: case 4: case 5:
7106 if (p_ptr->prace == RACE_ANDROID) break;
7108 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7110 msg_print("You feel life has clocked back.");
7113 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7117 case 6: case 7: case 8: case 9:
7119 switch (randint1(6))
7122 case 1: k = A_STR; act = "¶¯¤¯"; break;
7123 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7124 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7125 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7126 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7127 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7129 case 1: k = A_STR; act = "strong"; break;
7130 case 2: k = A_INT; act = "bright"; break;
7131 case 3: k = A_WIS; act = "wise"; break;
7132 case 4: k = A_DEX; act = "agile"; break;
7133 case 5: k = A_CON; act = "hale"; break;
7134 case 6: k = A_CHR; act = "beautiful"; break;
7139 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7141 msg_format("You're not as %s as you used to be...", act);
7144 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7145 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7146 p_ptr->update |= (PU_BONUS);
7153 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7155 msg_print("You're not as powerful as you used to be...");
7158 for (k = 0; k < 6; k++)
7160 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7161 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7163 p_ptr->update |= (PU_BONUS);
7169 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7173 /* Gravity -- stun plus slowness plus teleport */
7177 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7178 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7180 if (fuzzy) msg_print("You are hit by something heavy!");
7181 msg_print("Gravity warps around you.");
7184 if (!CHECK_MULTISHADOW())
7186 teleport_player(5, TELEPORT_PASSIVE);
7187 if (!p_ptr->levitation)
7188 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7189 if (!(p_ptr->resist_sound || p_ptr->levitation))
7191 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7192 (void)set_stun(p_ptr->stun + k);
7195 if (p_ptr->levitation)
7197 dam = (dam * 2) / 3;
7200 if (!p_ptr->levitation || one_in_(13))
7202 inven_damage(set_cold_destroy, 2);
7205 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7209 /* Standard damage */
7210 case GF_DISINTEGRATE:
7213 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7215 if (fuzzy) msg_print("You are hit by pure energy!");
7218 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7225 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7227 if (fuzzy) msg_print("You are hit by something invigorating!");
7230 (void)hp_player(dam);
7238 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7240 if (fuzzy) msg_print("You are hit by something!");
7243 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7251 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7253 if (fuzzy) msg_print("You are hit by something slow!");
7256 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7262 if (p_ptr->free_act) break;
7264 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7266 if (fuzzy) msg_print("You fall asleep!");
7270 if (ironman_nightmare)
7273 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7275 msg_print("A horrible vision enters your mind.");
7278 /* Pick a nightmare */
7279 get_mon_num_prep(get_nightmare, NULL);
7281 /* Have some nightmares */
7282 have_nightmare(get_mon_num(MAX_DEPTH));
7284 /* Remove the monster restriction */
7285 get_mon_num_prep(NULL, NULL);
7288 set_paralyzed(p_ptr->paralyzed + dam);
7299 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7301 if (fuzzy) msg_print("You are hit by an aura of magic!");
7304 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7312 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7314 if (fuzzy) msg_print("You are hit by an energy!");
7317 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7325 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7327 if (fuzzy) msg_print("Something falls from the sky on you!");
7330 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7331 if (!p_ptr->resist_shard || one_in_(13))
7333 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7334 inven_damage(set_cold_destroy, 2);
7340 /* Ice -- cold plus stun plus cuts */
7344 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7346 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7349 cold_dam(dam, killer, monspell);
7350 if (!CHECK_MULTISHADOW())
7352 if (!p_ptr->resist_shard)
7354 (void)set_cut(p_ptr->cut + damroll(5, 8));
7356 if (!p_ptr->resist_sound)
7358 (void)set_stun(p_ptr->stun + randint1(15));
7361 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7363 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7374 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7376 if (fuzzy) msg_print("You are hit by something extremely cold!");
7380 if (p_ptr->mimic_form)
7382 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7383 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7388 switch (p_ptr->prace)
7390 /* Some races are immune */
7404 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7416 if (CHECK_MULTISHADOW())
7419 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
7421 msg_print("The attack hits Shadow, you are unharmed!");
7424 else if (p_ptr->csp)
7428 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7429 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7431 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7432 else msg_print("Your psychic energy is drawn!");
7436 if (dam >= p_ptr->csp)
7440 p_ptr->csp_frac = 0;
7449 learn_spell(monspell);
7452 p_ptr->redraw |= (PR_MANA);
7455 p_ptr->window |= (PW_PLAYER);
7456 p_ptr->window |= (PW_SPELL);
7460 /* Heal the monster */
7461 if (m_ptr->hp < m_ptr->maxhp)
7464 m_ptr->hp += (6 * dam);
7465 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7467 /* Redraw (later) if needed */
7468 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7469 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7471 /* Special message */
7475 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7477 msg_format("%^s appears healthier.", m_name);
7491 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7494 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7496 msg_print("You resist the effects!");
7498 learn_spell(monspell);
7502 if (!CHECK_MULTISHADOW())
7505 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7507 msg_print("Your mind is blasted by psyonic energy.");
7510 if (!p_ptr->resist_conf)
7512 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7515 if (!p_ptr->resist_chaos && one_in_(3))
7517 (void)set_image(p_ptr->image + randint0(250) + 150);
7524 p_ptr->csp_frac = 0;
7526 p_ptr->redraw |= PR_MANA;
7529 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7535 case GF_BRAIN_SMASH:
7537 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7540 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7542 msg_print("You resist the effects!");
7544 learn_spell(monspell);
7548 if (!CHECK_MULTISHADOW())
7551 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7553 msg_print("Your mind is blasted by psionic energy.");
7560 p_ptr->csp_frac = 0;
7562 p_ptr->redraw |= PR_MANA;
7565 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7566 if (!CHECK_MULTISHADOW())
7568 if (!p_ptr->resist_blind)
7570 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7572 if (!p_ptr->resist_conf)
7574 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7576 if (!p_ptr->free_act)
7578 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7580 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7582 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7583 (void)do_dec_stat(A_INT);
7584 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7585 (void)do_dec_stat(A_WIS);
7587 if (!p_ptr->resist_chaos)
7589 (void)set_image(p_ptr->image + randint0(250) + 150);
7599 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7602 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7604 msg_print("You resist the effects!");
7606 learn_spell(monspell);
7610 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
7611 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7619 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7622 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7624 msg_print("You resist the effects!");
7626 learn_spell(monspell);
7630 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
7631 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7639 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7642 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7644 msg_print("You resist the effects!");
7646 learn_spell(monspell);
7650 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
7651 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7659 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
7662 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7664 msg_print("You resist the effects!");
7666 learn_spell(monspell);
7670 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7671 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
7679 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7682 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7684 msg_format("You resist the effects!");
7686 learn_spell(monspell);
7690 if (!CHECK_MULTISHADOW())
7693 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7695 msg_print("You feel your life fade away!");
7697 curse_equipment(40, 20);
7700 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7702 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
7717 if (p_ptr->tim_eyeeye && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
7720 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7722 char m_name_self[80];
7725 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7727 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7729 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7730 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7733 if (p_ptr->riding && dam > 0)
7735 rakubadam_p = (dam > 200) ? 200 : dam;
7743 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7745 (void)kawarimi(FALSE);
7748 /* Return "Anything seen?" */
7754 * Find the distance from (x, y) to a line.
7756 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7758 /* Vector from (x, y) to (x1, y1) */
7767 int pd = distance(y1, x1, y, x);
7768 int nd = distance(y1, x1, y2, x2);
7770 if (pd > nd) return distance(y, x, y2, x2);
7772 /* Component of P on N */
7773 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7775 /* Absolute value */
7776 return((nd >= 0) ? nd : 0 - nd);
7783 * Modified version of los() for calculation of disintegration balls.
7784 * Disintegration effects are stopped by permanent walls.
7786 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7806 /* Slope, or 1/Slope, of LOS */
7810 /* Extract the offset */
7814 /* Extract the absolute offset */
7819 /* Handle adjacent (or identical) grids */
7820 if ((ax < 2) && (ay < 2)) return (TRUE);
7823 /* Paranoia -- require "safe" origin */
7824 /* if (!in_bounds(y1, x1)) return (FALSE); */
7827 /* Directly South/North */
7830 /* South -- check for walls */
7833 for (ty = y1 + 1; ty < y2; ty++)
7835 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7839 /* North -- check for walls */
7842 for (ty = y1 - 1; ty > y2; ty--)
7844 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7852 /* Directly East/West */
7855 /* East -- check for walls */
7858 for (tx = x1 + 1; tx < x2; tx++)
7860 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7864 /* West -- check for walls */
7867 for (tx = x1 - 1; tx > x2; tx--)
7869 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7878 /* Extract some signs */
7879 sx = (dx < 0) ? -1 : 1;
7880 sy = (dy < 0) ? -1 : 1;
7883 /* Vertical "knights" */
7888 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7892 /* Horizontal "knights" */
7897 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7902 /* Calculate scale factor div 2 */
7905 /* Calculate scale factor */
7909 /* Travel horizontally */
7912 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7918 /* Consider the special case where slope == 1. */
7929 /* Note (below) the case (qy == f2), where */
7930 /* the LOS exactly meets the corner of a tile. */
7933 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7944 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7957 /* Travel vertically */
7960 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7976 /* Note (below) the case (qx == f2), where */
7977 /* the LOS exactly meets the corner of a tile. */
7980 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7991 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8012 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)
8017 int brev = rad * rad / dist;
8021 int mdis = distance(y1, x1, y2, x2) + rad;
8023 while (bdis <= mdis)
8027 if ((0 < dist) && (path_n < dist))
8029 int ny = GRID_Y(path_g[path_n]);
8030 int nx = GRID_X(path_g[path_n]);
8031 int nd = distance(ny, nx, y1, x1);
8033 /* Get next base point */
8042 /* Travel from center outward */
8043 for (cdis = 0; cdis <= brad; cdis++)
8045 /* Scan the maximal blast area of radius "cdis" */
8046 for (y = by - cdis; y <= by + cdis; y++)
8048 for (x = bx - cdis; x <= bx + cdis; x++)
8050 /* Ignore "illegal" locations */
8051 if (!in_bounds(y, x)) continue;
8053 /* Enforce a circular "ripple" */
8054 if (distance(y1, x1, y, x) != bdis) continue;
8056 /* Enforce an arc */
8057 if (distance(by, bx, y, x) != cdis) continue;
8063 /* Lights are stopped by opaque terrains */
8064 if (!los(by, bx, y, x)) continue;
8066 case GF_DISINTEGRATE:
8067 /* Disintegration are stopped only by perma-walls */
8068 if (!in_disintegration_range(by, bx, y, x)) continue;
8071 /* Ball explosions are stopped by walls */
8072 if (!projectable(by, bx, y, x)) continue;
8076 /* Save this grid */
8084 /* Encode some more "radius" info */
8085 gm[bdis + 1] = *pgrids;
8087 /* Increase the size */
8088 brad = rad * (path_n + brev) / (dist + brev);
8090 /* Find the next ripple */
8094 /* Store the effect size */
8100 * Generic "beam"/"bolt"/"ball" projection routine.
8103 * who: Index of "source" monster (zero for "player")
8104 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8105 * y,x: Target location (or location to travel "towards")
8106 * dam: Base damage roll to apply to affected monsters (or player)
8107 * typ: Type of damage to apply to monsters (and objects)
8108 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8111 * TRUE if any "effects" of the projection were observed, else FALSE
8113 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8114 * towards a given location (optionally passing over the heads of interposing
8115 * monsters), and have it do a given amount of damage to the monsters (and
8116 * optionally objects) within the given radius of the final location.
8118 * A "bolt" travels from source to target and affects only the target grid.
8119 * A "beam" travels from source to target, affecting all grids passed through.
8120 * A "ball" travels from source to the target, exploding at the target, and
8121 * affecting everything within the given radius of the target location.
8123 * Traditionally, a "bolt" does not affect anything on the ground, and does
8124 * not pass over the heads of interposing monsters, much like a traditional
8125 * missile, and will "stop" abruptly at the "target" even if no monster is
8126 * positioned there, while a "ball", on the other hand, passes over the heads
8127 * of monsters between the source and target, and affects everything except
8128 * the source monster which lies within the final radius, while a "beam"
8129 * affects every monster between the source and target, except for the casting
8130 * monster (or player), and rarely affects things on the ground.
8132 * Two special flags allow us to use this function in special ways, the
8133 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8134 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8135 * actually projecting from the source monster (or player).
8137 * The player will only get "experience" for monsters killed by himself
8138 * Unique monsters can only be destroyed by attacks from the player
8140 * Only 256 grids can be affected per projection, limiting the effective
8141 * "radius" of standard ball attacks to nine units (diameter nineteen).
8143 * One can project in a given "direction" by combining PROJECT_THRU with small
8144 * offsets to the initial location (see "line_spell()"), or by calculating
8145 * "virtual targets" far away from the player.
8147 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8148 * continuing until it actually hits somethings (useful for "stone to mud").
8150 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8152 * Balls must explode BEFORE hitting walls, or they would affect monsters
8153 * on both sides of a wall. Some bug reports indicate that this is still
8154 * happening in 2.7.8 for Windows, though it appears to be impossible.
8156 * We "pre-calculate" the blast area only in part for efficiency.
8157 * More importantly, this lets us do "explosions" from the "inside" out.
8158 * This results in a more logical distribution of "blast" treasure.
8159 * It also produces a better (in my opinion) animation of the explosion.
8160 * It could be (but is not) used to have the treasure dropped by monsters
8161 * in the middle of the explosion fall "outwards", and then be damaged by
8162 * the blast as it spreads outwards towards the treasure drop location.
8164 * Walls and doors are included in the blast area, so that they can be
8165 * "burned" or "melted" in later versions.
8167 * This algorithm is intended to maximize simplicity, not necessarily
8168 * efficiency, since this function is not a bottleneck in the code.
8170 * We apply the blast effect from ground zero outwards, in several passes,
8171 * first affecting features, then objects, then monsters, then the player.
8172 * This allows walls to be removed before checking the object or monster
8173 * in the wall, and protects objects which are dropped by monsters killed
8174 * in the blast, and allows the player to see all affects before he is
8175 * killed or teleported away. The semantics of this method are open to
8176 * various interpretations, but they seem to work well in practice.
8178 * We process the blast area from ground-zero outwards to allow for better
8179 * distribution of treasure dropped by monsters, and because it provides a
8180 * pleasing visual effect at low cost.
8182 * Note that the damage done by "ball" explosions decreases with distance.
8183 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8185 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8186 * the target, and then the damage "flows" along this beam of destruction.
8187 * The damage at every grid is the same as at the "center" of a "ball"
8188 * explosion, since the "beam" grids are treated as if they ARE at the
8189 * center of a "ball" explosion.
8191 * Currently, specifying "beam" plus "ball" means that locations which are
8192 * covered by the initial "beam", and also covered by the final "ball", except
8193 * for the final grid (the epicenter of the ball), will be "hit twice", once
8194 * by the initial beam, and once by the exploding ball. For the grid right
8195 * next to the epicenter, this results in 150% damage being done. The center
8196 * does not have this problem, for the same reason the final grid in a "beam"
8197 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8198 * grids which are covered by the "ball" will NOT work, as then they will
8199 * receive LESS damage than they should. Do not combine "beam" with "ball".
8201 * The array "gy[],gx[]" with current size "grids" is used to hold the
8202 * collected locations of all grids in the "blast area" plus "beam path".
8204 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8205 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8206 * first blast grid (see above) with radius "N" from the blast center. Note
8207 * that only the first gm[1] grids in the blast area thus take full damage.
8208 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8209 * number of blast grids.
8211 * Note that once the projection is complete, (y2,x2) holds the final location
8212 * of bolts/beams, and the "epicenter" of balls.
8214 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8215 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8216 * implementation of the "distance" function. Also, a bolt can be properly
8217 * viewed as a "ball" with a "rad" of "zero".
8219 * Note that if no "target" is reached before the beam/bolt/ball travels the
8220 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8221 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8223 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8224 * to move from point A to point B, even if the player cannot see part of the
8225 * projection path. Note that in general, the player will *always* see part
8226 * of the path, since it either starts at the player or ends on the player.
8228 * Hack -- we assume that every "projection" is "self-illuminating".
8230 * Hack -- when only a single monster is affected, we automatically track
8231 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8233 * Note that all projections now "explode" at their final destination, even
8234 * if they were being projected at a more distant destination. This means
8235 * that "ball" spells will *always* explode.
8237 * Note that we must call "handle_stuff()" after affecting terrain features
8238 * in the blast radius, in case the "illumination" of the grid was changed,
8239 * and "update_view()" and "update_monsters()" need to be called.
8241 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8251 int y_saver, x_saver; /* For reflecting monsters */
8253 int msec = delay_factor * delay_factor * delay_factor;
8255 /* Assume the player sees nothing */
8256 bool notice = FALSE;
8258 /* Assume the player has seen nothing */
8259 bool visual = FALSE;
8261 /* Assume the player has seen no blast grids */
8264 /* Assume to be a normal ball spell */
8265 bool breath = FALSE;
8267 /* Is the player blind? */
8268 bool blind = (p_ptr->blind ? TRUE : FALSE);
8270 bool old_hide = FALSE;
8272 /* Number of grids in the "path" */
8275 /* Actual grids in the "path" */
8278 /* Number of grids in the "blast area" (including the "beam" path) */
8281 /* Coordinates of the affected grids */
8282 byte gx[1024], gy[1024];
8284 /* Encoded "radius" info (see above) */
8287 /* Actual radius encoded in gm[] */
8292 /* Attacker's name (prepared before polymorph)*/
8295 /* Can the player see the source of this effect? */
8296 bool see_s_msg = TRUE;
8298 /* Initialize by null string */
8304 /* Default target of monsterspell is player */
8305 monster_target_y=py;
8306 monster_target_x=px;
8308 /* Hack -- Jump to target */
8309 if (flg & (PROJECT_JUMP))
8314 /* Clear the flag */
8315 flg &= ~(PROJECT_JUMP);
8320 /* Start at player */
8327 /* Start at monster */
8330 x1 = m_list[who].fx;
8331 y1 = m_list[who].fy;
8332 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8345 /* Default "destination" */
8350 /* Hack -- verify stuff */
8351 if (flg & (PROJECT_THRU))
8353 if ((x1 == x2) && (y1 == y2))
8355 flg &= ~(PROJECT_THRU);
8359 /* Handle a breath attack */
8364 if (flg & PROJECT_HIDE) old_hide = TRUE;
8365 flg |= PROJECT_HIDE;
8369 /* Hack -- Assume there will be no blast (max radius 32) */
8370 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8378 /* Collect beam grids */
8379 if (flg & (PROJECT_BEAM))
8390 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8392 case GF_DISINTEGRATE:
8393 flg |= (PROJECT_GRID);
8394 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8398 /* Calculate the projection path */
8400 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8402 /* Hack -- Handle stuff */
8405 /* Giga-Hack SEEKER & SUPER_RAY */
8407 if( typ == GF_SEEKER )
8417 for (i = 0; i < path_n; ++i)
8422 int ny = GRID_Y(path_g[i]);
8423 int nx = GRID_X(path_g[i]);
8434 /* Only do visuals if requested */
8435 if (!blind && !(flg & (PROJECT_HIDE)))
8437 /* Only do visuals if the player can "see" the bolt */
8438 if (panel_contains(y, x) && player_has_los_bold(y, x))
8445 /* Obtain the bolt pict */
8446 p = bolt_pict(oy, ox, y, x, typ);
8448 /* Extract attr/char */
8452 /* Visual effects */
8453 print_rel(c, a, y, x);
8454 move_cursor_relative(y, x);
8455 /*if (fresh_before)*/ Term_fresh();
8456 Term_xtra(TERM_XTRA_DELAY, msec);
8458 /*if (fresh_before)*/ Term_fresh();
8460 /* Display "beam" grids */
8461 if (flg & (PROJECT_BEAM))
8463 /* Obtain the explosion pict */
8464 p = bolt_pict(y, x, y, x, typ);
8466 /* Extract attr/char */
8470 /* Visual effects */
8471 print_rel(c, a, y, x);
8474 /* Hack -- Activate delay */
8478 /* Hack -- delay anyway for consistency */
8481 /* Delay for consistency */
8482 Term_xtra(TERM_XTRA_DELAY, msec);
8485 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8486 if( is_mirror_grid(&cave[y][x]))
8488 /* The target of monsterspell becomes tha mirror(broken) */
8489 monster_target_y=(s16b)y;
8490 monster_target_x=(s16b)x;
8493 next_mirror( &oy,&ox,y,x );
8495 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8496 for( j = last_i; j <=i ; j++ )
8498 y = GRID_Y(path_g[j]);
8499 x = GRID_X(path_g[j]);
8500 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
8501 if(!who && (project_m_n==1) && !jump ){
8502 if(cave[project_m_y][project_m_x].m_idx >0 ){
8503 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8507 /* Hack -- auto-recall */
8508 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8510 /* Hack - auto-track */
8511 health_track(cave[project_m_y][project_m_x].m_idx);
8515 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8520 for( i = last_i ; i < path_n ; i++ )
8523 y = GRID_Y(path_g[i]);
8524 x = GRID_X(path_g[i]);
8525 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
8527 if(!who && (project_m_n==1) && !jump ){
8528 if(cave[project_m_y][project_m_x].m_idx >0 ){
8529 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8533 /* Hack -- auto-recall */
8534 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8536 /* Hack - auto-track */
8537 health_track(cave[project_m_y][project_m_x].m_idx);
8541 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8545 else if(typ == GF_SUPER_RAY){
8547 int second_step = 0;
8554 for (i = 0; i < path_n; ++i)
8559 int ny = GRID_Y(path_g[i]);
8560 int nx = GRID_X(path_g[i]);
8571 /* Only do visuals if requested */
8572 if (!blind && !(flg & (PROJECT_HIDE)))
8574 /* Only do visuals if the player can "see" the bolt */
8575 if (panel_contains(y, x) && player_has_los_bold(y, x))
8582 /* Obtain the bolt pict */
8583 p = bolt_pict(oy, ox, y, x, typ);
8585 /* Extract attr/char */
8589 /* Visual effects */
8590 print_rel(c, a, y, x);
8591 move_cursor_relative(y, x);
8592 /*if (fresh_before)*/ Term_fresh();
8593 Term_xtra(TERM_XTRA_DELAY, msec);
8595 /*if (fresh_before)*/ Term_fresh();
8597 /* Display "beam" grids */
8598 if (flg & (PROJECT_BEAM))
8600 /* Obtain the explosion pict */
8601 p = bolt_pict(y, x, y, x, typ);
8603 /* Extract attr/char */
8607 /* Visual effects */
8608 print_rel(c, a, y, x);
8611 /* Hack -- Activate delay */
8615 /* Hack -- delay anyway for consistency */
8618 /* Delay for consistency */
8619 Term_xtra(TERM_XTRA_DELAY, msec);
8622 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8623 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8625 if( second_step )continue;
8628 if( is_mirror_grid(&cave[y][x]) && !second_step )
8630 /* The target of monsterspell becomes tha mirror(broken) */
8631 monster_target_y=(s16b)y;
8632 monster_target_x=(s16b)x;
8635 for( j = 0; j <=i ; j++ )
8637 y = GRID_Y(path_g[j]);
8638 x = GRID_X(path_g[j]);
8639 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8643 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8644 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8645 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8646 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8647 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8648 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8649 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8650 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8653 for( i = 0; i < path_n ; i++ )
8656 y = GRID_Y(path_g[i]);
8657 x = GRID_X(path_g[i]);
8658 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
8659 if(!who && (project_m_n==1) && !jump ){
8660 if(cave[project_m_y][project_m_x].m_idx >0 ){
8661 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8665 /* Hack -- auto-recall */
8666 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8668 /* Hack - auto-track */
8669 health_track(cave[project_m_y][project_m_x].m_idx);
8673 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8678 /* Project along the path */
8679 for (i = 0; i < path_n; ++i)
8684 int ny = GRID_Y(path_g[i]);
8685 int nx = GRID_X(path_g[i]);
8687 if (flg & PROJECT_DISI)
8689 /* Hack -- Balls explode before reaching walls */
8690 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8692 else if (flg & PROJECT_LOS)
8694 /* Hack -- Balls explode before reaching walls */
8695 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8699 /* Hack -- Balls explode before reaching walls */
8700 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8707 /* Collect beam grids */
8708 if (flg & (PROJECT_BEAM))
8715 /* Only do visuals if requested */
8716 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8718 /* Only do visuals if the player can "see" the bolt */
8719 if (panel_contains(y, x) && player_has_los_bold(y, x))
8726 /* Obtain the bolt pict */
8727 p = bolt_pict(oy, ox, y, x, typ);
8729 /* Extract attr/char */
8733 /* Visual effects */
8734 print_rel(c, a, y, x);
8735 move_cursor_relative(y, x);
8736 /*if (fresh_before)*/ Term_fresh();
8737 Term_xtra(TERM_XTRA_DELAY, msec);
8739 /*if (fresh_before)*/ Term_fresh();
8741 /* Display "beam" grids */
8742 if (flg & (PROJECT_BEAM))
8744 /* Obtain the explosion pict */
8745 p = bolt_pict(y, x, y, x, typ);
8747 /* Extract attr/char */
8751 /* Visual effects */
8752 print_rel(c, a, y, x);
8755 /* Hack -- Activate delay */
8759 /* Hack -- delay anyway for consistency */
8762 /* Delay for consistency */
8763 Term_xtra(TERM_XTRA_DELAY, msec);
8770 /* Save the "blast epicenter" */
8774 if (breath && !path_n)
8780 flg &= ~(PROJECT_HIDE);
8784 /* Start the "explosion" */
8787 /* Hack -- make sure beams get to "explode" */
8795 /* If we found a "target", explode there */
8796 if (dist <= MAX_RANGE)
8798 /* Mega-Hack -- remove the final "beam" grid */
8799 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8802 * Create a conical breath attack
8813 flg &= ~(PROJECT_HIDE);
8815 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8819 /* Determine the blast area, work from the inside out */
8820 for (dist = 0; dist <= rad; dist++)
8822 /* Scan the maximal blast area of radius "dist" */
8823 for (y = by - dist; y <= by + dist; y++)
8825 for (x = bx - dist; x <= bx + dist; x++)
8827 /* Ignore "illegal" locations */
8828 if (!in_bounds2(y, x)) continue;
8830 /* Enforce a "circular" explosion */
8831 if (distance(by, bx, y, x) != dist) continue;
8837 /* Lights are stopped by opaque terrains */
8838 if (!los(by, bx, y, x)) continue;
8840 case GF_DISINTEGRATE:
8841 /* Disintegration are stopped only by perma-walls */
8842 if (!in_disintegration_range(by, bx, y, x)) continue;
8845 /* Ball explosions are stopped by walls */
8846 if (!projectable(by, bx, y, x)) continue;
8850 /* Save this grid */
8857 /* Encode some more "radius" info */
8863 /* Speed -- ignore "non-explosions" */
8864 if (!grids) return (FALSE);
8867 /* Display the "blast area" if requested */
8868 if (!blind && !(flg & (PROJECT_HIDE)))
8870 /* Then do the "blast", from inside out */
8871 for (t = 0; t <= gm_rad; t++)
8873 /* Dump everything with this radius */
8874 for (i = gm[t]; i < gm[t+1]; i++)
8876 /* Extract the location */
8880 /* Only do visuals if the player can "see" the blast */
8881 if (panel_contains(y, x) && player_has_los_bold(y, x))
8890 /* Obtain the explosion pict */
8891 p = bolt_pict(y, x, y, x, typ);
8893 /* Extract attr/char */
8897 /* Visual effects -- Display */
8898 print_rel(c, a, y, x);
8902 /* Hack -- center the cursor */
8903 move_cursor_relative(by, bx);
8905 /* Flush each "radius" seperately */
8906 /*if (fresh_before)*/ Term_fresh();
8908 /* Delay (efficiently) */
8909 if (visual || drawn)
8911 Term_xtra(TERM_XTRA_DELAY, msec);
8915 /* Flush the erasing */
8918 /* Erase the explosion drawn above */
8919 for (i = 0; i < grids; i++)
8921 /* Extract the location */
8925 /* Hack -- Erase if needed */
8926 if (panel_contains(y, x) && player_has_los_bold(y, x))
8932 /* Hack -- center the cursor */
8933 move_cursor_relative(by, bx);
8935 /* Flush the explosion */
8936 /*if (fresh_before)*/ Term_fresh();
8941 /* Update stuff if needed */
8942 if (p_ptr->update) update_stuff();
8945 if (flg & PROJECT_KILL)
8947 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
8948 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
8952 /* Check features */
8953 if (flg & (PROJECT_GRID))
8955 /* Start with "dist" of zero */
8958 /* Scan for features */
8959 for (i = 0; i < grids; i++)
8961 /* Hack -- Notice new "dist" values */
8962 if (gm[dist+1] == i) dist++;
8964 /* Get the grid location */
8968 /* Find the closest point in the blast */
8971 int d = dist_to_line(y, x, y1, x1, by, bx);
8973 /* Affect the grid */
8974 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8978 /* Affect the grid */
8979 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8984 /* Update stuff if needed */
8985 if (p_ptr->update) update_stuff();
8988 if (flg & (PROJECT_ITEM))
8990 /* Start with "dist" of zero */
8993 /* Scan for objects */
8994 for (i = 0; i < grids; i++)
8996 /* Hack -- Notice new "dist" values */
8997 if (gm[dist+1] == i) dist++;
8999 /* Get the grid location */
9003 /* Find the closest point in the blast */
9006 int d = dist_to_line(y, x, y1, x1, by, bx);
9008 /* Affect the object in the grid */
9009 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
9013 /* Affect the object in the grid */
9014 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
9020 /* Check monsters */
9021 if (flg & (PROJECT_KILL))
9028 /* Start with "dist" of zero */
9031 /* Scan for monsters */
9032 for (i = 0; i < grids; i++)
9036 /* Hack -- Notice new "dist" values */
9037 if (gm[dist + 1] == i) dist++;
9039 /* Get the grid location */
9043 /* A single bolt may be reflected */
9046 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9047 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9049 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
9050 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
9051 (!who || dist_hack > 1) && !one_in_(10))
9054 int max_attempts = 10;
9056 /* Choose 'new' target */
9059 t_y = y_saver - 1 + randint1(3);
9060 t_x = x_saver - 1 + randint1(3);
9063 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9065 if (max_attempts < 1)
9074 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9075 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9076 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9077 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9079 msg_print("The attack bounces!");
9082 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9084 /* Reflected bolts randomly target either one */
9085 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
9086 else flg |= PROJECT_PLAYER;
9088 /* The bolt is reflected */
9089 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9091 /* Don't affect the monster any longer */
9097 /* Find the closest point in the blast */
9100 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9104 effective_dist = dist;
9108 /* There is the riding player on this monster */
9109 if (p_ptr->riding && player_bold(y, x))
9111 /* Aimed on the player */
9112 if (flg & PROJECT_PLAYER)
9114 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9117 * A beam or bolt is well aimed
9119 * So don't affects the mount.
9126 * The spell is not well aimed,
9127 * So partly affect the mount too.
9134 * This grid is the original target.
9135 * Or aimed on your horse.
9137 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9139 /* Hit the mount with full damage */
9143 * Otherwise this grid is not the
9144 * original target, it means that line
9145 * of fire is obstructed by this
9149 * A beam or bolt will hit either
9150 * player or mount. Choose randomly.
9152 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9156 /* Hit the mount with full damage */
9160 /* Hit the player later */
9161 flg |= PROJECT_PLAYER;
9163 /* Don't affect the mount */
9169 * The spell is not well aimed, so
9170 * partly affect both player and
9179 /* Affect the monster in the grid */
9180 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
9184 /* Player affected one monster (without "jumping") */
9185 if (!who && (project_m_n == 1) && !jump)
9191 /* Track if possible */
9192 if (cave[y][x].m_idx > 0)
9194 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9198 /* Hack -- auto-recall */
9199 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
9201 /* Hack - auto-track */
9202 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9210 if (flg & (PROJECT_KILL))
9212 /* Start with "dist" of zero */
9215 /* Scan for player */
9216 for (i = 0; i < grids; i++)
9220 /* Hack -- Notice new "dist" values */
9221 if (gm[dist+1] == i) dist++;
9223 /* Get the grid location */
9227 /* Affect the player? */
9228 if (!player_bold(y, x)) continue;
9230 /* Find the closest point in the blast */
9233 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9237 effective_dist = dist;
9240 /* Target may be your horse */
9243 /* Aimed on the player */
9244 if (flg & PROJECT_PLAYER)
9246 /* Hit the player with full damage */
9250 * Hack -- When this grid was not the
9251 * original target, a beam or bolt
9252 * would hit either player or mount,
9253 * and should be choosen randomly.
9255 * But already choosen to hit the
9256 * mount at this point.
9258 * Or aimed on your horse.
9260 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9263 * A beam or bolt is well aimed
9265 * So don't affects the player.
9272 * The spell is not well aimed,
9273 * So partly affect the player too.
9279 /* Affect the player */
9280 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9288 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9290 if (rakubadam_m > 0)
9292 if (rakuba(rakubadam_m, FALSE))
9295 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9297 msg_format("%^s has thrown you off!", m_name);
9301 if (p_ptr->riding && rakubadam_p > 0)
9303 if(rakuba(rakubadam_p, FALSE))
9306 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9308 msg_format("You have fallen from %s.", m_name);
9314 /* Return "something was noticed" */
9318 bool binding_field( int dam )
9320 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9321 int mirror_num=0; /* ¶À¤Î¿ô */
9326 int msec= delay_factor*delay_factor*delay_factor;
9332 /* Default target of monsterspell is player */
9333 monster_target_y=py;
9334 monster_target_x=px;
9336 for( x=0 ; x < cur_wid ; x++ )
9338 for( y=0 ; y < cur_hgt ; y++ )
9340 if( is_mirror_grid(&cave[y][x]) &&
9341 distance(py,px,y,x) <= MAX_RANGE &&
9342 distance(py,px,y,x) != 0 &&
9343 player_has_los_bold(y,x) &&
9344 projectable(py, px, y, x)
9346 mirror_y[mirror_num]=y;
9347 mirror_x[mirror_num]=x;
9353 if( mirror_num < 2 )return FALSE;
9355 point_x[0] = randint0( mirror_num );
9357 point_x[1] = randint0( mirror_num );
9359 while( point_x[0] == point_x[1] );
9361 point_y[0]=mirror_y[point_x[0]];
9362 point_x[0]=mirror_x[point_x[0]];
9363 point_y[1]=mirror_y[point_x[1]];
9364 point_x[1]=mirror_x[point_x[1]];
9368 x=point_x[0]+point_x[1]+point_x[2];
9369 y=point_y[0]+point_y[1]+point_y[2];
9371 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9372 - (point_y[0]*3-y)*(point_x[1]*3-x);
9373 if( centersign == 0 )return FALSE;
9375 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9376 x1 = x1 < point_x[2] ? x1 : point_x[2];
9377 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9378 y1 = y1 < point_y[2] ? y1 : point_y[2];
9380 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9381 x2 = x2 > point_x[2] ? x2 : point_x[2];
9382 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9383 y2 = y2 > point_y[2] ? y2 : point_y[2];
9385 for( y=y1 ; y <=y2 ; y++ ){
9386 for( x=x1 ; x <=x2 ; x++ ){
9387 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9388 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9389 centersign*( (point_x[1]-x)*(point_y[2]-y)
9390 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9391 centersign*( (point_x[2]-x)*(point_y[0]-y)
9392 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9394 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9395 /* Visual effects */
9397 && panel_contains(y,x)){
9398 p = bolt_pict(y,x,y,x, GF_MANA );
9399 print_rel(PICT_C(p), PICT_A(p),y,x);
9400 move_cursor_relative(y, x);
9401 /*if (fresh_before)*/ Term_fresh();
9402 Term_xtra(TERM_XTRA_DELAY, msec);
9408 for( y=y1 ; y <=y2 ; y++ ){
9409 for( x=x1 ; x <=x2 ; x++ ){
9410 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9411 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9412 centersign*( (point_x[1]-x)*(point_y[2]-y)
9413 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9414 centersign*( (point_x[2]-x)*(point_y[0]-y)
9415 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9417 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9418 (void)project_f(0,0,y,x,dam,GF_MANA);
9423 for( y=y1 ; y <=y2 ; y++ ){
9424 for( x=x1 ; x <=x2 ; x++ ){
9425 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9426 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9427 centersign*( (point_x[1]-x)*(point_y[2]-y)
9428 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9429 centersign*( (point_x[2]-x)*(point_y[0]-y)
9430 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9432 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9433 (void)project_o(0,0,y,x,dam,GF_MANA);
9438 for( y=y1 ; y <=y2 ; y++ ){
9439 for( x=x1 ; x <=x2 ; x++ ){
9440 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9441 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9442 centersign*( (point_x[1]-x)*(point_y[2]-y)
9443 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9444 centersign*( (point_x[2]-x)*(point_y[0]-y)
9445 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9447 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9448 (void)project_m(0,0,y,x,dam,GF_MANA,
9449 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
9456 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9458 msg_print("The field broke a mirror");
9460 remove_mirror(point_y[0],point_x[0]);
9466 void seal_of_mirror( int dam )
9470 for( x = 0 ; x < cur_wid ; x++ )
9472 for( y = 0 ; y < cur_hgt ; y++ )
9474 if( is_mirror_grid(&cave[y][x]))
9476 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9477 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
9479 if( !cave[y][x].m_idx )