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 */
1181 if (is_mirror_grid(c_ptr)) remove_mirror(y, x);
1183 /* Permanent features don't get effect */
1184 /* But not protect monsters and other objects */
1185 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1187 cave_alter_feat(y, x, FF_HURT_DISI);
1189 /* Update some things -- similar to GF_KILL_WALL */
1190 p_ptr->update |= (PU_FLOW);
1197 /* Return "Anything seen?" */
1204 * We are called from "project()" to "damage" objects
1206 * We are called both for "beam" effects and "ball" effects.
1208 * Perhaps we should only SOMETIMES damage things on the ground.
1210 * The "r" parameter is the "distance from ground zero".
1212 * Note that we determine if the player can "see" anything that happens
1213 * by taking into account: blindness, line-of-sight, and illumination.
1215 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1217 * We return "TRUE" if the effect of the projection is "obvious".
1219 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1221 cave_type *c_ptr = &cave[y][x];
1223 s16b this_o_idx, next_o_idx = 0;
1225 bool obvious = FALSE;
1226 bool known = player_has_los_bold(y, x);
1228 u32b flgs[TR_FLAG_SIZE];
1230 char o_name[MAX_NLEN];
1233 bool is_potion = FALSE;
1237 who = who ? who : 0;
1239 /* Reduce damage by distance */
1240 dam = (dam + r) / (r + 1);
1243 /* Scan all objects in the grid */
1244 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1246 /* Acquire object */
1247 object_type *o_ptr = &o_list[this_o_idx];
1249 bool is_art = FALSE;
1250 bool ignore = FALSE;
1251 bool do_kill = FALSE;
1253 cptr note_kill = NULL;
1256 /* Get the "plural"-ness */
1257 bool plural = (o_ptr->number > 1);
1260 /* Acquire next object */
1261 next_o_idx = o_ptr->next_o_idx;
1263 /* Extract the flags */
1264 object_flags(o_ptr, flgs);
1266 /* Check for artifact */
1267 if (object_is_artifact(o_ptr)) is_art = TRUE;
1269 /* Analyze the type */
1272 /* Acid -- Lots of things */
1275 if (hates_acid(o_ptr))
1279 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1281 note_kill = (plural ? " melt!" : " melts!");
1284 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1289 /* Elec -- Rings and Wands */
1292 if (hates_elec(o_ptr))
1296 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1298 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1301 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1306 /* Fire -- Flammable objects */
1309 if (hates_fire(o_ptr))
1313 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1315 note_kill = (plural ? " burn up!" : " burns up!");
1318 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1323 /* Cold -- potions and flasks */
1326 if (hates_cold(o_ptr))
1329 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1331 note_kill = (plural ? " shatter!" : " shatters!");
1335 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1343 if (hates_fire(o_ptr))
1347 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1349 note_kill = (plural ? " burn up!" : " burns up!");
1352 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1354 if (hates_elec(o_ptr))
1359 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1361 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1364 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1372 if (hates_fire(o_ptr))
1376 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1378 note_kill = (plural ? " burn up!" : " burns up!");
1381 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1383 if (hates_cold(o_ptr))
1388 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1390 note_kill = (plural ? " shatter!" : " shatters!");
1393 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1398 /* Hack -- break potions and such */
1404 if (hates_cold(o_ptr))
1407 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1409 note_kill = (plural ? " shatter!" : " shatters!");
1417 /* Mana and Chaos -- destroy everything */
1424 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1426 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1432 case GF_DISINTEGRATE:
1436 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1438 note_kill = (plural ? " evaporate!" : " evaporates!");
1448 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1450 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1453 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1454 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1458 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1462 if (object_is_cursed(o_ptr))
1466 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1468 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1477 identify_item(o_ptr);
1479 /* Auto-inscription */
1480 autopick_alter_item((-this_o_idx), FALSE);
1488 /* Chests are noticed only if trapped or locked */
1489 if (o_ptr->tval == TV_CHEST)
1491 /* Disarm/Unlock traps */
1492 if (o_ptr->pval > 0)
1494 /* Disarm or Unlock */
1495 o_ptr->pval = (0 - o_ptr->pval);
1498 object_known(o_ptr);
1501 if (known && (o_ptr->marked & OM_FOUND))
1504 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1506 msg_print("Click!");
1518 if (o_ptr->tval == TV_CORPSE)
1523 if (!who || is_pet(&m_list[who]))
1524 mode |= PM_FORCE_PET;
1526 for (i = 0; i < o_ptr->number ; i++)
1528 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1529 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1534 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1536 note_kill = (plural ? " become dust." : " becomes dust.");
1541 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1544 note_kill = "À¸¤Ê֤ä¿¡£";
1546 note_kill = " revived.";
1549 else if (!note_kill)
1552 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1554 note_kill = (plural ? " become dust." : " becomes dust.");
1566 /* Attempt to destroy the object */
1569 /* Effect "observed" */
1570 if (known && (o_ptr->marked & OM_FOUND))
1573 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1576 /* Artifacts, and other objects, get to resist */
1577 if (is_art || ignore)
1579 /* Observe the resist */
1580 if (known && (o_ptr->marked & OM_FOUND))
1583 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1586 msg_format("The %s %s unaffected!",
1587 o_name, (plural ? "are" : "is"));
1596 /* Describe if needed */
1597 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1600 msg_format("%s¤Ï%s", o_name, note_kill);
1602 msg_format("The %s%s", o_name, note_kill);
1607 k_idx = o_ptr->k_idx;
1608 is_potion = object_is_potion(o_ptr);
1611 /* Delete the object */
1612 delete_object_idx(this_o_idx);
1614 /* Potions produce effects when 'shattered' */
1617 (void)potion_smash_effect(who, y, x, k_idx);
1626 /* Return "Anything seen?" */
1632 * Helper function for "project()" below.
1634 * Handle a beam/bolt/ball causing damage to a monster.
1636 * This routine takes a "source monster" (by index) which is mostly used to
1637 * determine if the player is causing the damage, and a "radius" (see below),
1638 * which is used to decrease the power of explosions with distance, and a
1639 * location, via integers which are modified by certain types of attacks
1640 * (polymorph and teleport being the obvious ones), a default damage, which
1641 * is modified as needed based on various properties, and finally a "damage
1642 * type" (see below).
1644 * Note that this routine can handle "no damage" attacks (like teleport) by
1645 * taking a "zero" damage, and can even take "parameters" to attacks (like
1646 * confuse) by accepting a "damage", using it to calculate the effect, and
1647 * then setting the damage to zero. Note that the "damage" parameter is
1648 * divided by the radius, so monsters not at the "epicenter" will not take
1649 * as much damage (or whatever)...
1651 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1652 * may result in a dereference of an invalid pointer. XXX XXX XXX
1654 * Various messages are produced, and damage is applied.
1656 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1657 * actually be "made" of that substance, or "breathe" big balls of it.
1659 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1662 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1663 * and hurts evil less. If can breath nether, then it resists it as well.
1665 * Damage reductions use the following formulas:
1666 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1667 * gives avg damage of .655, ranging from .858 to .500
1668 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1669 * gives avg damage of .544, ranging from .714 to .417
1670 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1671 * gives avg damage of .444, ranging from .556 to .333
1672 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1673 * gives avg damage of .327, ranging from .427 to .250
1674 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1675 * gives something simple.
1677 * In this function, "result" messages are postponed until the end, where
1678 * the "note" string is appended to the monster name, if not NULL. So,
1679 * to make a spell have "no effect" just set "note" to NULL. You should
1680 * also set "notice" to FALSE, or the player will learn what the spell does.
1682 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1684 /* "flg" was added. */
1685 static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
1689 cave_type *c_ptr = &cave[y][x];
1691 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1692 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1694 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1698 /* Is the monster "seen"? */
1699 bool seen = m_ptr->ml;
1700 bool seen_msg = is_seen(m_ptr);
1702 bool slept = (bool)MON_CSLEEP(m_ptr);
1704 /* Were the effects "obvious" (if seen)? */
1705 bool obvious = FALSE;
1707 /* Can the player know about this effect? */
1708 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1710 /* Were the effects "irrelevant"? */
1711 bool skipped = FALSE;
1713 /* Gets the monster angry at the source of the effect? */
1714 bool get_angry = FALSE;
1716 /* Polymorph setting (true or false) */
1717 bool do_poly = FALSE;
1719 /* Teleport setting (max distance) */
1722 /* Confusion setting (amount to confuse) */
1725 /* Stunning setting (amount to stun) */
1728 /* Sleep amount (amount to sleep) */
1731 /* Fear amount (amount to fear) */
1734 /* Time amount (amount to time) */
1737 bool heal_leper = FALSE;
1739 /* Hold the monster name */
1748 /* Assume no note */
1751 /* Assume a default death */
1752 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1757 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1760 if (!c_ptr->m_idx) return (FALSE);
1762 /* Never affect projector */
1763 if (who && (c_ptr->m_idx == who)) return (FALSE);
1764 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1765 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1767 /* Don't affect already death monsters */
1768 /* Prevents problems with chain reactions of exploding monsters */
1769 if (m_ptr->hp < 0) return (FALSE);
1771 /* Reduce damage by distance */
1772 dam = (dam + r) / (r + 1);
1775 /* Get the monster name (BEFORE polymorphing) */
1776 monster_desc(m_name, m_ptr, 0);
1779 /* Get the monster possessive ("his"/"her"/"its") */
1780 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1784 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1786 /* Analyze the damage type */
1789 /* Magic Missile -- pure damage */
1792 if (seen) obvious = TRUE;
1794 if (r_ptr->flagsr & RFR_RES_ALL)
1797 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1799 note = " is immune.";
1802 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1811 if (seen) obvious = TRUE;
1813 if (r_ptr->flagsr & RFR_RES_ALL)
1816 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1818 note = " is immune.";
1821 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1824 if (r_ptr->flagsr & RFR_IM_ACID)
1827 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1829 note = " resists a lot.";
1833 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1841 if (seen) obvious = TRUE;
1843 if (r_ptr->flagsr & RFR_RES_ALL)
1846 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1848 note = " is immune.";
1851 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1854 if (r_ptr->flagsr & RFR_IM_ELEC)
1857 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1859 note = " resists a lot.";
1863 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1871 if (seen) obvious = TRUE;
1873 if (r_ptr->flagsr & RFR_RES_ALL)
1876 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1878 note = " is immune.";
1881 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1884 if (r_ptr->flagsr & RFR_IM_FIRE)
1887 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1889 note = " resists a lot.";
1893 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1895 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1898 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1900 note = " is hit hard.";
1904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1912 if (seen) obvious = TRUE;
1914 if (r_ptr->flagsr & RFR_RES_ALL)
1917 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1919 note = " is immune.";
1922 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1925 if (r_ptr->flagsr & RFR_IM_COLD)
1928 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1930 note = " resists a lot.";
1934 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1936 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1939 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1941 note = " is hit hard.";
1945 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1953 if (seen) obvious = TRUE;
1955 if (r_ptr->flagsr & RFR_RES_ALL)
1958 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1960 note = " is immune.";
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1966 if (r_ptr->flagsr & RFR_IM_POIS)
1969 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1971 note = " resists a lot.";
1975 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1983 if (seen) obvious = TRUE;
1985 if (r_ptr->flagsr & RFR_RES_ALL)
1988 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1990 note = " is immune.";
1993 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1996 if (r_ptr->flagsr & RFR_IM_POIS)
1999 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2004 dam *= 3; dam /= randint1(6) + 6;
2005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
2007 else if (one_in_(3)) do_poly = TRUE;
2011 /* Hellfire -- hurts Evil */
2014 if (seen) obvious = TRUE;
2016 if (r_ptr->flagsr & RFR_RES_ALL)
2019 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2021 note = " is immune.";
2024 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2027 if (r_ptr->flags3 & RF3_GOOD)
2031 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2033 note = " is hit hard.";
2036 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2041 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2044 if (seen) obvious = TRUE;
2046 if (r_ptr->flagsr & RFR_RES_ALL)
2049 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2051 note = " is immune.";
2054 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2057 if (r_ptr->flags3 & RF3_GOOD)
2061 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2063 note = " is immune.";
2066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2068 else if (r_ptr->flags3 & RF3_EVIL)
2072 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2074 note = " is hit hard.";
2077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2082 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2087 dam *= 3; dam /= randint1(6) + 6;
2092 /* Arrow -- XXX no defense */
2095 if (seen) obvious = TRUE;
2097 if (r_ptr->flagsr & RFR_RES_ALL)
2100 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2102 note = " is immune.";
2105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2111 /* Plasma -- XXX perhaps check ELEC or FIRE */
2114 if (seen) obvious = TRUE;
2116 if (r_ptr->flagsr & RFR_RES_ALL)
2119 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2121 note = " is immune.";
2124 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2127 if (r_ptr->flagsr & RFR_RES_PLAS)
2130 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2135 dam *= 3; dam /= randint1(6) + 6;
2136 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2141 /* Nether -- see above */
2144 if (seen) obvious = TRUE;
2146 if (r_ptr->flagsr & RFR_RES_ALL)
2149 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2151 note = " is immune.";
2154 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2157 if (r_ptr->flagsr & RFR_RES_NETH)
2159 if (r_ptr->flags3 & RF3_UNDEAD)
2162 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2164 note = " is immune.";
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2173 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2178 dam *= 3; dam /= randint1(6) + 6;
2180 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2182 else if (r_ptr->flags3 & RF3_EVIL)
2186 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2188 note = " resists somewhat.";
2191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2196 /* Water (acid) damage -- Water spirits/elementals are immune */
2199 if (seen) obvious = TRUE;
2201 if (r_ptr->flagsr & RFR_RES_ALL)
2204 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2206 note = " is immune.";
2209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2212 if (r_ptr->flagsr & RFR_RES_WATE)
2214 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2217 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2219 note = " is immune.";
2227 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2232 dam *= 3; dam /= randint1(6) + 6;
2234 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2239 /* Chaos -- Chaos breathers resist */
2242 if (seen) obvious = TRUE;
2244 if (r_ptr->flagsr & RFR_RES_ALL)
2247 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2249 note = " is immune.";
2252 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2255 if (r_ptr->flagsr & RFR_RES_CHAO)
2258 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2263 dam *= 3; dam /= randint1(6) + 6;
2264 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2266 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2269 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2271 note = " resists somewhat.";
2274 dam *= 3; dam /= randint1(6) + 6;
2275 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2280 do_conf = (5 + randint1(11) + r) / (r + 1);
2285 /* Shards -- Shard breathers resist */
2288 if (seen) obvious = TRUE;
2290 if (r_ptr->flagsr & RFR_RES_ALL)
2293 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2295 note = " is immune.";
2298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2301 if (r_ptr->flagsr & RFR_RES_SHAR)
2304 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2309 dam *= 3; dam /= randint1(6) + 6;
2310 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2315 /* Rocket: Shard resistance helps */
2318 if (seen) obvious = TRUE;
2320 if (r_ptr->flagsr & RFR_RES_ALL)
2323 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2325 note = " is immune.";
2328 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2331 if (r_ptr->flagsr & RFR_RES_SHAR)
2334 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2336 note = " resists somewhat.";
2340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2346 /* Sound -- Sound breathers resist */
2349 if (seen) obvious = TRUE;
2351 if (r_ptr->flagsr & RFR_RES_ALL)
2354 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2356 note = " is immune.";
2359 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2362 if (r_ptr->flagsr & RFR_RES_SOUN)
2365 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2370 dam *= 2; dam /= randint1(6) + 6;
2371 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2373 else do_stun = (10 + randint1(15) + r) / (r + 1);
2380 if (seen) obvious = TRUE;
2382 if (r_ptr->flagsr & RFR_RES_ALL)
2385 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2387 note = " is immune.";
2390 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2393 if (r_ptr->flags3 & RF3_NO_CONF)
2396 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2401 dam *= 3; dam /= randint1(6) + 6;
2402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2404 else do_conf = (10 + randint1(15) + r) / (r + 1);
2408 /* Disenchantment -- Breathers and Disenchanters resist */
2411 if (seen) obvious = TRUE;
2413 if (r_ptr->flagsr & RFR_RES_ALL)
2416 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2418 note = " is immune.";
2421 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2424 if (r_ptr->flagsr & RFR_RES_DISE)
2427 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2432 dam *= 3; dam /= randint1(6) + 6;
2433 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2438 /* Nexus -- Breathers and Existers resist */
2441 if (seen) obvious = TRUE;
2443 if (r_ptr->flagsr & RFR_RES_ALL)
2446 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2448 note = " is immune.";
2451 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2454 if (r_ptr->flagsr & RFR_RES_NEXU)
2457 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2462 dam *= 3; dam /= randint1(6) + 6;
2463 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2471 if (seen) obvious = TRUE;
2473 if (r_ptr->flagsr & RFR_RES_ALL)
2476 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2478 note = " is immune.";
2481 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2484 if (r_ptr->flagsr & RFR_RES_WALL)
2487 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2492 dam *= 3; dam /= randint1(6) + 6;
2493 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2495 else do_stun = (randint1(15) + r) / (r + 1);
2499 /* Inertia -- breathers resist */
2502 if (seen) obvious = TRUE;
2504 if (r_ptr->flagsr & RFR_RES_ALL)
2507 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2509 note = " is immune.";
2512 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2515 if (r_ptr->flagsr & RFR_RES_INER)
2518 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2523 dam *= 3; dam /= randint1(6) + 6;
2524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2528 /* Powerful monsters can resist */
2529 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2530 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2534 /* Normal monsters slow down */
2537 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2540 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2542 note = " starts moving slower.";
2550 /* Time -- breathers resist */
2553 if (seen) obvious = TRUE;
2555 if (r_ptr->flagsr & RFR_RES_ALL)
2558 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2560 note = " is immune.";
2563 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2566 if (r_ptr->flagsr & RFR_RES_TIME)
2569 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2574 dam *= 3; dam /= randint1(6) + 6;
2575 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2577 else do_time = (dam + 1) / 2;
2581 /* Gravity -- breathers resist */
2584 bool resist_tele = FALSE;
2586 if (seen) obvious = TRUE;
2588 if (r_ptr->flagsr & RFR_RES_ALL)
2591 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2593 note = " is immune.";
2596 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2599 if (r_ptr->flagsr & RFR_RES_TELE)
2601 if (r_ptr->flags1 & (RF1_UNIQUE))
2603 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2605 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2607 note = " is unaffected!";
2612 else if (r_ptr->level > randint1(100))
2614 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2616 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2625 if (!resist_tele) do_dist = 10;
2627 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2629 if (r_ptr->flagsr & RFR_RES_GRAV)
2632 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2637 dam *= 3; dam /= randint1(6) + 6;
2639 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2644 /* Powerful monsters can resist */
2645 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2646 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2650 /* Normal monsters slow down */
2653 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2656 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2658 note = " starts moving slower.";
2664 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2666 /* Attempt a saving throw */
2667 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2668 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2672 /* No obvious effect */
2674 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2676 note = " is unaffected!";
2690 if (seen) obvious = TRUE;
2692 if (r_ptr->flagsr & RFR_RES_ALL)
2695 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2697 note = " is immune.";
2700 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2708 case GF_DISINTEGRATE:
2710 if (seen) obvious = TRUE;
2712 if (r_ptr->flagsr & RFR_RES_ALL)
2715 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2717 note = " is immune.";
2720 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2723 if (r_ptr->flags3 & RF3_HURT_ROCK)
2725 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2727 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2728 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2730 note = " loses some skin!";
2731 note_dies = " evaporates!";
2741 if (seen) obvious = TRUE;
2743 /* PSI only works if the monster can see you! -- RG */
2744 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2747 if (seen_msg) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2749 if (seen_msg) msg_format("%^s can't see you, and isn't affected!", m_name);
2755 if (r_ptr->flagsr & RFR_RES_ALL)
2758 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2760 note = " is immune.";
2763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2766 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2770 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2772 note = " is immune!";
2774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2777 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2778 (r_ptr->flags3 & RF3_ANIMAL) ||
2779 (r_ptr->level > randint1(3 * dam)))
2783 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2790 * Powerful demons & undead can turn a mindcrafter's
2791 * attacks back on them
2793 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2794 (r_ptr->level > p_ptr->lev / 2) &&
2799 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2801 msg_format("%^s%s corrupted mind backlashes your attack!",
2802 m_name, (seen ? "'s" : "s"));
2806 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2809 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2811 msg_print("You resist the effects!");
2817 /* Injure +/- confusion */
2818 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2819 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2820 if (one_in_(4) && !CHECK_MULTISHADOW())
2822 switch (randint1(4))
2825 set_confused(p_ptr->confused + 3 + randint1(dam));
2828 set_stun(p_ptr->stun + randint1(dam));
2832 if (r_ptr->flags3 & RF3_NO_FEAR)
2834 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2836 note = " is unaffected.";
2840 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2844 if (!p_ptr->free_act)
2845 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2854 if ((dam > 0) && one_in_(4))
2856 switch (randint1(4))
2859 do_conf = 3 + randint1(dam);
2862 do_stun = 3 + randint1(dam);
2865 do_fear = 3 + randint1(dam);
2869 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2871 note = " falls asleep!";
2874 do_sleep = 3 + randint1(dam);
2880 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2882 note_dies = " collapses, a mindless husk.";
2890 if (seen) obvious = TRUE;
2892 if (r_ptr->flagsr & RFR_RES_ALL)
2895 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2897 note = " is immune.";
2900 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2903 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2907 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2909 note = " is immune!";
2913 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2914 (r_ptr->flags3 & RF3_ANIMAL) ||
2915 (r_ptr->level > randint1(3 * dam)))
2919 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2926 * Powerful demons & undead can turn a mindcrafter's
2927 * attacks back on them
2929 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2930 (r_ptr->level > p_ptr->lev / 2) &&
2935 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2937 msg_format("%^s%s corrupted mind backlashes your attack!",
2938 m_name, (seen ? "'s" : "s"));
2942 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2945 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2947 msg_print("You resist the effects!");
2952 /* Injure + mana drain */
2953 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2954 if (!CHECK_MULTISHADOW())
2957 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2959 msg_print("Your psychic energy is drained!");
2962 p_ptr->csp -= damroll(5, dam) / 2;
2963 if (p_ptr->csp < 0) p_ptr->csp = 0;
2964 p_ptr->redraw |= PR_MANA;
2965 p_ptr->window |= (PW_SPELL);
2967 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2974 int b = damroll(5, dam) / 4;
2976 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
2978 msg_format("You convert %s%s pain into psychic energy!",
2979 m_name, (seen ? "'s" : "s"));
2982 b = MIN(p_ptr->msp, p_ptr->csp + b);
2984 p_ptr->redraw |= PR_MANA;
2985 p_ptr->window |= (PW_SPELL);
2989 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2991 note_dies = " collapses, a mindless husk.";
2997 case GF_TELEKINESIS:
2999 if (seen) obvious = TRUE;
3001 if (r_ptr->flagsr & RFR_RES_ALL)
3004 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3006 note = " is immune.";
3009 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3014 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3019 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3021 /* Attempt a saving throw */
3022 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3023 (r_ptr->level > 5 + randint1(dam)))
3027 /* No obvious effect */
3033 /* Psycho-spear -- powerful magic missile */
3036 if (seen) obvious = TRUE;
3038 if (r_ptr->flagsr & RFR_RES_ALL)
3041 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3043 note = " is immune.";
3046 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3052 /* Meteor -- powerful magic missile */
3055 if (seen) obvious = TRUE;
3057 if (r_ptr->flagsr & RFR_RES_ALL)
3060 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3062 note = " is immune.";
3065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3073 if (!is_hostile(m_ptr)) break;
3075 if (seen) obvious = TRUE;
3077 if (r_ptr->flagsr & RFR_RES_ALL)
3080 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3082 note = " is immune.";
3085 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3088 /* Attempt a saving throw */
3089 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3090 (r_ptr->flags3 & RF3_NO_CONF) ||
3091 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3093 /* Memorize a flag */
3094 if (r_ptr->flags3 & RF3_NO_CONF)
3096 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3103 * Powerful demons & undead can turn a mindcrafter's
3104 * attacks back on them
3106 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3107 (r_ptr->level > p_ptr->lev / 2) &&
3112 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3114 msg_format("%^s%s corrupted mind backlashes your attack!",
3115 m_name, (seen ? "'s" : "s"));
3119 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3122 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3124 msg_print("You resist the effects!");
3130 /* Confuse, stun, terrify */
3131 switch (randint1(4))
3134 set_stun(p_ptr->stun + dam / 2);
3137 set_confused(p_ptr->confused + dam / 2);
3141 if (r_ptr->flags3 & RF3_NO_FEAR)
3143 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3145 note = " is unaffected.";
3149 set_afraid(p_ptr->afraid + dam);
3156 /* No obvious effect */
3158 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3160 note = " is unaffected!";
3168 if ((dam > 29) && (randint1(100) < dam))
3171 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3173 note = " is in your thrall!";
3180 switch (randint1(4))
3194 /* No "real" damage */
3201 /* Ice -- Cold + Cuts + Stun */
3204 if (seen) obvious = TRUE;
3206 if (r_ptr->flagsr & RFR_RES_ALL)
3209 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3211 note = " is immune.";
3214 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3217 do_stun = (randint1(15) + 1) / (r + 1);
3218 if (r_ptr->flagsr & RFR_IM_COLD)
3221 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3223 note = " resists a lot.";
3227 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3229 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3232 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3234 note = " is hit hard.";
3238 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3247 if (seen) obvious = TRUE;
3249 if (r_ptr->flagsr & RFR_RES_ALL)
3252 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3254 note = " is immune.";
3257 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3260 if (!monster_living(r_ptr))
3262 if (is_original_ap_and_seen(m_ptr))
3264 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3265 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3266 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3270 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3272 note = " is unaffected!";
3278 else do_time = (dam+7)/8;
3286 if (seen) obvious = TRUE;
3288 if (r_ptr->flagsr & RFR_RES_ALL)
3291 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3293 note = " is immune.";
3296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3299 if (!monster_living(r_ptr))
3301 if (is_original_ap_and_seen(m_ptr))
3303 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3304 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3305 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3309 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3311 note = " is immune.";
3317 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3318 (randint1(888) != 666)) ||
3319 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3320 randint1(100) != 66))
3323 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3335 /* Polymorph monster (Use "dam" as "power") */
3338 if (seen) obvious = TRUE;
3340 if (r_ptr->flagsr & RFR_RES_ALL)
3343 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3345 note = " is immune.";
3348 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3351 /* Attempt to polymorph (see below) */
3354 /* Powerful monsters can resist */
3355 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3356 (r_ptr->flags1 & RF1_QUESTOR) ||
3357 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3360 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3362 note = " is unaffected!";
3369 /* No "real" damage */
3376 /* Clone monsters (Ignore "dam") */
3379 if (seen) obvious = TRUE;
3381 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3384 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3386 note = " is unaffected!";
3392 m_ptr->hp = m_ptr->maxhp;
3394 /* Attempt to clone. */
3395 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3398 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3406 /* No "real" damage */
3413 /* Heal Monster (use "dam" as amount of healing) */
3416 if (seen) obvious = TRUE;
3419 (void)set_monster_csleep(c_ptr->m_idx, 0);
3421 if (m_ptr->maxhp < m_ptr->max_maxhp)
3424 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3426 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3428 m_ptr->maxhp = m_ptr->max_maxhp;
3433 /* Redraw (later) if needed */
3434 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3435 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3443 if (seen) obvious = TRUE;
3446 (void)set_monster_csleep(c_ptr->m_idx, 0);
3447 if (MON_STUNNED(m_ptr))
3450 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3452 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3454 (void)set_monster_stunned(c_ptr->m_idx, 0);
3456 if (MON_CONFUSED(m_ptr))
3459 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3461 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3463 (void)set_monster_confused(c_ptr->m_idx, 0);
3465 if (MON_MONFEAR(m_ptr))
3468 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3470 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3472 (void)set_monster_monfear(c_ptr->m_idx, 0);
3476 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3479 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3483 chg_virtue(V_VITALITY, 1);
3485 if (r_ptr->flags1 & RF1_UNIQUE)
3486 chg_virtue(V_INDIVIDUALISM, 1);
3488 if (is_friendly(m_ptr))
3489 chg_virtue(V_HONOUR, 1);
3490 else if (!(r_ptr->flags3 & RF3_EVIL))
3492 if (r_ptr->flags3 & RF3_GOOD)
3493 chg_virtue(V_COMPASSION, 2);
3495 chg_virtue(V_COMPASSION, 1);
3498 if (r_ptr->flags3 & RF3_ANIMAL)
3499 chg_virtue(V_NATURE, 1);
3502 if (m_ptr->r_idx == MON_LEPER)
3505 if (!who) chg_virtue(V_COMPASSION, 5);
3508 /* Redraw (later) if needed */
3509 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3510 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3514 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3516 note = " looks healthier.";
3519 /* No "real" damage */
3525 /* Speed Monster (Ignore "dam") */
3528 if (seen) obvious = TRUE;
3531 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
3534 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3536 note = " starts moving faster.";
3542 if (r_ptr->flags1 & RF1_UNIQUE)
3543 chg_virtue(V_INDIVIDUALISM, 1);
3544 if (is_friendly(m_ptr))
3545 chg_virtue(V_HONOUR, 1);
3548 /* No "real" damage */
3554 /* Slow Monster (Use "dam" as "power") */
3557 if (seen) obvious = TRUE;
3559 if (r_ptr->flagsr & RFR_RES_ALL)
3562 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3564 note = " is immune.";
3567 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3570 /* Powerful monsters can resist */
3571 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3572 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3575 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3577 note = " is unaffected!";
3583 /* Normal monsters slow down */
3586 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3589 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3591 note = " starts moving slower.";
3596 /* No "real" damage */
3602 /* Sleep (Use "dam" as "power") */
3605 if (seen) obvious = TRUE;
3607 if (r_ptr->flagsr & RFR_RES_ALL)
3610 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3612 note = " is immune.";
3615 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3618 /* Attempt a saving throw */
3619 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3620 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3621 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3623 /* Memorize a flag */
3624 if (r_ptr->flags3 & RF3_NO_SLEEP)
3626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3629 /* No obvious effect */
3631 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3633 note = " is unaffected!";
3640 /* Go to sleep (much) later */
3642 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3644 note = " falls asleep!";
3650 /* No "real" damage */
3656 /* Sleep (Use "dam" as "power") */
3657 case GF_STASIS_EVIL:
3659 if (seen) obvious = TRUE;
3661 if (r_ptr->flagsr & RFR_RES_ALL)
3664 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3666 note = " is immune.";
3669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3672 /* Attempt a saving throw */
3673 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3674 !(r_ptr->flags3 & RF3_EVIL) ||
3675 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3678 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3680 note = " is unaffected!";
3687 /* Go to sleep (much) later */
3689 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3691 note = " is suspended!";
3697 /* No "real" damage */
3702 /* Sleep (Use "dam" as "power") */
3705 if (seen) obvious = TRUE;
3707 if (r_ptr->flagsr & RFR_RES_ALL)
3710 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3712 note = " is immune.";
3715 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3718 /* Attempt a saving throw */
3719 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3720 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3723 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3725 note = " is unaffected!";
3732 /* Go to sleep (much) later */
3734 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3736 note = " is suspended!";
3742 /* No "real" damage */
3751 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3752 vir = virtue_number(V_HARMONY);
3755 dam += p_ptr->virtues[vir-1]/10;
3758 vir = virtue_number(V_INDIVIDUALISM);
3761 dam -= p_ptr->virtues[vir-1]/20;
3764 if (seen) obvious = TRUE;
3766 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3769 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3771 note = " is immune.";
3774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3778 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3781 /* Attempt a saving throw */
3782 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3783 (r_ptr->flags3 & RF3_NO_CONF) ||
3784 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3785 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3787 /* Memorize a flag */
3788 if (r_ptr->flags3 & RF3_NO_CONF)
3790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3794 /* No obvious effect */
3796 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3798 note = " is unaffected!";
3803 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3805 else if (p_ptr->cursed & TRC_AGGRAVATE)
3808 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3810 note = " hates you too much!";
3813 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3818 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3820 note = " suddenly seems friendly!";
3825 chg_virtue(V_INDIVIDUALISM, -1);
3826 if (r_ptr->flags3 & RF3_ANIMAL)
3827 chg_virtue(V_NATURE, 1);
3830 /* No "real" damage */
3835 /* Control undead */
3836 case GF_CONTROL_UNDEAD:
3839 if (seen) obvious = TRUE;
3841 vir = virtue_number(V_UNLIFE);
3844 dam += p_ptr->virtues[vir-1]/10;
3847 vir = virtue_number(V_INDIVIDUALISM);
3850 dam -= p_ptr->virtues[vir-1]/20;
3853 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3856 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3858 note = " is immune.";
3861 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3865 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3868 /* Attempt a saving throw */
3869 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3870 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3871 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3872 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3874 /* No obvious effect */
3876 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3878 note = " is unaffected!";
3882 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3884 else if (p_ptr->cursed & TRC_AGGRAVATE)
3887 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3889 note = " hates you too much!";
3892 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3897 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3899 note = " is in your thrall!";
3905 /* No "real" damage */
3911 case GF_CONTROL_DEMON:
3914 if (seen) obvious = TRUE;
3916 vir = virtue_number(V_UNLIFE);
3919 dam += p_ptr->virtues[vir-1]/10;
3922 vir = virtue_number(V_INDIVIDUALISM);
3925 dam -= p_ptr->virtues[vir-1]/20;
3928 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3931 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3933 note = " is immune.";
3936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3940 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3943 /* Attempt a saving throw */
3944 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3945 (!(r_ptr->flags3 & RF3_DEMON)) ||
3946 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3947 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3949 /* No obvious effect */
3951 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3953 note = " is unaffected!";
3957 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3959 else if (p_ptr->cursed & TRC_AGGRAVATE)
3962 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3964 note = " hates you too much!";
3967 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3972 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3974 note = " is in your thrall!";
3980 /* No "real" damage */
3986 case GF_CONTROL_ANIMAL:
3990 if (seen) obvious = TRUE;
3992 vir = virtue_number(V_NATURE);
3995 dam += p_ptr->virtues[vir-1]/10;
3998 vir = virtue_number(V_INDIVIDUALISM);
4001 dam -= p_ptr->virtues[vir-1]/20;
4004 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4007 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4009 note = " is immune.";
4012 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4016 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4019 /* Attempt a saving throw */
4020 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4021 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4022 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4023 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4024 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4026 /* Memorize a flag */
4027 if (r_ptr->flags3 & (RF3_NO_CONF))
4029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4033 /* No obvious effect */
4035 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4037 note = " is unaffected!";
4041 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4043 else if (p_ptr->cursed & TRC_AGGRAVATE)
4046 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4048 note = " hates you too much!";
4051 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4056 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4058 note = " is tamed!";
4063 if (r_ptr->flags3 & RF3_ANIMAL)
4064 chg_virtue(V_NATURE, 1);
4067 /* No "real" damage */
4073 case GF_CONTROL_LIVING:
4077 vir = virtue_number(V_UNLIFE);
4078 if (seen) obvious = TRUE;
4080 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4081 vir = virtue_number(V_UNLIFE);
4084 dam -= p_ptr->virtues[vir-1]/10;
4087 vir = virtue_number(V_INDIVIDUALISM);
4090 dam -= p_ptr->virtues[vir-1]/20;
4093 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4094 if (dam < 1) dam = 1;
4096 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4098 msg_format("You stare into %s.", m_name);
4100 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4103 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4105 note = " is immune.";
4108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4112 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4115 /* Attempt a saving throw */
4116 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4117 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4118 !monster_living(r_ptr) ||
4119 ((r_ptr->level+10) > randint1(dam)))
4122 /* No obvious effect */
4124 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4126 note = " is unaffected!";
4130 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4132 else if (p_ptr->cursed & TRC_AGGRAVATE)
4135 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4137 note = " hates you too much!";
4140 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4145 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4147 note = " is tamed!";
4152 if (r_ptr->flags3 & RF3_ANIMAL)
4153 chg_virtue(V_NATURE, 1);
4156 /* No "real" damage */
4161 /* Confusion (Use "dam" as "power") */
4164 if (seen) obvious = TRUE;
4166 if (r_ptr->flagsr & RFR_RES_ALL)
4169 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4171 note = " is immune.";
4174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4177 /* Get confused later */
4178 do_conf = damroll(3, (dam / 2)) + 1;
4180 /* Attempt a saving throw */
4181 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4182 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4183 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4185 /* Memorize a flag */
4186 if (r_ptr->flags3 & (RF3_NO_CONF))
4188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4194 /* No obvious effect */
4196 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4198 note = " is unaffected!";
4204 /* No "real" damage */
4211 if (seen) obvious = TRUE;
4213 if (r_ptr->flagsr & RFR_RES_ALL)
4216 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4218 note = " is immune.";
4221 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4224 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4226 /* Attempt a saving throw */
4227 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4228 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4233 /* No obvious effect */
4235 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4237 note = " is unaffected!";
4243 /* No "real" damage */
4251 /* Lite, but only hurts susceptible creatures */
4259 if (r_ptr->flagsr & RFR_RES_ALL)
4265 if (r_ptr->flags3 & (RF3_HURT_LITE))
4267 /* Obvious effect */
4268 if (seen) obvious = TRUE;
4270 /* Memorize the effects */
4271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4273 /* Special effect */
4275 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4276 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4278 note = " cringes from the light!";
4279 note_dies = " shrivels away in the light!";
4284 /* Normally no damage */
4296 /* Lite -- opposite of Dark */
4299 if (seen) obvious = TRUE;
4301 if (r_ptr->flagsr & RFR_RES_ALL)
4304 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4306 note = " is immune.";
4309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4312 if (r_ptr->flagsr & RFR_RES_LITE)
4315 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4320 dam *= 2; dam /= (randint1(6)+6);
4321 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4323 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4327 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4328 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4330 note = " cringes from the light!";
4331 note_dies = " shrivels away in the light!";
4340 /* Dark -- opposite of Lite */
4343 if (seen) obvious = TRUE;
4345 if (r_ptr->flagsr & RFR_RES_ALL)
4348 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4350 note = " is immune.";
4353 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4356 if (r_ptr->flagsr & RFR_RES_DARK)
4359 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4364 dam *= 2; dam /= (randint1(6)+6);
4365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4374 if (r_ptr->flagsr & RFR_RES_ALL)
4379 /* Hurt by rock remover */
4380 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4383 if (seen) obvious = TRUE;
4385 /* Memorize the effects */
4386 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4388 /* Cute little message */
4390 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4391 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4393 note = " loses some skin!";
4394 note_dies = " dissolves!";
4399 /* Usually, ignore the effects */
4410 /* Teleport undead (Use "dam" as "power") */
4411 case GF_AWAY_UNDEAD:
4413 /* Only affect undead */
4414 if (r_ptr->flags3 & (RF3_UNDEAD))
4416 bool resists_tele = FALSE;
4418 if (r_ptr->flagsr & RFR_RES_TELE)
4420 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4424 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4426 note = " is unaffected!";
4429 resists_tele = TRUE;
4431 else if (r_ptr->level > randint1(100))
4433 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4435 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4440 resists_tele = TRUE;
4446 if (seen) obvious = TRUE;
4447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4459 /* No "real" damage */
4465 /* Teleport evil (Use "dam" as "power") */
4468 /* Only affect evil */
4469 if (r_ptr->flags3 & (RF3_EVIL))
4471 bool resists_tele = FALSE;
4473 if (r_ptr->flagsr & RFR_RES_TELE)
4475 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4477 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4479 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4481 note = " is unaffected!";
4484 resists_tele = TRUE;
4486 else if (r_ptr->level > randint1(100))
4488 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4490 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4495 resists_tele = TRUE;
4501 if (seen) obvious = TRUE;
4502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4514 /* No "real" damage */
4520 /* Teleport monster (Use "dam" as "power") */
4523 bool resists_tele = FALSE;
4524 if (r_ptr->flagsr & RFR_RES_TELE)
4526 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4528 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4530 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4532 note = " is unaffected!";
4535 resists_tele = TRUE;
4537 else if (r_ptr->level > randint1(100))
4539 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4541 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4546 resists_tele = TRUE;
4553 if (seen) obvious = TRUE;
4555 /* Prepare to teleport */
4559 /* No "real" damage */
4565 /* Turn undead (Use "dam" as "power") */
4566 case GF_TURN_UNDEAD:
4568 if (r_ptr->flagsr & RFR_RES_ALL)
4573 /* Only affect undead */
4574 if (r_ptr->flags3 & (RF3_UNDEAD))
4577 if (seen) obvious = TRUE;
4579 /* Learn about type */
4580 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4582 /* Apply some fear */
4583 do_fear = damroll(3, (dam / 2)) + 1;
4585 /* Attempt a saving throw */
4586 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4588 /* No obvious effect */
4590 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4592 note = " is unaffected!";
4607 /* No "real" damage */
4613 /* Turn evil (Use "dam" as "power") */
4616 if (r_ptr->flagsr & RFR_RES_ALL)
4621 /* Only affect evil */
4622 if (r_ptr->flags3 & (RF3_EVIL))
4625 if (seen) obvious = TRUE;
4627 /* Learn about type */
4628 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4630 /* Apply some fear */
4631 do_fear = damroll(3, (dam / 2)) + 1;
4633 /* Attempt a saving throw */
4634 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4636 /* No obvious effect */
4638 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4640 note = " is unaffected!";
4655 /* No "real" damage */
4661 /* Turn monster (Use "dam" as "power") */
4664 if (r_ptr->flagsr & RFR_RES_ALL)
4670 if (seen) obvious = TRUE;
4672 /* Apply some fear */
4673 do_fear = damroll(3, (dam / 2)) + 1;
4675 /* Attempt a saving throw */
4676 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4677 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4678 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4680 /* No obvious effect */
4682 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4684 note = " is unaffected!";
4691 /* No "real" damage */
4698 case GF_DISP_UNDEAD:
4700 if (r_ptr->flagsr & RFR_RES_ALL)
4706 /* Only affect undead */
4707 if (r_ptr->flags3 & (RF3_UNDEAD))
4710 if (seen) obvious = TRUE;
4712 /* Learn about type */
4713 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4717 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4718 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4720 note = " shudders.";
4721 note_dies = " dissolves!";
4742 if (r_ptr->flagsr & RFR_RES_ALL)
4748 /* Only affect evil */
4749 if (r_ptr->flags3 & (RF3_EVIL))
4752 if (seen) obvious = TRUE;
4754 /* Learn about type */
4755 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4759 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4760 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4762 note = " shudders.";
4763 note_dies = " dissolves!";
4783 if (r_ptr->flagsr & RFR_RES_ALL)
4789 /* Only affect good */
4790 if (r_ptr->flags3 & (RF3_GOOD))
4793 if (seen) obvious = TRUE;
4795 /* Learn about type */
4796 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4800 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4801 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4803 note = " shudders.";
4804 note_dies = " dissolves!";
4822 case GF_DISP_LIVING:
4824 if (r_ptr->flagsr & RFR_RES_ALL)
4830 /* Only affect non-undead */
4831 if (monster_living(r_ptr))
4834 if (seen) obvious = TRUE;
4838 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4839 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4841 note = " shudders.";
4842 note_dies = " dissolves!";
4863 if (r_ptr->flagsr & RFR_RES_ALL)
4869 /* Only affect demons */
4870 if (r_ptr->flags3 & (RF3_DEMON))
4873 if (seen) obvious = TRUE;
4875 /* Learn about type */
4876 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4880 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4881 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4883 note = " shudders.";
4884 note_dies = " dissolves!";
4901 /* Dispel monster */
4904 if (r_ptr->flagsr & RFR_RES_ALL)
4911 if (seen) obvious = TRUE;
4915 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4916 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4918 note = " shudders.";
4919 note_dies = " dissolves!";
4929 if (seen) obvious = TRUE;
4931 if (r_ptr->flagsr & RFR_RES_ALL)
4934 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4936 note = " is immune.";
4939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4943 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4947 /* Heal the monster */
4948 if (caster_ptr->hp < caster_ptr->maxhp)
4951 caster_ptr->hp += 6 * dam;
4952 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4954 /* Redraw (later) if needed */
4955 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4956 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4958 /* Special message */
4961 /* Get the monster name */
4962 monster_desc(killer, caster_ptr, 0);
4964 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4966 msg_format("%^s appears healthier.", killer);
4975 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4977 msg_format("You draw psychic energy from %s.", m_name);
4980 (void)hp_player(dam);
4986 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4988 if (see_s_msg) msg_format("%s is unaffected.", m_name);
4998 if (seen) obvious = TRUE;
5001 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5003 if (!who) msg_format("You gaze intently at %s.", m_name);
5006 if (r_ptr->flagsr & RFR_RES_ALL)
5009 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5011 note = " is immune.";
5014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5018 /* Attempt a saving throw */
5019 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5020 (r_ptr->flags3 & RF3_NO_CONF) ||
5021 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5023 /* Memorize a flag */
5024 if (r_ptr->flags3 & (RF3_NO_CONF))
5026 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5029 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5031 note = "is unaffected!";
5035 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5039 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5041 note = " is immune!";
5045 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5049 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5058 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5059 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5061 note = " is blasted by psionic energy.";
5062 note_dies = " collapses, a mindless husk.";
5065 if (who > 0) do_conf = randint0(4) + 4;
5066 else do_conf = randint0(8) + 8;
5072 case GF_BRAIN_SMASH:
5074 if (seen) obvious = TRUE;
5077 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5079 if (!who) msg_format("You gaze intently at %s.", m_name);
5082 if (r_ptr->flagsr & RFR_RES_ALL)
5085 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5087 note = " is immune.";
5090 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5094 /* Attempt a saving throw */
5095 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5096 (r_ptr->flags3 & RF3_NO_CONF) ||
5097 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5099 /* Memorize a flag */
5100 if (r_ptr->flags3 & (RF3_NO_CONF))
5102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5105 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5107 note = "is unaffected!";
5111 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5113 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5115 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5117 note = " is immune!";
5121 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5125 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5134 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5135 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5137 note = " is blasted by psionic energy.";
5138 note_dies = " collapses, a mindless husk.";
5143 do_conf = randint0(4) + 4;
5144 do_stun = randint0(4) + 4;
5148 do_conf = randint0(8) + 8;
5149 do_stun = randint0(8) + 8;
5151 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
5159 if (seen) obvious = TRUE;
5162 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5164 if (!who) msg_format("You point at %s and curse.", m_name);
5167 if (r_ptr->flagsr & RFR_RES_ALL)
5170 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5172 note = " is immune.";
5175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5179 /* Attempt a saving throw */
5180 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5183 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5185 note = "is unaffected!";
5195 if (seen) obvious = TRUE;
5198 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5200 if (!who) msg_format("You point at %s and curse horribly.", m_name);
5203 if (r_ptr->flagsr & RFR_RES_ALL)
5206 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5208 note = " is immune.";
5211 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5215 /* Attempt a saving throw */
5216 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5219 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5221 note = "is unaffected!";
5231 if (seen) obvious = TRUE;
5234 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5236 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5239 if (r_ptr->flagsr & RFR_RES_ALL)
5242 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5244 note = " is immune.";
5247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5251 /* Attempt a saving throw */
5252 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5255 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5257 note = "is unaffected!";
5267 if (seen) obvious = TRUE;
5270 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5272 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5275 if (r_ptr->flagsr & RFR_RES_ALL)
5278 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5280 note = " is immune.";
5283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5287 /* Attempt a saving throw */
5288 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5291 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5293 note = "is unaffected!";
5303 if (seen) obvious = TRUE;
5305 if (r_ptr->flagsr & RFR_RES_ALL)
5308 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5310 note = " is immune.";
5313 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5317 if (r_ptr->flags1 & RF1_UNIQUE)
5320 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5322 note = "is unaffected!";
5328 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5329 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5331 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5333 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5338 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5348 /* Capture monster */
5352 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5353 (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)
5356 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5358 msg_format("%^s is unaffected.", m_name);
5364 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
5365 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5366 nokori_hp = m_ptr->maxhp * 3 / 10;
5368 nokori_hp = m_ptr->maxhp * 3 / 20;
5370 if (m_ptr->hp >= nokori_hp)
5373 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5375 msg_format("You need to weaken %s more.", m_name);
5379 else if (m_ptr->hp < randint0(nokori_hp))
5381 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5383 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5385 msg_format("You capture %^s!", m_name);
5387 cap_mon = m_ptr->r_idx;
5388 cap_mspeed = m_ptr->mspeed;
5390 cap_maxhp = m_ptr->max_maxhp;
5391 cap_nickname = m_ptr->nickname; /* Quark transfer */
5392 if (c_ptr->m_idx == p_ptr->riding)
5394 if (rakuba(-1, FALSE))
5397 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5399 msg_format("You have fallen from %s.", m_name);
5404 delete_monster_idx(c_ptr->m_idx);
5411 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5413 msg_format("You failed to capture %s.", m_name);
5420 /* Attack (Use "dam" as attack type) */
5423 /* Return this monster's death */
5424 return py_attack(y, x, dam);
5427 /* Sleep (Use "dam" as "power") */
5433 if (seen) obvious = TRUE;
5435 if (r_ptr->flagsr & RFR_RES_ALL)
5438 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5440 note = " is immune.";
5443 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5446 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5449 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5451 note = " is immune!";
5455 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5458 if (MON_CSLEEP(m_ptr))
5461 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5463 note = " is immune!";
5470 if (one_in_(5)) effect = 1;
5471 else if (one_in_(4)) effect = 2;
5472 else if (one_in_(3)) effect = 3;
5477 /* Powerful monsters can resist */
5478 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5479 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5482 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5484 note = " is unaffected!";
5490 /* Normal monsters slow down */
5493 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
5496 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5498 note = " starts moving slower.";
5504 else if (effect == 2)
5506 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5508 /* Attempt a saving throw */
5509 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5510 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5515 /* No obvious effect */
5517 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5519 note = " is unaffected!";
5526 else if (effect == 3)
5528 /* Attempt a saving throw */
5529 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5530 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5531 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5533 /* Memorize a flag */
5534 if (r_ptr->flags3 & RF3_NO_SLEEP)
5536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5539 /* No obvious effect */
5541 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5543 note = " is unaffected!";
5550 /* Go to sleep (much) later */
5552 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5554 note = " falls asleep!";
5564 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5566 note = " is immune!";
5570 /* No "real" damage */
5578 if (seen) obvious = TRUE;
5580 if (r_ptr->flagsr & RFR_RES_ALL)
5583 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5585 note = " is immune.";
5588 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5593 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "¥â¥ó¥¹¥¿¡¼¾ÃÌÇ"))
5595 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, "Genocide One"))
5599 if (seen_msg) msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª", m_name);
5601 if (seen_msg) msg_format("%^s disappered!", m_name);
5603 chg_virtue(V_VITALITY, -1);
5614 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5616 if (!who) msg_format("You take a photograph of %s.", m_name);
5619 if (r_ptr->flags3 & (RF3_HURT_LITE))
5621 /* Obvious effect */
5622 if (seen) obvious = TRUE;
5624 /* Memorize the effects */
5625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5627 /* Special effect */
5629 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5630 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5632 note = " cringes from the light!";
5633 note_dies = " shrivels away in the light!";
5637 /* Normally no damage */
5644 photo = m_ptr->r_idx;
5651 case GF_BLOOD_CURSE:
5653 if (seen) obvious = TRUE;
5655 if (r_ptr->flagsr & RFR_RES_ALL)
5658 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5660 note = " is immune.";
5663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5671 bool success = FALSE;
5672 if (seen) obvious = TRUE;
5674 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5676 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5677 if (dam < 1) dam = 1;
5679 /* No need to tame your pet */
5683 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5685 note = " starts moving faster.";
5688 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5692 /* Attempt a saving throw */
5693 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5694 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5695 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5696 (p_ptr->cursed & TRC_AGGRAVATE) ||
5697 ((r_ptr->level+10) > randint1(dam)))
5700 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5705 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5707 note = " is tamed!";
5711 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
5713 /* Learn about type */
5714 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5721 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5723 do_fear = randint1(90)+10;
5725 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5728 /* No "real" damage */
5735 if (seen) obvious = TRUE;
5737 if (r_ptr->flagsr & RFR_RES_ALL)
5740 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5742 note = " is immune.";
5745 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5749 /* Attempt a saving throw */
5750 if (randint0(100 + dam) < (r_ptr->level + 50))
5754 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5756 note = "is unaffected!";
5777 /* Absolutely no effect */
5778 if (skipped) return (FALSE);
5780 /* "Unique" monsters cannot be polymorphed */
5781 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5783 /* Quest monsters cannot be polymorphed */
5784 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5786 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5788 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5789 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5791 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5796 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5797 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5800 /* Modify the damage */
5802 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5804 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5806 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5809 /* Check for death */
5810 if (dam > m_ptr->hp)
5812 /* Extract method of death */
5817 /* Sound and Impact resisters never stun */
5819 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5820 !(r_ptr->flags3 & RF3_NO_STUN))
5823 if (seen) obvious = TRUE;
5826 if (MON_STUNNED(m_ptr))
5829 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5831 note = " is more dazed.";
5834 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
5839 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5841 note = " is dazed.";
5848 (void)set_monster_stunned(c_ptr->m_idx, tmp);
5854 /* Confusion and Chaos resisters (and sleepers) never confuse */
5856 !(r_ptr->flags3 & RF3_NO_CONF) &&
5857 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5860 if (seen) obvious = TRUE;
5862 /* Already partially confused */
5863 if (MON_CONFUSED(m_ptr))
5866 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5868 note = " looks more confused.";
5871 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
5874 /* Was not confused */
5878 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5880 note = " looks confused.";
5886 /* Apply confusion */
5887 (void)set_monster_confused(c_ptr->m_idx, tmp);
5896 if (seen) obvious = TRUE;
5898 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5903 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5905 note = " seems weakened.";
5907 m_ptr->maxhp -= do_time;
5908 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5913 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5914 if (do_poly && (randint1(90) > r_ptr->level))
5916 if (polymorph_monster(y, x))
5919 if (seen) obvious = TRUE;
5921 /* Monster polymorphs */
5923 note = "¤¬ÊѿȤ·¤¿¡ª";
5928 /* Turn off the damage */
5935 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5937 note = " is unaffected!";
5941 /* Hack -- Get new monster */
5942 m_ptr = &m_list[c_ptr->m_idx];
5944 /* Hack -- Get new race */
5945 r_ptr = &r_info[m_ptr->r_idx];
5948 /* Handle "teleport" */
5952 if (seen) obvious = TRUE;
5956 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5958 note = " disappears!";
5961 if (!who) chg_virtue(V_VALOUR, -1);
5964 teleport_away(c_ptr->m_idx, do_dist,
5965 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
5967 /* Hack -- get new location */
5971 /* Hack -- get new grid */
5972 c_ptr = &cave[y][x];
5979 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
5986 if (typ == GF_DRAIN_MANA)
5988 /* Drain mana does nothing */
5991 /* If another monster did the damage, hurt the monster by hand */
5994 /* Redraw (later) if needed */
5995 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
5996 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
5998 /* Wake the monster up */
5999 (void)set_monster_csleep(c_ptr->m_idx, 0);
6001 /* Hurt the monster */
6009 if (is_pet(m_ptr) && !(m_ptr->ml))
6012 /* Give detailed messages if destroyed */
6015 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6018 msg_format("%^s%s", m_name, note);
6026 monster_gain_exp(who, m_ptr->r_idx);
6028 /* Generate treasure, etc */
6029 monster_death(c_ptr->m_idx, FALSE);
6031 /* Delete the monster */
6032 delete_monster_idx(c_ptr->m_idx);
6037 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6039 msg_print("You feel sad for a moment.");
6044 /* Damaged monster */
6047 /* Give detailed messages if visible or destroyed */
6048 if (note && seen_msg) msg_format("%^s%s", m_name, note);
6050 /* Hack -- Pain message */
6053 message_pain(c_ptr->m_idx, dam);
6060 /* Hack -- handle sleep */
6061 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6065 else if (heal_leper)
6068 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6070 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6073 delete_monster_idx(c_ptr->m_idx);
6076 /* If the player did it, give him experience, check fear */
6081 /* Hurt the monster, check for fear and death */
6082 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6087 /* Damaged monster */
6090 /* HACK - anger the monster before showing the sleep message */
6091 if (do_sleep) anger_monster(m_ptr);
6093 /* Give detailed messages if visible or destroyed */
6094 if (note && seen_msg)
6096 msg_format("%s%s", m_name, note);
6098 msg_format("%^s%s", m_name, note);
6102 /* Hack -- Pain message */
6103 else if (known && (dam || !do_fear))
6105 message_pain(c_ptr->m_idx, dam);
6108 /* Anger monsters */
6109 if (((dam > 0) || get_angry) && !do_sleep)
6110 anger_monster(m_ptr);
6113 if ((fear || do_fear) && seen)
6120 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6122 msg_format("%^s flees in terror!", m_name);
6126 /* Hack -- handle sleep */
6127 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6131 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6133 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6137 switch (randint1(28))
6143 msg_print("ÃÏÌ̤¬Íɤ줿...");
6145 msg_print("The ground trembles...");
6148 earthquake(ty, tx, 4 + randint0(4));
6149 if (!one_in_(6)) break;
6151 case 3: case 4: case 5: case 6:
6154 int dam = damroll(10, 10);
6156 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6158 msg_print("A portal opens to a plane of raw mana!");
6161 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6162 if (!one_in_(6)) break;
6168 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6170 msg_print("Space warps about you!");
6173 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
6174 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6175 if (!one_in_(6)) break;
6177 case 9: case 10: case 11:
6179 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6181 msg_print("You feel a surge of energy!");
6184 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6185 if (!one_in_(6)) break;
6186 case 12: case 13: case 14: case 15: case 16:
6187 aggravate_monsters(0);
6188 if (!one_in_(6)) break;
6190 count += activate_hi_summon(ty, tx, TRUE);
6191 if (!one_in_(6)) break;
6192 case 19: case 20: case 21: case 22:
6194 bool pet = !one_in_(3);
6195 u32b mode = PM_ALLOW_GROUP;
6197 if (pet) mode |= PM_FORCE_PET;
6198 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6200 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6201 if (!one_in_(6)) break;
6203 case 23: case 24: case 25:
6204 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6206 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6208 msg_print("You feel your life draining away...");
6211 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6212 else lose_exp(p_ptr->exp / 16);
6213 if (!one_in_(6)) break;
6214 case 26: case 27: case 28:
6223 (void)do_dec_stat(i);
6232 (void)do_dec_stat(randint0(6));
6241 if (p_ptr->inside_battle)
6243 p_ptr->health_who = c_ptr->m_idx;
6244 p_ptr->redraw |= (PR_HEALTH);
6248 /* XXX XXX XXX Verify this code */
6250 /* Update the monster */
6251 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
6253 /* Redraw the monster grid */
6257 /* Update monster recall window */
6258 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
6261 p_ptr->window |= (PW_MONSTER);
6264 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6268 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6270 set_target(m_ptr, monster_target_y, monster_target_x);
6273 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6275 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6279 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6281 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6282 rakubadam_m = (dam > 200) ? 200 : dam;
6291 /* Get local object */
6294 /* Prepare to make a Blade of Chaos */
6295 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6297 q_ptr->pval = photo;
6299 /* Mark the item as fully known */
6300 q_ptr->ident |= (IDENT_MENTAL);
6302 /* Drop it in the dungeon */
6303 (void)drop_near(q_ptr, -1, py, px);
6311 /* Return "Anything seen?" */
6317 * Helper function for "project()" below.
6319 * Handle a beam/bolt/ball causing damage to the player.
6321 * This routine takes a "source monster" (by index), a "distance", a default
6322 * "damage", and a "damage type". See "project_m()" above.
6324 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6325 * is reduced (see "project_m()" above). This can happen if a monster breathes
6326 * at the player and hits a wall instead.
6328 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6329 * to know if this is actually a ball or a bolt spell
6332 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6333 * we just assume that the effects were obvious, for historical reasons.
6335 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6340 /* Hack -- assume obvious */
6341 bool obvious = TRUE;
6343 /* Player blind-ness */
6344 bool blind = (p_ptr->blind ? TRUE : FALSE);
6346 /* Player needs a "description" (he is blind) */
6349 /* Source monster */
6350 monster_type *m_ptr = NULL;
6352 /* Monster name (for attacks) */
6355 /* Monster name (for damage) */
6358 /* Hack -- messages */
6364 /* Player is not here */
6365 if (!player_bold(y, x)) return (FALSE);
6367 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6369 if (kawarimi(TRUE)) return FALSE;
6372 /* Player cannot hurt himself */
6373 if (!who) return (FALSE);
6374 if (who == p_ptr->riding) return (FALSE);
6376 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6379 int max_attempts = 10;
6382 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6383 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6384 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6386 if (blind) msg_print("Something bounces!");
6387 else msg_print("The attack bounces!");
6391 /* Choose 'new' target */
6396 t_y = m_list[who].fy - 1 + randint1(3);
6397 t_x = m_list[who].fx - 1 + randint1(3);
6400 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6402 if (max_attempts < 1)
6404 t_y = m_list[who].fy;
6405 t_x = m_list[who].fx;
6410 t_y = py - 1 + randint1(3);
6411 t_x = px - 1 + randint1(3);
6414 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6421 /* Limit maximum damage */
6422 if (dam > 1600) dam = 1600;
6424 /* Reduce damage by distance */
6425 dam = (dam + r) / (r + 1);
6428 /* If the player is blind, be more descriptive */
6429 if (blind) fuzzy = TRUE;
6434 /* Get the source monster */
6435 m_ptr = &m_list[who];
6436 /* Extract the monster level */
6437 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6439 /* Get the monster name */
6440 monster_desc(m_name, m_ptr, 0);
6442 /* Get the monster's real name (gotten before polymorph!) */
6443 strcpy(killer, who_name);
6449 case PROJECT_WHO_UNCTRL_POWER:
6451 strcpy(killer, "À©¸æ¤Ç¤¤Ê¤¤ÎϤÎÈÅή");
6453 strcpy(killer, "uncontrollable power storm");
6457 case PROJECT_WHO_GLASS_SHARDS:
6459 strcpy(killer, "¥¬¥é¥¹¤ÎÇËÊÒ");
6461 strcpy(killer, "shards of glass");
6467 strcpy(killer, "æ«");
6469 strcpy(killer, "a trap");
6475 strcpy(m_name, killer);
6478 /* Analyze the damage */
6481 /* Standard damage -- hurts inventory too */
6485 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6487 if (fuzzy) msg_print("You are hit by acid!");
6490 get_damage = acid_dam(dam, killer, monspell);
6494 /* Standard damage -- hurts inventory too */
6498 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6500 if (fuzzy) msg_print("You are hit by fire!");
6503 get_damage = fire_dam(dam, killer, monspell);
6507 /* Standard damage -- hurts inventory too */
6511 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6513 if (fuzzy) msg_print("You are hit by cold!");
6516 get_damage = cold_dam(dam, killer, monspell);
6520 /* Standard damage -- hurts inventory too */
6524 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6526 if (fuzzy) msg_print("You are hit by lightning!");
6529 get_damage = elec_dam(dam, killer, monspell);
6533 /* Standard damage -- also poisons player */
6536 bool double_resist = IS_OPPOSE_POIS();
6538 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6540 if (fuzzy) msg_print("You are hit by poison!");
6543 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6544 if (double_resist) dam = (dam + 2) / 3;
6546 if ((!(double_resist || p_ptr->resist_pois)) &&
6547 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
6552 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6554 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6556 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6561 /* Standard damage -- also poisons / mutates player */
6564 bool double_resist = IS_OPPOSE_POIS();
6566 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6568 if (fuzzy) msg_print("You are hit by radiation!");
6571 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6572 if (double_resist) dam = (2 * dam + 2) / 5;
6573 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6574 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6576 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6578 if (one_in_(5)) /* 6 */
6581 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6583 msg_print("You undergo a freakish metamorphosis!");
6586 if (one_in_(4)) /* 4 */
6594 inven_damage(set_acid_destroy, 2);
6600 /* Standard damage */
6604 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6606 if (fuzzy) msg_print("You are hit by something!");
6609 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6613 /* Holy Orb -- Player only takes partial damage */
6617 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6619 if (fuzzy) msg_print("You are hit by something!");
6622 if (p_ptr->align > 10)
6624 else if (p_ptr->align < -10)
6626 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6633 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6635 if (fuzzy) msg_print("You are hit by something!");
6638 if (p_ptr->align > 10)
6640 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6644 /* Arrow -- XXX no dodging */
6648 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6650 if (fuzzy) msg_print("You are hit by something sharp!");
6653 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6656 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6658 msg_print("You cut down the arrow!");
6662 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6666 /* Plasma -- XXX No resist */
6670 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6672 if (fuzzy) msg_print("You are hit by something *HOT*!");
6675 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6677 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6679 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6680 (void)set_stun(p_ptr->stun + k);
6683 if (!(p_ptr->resist_fire ||
6685 p_ptr->immune_fire))
6687 inven_damage(set_acid_destroy, 3);
6693 /* Nether -- drain experience */
6697 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6699 if (fuzzy) msg_print("You are hit by nether forces!");
6702 if (p_ptr->resist_neth)
6704 if (!prace_is_(RACE_SPECTRE))
6705 dam *= 6; dam /= (randint1(4) + 7);
6707 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6709 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
6712 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6714 msg_print("You feel invigorated!");
6718 learn_spell(monspell);
6722 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6728 /* Water -- stun/confuse */
6732 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6734 if (fuzzy) msg_print("You are hit by something wet!");
6737 if (!CHECK_MULTISHADOW())
6739 if (!p_ptr->resist_sound)
6741 set_stun(p_ptr->stun + randint1(40));
6743 if (!p_ptr->resist_conf)
6745 set_confused(p_ptr->confused + randint1(5) + 5);
6750 inven_damage(set_cold_destroy, 3);
6754 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6758 /* Chaos -- many effects */
6762 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6764 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6767 if (p_ptr->resist_chaos)
6769 dam *= 6; dam /= (randint1(4) + 7);
6772 if (!CHECK_MULTISHADOW())
6774 if (!p_ptr->resist_conf)
6776 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6778 if (!p_ptr->resist_chaos)
6780 (void)set_image(p_ptr->image + randint1(10));
6784 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6786 msg_print("Your body is twisted by chaos!");
6789 (void)gain_random_mutation(0);
6792 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6794 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6797 if (!p_ptr->resist_chaos || one_in_(9))
6799 inven_damage(set_elec_destroy, 2);
6800 inven_damage(set_fire_destroy, 2);
6804 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6808 /* Shards -- mostly cutting */
6812 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6814 if (fuzzy) msg_print("You are hit by something sharp!");
6817 if (p_ptr->resist_shard)
6819 dam *= 6; dam /= (randint1(4) + 7);
6821 else if (!CHECK_MULTISHADOW())
6823 (void)set_cut(p_ptr->cut + dam);
6826 if (!p_ptr->resist_shard || one_in_(13))
6828 inven_damage(set_cold_destroy, 2);
6831 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6835 /* Sound -- mostly stunning */
6839 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6841 if (fuzzy) msg_print("You are hit by a loud noise!");
6844 if (p_ptr->resist_sound)
6846 dam *= 5; dam /= (randint1(4) + 7);
6848 else if (!CHECK_MULTISHADOW())
6850 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6851 (void)set_stun(p_ptr->stun + k);
6854 if (!p_ptr->resist_sound || one_in_(13))
6856 inven_damage(set_cold_destroy, 2);
6859 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6863 /* Pure confusion */
6867 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6869 if (fuzzy) msg_print("You are hit by something puzzling!");
6872 if (p_ptr->resist_conf)
6874 dam *= 5; dam /= (randint1(4) + 7);
6876 else if (!CHECK_MULTISHADOW())
6878 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6880 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6884 /* Disenchantment -- see above */
6888 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6890 if (fuzzy) msg_print("You are hit by something static!");
6893 if (p_ptr->resist_disen)
6895 dam *= 6; dam /= (randint1(4) + 7);
6897 else if (!CHECK_MULTISHADOW())
6899 (void)apply_disenchant(0);
6901 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6905 /* Nexus -- see above */
6909 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6911 if (fuzzy) msg_print("You are hit by something strange!");
6914 if (p_ptr->resist_nexus)
6916 dam *= 6; dam /= (randint1(4) + 7);
6918 else if (!CHECK_MULTISHADOW())
6922 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6926 /* Force -- mostly stun */
6930 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6932 if (fuzzy) msg_print("You are hit by kinetic force!");
6935 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6937 (void)set_stun(p_ptr->stun + randint1(20));
6939 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6944 /* Rocket -- stun, cut */
6948 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6950 if (fuzzy) msg_print("There is an explosion!");
6953 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6955 (void)set_stun(p_ptr->stun + randint1(20));
6958 if (p_ptr->resist_shard)
6962 else if (!CHECK_MULTISHADOW())
6964 (void)set_cut(p_ptr->cut + (dam / 2));
6967 if (!p_ptr->resist_shard || one_in_(12))
6969 inven_damage(set_cold_destroy, 3);
6972 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6976 /* Inertia -- slowness */
6980 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6982 if (fuzzy) msg_print("You are hit by something slow!");
6985 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6986 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6990 /* Lite -- blinding */
6994 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6996 if (fuzzy) msg_print("You are hit by something!");
6999 if (p_ptr->resist_lite)
7001 dam *= 4; dam /= (randint1(4) + 7);
7003 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7005 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7008 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7011 if (!CHECK_MULTISHADOW()) msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7013 if (!CHECK_MULTISHADOW()) msg_print("The light scorches your flesh!");
7018 else if (prace_is_(RACE_S_FAIRY))
7023 if (p_ptr->wraith_form) dam *= 2;
7024 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7026 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
7028 p_ptr->wraith_form = 0;
7030 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7032 msg_print("The light forces you out of your incorporeal shadow form.");
7035 p_ptr->redraw |= PR_MAP;
7036 /* Update monsters */
7037 p_ptr->update |= (PU_MONSTERS);
7039 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7041 /* Redraw status bar */
7042 p_ptr->redraw |= (PR_STATUS);
7049 /* Dark -- blinding */
7053 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7055 if (fuzzy) msg_print("You are hit by something!");
7058 if (p_ptr->resist_dark)
7060 dam *= 4; dam /= (randint1(4) + 7);
7062 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7064 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7066 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7068 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7072 /* Time -- bolt fewer effects XXX */
7076 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7078 if (fuzzy) msg_print("You are hit by a blast from the past!");
7081 if (p_ptr->resist_time)
7084 dam /= (randint1(4) + 7);
7086 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7088 msg_print("You feel as if time is passing you by.");
7091 else if (!CHECK_MULTISHADOW())
7093 switch (randint1(10))
7095 case 1: case 2: case 3: case 4: case 5:
7097 if (p_ptr->prace == RACE_ANDROID) break;
7099 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7101 msg_print("You feel life has clocked back.");
7104 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7108 case 6: case 7: case 8: case 9:
7110 switch (randint1(6))
7113 case 1: k = A_STR; act = "¶¯¤¯"; break;
7114 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7115 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7116 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7117 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7118 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7120 case 1: k = A_STR; act = "strong"; break;
7121 case 2: k = A_INT; act = "bright"; break;
7122 case 3: k = A_WIS; act = "wise"; break;
7123 case 4: k = A_DEX; act = "agile"; break;
7124 case 5: k = A_CON; act = "hale"; break;
7125 case 6: k = A_CHR; act = "beautiful"; break;
7130 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7132 msg_format("You're not as %s as you used to be...", act);
7135 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7136 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7137 p_ptr->update |= (PU_BONUS);
7144 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7146 msg_print("You're not as powerful as you used to be...");
7149 for (k = 0; k < 6; k++)
7151 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7152 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7154 p_ptr->update |= (PU_BONUS);
7160 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7164 /* Gravity -- stun plus slowness plus teleport */
7168 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7169 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7171 if (fuzzy) msg_print("You are hit by something heavy!");
7172 msg_print("Gravity warps around you.");
7175 if (!CHECK_MULTISHADOW())
7177 teleport_player(5, TELEPORT_PASSIVE);
7178 if (!p_ptr->levitation)
7179 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7180 if (!(p_ptr->resist_sound || p_ptr->levitation))
7182 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7183 (void)set_stun(p_ptr->stun + k);
7186 if (p_ptr->levitation)
7188 dam = (dam * 2) / 3;
7191 if (!p_ptr->levitation || one_in_(13))
7193 inven_damage(set_cold_destroy, 2);
7196 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7200 /* Standard damage */
7201 case GF_DISINTEGRATE:
7204 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7206 if (fuzzy) msg_print("You are hit by pure energy!");
7209 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7216 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7218 if (fuzzy) msg_print("You are hit by something invigorating!");
7221 (void)hp_player(dam);
7229 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7231 if (fuzzy) msg_print("You are hit by something!");
7234 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7242 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7244 if (fuzzy) msg_print("You are hit by something slow!");
7247 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7253 if (p_ptr->free_act) break;
7255 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7257 if (fuzzy) msg_print("You fall asleep!");
7261 if (ironman_nightmare)
7264 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7266 msg_print("A horrible vision enters your mind.");
7269 /* Pick a nightmare */
7270 get_mon_num_prep(get_nightmare, NULL);
7272 /* Have some nightmares */
7273 have_nightmare(get_mon_num(MAX_DEPTH));
7275 /* Remove the monster restriction */
7276 get_mon_num_prep(NULL, NULL);
7279 set_paralyzed(p_ptr->paralyzed + dam);
7290 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7292 if (fuzzy) msg_print("You are hit by an aura of magic!");
7295 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7303 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7305 if (fuzzy) msg_print("You are hit by an energy!");
7308 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7316 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7318 if (fuzzy) msg_print("Something falls from the sky on you!");
7321 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7322 if (!p_ptr->resist_shard || one_in_(13))
7324 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7325 inven_damage(set_cold_destroy, 2);
7331 /* Ice -- cold plus stun plus cuts */
7335 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7337 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7340 cold_dam(dam, killer, monspell);
7341 if (!CHECK_MULTISHADOW())
7343 if (!p_ptr->resist_shard)
7345 (void)set_cut(p_ptr->cut + damroll(5, 8));
7347 if (!p_ptr->resist_sound)
7349 (void)set_stun(p_ptr->stun + randint1(15));
7352 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7354 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7365 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7367 if (fuzzy) msg_print("You are hit by something extremely cold!");
7371 if (p_ptr->mimic_form)
7373 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7374 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7379 switch (p_ptr->prace)
7381 /* Some races are immune */
7395 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7407 if (CHECK_MULTISHADOW())
7410 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
7412 msg_print("The attack hits Shadow, you are unharmed!");
7415 else if (p_ptr->csp)
7419 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7420 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7422 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7423 else msg_print("Your psychic energy is drawn!");
7427 if (dam >= p_ptr->csp)
7431 p_ptr->csp_frac = 0;
7440 learn_spell(monspell);
7443 p_ptr->redraw |= (PR_MANA);
7446 p_ptr->window |= (PW_PLAYER);
7447 p_ptr->window |= (PW_SPELL);
7451 /* Heal the monster */
7452 if (m_ptr->hp < m_ptr->maxhp)
7455 m_ptr->hp += (6 * dam);
7456 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7458 /* Redraw (later) if needed */
7459 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7460 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7462 /* Special message */
7466 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7468 msg_format("%^s appears healthier.", m_name);
7482 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7485 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7487 msg_print("You resist the effects!");
7489 learn_spell(monspell);
7493 if (!CHECK_MULTISHADOW())
7496 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7498 msg_print("Your mind is blasted by psyonic energy.");
7501 if (!p_ptr->resist_conf)
7503 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7506 if (!p_ptr->resist_chaos && one_in_(3))
7508 (void)set_image(p_ptr->image + randint0(250) + 150);
7515 p_ptr->csp_frac = 0;
7517 p_ptr->redraw |= PR_MANA;
7520 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7526 case GF_BRAIN_SMASH:
7528 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7531 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7533 msg_print("You resist the effects!");
7535 learn_spell(monspell);
7539 if (!CHECK_MULTISHADOW())
7542 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7544 msg_print("Your mind is blasted by psionic energy.");
7551 p_ptr->csp_frac = 0;
7553 p_ptr->redraw |= PR_MANA;
7556 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7557 if (!CHECK_MULTISHADOW())
7559 if (!p_ptr->resist_blind)
7561 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7563 if (!p_ptr->resist_conf)
7565 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7567 if (!p_ptr->free_act)
7569 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7571 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7573 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7574 (void)do_dec_stat(A_INT);
7575 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7576 (void)do_dec_stat(A_WIS);
7578 if (!p_ptr->resist_chaos)
7580 (void)set_image(p_ptr->image + randint0(250) + 150);
7590 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7593 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7595 msg_print("You resist the effects!");
7597 learn_spell(monspell);
7601 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
7602 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7610 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7613 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7615 msg_print("You resist the effects!");
7617 learn_spell(monspell);
7621 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
7622 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7630 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7633 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7635 msg_print("You resist the effects!");
7637 learn_spell(monspell);
7641 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
7642 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7650 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
7653 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7655 msg_print("You resist the effects!");
7657 learn_spell(monspell);
7661 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7662 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
7670 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7673 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7675 msg_format("You resist the effects!");
7677 learn_spell(monspell);
7681 if (!CHECK_MULTISHADOW())
7684 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7686 msg_print("You feel your life fade away!");
7688 curse_equipment(40, 20);
7691 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7693 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
7708 if (p_ptr->tim_eyeeye && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
7711 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7713 char m_name_self[80];
7716 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7718 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7720 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7721 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7724 if (p_ptr->riding && dam > 0)
7726 rakubadam_p = (dam > 200) ? 200 : dam;
7734 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7736 (void)kawarimi(FALSE);
7739 /* Return "Anything seen?" */
7745 * Find the distance from (x, y) to a line.
7747 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7749 /* Vector from (x, y) to (x1, y1) */
7758 int pd = distance(y1, x1, y, x);
7759 int nd = distance(y1, x1, y2, x2);
7761 if (pd > nd) return distance(y, x, y2, x2);
7763 /* Component of P on N */
7764 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7766 /* Absolute value */
7767 return((nd >= 0) ? nd : 0 - nd);
7774 * Modified version of los() for calculation of disintegration balls.
7775 * Disintegration effects are stopped by permanent walls.
7777 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7797 /* Slope, or 1/Slope, of LOS */
7801 /* Extract the offset */
7805 /* Extract the absolute offset */
7810 /* Handle adjacent (or identical) grids */
7811 if ((ax < 2) && (ay < 2)) return (TRUE);
7814 /* Paranoia -- require "safe" origin */
7815 /* if (!in_bounds(y1, x1)) return (FALSE); */
7818 /* Directly South/North */
7821 /* South -- check for walls */
7824 for (ty = y1 + 1; ty < y2; ty++)
7826 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7830 /* North -- check for walls */
7833 for (ty = y1 - 1; ty > y2; ty--)
7835 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7843 /* Directly East/West */
7846 /* East -- check for walls */
7849 for (tx = x1 + 1; tx < x2; tx++)
7851 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7855 /* West -- check for walls */
7858 for (tx = x1 - 1; tx > x2; tx--)
7860 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7869 /* Extract some signs */
7870 sx = (dx < 0) ? -1 : 1;
7871 sy = (dy < 0) ? -1 : 1;
7874 /* Vertical "knights" */
7879 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7883 /* Horizontal "knights" */
7888 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7893 /* Calculate scale factor div 2 */
7896 /* Calculate scale factor */
7900 /* Travel horizontally */
7903 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7909 /* Consider the special case where slope == 1. */
7920 /* Note (below) the case (qy == f2), where */
7921 /* the LOS exactly meets the corner of a tile. */
7924 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7935 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7948 /* Travel vertically */
7951 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7967 /* Note (below) the case (qx == f2), where */
7968 /* the LOS exactly meets the corner of a tile. */
7971 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7982 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8003 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)
8008 int brev = rad * rad / dist;
8012 int mdis = distance(y1, x1, y2, x2) + rad;
8014 while (bdis <= mdis)
8018 if ((0 < dist) && (path_n < dist))
8020 int ny = GRID_Y(path_g[path_n]);
8021 int nx = GRID_X(path_g[path_n]);
8022 int nd = distance(ny, nx, y1, x1);
8024 /* Get next base point */
8033 /* Travel from center outward */
8034 for (cdis = 0; cdis <= brad; cdis++)
8036 /* Scan the maximal blast area of radius "cdis" */
8037 for (y = by - cdis; y <= by + cdis; y++)
8039 for (x = bx - cdis; x <= bx + cdis; x++)
8041 /* Ignore "illegal" locations */
8042 if (!in_bounds(y, x)) continue;
8044 /* Enforce a circular "ripple" */
8045 if (distance(y1, x1, y, x) != bdis) continue;
8047 /* Enforce an arc */
8048 if (distance(by, bx, y, x) != cdis) continue;
8054 /* Lights are stopped by opaque terrains */
8055 if (!los(by, bx, y, x)) continue;
8057 case GF_DISINTEGRATE:
8058 /* Disintegration are stopped only by perma-walls */
8059 if (!in_disintegration_range(by, bx, y, x)) continue;
8062 /* Ball explosions are stopped by walls */
8063 if (!projectable(by, bx, y, x)) continue;
8067 /* Save this grid */
8075 /* Encode some more "radius" info */
8076 gm[bdis + 1] = *pgrids;
8078 /* Increase the size */
8079 brad = rad * (path_n + brev) / (dist + brev);
8081 /* Find the next ripple */
8085 /* Store the effect size */
8091 * Generic "beam"/"bolt"/"ball" projection routine.
8094 * who: Index of "source" monster (zero for "player")
8095 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8096 * y,x: Target location (or location to travel "towards")
8097 * dam: Base damage roll to apply to affected monsters (or player)
8098 * typ: Type of damage to apply to monsters (and objects)
8099 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8102 * TRUE if any "effects" of the projection were observed, else FALSE
8104 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8105 * towards a given location (optionally passing over the heads of interposing
8106 * monsters), and have it do a given amount of damage to the monsters (and
8107 * optionally objects) within the given radius of the final location.
8109 * A "bolt" travels from source to target and affects only the target grid.
8110 * A "beam" travels from source to target, affecting all grids passed through.
8111 * A "ball" travels from source to the target, exploding at the target, and
8112 * affecting everything within the given radius of the target location.
8114 * Traditionally, a "bolt" does not affect anything on the ground, and does
8115 * not pass over the heads of interposing monsters, much like a traditional
8116 * missile, and will "stop" abruptly at the "target" even if no monster is
8117 * positioned there, while a "ball", on the other hand, passes over the heads
8118 * of monsters between the source and target, and affects everything except
8119 * the source monster which lies within the final radius, while a "beam"
8120 * affects every monster between the source and target, except for the casting
8121 * monster (or player), and rarely affects things on the ground.
8123 * Two special flags allow us to use this function in special ways, the
8124 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8125 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8126 * actually projecting from the source monster (or player).
8128 * The player will only get "experience" for monsters killed by himself
8129 * Unique monsters can only be destroyed by attacks from the player
8131 * Only 256 grids can be affected per projection, limiting the effective
8132 * "radius" of standard ball attacks to nine units (diameter nineteen).
8134 * One can project in a given "direction" by combining PROJECT_THRU with small
8135 * offsets to the initial location (see "line_spell()"), or by calculating
8136 * "virtual targets" far away from the player.
8138 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8139 * continuing until it actually hits somethings (useful for "stone to mud").
8141 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8143 * Balls must explode BEFORE hitting walls, or they would affect monsters
8144 * on both sides of a wall. Some bug reports indicate that this is still
8145 * happening in 2.7.8 for Windows, though it appears to be impossible.
8147 * We "pre-calculate" the blast area only in part for efficiency.
8148 * More importantly, this lets us do "explosions" from the "inside" out.
8149 * This results in a more logical distribution of "blast" treasure.
8150 * It also produces a better (in my opinion) animation of the explosion.
8151 * It could be (but is not) used to have the treasure dropped by monsters
8152 * in the middle of the explosion fall "outwards", and then be damaged by
8153 * the blast as it spreads outwards towards the treasure drop location.
8155 * Walls and doors are included in the blast area, so that they can be
8156 * "burned" or "melted" in later versions.
8158 * This algorithm is intended to maximize simplicity, not necessarily
8159 * efficiency, since this function is not a bottleneck in the code.
8161 * We apply the blast effect from ground zero outwards, in several passes,
8162 * first affecting features, then objects, then monsters, then the player.
8163 * This allows walls to be removed before checking the object or monster
8164 * in the wall, and protects objects which are dropped by monsters killed
8165 * in the blast, and allows the player to see all affects before he is
8166 * killed or teleported away. The semantics of this method are open to
8167 * various interpretations, but they seem to work well in practice.
8169 * We process the blast area from ground-zero outwards to allow for better
8170 * distribution of treasure dropped by monsters, and because it provides a
8171 * pleasing visual effect at low cost.
8173 * Note that the damage done by "ball" explosions decreases with distance.
8174 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8176 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8177 * the target, and then the damage "flows" along this beam of destruction.
8178 * The damage at every grid is the same as at the "center" of a "ball"
8179 * explosion, since the "beam" grids are treated as if they ARE at the
8180 * center of a "ball" explosion.
8182 * Currently, specifying "beam" plus "ball" means that locations which are
8183 * covered by the initial "beam", and also covered by the final "ball", except
8184 * for the final grid (the epicenter of the ball), will be "hit twice", once
8185 * by the initial beam, and once by the exploding ball. For the grid right
8186 * next to the epicenter, this results in 150% damage being done. The center
8187 * does not have this problem, for the same reason the final grid in a "beam"
8188 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8189 * grids which are covered by the "ball" will NOT work, as then they will
8190 * receive LESS damage than they should. Do not combine "beam" with "ball".
8192 * The array "gy[],gx[]" with current size "grids" is used to hold the
8193 * collected locations of all grids in the "blast area" plus "beam path".
8195 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8196 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8197 * first blast grid (see above) with radius "N" from the blast center. Note
8198 * that only the first gm[1] grids in the blast area thus take full damage.
8199 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8200 * number of blast grids.
8202 * Note that once the projection is complete, (y2,x2) holds the final location
8203 * of bolts/beams, and the "epicenter" of balls.
8205 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8206 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8207 * implementation of the "distance" function. Also, a bolt can be properly
8208 * viewed as a "ball" with a "rad" of "zero".
8210 * Note that if no "target" is reached before the beam/bolt/ball travels the
8211 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8212 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8214 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8215 * to move from point A to point B, even if the player cannot see part of the
8216 * projection path. Note that in general, the player will *always* see part
8217 * of the path, since it either starts at the player or ends on the player.
8219 * Hack -- we assume that every "projection" is "self-illuminating".
8221 * Hack -- when only a single monster is affected, we automatically track
8222 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8224 * Note that all projections now "explode" at their final destination, even
8225 * if they were being projected at a more distant destination. This means
8226 * that "ball" spells will *always* explode.
8228 * Note that we must call "handle_stuff()" after affecting terrain features
8229 * in the blast radius, in case the "illumination" of the grid was changed,
8230 * and "update_view()" and "update_monsters()" need to be called.
8232 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8242 int y_saver, x_saver; /* For reflecting monsters */
8244 int msec = delay_factor * delay_factor * delay_factor;
8246 /* Assume the player sees nothing */
8247 bool notice = FALSE;
8249 /* Assume the player has seen nothing */
8250 bool visual = FALSE;
8252 /* Assume the player has seen no blast grids */
8255 /* Assume to be a normal ball spell */
8256 bool breath = FALSE;
8258 /* Is the player blind? */
8259 bool blind = (p_ptr->blind ? TRUE : FALSE);
8261 bool old_hide = FALSE;
8263 /* Number of grids in the "path" */
8266 /* Actual grids in the "path" */
8269 /* Number of grids in the "blast area" (including the "beam" path) */
8272 /* Coordinates of the affected grids */
8273 byte gx[1024], gy[1024];
8275 /* Encoded "radius" info (see above) */
8278 /* Actual radius encoded in gm[] */
8283 /* Attacker's name (prepared before polymorph)*/
8286 /* Can the player see the source of this effect? */
8287 bool see_s_msg = TRUE;
8289 /* Initialize by null string */
8295 /* Default target of monsterspell is player */
8296 monster_target_y=py;
8297 monster_target_x=px;
8299 /* Hack -- Jump to target */
8300 if (flg & (PROJECT_JUMP))
8305 /* Clear the flag */
8306 flg &= ~(PROJECT_JUMP);
8311 /* Start at player */
8318 /* Start at monster */
8321 x1 = m_list[who].fx;
8322 y1 = m_list[who].fy;
8323 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8336 /* Default "destination" */
8341 /* Hack -- verify stuff */
8342 if (flg & (PROJECT_THRU))
8344 if ((x1 == x2) && (y1 == y2))
8346 flg &= ~(PROJECT_THRU);
8350 /* Handle a breath attack */
8355 if (flg & PROJECT_HIDE) old_hide = TRUE;
8356 flg |= PROJECT_HIDE;
8360 /* Hack -- Assume there will be no blast (max radius 32) */
8361 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8369 /* Collect beam grids */
8370 if (flg & (PROJECT_BEAM))
8381 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8383 case GF_DISINTEGRATE:
8384 flg |= (PROJECT_GRID);
8385 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8389 /* Calculate the projection path */
8391 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8393 /* Hack -- Handle stuff */
8396 /* Giga-Hack SEEKER & SUPER_RAY */
8398 if( typ == GF_SEEKER )
8408 for (i = 0; i < path_n; ++i)
8413 int ny = GRID_Y(path_g[i]);
8414 int nx = GRID_X(path_g[i]);
8425 /* Only do visuals if requested */
8426 if (!blind && !(flg & (PROJECT_HIDE)))
8428 /* Only do visuals if the player can "see" the bolt */
8429 if (panel_contains(y, x) && player_has_los_bold(y, x))
8436 /* Obtain the bolt pict */
8437 p = bolt_pict(oy, ox, y, x, typ);
8439 /* Extract attr/char */
8443 /* Visual effects */
8444 print_rel(c, a, y, x);
8445 move_cursor_relative(y, x);
8446 /*if (fresh_before)*/ Term_fresh();
8447 Term_xtra(TERM_XTRA_DELAY, msec);
8449 /*if (fresh_before)*/ Term_fresh();
8451 /* Display "beam" grids */
8452 if (flg & (PROJECT_BEAM))
8454 /* Obtain the explosion pict */
8455 p = bolt_pict(y, x, y, x, typ);
8457 /* Extract attr/char */
8461 /* Visual effects */
8462 print_rel(c, a, y, x);
8465 /* Hack -- Activate delay */
8469 /* Hack -- delay anyway for consistency */
8472 /* Delay for consistency */
8473 Term_xtra(TERM_XTRA_DELAY, msec);
8476 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8477 if( is_mirror_grid(&cave[y][x]))
8479 /* The target of monsterspell becomes tha mirror(broken) */
8480 monster_target_y=(s16b)y;
8481 monster_target_x=(s16b)x;
8484 next_mirror( &oy,&ox,y,x );
8486 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8487 for( j = last_i; j <=i ; j++ )
8489 y = GRID_Y(path_g[j]);
8490 x = GRID_X(path_g[j]);
8491 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
8492 if(!who && (project_m_n==1) && !jump ){
8493 if(cave[project_m_y][project_m_x].m_idx >0 ){
8494 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8498 /* Hack -- auto-recall */
8499 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8501 /* Hack - auto-track */
8502 health_track(cave[project_m_y][project_m_x].m_idx);
8506 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8511 for( i = last_i ; i < path_n ; i++ )
8514 y = GRID_Y(path_g[i]);
8515 x = GRID_X(path_g[i]);
8516 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
8518 if(!who && (project_m_n==1) && !jump ){
8519 if(cave[project_m_y][project_m_x].m_idx >0 ){
8520 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8524 /* Hack -- auto-recall */
8525 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8527 /* Hack - auto-track */
8528 health_track(cave[project_m_y][project_m_x].m_idx);
8532 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8536 else if(typ == GF_SUPER_RAY){
8538 int second_step = 0;
8545 for (i = 0; i < path_n; ++i)
8550 int ny = GRID_Y(path_g[i]);
8551 int nx = GRID_X(path_g[i]);
8562 /* Only do visuals if requested */
8563 if (!blind && !(flg & (PROJECT_HIDE)))
8565 /* Only do visuals if the player can "see" the bolt */
8566 if (panel_contains(y, x) && player_has_los_bold(y, x))
8573 /* Obtain the bolt pict */
8574 p = bolt_pict(oy, ox, y, x, typ);
8576 /* Extract attr/char */
8580 /* Visual effects */
8581 print_rel(c, a, y, x);
8582 move_cursor_relative(y, x);
8583 /*if (fresh_before)*/ Term_fresh();
8584 Term_xtra(TERM_XTRA_DELAY, msec);
8586 /*if (fresh_before)*/ Term_fresh();
8588 /* Display "beam" grids */
8589 if (flg & (PROJECT_BEAM))
8591 /* Obtain the explosion pict */
8592 p = bolt_pict(y, x, y, x, typ);
8594 /* Extract attr/char */
8598 /* Visual effects */
8599 print_rel(c, a, y, x);
8602 /* Hack -- Activate delay */
8606 /* Hack -- delay anyway for consistency */
8609 /* Delay for consistency */
8610 Term_xtra(TERM_XTRA_DELAY, msec);
8613 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8614 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8616 if( second_step )continue;
8619 if( is_mirror_grid(&cave[y][x]) && !second_step )
8621 /* The target of monsterspell becomes tha mirror(broken) */
8622 monster_target_y=(s16b)y;
8623 monster_target_x=(s16b)x;
8626 for( j = 0; j <=i ; j++ )
8628 y = GRID_Y(path_g[j]);
8629 x = GRID_X(path_g[j]);
8630 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8634 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8635 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8636 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8637 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8638 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8639 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8640 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8641 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8644 for( i = 0; i < path_n ; i++ )
8647 y = GRID_Y(path_g[i]);
8648 x = GRID_X(path_g[i]);
8649 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
8650 if(!who && (project_m_n==1) && !jump ){
8651 if(cave[project_m_y][project_m_x].m_idx >0 ){
8652 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8656 /* Hack -- auto-recall */
8657 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8659 /* Hack - auto-track */
8660 health_track(cave[project_m_y][project_m_x].m_idx);
8664 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8669 /* Project along the path */
8670 for (i = 0; i < path_n; ++i)
8675 int ny = GRID_Y(path_g[i]);
8676 int nx = GRID_X(path_g[i]);
8678 if (flg & PROJECT_DISI)
8680 /* Hack -- Balls explode before reaching walls */
8681 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8683 else if (flg & PROJECT_LOS)
8685 /* Hack -- Balls explode before reaching walls */
8686 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8690 /* Hack -- Balls explode before reaching walls */
8691 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8698 /* Collect beam grids */
8699 if (flg & (PROJECT_BEAM))
8706 /* Only do visuals if requested */
8707 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8709 /* Only do visuals if the player can "see" the bolt */
8710 if (panel_contains(y, x) && player_has_los_bold(y, x))
8717 /* Obtain the bolt pict */
8718 p = bolt_pict(oy, ox, y, x, typ);
8720 /* Extract attr/char */
8724 /* Visual effects */
8725 print_rel(c, a, y, x);
8726 move_cursor_relative(y, x);
8727 /*if (fresh_before)*/ Term_fresh();
8728 Term_xtra(TERM_XTRA_DELAY, msec);
8730 /*if (fresh_before)*/ Term_fresh();
8732 /* Display "beam" grids */
8733 if (flg & (PROJECT_BEAM))
8735 /* Obtain the explosion pict */
8736 p = bolt_pict(y, x, y, x, typ);
8738 /* Extract attr/char */
8742 /* Visual effects */
8743 print_rel(c, a, y, x);
8746 /* Hack -- Activate delay */
8750 /* Hack -- delay anyway for consistency */
8753 /* Delay for consistency */
8754 Term_xtra(TERM_XTRA_DELAY, msec);
8761 /* Save the "blast epicenter" */
8765 if (breath && !path_n)
8771 flg &= ~(PROJECT_HIDE);
8775 /* Start the "explosion" */
8778 /* Hack -- make sure beams get to "explode" */
8786 /* If we found a "target", explode there */
8787 if (dist <= MAX_RANGE)
8789 /* Mega-Hack -- remove the final "beam" grid */
8790 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8793 * Create a conical breath attack
8804 flg &= ~(PROJECT_HIDE);
8806 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8810 /* Determine the blast area, work from the inside out */
8811 for (dist = 0; dist <= rad; dist++)
8813 /* Scan the maximal blast area of radius "dist" */
8814 for (y = by - dist; y <= by + dist; y++)
8816 for (x = bx - dist; x <= bx + dist; x++)
8818 /* Ignore "illegal" locations */
8819 if (!in_bounds2(y, x)) continue;
8821 /* Enforce a "circular" explosion */
8822 if (distance(by, bx, y, x) != dist) continue;
8828 /* Lights are stopped by opaque terrains */
8829 if (!los(by, bx, y, x)) continue;
8831 case GF_DISINTEGRATE:
8832 /* Disintegration are stopped only by perma-walls */
8833 if (!in_disintegration_range(by, bx, y, x)) continue;
8836 /* Ball explosions are stopped by walls */
8837 if (!projectable(by, bx, y, x)) continue;
8841 /* Save this grid */
8848 /* Encode some more "radius" info */
8854 /* Speed -- ignore "non-explosions" */
8855 if (!grids) return (FALSE);
8858 /* Display the "blast area" if requested */
8859 if (!blind && !(flg & (PROJECT_HIDE)))
8861 /* Then do the "blast", from inside out */
8862 for (t = 0; t <= gm_rad; t++)
8864 /* Dump everything with this radius */
8865 for (i = gm[t]; i < gm[t+1]; i++)
8867 /* Extract the location */
8871 /* Only do visuals if the player can "see" the blast */
8872 if (panel_contains(y, x) && player_has_los_bold(y, x))
8881 /* Obtain the explosion pict */
8882 p = bolt_pict(y, x, y, x, typ);
8884 /* Extract attr/char */
8888 /* Visual effects -- Display */
8889 print_rel(c, a, y, x);
8893 /* Hack -- center the cursor */
8894 move_cursor_relative(by, bx);
8896 /* Flush each "radius" seperately */
8897 /*if (fresh_before)*/ Term_fresh();
8899 /* Delay (efficiently) */
8900 if (visual || drawn)
8902 Term_xtra(TERM_XTRA_DELAY, msec);
8906 /* Flush the erasing */
8909 /* Erase the explosion drawn above */
8910 for (i = 0; i < grids; i++)
8912 /* Extract the location */
8916 /* Hack -- Erase if needed */
8917 if (panel_contains(y, x) && player_has_los_bold(y, x))
8923 /* Hack -- center the cursor */
8924 move_cursor_relative(by, bx);
8926 /* Flush the explosion */
8927 /*if (fresh_before)*/ Term_fresh();
8932 /* Update stuff if needed */
8933 if (p_ptr->update) update_stuff();
8936 if (flg & PROJECT_KILL)
8938 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
8939 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
8943 /* Check features */
8944 if (flg & (PROJECT_GRID))
8946 /* Start with "dist" of zero */
8949 /* Scan for features */
8950 for (i = 0; i < grids; i++)
8952 /* Hack -- Notice new "dist" values */
8953 if (gm[dist+1] == i) dist++;
8955 /* Get the grid location */
8959 /* Find the closest point in the blast */
8962 int d = dist_to_line(y, x, y1, x1, by, bx);
8964 /* Affect the grid */
8965 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8969 /* Affect the grid */
8970 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8975 /* Update stuff if needed */
8976 if (p_ptr->update) update_stuff();
8979 if (flg & (PROJECT_ITEM))
8981 /* Start with "dist" of zero */
8984 /* Scan for objects */
8985 for (i = 0; i < grids; i++)
8987 /* Hack -- Notice new "dist" values */
8988 if (gm[dist+1] == i) dist++;
8990 /* Get the grid location */
8994 /* Find the closest point in the blast */
8997 int d = dist_to_line(y, x, y1, x1, by, bx);
8999 /* Affect the object in the grid */
9000 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
9004 /* Affect the object in the grid */
9005 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
9011 /* Check monsters */
9012 if (flg & (PROJECT_KILL))
9019 /* Start with "dist" of zero */
9022 /* Scan for monsters */
9023 for (i = 0; i < grids; i++)
9027 /* Hack -- Notice new "dist" values */
9028 if (gm[dist + 1] == i) dist++;
9030 /* Get the grid location */
9034 /* A single bolt may be reflected */
9037 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9038 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9040 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
9041 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
9042 (!who || dist_hack > 1) && !one_in_(10))
9045 int max_attempts = 10;
9047 /* Choose 'new' target */
9050 t_y = y_saver - 1 + randint1(3);
9051 t_x = x_saver - 1 + randint1(3);
9054 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9056 if (max_attempts < 1)
9065 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9066 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9067 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9068 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9070 msg_print("The attack bounces!");
9073 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9075 /* Reflected bolts randomly target either one */
9076 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
9077 else flg |= PROJECT_PLAYER;
9079 /* The bolt is reflected */
9080 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9082 /* Don't affect the monster any longer */
9088 /* Find the closest point in the blast */
9091 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9095 effective_dist = dist;
9099 /* There is the riding player on this monster */
9100 if (p_ptr->riding && player_bold(y, x))
9102 /* Aimed on the player */
9103 if (flg & PROJECT_PLAYER)
9105 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9108 * A beam or bolt is well aimed
9110 * So don't affects the mount.
9117 * The spell is not well aimed,
9118 * So partly affect the mount too.
9125 * This grid is the original target.
9126 * Or aimed on your horse.
9128 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9130 /* Hit the mount with full damage */
9134 * Otherwise this grid is not the
9135 * original target, it means that line
9136 * of fire is obstructed by this
9140 * A beam or bolt will hit either
9141 * player or mount. Choose randomly.
9143 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9147 /* Hit the mount with full damage */
9151 /* Hit the player later */
9152 flg |= PROJECT_PLAYER;
9154 /* Don't affect the mount */
9160 * The spell is not well aimed, so
9161 * partly affect both player and
9170 /* Affect the monster in the grid */
9171 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
9175 /* Player affected one monster (without "jumping") */
9176 if (!who && (project_m_n == 1) && !jump)
9182 /* Track if possible */
9183 if (cave[y][x].m_idx > 0)
9185 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9189 /* Hack -- auto-recall */
9190 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
9192 /* Hack - auto-track */
9193 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9201 if (flg & (PROJECT_KILL))
9203 /* Start with "dist" of zero */
9206 /* Scan for player */
9207 for (i = 0; i < grids; i++)
9211 /* Hack -- Notice new "dist" values */
9212 if (gm[dist+1] == i) dist++;
9214 /* Get the grid location */
9218 /* Affect the player? */
9219 if (!player_bold(y, x)) continue;
9221 /* Find the closest point in the blast */
9224 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9228 effective_dist = dist;
9231 /* Target may be your horse */
9234 /* Aimed on the player */
9235 if (flg & PROJECT_PLAYER)
9237 /* Hit the player with full damage */
9241 * Hack -- When this grid was not the
9242 * original target, a beam or bolt
9243 * would hit either player or mount,
9244 * and should be choosen randomly.
9246 * But already choosen to hit the
9247 * mount at this point.
9249 * Or aimed on your horse.
9251 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9254 * A beam or bolt is well aimed
9256 * So don't affects the player.
9263 * The spell is not well aimed,
9264 * So partly affect the player too.
9270 /* Affect the player */
9271 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9279 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9281 if (rakubadam_m > 0)
9283 if (rakuba(rakubadam_m, FALSE))
9286 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9288 msg_format("%^s has thrown you off!", m_name);
9292 if (p_ptr->riding && rakubadam_p > 0)
9294 if(rakuba(rakubadam_p, FALSE))
9297 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9299 msg_format("You have fallen from %s.", m_name);
9305 /* Return "something was noticed" */
9309 bool binding_field( int dam )
9311 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9312 int mirror_num=0; /* ¶À¤Î¿ô */
9317 int msec= delay_factor*delay_factor*delay_factor;
9323 /* Default target of monsterspell is player */
9324 monster_target_y=py;
9325 monster_target_x=px;
9327 for( x=0 ; x < cur_wid ; x++ )
9329 for( y=0 ; y < cur_hgt ; y++ )
9331 if( is_mirror_grid(&cave[y][x]) &&
9332 distance(py,px,y,x) <= MAX_RANGE &&
9333 distance(py,px,y,x) != 0 &&
9334 player_has_los_bold(y,x) &&
9335 projectable(py, px, y, x)
9337 mirror_y[mirror_num]=y;
9338 mirror_x[mirror_num]=x;
9344 if( mirror_num < 2 )return FALSE;
9346 point_x[0] = randint0( mirror_num );
9348 point_x[1] = randint0( mirror_num );
9350 while( point_x[0] == point_x[1] );
9352 point_y[0]=mirror_y[point_x[0]];
9353 point_x[0]=mirror_x[point_x[0]];
9354 point_y[1]=mirror_y[point_x[1]];
9355 point_x[1]=mirror_x[point_x[1]];
9359 x=point_x[0]+point_x[1]+point_x[2];
9360 y=point_y[0]+point_y[1]+point_y[2];
9362 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9363 - (point_y[0]*3-y)*(point_x[1]*3-x);
9364 if( centersign == 0 )return FALSE;
9366 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9367 x1 = x1 < point_x[2] ? x1 : point_x[2];
9368 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9369 y1 = y1 < point_y[2] ? y1 : point_y[2];
9371 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9372 x2 = x2 > point_x[2] ? x2 : point_x[2];
9373 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9374 y2 = y2 > point_y[2] ? y2 : point_y[2];
9376 for( y=y1 ; y <=y2 ; y++ ){
9377 for( x=x1 ; x <=x2 ; x++ ){
9378 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9379 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9380 centersign*( (point_x[1]-x)*(point_y[2]-y)
9381 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9382 centersign*( (point_x[2]-x)*(point_y[0]-y)
9383 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9385 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9386 /* Visual effects */
9388 && panel_contains(y,x)){
9389 p = bolt_pict(y,x,y,x, GF_MANA );
9390 print_rel(PICT_C(p), PICT_A(p),y,x);
9391 move_cursor_relative(y, x);
9392 /*if (fresh_before)*/ Term_fresh();
9393 Term_xtra(TERM_XTRA_DELAY, msec);
9399 for( y=y1 ; y <=y2 ; y++ ){
9400 for( x=x1 ; x <=x2 ; x++ ){
9401 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9402 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9403 centersign*( (point_x[1]-x)*(point_y[2]-y)
9404 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9405 centersign*( (point_x[2]-x)*(point_y[0]-y)
9406 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9408 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9409 (void)project_f(0,0,y,x,dam,GF_MANA);
9414 for( y=y1 ; y <=y2 ; y++ ){
9415 for( x=x1 ; x <=x2 ; x++ ){
9416 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9417 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9418 centersign*( (point_x[1]-x)*(point_y[2]-y)
9419 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9420 centersign*( (point_x[2]-x)*(point_y[0]-y)
9421 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9423 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9424 (void)project_o(0,0,y,x,dam,GF_MANA);
9429 for( y=y1 ; y <=y2 ; y++ ){
9430 for( x=x1 ; x <=x2 ; x++ ){
9431 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9432 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9433 centersign*( (point_x[1]-x)*(point_y[2]-y)
9434 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9435 centersign*( (point_x[2]-x)*(point_y[0]-y)
9436 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9438 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9439 (void)project_m(0,0,y,x,dam,GF_MANA,
9440 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
9447 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9449 msg_print("The field broke a mirror");
9451 remove_mirror(point_y[0],point_x[0]);
9457 void seal_of_mirror( int dam )
9461 for( x = 0 ; x < cur_wid ; x++ )
9463 for( y = 0 ; y < cur_hgt ; y++ )
9465 if( is_mirror_grid(&cave[y][x]))
9467 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9468 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
9470 if( !cave[y][x].m_idx )