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_DEEP_GRASS : FEAT_GRASS));
677 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
679 /* Update some things */
680 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
684 /* Analyze the type */
687 /* Ignore most effects */
722 /* Destroy Traps (and Locks) */
725 /* Reveal secret doors */
726 if (is_hidden_door(c_ptr))
731 /* Check line of sight */
739 if (is_trap(c_ptr->feat))
741 /* Check line of sight */
745 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
747 msg_print("There is a bright flash of light!");
753 /* Destroy the trap */
754 cave_alter_feat(y, x, FF_DISARM);
757 /* Locked doors are unlocked */
758 if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
760 s16b old_feat = c_ptr->feat;
762 /* Unlock the door */
763 cave_alter_feat(y, x, FF_DISARM);
765 /* Check line of sound */
766 if (known && (old_feat != c_ptr->feat))
769 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
778 /* Remove "unsafe" flag if player is not blind */
779 if (!p_ptr->blind && player_has_los_bold(y, x))
781 c_ptr->info &= ~(CAVE_UNSAFE);
792 /* Destroy Doors (and traps) */
795 /* Destroy all doors and traps */
796 if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
798 /* Check line of sight */
803 msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
805 msg_print("There is a bright flash of light!");
811 /* Visibility change */
812 if (have_flag(f_ptr->flags, FF_DOOR))
814 /* Update some things */
815 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
818 /* Destroy the feature */
819 cave_alter_feat(y, x, FF_TUNNEL);
822 /* Remove "unsafe" flag if player is not blind */
823 if (!p_ptr->blind && player_has_los_bold(y, x))
825 c_ptr->info &= ~(CAVE_UNSAFE);
836 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
838 if (have_flag(f_ptr->flags, FF_SPIKE))
840 s16b old_mimic = c_ptr->mimic;
841 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
843 cave_alter_feat(y, x, FF_SPIKE);
845 c_ptr->mimic = old_mimic;
853 /* Check line of sight */
854 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
858 msg_format("%s¤Ë²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ³«¤«¤Ê¤¯¤Ê¤Ã¤¿¡£", f_name + mimic_f_ptr->name);
860 msg_format("The %s seems stuck.", f_name + mimic_f_ptr->name);
869 /* Destroy walls (and doors) */
872 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
875 if (known && (c_ptr->info & (CAVE_MARK)))
878 msg_format("%s¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
880 msg_format("The %s turns into mud!", f_name + f_info[get_feat_mimic(c_ptr)].name);
886 /* Destroy the wall */
887 cave_alter_feat(y, x, FF_HURT_ROCK);
889 /* Update some things */
890 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
899 /* Require a "naked" floor grid */
900 if (!cave_naked_bold(y, x)) break;
902 /* Not on the player */
903 if (player_bold(y, x)) break;
905 /* Create a closed door */
906 cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
909 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
911 /* Update some things */
912 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
929 /* Require a "naked" floor grid */
930 if (!cave_naked_bold(y, x)) break;
932 /* Not on the player */
933 if (player_bold(y, x)) break;
935 /* Create a closed door */
936 cave_set_feat(y, x, FEAT_TREES);
939 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
941 /* Update some things */
942 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
949 /* Require a "naked" floor grid */
950 if (!cave_naked_bold(y, x)) break;
953 c_ptr->info |= CAVE_OBJECT;
954 c_ptr->mimic = FEAT_GLYPH;
967 /* Require a "naked" floor grid */
968 if (!cave_naked_bold(y, x)) break;
970 /* Not on the player */
971 if (player_bold(y, x)) break;
974 cave_set_feat(y, x, FEAT_WALL);
976 /* Update some things */
977 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
985 /* Ignore permanent grid */
986 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
991 /* Ignore grid without enough space */
992 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
994 /* Place a shallow lava */
995 cave_set_feat(y, x, FEAT_SHAL_LAVA);
1000 /* Place a deep lava */
1001 cave_set_feat(y, x, FEAT_DEEP_LAVA);
1008 /* Ignore permanent grid */
1009 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
1014 /* Ignore grid without enough space */
1015 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
1017 /* Place a shallow water */
1018 cave_set_feat(y, x, FEAT_SHAL_WATER);
1023 /* Place a deep water */
1024 cave_set_feat(y, x, FEAT_DEEP_WATER);
1029 /* Lite up the grid */
1033 /* Turn on the light */
1034 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1036 c_ptr->info |= (CAVE_GLOW);
1044 update_local_illumination(y, x);
1047 if (player_can_see_bold(y, x)) obvious = TRUE;
1049 /* Mega-Hack -- Update the monster in the affected grid */
1050 /* This allows "spear of light" (etc) to work "correctly" */
1051 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1053 if (p_ptr->special_defense & NINJA_S_STEALTH)
1055 if (player_bold(y, x)) set_superstealth(FALSE);
1062 /* Darken the grid */
1066 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
1069 /* Turn off the light. */
1072 if (!p_ptr->inside_arena)
1074 for (j = 0; j < 9; j++)
1076 int by = y + ddy_ddd[j];
1077 int bx = x + ddx_ddd[j];
1079 if (in_bounds2(by, bx))
1081 cave_type *cc_ptr = &cave[by][bx];
1083 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1091 if (!do_dark) break;
1094 c_ptr->info &= ~(CAVE_GLOW);
1096 /* Hack -- Forget "boring" grids */
1097 if (!have_flag(f_ptr->flags, FF_REMEMBER))
1100 c_ptr->info &= ~(CAVE_MARK);
1109 update_local_illumination(y, x);
1112 if (player_can_see_bold(y, x)) obvious = TRUE;
1114 /* Mega-Hack -- Update the monster in the affected grid */
1115 /* This allows "spear of light" (etc) to work "correctly" */
1116 if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
1118 if ((p_ptr->pclass == CLASS_NINJA) && (p_ptr->cur_lite <= 0))
1120 if (player_bold(y, x)) set_superstealth(TRUE);
1131 if (is_mirror_grid(c_ptr))
1134 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1136 msg_print("The mirror was crashed!");
1138 remove_mirror(y, x);
1139 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1145 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1148 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1150 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);
1158 case GF_DISINTEGRATE:
1160 /* Destroy mirror */
1161 if (is_mirror_grid(c_ptr)) remove_mirror(y, x);
1163 /* Permanent features don't get effect */
1164 /* But not protect monsters and other objects */
1165 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1167 cave_alter_feat(y, x, FF_HURT_DISI);
1169 /* Update some things -- similar to GF_KILL_WALL */
1170 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
1177 /* Return "Anything seen?" */
1184 * We are called from "project()" to "damage" objects
1186 * We are called both for "beam" effects and "ball" effects.
1188 * Perhaps we should only SOMETIMES damage things on the ground.
1190 * The "r" parameter is the "distance from ground zero".
1192 * Note that we determine if the player can "see" anything that happens
1193 * by taking into account: blindness, line-of-sight, and illumination.
1195 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1197 * We return "TRUE" if the effect of the projection is "obvious".
1199 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1201 cave_type *c_ptr = &cave[y][x];
1203 s16b this_o_idx, next_o_idx = 0;
1205 bool obvious = FALSE;
1206 bool known = player_has_los_bold(y, x);
1208 u32b flgs[TR_FLAG_SIZE];
1210 char o_name[MAX_NLEN];
1213 bool is_potion = FALSE;
1217 who = who ? who : 0;
1219 /* Reduce damage by distance */
1220 dam = (dam + r) / (r + 1);
1223 /* Scan all objects in the grid */
1224 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1226 /* Acquire object */
1227 object_type *o_ptr = &o_list[this_o_idx];
1229 bool is_art = FALSE;
1230 bool ignore = FALSE;
1231 bool do_kill = FALSE;
1233 cptr note_kill = NULL;
1236 /* Get the "plural"-ness */
1237 bool plural = (o_ptr->number > 1);
1240 /* Acquire next object */
1241 next_o_idx = o_ptr->next_o_idx;
1243 /* Extract the flags */
1244 object_flags(o_ptr, flgs);
1246 /* Check for artifact */
1247 if (object_is_artifact(o_ptr)) is_art = TRUE;
1249 /* Analyze the type */
1252 /* Acid -- Lots of things */
1255 if (hates_acid(o_ptr))
1259 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1261 note_kill = (plural ? " melt!" : " melts!");
1264 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1269 /* Elec -- Rings and Wands */
1272 if (hates_elec(o_ptr))
1276 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1278 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1281 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1286 /* Fire -- Flammable objects */
1289 if (hates_fire(o_ptr))
1293 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1295 note_kill = (plural ? " burn up!" : " burns up!");
1298 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1303 /* Cold -- potions and flasks */
1306 if (hates_cold(o_ptr))
1309 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1311 note_kill = (plural ? " shatter!" : " shatters!");
1315 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1323 if (hates_fire(o_ptr))
1327 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1329 note_kill = (plural ? " burn up!" : " burns up!");
1332 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1334 if (hates_elec(o_ptr))
1339 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1341 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1344 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1352 if (hates_fire(o_ptr))
1356 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1358 note_kill = (plural ? " burn up!" : " burns up!");
1361 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1363 if (hates_cold(o_ptr))
1368 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1370 note_kill = (plural ? " shatter!" : " shatters!");
1373 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1378 /* Hack -- break potions and such */
1384 if (hates_cold(o_ptr))
1387 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1389 note_kill = (plural ? " shatter!" : " shatters!");
1397 /* Mana and Chaos -- destroy everything */
1404 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1406 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1412 case GF_DISINTEGRATE:
1416 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1418 note_kill = (plural ? " evaporate!" : " evaporates!");
1428 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1430 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1433 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1434 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1438 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1442 if (object_is_cursed(o_ptr))
1446 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1448 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1457 identify_item(o_ptr);
1459 /* Auto-inscription */
1460 autopick_alter_item((-this_o_idx), FALSE);
1468 /* Chests are noticed only if trapped or locked */
1469 if (o_ptr->tval == TV_CHEST)
1471 /* Disarm/Unlock traps */
1472 if (o_ptr->pval > 0)
1474 /* Disarm or Unlock */
1475 o_ptr->pval = (0 - o_ptr->pval);
1478 object_known(o_ptr);
1481 if (known && o_ptr->marked)
1484 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1486 msg_print("Click!");
1498 if (o_ptr->tval == TV_CORPSE)
1503 if (!who || is_pet(&m_list[who]))
1504 mode |= PM_FORCE_PET;
1506 for (i = 0; i < o_ptr->number ; i++)
1508 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1509 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1514 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1516 note_kill = (plural ? " become dust." : " becomes dust.");
1521 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1524 note_kill = "À¸¤Ê֤ä¿¡£";
1526 note_kill = "rivived.";
1529 else if (!note_kill)
1532 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1534 note_kill = (plural ? " become dust." : " becomes dust.");
1546 /* Attempt to destroy the object */
1549 /* Effect "observed" */
1550 if (known && o_ptr->marked)
1553 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1556 /* Artifacts, and other objects, get to resist */
1557 if (is_art || ignore)
1559 /* Observe the resist */
1560 if (known && o_ptr->marked)
1563 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1566 msg_format("The %s %s unaffected!",
1567 o_name, (plural ? "are" : "is"));
1576 /* Describe if needed */
1577 if (known && o_ptr->marked && note_kill)
1580 msg_format("%s¤Ï%s", o_name, note_kill);
1582 msg_format("The %s%s", o_name, note_kill);
1587 k_idx = o_ptr->k_idx;
1588 is_potion = object_is_potion(o_ptr);
1591 /* Delete the object */
1592 delete_object_idx(this_o_idx);
1594 /* Potions produce effects when 'shattered' */
1597 (void)potion_smash_effect(who, y, x, k_idx);
1606 /* Return "Anything seen?" */
1612 * Helper function for "project()" below.
1614 * Handle a beam/bolt/ball causing damage to a monster.
1616 * This routine takes a "source monster" (by index) which is mostly used to
1617 * determine if the player is causing the damage, and a "radius" (see below),
1618 * which is used to decrease the power of explosions with distance, and a
1619 * location, via integers which are modified by certain types of attacks
1620 * (polymorph and teleport being the obvious ones), a default damage, which
1621 * is modified as needed based on various properties, and finally a "damage
1622 * type" (see below).
1624 * Note that this routine can handle "no damage" attacks (like teleport) by
1625 * taking a "zero" damage, and can even take "parameters" to attacks (like
1626 * confuse) by accepting a "damage", using it to calculate the effect, and
1627 * then setting the damage to zero. Note that the "damage" parameter is
1628 * divided by the radius, so monsters not at the "epicenter" will not take
1629 * as much damage (or whatever)...
1631 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1632 * may result in a dereference of an invalid pointer. XXX XXX XXX
1634 * Various messages are produced, and damage is applied.
1636 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1637 * actually be "made" of that substance, or "breathe" big balls of it.
1639 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1642 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1643 * and hurts evil less. If can breath nether, then it resists it as well.
1645 * Damage reductions use the following formulas:
1646 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1647 * gives avg damage of .655, ranging from .858 to .500
1648 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1649 * gives avg damage of .544, ranging from .714 to .417
1650 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1651 * gives avg damage of .444, ranging from .556 to .333
1652 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1653 * gives avg damage of .327, ranging from .427 to .250
1654 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1655 * gives something simple.
1657 * In this function, "result" messages are postponed until the end, where
1658 * the "note" string is appended to the monster name, if not NULL. So,
1659 * to make a spell have "no effect" just set "note" to NULL. You should
1660 * also set "notice" to FALSE, or the player will learn what the spell does.
1662 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1664 /* "flg" was added. */
1665 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1669 cave_type *c_ptr = &cave[y][x];
1671 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1672 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1674 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1678 /* Is the monster "seen"? */
1679 bool seen = m_ptr->ml;
1680 bool seen_msg = is_seen(m_ptr);
1682 bool slept = (bool)(m_ptr->csleep > 0);
1684 /* Were the effects "obvious" (if seen)? */
1685 bool obvious = FALSE;
1687 /* Can the player know about this effect? */
1688 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1690 /* Can the player see the source of this effect? */
1691 bool see_s_msg = ((who <= 0) || is_seen(caster_ptr));
1693 /* Were the effects "irrelevant"? */
1694 bool skipped = FALSE;
1696 /* Gets the monster angry at the source of the effect? */
1697 bool get_angry = FALSE;
1699 /* Polymorph setting (true or false) */
1700 bool do_poly = FALSE;
1702 /* Teleport setting (max distance) */
1705 /* Confusion setting (amount to confuse) */
1708 /* Stunning setting (amount to stun) */
1711 /* Sleep amount (amount to sleep) */
1714 /* Fear amount (amount to fear) */
1717 /* Time amount (amount to time) */
1720 bool heal_leper = FALSE;
1722 /* Hold the monster name */
1731 /* Assume no note */
1734 /* Assume a default death */
1735 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1740 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1743 if (!c_ptr->m_idx) return (FALSE);
1745 /* Never affect projector */
1746 if (who && (c_ptr->m_idx == who)) return (FALSE);
1747 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1748 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1750 /* Don't affect already death monsters */
1751 /* Prevents problems with chain reactions of exploding monsters */
1752 if (m_ptr->hp < 0) return (FALSE);
1754 /* Reduce damage by distance */
1755 dam = (dam + r) / (r + 1);
1758 /* Get the monster name (BEFORE polymorphing) */
1759 monster_desc(m_name, m_ptr, 0);
1762 /* Get the monster possessive ("his"/"her"/"its") */
1763 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1767 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1769 /* Analyze the damage type */
1772 /* Magic Missile -- pure damage */
1775 if (seen) obvious = TRUE;
1777 if (r_ptr->flagsr & RFR_RES_ALL)
1780 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1782 note = " is immune.";
1785 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1794 if (seen) obvious = TRUE;
1796 if (r_ptr->flagsr & RFR_RES_ALL)
1799 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1801 note = " is immune.";
1804 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1807 if (r_ptr->flagsr & RFR_IM_ACID)
1810 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1812 note = " resists a lot.";
1816 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1824 if (seen) obvious = TRUE;
1826 if (r_ptr->flagsr & RFR_RES_ALL)
1829 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1831 note = " is immune.";
1834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1837 if (r_ptr->flagsr & RFR_IM_ELEC)
1840 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1842 note = " resists a lot.";
1846 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1854 if (seen) obvious = TRUE;
1856 if (r_ptr->flagsr & RFR_RES_ALL)
1859 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1861 note = " is immune.";
1864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1867 if (r_ptr->flagsr & RFR_IM_FIRE)
1870 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1872 note = " resists a lot.";
1876 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1878 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1881 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1883 note = " is hit hard.";
1887 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1895 if (seen) obvious = TRUE;
1897 if (r_ptr->flagsr & RFR_RES_ALL)
1900 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1902 note = " is immune.";
1905 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1908 if (r_ptr->flagsr & RFR_IM_COLD)
1911 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1913 note = " resists a lot.";
1917 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1919 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1922 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1924 note = " is hit hard.";
1928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1936 if (seen) obvious = TRUE;
1938 if (r_ptr->flagsr & RFR_RES_ALL)
1941 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1943 note = " is immune.";
1946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1949 if (r_ptr->flagsr & RFR_IM_POIS)
1952 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1954 note = " resists a lot.";
1958 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1966 if (seen) obvious = TRUE;
1968 if (r_ptr->flagsr & RFR_RES_ALL)
1971 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1973 note = " is immune.";
1976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1979 if (r_ptr->flagsr & RFR_IM_POIS)
1982 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
1987 dam *= 3; dam /= randint1(6) + 6;
1988 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1990 else if (one_in_(3)) do_poly = TRUE;
1994 /* Hellfire -- hurts Evil */
1997 if (seen) obvious = TRUE;
1999 if (r_ptr->flagsr & RFR_RES_ALL)
2002 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2004 note = " is immune.";
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2010 if (r_ptr->flags3 & RF3_GOOD)
2014 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2016 note = " is hit hard.";
2019 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2024 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2027 if (seen) obvious = TRUE;
2029 if (r_ptr->flagsr & RFR_RES_ALL)
2032 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2034 note = " is immune.";
2037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2040 if (r_ptr->flags3 & RF3_GOOD)
2044 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2046 note = " is immune.";
2049 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2051 else if (r_ptr->flags3 & RF3_EVIL)
2055 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2057 note = " is hit hard.";
2060 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2065 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2070 dam *= 3; dam /= randint1(6) + 6;
2075 /* Arrow -- XXX no defense */
2078 if (seen) obvious = TRUE;
2080 if (r_ptr->flagsr & RFR_RES_ALL)
2083 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2085 note = " is immune.";
2088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2094 /* Plasma -- XXX perhaps check ELEC or FIRE */
2097 if (seen) obvious = TRUE;
2099 if (r_ptr->flagsr & RFR_RES_ALL)
2102 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2104 note = " is immune.";
2107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2110 if (r_ptr->flagsr & RFR_RES_PLAS)
2113 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2118 dam *= 3; dam /= randint1(6) + 6;
2119 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2124 /* Nether -- see above */
2127 if (seen) obvious = TRUE;
2129 if (r_ptr->flagsr & RFR_RES_ALL)
2132 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2134 note = " is immune.";
2137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2140 if (r_ptr->flagsr & RFR_RES_NETH)
2142 if (r_ptr->flags3 & RF3_UNDEAD)
2145 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2147 note = " is immune.";
2151 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2156 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2161 dam *= 3; dam /= randint1(6) + 6;
2163 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2165 else if (r_ptr->flags3 & RF3_EVIL)
2169 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2171 note = " resists somewhat.";
2174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2179 /* Water (acid) damage -- Water spirits/elementals are immune */
2182 if (seen) obvious = TRUE;
2184 if (r_ptr->flagsr & RFR_RES_ALL)
2187 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2189 note = " is immune.";
2192 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2195 if (r_ptr->flagsr & RFR_RES_WATE)
2197 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2200 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2202 note = " is immune.";
2210 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2215 dam *= 3; dam /= randint1(6) + 6;
2217 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2222 /* Chaos -- Chaos breathers resist */
2225 if (seen) obvious = TRUE;
2227 if (r_ptr->flagsr & RFR_RES_ALL)
2230 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2232 note = " is immune.";
2235 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2238 if (r_ptr->flagsr & RFR_RES_CHAO)
2241 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2246 dam *= 3; dam /= randint1(6) + 6;
2247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2249 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2252 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2254 note = " resists somewhat.";
2257 dam *= 3; dam /= randint1(6) + 6;
2258 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2263 do_conf = (5 + randint1(11) + r) / (r + 1);
2268 /* Shards -- Shard breathers resist */
2271 if (seen) obvious = TRUE;
2273 if (r_ptr->flagsr & RFR_RES_ALL)
2276 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2278 note = " is immune.";
2281 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2284 if (r_ptr->flagsr & RFR_RES_SHAR)
2287 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2292 dam *= 3; dam /= randint1(6) + 6;
2293 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2298 /* Rocket: Shard resistance helps */
2301 if (seen) obvious = TRUE;
2303 if (r_ptr->flagsr & RFR_RES_ALL)
2306 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2308 note = " is immune.";
2311 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2314 if (r_ptr->flagsr & RFR_RES_SHAR)
2317 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2319 note = " resists somewhat.";
2323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2329 /* Sound -- Sound breathers resist */
2332 if (seen) obvious = TRUE;
2334 if (r_ptr->flagsr & RFR_RES_ALL)
2337 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2339 note = " is immune.";
2342 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2345 if (r_ptr->flagsr & RFR_RES_SOUN)
2348 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2353 dam *= 2; dam /= randint1(6) + 6;
2354 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2356 else do_stun = (10 + randint1(15) + r) / (r + 1);
2363 if (seen) obvious = TRUE;
2365 if (r_ptr->flagsr & RFR_RES_ALL)
2368 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2370 note = " is immune.";
2373 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2376 if (r_ptr->flags3 & RF3_NO_CONF)
2379 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2384 dam *= 3; dam /= randint1(6) + 6;
2385 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2387 else do_conf = (10 + randint1(15) + r) / (r + 1);
2391 /* Disenchantment -- Breathers and Disenchanters resist */
2394 if (seen) obvious = TRUE;
2396 if (r_ptr->flagsr & RFR_RES_ALL)
2399 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2401 note = " is immune.";
2404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2407 if (r_ptr->flagsr & RFR_RES_DISE)
2410 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2415 dam *= 3; dam /= randint1(6) + 6;
2416 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2421 /* Nexus -- Breathers and Existers resist */
2424 if (seen) obvious = TRUE;
2426 if (r_ptr->flagsr & RFR_RES_ALL)
2429 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2431 note = " is immune.";
2434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2437 if (r_ptr->flagsr & RFR_RES_NEXU)
2440 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2445 dam *= 3; dam /= randint1(6) + 6;
2446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2454 if (seen) obvious = TRUE;
2456 if (r_ptr->flagsr & RFR_RES_ALL)
2459 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2461 note = " is immune.";
2464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2467 if (r_ptr->flagsr & RFR_RES_WALL)
2470 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2475 dam *= 3; dam /= randint1(6) + 6;
2476 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2478 else do_stun = (randint1(15) + r) / (r + 1);
2482 /* Inertia -- breathers resist */
2485 if (seen) obvious = TRUE;
2487 if (r_ptr->flagsr & RFR_RES_ALL)
2490 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2492 note = " is immune.";
2495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2498 if (r_ptr->flagsr & RFR_RES_INER)
2501 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2506 dam *= 3; dam /= randint1(6) + 6;
2507 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2511 /* Powerful monsters can resist */
2512 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2513 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2517 /* Normal monsters slow down */
2523 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2525 note = " starts moving slower.";
2528 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2529 if (c_ptr->m_idx == p_ptr->riding)
2530 p_ptr->update |= (PU_BONUS);
2536 /* Time -- breathers resist */
2539 if (seen) obvious = TRUE;
2541 if (r_ptr->flagsr & RFR_RES_ALL)
2544 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2546 note = " is immune.";
2549 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2552 if (r_ptr->flagsr & RFR_RES_TIME)
2555 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2560 dam *= 3; dam /= randint1(6) + 6;
2561 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2563 else do_time = (dam + 1) / 2;
2567 /* Gravity -- breathers resist */
2570 bool resist_tele = FALSE;
2572 if (seen) obvious = TRUE;
2574 if (r_ptr->flagsr & RFR_RES_ALL)
2577 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2579 note = " is immune.";
2582 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2585 if (r_ptr->flagsr & RFR_RES_TELE)
2587 if (r_ptr->flags1 & (RF1_UNIQUE))
2589 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2591 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2593 note = " is unaffected!";
2598 else if (r_ptr->level > randint1(100))
2600 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2602 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2611 if (!resist_tele) do_dist = 10;
2613 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2615 if (r_ptr->flagsr & RFR_RES_GRAV)
2618 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2623 dam *= 3; dam /= randint1(6) + 6;
2625 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2630 /* Powerful monsters can resist */
2631 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2632 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2636 /* Normal monsters slow down */
2642 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2644 note = " starts moving slower.";
2647 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2648 if (c_ptr->m_idx == p_ptr->riding)
2649 p_ptr->update |= (PU_BONUS);
2653 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2655 /* Attempt a saving throw */
2656 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2657 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2661 /* No obvious effect */
2663 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2665 note = " is unaffected!";
2679 if (seen) obvious = TRUE;
2681 if (r_ptr->flagsr & RFR_RES_ALL)
2684 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2686 note = " is immune.";
2689 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2697 case GF_DISINTEGRATE:
2699 if (seen) obvious = TRUE;
2701 if (r_ptr->flagsr & RFR_RES_ALL)
2704 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2706 note = " is immune.";
2709 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2712 if (r_ptr->flags3 & RF3_HURT_ROCK)
2714 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2716 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2717 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2719 note = " loses some skin!";
2720 note_dies = " evaporates!";
2730 if (seen) obvious = TRUE;
2732 /* PSI only works if the monster can see you! -- RG */
2733 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2736 if (seen_msg) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2738 if (seen_msg) msg_format("%^s can't see you, and isn't affected!", m_name);
2744 if (r_ptr->flagsr & RFR_RES_ALL)
2747 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2749 note = " is immune.";
2752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2755 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2759 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2761 note = " is immune!";
2763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2766 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2767 (r_ptr->flags3 & RF3_ANIMAL) ||
2768 (r_ptr->level > randint1(3 * dam)))
2772 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2779 * Powerful demons & undead can turn a mindcrafter's
2780 * attacks back on them
2782 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2783 (r_ptr->level > p_ptr->lev / 2) &&
2788 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2790 msg_format("%^s%s corrupted mind backlashes your attack!",
2791 m_name, (seen ? "'s" : "s"));
2795 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2798 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2800 msg_print("You resist the effects!");
2806 /* Injure +/- confusion */
2807 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2808 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2811 switch (randint1(4))
2814 set_confused(p_ptr->confused + 3 + randint1(dam));
2817 set_stun(p_ptr->stun + randint1(dam));
2821 if (r_ptr->flags3 & RF3_NO_FEAR)
2823 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2825 note = " is unaffected.";
2829 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2833 if (!p_ptr->free_act)
2834 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2843 if ((dam > 0) && one_in_(4))
2845 switch (randint1(4))
2848 do_conf = 3 + randint1(dam);
2851 do_stun = 3 + randint1(dam);
2854 do_fear = 3 + randint1(dam);
2858 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2860 note = " falls asleep!";
2863 do_sleep = 3 + randint1(dam);
2869 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2871 note_dies = " collapses, a mindless husk.";
2879 if (seen) obvious = TRUE;
2881 if (r_ptr->flagsr & RFR_RES_ALL)
2884 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2886 note = " is immune.";
2889 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2892 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2896 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2898 note = " is immune!";
2902 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2903 (r_ptr->flags3 & RF3_ANIMAL) ||
2904 (r_ptr->level > randint1(3 * dam)))
2908 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2915 * Powerful demons & undead can turn a mindcrafter's
2916 * attacks back on them
2918 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2919 (r_ptr->level > p_ptr->lev / 2) &&
2924 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2926 msg_format("%^s%s corrupted mind backlashes your attack!",
2927 m_name, (seen ? "'s" : "s"));
2931 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2934 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2936 msg_print("You resist the effects!");
2942 /* Injure + mana drain */
2943 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2945 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2947 msg_print("Your psychic energy is drained!");
2950 p_ptr->csp -= damroll(5, dam) / 2;
2951 if (p_ptr->csp < 0) p_ptr->csp = 0;
2952 p_ptr->redraw |= PR_MANA;
2953 p_ptr->window |= (PW_SPELL);
2954 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2961 int b = damroll(5, dam) / 4;
2963 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
2965 msg_format("You convert %s%s pain into psychic energy!",
2966 m_name, (seen ? "'s" : "s"));
2969 b = MIN(p_ptr->msp, p_ptr->csp + b);
2971 p_ptr->redraw |= PR_MANA;
2972 p_ptr->window |= (PW_SPELL);
2976 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2978 note_dies = " collapses, a mindless husk.";
2984 case GF_TELEKINESIS:
2986 if (seen) obvious = TRUE;
2988 if (r_ptr->flagsr & RFR_RES_ALL)
2991 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2993 note = " is immune.";
2996 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3001 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3006 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3008 /* Attempt a saving throw */
3009 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3010 (r_ptr->level > 5 + randint1(dam)))
3014 /* No obvious effect */
3020 /* Psycho-spear -- powerful magic missile */
3023 if (seen) obvious = TRUE;
3025 if (r_ptr->flagsr & RFR_RES_ALL)
3028 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3030 note = " is immune.";
3033 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3039 /* Meteor -- powerful magic missile */
3042 if (seen) obvious = TRUE;
3044 if (r_ptr->flagsr & RFR_RES_ALL)
3047 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3049 note = " is immune.";
3052 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3060 if (!is_hostile(m_ptr)) break;
3062 if (seen) obvious = TRUE;
3064 if (r_ptr->flagsr & RFR_RES_ALL)
3067 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3069 note = " is immune.";
3072 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3075 /* Attempt a saving throw */
3076 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3077 (r_ptr->flags3 & RF3_NO_CONF) ||
3078 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3080 /* Memorize a flag */
3081 if (r_ptr->flags3 & RF3_NO_CONF)
3083 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3090 * Powerful demons & undead can turn a mindcrafter's
3091 * attacks back on them
3093 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3094 (r_ptr->level > p_ptr->lev / 2) &&
3099 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3101 msg_format("%^s%s corrupted mind backlashes your attack!",
3102 m_name, (seen ? "'s" : "s"));
3106 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3109 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3111 msg_print("You resist the effects!");
3117 /* Confuse, stun, terrify */
3118 switch (randint1(4))
3121 set_stun(p_ptr->stun + dam / 2);
3124 set_confused(p_ptr->confused + dam / 2);
3128 if (r_ptr->flags3 & RF3_NO_FEAR)
3130 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3132 note = " is unaffected.";
3136 set_afraid(p_ptr->afraid + dam);
3143 /* No obvious effect */
3145 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3147 note = " is unaffected!";
3155 if ((dam > 29) && (randint1(100) < dam))
3158 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3160 note = " is in your thrall!";
3167 switch (randint1(4))
3181 /* No "real" damage */
3188 /* Ice -- Cold + Cuts + Stun */
3191 if (seen) obvious = TRUE;
3193 if (r_ptr->flagsr & RFR_RES_ALL)
3196 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3198 note = " is immune.";
3201 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3204 do_stun = (randint1(15) + 1) / (r + 1);
3205 if (r_ptr->flagsr & RFR_IM_COLD)
3208 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3210 note = " resists a lot.";
3214 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3216 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3219 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3221 note = " is hit hard.";
3225 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3234 if (seen) obvious = TRUE;
3236 if (r_ptr->flagsr & RFR_RES_ALL)
3239 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3241 note = " is immune.";
3244 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3247 if (!monster_living(r_ptr))
3249 if (is_original_ap_and_seen(m_ptr))
3251 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3252 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3253 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3257 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3259 note = " is unaffected!";
3265 else do_time = (dam+7)/8;
3273 if (seen) obvious = TRUE;
3275 if (r_ptr->flagsr & RFR_RES_ALL)
3278 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3280 note = " is immune.";
3283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3286 if (!monster_living(r_ptr))
3288 if (is_original_ap_and_seen(m_ptr))
3290 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3291 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3292 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3296 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3298 note = " is immune.";
3304 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3305 (randint1(888) != 666)) ||
3306 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3307 randint1(100) != 66))
3310 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3322 /* Polymorph monster (Use "dam" as "power") */
3325 if (seen) obvious = TRUE;
3327 if (r_ptr->flagsr & RFR_RES_ALL)
3330 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3332 note = " is immune.";
3335 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3338 /* Attempt to polymorph (see below) */
3341 /* Powerful monsters can resist */
3342 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3343 (r_ptr->flags1 & RF1_QUESTOR) ||
3344 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3347 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3349 note = " is unaffected!";
3356 /* No "real" damage */
3363 /* Clone monsters (Ignore "dam") */
3366 if (seen) obvious = TRUE;
3368 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3371 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3373 note = " is unaffected!";
3379 m_ptr->hp = m_ptr->maxhp;
3381 /* Attempt to clone. */
3382 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3385 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3393 /* No "real" damage */
3400 /* Heal Monster (use "dam" as amount of healing) */
3403 if (seen) obvious = TRUE;
3408 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3410 if (m_ptr->maxhp < m_ptr->max_maxhp)
3413 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3415 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3417 m_ptr->maxhp = m_ptr->max_maxhp;
3423 if (seen) obvious = TRUE;
3428 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3433 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3435 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3439 if (m_ptr->confused)
3442 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3444 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3446 m_ptr->confused = 0;
3451 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3453 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3459 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3462 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3466 chg_virtue(V_VITALITY, 1);
3468 if (r_ptr->flags1 & RF1_UNIQUE)
3469 chg_virtue(V_INDIVIDUALISM, 1);
3471 if (is_friendly(m_ptr))
3472 chg_virtue(V_HONOUR, 1);
3473 else if (!(r_ptr->flags3 & RF3_EVIL))
3475 if (r_ptr->flags3 & RF3_GOOD)
3476 chg_virtue(V_COMPASSION, 2);
3478 chg_virtue(V_COMPASSION, 1);
3481 if (r_ptr->flags3 & RF3_ANIMAL)
3482 chg_virtue(V_NATURE, 1);
3485 if (m_ptr->r_idx == MON_LEPER)
3488 if (!who) chg_virtue(V_COMPASSION, 5);
3491 /* Redraw (later) if needed */
3492 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3493 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3497 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3499 note = " looks healthier.";
3503 /* No "real" damage */
3509 /* Speed Monster (Ignore "dam") */
3512 if (seen) obvious = TRUE;
3518 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3520 note = " starts moving faster.";
3523 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3525 if (c_ptr->m_idx == p_ptr->riding)
3526 p_ptr->update |= (PU_BONUS);
3530 if (r_ptr->flags1 & RF1_UNIQUE)
3531 chg_virtue(V_INDIVIDUALISM, 1);
3532 if (is_friendly(m_ptr))
3533 chg_virtue(V_HONOUR, 1);
3536 /* No "real" damage */
3542 /* Slow Monster (Use "dam" as "power") */
3545 if (seen) obvious = TRUE;
3547 if (r_ptr->flagsr & RFR_RES_ALL)
3550 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3552 note = " is immune.";
3555 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3558 /* Powerful monsters can resist */
3559 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3560 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3563 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3565 note = " is unaffected!";
3571 /* Normal monsters slow down */
3577 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3579 note = " starts moving slower.";
3582 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3584 if (c_ptr->m_idx == p_ptr->riding)
3585 p_ptr->update |= (PU_BONUS);
3588 /* No "real" damage */
3594 /* Sleep (Use "dam" as "power") */
3597 if (seen) obvious = TRUE;
3599 if (r_ptr->flagsr & RFR_RES_ALL)
3602 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3604 note = " is immune.";
3607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3610 /* Attempt a saving throw */
3611 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3612 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3613 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3615 /* Memorize a flag */
3616 if (r_ptr->flags3 & RF3_NO_SLEEP)
3618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3621 /* No obvious effect */
3623 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3625 note = " is unaffected!";
3632 /* Go to sleep (much) later */
3634 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3636 note = " falls asleep!";
3642 /* No "real" damage */
3648 /* Sleep (Use "dam" as "power") */
3649 case GF_STASIS_EVIL:
3651 if (seen) obvious = TRUE;
3653 if (r_ptr->flagsr & RFR_RES_ALL)
3656 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3658 note = " is immune.";
3661 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3664 /* Attempt a saving throw */
3665 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3666 !(r_ptr->flags3 & RF3_EVIL) ||
3667 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3670 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3672 note = " is unaffected!";
3679 /* Go to sleep (much) later */
3681 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3683 note = " is suspended!";
3689 /* No "real" damage */
3694 /* Sleep (Use "dam" as "power") */
3697 if (seen) obvious = TRUE;
3699 if (r_ptr->flagsr & RFR_RES_ALL)
3702 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3704 note = " is immune.";
3707 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3710 /* Attempt a saving throw */
3711 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3712 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3715 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3717 note = " is unaffected!";
3724 /* Go to sleep (much) later */
3726 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3728 note = " is suspended!";
3734 /* No "real" damage */
3743 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3744 vir = virtue_number(V_HARMONY);
3747 dam += p_ptr->virtues[vir-1]/10;
3750 vir = virtue_number(V_INDIVIDUALISM);
3753 dam -= p_ptr->virtues[vir-1]/20;
3756 if (seen) obvious = TRUE;
3758 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3761 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3763 note = " is immune.";
3766 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3770 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3773 /* Attempt a saving throw */
3774 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3775 (r_ptr->flags3 & RF3_NO_CONF) ||
3776 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3777 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3779 /* Memorize a flag */
3780 if (r_ptr->flags3 & RF3_NO_CONF)
3782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3786 /* No obvious effect */
3788 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3790 note = " is unaffected!";
3795 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3797 else if (p_ptr->cursed & TRC_AGGRAVATE)
3800 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3802 note = " hates you too much!";
3805 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3810 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3812 note = " suddenly seems friendly!";
3817 chg_virtue(V_INDIVIDUALISM, -1);
3818 if (r_ptr->flags3 & RF3_ANIMAL)
3819 chg_virtue(V_NATURE, 1);
3822 /* No "real" damage */
3827 /* Control undead */
3828 case GF_CONTROL_UNDEAD:
3831 if (seen) obvious = TRUE;
3833 vir = virtue_number(V_UNLIFE);
3836 dam += p_ptr->virtues[vir-1]/10;
3839 vir = virtue_number(V_INDIVIDUALISM);
3842 dam -= p_ptr->virtues[vir-1]/20;
3845 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3848 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3850 note = " is immune.";
3853 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3857 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3860 /* Attempt a saving throw */
3861 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3862 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3863 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3864 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3866 /* No obvious effect */
3868 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3870 note = " is unaffected!";
3874 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3876 else if (p_ptr->cursed & TRC_AGGRAVATE)
3879 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3881 note = " hates you too much!";
3884 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3889 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3891 note = " is in your thrall!";
3897 /* No "real" damage */
3903 case GF_CONTROL_DEMON:
3906 if (seen) obvious = TRUE;
3908 vir = virtue_number(V_UNLIFE);
3911 dam += p_ptr->virtues[vir-1]/10;
3914 vir = virtue_number(V_INDIVIDUALISM);
3917 dam -= p_ptr->virtues[vir-1]/20;
3920 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3923 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3925 note = " is immune.";
3928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3932 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3935 /* Attempt a saving throw */
3936 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3937 (!(r_ptr->flags3 & RF3_DEMON)) ||
3938 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3939 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3941 /* No obvious effect */
3943 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3945 note = " is unaffected!";
3949 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3951 else if (p_ptr->cursed & TRC_AGGRAVATE)
3954 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3956 note = " hates you too much!";
3959 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3964 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3966 note = " is in your thrall!";
3972 /* No "real" damage */
3978 case GF_CONTROL_ANIMAL:
3982 if (seen) obvious = TRUE;
3984 vir = virtue_number(V_NATURE);
3987 dam += p_ptr->virtues[vir-1]/10;
3990 vir = virtue_number(V_INDIVIDUALISM);
3993 dam -= p_ptr->virtues[vir-1]/20;
3996 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3999 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4001 note = " is immune.";
4004 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4008 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4011 /* Attempt a saving throw */
4012 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4013 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4014 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4015 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4016 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4018 /* Memorize a flag */
4019 if (r_ptr->flags3 & (RF3_NO_CONF))
4021 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4025 /* No obvious effect */
4027 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4029 note = " is unaffected!";
4033 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4035 else if (p_ptr->cursed & TRC_AGGRAVATE)
4038 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4040 note = " hates you too much!";
4043 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4048 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4050 note = " is tamed!";
4055 if (r_ptr->flags3 & RF3_ANIMAL)
4056 chg_virtue(V_NATURE, 1);
4059 /* No "real" damage */
4065 case GF_CONTROL_LIVING:
4069 vir = virtue_number(V_UNLIFE);
4070 if (seen) obvious = TRUE;
4072 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4073 vir = virtue_number(V_UNLIFE);
4076 dam -= p_ptr->virtues[vir-1]/10;
4079 vir = virtue_number(V_INDIVIDUALISM);
4082 dam -= p_ptr->virtues[vir-1]/20;
4085 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4086 if (dam < 1) dam = 1;
4088 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4090 msg_format("You stare into %s.", m_name);
4092 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4095 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4097 note = " is immune.";
4100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4104 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4107 /* Attempt a saving throw */
4108 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4109 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4110 !monster_living(r_ptr) ||
4111 ((r_ptr->level+10) > randint1(dam)))
4114 /* No obvious effect */
4116 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4118 note = " is unaffected!";
4122 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4124 else if (p_ptr->cursed & TRC_AGGRAVATE)
4127 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4129 note = " hates you too much!";
4132 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4137 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4139 note = " is tamed!";
4144 if (r_ptr->flags3 & RF3_ANIMAL)
4145 chg_virtue(V_NATURE, 1);
4148 /* No "real" damage */
4153 /* Confusion (Use "dam" as "power") */
4156 if (seen) obvious = TRUE;
4158 if (r_ptr->flagsr & RFR_RES_ALL)
4161 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4163 note = " is immune.";
4166 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4169 /* Get confused later */
4170 do_conf = damroll(3, (dam / 2)) + 1;
4172 /* Attempt a saving throw */
4173 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4174 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4175 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4177 /* Memorize a flag */
4178 if (r_ptr->flags3 & (RF3_NO_CONF))
4180 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4186 /* No obvious effect */
4188 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4190 note = " is unaffected!";
4196 /* No "real" damage */
4203 if (seen) obvious = TRUE;
4205 if (r_ptr->flagsr & RFR_RES_ALL)
4208 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4210 note = " is immune.";
4213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4216 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4218 /* Attempt a saving throw */
4219 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4220 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4225 /* No obvious effect */
4227 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4229 note = " is unaffected!";
4235 /* No "real" damage */
4243 /* Lite, but only hurts susceptible creatures */
4251 if (r_ptr->flagsr & RFR_RES_ALL)
4257 if (r_ptr->flags3 & (RF3_HURT_LITE))
4259 /* Obvious effect */
4260 if (seen) obvious = TRUE;
4262 /* Memorize the effects */
4263 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4265 /* Special effect */
4267 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4268 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4270 note = " cringes from the light!";
4271 note_dies = " shrivels away in the light!";
4276 /* Normally no damage */
4288 /* Lite -- opposite of Dark */
4291 if (seen) obvious = TRUE;
4293 if (r_ptr->flagsr & RFR_RES_ALL)
4296 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4298 note = " is immune.";
4301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4304 if (r_ptr->flagsr & RFR_RES_LITE)
4307 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4312 dam *= 2; dam /= (randint1(6)+6);
4313 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4315 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4317 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4319 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4320 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4322 note = " cringes from the light!";
4323 note_dies = " shrivels away in the light!";
4332 /* Dark -- opposite of Lite */
4335 if (seen) obvious = TRUE;
4337 if (r_ptr->flagsr & RFR_RES_ALL)
4340 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4342 note = " is immune.";
4345 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4348 if (r_ptr->flagsr & RFR_RES_DARK)
4351 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4356 dam *= 2; dam /= (randint1(6)+6);
4357 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4366 if (r_ptr->flagsr & RFR_RES_ALL)
4371 /* Hurt by rock remover */
4372 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4375 if (seen) obvious = TRUE;
4377 /* Memorize the effects */
4378 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4380 /* Cute little message */
4382 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4383 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4385 note = " loses some skin!";
4386 note_dies = " dissolves!";
4391 /* Usually, ignore the effects */
4402 /* Teleport undead (Use "dam" as "power") */
4403 case GF_AWAY_UNDEAD:
4405 /* Only affect undead */
4406 if (r_ptr->flags3 & (RF3_UNDEAD))
4408 bool resists_tele = FALSE;
4410 if (r_ptr->flagsr & RFR_RES_TELE)
4412 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4416 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4418 note = " is unaffected!";
4421 resists_tele = TRUE;
4423 else if (r_ptr->level > randint1(100))
4425 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4427 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4432 resists_tele = TRUE;
4438 if (seen) obvious = TRUE;
4439 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4451 /* No "real" damage */
4457 /* Teleport evil (Use "dam" as "power") */
4460 /* Only affect evil */
4461 if (r_ptr->flags3 & (RF3_EVIL))
4463 bool resists_tele = FALSE;
4465 if (r_ptr->flagsr & RFR_RES_TELE)
4467 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4469 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4471 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4473 note = " is unaffected!";
4476 resists_tele = TRUE;
4478 else if (r_ptr->level > randint1(100))
4480 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4482 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4487 resists_tele = TRUE;
4493 if (seen) obvious = TRUE;
4494 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4506 /* No "real" damage */
4512 /* Teleport monster (Use "dam" as "power") */
4515 bool resists_tele = FALSE;
4516 if (r_ptr->flagsr & RFR_RES_TELE)
4518 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4520 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4522 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4524 note = " is unaffected!";
4527 resists_tele = TRUE;
4529 else if (r_ptr->level > randint1(100))
4531 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4533 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4538 resists_tele = TRUE;
4545 if (seen) obvious = TRUE;
4547 /* Prepare to teleport */
4551 /* No "real" damage */
4557 /* Turn undead (Use "dam" as "power") */
4558 case GF_TURN_UNDEAD:
4560 if (r_ptr->flagsr & RFR_RES_ALL)
4565 /* Only affect undead */
4566 if (r_ptr->flags3 & (RF3_UNDEAD))
4569 if (seen) obvious = TRUE;
4571 /* Learn about type */
4572 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4574 /* Apply some fear */
4575 do_fear = damroll(3, (dam / 2)) + 1;
4577 /* Attempt a saving throw */
4578 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4580 /* No obvious effect */
4582 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4584 note = " is unaffected!";
4599 /* No "real" damage */
4605 /* Turn evil (Use "dam" as "power") */
4608 if (r_ptr->flagsr & RFR_RES_ALL)
4613 /* Only affect evil */
4614 if (r_ptr->flags3 & (RF3_EVIL))
4617 if (seen) obvious = TRUE;
4619 /* Learn about type */
4620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4622 /* Apply some fear */
4623 do_fear = damroll(3, (dam / 2)) + 1;
4625 /* Attempt a saving throw */
4626 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4628 /* No obvious effect */
4630 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4632 note = " is unaffected!";
4647 /* No "real" damage */
4653 /* Turn monster (Use "dam" as "power") */
4656 if (r_ptr->flagsr & RFR_RES_ALL)
4662 if (seen) obvious = TRUE;
4664 /* Apply some fear */
4665 do_fear = damroll(3, (dam / 2)) + 1;
4667 /* Attempt a saving throw */
4668 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4669 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4670 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4672 /* No obvious effect */
4674 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4676 note = " is unaffected!";
4683 /* No "real" damage */
4690 case GF_DISP_UNDEAD:
4692 if (r_ptr->flagsr & RFR_RES_ALL)
4698 /* Only affect undead */
4699 if (r_ptr->flags3 & (RF3_UNDEAD))
4702 if (seen) obvious = TRUE;
4704 /* Learn about type */
4705 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4709 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4710 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4712 note = " shudders.";
4713 note_dies = " dissolves!";
4734 if (r_ptr->flagsr & RFR_RES_ALL)
4740 /* Only affect evil */
4741 if (r_ptr->flags3 & (RF3_EVIL))
4744 if (seen) obvious = TRUE;
4746 /* Learn about type */
4747 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4751 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4752 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4754 note = " shudders.";
4755 note_dies = " dissolves!";
4775 if (r_ptr->flagsr & RFR_RES_ALL)
4781 /* Only affect good */
4782 if (r_ptr->flags3 & (RF3_GOOD))
4785 if (seen) obvious = TRUE;
4787 /* Learn about type */
4788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4792 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4793 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4795 note = " shudders.";
4796 note_dies = " dissolves!";
4814 case GF_DISP_LIVING:
4816 if (r_ptr->flagsr & RFR_RES_ALL)
4822 /* Only affect non-undead */
4823 if (monster_living(r_ptr))
4826 if (seen) obvious = TRUE;
4830 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4831 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4833 note = " shudders.";
4834 note_dies = " dissolves!";
4855 if (r_ptr->flagsr & RFR_RES_ALL)
4861 /* Only affect demons */
4862 if (r_ptr->flags3 & (RF3_DEMON))
4865 if (seen) obvious = TRUE;
4867 /* Learn about type */
4868 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4872 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4873 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4875 note = " shudders.";
4876 note_dies = " dissolves!";
4893 /* Dispel monster */
4896 if (r_ptr->flagsr & RFR_RES_ALL)
4903 if (seen) obvious = TRUE;
4907 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4908 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4910 note = " shudders.";
4911 note_dies = " dissolves!";
4921 if (seen) obvious = TRUE;
4923 if (r_ptr->flagsr & RFR_RES_ALL)
4926 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4928 note = " is immune.";
4931 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4935 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4939 /* Heal the monster */
4940 if (caster_ptr->hp < caster_ptr->maxhp)
4943 caster_ptr->hp += 6 * dam;
4944 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4946 /* Redraw (later) if needed */
4947 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4948 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4950 /* Special message */
4953 /* Get the monster name */
4954 monster_desc(killer, caster_ptr, 0);
4956 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4958 msg_format("%^s appears healthier.", killer);
4967 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4969 msg_format("You draw psychic energy from %s.", m_name);
4972 (void)hp_player(dam);
4978 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4980 if (see_s_msg) msg_format("%s is unaffected.", m_name);
4990 if (seen) obvious = TRUE;
4993 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
4995 if (!who) msg_format("You gaze intently at %s.", m_name);
4998 if (r_ptr->flagsr & RFR_RES_ALL)
5001 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5003 note = " is immune.";
5006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5010 /* Attempt a saving throw */
5011 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5012 (r_ptr->flags3 & RF3_NO_CONF) ||
5013 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5015 /* Memorize a flag */
5016 if (r_ptr->flags3 & (RF3_NO_CONF))
5018 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5021 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5023 note = "is unaffected!";
5027 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5031 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5033 note = " is immune!";
5037 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5039 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5041 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5050 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5051 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5053 note = " is blasted by psionic energy.";
5054 note_dies = " collapses, a mindless husk.";
5057 if (who > 0) do_conf = randint0(4) + 4;
5058 else do_conf = randint0(8) + 8;
5064 case GF_BRAIN_SMASH:
5066 if (seen) obvious = TRUE;
5069 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5071 if (!who) msg_format("You gaze intently at %s.", m_name);
5074 if (r_ptr->flagsr & RFR_RES_ALL)
5077 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5079 note = " is immune.";
5082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5086 /* Attempt a saving throw */
5087 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5088 (r_ptr->flags3 & RF3_NO_CONF) ||
5089 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5091 /* Memorize a flag */
5092 if (r_ptr->flags3 & (RF3_NO_CONF))
5094 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5097 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5099 note = "is unaffected!";
5103 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5105 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5107 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5109 note = " is immune!";
5113 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5115 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5117 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5126 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5127 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5129 note = " is blasted by psionic energy.";
5130 note_dies = " collapses, a mindless husk.";
5135 do_conf = randint0(4) + 4;
5136 do_stun = randint0(4) + 4;
5140 do_conf = randint0(8) + 8;
5141 do_stun = randint0(8) + 8;
5143 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5144 if (c_ptr->m_idx == p_ptr->riding)
5145 p_ptr->update |= (PU_BONUS);
5153 if (seen) obvious = TRUE;
5156 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5158 if (!who) msg_format("You point at %s and curses.", m_name);
5161 if (r_ptr->flagsr & RFR_RES_ALL)
5164 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5166 note = " is immune.";
5169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5173 /* Attempt a saving throw */
5174 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5177 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5179 note = "is unaffected!";
5189 if (seen) obvious = TRUE;
5192 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5194 if (!who) msg_format("You point at %s and curses horribly.", m_name);
5197 if (r_ptr->flagsr & RFR_RES_ALL)
5200 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5202 note = " is immune.";
5205 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5209 /* Attempt a saving throw */
5210 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5213 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5215 note = "is unaffected!";
5225 if (seen) obvious = TRUE;
5228 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5230 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5233 if (r_ptr->flagsr & RFR_RES_ALL)
5236 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5238 note = " is immune.";
5241 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5245 /* Attempt a saving throw */
5246 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5249 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5251 note = "is unaffected!";
5261 if (seen) obvious = TRUE;
5264 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5266 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5269 if (r_ptr->flagsr & RFR_RES_ALL)
5272 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5274 note = " is immune.";
5277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5281 /* Attempt a saving throw */
5282 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5285 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5287 note = "is unaffected!";
5297 if (seen) obvious = TRUE;
5299 if (r_ptr->flagsr & RFR_RES_ALL)
5302 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5304 note = " is immune.";
5307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5311 if (r_ptr->flags1 & RF1_UNIQUE)
5314 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5316 note = "is unaffected!";
5322 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5323 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5325 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5327 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5332 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5342 /* Capture monster */
5346 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5347 (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)
5350 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5352 msg_format("%^s is unaffected.", m_name);
5358 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5359 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5360 nokori_hp = m_ptr->maxhp * 3 / 10;
5362 nokori_hp = m_ptr->maxhp * 3 / 20;
5364 if (m_ptr->hp >= nokori_hp)
5367 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5369 msg_format("You need to weaken %s more.", m_name);
5373 else if (m_ptr->hp < randint0(nokori_hp))
5375 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5377 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5379 msg_format("You capture %^s!", m_name);
5381 cap_mon = m_list[c_ptr->m_idx].r_idx;
5382 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5383 cap_hp = m_list[c_ptr->m_idx].hp;
5384 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5385 if (m_list[c_ptr->m_idx].nickname)
5386 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5389 if (c_ptr->m_idx == p_ptr->riding)
5391 if (rakuba(-1, FALSE))
5394 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5396 msg_format("You have fallen from %s.", m_name);
5401 delete_monster_idx(c_ptr->m_idx);
5408 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5410 msg_format("You failed to capture %s.", m_name);
5417 /* Attack (Use "dam" as attack type) */
5420 /* Return this monster's death */
5421 return py_attack(y, x, dam);
5424 /* Sleep (Use "dam" as "power") */
5430 if (seen) obvious = TRUE;
5432 if (r_ptr->flagsr & RFR_RES_ALL)
5435 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5437 note = " is immune.";
5440 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5443 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5446 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5448 note = " is immune!";
5452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5458 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5460 note = " is immune!";
5467 if (one_in_(5)) effect = 1;
5468 else if (one_in_(4)) effect = 2;
5469 else if (one_in_(3)) effect = 3;
5474 /* Powerful monsters can resist */
5475 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5476 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5479 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5481 note = " is unaffected!";
5487 /* Normal monsters slow down */
5493 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5495 note = " starts moving slower.";
5498 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5500 if (c_ptr->m_idx == p_ptr->riding)
5501 p_ptr->update |= (PU_BONUS);
5505 else if (effect == 2)
5507 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5509 /* Attempt a saving throw */
5510 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5511 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5516 /* No obvious effect */
5518 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5520 note = " is unaffected!";
5527 else if (effect == 3)
5529 /* Attempt a saving throw */
5530 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5531 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5532 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5534 /* Memorize a flag */
5535 if (r_ptr->flags3 & RF3_NO_SLEEP)
5537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5540 /* No obvious effect */
5542 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5544 note = " is unaffected!";
5551 /* Go to sleep (much) later */
5553 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5555 note = " falls asleep!";
5565 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5567 note = " is immune!";
5571 /* No "real" damage */
5580 if (seen) obvious = TRUE;
5582 if (r_ptr->flagsr & RFR_RES_ALL)
5585 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5587 note = " is immune.";
5590 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5594 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_UNIQUE2)) || (c_ptr->m_idx == p_ptr->riding)) || p_ptr->inside_arena || p_ptr->inside_quest)
5601 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG2_NOGENO))
5608 delete_monster_idx(c_ptr->m_idx);
5610 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5612 msg_format("%^s disappered!",m_name);
5616 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5618 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5622 chg_virtue(V_VITALITY, -1);
5627 p_ptr->redraw |= (PR_HP);
5630 p_ptr->window |= (PW_PLAYER);
5637 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5639 note = "is unaffected!";
5642 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
5650 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5652 if (!who) msg_format("You take a photograph of %s.", m_name);
5655 if (r_ptr->flags3 & (RF3_HURT_LITE))
5657 /* Obvious effect */
5658 if (seen) obvious = TRUE;
5660 /* Memorize the effects */
5661 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5663 /* Special effect */
5665 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5666 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5668 note = " cringes from the light!";
5669 note_dies = " shrivels away in the light!";
5673 /* Normally no damage */
5680 photo = m_ptr->r_idx;
5687 case GF_BLOOD_CURSE:
5689 if (seen) obvious = TRUE;
5691 if (r_ptr->flagsr & RFR_RES_ALL)
5694 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5696 note = " is immune.";
5699 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5707 bool success = FALSE;
5708 if (seen) obvious = TRUE;
5710 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5712 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5713 if (dam < 1) dam = 1;
5715 /* No need to tame your pet */
5719 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5721 note = " starts moving faster.";
5724 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5728 /* Attempt a saving throw */
5729 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5730 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5731 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5732 (p_ptr->cursed & TRC_AGGRAVATE) ||
5733 ((r_ptr->level+10) > randint1(dam)))
5736 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5741 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5743 note = " is tamed!";
5747 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5749 /* Learn about type */
5750 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5757 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5759 do_fear = randint1(90)+10;
5761 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5764 /* No "real" damage */
5771 if (seen) obvious = TRUE;
5773 if (r_ptr->flagsr & RFR_RES_ALL)
5776 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5778 note = " is immune.";
5781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5785 /* Attempt a saving throw */
5786 if (randint0(100 + dam) < (r_ptr->level + 50))
5790 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5792 note = "is unaffected!";
5813 /* Absolutely no effect */
5814 if (skipped) return (FALSE);
5816 /* "Unique" monsters cannot be polymorphed */
5817 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5819 /* Quest monsters cannot be polymorphed */
5820 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5822 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5824 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5825 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5827 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5832 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5833 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5836 /* Modify the damage */
5838 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5840 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5842 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5845 /* Check for death */
5846 if (dam > m_ptr->hp)
5848 /* Extract method of death */
5853 /* Sound and Impact resisters never stun */
5855 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5856 !(r_ptr->flags3 & RF3_NO_STUN))
5859 if (seen) obvious = TRUE;
5865 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5867 note = " is more dazed.";
5870 tmp = m_ptr->stunned + (do_stun / 2);
5875 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5877 note = " is dazed.";
5884 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5890 /* Confusion and Chaos resisters (and sleepers) never confuse */
5892 !(r_ptr->flags3 & RF3_NO_CONF) &&
5893 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5896 if (seen) obvious = TRUE;
5898 /* Already partially confused */
5899 if (m_ptr->confused)
5902 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5904 note = " looks more confused.";
5907 tmp = m_ptr->confused + (do_conf / 2);
5910 /* Was not confused */
5914 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5916 note = " looks confused.";
5922 /* Apply confusion */
5923 m_ptr->confused = (tmp < 200) ? tmp : 200;
5932 if (seen) obvious = TRUE;
5934 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5939 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5941 note = " seems weakened.";
5943 m_ptr->maxhp -= do_time;
5944 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5949 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5950 if (do_poly && (randint1(90) > r_ptr->level))
5952 if (polymorph_monster(y, x))
5955 if (seen) obvious = TRUE;
5957 /* Monster polymorphs */
5959 note = "¤¬ÊѿȤ·¤¿¡ª";
5964 /* Turn off the damage */
5967 /* Hack -- Get new monster */
5968 m_ptr = &m_list[c_ptr->m_idx];
5970 /* Hack -- Get new race */
5971 r_ptr = &r_info[m_ptr->r_idx];
5977 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5979 note = " is unaffected!";
5984 /* Handle "teleport" */
5988 if (seen) obvious = TRUE;
5992 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5994 note = " disappears!";
5997 if (!who) chg_virtue(V_VALOUR, -1);
6000 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who), TRUE);
6002 /* Hack -- get new location */
6006 /* Hack -- get new grid */
6007 c_ptr = &cave[y][x];
6014 tmp = m_ptr->monfear + do_fear;
6017 m_ptr->monfear = (tmp < 200) ? tmp : 200;
6024 if (typ == GF_DRAIN_MANA)
6026 /* Drain mana does nothing */
6029 /* If another monster did the damage, hurt the monster by hand */
6032 /* Redraw (later) if needed */
6033 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
6034 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
6036 /* Wake the monster up */
6039 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
6041 /* Hurt the monster */
6049 if (is_pet(m_ptr) && !(m_ptr->ml))
6052 /* Give detailed messages if destroyed */
6055 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6058 msg_format("%^s%s", m_name, note);
6066 monster_gain_exp(who, m_ptr->r_idx);
6068 /* Generate treasure, etc */
6069 monster_death(c_ptr->m_idx, FALSE);
6071 /* Delete the monster */
6072 delete_monster_idx(c_ptr->m_idx);
6077 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6079 msg_print("You feel sad for a moment.");
6085 /* Damaged monster */
6088 /* Give detailed messages if visible or destroyed */
6089 if (note && seen_msg) msg_format("%^s%s", m_name, note);
6091 /* Hack -- Pain message */
6094 message_pain(c_ptr->m_idx, dam);
6101 /* Hack -- handle sleep */
6102 if (do_sleep) m_ptr->csleep = do_sleep;
6106 else if (heal_leper)
6109 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6111 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6114 delete_monster_idx(c_ptr->m_idx);
6117 /* If the player did it, give him experience, check fear */
6122 /* Hurt the monster, check for fear and death */
6123 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6128 /* Damaged monster */
6131 /* HACK - anger the monster before showing the sleep message */
6132 if (do_sleep) anger_monster(m_ptr);
6134 /* Give detailed messages if visible or destroyed */
6135 if (note && seen_msg)
6137 msg_format("%s%s", m_name, note);
6139 msg_format("%^s%s", m_name, note);
6143 /* Hack -- Pain message */
6144 else if (known && (dam || !do_fear))
6146 message_pain(c_ptr->m_idx, dam);
6149 /* Anger monsters */
6150 if (((dam > 0) || get_angry) && !do_sleep)
6151 anger_monster(m_ptr);
6154 if ((fear || do_fear) && seen)
6161 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6163 msg_format("%^s flees in terror!", m_name);
6167 /* Hack -- handle sleep */
6168 if (do_sleep) m_ptr->csleep = do_sleep;
6172 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6174 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6178 switch (randint1(28))
6184 msg_print("ÃÏÌ̤¬Íɤ줿...");
6186 msg_print("The ground trembles...");
6189 earthquake(ty, tx, 4 + randint0(4));
6190 if (!one_in_(6)) break;
6192 case 3: case 4: case 5: case 6:
6195 int dam = damroll(10, 10);
6197 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6199 msg_print("A portal opens to a plane of raw mana!");
6202 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6203 if (!one_in_(6)) break;
6209 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6211 msg_print("Space warps about you!");
6214 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE, TRUE);
6215 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6216 if (!one_in_(6)) break;
6218 case 9: case 10: case 11:
6220 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6222 msg_print("You feel a surge of energy!");
6225 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6226 if (!one_in_(6)) break;
6227 case 12: case 13: case 14: case 15: case 16:
6228 aggravate_monsters(0);
6229 if (!one_in_(6)) break;
6231 count += activate_hi_summon(ty, tx, TRUE);
6232 if (!one_in_(6)) break;
6233 case 19: case 20: case 21: case 22:
6235 bool pet = !one_in_(3);
6236 u32b mode = PM_ALLOW_GROUP;
6238 if (pet) mode |= PM_FORCE_PET;
6239 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6241 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6242 if (!one_in_(6)) break;
6244 case 23: case 24: case 25:
6245 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6247 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6249 msg_print("You feel your life draining away...");
6252 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6253 else lose_exp(p_ptr->exp / 16);
6254 if (!one_in_(6)) break;
6255 case 26: case 27: case 28:
6264 (void)do_dec_stat(i);
6273 (void)do_dec_stat(randint0(6));
6282 if (p_ptr->inside_battle)
6284 p_ptr->health_who = c_ptr->m_idx;
6285 p_ptr->redraw |= (PR_HEALTH);
6289 /* XXX XXX XXX Verify this code */
6291 /* Update the monster */
6292 update_mon(c_ptr->m_idx, FALSE);
6294 /* Redraw the monster grid */
6298 /* Update monster recall window */
6299 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6302 p_ptr->window |= (PW_MONSTER);
6305 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6309 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6311 set_target(m_ptr, monster_target_y, monster_target_x);
6314 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6316 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6320 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6322 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6323 rakubadam_m = (dam > 200) ? 200 : dam;
6332 /* Get local object */
6335 /* Prepare to make a Blade of Chaos */
6336 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6338 q_ptr->pval = photo;
6340 /* Mark the item as fully known */
6341 q_ptr->ident |= (IDENT_MENTAL);
6343 /* Drop it in the dungeon */
6344 (void)drop_near(q_ptr, -1, py, px);
6352 /* Return "Anything seen?" */
6358 * Helper function for "project()" below.
6360 * Handle a beam/bolt/ball causing damage to the player.
6362 * This routine takes a "source monster" (by index), a "distance", a default
6363 * "damage", and a "damage type". See "project_m()" above.
6365 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6366 * is reduced (see "project_m()" above). This can happen if a monster breathes
6367 * at the player and hits a wall instead.
6369 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6370 * to know if this is actually a ball or a bolt spell
6373 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6374 * we just assume that the effects were obvious, for historical reasons.
6376 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6381 /* Hack -- assume obvious */
6382 bool obvious = TRUE;
6384 /* Player blind-ness */
6385 bool blind = (p_ptr->blind ? TRUE : FALSE);
6387 /* Player needs a "description" (he is blind) */
6390 /* Source monster */
6391 monster_type *m_ptr = NULL;
6393 /* Monster name (for attacks) */
6396 /* Monster name (for damage) */
6399 /* Hack -- messages */
6405 /* Player is not here */
6406 if (!player_bold(y, x)) return (FALSE);
6408 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6414 /* Player cannot hurt himself */
6415 if (!who) return (FALSE);
6416 if (who == p_ptr->riding) return (FALSE);
6418 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6421 int max_attempts = 10;
6424 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6425 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6426 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6428 if (blind) msg_print("Something bounces!");
6429 else msg_print("The attack bounces!");
6433 /* Choose 'new' target */
6436 t_y = m_list[who].fy - 1 + randint1(3);
6437 t_x = m_list[who].fx - 1 + randint1(3);
6440 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6442 if (max_attempts < 1)
6444 t_y = m_list[who].fy;
6445 t_x = m_list[who].fx;
6448 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6455 /* Limit maximum damage */
6456 if (dam > 1600) dam = 1600;
6458 /* Reduce damage by distance */
6459 dam = (dam + r) / (r + 1);
6462 /* If the player is blind, be more descriptive */
6463 if (blind) fuzzy = TRUE;
6468 /* Get the source monster */
6469 m_ptr = &m_list[who];
6470 /* Extract the monster level */
6471 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6473 /* Get the monster name */
6474 monster_desc(m_name, m_ptr, 0);
6476 /* Get the monster's real name (gotten before polymorph!) */
6477 strcpy(killer, who_name);
6482 strcpy(killer, "æ«");
6484 strcpy(killer, "a trap");
6488 /* Analyze the damage */
6491 /* Standard damage -- hurts inventory too */
6495 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6497 if (fuzzy) msg_print("You are hit by acid!");
6500 get_damage = acid_dam(dam, killer, monspell);
6504 /* Standard damage -- hurts inventory too */
6508 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6510 if (fuzzy) msg_print("You are hit by fire!");
6513 get_damage = fire_dam(dam, killer, monspell);
6517 /* Standard damage -- hurts inventory too */
6521 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6523 if (fuzzy) msg_print("You are hit by cold!");
6526 get_damage = cold_dam(dam, killer, monspell);
6530 /* Standard damage -- hurts inventory too */
6534 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6536 if (fuzzy) msg_print("You are hit by lightning!");
6539 get_damage = elec_dam(dam, killer, monspell);
6543 /* Standard damage -- also poisons player */
6546 bool double_resist = IS_OPPOSE_POIS();
6548 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6550 if (fuzzy) msg_print("You are hit by poison!");
6553 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6554 if (double_resist) dam = (dam + 2) / 3;
6556 if ((!(double_resist || p_ptr->resist_pois)) &&
6557 one_in_(HURT_CHANCE))
6562 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6564 if (!(double_resist || p_ptr->resist_pois))
6566 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6571 /* Standard damage -- also poisons / mutates player */
6574 bool double_resist = IS_OPPOSE_POIS();
6576 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6578 if (fuzzy) msg_print("You are hit by radiation!");
6581 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6582 if (double_resist) dam = (2 * dam + 2) / 5;
6583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6584 if (!(double_resist || p_ptr->resist_pois))
6586 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6588 if (one_in_(5)) /* 6 */
6591 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6593 msg_print("You undergo a freakish metamorphosis!");
6596 if (one_in_(4)) /* 4 */
6604 inven_damage(set_acid_destroy, 2);
6610 /* Standard damage */
6614 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6616 if (fuzzy) msg_print("You are hit by something!");
6619 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6623 /* Holy Orb -- Player only takes partial damage */
6627 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6629 if (fuzzy) msg_print("You are hit by something!");
6632 if (p_ptr->align > 10)
6634 else if (p_ptr->align < -10)
6636 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6643 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6645 if (fuzzy) msg_print("You are hit by something!");
6648 if (p_ptr->align > 10)
6650 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6654 /* Arrow -- XXX no dodging */
6658 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6660 if (fuzzy) msg_print("You are hit by something sharp!");
6663 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6666 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6668 msg_print("You cut down the arrow!");
6672 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6676 /* Plasma -- XXX No resist */
6680 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6682 if (fuzzy) msg_print("You are hit by something *HOT*!");
6685 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6687 if (!p_ptr->resist_sound)
6689 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6690 (void)set_stun(p_ptr->stun + k);
6693 if (!(p_ptr->resist_fire ||
6695 p_ptr->immune_fire))
6697 inven_damage(set_acid_destroy, 3);
6703 /* Nether -- drain experience */
6707 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6709 if (fuzzy) msg_print("You are hit by nether forces!");
6713 if (p_ptr->resist_neth)
6715 if (!prace_is_(RACE_SPECTRE))
6716 dam *= 6; dam /= (randint1(4) + 7);
6718 else drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6720 if (prace_is_(RACE_SPECTRE))
6723 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6725 msg_print("You feel invigorated!");
6729 learn_spell(monspell);
6733 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6739 /* Water -- stun/confuse */
6743 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6745 if (fuzzy) msg_print("You are hit by something wet!");
6748 if (!p_ptr->resist_sound)
6750 set_stun(p_ptr->stun + randint1(40));
6752 if (!p_ptr->resist_conf)
6754 set_confused(p_ptr->confused + randint1(5) + 5);
6759 inven_damage(set_cold_destroy, 3);
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);
6779 if (!p_ptr->resist_conf)
6781 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6783 if (!p_ptr->resist_chaos)
6785 (void)set_image(p_ptr->image + randint1(10));
6789 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6791 msg_print("Your body is twisted by chaos!");
6794 (void)gain_random_mutation(0);
6797 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6799 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6801 if (!p_ptr->resist_chaos || one_in_(9))
6803 inven_damage(set_elec_destroy, 2);
6804 inven_damage(set_fire_destroy, 2);
6806 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6810 /* Shards -- mostly cutting */
6814 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6816 if (fuzzy) msg_print("You are hit by something sharp!");
6819 if (p_ptr->resist_shard)
6821 dam *= 6; dam /= (randint1(4) + 7);
6825 (void)set_cut(p_ptr->cut + dam);
6828 if (!p_ptr->resist_shard || one_in_(13))
6830 inven_damage(set_cold_destroy, 2);
6833 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6837 /* Sound -- mostly stunning */
6841 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6843 if (fuzzy) msg_print("You are hit by a loud noise!");
6846 if (p_ptr->resist_sound)
6848 dam *= 5; dam /= (randint1(4) + 7);
6852 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6853 (void)set_stun(p_ptr->stun + k);
6856 if (!p_ptr->resist_sound || one_in_(13))
6858 inven_damage(set_cold_destroy, 2);
6861 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6865 /* Pure confusion */
6869 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6871 if (fuzzy) msg_print("You are hit by something puzzling!");
6874 if (p_ptr->resist_conf)
6876 dam *= 5; dam /= (randint1(4) + 7);
6878 if (!p_ptr->resist_conf)
6880 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6882 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6886 /* Disenchantment -- see above */
6890 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6892 if (fuzzy) msg_print("You are hit by something static!");
6895 if (p_ptr->resist_disen)
6897 dam *= 6; dam /= (randint1(4) + 7);
6901 (void)apply_disenchant(0);
6903 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6907 /* Nexus -- see above */
6911 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6913 if (fuzzy) msg_print("You are hit by something strange!");
6916 if (p_ptr->resist_nexus)
6918 dam *= 6; dam /= (randint1(4) + 7);
6924 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6928 /* Force -- mostly stun */
6932 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6934 if (fuzzy) msg_print("You are hit by kinetic force!");
6937 if (!p_ptr->resist_sound)
6939 (void)set_stun(p_ptr->stun + randint1(20));
6941 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6946 /* Rocket -- stun, cut */
6950 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6952 if (fuzzy) msg_print("There is an explosion!");
6955 if (!p_ptr->resist_sound)
6957 (void)set_stun(p_ptr->stun + randint1(20));
6959 if (p_ptr->resist_shard)
6965 (void)set_cut(p_ptr-> cut + ( dam / 2));
6968 if ((!p_ptr->resist_shard) || one_in_(12))
6970 inven_damage(set_cold_destroy, 3);
6973 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6977 /* Inertia -- slowness */
6981 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6983 if (fuzzy) msg_print("You are hit by something slow!");
6986 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6987 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6991 /* Lite -- blinding */
6995 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6997 if (fuzzy) msg_print("You are hit by something!");
7000 if (p_ptr->resist_lite)
7002 dam *= 4; dam /= (randint1(4) + 7);
7004 else if (!blind && !p_ptr->resist_blind)
7006 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7008 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7011 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7013 msg_print("The light scorches your flesh!");
7018 else if (prace_is_(RACE_S_FAIRY))
7022 if (p_ptr->wraith_form) dam *= 2;
7023 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7025 if (p_ptr->wraith_form)
7027 p_ptr->wraith_form = 0;
7029 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7031 msg_print("The light forces you out of your incorporeal shadow form.");
7034 p_ptr->redraw |= PR_MAP;
7035 /* Update monsters */
7036 p_ptr->update |= (PU_MONSTERS);
7038 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7040 /* Redraw status bar */
7041 p_ptr->redraw |= (PR_STATUS);
7048 /* Dark -- blinding */
7052 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7054 if (fuzzy) msg_print("You are hit by something!");
7057 if (p_ptr->resist_dark)
7059 dam *= 4; dam /= (randint1(4) + 7);
7061 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7063 else if (!blind && !p_ptr->resist_blind)
7065 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7067 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7071 /* Time -- bolt fewer effects XXX */
7075 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7077 if (fuzzy) msg_print("You are hit by a blast from the past!");
7080 if (p_ptr->resist_time)
7083 dam /= (randint1(4) + 7);
7085 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7087 msg_print("You feel as if time is passing you by.");
7093 switch (randint1(10))
7095 case 1: case 2: case 3: case 4: case 5:
7097 if (p_ptr->prace == RACE_ANDROID) break;
7099 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7101 msg_print("You feel life has clocked back.");
7104 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7108 case 6: case 7: case 8: case 9:
7110 switch (randint1(6))
7113 case 1: k = A_STR; act = "¶¯¤¯"; break;
7114 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7115 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7116 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7117 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7118 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7120 case 1: k = A_STR; act = "strong"; break;
7121 case 2: k = A_INT; act = "bright"; break;
7122 case 3: k = A_WIS; act = "wise"; break;
7123 case 4: k = A_DEX; act = "agile"; break;
7124 case 5: k = A_CON; act = "hale"; break;
7125 case 6: k = A_CHR; act = "beautiful"; break;
7131 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7133 msg_format("You're not as %s as you used to be...", act);
7137 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7138 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7139 p_ptr->update |= (PU_BONUS);
7146 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7148 msg_print("You're not as powerful as you used to be...");
7152 for (k = 0; k < 6; k++)
7154 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7155 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7157 p_ptr->update |= (PU_BONUS);
7163 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7167 /* Gravity -- stun plus slowness plus teleport */
7171 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7172 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7174 if (fuzzy) msg_print("You are hit by something heavy!");
7175 msg_print("Gravity warps around you.");
7178 teleport_player(5, TRUE);
7179 if (!p_ptr->levitation)
7180 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7181 if (!(p_ptr->resist_sound || p_ptr->levitation))
7183 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7184 (void)set_stun(p_ptr->stun + k);
7186 if (p_ptr->levitation)
7188 dam = (dam * 2) / 3;
7191 if (!p_ptr->levitation || one_in_(13))
7193 inven_damage(set_cold_destroy, 2);
7196 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7200 /* Standard damage */
7201 case GF_DISINTEGRATE:
7204 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7206 if (fuzzy) msg_print("You are hit by pure energy!");
7209 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7216 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7218 if (fuzzy) msg_print("You are hit by something invigorating!");
7221 (void)hp_player(dam);
7229 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7231 if (fuzzy) msg_print("You are hit by something!");
7234 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7242 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7244 if (fuzzy) msg_print("You are hit by something slow!");
7247 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7253 if (p_ptr->free_act) break;
7255 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7257 if (fuzzy) msg_print("You fall asleep!");
7261 if (ironman_nightmare)
7264 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7266 msg_print("A horrible vision enters your mind.");
7270 /* Pick a nightmare */
7271 get_mon_num_prep(get_nightmare, NULL);
7273 /* Have some nightmares */
7274 have_nightmare(get_mon_num(MAX_DEPTH));
7276 /* Remove the monster restriction */
7277 get_mon_num_prep(NULL, NULL);
7280 set_paralyzed(p_ptr->paralyzed + dam);
7291 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7293 if (fuzzy) msg_print("You are hit by an aura of magic!");
7296 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7304 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7306 if (fuzzy) msg_print("You are hit by an energy!");
7309 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7317 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7319 if (fuzzy) msg_print("Something falls from the sky on you!");
7322 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7323 if (!p_ptr->resist_shard || one_in_(13))
7325 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7326 inven_damage(set_cold_destroy, 2);
7332 /* Ice -- cold plus stun plus cuts */
7336 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7338 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7341 cold_dam(dam, killer, monspell);
7342 if (!p_ptr->resist_shard)
7344 (void)set_cut(p_ptr->cut + damroll(5, 8));
7346 if (!p_ptr->resist_sound)
7348 (void)set_stun(p_ptr->stun + randint1(15));
7351 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7353 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7363 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7365 if (fuzzy) msg_print("You are hit by something extremely cold!");
7369 if (p_ptr->mimic_form)
7371 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7372 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7377 switch (p_ptr->prace)
7379 /* Some races are immune */
7393 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7409 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7410 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7412 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7413 else msg_print("Your psychic energy is drawn!");
7417 if (dam >= p_ptr->csp)
7421 p_ptr->csp_frac = 0;
7430 learn_spell(monspell);
7433 p_ptr->redraw |= (PR_MANA);
7436 p_ptr->window |= (PW_PLAYER);
7437 p_ptr->window |= (PW_SPELL);
7441 /* Heal the monster */
7442 if (m_ptr->hp < m_ptr->maxhp)
7445 m_ptr->hp += (6 * dam);
7446 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7448 /* Redraw (later) if needed */
7449 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7450 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7452 /* Special message */
7456 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7458 msg_format("%^s appears healthier.", m_name);
7472 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7475 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7477 msg_print("You resist the effects!");
7479 learn_spell(monspell);
7484 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7486 msg_print("Your mind is blasted by psyonic energy.");
7489 if (!p_ptr->resist_conf)
7491 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7494 if (!p_ptr->resist_chaos && one_in_(3))
7496 (void)set_image(p_ptr->image + randint0(250) + 150);
7503 p_ptr->csp_frac = 0;
7505 p_ptr->redraw |= PR_MANA;
7507 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7513 case GF_BRAIN_SMASH:
7515 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7518 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7520 msg_print("You resist the effects!");
7522 learn_spell(monspell);
7527 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7529 msg_print("Your mind is blasted by psionic energy.");
7536 p_ptr->csp_frac = 0;
7538 p_ptr->redraw |= PR_MANA;
7540 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7541 if (!p_ptr->resist_blind)
7543 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7545 if (!p_ptr->resist_conf)
7547 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7549 if (!p_ptr->free_act)
7551 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7553 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7555 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7556 (void)do_dec_stat(A_INT);
7557 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7558 (void)do_dec_stat(A_WIS);
7560 if (!p_ptr->resist_chaos)
7562 (void)set_image(p_ptr->image + randint0(250) + 150);
7571 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7574 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7576 msg_print("You resist the effects!");
7578 learn_spell(monspell);
7582 curse_equipment(15, 0);
7583 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7591 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7594 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7596 msg_print("You resist the effects!");
7598 learn_spell(monspell);
7602 curse_equipment(25, MIN(rlev/2-15, 5));
7603 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7611 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7614 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7616 msg_print("You resist the effects!");
7618 learn_spell(monspell);
7622 curse_equipment(33, MIN(rlev/2-15, 15));
7623 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7631 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
7634 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7636 msg_print("You resist the effects!");
7638 learn_spell(monspell);
7642 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7643 (void)set_cut(p_ptr->cut + damroll(10, 10));
7651 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7654 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7656 msg_format("You resist the effects!");
7658 learn_spell(monspell);
7663 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7665 msg_print("You feel your life fade away!");
7668 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7669 curse_equipment(40, 20);
7671 if (p_ptr->chp < 1) p_ptr->chp = 1;
7686 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
7689 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7691 char m_name_self[80];
7694 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7696 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7698 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7699 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7702 if (p_ptr->riding && dam > 0)
7704 rakubadam_p = (dam > 200) ? 200 : dam;
7712 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7718 /* Return "Anything seen?" */
7724 * Find the distance from (x, y) to a line.
7726 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7728 /* Vector from (x, y) to (x1, y1) */
7737 int pd = distance(y1, x1, y, x);
7738 int nd = distance(y1, x1, y2, x2);
7740 if (pd > nd) return distance(y, x, y2, x2);
7742 /* Component of P on N */
7743 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7745 /* Absolute value */
7746 return((nd >= 0) ? nd : 0 - nd);
7753 * Modified version of los() for calculation of disintegration balls.
7754 * Disintegration effects are stopped by permanent walls.
7756 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7776 /* Slope, or 1/Slope, of LOS */
7780 /* Extract the offset */
7784 /* Extract the absolute offset */
7789 /* Handle adjacent (or identical) grids */
7790 if ((ax < 2) && (ay < 2)) return (TRUE);
7793 /* Paranoia -- require "safe" origin */
7794 /* if (!in_bounds(y1, x1)) return (FALSE); */
7797 /* Directly South/North */
7800 /* South -- check for walls */
7803 for (ty = y1 + 1; ty < y2; ty++)
7805 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7809 /* North -- check for walls */
7812 for (ty = y1 - 1; ty > y2; ty--)
7814 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7822 /* Directly East/West */
7825 /* East -- check for walls */
7828 for (tx = x1 + 1; tx < x2; tx++)
7830 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7834 /* West -- check for walls */
7837 for (tx = x1 - 1; tx > x2; tx--)
7839 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7848 /* Extract some signs */
7849 sx = (dx < 0) ? -1 : 1;
7850 sy = (dy < 0) ? -1 : 1;
7853 /* Vertical "knights" */
7858 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7862 /* Horizontal "knights" */
7867 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7872 /* Calculate scale factor div 2 */
7875 /* Calculate scale factor */
7879 /* Travel horizontally */
7882 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7888 /* Consider the special case where slope == 1. */
7899 /* Note (below) the case (qy == f2), where */
7900 /* the LOS exactly meets the corner of a tile. */
7903 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7914 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7927 /* Travel vertically */
7930 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7946 /* Note (below) the case (qx == f2), where */
7947 /* the LOS exactly meets the corner of a tile. */
7950 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7961 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7982 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)
7987 int brev = rad * rad / dist;
7991 int mdis = distance(y1, x1, y2, x2) + rad;
7993 while (bdis <= mdis)
7997 if ((0 < dist) && (path_n < dist))
7999 int ny = GRID_Y(path_g[path_n]);
8000 int nx = GRID_X(path_g[path_n]);
8001 int nd = distance(ny, nx, y1, x1);
8003 /* Get next base point */
8012 /* Travel from center outward */
8013 for (cdis = 0; cdis <= brad; cdis++)
8015 /* Scan the maximal blast area of radius "cdis" */
8016 for (y = by - cdis; y <= by + cdis; y++)
8018 for (x = bx - cdis; x <= bx + cdis; x++)
8020 /* Ignore "illegal" locations */
8021 if (!in_bounds(y, x)) continue;
8023 /* Enforce a circular "ripple" */
8024 if (distance(y1, x1, y, x) != bdis) continue;
8026 /* Enforce an arc */
8027 if (distance(by, bx, y, x) != cdis) continue;
8033 /* Lights are stopped by opaque terrains */
8034 if (!los(by, bx, y, x)) continue;
8036 case GF_DISINTEGRATE:
8037 /* Disintegration are stopped only by perma-walls */
8038 if (!in_disintegration_range(by, bx, y, x)) continue;
8041 /* Ball explosions are stopped by walls */
8042 if (!projectable(by, bx, y, x)) continue;
8046 /* Save this grid */
8054 /* Encode some more "radius" info */
8055 gm[bdis + 1] = *pgrids;
8057 /* Increase the size */
8058 brad = rad * (path_n + brev) / (dist + brev);
8060 /* Find the next ripple */
8064 /* Store the effect size */
8070 * Generic "beam"/"bolt"/"ball" projection routine.
8073 * who: Index of "source" monster (zero for "player")
8074 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8075 * y,x: Target location (or location to travel "towards")
8076 * dam: Base damage roll to apply to affected monsters (or player)
8077 * typ: Type of damage to apply to monsters (and objects)
8078 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8081 * TRUE if any "effects" of the projection were observed, else FALSE
8083 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8084 * towards a given location (optionally passing over the heads of interposing
8085 * monsters), and have it do a given amount of damage to the monsters (and
8086 * optionally objects) within the given radius of the final location.
8088 * A "bolt" travels from source to target and affects only the target grid.
8089 * A "beam" travels from source to target, affecting all grids passed through.
8090 * A "ball" travels from source to the target, exploding at the target, and
8091 * affecting everything within the given radius of the target location.
8093 * Traditionally, a "bolt" does not affect anything on the ground, and does
8094 * not pass over the heads of interposing monsters, much like a traditional
8095 * missile, and will "stop" abruptly at the "target" even if no monster is
8096 * positioned there, while a "ball", on the other hand, passes over the heads
8097 * of monsters between the source and target, and affects everything except
8098 * the source monster which lies within the final radius, while a "beam"
8099 * affects every monster between the source and target, except for the casting
8100 * monster (or player), and rarely affects things on the ground.
8102 * Two special flags allow us to use this function in special ways, the
8103 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8104 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8105 * actually projecting from the source monster (or player).
8107 * The player will only get "experience" for monsters killed by himself
8108 * Unique monsters can only be destroyed by attacks from the player
8110 * Only 256 grids can be affected per projection, limiting the effective
8111 * "radius" of standard ball attacks to nine units (diameter nineteen).
8113 * One can project in a given "direction" by combining PROJECT_THRU with small
8114 * offsets to the initial location (see "line_spell()"), or by calculating
8115 * "virtual targets" far away from the player.
8117 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8118 * continuing until it actually hits somethings (useful for "stone to mud").
8120 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8122 * Balls must explode BEFORE hitting walls, or they would affect monsters
8123 * on both sides of a wall. Some bug reports indicate that this is still
8124 * happening in 2.7.8 for Windows, though it appears to be impossible.
8126 * We "pre-calculate" the blast area only in part for efficiency.
8127 * More importantly, this lets us do "explosions" from the "inside" out.
8128 * This results in a more logical distribution of "blast" treasure.
8129 * It also produces a better (in my opinion) animation of the explosion.
8130 * It could be (but is not) used to have the treasure dropped by monsters
8131 * in the middle of the explosion fall "outwards", and then be damaged by
8132 * the blast as it spreads outwards towards the treasure drop location.
8134 * Walls and doors are included in the blast area, so that they can be
8135 * "burned" or "melted" in later versions.
8137 * This algorithm is intended to maximize simplicity, not necessarily
8138 * efficiency, since this function is not a bottleneck in the code.
8140 * We apply the blast effect from ground zero outwards, in several passes,
8141 * first affecting features, then objects, then monsters, then the player.
8142 * This allows walls to be removed before checking the object or monster
8143 * in the wall, and protects objects which are dropped by monsters killed
8144 * in the blast, and allows the player to see all affects before he is
8145 * killed or teleported away. The semantics of this method are open to
8146 * various interpretations, but they seem to work well in practice.
8148 * We process the blast area from ground-zero outwards to allow for better
8149 * distribution of treasure dropped by monsters, and because it provides a
8150 * pleasing visual effect at low cost.
8152 * Note that the damage done by "ball" explosions decreases with distance.
8153 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8155 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8156 * the target, and then the damage "flows" along this beam of destruction.
8157 * The damage at every grid is the same as at the "center" of a "ball"
8158 * explosion, since the "beam" grids are treated as if they ARE at the
8159 * center of a "ball" explosion.
8161 * Currently, specifying "beam" plus "ball" means that locations which are
8162 * covered by the initial "beam", and also covered by the final "ball", except
8163 * for the final grid (the epicenter of the ball), will be "hit twice", once
8164 * by the initial beam, and once by the exploding ball. For the grid right
8165 * next to the epicenter, this results in 150% damage being done. The center
8166 * does not have this problem, for the same reason the final grid in a "beam"
8167 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8168 * grids which are covered by the "ball" will NOT work, as then they will
8169 * receive LESS damage than they should. Do not combine "beam" with "ball".
8171 * The array "gy[],gx[]" with current size "grids" is used to hold the
8172 * collected locations of all grids in the "blast area" plus "beam path".
8174 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8175 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8176 * first blast grid (see above) with radius "N" from the blast center. Note
8177 * that only the first gm[1] grids in the blast area thus take full damage.
8178 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8179 * number of blast grids.
8181 * Note that once the projection is complete, (y2,x2) holds the final location
8182 * of bolts/beams, and the "epicenter" of balls.
8184 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8185 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8186 * implementation of the "distance" function. Also, a bolt can be properly
8187 * viewed as a "ball" with a "rad" of "zero".
8189 * Note that if no "target" is reached before the beam/bolt/ball travels the
8190 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8191 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8193 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8194 * to move from point A to point B, even if the player cannot see part of the
8195 * projection path. Note that in general, the player will *always* see part
8196 * of the path, since it either starts at the player or ends on the player.
8198 * Hack -- we assume that every "projection" is "self-illuminating".
8200 * Hack -- when only a single monster is affected, we automatically track
8201 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8203 * Note that all projections now "explode" at their final destination, even
8204 * if they were being projected at a more distant destination. This means
8205 * that "ball" spells will *always* explode.
8207 * Note that we must call "handle_stuff()" after affecting terrain features
8208 * in the blast radius, in case the "illumination" of the grid was changed,
8209 * and "update_view()" and "update_monsters()" need to be called.
8211 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8221 int y_saver, x_saver; /* For reflecting monsters */
8223 int msec = delay_factor * delay_factor * delay_factor;
8225 /* Assume the player sees nothing */
8226 bool notice = FALSE;
8228 /* Assume the player has seen nothing */
8229 bool visual = FALSE;
8231 /* Assume the player has seen no blast grids */
8234 /* Assume to be a normal ball spell */
8235 bool breath = FALSE;
8237 /* Is the player blind? */
8238 bool blind = (p_ptr->blind ? TRUE : FALSE);
8240 bool old_hide = FALSE;
8242 /* Number of grids in the "path" */
8245 /* Actual grids in the "path" */
8248 /* Number of grids in the "blast area" (including the "beam" path) */
8251 /* Coordinates of the affected grids */
8252 byte gx[1024], gy[1024];
8254 /* Encoded "radius" info (see above) */
8257 /* Actual radius encoded in gm[] */
8262 /* Attacker's name (prepared before polymorph)*/
8265 /* Initialize by null string */
8271 /* Default target of monsterspell is player */
8272 monster_target_y=py;
8273 monster_target_x=px;
8275 /* Hack -- Jump to target */
8276 if (flg & (PROJECT_JUMP))
8281 /* Clear the flag */
8282 flg &= ~(PROJECT_JUMP);
8287 /* Start at player */
8294 /* Start at monster */
8297 x1 = m_list[who].fx;
8298 y1 = m_list[who].fy;
8299 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8312 /* Default "destination" */
8317 /* Hack -- verify stuff */
8318 if (flg & (PROJECT_THRU))
8320 if ((x1 == x2) && (y1 == y2))
8322 flg &= ~(PROJECT_THRU);
8326 /* Handle a breath attack */
8331 if (flg & PROJECT_HIDE) old_hide = TRUE;
8332 flg |= PROJECT_HIDE;
8336 /* Hack -- Assume there will be no blast (max radius 32) */
8337 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8345 /* Collect beam grids */
8346 if (flg & (PROJECT_BEAM))
8357 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8359 case GF_DISINTEGRATE:
8360 flg |= (PROJECT_GRID);
8361 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8365 /* Calculate the projection path */
8367 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8369 /* Hack -- Handle stuff */
8372 /* Giga-Hack SEEKER & SUPER_RAY */
8374 if( typ == GF_SEEKER )
8384 for (i = 0; i < path_n; ++i)
8389 int ny = GRID_Y(path_g[i]);
8390 int nx = GRID_X(path_g[i]);
8401 /* Only do visuals if requested */
8402 if (!blind && !(flg & (PROJECT_HIDE)))
8404 /* Only do visuals if the player can "see" the bolt */
8405 if (panel_contains(y, x) && player_has_los_bold(y, x))
8412 /* Obtain the bolt pict */
8413 p = bolt_pict(oy, ox, y, x, typ);
8415 /* Extract attr/char */
8419 /* Visual effects */
8420 print_rel(c, a, y, x);
8421 move_cursor_relative(y, x);
8422 /*if (fresh_before)*/ Term_fresh();
8423 Term_xtra(TERM_XTRA_DELAY, msec);
8425 /*if (fresh_before)*/ Term_fresh();
8427 /* Display "beam" grids */
8428 if (flg & (PROJECT_BEAM))
8430 /* Obtain the explosion pict */
8431 p = bolt_pict(y, x, y, x, typ);
8433 /* Extract attr/char */
8437 /* Visual effects */
8438 print_rel(c, a, y, x);
8441 /* Hack -- Activate delay */
8445 /* Hack -- delay anyway for consistency */
8448 /* Delay for consistency */
8449 Term_xtra(TERM_XTRA_DELAY, msec);
8452 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8453 if( is_mirror_grid(&cave[y][x]))
8455 /* The target of monsterspell becomes tha mirror(broken) */
8456 monster_target_y=(s16b)y;
8457 monster_target_x=(s16b)x;
8460 next_mirror( &oy,&ox,y,x );
8462 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8463 for( j = last_i; j <=i ; j++ )
8465 y = GRID_Y(path_g[j]);
8466 x = GRID_X(path_g[j]);
8467 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8468 if(!who && (project_m_n==1) && !jump ){
8469 if(cave[project_m_y][project_m_x].m_idx >0 ){
8470 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8472 /* Hack -- auto-recall */
8473 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8475 /* Hack - auto-track */
8476 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8479 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8484 for( i = last_i ; i < path_n ; i++ )
8487 y = GRID_Y(path_g[i]);
8488 x = GRID_X(path_g[i]);
8489 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8491 if(!who && (project_m_n==1) && !jump ){
8492 if(cave[project_m_y][project_m_x].m_idx >0 ){
8493 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8495 /* Hack -- auto-recall */
8496 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8498 /* Hack - auto-track */
8499 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8502 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8506 else if(typ == GF_SUPER_RAY){
8508 int second_step = 0;
8515 for (i = 0; i < path_n; ++i)
8520 int ny = GRID_Y(path_g[i]);
8521 int nx = GRID_X(path_g[i]);
8532 /* Only do visuals if requested */
8533 if (!blind && !(flg & (PROJECT_HIDE)))
8535 /* Only do visuals if the player can "see" the bolt */
8536 if (panel_contains(y, x) && player_has_los_bold(y, x))
8543 /* Obtain the bolt pict */
8544 p = bolt_pict(oy, ox, y, x, typ);
8546 /* Extract attr/char */
8550 /* Visual effects */
8551 print_rel(c, a, y, x);
8552 move_cursor_relative(y, x);
8553 /*if (fresh_before)*/ Term_fresh();
8554 Term_xtra(TERM_XTRA_DELAY, msec);
8556 /*if (fresh_before)*/ Term_fresh();
8558 /* Display "beam" grids */
8559 if (flg & (PROJECT_BEAM))
8561 /* Obtain the explosion pict */
8562 p = bolt_pict(y, x, y, x, typ);
8564 /* Extract attr/char */
8568 /* Visual effects */
8569 print_rel(c, a, y, x);
8572 /* Hack -- Activate delay */
8576 /* Hack -- delay anyway for consistency */
8579 /* Delay for consistency */
8580 Term_xtra(TERM_XTRA_DELAY, msec);
8583 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8584 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8586 if( second_step )continue;
8589 if( is_mirror_grid(&cave[y][x]) && !second_step )
8591 /* The target of monsterspell becomes tha mirror(broken) */
8592 monster_target_y=(s16b)y;
8593 monster_target_x=(s16b)x;
8596 for( j = 0; j <=i ; j++ )
8598 y = GRID_Y(path_g[j]);
8599 x = GRID_X(path_g[j]);
8600 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8604 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8605 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8606 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8607 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8608 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
8609 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
8610 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
8611 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
8614 for( i = 0; i < path_n ; i++ )
8617 y = GRID_Y(path_g[i]);
8618 x = GRID_X(path_g[i]);
8619 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8620 if(!who && (project_m_n==1) && !jump ){
8621 if(cave[project_m_y][project_m_x].m_idx >0 ){
8622 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8624 /* Hack -- auto-recall */
8625 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8627 /* Hack - auto-track */
8628 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8631 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8636 /* Project along the path */
8637 for (i = 0; i < path_n; ++i)
8642 int ny = GRID_Y(path_g[i]);
8643 int nx = GRID_X(path_g[i]);
8645 if (flg & PROJECT_DISI)
8647 /* Hack -- Balls explode before reaching walls */
8648 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8650 else if (flg & PROJECT_LOS)
8652 /* Hack -- Balls explode before reaching walls */
8653 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8657 /* Hack -- Balls explode before reaching walls */
8658 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8665 /* Collect beam grids */
8666 if (flg & (PROJECT_BEAM))
8673 /* Only do visuals if requested */
8674 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8676 /* Only do visuals if the player can "see" the bolt */
8677 if (panel_contains(y, x) && player_has_los_bold(y, x))
8684 /* Obtain the bolt pict */
8685 p = bolt_pict(oy, ox, y, x, typ);
8687 /* Extract attr/char */
8691 /* Visual effects */
8692 print_rel(c, a, y, x);
8693 move_cursor_relative(y, x);
8694 /*if (fresh_before)*/ Term_fresh();
8695 Term_xtra(TERM_XTRA_DELAY, msec);
8697 /*if (fresh_before)*/ Term_fresh();
8699 /* Display "beam" grids */
8700 if (flg & (PROJECT_BEAM))
8702 /* Obtain the explosion pict */
8703 p = bolt_pict(y, x, y, x, typ);
8705 /* Extract attr/char */
8709 /* Visual effects */
8710 print_rel(c, a, y, x);
8713 /* Hack -- Activate delay */
8717 /* Hack -- delay anyway for consistency */
8720 /* Delay for consistency */
8721 Term_xtra(TERM_XTRA_DELAY, msec);
8728 /* Save the "blast epicenter" */
8732 if (breath && !path_n)
8738 flg &= ~(PROJECT_HIDE);
8742 /* Start the "explosion" */
8745 /* Hack -- make sure beams get to "explode" */
8753 /* If we found a "target", explode there */
8754 if (dist <= MAX_RANGE)
8756 /* Mega-Hack -- remove the final "beam" grid */
8757 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8760 * Create a conical breath attack
8771 flg &= ~(PROJECT_HIDE);
8773 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8777 /* Determine the blast area, work from the inside out */
8778 for (dist = 0; dist <= rad; dist++)
8780 /* Scan the maximal blast area of radius "dist" */
8781 for (y = by - dist; y <= by + dist; y++)
8783 for (x = bx - dist; x <= bx + dist; x++)
8785 /* Ignore "illegal" locations */
8786 if (!in_bounds2(y, x)) continue;
8788 /* Enforce a "circular" explosion */
8789 if (distance(by, bx, y, x) != dist) continue;
8795 /* Lights are stopped by opaque terrains */
8796 if (!los(by, bx, y, x)) continue;
8798 case GF_DISINTEGRATE:
8799 /* Disintegration are stopped only by perma-walls */
8800 if (!in_disintegration_range(by, bx, y, x)) continue;
8803 /* Ball explosions are stopped by walls */
8804 if (!projectable(by, bx, y, x)) continue;
8808 /* Save this grid */
8815 /* Encode some more "radius" info */
8821 /* Speed -- ignore "non-explosions" */
8822 if (!grids) return (FALSE);
8825 /* Display the "blast area" if requested */
8826 if (!blind && !(flg & (PROJECT_HIDE)))
8828 /* Then do the "blast", from inside out */
8829 for (t = 0; t <= gm_rad; t++)
8831 /* Dump everything with this radius */
8832 for (i = gm[t]; i < gm[t+1]; i++)
8834 /* Extract the location */
8838 /* Only do visuals if the player can "see" the blast */
8839 if (panel_contains(y, x) && player_has_los_bold(y, x))
8848 /* Obtain the explosion pict */
8849 p = bolt_pict(y, x, y, x, typ);
8851 /* Extract attr/char */
8855 /* Visual effects -- Display */
8856 print_rel(c, a, y, x);
8860 /* Hack -- center the cursor */
8861 move_cursor_relative(by, bx);
8863 /* Flush each "radius" seperately */
8864 /*if (fresh_before)*/ Term_fresh();
8866 /* Delay (efficiently) */
8867 if (visual || drawn)
8869 Term_xtra(TERM_XTRA_DELAY, msec);
8873 /* Flush the erasing */
8876 /* Erase the explosion drawn above */
8877 for (i = 0; i < grids; i++)
8879 /* Extract the location */
8883 /* Hack -- Erase if needed */
8884 if (panel_contains(y, x) && player_has_los_bold(y, x))
8890 /* Hack -- center the cursor */
8891 move_cursor_relative(by, bx);
8893 /* Flush the explosion */
8894 /*if (fresh_before)*/ Term_fresh();
8899 /* Update stuff if needed */
8900 if (p_ptr->update) update_stuff();
8903 /* Check features */
8904 if (flg & (PROJECT_GRID))
8906 /* Start with "dist" of zero */
8909 /* Scan for features */
8910 for (i = 0; i < grids; i++)
8912 /* Hack -- Notice new "dist" values */
8913 if (gm[dist+1] == i) dist++;
8915 /* Get the grid location */
8919 /* Find the closest point in the blast */
8922 int d = dist_to_line(y, x, y1, x1, by, bx);
8924 /* Affect the grid */
8925 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8929 /* Affect the grid */
8930 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8935 /* Update stuff if needed */
8936 if (p_ptr->update) update_stuff();
8939 if (flg & (PROJECT_ITEM))
8941 /* Start with "dist" of zero */
8944 /* Scan for objects */
8945 for (i = 0; i < grids; i++)
8947 /* Hack -- Notice new "dist" values */
8948 if (gm[dist+1] == i) dist++;
8950 /* Get the grid location */
8954 /* Find the closest point in the blast */
8957 int d = dist_to_line(y, x, y1, x1, by, bx);
8959 /* Affect the object in the grid */
8960 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8964 /* Affect the object in the grid */
8965 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8971 /* Check monsters */
8972 if (flg & (PROJECT_KILL))
8979 /* Start with "dist" of zero */
8982 /* Scan for monsters */
8983 for (i = 0; i < grids; i++)
8987 /* Hack -- Notice new "dist" values */
8988 if (gm[dist + 1] == i) dist++;
8990 /* Get the grid location */
8994 /* A single bolt may be reflected */
8997 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8998 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
9000 if ((ref_ptr->flags2 & RF2_REFLECTING) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1) && !one_in_(10))
9003 int max_attempts = 10;
9005 /* Choose 'new' target */
9008 t_y = y_saver - 1 + randint1(3);
9009 t_x = x_saver - 1 + randint1(3);
9012 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9014 if (max_attempts < 1)
9023 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9024 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9025 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9026 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9028 msg_print("The attack bounces!");
9031 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9033 /* Reflected bolts randomly target either one */
9034 if (one_in_(2)) flg |= PROJECT_PLAYER;
9035 else flg &= ~(PROJECT_PLAYER);
9037 /* The bolt is reflected */
9038 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9040 /* Don't affect the monster any longer */
9046 /* Find the closest point in the blast */
9049 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9053 effective_dist = dist;
9057 /* There is the riding player on this monster */
9058 if (p_ptr->riding && player_bold(y, x))
9060 /* Aimed on the player */
9061 if (flg & PROJECT_PLAYER)
9063 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9066 * A beam or bolt is well aimed
9068 * So don't affects the mount.
9075 * The spell is not well aimed,
9076 * So partly affect the mount too.
9083 * This grid is the original target.
9084 * Or aimed on your horse.
9086 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9088 /* Hit the mount with full damage */
9092 * Otherwise this grid is not the
9093 * original target, it means that line
9094 * of fire is obstructed by this
9098 * A beam or bolt will hit either
9099 * player or mount. Choose randomly.
9101 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9105 /* Hit the mount with full damage */
9109 /* Hit the player later */
9110 flg |= PROJECT_PLAYER;
9112 /* Don't affect the mount */
9118 * The spell is not well aimed, so
9119 * partly affect both player and
9128 /* Affect the monster in the grid */
9129 if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
9133 /* Player affected one monster (without "jumping") */
9134 if (!who && (project_m_n == 1) && !jump)
9140 /* Track if possible */
9141 if (cave[y][x].m_idx > 0)
9143 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9145 /* Hack -- auto-recall */
9146 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
9148 /* Hack - auto-track */
9149 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9156 if (flg & (PROJECT_KILL))
9158 /* Start with "dist" of zero */
9161 /* Scan for player */
9162 for (i = 0; i < grids; i++)
9166 /* Hack -- Notice new "dist" values */
9167 if (gm[dist+1] == i) dist++;
9169 /* Get the grid location */
9173 /* Affect the player? */
9174 if (!player_bold(y, x)) continue;
9176 /* Find the closest point in the blast */
9179 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9183 effective_dist = dist;
9186 /* Target may be your horse */
9189 /* Aimed on the player */
9190 if (flg & PROJECT_PLAYER)
9192 /* Hit the player with full damage */
9196 * Hack -- When this grid was not the
9197 * original target, a beam or bolt
9198 * would hit either player or mount,
9199 * and should be choosen randomly.
9201 * But already choosen to hit the
9202 * mount at this point.
9204 * Or aimed on your horse.
9206 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9209 * A beam or bolt is well aimed
9211 * So don't affects the player.
9218 * The spell is not well aimed,
9219 * So partly affect the player too.
9225 /* Affect the player */
9226 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9234 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9236 if (rakubadam_m > 0)
9238 if (rakuba(rakubadam_m, FALSE))
9241 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9243 msg_format("%^s has thrown you off!", m_name);
9247 if (p_ptr->riding && rakubadam_p > 0)
9249 if(rakuba(rakubadam_p, FALSE))
9252 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9254 msg_format("You have fallen from %s.", m_name);
9260 /* Return "something was noticed" */
9264 bool binding_field( int dam )
9266 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9267 int mirror_num=0; /* ¶À¤Î¿ô */
9272 int msec= delay_factor*delay_factor*delay_factor;
9278 /* Default target of monsterspell is player */
9279 monster_target_y=py;
9280 monster_target_x=px;
9282 for( x=0 ; x < cur_wid ; x++ )
9284 for( y=0 ; y < cur_hgt ; y++ )
9286 if( is_mirror_grid(&cave[y][x]) &&
9287 distance(py,px,y,x) <= MAX_RANGE &&
9288 distance(py,px,y,x) != 0 &&
9289 player_has_los_bold(y,x) &&
9290 projectable(py, px, y, x)
9292 mirror_y[mirror_num]=y;
9293 mirror_x[mirror_num]=x;
9299 if( mirror_num < 2 )return FALSE;
9301 point_x[0] = randint0( mirror_num );
9303 point_x[1] = randint0( mirror_num );
9305 while( point_x[0] == point_x[1] );
9307 point_y[0]=mirror_y[point_x[0]];
9308 point_x[0]=mirror_x[point_x[0]];
9309 point_y[1]=mirror_y[point_x[1]];
9310 point_x[1]=mirror_x[point_x[1]];
9314 x=point_x[0]+point_x[1]+point_x[2];
9315 y=point_y[0]+point_y[1]+point_y[2];
9317 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9318 - (point_y[0]*3-y)*(point_x[1]*3-x);
9319 if( centersign == 0 )return FALSE;
9321 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9322 x1 = x1 < point_x[2] ? x1 : point_x[2];
9323 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9324 y1 = y1 < point_y[2] ? y1 : point_y[2];
9326 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9327 x2 = x2 > point_x[2] ? x2 : point_x[2];
9328 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9329 y2 = y2 > point_y[2] ? y2 : point_y[2];
9331 for( y=y1 ; y <=y2 ; y++ ){
9332 for( x=x1 ; x <=x2 ; x++ ){
9333 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9334 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9335 centersign*( (point_x[1]-x)*(point_y[2]-y)
9336 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9337 centersign*( (point_x[2]-x)*(point_y[0]-y)
9338 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9340 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9341 /* Visual effects */
9343 && panel_contains(y,x)){
9344 p = bolt_pict(y,x,y,x, GF_MANA );
9345 print_rel(PICT_C(p), PICT_A(p),y,x);
9346 move_cursor_relative(y, x);
9347 /*if (fresh_before)*/ Term_fresh();
9348 Term_xtra(TERM_XTRA_DELAY, msec);
9354 for( y=y1 ; y <=y2 ; y++ ){
9355 for( x=x1 ; x <=x2 ; x++ ){
9356 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9357 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9358 centersign*( (point_x[1]-x)*(point_y[2]-y)
9359 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9360 centersign*( (point_x[2]-x)*(point_y[0]-y)
9361 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9363 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9364 (void)project_f(0,0,y,x,dam,GF_MANA);
9369 for( y=y1 ; y <=y2 ; y++ ){
9370 for( x=x1 ; x <=x2 ; x++ ){
9371 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9372 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9373 centersign*( (point_x[1]-x)*(point_y[2]-y)
9374 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9375 centersign*( (point_x[2]-x)*(point_y[0]-y)
9376 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9378 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9379 (void)project_o(0,0,y,x,dam,GF_MANA);
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 (void)project_m(0,0,y,x,dam,GF_MANA,
9395 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP));
9402 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9404 msg_print("The field broke a mirror");
9406 remove_mirror(point_y[0],point_x[0]);
9412 void seal_of_mirror( int dam )
9416 for( x = 0 ; x < cur_wid ; x++ )
9418 for( y = 0 ; y < cur_hgt ; y++ )
9420 if( is_mirror_grid(&cave[y][x]))
9422 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9423 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP)))
9425 if( !cave[y][x].m_idx )