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 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
6077 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
6078 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
6081 delete_monster_idx(c_ptr->m_idx);
6084 /* If the player did it, give him experience, check fear */
6089 /* Hurt the monster, check for fear and death */
6090 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6095 /* Damaged monster */
6098 /* HACK - anger the monster before showing the sleep message */
6099 if (do_sleep) anger_monster(m_ptr);
6101 /* Give detailed messages if visible or destroyed */
6102 if (note && seen_msg)
6104 msg_format("%s%s", m_name, note);
6106 msg_format("%^s%s", m_name, note);
6110 /* Hack -- Pain message */
6111 else if (known && (dam || !do_fear))
6113 message_pain(c_ptr->m_idx, dam);
6116 /* Anger monsters */
6117 if (((dam > 0) || get_angry) && !do_sleep)
6118 anger_monster(m_ptr);
6121 if ((fear || do_fear) && seen)
6128 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6130 msg_format("%^s flees in terror!", m_name);
6134 /* Hack -- handle sleep */
6135 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
6139 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6141 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6145 switch (randint1(28))
6151 msg_print("ÃÏÌ̤¬Íɤ줿...");
6153 msg_print("The ground trembles...");
6156 earthquake(ty, tx, 4 + randint0(4));
6157 if (!one_in_(6)) break;
6159 case 3: case 4: case 5: case 6:
6162 int dam = damroll(10, 10);
6164 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6166 msg_print("A portal opens to a plane of raw mana!");
6169 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6170 if (!one_in_(6)) break;
6176 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6178 msg_print("Space warps about you!");
6181 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
6182 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6183 if (!one_in_(6)) break;
6185 case 9: case 10: case 11:
6187 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6189 msg_print("You feel a surge of energy!");
6192 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6193 if (!one_in_(6)) break;
6194 case 12: case 13: case 14: case 15: case 16:
6195 aggravate_monsters(0);
6196 if (!one_in_(6)) break;
6198 count += activate_hi_summon(ty, tx, TRUE);
6199 if (!one_in_(6)) break;
6200 case 19: case 20: case 21: case 22:
6202 bool pet = !one_in_(3);
6203 u32b mode = PM_ALLOW_GROUP;
6205 if (pet) mode |= PM_FORCE_PET;
6206 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6208 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6209 if (!one_in_(6)) break;
6211 case 23: case 24: case 25:
6212 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6214 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6216 msg_print("You feel your life draining away...");
6219 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6220 else lose_exp(p_ptr->exp / 16);
6221 if (!one_in_(6)) break;
6222 case 26: case 27: case 28:
6231 (void)do_dec_stat(i);
6240 (void)do_dec_stat(randint0(6));
6249 if (p_ptr->inside_battle)
6251 p_ptr->health_who = c_ptr->m_idx;
6252 p_ptr->redraw |= (PR_HEALTH);
6256 /* XXX XXX XXX Verify this code */
6258 /* Update the monster */
6259 if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE);
6261 /* Redraw the monster grid */
6265 /* Update monster recall window */
6266 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
6269 p_ptr->window |= (PW_MONSTER);
6272 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6276 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6278 set_target(m_ptr, monster_target_y, monster_target_x);
6281 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6283 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6287 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6289 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6290 rakubadam_m = (dam > 200) ? 200 : dam;
6299 /* Get local object */
6302 /* Prepare to make a Blade of Chaos */
6303 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6305 q_ptr->pval = photo;
6307 /* Mark the item as fully known */
6308 q_ptr->ident |= (IDENT_MENTAL);
6310 /* Drop it in the dungeon */
6311 (void)drop_near(q_ptr, -1, py, px);
6319 /* Return "Anything seen?" */
6325 * Helper function for "project()" below.
6327 * Handle a beam/bolt/ball causing damage to the player.
6329 * This routine takes a "source monster" (by index), a "distance", a default
6330 * "damage", and a "damage type". See "project_m()" above.
6332 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6333 * is reduced (see "project_m()" above). This can happen if a monster breathes
6334 * at the player and hits a wall instead.
6336 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6337 * to know if this is actually a ball or a bolt spell
6340 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6341 * we just assume that the effects were obvious, for historical reasons.
6343 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6348 /* Hack -- assume obvious */
6349 bool obvious = TRUE;
6351 /* Player blind-ness */
6352 bool blind = (p_ptr->blind ? TRUE : FALSE);
6354 /* Player needs a "description" (he is blind) */
6357 /* Source monster */
6358 monster_type *m_ptr = NULL;
6360 /* Monster name (for attacks) */
6363 /* Monster name (for damage) */
6366 /* Hack -- messages */
6372 /* Player is not here */
6373 if (!player_bold(y, x)) return (FALSE);
6375 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6377 if (kawarimi(TRUE)) return FALSE;
6380 /* Player cannot hurt himself */
6381 if (!who) return (FALSE);
6382 if (who == p_ptr->riding) return (FALSE);
6384 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6387 int max_attempts = 10;
6390 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6391 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6392 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6394 if (blind) msg_print("Something bounces!");
6395 else msg_print("The attack bounces!");
6399 /* Choose 'new' target */
6404 t_y = m_list[who].fy - 1 + randint1(3);
6405 t_x = m_list[who].fx - 1 + randint1(3);
6408 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6410 if (max_attempts < 1)
6412 t_y = m_list[who].fy;
6413 t_x = m_list[who].fx;
6418 t_y = py - 1 + randint1(3);
6419 t_x = px - 1 + randint1(3);
6422 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6429 /* Limit maximum damage */
6430 if (dam > 1600) dam = 1600;
6432 /* Reduce damage by distance */
6433 dam = (dam + r) / (r + 1);
6436 /* If the player is blind, be more descriptive */
6437 if (blind) fuzzy = TRUE;
6442 /* Get the source monster */
6443 m_ptr = &m_list[who];
6444 /* Extract the monster level */
6445 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6447 /* Get the monster name */
6448 monster_desc(m_name, m_ptr, 0);
6450 /* Get the monster's real name (gotten before polymorph!) */
6451 strcpy(killer, who_name);
6457 case PROJECT_WHO_UNCTRL_POWER:
6459 strcpy(killer, "À©¸æ¤Ç¤¤Ê¤¤ÎϤÎÈÅή");
6461 strcpy(killer, "uncontrollable power storm");
6465 case PROJECT_WHO_GLASS_SHARDS:
6467 strcpy(killer, "¥¬¥é¥¹¤ÎÇËÊÒ");
6469 strcpy(killer, "shards of glass");
6475 strcpy(killer, "æ«");
6477 strcpy(killer, "a trap");
6483 strcpy(m_name, killer);
6486 /* Analyze the damage */
6489 /* Standard damage -- hurts inventory too */
6493 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6495 if (fuzzy) msg_print("You are hit by acid!");
6498 get_damage = acid_dam(dam, killer, monspell);
6502 /* Standard damage -- hurts inventory too */
6506 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6508 if (fuzzy) msg_print("You are hit by fire!");
6511 get_damage = fire_dam(dam, killer, monspell);
6515 /* Standard damage -- hurts inventory too */
6519 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6521 if (fuzzy) msg_print("You are hit by cold!");
6524 get_damage = cold_dam(dam, killer, monspell);
6528 /* Standard damage -- hurts inventory too */
6532 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6534 if (fuzzy) msg_print("You are hit by lightning!");
6537 get_damage = elec_dam(dam, killer, monspell);
6541 /* Standard damage -- also poisons player */
6544 bool double_resist = IS_OPPOSE_POIS();
6546 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6548 if (fuzzy) msg_print("You are hit by poison!");
6551 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6552 if (double_resist) dam = (dam + 2) / 3;
6554 if ((!(double_resist || p_ptr->resist_pois)) &&
6555 one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
6560 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6562 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6564 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6569 /* Standard damage -- also poisons / mutates player */
6572 bool double_resist = IS_OPPOSE_POIS();
6574 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6576 if (fuzzy) msg_print("You are hit by radiation!");
6579 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6580 if (double_resist) dam = (2 * dam + 2) / 5;
6581 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6582 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
6584 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6586 if (one_in_(5)) /* 6 */
6589 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6591 msg_print("You undergo a freakish metamorphosis!");
6594 if (one_in_(4)) /* 4 */
6602 inven_damage(set_acid_destroy, 2);
6608 /* Standard damage */
6612 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6614 if (fuzzy) msg_print("You are hit by something!");
6617 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6621 /* Holy Orb -- Player only takes partial damage */
6625 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6627 if (fuzzy) msg_print("You are hit by something!");
6630 if (p_ptr->align > 10)
6632 else if (p_ptr->align < -10)
6634 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6641 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6643 if (fuzzy) msg_print("You are hit by something!");
6646 if (p_ptr->align > 10)
6648 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6652 /* Arrow -- XXX no dodging */
6656 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6658 if (fuzzy) msg_print("You are hit by something sharp!");
6661 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6664 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6666 msg_print("You cut down the arrow!");
6670 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6674 /* Plasma -- XXX No resist */
6678 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6680 if (fuzzy) msg_print("You are hit by something *HOT*!");
6683 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6685 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6687 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6688 (void)set_stun(p_ptr->stun + k);
6691 if (!(p_ptr->resist_fire ||
6693 p_ptr->immune_fire))
6695 inven_damage(set_acid_destroy, 3);
6701 /* Nether -- drain experience */
6705 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6707 if (fuzzy) msg_print("You are hit by nether forces!");
6710 if (p_ptr->resist_neth)
6712 if (!prace_is_(RACE_SPECTRE))
6713 dam *= 6; dam /= (randint1(4) + 7);
6715 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6717 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
6720 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6722 msg_print("You feel invigorated!");
6726 learn_spell(monspell);
6730 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6736 /* Water -- stun/confuse */
6740 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6742 if (fuzzy) msg_print("You are hit by something wet!");
6745 if (!CHECK_MULTISHADOW())
6747 if (!p_ptr->resist_sound)
6749 set_stun(p_ptr->stun + randint1(40));
6751 if (!p_ptr->resist_conf)
6753 set_confused(p_ptr->confused + randint1(5) + 5);
6758 inven_damage(set_cold_destroy, 3);
6762 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6766 /* Chaos -- many effects */
6770 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6772 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6775 if (p_ptr->resist_chaos)
6777 dam *= 6; dam /= (randint1(4) + 7);
6780 if (!CHECK_MULTISHADOW())
6782 if (!p_ptr->resist_conf)
6784 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6786 if (!p_ptr->resist_chaos)
6788 (void)set_image(p_ptr->image + randint1(10));
6792 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6794 msg_print("Your body is twisted by chaos!");
6797 (void)gain_random_mutation(0);
6800 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6802 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6805 if (!p_ptr->resist_chaos || one_in_(9))
6807 inven_damage(set_elec_destroy, 2);
6808 inven_damage(set_fire_destroy, 2);
6812 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6816 /* Shards -- mostly cutting */
6820 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6822 if (fuzzy) msg_print("You are hit by something sharp!");
6825 if (p_ptr->resist_shard)
6827 dam *= 6; dam /= (randint1(4) + 7);
6829 else if (!CHECK_MULTISHADOW())
6831 (void)set_cut(p_ptr->cut + dam);
6834 if (!p_ptr->resist_shard || one_in_(13))
6836 inven_damage(set_cold_destroy, 2);
6839 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6843 /* Sound -- mostly stunning */
6847 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6849 if (fuzzy) msg_print("You are hit by a loud noise!");
6852 if (p_ptr->resist_sound)
6854 dam *= 5; dam /= (randint1(4) + 7);
6856 else if (!CHECK_MULTISHADOW())
6858 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6859 (void)set_stun(p_ptr->stun + k);
6862 if (!p_ptr->resist_sound || one_in_(13))
6864 inven_damage(set_cold_destroy, 2);
6867 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6871 /* Pure confusion */
6875 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6877 if (fuzzy) msg_print("You are hit by something puzzling!");
6880 if (p_ptr->resist_conf)
6882 dam *= 5; dam /= (randint1(4) + 7);
6884 else if (!CHECK_MULTISHADOW())
6886 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6888 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6892 /* Disenchantment -- see above */
6896 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6898 if (fuzzy) msg_print("You are hit by something static!");
6901 if (p_ptr->resist_disen)
6903 dam *= 6; dam /= (randint1(4) + 7);
6905 else if (!CHECK_MULTISHADOW())
6907 (void)apply_disenchant(0);
6909 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6913 /* Nexus -- see above */
6917 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6919 if (fuzzy) msg_print("You are hit by something strange!");
6922 if (p_ptr->resist_nexus)
6924 dam *= 6; dam /= (randint1(4) + 7);
6926 else if (!CHECK_MULTISHADOW())
6930 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6934 /* Force -- mostly stun */
6938 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6940 if (fuzzy) msg_print("You are hit by kinetic force!");
6943 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6945 (void)set_stun(p_ptr->stun + randint1(20));
6947 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6952 /* Rocket -- stun, cut */
6956 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6958 if (fuzzy) msg_print("There is an explosion!");
6961 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
6963 (void)set_stun(p_ptr->stun + randint1(20));
6966 if (p_ptr->resist_shard)
6970 else if (!CHECK_MULTISHADOW())
6972 (void)set_cut(p_ptr->cut + (dam / 2));
6975 if (!p_ptr->resist_shard || one_in_(12))
6977 inven_damage(set_cold_destroy, 3);
6980 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6984 /* Inertia -- slowness */
6988 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6990 if (fuzzy) msg_print("You are hit by something slow!");
6993 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6994 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6998 /* Lite -- blinding */
7002 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7004 if (fuzzy) msg_print("You are hit by something!");
7007 if (p_ptr->resist_lite)
7009 dam *= 4; dam /= (randint1(4) + 7);
7011 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7013 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7016 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7019 if (!CHECK_MULTISHADOW()) msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7021 if (!CHECK_MULTISHADOW()) msg_print("The light scorches your flesh!");
7026 else if (prace_is_(RACE_S_FAIRY))
7031 if (p_ptr->wraith_form) dam *= 2;
7032 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7034 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
7036 p_ptr->wraith_form = 0;
7038 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7040 msg_print("The light forces you out of your incorporeal shadow form.");
7043 p_ptr->redraw |= PR_MAP;
7044 /* Update monsters */
7045 p_ptr->update |= (PU_MONSTERS);
7047 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7049 /* Redraw status bar */
7050 p_ptr->redraw |= (PR_STATUS);
7057 /* Dark -- blinding */
7061 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7063 if (fuzzy) msg_print("You are hit by something!");
7066 if (p_ptr->resist_dark)
7068 dam *= 4; dam /= (randint1(4) + 7);
7070 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7072 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
7074 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7076 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7080 /* Time -- bolt fewer effects XXX */
7084 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7086 if (fuzzy) msg_print("You are hit by a blast from the past!");
7089 if (p_ptr->resist_time)
7092 dam /= (randint1(4) + 7);
7094 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7096 msg_print("You feel as if time is passing you by.");
7099 else if (!CHECK_MULTISHADOW())
7101 switch (randint1(10))
7103 case 1: case 2: case 3: case 4: case 5:
7105 if (p_ptr->prace == RACE_ANDROID) break;
7107 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7109 msg_print("You feel life has clocked back.");
7112 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7116 case 6: case 7: case 8: case 9:
7118 switch (randint1(6))
7121 case 1: k = A_STR; act = "¶¯¤¯"; break;
7122 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7123 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7124 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7125 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7126 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7128 case 1: k = A_STR; act = "strong"; break;
7129 case 2: k = A_INT; act = "bright"; break;
7130 case 3: k = A_WIS; act = "wise"; break;
7131 case 4: k = A_DEX; act = "agile"; break;
7132 case 5: k = A_CON; act = "hale"; break;
7133 case 6: k = A_CHR; act = "beautiful"; break;
7138 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7140 msg_format("You're not as %s as you used to be...", act);
7143 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7144 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7145 p_ptr->update |= (PU_BONUS);
7152 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7154 msg_print("You're not as powerful as you used to be...");
7157 for (k = 0; k < 6; k++)
7159 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7160 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7162 p_ptr->update |= (PU_BONUS);
7168 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7172 /* Gravity -- stun plus slowness plus teleport */
7176 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7177 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7179 if (fuzzy) msg_print("You are hit by something heavy!");
7180 msg_print("Gravity warps around you.");
7183 if (!CHECK_MULTISHADOW())
7185 teleport_player(5, TELEPORT_PASSIVE);
7186 if (!p_ptr->levitation)
7187 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7188 if (!(p_ptr->resist_sound || p_ptr->levitation))
7190 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7191 (void)set_stun(p_ptr->stun + k);
7194 if (p_ptr->levitation)
7196 dam = (dam * 2) / 3;
7199 if (!p_ptr->levitation || one_in_(13))
7201 inven_damage(set_cold_destroy, 2);
7204 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7208 /* Standard damage */
7209 case GF_DISINTEGRATE:
7212 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7214 if (fuzzy) msg_print("You are hit by pure energy!");
7217 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7224 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7226 if (fuzzy) msg_print("You are hit by something invigorating!");
7229 (void)hp_player(dam);
7237 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7239 if (fuzzy) msg_print("You are hit by something!");
7242 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7250 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7252 if (fuzzy) msg_print("You are hit by something slow!");
7255 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7261 if (p_ptr->free_act) break;
7263 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7265 if (fuzzy) msg_print("You fall asleep!");
7269 if (ironman_nightmare)
7272 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7274 msg_print("A horrible vision enters your mind.");
7277 /* Pick a nightmare */
7278 get_mon_num_prep(get_nightmare, NULL);
7280 /* Have some nightmares */
7281 have_nightmare(get_mon_num(MAX_DEPTH));
7283 /* Remove the monster restriction */
7284 get_mon_num_prep(NULL, NULL);
7287 set_paralyzed(p_ptr->paralyzed + dam);
7298 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7300 if (fuzzy) msg_print("You are hit by an aura of magic!");
7303 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7311 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7313 if (fuzzy) msg_print("You are hit by an energy!");
7316 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7324 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7326 if (fuzzy) msg_print("Something falls from the sky on you!");
7329 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7330 if (!p_ptr->resist_shard || one_in_(13))
7332 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7333 inven_damage(set_cold_destroy, 2);
7339 /* Ice -- cold plus stun plus cuts */
7343 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7345 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7348 cold_dam(dam, killer, monspell);
7349 if (!CHECK_MULTISHADOW())
7351 if (!p_ptr->resist_shard)
7353 (void)set_cut(p_ptr->cut + damroll(5, 8));
7355 if (!p_ptr->resist_sound)
7357 (void)set_stun(p_ptr->stun + randint1(15));
7360 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7362 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7373 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7375 if (fuzzy) msg_print("You are hit by something extremely cold!");
7379 if (p_ptr->mimic_form)
7381 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7382 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7387 switch (p_ptr->prace)
7389 /* Some races are immune */
7403 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7415 if (CHECK_MULTISHADOW())
7418 msg_print("¹¶·â¤Ï¸¸±Æ¤ËÌ¿Ã椷¡¢¤¢¤Ê¤¿¤Ë¤ÏÆϤ«¤Ê¤«¤Ã¤¿¡£");
7420 msg_print("The attack hits Shadow, you are unharmed!");
7423 else if (p_ptr->csp)
7427 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7428 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7430 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7431 else msg_print("Your psychic energy is drawn!");
7435 if (dam >= p_ptr->csp)
7439 p_ptr->csp_frac = 0;
7448 learn_spell(monspell);
7451 p_ptr->redraw |= (PR_MANA);
7454 p_ptr->window |= (PW_PLAYER);
7455 p_ptr->window |= (PW_SPELL);
7459 /* Heal the monster */
7460 if (m_ptr->hp < m_ptr->maxhp)
7463 m_ptr->hp += (6 * dam);
7464 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7466 /* Redraw (later) if needed */
7467 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7468 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7470 /* Special message */
7474 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7476 msg_format("%^s appears healthier.", m_name);
7490 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7493 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7495 msg_print("You resist the effects!");
7497 learn_spell(monspell);
7501 if (!CHECK_MULTISHADOW())
7504 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7506 msg_print("Your mind is blasted by psyonic energy.");
7509 if (!p_ptr->resist_conf)
7511 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7514 if (!p_ptr->resist_chaos && one_in_(3))
7516 (void)set_image(p_ptr->image + randint0(250) + 150);
7523 p_ptr->csp_frac = 0;
7525 p_ptr->redraw |= PR_MANA;
7528 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7534 case GF_BRAIN_SMASH:
7536 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
7539 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7541 msg_print("You resist the effects!");
7543 learn_spell(monspell);
7547 if (!CHECK_MULTISHADOW())
7550 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7552 msg_print("Your mind is blasted by psionic energy.");
7559 p_ptr->csp_frac = 0;
7561 p_ptr->redraw |= PR_MANA;
7564 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7565 if (!CHECK_MULTISHADOW())
7567 if (!p_ptr->resist_blind)
7569 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7571 if (!p_ptr->resist_conf)
7573 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7575 if (!p_ptr->free_act)
7577 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7579 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7581 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7582 (void)do_dec_stat(A_INT);
7583 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
7584 (void)do_dec_stat(A_WIS);
7586 if (!p_ptr->resist_chaos)
7588 (void)set_image(p_ptr->image + randint0(250) + 150);
7598 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7601 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7603 msg_print("You resist the effects!");
7605 learn_spell(monspell);
7609 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
7610 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7618 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7621 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7623 msg_print("You resist the effects!");
7625 learn_spell(monspell);
7629 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
7630 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7638 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7641 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7643 msg_print("You resist the effects!");
7645 learn_spell(monspell);
7649 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
7650 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7658 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
7661 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7663 msg_print("You resist the effects!");
7665 learn_spell(monspell);
7669 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7670 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
7678 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
7681 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7683 msg_format("You resist the effects!");
7685 learn_spell(monspell);
7689 if (!CHECK_MULTISHADOW())
7692 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7694 msg_print("You feel your life fade away!");
7696 curse_equipment(40, 20);
7699 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7701 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
7716 if (p_ptr->tim_eyeeye && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
7719 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7721 char m_name_self[80];
7724 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7726 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7728 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7729 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7732 if (p_ptr->riding && dam > 0)
7734 rakubadam_p = (dam > 200) ? 200 : dam;
7742 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7744 (void)kawarimi(FALSE);
7747 /* Return "Anything seen?" */
7753 * Find the distance from (x, y) to a line.
7755 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7757 /* Vector from (x, y) to (x1, y1) */
7766 int pd = distance(y1, x1, y, x);
7767 int nd = distance(y1, x1, y2, x2);
7769 if (pd > nd) return distance(y, x, y2, x2);
7771 /* Component of P on N */
7772 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7774 /* Absolute value */
7775 return((nd >= 0) ? nd : 0 - nd);
7782 * Modified version of los() for calculation of disintegration balls.
7783 * Disintegration effects are stopped by permanent walls.
7785 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7805 /* Slope, or 1/Slope, of LOS */
7809 /* Extract the offset */
7813 /* Extract the absolute offset */
7818 /* Handle adjacent (or identical) grids */
7819 if ((ax < 2) && (ay < 2)) return (TRUE);
7822 /* Paranoia -- require "safe" origin */
7823 /* if (!in_bounds(y1, x1)) return (FALSE); */
7826 /* Directly South/North */
7829 /* South -- check for walls */
7832 for (ty = y1 + 1; ty < y2; ty++)
7834 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7838 /* North -- check for walls */
7841 for (ty = y1 - 1; ty > y2; ty--)
7843 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7851 /* Directly East/West */
7854 /* East -- check for walls */
7857 for (tx = x1 + 1; tx < x2; tx++)
7859 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7863 /* West -- check for walls */
7866 for (tx = x1 - 1; tx > x2; tx--)
7868 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7877 /* Extract some signs */
7878 sx = (dx < 0) ? -1 : 1;
7879 sy = (dy < 0) ? -1 : 1;
7882 /* Vertical "knights" */
7887 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7891 /* Horizontal "knights" */
7896 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7901 /* Calculate scale factor div 2 */
7904 /* Calculate scale factor */
7908 /* Travel horizontally */
7911 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7917 /* Consider the special case where slope == 1. */
7928 /* Note (below) the case (qy == f2), where */
7929 /* the LOS exactly meets the corner of a tile. */
7932 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7943 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7956 /* Travel vertically */
7959 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7975 /* Note (below) the case (qx == f2), where */
7976 /* the LOS exactly meets the corner of a tile. */
7979 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7990 if (cave_stop_disintegration(ty, tx)) return (FALSE);
8011 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)
8016 int brev = rad * rad / dist;
8020 int mdis = distance(y1, x1, y2, x2) + rad;
8022 while (bdis <= mdis)
8026 if ((0 < dist) && (path_n < dist))
8028 int ny = GRID_Y(path_g[path_n]);
8029 int nx = GRID_X(path_g[path_n]);
8030 int nd = distance(ny, nx, y1, x1);
8032 /* Get next base point */
8041 /* Travel from center outward */
8042 for (cdis = 0; cdis <= brad; cdis++)
8044 /* Scan the maximal blast area of radius "cdis" */
8045 for (y = by - cdis; y <= by + cdis; y++)
8047 for (x = bx - cdis; x <= bx + cdis; x++)
8049 /* Ignore "illegal" locations */
8050 if (!in_bounds(y, x)) continue;
8052 /* Enforce a circular "ripple" */
8053 if (distance(y1, x1, y, x) != bdis) continue;
8055 /* Enforce an arc */
8056 if (distance(by, bx, y, x) != cdis) continue;
8062 /* Lights are stopped by opaque terrains */
8063 if (!los(by, bx, y, x)) continue;
8065 case GF_DISINTEGRATE:
8066 /* Disintegration are stopped only by perma-walls */
8067 if (!in_disintegration_range(by, bx, y, x)) continue;
8070 /* Ball explosions are stopped by walls */
8071 if (!projectable(by, bx, y, x)) continue;
8075 /* Save this grid */
8083 /* Encode some more "radius" info */
8084 gm[bdis + 1] = *pgrids;
8086 /* Increase the size */
8087 brad = rad * (path_n + brev) / (dist + brev);
8089 /* Find the next ripple */
8093 /* Store the effect size */
8099 * Generic "beam"/"bolt"/"ball" projection routine.
8102 * who: Index of "source" monster (zero for "player")
8103 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8104 * y,x: Target location (or location to travel "towards")
8105 * dam: Base damage roll to apply to affected monsters (or player)
8106 * typ: Type of damage to apply to monsters (and objects)
8107 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8110 * TRUE if any "effects" of the projection were observed, else FALSE
8112 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8113 * towards a given location (optionally passing over the heads of interposing
8114 * monsters), and have it do a given amount of damage to the monsters (and
8115 * optionally objects) within the given radius of the final location.
8117 * A "bolt" travels from source to target and affects only the target grid.
8118 * A "beam" travels from source to target, affecting all grids passed through.
8119 * A "ball" travels from source to the target, exploding at the target, and
8120 * affecting everything within the given radius of the target location.
8122 * Traditionally, a "bolt" does not affect anything on the ground, and does
8123 * not pass over the heads of interposing monsters, much like a traditional
8124 * missile, and will "stop" abruptly at the "target" even if no monster is
8125 * positioned there, while a "ball", on the other hand, passes over the heads
8126 * of monsters between the source and target, and affects everything except
8127 * the source monster which lies within the final radius, while a "beam"
8128 * affects every monster between the source and target, except for the casting
8129 * monster (or player), and rarely affects things on the ground.
8131 * Two special flags allow us to use this function in special ways, the
8132 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8133 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8134 * actually projecting from the source monster (or player).
8136 * The player will only get "experience" for monsters killed by himself
8137 * Unique monsters can only be destroyed by attacks from the player
8139 * Only 256 grids can be affected per projection, limiting the effective
8140 * "radius" of standard ball attacks to nine units (diameter nineteen).
8142 * One can project in a given "direction" by combining PROJECT_THRU with small
8143 * offsets to the initial location (see "line_spell()"), or by calculating
8144 * "virtual targets" far away from the player.
8146 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8147 * continuing until it actually hits somethings (useful for "stone to mud").
8149 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8151 * Balls must explode BEFORE hitting walls, or they would affect monsters
8152 * on both sides of a wall. Some bug reports indicate that this is still
8153 * happening in 2.7.8 for Windows, though it appears to be impossible.
8155 * We "pre-calculate" the blast area only in part for efficiency.
8156 * More importantly, this lets us do "explosions" from the "inside" out.
8157 * This results in a more logical distribution of "blast" treasure.
8158 * It also produces a better (in my opinion) animation of the explosion.
8159 * It could be (but is not) used to have the treasure dropped by monsters
8160 * in the middle of the explosion fall "outwards", and then be damaged by
8161 * the blast as it spreads outwards towards the treasure drop location.
8163 * Walls and doors are included in the blast area, so that they can be
8164 * "burned" or "melted" in later versions.
8166 * This algorithm is intended to maximize simplicity, not necessarily
8167 * efficiency, since this function is not a bottleneck in the code.
8169 * We apply the blast effect from ground zero outwards, in several passes,
8170 * first affecting features, then objects, then monsters, then the player.
8171 * This allows walls to be removed before checking the object or monster
8172 * in the wall, and protects objects which are dropped by monsters killed
8173 * in the blast, and allows the player to see all affects before he is
8174 * killed or teleported away. The semantics of this method are open to
8175 * various interpretations, but they seem to work well in practice.
8177 * We process the blast area from ground-zero outwards to allow for better
8178 * distribution of treasure dropped by monsters, and because it provides a
8179 * pleasing visual effect at low cost.
8181 * Note that the damage done by "ball" explosions decreases with distance.
8182 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8184 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8185 * the target, and then the damage "flows" along this beam of destruction.
8186 * The damage at every grid is the same as at the "center" of a "ball"
8187 * explosion, since the "beam" grids are treated as if they ARE at the
8188 * center of a "ball" explosion.
8190 * Currently, specifying "beam" plus "ball" means that locations which are
8191 * covered by the initial "beam", and also covered by the final "ball", except
8192 * for the final grid (the epicenter of the ball), will be "hit twice", once
8193 * by the initial beam, and once by the exploding ball. For the grid right
8194 * next to the epicenter, this results in 150% damage being done. The center
8195 * does not have this problem, for the same reason the final grid in a "beam"
8196 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8197 * grids which are covered by the "ball" will NOT work, as then they will
8198 * receive LESS damage than they should. Do not combine "beam" with "ball".
8200 * The array "gy[],gx[]" with current size "grids" is used to hold the
8201 * collected locations of all grids in the "blast area" plus "beam path".
8203 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8204 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8205 * first blast grid (see above) with radius "N" from the blast center. Note
8206 * that only the first gm[1] grids in the blast area thus take full damage.
8207 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8208 * number of blast grids.
8210 * Note that once the projection is complete, (y2,x2) holds the final location
8211 * of bolts/beams, and the "epicenter" of balls.
8213 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8214 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8215 * implementation of the "distance" function. Also, a bolt can be properly
8216 * viewed as a "ball" with a "rad" of "zero".
8218 * Note that if no "target" is reached before the beam/bolt/ball travels the
8219 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8220 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8222 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8223 * to move from point A to point B, even if the player cannot see part of the
8224 * projection path. Note that in general, the player will *always* see part
8225 * of the path, since it either starts at the player or ends on the player.
8227 * Hack -- we assume that every "projection" is "self-illuminating".
8229 * Hack -- when only a single monster is affected, we automatically track
8230 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8232 * Note that all projections now "explode" at their final destination, even
8233 * if they were being projected at a more distant destination. This means
8234 * that "ball" spells will *always* explode.
8236 * Note that we must call "handle_stuff()" after affecting terrain features
8237 * in the blast radius, in case the "illumination" of the grid was changed,
8238 * and "update_view()" and "update_monsters()" need to be called.
8240 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8250 int y_saver, x_saver; /* For reflecting monsters */
8252 int msec = delay_factor * delay_factor * delay_factor;
8254 /* Assume the player sees nothing */
8255 bool notice = FALSE;
8257 /* Assume the player has seen nothing */
8258 bool visual = FALSE;
8260 /* Assume the player has seen no blast grids */
8263 /* Assume to be a normal ball spell */
8264 bool breath = FALSE;
8266 /* Is the player blind? */
8267 bool blind = (p_ptr->blind ? TRUE : FALSE);
8269 bool old_hide = FALSE;
8271 /* Number of grids in the "path" */
8274 /* Actual grids in the "path" */
8277 /* Number of grids in the "blast area" (including the "beam" path) */
8280 /* Coordinates of the affected grids */
8281 byte gx[1024], gy[1024];
8283 /* Encoded "radius" info (see above) */
8286 /* Actual radius encoded in gm[] */
8291 /* Attacker's name (prepared before polymorph)*/
8294 /* Can the player see the source of this effect? */
8295 bool see_s_msg = TRUE;
8297 /* Initialize by null string */
8303 /* Default target of monsterspell is player */
8304 monster_target_y=py;
8305 monster_target_x=px;
8307 /* Hack -- Jump to target */
8308 if (flg & (PROJECT_JUMP))
8313 /* Clear the flag */
8314 flg &= ~(PROJECT_JUMP);
8319 /* Start at player */
8326 /* Start at monster */
8329 x1 = m_list[who].fx;
8330 y1 = m_list[who].fy;
8331 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8344 /* Default "destination" */
8349 /* Hack -- verify stuff */
8350 if (flg & (PROJECT_THRU))
8352 if ((x1 == x2) && (y1 == y2))
8354 flg &= ~(PROJECT_THRU);
8358 /* Handle a breath attack */
8363 if (flg & PROJECT_HIDE) old_hide = TRUE;
8364 flg |= PROJECT_HIDE;
8368 /* Hack -- Assume there will be no blast (max radius 32) */
8369 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8377 /* Collect beam grids */
8378 if (flg & (PROJECT_BEAM))
8389 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8391 case GF_DISINTEGRATE:
8392 flg |= (PROJECT_GRID);
8393 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8397 /* Calculate the projection path */
8399 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8401 /* Hack -- Handle stuff */
8404 /* Giga-Hack SEEKER & SUPER_RAY */
8406 if( typ == GF_SEEKER )
8416 for (i = 0; i < path_n; ++i)
8421 int ny = GRID_Y(path_g[i]);
8422 int nx = GRID_X(path_g[i]);
8433 /* Only do visuals if requested */
8434 if (!blind && !(flg & (PROJECT_HIDE)))
8436 /* Only do visuals if the player can "see" the bolt */
8437 if (panel_contains(y, x) && player_has_los_bold(y, x))
8444 /* Obtain the bolt pict */
8445 p = bolt_pict(oy, ox, y, x, typ);
8447 /* Extract attr/char */
8451 /* Visual effects */
8452 print_rel(c, a, y, x);
8453 move_cursor_relative(y, x);
8454 /*if (fresh_before)*/ Term_fresh();
8455 Term_xtra(TERM_XTRA_DELAY, msec);
8457 /*if (fresh_before)*/ Term_fresh();
8459 /* Display "beam" grids */
8460 if (flg & (PROJECT_BEAM))
8462 /* Obtain the explosion pict */
8463 p = bolt_pict(y, x, y, x, typ);
8465 /* Extract attr/char */
8469 /* Visual effects */
8470 print_rel(c, a, y, x);
8473 /* Hack -- Activate delay */
8477 /* Hack -- delay anyway for consistency */
8480 /* Delay for consistency */
8481 Term_xtra(TERM_XTRA_DELAY, msec);
8484 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8485 if( is_mirror_grid(&cave[y][x]))
8487 /* The target of monsterspell becomes tha mirror(broken) */
8488 monster_target_y=(s16b)y;
8489 monster_target_x=(s16b)x;
8492 next_mirror( &oy,&ox,y,x );
8494 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8495 for( j = last_i; j <=i ; j++ )
8497 y = GRID_Y(path_g[j]);
8498 x = GRID_X(path_g[j]);
8499 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
8500 if(!who && (project_m_n==1) && !jump ){
8501 if(cave[project_m_y][project_m_x].m_idx >0 ){
8502 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8506 /* Hack -- auto-recall */
8507 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8509 /* Hack - auto-track */
8510 health_track(cave[project_m_y][project_m_x].m_idx);
8514 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8519 for( i = last_i ; i < path_n ; i++ )
8522 y = GRID_Y(path_g[i]);
8523 x = GRID_X(path_g[i]);
8524 if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
8526 if(!who && (project_m_n==1) && !jump ){
8527 if(cave[project_m_y][project_m_x].m_idx >0 ){
8528 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8532 /* Hack -- auto-recall */
8533 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8535 /* Hack - auto-track */
8536 health_track(cave[project_m_y][project_m_x].m_idx);
8540 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8544 else if(typ == GF_SUPER_RAY){
8546 int second_step = 0;
8553 for (i = 0; i < path_n; ++i)
8558 int ny = GRID_Y(path_g[i]);
8559 int nx = GRID_X(path_g[i]);
8570 /* Only do visuals if requested */
8571 if (!blind && !(flg & (PROJECT_HIDE)))
8573 /* Only do visuals if the player can "see" the bolt */
8574 if (panel_contains(y, x) && player_has_los_bold(y, x))
8581 /* Obtain the bolt pict */
8582 p = bolt_pict(oy, ox, y, x, typ);
8584 /* Extract attr/char */
8588 /* Visual effects */
8589 print_rel(c, a, y, x);
8590 move_cursor_relative(y, x);
8591 /*if (fresh_before)*/ Term_fresh();
8592 Term_xtra(TERM_XTRA_DELAY, msec);
8594 /*if (fresh_before)*/ Term_fresh();
8596 /* Display "beam" grids */
8597 if (flg & (PROJECT_BEAM))
8599 /* Obtain the explosion pict */
8600 p = bolt_pict(y, x, y, x, typ);
8602 /* Extract attr/char */
8606 /* Visual effects */
8607 print_rel(c, a, y, x);
8610 /* Hack -- Activate delay */
8614 /* Hack -- delay anyway for consistency */
8617 /* Delay for consistency */
8618 Term_xtra(TERM_XTRA_DELAY, msec);
8621 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8622 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8624 if( second_step )continue;
8627 if( is_mirror_grid(&cave[y][x]) && !second_step )
8629 /* The target of monsterspell becomes tha mirror(broken) */
8630 monster_target_y=(s16b)y;
8631 monster_target_x=(s16b)x;
8634 for( j = 0; j <=i ; j++ )
8636 y = GRID_Y(path_g[j]);
8637 x = GRID_X(path_g[j]);
8638 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8642 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8643 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8644 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8645 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8646 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8647 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8648 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8649 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8652 for( i = 0; i < path_n ; i++ )
8655 y = GRID_Y(path_g[i]);
8656 x = GRID_X(path_g[i]);
8657 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
8658 if(!who && (project_m_n==1) && !jump ){
8659 if(cave[project_m_y][project_m_x].m_idx >0 ){
8660 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8664 /* Hack -- auto-recall */
8665 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
8667 /* Hack - auto-track */
8668 health_track(cave[project_m_y][project_m_x].m_idx);
8672 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8677 /* Project along the path */
8678 for (i = 0; i < path_n; ++i)
8683 int ny = GRID_Y(path_g[i]);
8684 int nx = GRID_X(path_g[i]);
8686 if (flg & PROJECT_DISI)
8688 /* Hack -- Balls explode before reaching walls */
8689 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8691 else if (flg & PROJECT_LOS)
8693 /* Hack -- Balls explode before reaching walls */
8694 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8698 /* Hack -- Balls explode before reaching walls */
8699 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8706 /* Collect beam grids */
8707 if (flg & (PROJECT_BEAM))
8714 /* Only do visuals if requested */
8715 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8717 /* Only do visuals if the player can "see" the bolt */
8718 if (panel_contains(y, x) && player_has_los_bold(y, x))
8725 /* Obtain the bolt pict */
8726 p = bolt_pict(oy, ox, y, x, typ);
8728 /* Extract attr/char */
8732 /* Visual effects */
8733 print_rel(c, a, y, x);
8734 move_cursor_relative(y, x);
8735 /*if (fresh_before)*/ Term_fresh();
8736 Term_xtra(TERM_XTRA_DELAY, msec);
8738 /*if (fresh_before)*/ Term_fresh();
8740 /* Display "beam" grids */
8741 if (flg & (PROJECT_BEAM))
8743 /* Obtain the explosion pict */
8744 p = bolt_pict(y, x, y, x, typ);
8746 /* Extract attr/char */
8750 /* Visual effects */
8751 print_rel(c, a, y, x);
8754 /* Hack -- Activate delay */
8758 /* Hack -- delay anyway for consistency */
8761 /* Delay for consistency */
8762 Term_xtra(TERM_XTRA_DELAY, msec);
8769 /* Save the "blast epicenter" */
8773 if (breath && !path_n)
8779 flg &= ~(PROJECT_HIDE);
8783 /* Start the "explosion" */
8786 /* Hack -- make sure beams get to "explode" */
8794 /* If we found a "target", explode there */
8795 if (dist <= MAX_RANGE)
8797 /* Mega-Hack -- remove the final "beam" grid */
8798 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8801 * Create a conical breath attack
8812 flg &= ~(PROJECT_HIDE);
8814 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8818 /* Determine the blast area, work from the inside out */
8819 for (dist = 0; dist <= rad; dist++)
8821 /* Scan the maximal blast area of radius "dist" */
8822 for (y = by - dist; y <= by + dist; y++)
8824 for (x = bx - dist; x <= bx + dist; x++)
8826 /* Ignore "illegal" locations */
8827 if (!in_bounds2(y, x)) continue;
8829 /* Enforce a "circular" explosion */
8830 if (distance(by, bx, y, x) != dist) continue;
8836 /* Lights are stopped by opaque terrains */
8837 if (!los(by, bx, y, x)) continue;
8839 case GF_DISINTEGRATE:
8840 /* Disintegration are stopped only by perma-walls */
8841 if (!in_disintegration_range(by, bx, y, x)) continue;
8844 /* Ball explosions are stopped by walls */
8845 if (!projectable(by, bx, y, x)) continue;
8849 /* Save this grid */
8856 /* Encode some more "radius" info */
8862 /* Speed -- ignore "non-explosions" */
8863 if (!grids) return (FALSE);
8866 /* Display the "blast area" if requested */
8867 if (!blind && !(flg & (PROJECT_HIDE)))
8869 /* Then do the "blast", from inside out */
8870 for (t = 0; t <= gm_rad; t++)
8872 /* Dump everything with this radius */
8873 for (i = gm[t]; i < gm[t+1]; i++)
8875 /* Extract the location */
8879 /* Only do visuals if the player can "see" the blast */
8880 if (panel_contains(y, x) && player_has_los_bold(y, x))
8889 /* Obtain the explosion pict */
8890 p = bolt_pict(y, x, y, x, typ);
8892 /* Extract attr/char */
8896 /* Visual effects -- Display */
8897 print_rel(c, a, y, x);
8901 /* Hack -- center the cursor */
8902 move_cursor_relative(by, bx);
8904 /* Flush each "radius" seperately */
8905 /*if (fresh_before)*/ Term_fresh();
8907 /* Delay (efficiently) */
8908 if (visual || drawn)
8910 Term_xtra(TERM_XTRA_DELAY, msec);
8914 /* Flush the erasing */
8917 /* Erase the explosion drawn above */
8918 for (i = 0; i < grids; i++)
8920 /* Extract the location */
8924 /* Hack -- Erase if needed */
8925 if (panel_contains(y, x) && player_has_los_bold(y, x))
8931 /* Hack -- center the cursor */
8932 move_cursor_relative(by, bx);
8934 /* Flush the explosion */
8935 /*if (fresh_before)*/ Term_fresh();
8940 /* Update stuff if needed */
8941 if (p_ptr->update) update_stuff();
8944 if (flg & PROJECT_KILL)
8946 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
8947 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
8951 /* Check features */
8952 if (flg & (PROJECT_GRID))
8954 /* Start with "dist" of zero */
8957 /* Scan for features */
8958 for (i = 0; i < grids; i++)
8960 /* Hack -- Notice new "dist" values */
8961 if (gm[dist+1] == i) dist++;
8963 /* Get the grid location */
8967 /* Find the closest point in the blast */
8970 int d = dist_to_line(y, x, y1, x1, by, bx);
8972 /* Affect the grid */
8973 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8977 /* Affect the grid */
8978 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8983 /* Update stuff if needed */
8984 if (p_ptr->update) update_stuff();
8987 if (flg & (PROJECT_ITEM))
8989 /* Start with "dist" of zero */
8992 /* Scan for objects */
8993 for (i = 0; i < grids; i++)
8995 /* Hack -- Notice new "dist" values */
8996 if (gm[dist+1] == i) dist++;
8998 /* Get the grid location */
9002 /* Find the closest point in the blast */
9005 int d = dist_to_line(y, x, y1, x1, by, bx);
9007 /* Affect the object in the grid */
9008 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
9012 /* Affect the object in the grid */
9013 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
9019 /* Check monsters */
9020 if (flg & (PROJECT_KILL))
9027 /* Start with "dist" of zero */
9030 /* Scan for monsters */
9031 for (i = 0; i < grids; i++)
9035 /* Hack -- Notice new "dist" values */
9036 if (gm[dist + 1] == i) dist++;
9038 /* Get the grid location */
9042 /* A single bolt may be reflected */
9045 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9046 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9048 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
9049 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
9050 (!who || dist_hack > 1) && !one_in_(10))
9053 int max_attempts = 10;
9055 /* Choose 'new' target */
9058 t_y = y_saver - 1 + randint1(3);
9059 t_x = x_saver - 1 + randint1(3);
9062 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9064 if (max_attempts < 1)
9073 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9074 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9075 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9076 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9078 msg_print("The attack bounces!");
9081 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9083 /* Reflected bolts randomly target either one */
9084 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
9085 else flg |= PROJECT_PLAYER;
9087 /* The bolt is reflected */
9088 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9090 /* Don't affect the monster any longer */
9096 /* Find the closest point in the blast */
9099 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9103 effective_dist = dist;
9107 /* There is the riding player on this monster */
9108 if (p_ptr->riding && player_bold(y, x))
9110 /* Aimed on the player */
9111 if (flg & PROJECT_PLAYER)
9113 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9116 * A beam or bolt is well aimed
9118 * So don't affects the mount.
9125 * The spell is not well aimed,
9126 * So partly affect the mount too.
9133 * This grid is the original target.
9134 * Or aimed on your horse.
9136 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9138 /* Hit the mount with full damage */
9142 * Otherwise this grid is not the
9143 * original target, it means that line
9144 * of fire is obstructed by this
9148 * A beam or bolt will hit either
9149 * player or mount. Choose randomly.
9151 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9155 /* Hit the mount with full damage */
9159 /* Hit the player later */
9160 flg |= PROJECT_PLAYER;
9162 /* Don't affect the mount */
9168 * The spell is not well aimed, so
9169 * partly affect both player and
9178 /* Affect the monster in the grid */
9179 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
9183 /* Player affected one monster (without "jumping") */
9184 if (!who && (project_m_n == 1) && !jump)
9190 /* Track if possible */
9191 if (cave[y][x].m_idx > 0)
9193 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9197 /* Hack -- auto-recall */
9198 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
9200 /* Hack - auto-track */
9201 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9209 if (flg & (PROJECT_KILL))
9211 /* Start with "dist" of zero */
9214 /* Scan for player */
9215 for (i = 0; i < grids; i++)
9219 /* Hack -- Notice new "dist" values */
9220 if (gm[dist+1] == i) dist++;
9222 /* Get the grid location */
9226 /* Affect the player? */
9227 if (!player_bold(y, x)) continue;
9229 /* Find the closest point in the blast */
9232 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9236 effective_dist = dist;
9239 /* Target may be your horse */
9242 /* Aimed on the player */
9243 if (flg & PROJECT_PLAYER)
9245 /* Hit the player with full damage */
9249 * Hack -- When this grid was not the
9250 * original target, a beam or bolt
9251 * would hit either player or mount,
9252 * and should be choosen randomly.
9254 * But already choosen to hit the
9255 * mount at this point.
9257 * Or aimed on your horse.
9259 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9262 * A beam or bolt is well aimed
9264 * So don't affects the player.
9271 * The spell is not well aimed,
9272 * So partly affect the player too.
9278 /* Affect the player */
9279 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9287 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9289 if (rakubadam_m > 0)
9291 if (rakuba(rakubadam_m, FALSE))
9294 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9296 msg_format("%^s has thrown you off!", m_name);
9300 if (p_ptr->riding && rakubadam_p > 0)
9302 if(rakuba(rakubadam_p, FALSE))
9305 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9307 msg_format("You have fallen from %s.", m_name);
9313 /* Return "something was noticed" */
9317 bool binding_field( int dam )
9319 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9320 int mirror_num=0; /* ¶À¤Î¿ô */
9325 int msec= delay_factor*delay_factor*delay_factor;
9331 /* Default target of monsterspell is player */
9332 monster_target_y=py;
9333 monster_target_x=px;
9335 for( x=0 ; x < cur_wid ; x++ )
9337 for( y=0 ; y < cur_hgt ; y++ )
9339 if( is_mirror_grid(&cave[y][x]) &&
9340 distance(py,px,y,x) <= MAX_RANGE &&
9341 distance(py,px,y,x) != 0 &&
9342 player_has_los_bold(y,x) &&
9343 projectable(py, px, y, x)
9345 mirror_y[mirror_num]=y;
9346 mirror_x[mirror_num]=x;
9352 if( mirror_num < 2 )return FALSE;
9354 point_x[0] = randint0( mirror_num );
9356 point_x[1] = randint0( mirror_num );
9358 while( point_x[0] == point_x[1] );
9360 point_y[0]=mirror_y[point_x[0]];
9361 point_x[0]=mirror_x[point_x[0]];
9362 point_y[1]=mirror_y[point_x[1]];
9363 point_x[1]=mirror_x[point_x[1]];
9367 x=point_x[0]+point_x[1]+point_x[2];
9368 y=point_y[0]+point_y[1]+point_y[2];
9370 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9371 - (point_y[0]*3-y)*(point_x[1]*3-x);
9372 if( centersign == 0 )return FALSE;
9374 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9375 x1 = x1 < point_x[2] ? x1 : point_x[2];
9376 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9377 y1 = y1 < point_y[2] ? y1 : point_y[2];
9379 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9380 x2 = x2 > point_x[2] ? x2 : point_x[2];
9381 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9382 y2 = y2 > point_y[2] ? y2 : point_y[2];
9384 for( y=y1 ; y <=y2 ; y++ ){
9385 for( x=x1 ; x <=x2 ; x++ ){
9386 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9387 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9388 centersign*( (point_x[1]-x)*(point_y[2]-y)
9389 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9390 centersign*( (point_x[2]-x)*(point_y[0]-y)
9391 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9393 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9394 /* Visual effects */
9396 && panel_contains(y,x)){
9397 p = bolt_pict(y,x,y,x, GF_MANA );
9398 print_rel(PICT_C(p), PICT_A(p),y,x);
9399 move_cursor_relative(y, x);
9400 /*if (fresh_before)*/ Term_fresh();
9401 Term_xtra(TERM_XTRA_DELAY, msec);
9407 for( y=y1 ; y <=y2 ; y++ ){
9408 for( x=x1 ; x <=x2 ; x++ ){
9409 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9410 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9411 centersign*( (point_x[1]-x)*(point_y[2]-y)
9412 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9413 centersign*( (point_x[2]-x)*(point_y[0]-y)
9414 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9416 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9417 (void)project_f(0,0,y,x,dam,GF_MANA);
9422 for( y=y1 ; y <=y2 ; y++ ){
9423 for( x=x1 ; x <=x2 ; x++ ){
9424 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9425 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9426 centersign*( (point_x[1]-x)*(point_y[2]-y)
9427 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9428 centersign*( (point_x[2]-x)*(point_y[0]-y)
9429 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9431 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9432 (void)project_o(0,0,y,x,dam,GF_MANA);
9437 for( y=y1 ; y <=y2 ; y++ ){
9438 for( x=x1 ; x <=x2 ; x++ ){
9439 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9440 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9441 centersign*( (point_x[1]-x)*(point_y[2]-y)
9442 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9443 centersign*( (point_x[2]-x)*(point_y[0]-y)
9444 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9446 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9447 (void)project_m(0,0,y,x,dam,GF_MANA,
9448 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
9455 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9457 msg_print("The field broke a mirror");
9459 remove_mirror(point_y[0],point_x[0]);
9465 void seal_of_mirror( int dam )
9469 for( x = 0 ; x < cur_wid ; x++ )
9471 for( y = 0 ; y < cur_hgt ; y++ )
9473 if( is_mirror_grid(&cave[y][x]))
9475 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9476 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE))
9478 if( !cave[y][x].m_idx )