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);
1126 if (is_mirror_grid(c_ptr))
1129 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1131 msg_print("The mirror was crashed!");
1133 remove_mirror(y, x);
1134 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1140 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
1143 msg_print("¶À¤¬³ä¤ì¤¿¡ª");
1145 msg_print("The mirror was crashed!");
1147 remove_mirror(y, x);
1148 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
1153 case GF_DISINTEGRATE:
1155 /* Destroy mirror */
1156 if (is_mirror_grid(c_ptr)) remove_mirror(y, x);
1158 /* Permanent features don't get effect */
1159 /* But not protect monsters and other objects */
1160 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
1162 cave_alter_feat(y, x, FF_HURT_DISI);
1164 /* Update some things -- similar to GF_KILL_WALL */
1165 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
1172 /* Return "Anything seen?" */
1179 * We are called from "project()" to "damage" objects
1181 * We are called both for "beam" effects and "ball" effects.
1183 * Perhaps we should only SOMETIMES damage things on the ground.
1185 * The "r" parameter is the "distance from ground zero".
1187 * Note that we determine if the player can "see" anything that happens
1188 * by taking into account: blindness, line-of-sight, and illumination.
1190 * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
1192 * We return "TRUE" if the effect of the projection is "obvious".
1194 static bool project_o(int who, int r, int y, int x, int dam, int typ)
1196 cave_type *c_ptr = &cave[y][x];
1198 s16b this_o_idx, next_o_idx = 0;
1200 bool obvious = FALSE;
1201 bool known = player_has_los_bold(y, x);
1203 u32b flgs[TR_FLAG_SIZE];
1205 char o_name[MAX_NLEN];
1208 bool is_potion = FALSE;
1212 who = who ? who : 0;
1214 /* Reduce damage by distance */
1215 dam = (dam + r) / (r + 1);
1218 /* Scan all objects in the grid */
1219 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1221 /* Acquire object */
1222 object_type *o_ptr = &o_list[this_o_idx];
1224 bool is_art = FALSE;
1225 bool ignore = FALSE;
1226 bool do_kill = FALSE;
1228 cptr note_kill = NULL;
1231 /* Get the "plural"-ness */
1232 bool plural = (o_ptr->number > 1);
1235 /* Acquire next object */
1236 next_o_idx = o_ptr->next_o_idx;
1238 /* Extract the flags */
1239 object_flags(o_ptr, flgs);
1241 /* Check for artifact */
1242 if (object_is_artifact(o_ptr)) is_art = TRUE;
1244 /* Analyze the type */
1247 /* Acid -- Lots of things */
1250 if (hates_acid(o_ptr))
1254 note_kill = "Í»¤±¤Æ¤·¤Þ¤Ã¤¿¡ª";
1256 note_kill = (plural ? " melt!" : " melts!");
1259 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
1264 /* Elec -- Rings and Wands */
1267 if (hates_elec(o_ptr))
1271 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1273 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1276 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1281 /* Fire -- Flammable objects */
1284 if (hates_fire(o_ptr))
1288 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1290 note_kill = (plural ? " burn up!" : " burns up!");
1293 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1298 /* Cold -- potions and flasks */
1301 if (hates_cold(o_ptr))
1304 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1306 note_kill = (plural ? " shatter!" : " shatters!");
1310 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1318 if (hates_fire(o_ptr))
1322 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1324 note_kill = (plural ? " burn up!" : " burns up!");
1327 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1329 if (hates_elec(o_ptr))
1334 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1336 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1339 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
1347 if (hates_fire(o_ptr))
1351 note_kill = "dz¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª";
1353 note_kill = (plural ? " burn up!" : " burns up!");
1356 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
1358 if (hates_cold(o_ptr))
1363 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1365 note_kill = (plural ? " shatter!" : " shatters!");
1368 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
1373 /* Hack -- break potions and such */
1379 if (hates_cold(o_ptr))
1382 note_kill = "ºÕ¤±»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª";
1384 note_kill = (plural ? " shatter!" : " shatters!");
1392 /* Mana and Chaos -- destroy everything */
1399 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1401 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1407 case GF_DISINTEGRATE:
1411 note_kill = "¾øȯ¤·¤Æ¤·¤Þ¤Ã¤¿¡ª";
1413 note_kill = (plural ? " evaporate!" : " evaporates!");
1423 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1425 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1428 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1429 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1433 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1437 if (object_is_cursed(o_ptr))
1441 note_kill = "²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª";
1443 note_kill = (plural ? " are destroyed!" : " is destroyed!");
1452 identify_item(o_ptr);
1454 /* Auto-inscription */
1455 autopick_alter_item((-this_o_idx), FALSE);
1463 /* Chests are noticed only if trapped or locked */
1464 if (o_ptr->tval == TV_CHEST)
1466 /* Disarm/Unlock traps */
1467 if (o_ptr->pval > 0)
1469 /* Disarm or Unlock */
1470 o_ptr->pval = (0 - o_ptr->pval);
1473 object_known(o_ptr);
1476 if (known && o_ptr->marked)
1479 msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
1481 msg_print("Click!");
1493 if (o_ptr->tval == TV_CORPSE)
1498 if (!who || is_pet(&m_list[who]))
1499 mode |= PM_FORCE_PET;
1501 for (i = 0; i < o_ptr->number ; i++)
1503 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1504 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1509 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1511 note_kill = (plural ? " become dust." : " becomes dust.");
1516 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1519 note_kill = "À¸¤Ê֤ä¿¡£";
1521 note_kill = "rivived.";
1524 else if (!note_kill)
1527 note_kill = "³¥¤Ë¤Ê¤Ã¤¿¡£";
1529 note_kill = (plural ? " become dust." : " becomes dust.");
1541 /* Attempt to destroy the object */
1544 /* Effect "observed" */
1545 if (known && o_ptr->marked)
1548 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1551 /* Artifacts, and other objects, get to resist */
1552 if (is_art || ignore)
1554 /* Observe the resist */
1555 if (known && o_ptr->marked)
1558 msg_format("%s¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡ª",
1561 msg_format("The %s %s unaffected!",
1562 o_name, (plural ? "are" : "is"));
1571 /* Describe if needed */
1572 if (known && o_ptr->marked && note_kill)
1575 msg_format("%s¤Ï%s", o_name, note_kill);
1577 msg_format("The %s%s", o_name, note_kill);
1582 k_idx = o_ptr->k_idx;
1583 is_potion = object_is_potion(o_ptr);
1586 /* Delete the object */
1587 delete_object_idx(this_o_idx);
1589 /* Potions produce effects when 'shattered' */
1592 (void)potion_smash_effect(who, y, x, k_idx);
1601 /* Return "Anything seen?" */
1607 * Helper function for "project()" below.
1609 * Handle a beam/bolt/ball causing damage to a monster.
1611 * This routine takes a "source monster" (by index) which is mostly used to
1612 * determine if the player is causing the damage, and a "radius" (see below),
1613 * which is used to decrease the power of explosions with distance, and a
1614 * location, via integers which are modified by certain types of attacks
1615 * (polymorph and teleport being the obvious ones), a default damage, which
1616 * is modified as needed based on various properties, and finally a "damage
1617 * type" (see below).
1619 * Note that this routine can handle "no damage" attacks (like teleport) by
1620 * taking a "zero" damage, and can even take "parameters" to attacks (like
1621 * confuse) by accepting a "damage", using it to calculate the effect, and
1622 * then setting the damage to zero. Note that the "damage" parameter is
1623 * divided by the radius, so monsters not at the "epicenter" will not take
1624 * as much damage (or whatever)...
1626 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1627 * may result in a dereference of an invalid pointer. XXX XXX XXX
1629 * Various messages are produced, and damage is applied.
1631 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1632 * actually be "made" of that substance, or "breathe" big balls of it.
1634 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1637 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1638 * and hurts evil less. If can breath nether, then it resists it as well.
1640 * Damage reductions use the following formulas:
1641 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1642 * gives avg damage of .655, ranging from .858 to .500
1643 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1644 * gives avg damage of .544, ranging from .714 to .417
1645 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1646 * gives avg damage of .444, ranging from .556 to .333
1647 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1648 * gives avg damage of .327, ranging from .427 to .250
1649 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1650 * gives something simple.
1652 * In this function, "result" messages are postponed until the end, where
1653 * the "note" string is appended to the monster name, if not NULL. So,
1654 * to make a spell have "no effect" just set "note" to NULL. You should
1655 * also set "notice" to FALSE, or the player will learn what the spell does.
1657 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1659 /* "flg" was added. */
1660 static bool project_m(int who, int r, int y, int x, int dam, int typ , int flg)
1664 cave_type *c_ptr = &cave[y][x];
1666 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1667 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1669 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1673 /* Is the monster "seen"? */
1674 bool seen = m_ptr->ml;
1675 bool seen_msg = is_seen(m_ptr);
1677 bool slept = (bool)(m_ptr->csleep > 0);
1679 /* Were the effects "obvious" (if seen)? */
1680 bool obvious = FALSE;
1682 /* Can the player know about this effect? */
1683 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1685 /* Can the player see the source of this effect? */
1686 bool see_s_msg = ((who <= 0) || is_seen(caster_ptr));
1688 /* Were the effects "irrelevant"? */
1689 bool skipped = FALSE;
1691 /* Gets the monster angry at the source of the effect? */
1692 bool get_angry = FALSE;
1694 /* Polymorph setting (true or false) */
1695 bool do_poly = FALSE;
1697 /* Teleport setting (max distance) */
1700 /* Confusion setting (amount to confuse) */
1703 /* Stunning setting (amount to stun) */
1706 /* Sleep amount (amount to sleep) */
1709 /* Fear amount (amount to fear) */
1712 /* Time amount (amount to time) */
1715 bool heal_leper = FALSE;
1717 /* Hold the monster name */
1726 /* Assume no note */
1729 /* Assume a default death */
1730 cptr note_dies = extract_note_dies(real_r_ptr(m_ptr));
1735 int caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1738 if (!c_ptr->m_idx) return (FALSE);
1740 /* Never affect projector */
1741 if (who && (c_ptr->m_idx == who)) return (FALSE);
1742 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1743 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1745 /* Don't affect already death monsters */
1746 /* Prevents problems with chain reactions of exploding monsters */
1747 if (m_ptr->hp < 0) return (FALSE);
1749 /* Reduce damage by distance */
1750 dam = (dam + r) / (r + 1);
1753 /* Get the monster name (BEFORE polymorphing) */
1754 monster_desc(m_name, m_ptr, 0);
1757 /* Get the monster possessive ("his"/"her"/"its") */
1758 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1762 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(1, 0);
1764 /* Analyze the damage type */
1767 /* Magic Missile -- pure damage */
1770 if (seen) obvious = TRUE;
1772 if (r_ptr->flagsr & RFR_RES_ALL)
1775 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1777 note = " is immune.";
1780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1789 if (seen) obvious = TRUE;
1791 if (r_ptr->flagsr & RFR_RES_ALL)
1794 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1796 note = " is immune.";
1799 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1802 if (r_ptr->flagsr & RFR_IM_ACID)
1805 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1807 note = " resists a lot.";
1811 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1819 if (seen) obvious = TRUE;
1821 if (r_ptr->flagsr & RFR_RES_ALL)
1824 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1826 note = " is immune.";
1829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1832 if (r_ptr->flagsr & RFR_IM_ELEC)
1835 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1837 note = " resists a lot.";
1841 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1849 if (seen) obvious = TRUE;
1851 if (r_ptr->flagsr & RFR_RES_ALL)
1854 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1856 note = " is immune.";
1859 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1862 if (r_ptr->flagsr & RFR_IM_FIRE)
1865 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1867 note = " resists a lot.";
1871 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1873 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1876 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1878 note = " is hit hard.";
1882 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1890 if (seen) obvious = TRUE;
1892 if (r_ptr->flagsr & RFR_RES_ALL)
1895 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1897 note = " is immune.";
1900 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1903 if (r_ptr->flagsr & RFR_IM_COLD)
1906 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1908 note = " resists a lot.";
1912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1914 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1917 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
1919 note = " is hit hard.";
1923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1931 if (seen) obvious = TRUE;
1933 if (r_ptr->flagsr & RFR_RES_ALL)
1936 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1938 note = " is immune.";
1941 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1944 if (r_ptr->flagsr & RFR_IM_POIS)
1947 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡ª";
1949 note = " resists a lot.";
1953 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1961 if (seen) obvious = TRUE;
1963 if (r_ptr->flagsr & RFR_RES_ALL)
1966 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1968 note = " is immune.";
1971 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1974 if (r_ptr->flagsr & RFR_IM_POIS)
1977 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
1982 dam *= 3; dam /= randint1(6) + 6;
1983 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1985 else if (one_in_(3)) do_poly = TRUE;
1989 /* Hellfire -- hurts Evil */
1992 if (seen) obvious = TRUE;
1994 if (r_ptr->flagsr & RFR_RES_ALL)
1997 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
1999 note = " is immune.";
2002 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2005 if (r_ptr->flags3 & RF3_GOOD)
2009 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2011 note = " is hit hard.";
2014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2019 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
2022 if (seen) obvious = TRUE;
2024 if (r_ptr->flagsr & RFR_RES_ALL)
2027 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2029 note = " is immune.";
2032 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2035 if (r_ptr->flags3 & RF3_GOOD)
2039 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2041 note = " is immune.";
2044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
2046 else if (r_ptr->flags3 & RF3_EVIL)
2050 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¼õ¤±¤¿¡£";
2052 note = " is hit hard.";
2055 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2060 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2065 dam *= 3; dam /= randint1(6) + 6;
2070 /* Arrow -- XXX no defense */
2073 if (seen) obvious = TRUE;
2075 if (r_ptr->flagsr & RFR_RES_ALL)
2078 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2080 note = " is immune.";
2083 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2089 /* Plasma -- XXX perhaps check ELEC or FIRE */
2092 if (seen) obvious = TRUE;
2094 if (r_ptr->flagsr & RFR_RES_ALL)
2097 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2099 note = " is immune.";
2102 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2105 if (r_ptr->flagsr & RFR_RES_PLAS)
2108 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2113 dam *= 3; dam /= randint1(6) + 6;
2114 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
2119 /* Nether -- see above */
2122 if (seen) obvious = TRUE;
2124 if (r_ptr->flagsr & RFR_RES_ALL)
2127 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2129 note = " is immune.";
2132 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2135 if (r_ptr->flagsr & RFR_RES_NETH)
2137 if (r_ptr->flags3 & RF3_UNDEAD)
2140 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2142 note = " is immune.";
2146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2151 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2156 dam *= 3; dam /= randint1(6) + 6;
2158 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
2160 else if (r_ptr->flags3 & RF3_EVIL)
2164 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2166 note = " resists somewhat.";
2169 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2174 /* Water (acid) damage -- Water spirits/elementals are immune */
2177 if (seen) obvious = TRUE;
2179 if (r_ptr->flagsr & RFR_RES_ALL)
2182 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2184 note = " is immune.";
2187 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2190 if (r_ptr->flagsr & RFR_RES_WATE)
2192 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
2195 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
2197 note = " is immune.";
2205 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2210 dam *= 3; dam /= randint1(6) + 6;
2212 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
2217 /* Chaos -- Chaos breathers resist */
2220 if (seen) obvious = TRUE;
2222 if (r_ptr->flagsr & RFR_RES_ALL)
2225 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2227 note = " is immune.";
2230 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2233 if (r_ptr->flagsr & RFR_RES_CHAO)
2236 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2241 dam *= 3; dam /= randint1(6) + 6;
2242 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
2244 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
2247 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2249 note = " resists somewhat.";
2252 dam *= 3; dam /= randint1(6) + 6;
2253 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2258 do_conf = (5 + randint1(11) + r) / (r + 1);
2263 /* Shards -- Shard breathers resist */
2266 if (seen) obvious = TRUE;
2268 if (r_ptr->flagsr & RFR_RES_ALL)
2271 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2273 note = " is immune.";
2276 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2279 if (r_ptr->flagsr & RFR_RES_SHAR)
2282 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2287 dam *= 3; dam /= randint1(6) + 6;
2288 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2293 /* Rocket: Shard resistance helps */
2296 if (seen) obvious = TRUE;
2298 if (r_ptr->flagsr & RFR_RES_ALL)
2301 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2303 note = " is immune.";
2306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2309 if (r_ptr->flagsr & RFR_RES_SHAR)
2312 note = "¤Ï¤¤¤¯¤é¤«ÂÑÀ¤ò¼¨¤·¤¿¡£";
2314 note = " resists somewhat.";
2318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
2324 /* Sound -- Sound breathers resist */
2327 if (seen) obvious = TRUE;
2329 if (r_ptr->flagsr & RFR_RES_ALL)
2332 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2334 note = " is immune.";
2337 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2340 if (r_ptr->flagsr & RFR_RES_SOUN)
2343 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2348 dam *= 2; dam /= randint1(6) + 6;
2349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
2351 else do_stun = (10 + randint1(15) + r) / (r + 1);
2358 if (seen) obvious = TRUE;
2360 if (r_ptr->flagsr & RFR_RES_ALL)
2363 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2365 note = " is immune.";
2368 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2371 if (r_ptr->flags3 & RF3_NO_CONF)
2374 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2379 dam *= 3; dam /= randint1(6) + 6;
2380 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2382 else do_conf = (10 + randint1(15) + r) / (r + 1);
2386 /* Disenchantment -- Breathers and Disenchanters resist */
2389 if (seen) obvious = TRUE;
2391 if (r_ptr->flagsr & RFR_RES_ALL)
2394 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2396 note = " is immune.";
2399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2402 if (r_ptr->flagsr & RFR_RES_DISE)
2405 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2410 dam *= 3; dam /= randint1(6) + 6;
2411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
2416 /* Nexus -- Breathers and Existers resist */
2419 if (seen) obvious = TRUE;
2421 if (r_ptr->flagsr & RFR_RES_ALL)
2424 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2426 note = " is immune.";
2429 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2432 if (r_ptr->flagsr & RFR_RES_NEXU)
2435 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2440 dam *= 3; dam /= randint1(6) + 6;
2441 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
2449 if (seen) obvious = TRUE;
2451 if (r_ptr->flagsr & RFR_RES_ALL)
2454 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2456 note = " is immune.";
2459 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2462 if (r_ptr->flagsr & RFR_RES_WALL)
2465 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2470 dam *= 3; dam /= randint1(6) + 6;
2471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
2473 else do_stun = (randint1(15) + r) / (r + 1);
2477 /* Inertia -- breathers resist */
2480 if (seen) obvious = TRUE;
2482 if (r_ptr->flagsr & RFR_RES_ALL)
2485 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2487 note = " is immune.";
2490 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2493 if (r_ptr->flagsr & RFR_RES_INER)
2496 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2501 dam *= 3; dam /= randint1(6) + 6;
2502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
2506 /* Powerful monsters can resist */
2507 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2508 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2512 /* Normal monsters slow down */
2518 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2520 note = " starts moving slower.";
2523 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2524 if (c_ptr->m_idx == p_ptr->riding)
2525 p_ptr->update |= (PU_BONUS);
2531 /* Time -- breathers resist */
2534 if (seen) obvious = TRUE;
2536 if (r_ptr->flagsr & RFR_RES_ALL)
2539 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2541 note = " is immune.";
2544 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2547 if (r_ptr->flagsr & RFR_RES_TIME)
2550 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2555 dam *= 3; dam /= randint1(6) + 6;
2556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
2558 else do_time = (dam + 1) / 2;
2562 /* Gravity -- breathers resist */
2565 bool resist_tele = FALSE;
2567 if (seen) obvious = TRUE;
2569 if (r_ptr->flagsr & RFR_RES_ALL)
2572 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2574 note = " is immune.";
2577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2580 if (r_ptr->flagsr & RFR_RES_TELE)
2582 if (r_ptr->flags1 & (RF1_UNIQUE))
2584 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2586 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2588 note = " is unaffected!";
2593 else if (r_ptr->level > randint1(100))
2595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2597 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
2606 if (!resist_tele) do_dist = 10;
2608 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2610 if (r_ptr->flagsr & RFR_RES_GRAV)
2613 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2618 dam *= 3; dam /= randint1(6) + 6;
2620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
2625 /* Powerful monsters can resist */
2626 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2627 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2631 /* Normal monsters slow down */
2637 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
2639 note = " starts moving slower.";
2642 m_ptr->slow = MIN(200, m_ptr->slow + 50);
2643 if (c_ptr->m_idx == p_ptr->riding)
2644 p_ptr->update |= (PU_BONUS);
2648 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2650 /* Attempt a saving throw */
2651 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2652 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2656 /* No obvious effect */
2658 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2660 note = " is unaffected!";
2674 if (seen) obvious = TRUE;
2676 if (r_ptr->flagsr & RFR_RES_ALL)
2679 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2681 note = " is immune.";
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2692 case GF_DISINTEGRATE:
2694 if (seen) obvious = TRUE;
2696 if (r_ptr->flagsr & RFR_RES_ALL)
2699 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2701 note = " is immune.";
2704 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2707 if (r_ptr->flags3 & RF3_HURT_ROCK)
2709 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2711 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
2712 note_dies = "¤Ï¾øȯ¤·¤¿¡ª";
2714 note = " loses some skin!";
2715 note_dies = " evaporates!";
2725 if (seen) obvious = TRUE;
2727 /* PSI only works if the monster can see you! -- RG */
2728 if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
2731 if (seen_msg) msg_format("%s¤Ï¤¢¤Ê¤¿¤¬¸«¤¨¤Ê¤¤¤Î¤Ç±Æ¶Á¤µ¤ì¤Ê¤¤¡ª", m_name);
2733 if (seen_msg) msg_format("%^s can't see you, and isn't affected!", m_name);
2739 if (r_ptr->flagsr & RFR_RES_ALL)
2742 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2744 note = " is immune.";
2747 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2750 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2754 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2756 note = " is immune!";
2758 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2761 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2762 (r_ptr->flags3 & RF3_ANIMAL) ||
2763 (r_ptr->level > randint1(3 * dam)))
2767 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2774 * Powerful demons & undead can turn a mindcrafter's
2775 * attacks back on them
2777 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2778 (r_ptr->level > p_ptr->lev / 2) &&
2783 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2785 msg_format("%^s%s corrupted mind backlashes your attack!",
2786 m_name, (seen ? "'s" : "s"));
2790 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2793 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2795 msg_print("You resist the effects!");
2801 /* Injure +/- confusion */
2802 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2803 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2806 switch (randint1(4))
2809 set_confused(p_ptr->confused + 3 + randint1(dam));
2812 set_stun(p_ptr->stun + randint1(dam));
2816 if (r_ptr->flags3 & RF3_NO_FEAR)
2818 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
2820 note = " is unaffected.";
2824 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2828 if (!p_ptr->free_act)
2829 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2838 if ((dam > 0) && one_in_(4))
2840 switch (randint1(4))
2843 do_conf = 3 + randint1(dam);
2846 do_stun = 3 + randint1(dam);
2849 do_fear = 3 + randint1(dam);
2853 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
2855 note = " falls asleep!";
2858 do_sleep = 3 + randint1(dam);
2864 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2866 note_dies = " collapses, a mindless husk.";
2874 if (seen) obvious = TRUE;
2876 if (r_ptr->flagsr & RFR_RES_ALL)
2879 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2881 note = " is immune.";
2884 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2887 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2891 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2893 note = " is immune!";
2897 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2898 (r_ptr->flags3 & RF3_ANIMAL) ||
2899 (r_ptr->level > randint1(3 * dam)))
2903 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
2910 * Powerful demons & undead can turn a mindcrafter's
2911 * attacks back on them
2913 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2914 (r_ptr->level > p_ptr->lev / 2) &&
2919 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
2921 msg_format("%^s%s corrupted mind backlashes your attack!",
2922 m_name, (seen ? "'s" : "s"));
2926 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2929 msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
2931 msg_print("You resist the effects!");
2937 /* Injure + mana drain */
2938 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2940 msg_print("ĶǽÎϥѥ¤òµÛ¤¤¤È¤é¤ì¤¿¡ª");
2942 msg_print("Your psychic energy is drained!");
2945 p_ptr->csp -= damroll(5, dam) / 2;
2946 if (p_ptr->csp < 0) p_ptr->csp = 0;
2947 p_ptr->redraw |= PR_MANA;
2948 p_ptr->window |= (PW_SPELL);
2949 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2956 int b = damroll(5, dam) / 4;
2958 msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¶ìÄˤòĶǽÎϥѥ¤ËÊÑ´¹¤·¤¿¡ª", m_name);
2960 msg_format("You convert %s%s pain into psychic energy!",
2961 m_name, (seen ? "'s" : "s"));
2964 b = MIN(p_ptr->msp, p_ptr->csp + b);
2966 p_ptr->redraw |= PR_MANA;
2967 p_ptr->window |= (PW_SPELL);
2971 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
2973 note_dies = " collapses, a mindless husk.";
2979 case GF_TELEKINESIS:
2981 if (seen) obvious = TRUE;
2983 if (r_ptr->flagsr & RFR_RES_ALL)
2986 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
2988 note = " is immune.";
2991 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2996 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
3001 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
3003 /* Attempt a saving throw */
3004 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3005 (r_ptr->level > 5 + randint1(dam)))
3009 /* No obvious effect */
3015 /* Psycho-spear -- powerful magic missile */
3018 if (seen) obvious = TRUE;
3020 if (r_ptr->flagsr & RFR_RES_ALL)
3023 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3025 note = " is immune.";
3028 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3034 /* Meteor -- powerful magic missile */
3037 if (seen) obvious = TRUE;
3039 if (r_ptr->flagsr & RFR_RES_ALL)
3042 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3044 note = " is immune.";
3047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3055 if (!is_hostile(m_ptr)) break;
3057 if (seen) obvious = TRUE;
3059 if (r_ptr->flagsr & RFR_RES_ALL)
3062 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3064 note = " is immune.";
3067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3070 /* Attempt a saving throw */
3071 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
3072 (r_ptr->flags3 & RF3_NO_CONF) ||
3073 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3075 /* Memorize a flag */
3076 if (r_ptr->flags3 & RF3_NO_CONF)
3078 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3085 * Powerful demons & undead can turn a mindcrafter's
3086 * attacks back on them
3088 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
3089 (r_ptr->level > p_ptr->lev / 2) &&
3094 msg_format("%^s¤ÎÂÄÍ¤¿Àº¿À¤Ï¹¶·â¤òÄ·¤ÍÊÖ¤·¤¿¡ª", m_name);
3096 msg_format("%^s%s corrupted mind backlashes your attack!",
3097 m_name, (seen ? "'s" : "s"));
3101 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
3104 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
3106 msg_print("You resist the effects!");
3112 /* Confuse, stun, terrify */
3113 switch (randint1(4))
3116 set_stun(p_ptr->stun + dam / 2);
3119 set_confused(p_ptr->confused + dam / 2);
3123 if (r_ptr->flags3 & RF3_NO_FEAR)
3125 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3127 note = " is unaffected.";
3131 set_afraid(p_ptr->afraid + dam);
3138 /* No obvious effect */
3140 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3142 note = " is unaffected!";
3150 if ((dam > 29) && (randint1(100) < dam))
3153 note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
3155 note = " is in your thrall!";
3162 switch (randint1(4))
3176 /* No "real" damage */
3183 /* Ice -- Cold + Cuts + Stun */
3186 if (seen) obvious = TRUE;
3188 if (r_ptr->flagsr & RFR_RES_ALL)
3191 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3193 note = " is immune.";
3196 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3199 do_stun = (randint1(15) + 1) / (r + 1);
3200 if (r_ptr->flagsr & RFR_IM_COLD)
3203 note = "¤Ë¤Ï¤«¤Ê¤êÂÑÀ¤¬¤¢¤ë¡£";
3205 note = " resists a lot.";
3209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
3211 else if (r_ptr->flags3 & (RF3_HURT_COLD))
3214 note = "¤Ï¤Ò¤É¤¤Ä˼ê¤ò¤¦¤±¤¿¡£";
3216 note = " is hit hard.";
3220 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
3229 if (seen) obvious = TRUE;
3231 if (r_ptr->flagsr & RFR_RES_ALL)
3234 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3236 note = " is immune.";
3239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3242 if (!monster_living(r_ptr))
3244 if (is_original_ap_and_seen(m_ptr))
3246 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3247 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3248 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3252 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3254 note = " is unaffected!";
3260 else do_time = (dam+7)/8;
3268 if (seen) obvious = TRUE;
3270 if (r_ptr->flagsr & RFR_RES_ALL)
3273 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
3275 note = " is immune.";
3278 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3281 if (!monster_living(r_ptr))
3283 if (is_original_ap_and_seen(m_ptr))
3285 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
3286 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
3287 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
3291 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡£";
3293 note = " is immune.";
3299 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
3300 (randint1(888) != 666)) ||
3301 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
3302 randint1(100) != 66))
3305 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
3317 /* Polymorph monster (Use "dam" as "power") */
3320 if (seen) obvious = TRUE;
3322 if (r_ptr->flagsr & RFR_RES_ALL)
3325 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3327 note = " is immune.";
3330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3333 /* Attempt to polymorph (see below) */
3336 /* Powerful monsters can resist */
3337 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3338 (r_ptr->flags1 & RF1_QUESTOR) ||
3339 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3342 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3344 note = " is unaffected!";
3351 /* No "real" damage */
3358 /* Clone monsters (Ignore "dam") */
3361 if (seen) obvious = TRUE;
3363 if (is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
3366 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
3368 note = " is unaffected!";
3374 m_ptr->hp = m_ptr->maxhp;
3376 /* Attempt to clone. */
3377 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
3380 note = "¤¬Ê¬Îö¤·¤¿¡ª";
3388 /* No "real" damage */
3395 /* Heal Monster (use "dam" as amount of healing) */
3398 if (seen) obvious = TRUE;
3403 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3405 if (m_ptr->maxhp < m_ptr->max_maxhp)
3408 if (seen_msg) msg_format("%^s¤Î¶¯¤µ¤¬Ìá¤Ã¤¿¡£", m_name);
3410 if (seen_msg) msg_format("%^s recovers %s vitality.", m_name, m_poss);
3412 m_ptr->maxhp = m_ptr->max_maxhp;
3418 if (seen) obvious = TRUE;
3423 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
3428 if (seen_msg) msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3430 if (seen_msg) msg_format("%^s is no longer stunned.", m_name);
3434 if (m_ptr->confused)
3437 if (seen_msg) msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
3439 if (seen_msg) msg_format("%^s is no longer confused.", m_name);
3441 m_ptr->confused = 0;
3446 if (seen_msg) msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
3448 if (seen_msg) msg_format("%^s recovers %s courage.", m_name, m_poss);
3454 if (m_ptr->hp < 30000) m_ptr->hp += dam;
3457 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3461 chg_virtue(V_VITALITY, 1);
3463 if (r_ptr->flags1 & RF1_UNIQUE)
3464 chg_virtue(V_INDIVIDUALISM, 1);
3466 if (is_friendly(m_ptr))
3467 chg_virtue(V_HONOUR, 1);
3468 else if (!(r_ptr->flags3 & RF3_EVIL))
3470 if (r_ptr->flags3 & RF3_GOOD)
3471 chg_virtue(V_COMPASSION, 2);
3473 chg_virtue(V_COMPASSION, 1);
3476 if (r_ptr->flags3 & RF3_ANIMAL)
3477 chg_virtue(V_NATURE, 1);
3480 if (m_ptr->r_idx == MON_LEPER)
3483 if (!who) chg_virtue(V_COMPASSION, 5);
3486 /* Redraw (later) if needed */
3487 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3488 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3492 note = "¤ÏÂÎÎϤò²óÉü¤·¤¿¤è¤¦¤À¡£";
3494 note = " looks healthier.";
3498 /* No "real" damage */
3504 /* Speed Monster (Ignore "dam") */
3507 if (seen) obvious = TRUE;
3513 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
3515 note = " starts moving faster.";
3518 m_ptr->fast = MIN(200, m_ptr->fast + 100);
3520 if (c_ptr->m_idx == p_ptr->riding)
3521 p_ptr->update |= (PU_BONUS);
3525 if (r_ptr->flags1 & RF1_UNIQUE)
3526 chg_virtue(V_INDIVIDUALISM, 1);
3527 if (is_friendly(m_ptr))
3528 chg_virtue(V_HONOUR, 1);
3531 /* No "real" damage */
3537 /* Slow Monster (Use "dam" as "power") */
3540 if (seen) obvious = TRUE;
3542 if (r_ptr->flagsr & RFR_RES_ALL)
3545 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3547 note = " is immune.";
3550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3553 /* Powerful monsters can resist */
3554 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3555 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3558 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3560 note = " is unaffected!";
3566 /* Normal monsters slow down */
3572 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
3574 note = " starts moving slower.";
3577 m_ptr->slow = MIN(200, m_ptr->slow + 50);
3579 if (c_ptr->m_idx == p_ptr->riding)
3580 p_ptr->update |= (PU_BONUS);
3583 /* No "real" damage */
3589 /* Sleep (Use "dam" as "power") */
3592 if (seen) obvious = TRUE;
3594 if (r_ptr->flagsr & RFR_RES_ALL)
3597 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3599 note = " is immune.";
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3605 /* Attempt a saving throw */
3606 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3607 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3608 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3610 /* Memorize a flag */
3611 if (r_ptr->flags3 & RF3_NO_SLEEP)
3613 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3616 /* No obvious effect */
3618 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3620 note = " is unaffected!";
3627 /* Go to sleep (much) later */
3629 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
3631 note = " falls asleep!";
3637 /* No "real" damage */
3643 /* Sleep (Use "dam" as "power") */
3644 case GF_STASIS_EVIL:
3646 if (seen) obvious = TRUE;
3648 if (r_ptr->flagsr & RFR_RES_ALL)
3651 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3653 note = " is immune.";
3656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3659 /* Attempt a saving throw */
3660 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3661 !(r_ptr->flags3 & RF3_EVIL) ||
3662 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3665 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3667 note = " is unaffected!";
3674 /* Go to sleep (much) later */
3676 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3678 note = " is suspended!";
3684 /* No "real" damage */
3689 /* Sleep (Use "dam" as "power") */
3692 if (seen) obvious = TRUE;
3694 if (r_ptr->flagsr & RFR_RES_ALL)
3697 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3699 note = " is immune.";
3702 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3705 /* Attempt a saving throw */
3706 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3707 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3710 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3712 note = " is unaffected!";
3719 /* Go to sleep (much) later */
3721 note = "¤ÏÆ°¤±¤Ê¤¯¤Ê¤Ã¤¿¡ª";
3723 note = " is suspended!";
3729 /* No "real" damage */
3738 dam += (adj_con_fix[p_ptr->stat_ind[A_CHR]] - 1);
3739 vir = virtue_number(V_HARMONY);
3742 dam += p_ptr->virtues[vir-1]/10;
3745 vir = virtue_number(V_INDIVIDUALISM);
3748 dam -= p_ptr->virtues[vir-1]/20;
3751 if (seen) obvious = TRUE;
3753 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3756 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3758 note = " is immune.";
3761 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3765 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3768 /* Attempt a saving throw */
3769 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3770 (r_ptr->flags3 & RF3_NO_CONF) ||
3771 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3772 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
3774 /* Memorize a flag */
3775 if (r_ptr->flags3 & RF3_NO_CONF)
3777 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3781 /* No obvious effect */
3783 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3785 note = " is unaffected!";
3790 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3792 else if (p_ptr->cursed & TRC_AGGRAVATE)
3795 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3797 note = " hates you too much!";
3800 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3805 note = "¤ÏÆÍÁ³Í§¹¥Åª¤Ë¤Ê¤Ã¤¿¤è¤¦¤À¡ª";
3807 note = " suddenly seems friendly!";
3812 chg_virtue(V_INDIVIDUALISM, -1);
3813 if (r_ptr->flags3 & RF3_ANIMAL)
3814 chg_virtue(V_NATURE, 1);
3817 /* No "real" damage */
3822 /* Control undead */
3823 case GF_CONTROL_UNDEAD:
3826 if (seen) obvious = TRUE;
3828 vir = virtue_number(V_UNLIFE);
3831 dam += p_ptr->virtues[vir-1]/10;
3834 vir = virtue_number(V_INDIVIDUALISM);
3837 dam -= p_ptr->virtues[vir-1]/20;
3840 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3843 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3845 note = " is immune.";
3848 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3852 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3855 /* Attempt a saving throw */
3856 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3857 (!(r_ptr->flags3 & RF3_UNDEAD)) ||
3858 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3859 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3861 /* No obvious effect */
3863 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3865 note = " is unaffected!";
3869 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3871 else if (p_ptr->cursed & TRC_AGGRAVATE)
3874 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3876 note = " hates you too much!";
3879 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3884 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3886 note = " is in your thrall!";
3892 /* No "real" damage */
3898 case GF_CONTROL_DEMON:
3901 if (seen) obvious = TRUE;
3903 vir = virtue_number(V_UNLIFE);
3906 dam += p_ptr->virtues[vir-1]/10;
3909 vir = virtue_number(V_INDIVIDUALISM);
3912 dam -= p_ptr->virtues[vir-1]/20;
3915 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3918 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3920 note = " is immune.";
3923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3927 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
3930 /* Attempt a saving throw */
3931 if ((r_ptr->flags1 & RF1_QUESTOR) ||
3932 (!(r_ptr->flags3 & RF3_DEMON)) ||
3933 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3934 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3936 /* No obvious effect */
3938 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3940 note = " is unaffected!";
3944 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3946 else if (p_ptr->cursed & TRC_AGGRAVATE)
3949 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
3951 note = " hates you too much!";
3954 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3959 note = "¤Ï´û¤Ë¤¢¤Ê¤¿¤ÎÅÛÎì¤À¡ª";
3961 note = " is in your thrall!";
3967 /* No "real" damage */
3973 case GF_CONTROL_ANIMAL:
3977 if (seen) obvious = TRUE;
3979 vir = virtue_number(V_NATURE);
3982 dam += p_ptr->virtues[vir-1]/10;
3985 vir = virtue_number(V_INDIVIDUALISM);
3988 dam -= p_ptr->virtues[vir-1]/20;
3991 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
3994 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
3996 note = " is immune.";
3999 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4003 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4006 /* Attempt a saving throw */
4007 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4008 (!(r_ptr->flags3 & (RF3_ANIMAL))) ||
4009 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4010 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4011 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4013 /* Memorize a flag */
4014 if (r_ptr->flags3 & (RF3_NO_CONF))
4016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4020 /* No obvious effect */
4022 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4024 note = " is unaffected!";
4028 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4030 else if (p_ptr->cursed & TRC_AGGRAVATE)
4033 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4035 note = " hates you too much!";
4038 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4043 note = "¤Ï¤Ê¤Ä¤¤¤¿¡£";
4045 note = " is tamed!";
4050 if (r_ptr->flags3 & RF3_ANIMAL)
4051 chg_virtue(V_NATURE, 1);
4054 /* No "real" damage */
4060 case GF_CONTROL_LIVING:
4064 vir = virtue_number(V_UNLIFE);
4065 if (seen) obvious = TRUE;
4067 dam += (adj_chr_chm[p_ptr->stat_ind[A_CHR]]);
4068 vir = virtue_number(V_UNLIFE);
4071 dam -= p_ptr->virtues[vir-1]/10;
4074 vir = virtue_number(V_INDIVIDUALISM);
4077 dam -= p_ptr->virtues[vir-1]/20;
4080 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 30;
4081 if (dam < 1) dam = 1;
4083 msg_format("%s¤ò¸«¤Ä¤á¤¿¡£",m_name);
4085 msg_format("You stare into %s.", m_name);
4087 if ((r_ptr->flagsr & RFR_RES_ALL) || p_ptr->inside_arena)
4090 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4092 note = " is immune.";
4095 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4099 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL))
4102 /* Attempt a saving throw */
4103 if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4104 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4105 !monster_living(r_ptr) ||
4106 ((r_ptr->level+10) > randint1(dam)))
4109 /* No obvious effect */
4111 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4113 note = " is unaffected!";
4117 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4119 else if (p_ptr->cursed & TRC_AGGRAVATE)
4122 note = "¤Ï¤¢¤Ê¤¿¤ËŨ°Õ¤òÊú¤¤¤Æ¤¤¤ë¡ª";
4124 note = " hates you too much!";
4127 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4132 note = "¤ò»ÙÇÛ¤·¤¿¡£";
4134 note = " is tamed!";
4139 if (r_ptr->flags3 & RF3_ANIMAL)
4140 chg_virtue(V_NATURE, 1);
4143 /* No "real" damage */
4148 /* Confusion (Use "dam" as "power") */
4151 if (seen) obvious = TRUE;
4153 if (r_ptr->flagsr & RFR_RES_ALL)
4156 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4158 note = " is immune.";
4161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4164 /* Get confused later */
4165 do_conf = damroll(3, (dam / 2)) + 1;
4167 /* Attempt a saving throw */
4168 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4169 (r_ptr->flags3 & (RF3_NO_CONF)) ||
4170 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4172 /* Memorize a flag */
4173 if (r_ptr->flags3 & (RF3_NO_CONF))
4175 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
4181 /* No obvious effect */
4183 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4185 note = " is unaffected!";
4191 /* No "real" damage */
4198 if (seen) obvious = TRUE;
4200 if (r_ptr->flagsr & RFR_RES_ALL)
4203 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4205 note = " is immune.";
4208 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4211 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
4213 /* Attempt a saving throw */
4214 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4215 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4220 /* No obvious effect */
4222 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4224 note = " is unaffected!";
4230 /* No "real" damage */
4238 /* Lite, but only hurts susceptible creatures */
4246 if (r_ptr->flagsr & RFR_RES_ALL)
4252 if (r_ptr->flags3 & (RF3_HURT_LITE))
4254 /* Obvious effect */
4255 if (seen) obvious = TRUE;
4257 /* Memorize the effects */
4258 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4260 /* Special effect */
4262 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4263 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4265 note = " cringes from the light!";
4266 note_dies = " shrivels away in the light!";
4271 /* Normally no damage */
4283 /* Lite -- opposite of Dark */
4286 if (seen) obvious = TRUE;
4288 if (r_ptr->flagsr & RFR_RES_ALL)
4291 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4293 note = " is immune.";
4296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4299 if (r_ptr->flagsr & RFR_RES_LITE)
4302 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4307 dam *= 2; dam /= (randint1(6)+6);
4308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
4310 else if (r_ptr->flags3 & (RF3_HURT_LITE))
4312 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4314 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
4315 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
4317 note = " cringes from the light!";
4318 note_dies = " shrivels away in the light!";
4327 /* Dark -- opposite of Lite */
4330 if (seen) obvious = TRUE;
4332 if (r_ptr->flagsr & RFR_RES_ALL)
4335 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4337 note = " is immune.";
4340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4343 if (r_ptr->flagsr & RFR_RES_DARK)
4346 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4351 dam *= 2; dam /= (randint1(6)+6);
4352 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
4361 if (r_ptr->flagsr & RFR_RES_ALL)
4366 /* Hurt by rock remover */
4367 if (r_ptr->flags3 & (RF3_HURT_ROCK))
4370 if (seen) obvious = TRUE;
4372 /* Memorize the effects */
4373 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
4375 /* Cute little message */
4377 note = "¤ÎÈéÉ椬¤¿¤À¤ì¤¿¡ª";
4378 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4380 note = " loses some skin!";
4381 note_dies = " dissolves!";
4386 /* Usually, ignore the effects */
4397 /* Teleport undead (Use "dam" as "power") */
4398 case GF_AWAY_UNDEAD:
4400 /* Only affect undead */
4401 if (r_ptr->flags3 & (RF3_UNDEAD))
4403 bool resists_tele = FALSE;
4405 if (r_ptr->flagsr & RFR_RES_TELE)
4407 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4409 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4411 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4413 note = " is unaffected!";
4416 resists_tele = TRUE;
4418 else if (r_ptr->level > randint1(100))
4420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4422 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4427 resists_tele = TRUE;
4433 if (seen) obvious = TRUE;
4434 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4446 /* No "real" damage */
4452 /* Teleport evil (Use "dam" as "power") */
4455 /* Only affect evil */
4456 if (r_ptr->flags3 & (RF3_EVIL))
4458 bool resists_tele = FALSE;
4460 if (r_ptr->flagsr & RFR_RES_TELE)
4462 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4466 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4468 note = " is unaffected!";
4471 resists_tele = TRUE;
4473 else if (r_ptr->level > randint1(100))
4475 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4477 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4482 resists_tele = TRUE;
4488 if (seen) obvious = TRUE;
4489 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4501 /* No "real" damage */
4507 /* Teleport monster (Use "dam" as "power") */
4510 bool resists_tele = FALSE;
4511 if (r_ptr->flagsr & RFR_RES_TELE)
4513 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
4515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4517 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4519 note = " is unaffected!";
4522 resists_tele = TRUE;
4524 else if (r_ptr->level > randint1(100))
4526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
4528 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
4533 resists_tele = TRUE;
4540 if (seen) obvious = TRUE;
4542 /* Prepare to teleport */
4546 /* No "real" damage */
4552 /* Turn undead (Use "dam" as "power") */
4553 case GF_TURN_UNDEAD:
4555 if (r_ptr->flagsr & RFR_RES_ALL)
4560 /* Only affect undead */
4561 if (r_ptr->flags3 & (RF3_UNDEAD))
4564 if (seen) obvious = TRUE;
4566 /* Learn about type */
4567 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4569 /* Apply some fear */
4570 do_fear = damroll(3, (dam / 2)) + 1;
4572 /* Attempt a saving throw */
4573 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4575 /* No obvious effect */
4577 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4579 note = " is unaffected!";
4594 /* No "real" damage */
4600 /* Turn evil (Use "dam" as "power") */
4603 if (r_ptr->flagsr & RFR_RES_ALL)
4608 /* Only affect evil */
4609 if (r_ptr->flags3 & (RF3_EVIL))
4612 if (seen) obvious = TRUE;
4614 /* Learn about type */
4615 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4617 /* Apply some fear */
4618 do_fear = damroll(3, (dam / 2)) + 1;
4620 /* Attempt a saving throw */
4621 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
4623 /* No obvious effect */
4625 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4627 note = " is unaffected!";
4642 /* No "real" damage */
4648 /* Turn monster (Use "dam" as "power") */
4651 if (r_ptr->flagsr & RFR_RES_ALL)
4657 if (seen) obvious = TRUE;
4659 /* Apply some fear */
4660 do_fear = damroll(3, (dam / 2)) + 1;
4662 /* Attempt a saving throw */
4663 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4664 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
4665 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4667 /* No obvious effect */
4669 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
4671 note = " is unaffected!";
4678 /* No "real" damage */
4685 case GF_DISP_UNDEAD:
4687 if (r_ptr->flagsr & RFR_RES_ALL)
4693 /* Only affect undead */
4694 if (r_ptr->flags3 & (RF3_UNDEAD))
4697 if (seen) obvious = TRUE;
4699 /* Learn about type */
4700 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
4704 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4705 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4707 note = " shudders.";
4708 note_dies = " dissolves!";
4729 if (r_ptr->flagsr & RFR_RES_ALL)
4735 /* Only affect evil */
4736 if (r_ptr->flags3 & (RF3_EVIL))
4739 if (seen) obvious = TRUE;
4741 /* Learn about type */
4742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
4746 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4747 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4749 note = " shudders.";
4750 note_dies = " dissolves!";
4770 if (r_ptr->flagsr & RFR_RES_ALL)
4776 /* Only affect good */
4777 if (r_ptr->flags3 & (RF3_GOOD))
4780 if (seen) obvious = TRUE;
4782 /* Learn about type */
4783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4787 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4788 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4790 note = " shudders.";
4791 note_dies = " dissolves!";
4809 case GF_DISP_LIVING:
4811 if (r_ptr->flagsr & RFR_RES_ALL)
4817 /* Only affect non-undead */
4818 if (monster_living(r_ptr))
4821 if (seen) obvious = TRUE;
4825 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4826 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4828 note = " shudders.";
4829 note_dies = " dissolves!";
4850 if (r_ptr->flagsr & RFR_RES_ALL)
4856 /* Only affect demons */
4857 if (r_ptr->flags3 & (RF3_DEMON))
4860 if (seen) obvious = TRUE;
4862 /* Learn about type */
4863 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
4867 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4868 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4870 note = " shudders.";
4871 note_dies = " dissolves!";
4888 /* Dispel monster */
4891 if (r_ptr->flagsr & RFR_RES_ALL)
4898 if (seen) obvious = TRUE;
4902 note = "¤Ï¿È¿Ì¤¤¤·¤¿¡£";
4903 note_dies = "¤Ï¥É¥í¥É¥í¤ËÍϤ±¤¿¡ª";
4905 note = " shudders.";
4906 note_dies = " dissolves!";
4916 if (seen) obvious = TRUE;
4918 if (r_ptr->flagsr & RFR_RES_ALL)
4921 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4923 note = " is immune.";
4926 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4930 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
4934 /* Heal the monster */
4935 if (caster_ptr->hp < caster_ptr->maxhp)
4938 caster_ptr->hp += 6 * dam;
4939 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
4941 /* Redraw (later) if needed */
4942 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4943 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4945 /* Special message */
4948 /* Get the monster name */
4949 monster_desc(killer, caster_ptr, 0);
4951 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", killer);
4953 msg_format("%^s appears healthier.", killer);
4962 msg_format("%s¤«¤éÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¤È¤Ã¤¿¡£", m_name);
4964 msg_format("You draw psychic energy from %s.", m_name);
4967 (void)hp_player(dam);
4973 if (see_s_msg) msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
4975 if (see_s_msg) msg_format("%s is unaffected.", m_name);
4985 if (seen) obvious = TRUE;
4988 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
4990 if (!who) msg_format("You gaze intently at %s.", m_name);
4993 if (r_ptr->flagsr & RFR_RES_ALL)
4996 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
4998 note = " is immune.";
5001 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5005 /* Attempt a saving throw */
5006 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5007 (r_ptr->flags3 & RF3_NO_CONF) ||
5008 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5010 /* Memorize a flag */
5011 if (r_ptr->flags3 & (RF3_NO_CONF))
5013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5016 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5018 note = "is unaffected!";
5022 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5024 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5026 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5028 note = " is immune!";
5032 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5034 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5036 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5045 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5046 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5048 note = " is blasted by psionic energy.";
5049 note_dies = " collapses, a mindless husk.";
5052 if (who > 0) do_conf = randint0(4) + 4;
5053 else do_conf = randint0(8) + 8;
5059 case GF_BRAIN_SMASH:
5061 if (seen) obvious = TRUE;
5064 if (!who) msg_format("%s¤ò¤¸¤Ã¤Èâˤó¤À¡£", m_name);
5066 if (!who) msg_format("You gaze intently at %s.", m_name);
5069 if (r_ptr->flagsr & RFR_RES_ALL)
5072 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5074 note = " is immune.";
5077 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5081 /* Attempt a saving throw */
5082 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5083 (r_ptr->flags3 & RF3_NO_CONF) ||
5084 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
5086 /* Memorize a flag */
5087 if (r_ptr->flags3 & (RF3_NO_CONF))
5089 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
5092 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5094 note = "is unaffected!";
5098 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
5100 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5102 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5104 note = " is immune!";
5108 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
5110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
5112 note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
5121 note = "¤ÏÀº¿À¹¶·â¤ò¿©¤é¤Ã¤¿¡£";
5122 note_dies = "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±³Ì¤È¤Ê¤Ã¤¿¡£";
5124 note = " is blasted by psionic energy.";
5125 note_dies = " collapses, a mindless husk.";
5130 do_conf = randint0(4) + 4;
5131 do_stun = randint0(4) + 4;
5135 do_conf = randint0(8) + 8;
5136 do_stun = randint0(8) + 8;
5138 m_ptr->slow = MIN(200, m_ptr->slow + 10);
5139 if (c_ptr->m_idx == p_ptr->riding)
5140 p_ptr->update |= (PU_BONUS);
5148 if (seen) obvious = TRUE;
5151 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5153 if (!who) msg_format("You point at %s and curses.", m_name);
5156 if (r_ptr->flagsr & RFR_RES_ALL)
5159 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5161 note = " is immune.";
5164 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5168 /* Attempt a saving throw */
5169 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5172 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5174 note = "is unaffected!";
5184 if (seen) obvious = TRUE;
5187 if (!who) msg_format("%s¤ò»Øº¹¤·¤Æ¶²¤í¤·¤²¤Ë¼ö¤¤¤ò¤«¤±¤¿¡£", m_name);
5189 if (!who) msg_format("You point at %s and curses horribly.", m_name);
5192 if (r_ptr->flagsr & RFR_RES_ALL)
5195 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5197 note = " is immune.";
5200 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5204 /* Attempt a saving throw */
5205 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5208 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5210 note = "is unaffected!";
5220 if (seen) obvious = TRUE;
5223 if (!who) msg_format("%s¤ò»Øº¹¤·¡¢¶²¤í¤·¤²¤Ë¼öʸ¤ò¾§¤¨¤¿¡ª", m_name);
5225 if (!who) msg_format("You point at %s, incanting terribly!", m_name);
5228 if (r_ptr->flagsr & RFR_RES_ALL)
5231 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5233 note = " is immune.";
5236 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5240 /* Attempt a saving throw */
5241 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
5244 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5246 note = "is unaffected!";
5256 if (seen) obvious = TRUE;
5259 if (!who) msg_format("%s¤ÎÈ빦¤òÆͤ¤¤Æ¡¢¡Ö¤ªÁ°¤Ï´û¤Ë»à¤ó¤Ç¤¤¤ë¡×¤È¶«¤ó¤À¡£", m_name);
5261 if (!who) msg_format("You point at %s, screaming the word, 'DIE!'.", m_name);
5264 if (r_ptr->flagsr & RFR_RES_ALL)
5267 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5269 note = " is immune.";
5272 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5276 /* Attempt a saving throw */
5277 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
5280 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5282 note = "is unaffected!";
5292 if (seen) obvious = TRUE;
5294 if (r_ptr->flagsr & RFR_RES_ALL)
5297 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5299 note = " is immune.";
5302 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5306 if (r_ptr->flags1 & RF1_UNIQUE)
5309 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5311 note = "is unaffected!";
5317 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
5318 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
5320 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
5322 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
5327 note = "¤ÏÂÑÀ¤ò»ý¤Ã¤Æ¤¤¤ë¡ª";
5337 /* Capture monster */
5341 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
5342 (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)
5345 msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£",m_name);
5347 msg_format("%^s is unaffected.", m_name);
5353 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp*4L;
5354 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(r_ptr))
5355 nokori_hp = m_ptr->maxhp * 3 / 10;
5357 nokori_hp = m_ptr->maxhp * 3 / 20;
5359 if (m_ptr->hp >= nokori_hp)
5362 msg_format("¤â¤Ã¤È¼å¤é¤»¤Ê¤¤¤È¡£");
5364 msg_format("You need to weaken %s more.", m_name);
5368 else if (m_ptr->hp < randint0(nokori_hp))
5370 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
5372 msg_format("%s¤òÊᤨ¤¿¡ª",m_name);
5374 msg_format("You capture %^s!", m_name);
5376 cap_mon = m_list[c_ptr->m_idx].r_idx;
5377 cap_mspeed = m_list[c_ptr->m_idx].mspeed;
5378 cap_hp = m_list[c_ptr->m_idx].hp;
5379 cap_maxhp = m_list[c_ptr->m_idx].max_maxhp;
5380 if (m_list[c_ptr->m_idx].nickname)
5381 cap_nickname = quark_add(quark_str(m_list[c_ptr->m_idx].nickname));
5384 if (c_ptr->m_idx == p_ptr->riding)
5386 if (rakuba(-1, FALSE))
5389 msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
5391 msg_format("You have fallen from %s.", m_name);
5396 delete_monster_idx(c_ptr->m_idx);
5403 msg_format("¤¦¤Þ¤¯Êá¤Þ¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
5405 msg_format("You failed to capture %s.", m_name);
5412 /* Attack (Use "dam" as attack type) */
5415 /* Return this monster's death */
5416 return py_attack(y, x, dam);
5419 /* Sleep (Use "dam" as "power") */
5425 if (seen) obvious = TRUE;
5427 if (r_ptr->flagsr & RFR_RES_ALL)
5430 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5432 note = " is immune.";
5435 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5438 if (r_ptr->flags2 & RF2_EMPTY_MIND)
5441 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5443 note = " is immune!";
5447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
5453 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5455 note = " is immune!";
5462 if (one_in_(5)) effect = 1;
5463 else if (one_in_(4)) effect = 2;
5464 else if (one_in_(3)) effect = 3;
5469 /* Powerful monsters can resist */
5470 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5471 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5474 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5476 note = " is unaffected!";
5482 /* Normal monsters slow down */
5488 note = "¤ÎÆ°¤¤¬ÃÙ¤¯¤Ê¤Ã¤¿¡£";
5490 note = " starts moving slower.";
5493 m_ptr->slow = MIN(200, m_ptr->slow + 50);
5495 if (c_ptr->m_idx == p_ptr->riding)
5496 p_ptr->update |= (PU_BONUS);
5500 else if (effect == 2)
5502 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
5504 /* Attempt a saving throw */
5505 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
5506 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5511 /* No obvious effect */
5513 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5515 note = " is unaffected!";
5522 else if (effect == 3)
5524 /* Attempt a saving throw */
5525 if ((r_ptr->flags1 & RF1_UNIQUE) ||
5526 (r_ptr->flags3 & RF3_NO_SLEEP) ||
5527 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
5529 /* Memorize a flag */
5530 if (r_ptr->flags3 & RF3_NO_SLEEP)
5532 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
5535 /* No obvious effect */
5537 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5539 note = " is unaffected!";
5546 /* Go to sleep (much) later */
5548 note = "¤Ï̲¤ê¹þ¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5550 note = " falls asleep!";
5560 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5562 note = " is immune!";
5566 /* No "real" damage */
5575 if (seen) obvious = TRUE;
5577 if (r_ptr->flagsr & RFR_RES_ALL)
5580 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5582 note = " is immune.";
5585 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5589 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)
5596 if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG2_NOGENO))
5603 delete_monster_idx(c_ptr->m_idx);
5605 msg_format("%s¤Ï¾ÃÌǤ·¤¿¡ª",m_name);
5607 msg_format("%^s disappered!",m_name);
5611 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
5613 take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
5617 chg_virtue(V_VITALITY, -1);
5622 p_ptr->redraw |= (PR_HP);
5625 p_ptr->window |= (PW_PLAYER);
5632 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5634 note = "is unaffected!";
5637 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
5645 if (!who) msg_format("%s¤ò¼Ì¿¿¤Ë»£¤Ã¤¿¡£", m_name);
5647 if (!who) msg_format("You take a photograph of %s.", m_name);
5650 if (r_ptr->flags3 & (RF3_HURT_LITE))
5652 /* Obvious effect */
5653 if (seen) obvious = TRUE;
5655 /* Memorize the effects */
5656 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
5658 /* Special effect */
5660 note = "¤Ï¸÷¤Ë¿È¤ò¤¹¤¯¤á¤¿¡ª";
5661 note_dies = "¤Ï¸÷¤ò¼õ¤±¤Æ¤·¤Ü¤ó¤Ç¤·¤Þ¤Ã¤¿¡ª";
5663 note = " cringes from the light!";
5664 note_dies = " shrivels away in the light!";
5668 /* Normally no damage */
5675 photo = m_ptr->r_idx;
5682 case GF_BLOOD_CURSE:
5684 if (seen) obvious = TRUE;
5686 if (r_ptr->flagsr & RFR_RES_ALL)
5689 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5691 note = " is immune.";
5694 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5702 bool success = FALSE;
5703 if (seen) obvious = TRUE;
5705 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
5707 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
5708 if (dam < 1) dam = 1;
5710 /* No need to tame your pet */
5714 note = "¤ÎÆ°¤¤¬Â®¤¯¤Ê¤Ã¤¿¡£";
5716 note = " starts moving faster.";
5719 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5723 /* Attempt a saving throw */
5724 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
5725 (r_ptr->flags1 & (RF1_UNIQUE)) ||
5726 (m_ptr->mflag2 & MFLAG2_NOPET) ||
5727 (p_ptr->cursed & TRC_AGGRAVATE) ||
5728 ((r_ptr->level+10) > randint1(dam)))
5731 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
5736 note = "¤ò»ÙÇÛ¤·¤¿¡£";
5738 note = " is tamed!";
5742 m_ptr->fast = MIN(200, m_ptr->fast + 100);
5744 /* Learn about type */
5745 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
5752 if (!(r_ptr->flags3 & RF3_NO_FEAR))
5754 do_fear = randint1(90)+10;
5756 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
5759 /* No "real" damage */
5766 if (seen) obvious = TRUE;
5768 if (r_ptr->flagsr & RFR_RES_ALL)
5771 note = "¤Ë¤Ï´°Á´¤ÊÂÑÀ¤¬¤¢¤ë¡ª";
5773 note = " is immune.";
5776 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
5780 /* Attempt a saving throw */
5781 if (randint0(100 + dam) < (r_ptr->level + 50))
5785 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
5787 note = "is unaffected!";
5808 /* Absolutely no effect */
5809 if (skipped) return (FALSE);
5811 /* "Unique" monsters cannot be polymorphed */
5812 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
5814 /* Quest monsters cannot be polymorphed */
5815 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
5817 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
5819 /* "Unique" and "quest" monsters can only be "killed" by the player. */
5820 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
5822 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
5827 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
5828 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
5831 /* Modify the damage */
5833 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
5835 if ((tmp > 0) && (dam == 0)) note = "¤Ï¥À¥á¡¼¥¸¤ò¼õ¤±¤Æ¤¤¤Ê¤¤¡£";
5837 if ((tmp > 0) && (dam == 0)) note = " is unharmed.";
5840 /* Check for death */
5841 if (dam > m_ptr->hp)
5843 /* Extract method of death */
5848 /* Sound and Impact resisters never stun */
5850 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
5851 !(r_ptr->flags3 & RF3_NO_STUN))
5854 if (seen) obvious = TRUE;
5860 note = "¤Ï¤Ò¤É¤¯¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5862 note = " is more dazed.";
5865 tmp = m_ptr->stunned + (do_stun / 2);
5870 note = "¤Ï¤â¤¦¤í¤¦¤È¤·¤¿¡£";
5872 note = " is dazed.";
5879 m_ptr->stunned = (tmp < 200) ? tmp : 200;
5885 /* Confusion and Chaos resisters (and sleepers) never confuse */
5887 !(r_ptr->flags3 & RF3_NO_CONF) &&
5888 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
5891 if (seen) obvious = TRUE;
5893 /* Already partially confused */
5894 if (m_ptr->confused)
5897 note = "¤Ï¤µ¤é¤Ëº®Í𤷤¿¤è¤¦¤À¡£";
5899 note = " looks more confused.";
5902 tmp = m_ptr->confused + (do_conf / 2);
5905 /* Was not confused */
5909 note = "¤Ïº®Í𤷤¿¤è¤¦¤À¡£";
5911 note = " looks confused.";
5917 /* Apply confusion */
5918 m_ptr->confused = (tmp < 200) ? tmp : 200;
5927 if (seen) obvious = TRUE;
5929 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
5934 note = "¤Ï¼å¤¯¤Ê¤Ã¤¿¤è¤¦¤À¡£";
5936 note = " seems weakened.";
5938 m_ptr->maxhp -= do_time;
5939 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
5944 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
5945 if (do_poly && (randint1(90) > r_ptr->level))
5947 if (polymorph_monster(y, x))
5950 if (seen) obvious = TRUE;
5952 /* Monster polymorphs */
5954 note = "¤¬ÊѿȤ·¤¿¡ª";
5959 /* Turn off the damage */
5962 /* Hack -- Get new monster */
5963 m_ptr = &m_list[c_ptr->m_idx];
5965 /* Hack -- Get new race */
5966 r_ptr = &r_info[m_ptr->r_idx];
5972 note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
5974 note = " is unaffected!";
5979 /* Handle "teleport" */
5983 if (seen) obvious = TRUE;
5987 note = "¤¬¾Ã¤¨µî¤Ã¤¿¡ª";
5989 note = " disappears!";
5992 if (!who) chg_virtue(V_VALOUR, -1);
5995 teleport_away(c_ptr->m_idx, do_dist, (bool)(!who), TRUE);
5997 /* Hack -- get new location */
6001 /* Hack -- get new grid */
6002 c_ptr = &cave[y][x];
6009 tmp = m_ptr->monfear + do_fear;
6012 m_ptr->monfear = (tmp < 200) ? tmp : 200;
6019 if (typ == GF_DRAIN_MANA)
6021 /* Drain mana does nothing */
6024 /* If another monster did the damage, hurt the monster by hand */
6027 /* Redraw (later) if needed */
6028 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
6029 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
6031 /* Wake the monster up */
6034 if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
6036 /* Hurt the monster */
6044 if (is_pet(m_ptr) && !(m_ptr->ml))
6047 /* Give detailed messages if destroyed */
6050 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
6053 msg_format("%^s%s", m_name, note);
6061 monster_gain_exp(who, m_ptr->r_idx);
6063 /* Generate treasure, etc */
6064 monster_death(c_ptr->m_idx, FALSE);
6066 /* Delete the monster */
6067 delete_monster_idx(c_ptr->m_idx);
6072 msg_print("¾¯¤·Èᤷ¤¤µ¤Ê¬¤¬¤·¤¿¡£");
6074 msg_print("You feel sad for a moment.");
6080 /* Damaged monster */
6083 /* Give detailed messages if visible or destroyed */
6084 if (note && seen_msg) msg_format("%^s%s", m_name, note);
6086 /* Hack -- Pain message */
6089 message_pain(c_ptr->m_idx, dam);
6096 /* Hack -- handle sleep */
6097 if (do_sleep) m_ptr->csleep = do_sleep;
6101 else if (heal_leper)
6104 if (seen_msg) msg_print("ÉÔ·é¤ÊÉ¿ͤÏɵ¤¤¬¼£¤Ã¤¿¡ª");
6106 if (seen_msg) msg_print("The Mangy looking leper is healed!");
6109 delete_monster_idx(c_ptr->m_idx);
6112 /* If the player did it, give him experience, check fear */
6117 /* Hurt the monster, check for fear and death */
6118 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
6123 /* Damaged monster */
6126 /* HACK - anger the monster before showing the sleep message */
6127 if (do_sleep) anger_monster(m_ptr);
6129 /* Give detailed messages if visible or destroyed */
6130 if (note && seen_msg)
6132 msg_format("%s%s", m_name, note);
6134 msg_format("%^s%s", m_name, note);
6138 /* Hack -- Pain message */
6139 else if (known && (dam || !do_fear))
6141 message_pain(c_ptr->m_idx, dam);
6144 /* Anger monsters */
6145 if (((dam > 0) || get_angry) && !do_sleep)
6146 anger_monster(m_ptr);
6149 if ((fear || do_fear) && seen)
6156 msg_format("%^s¤Ï¶²Éݤ·¤Æƨ¤²½Ð¤·¤¿¡ª", m_name);
6158 msg_format("%^s flees in terror!", m_name);
6162 /* Hack -- handle sleep */
6163 if (do_sleep) m_ptr->csleep = do_sleep;
6167 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
6169 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
6173 switch (randint1(28))
6179 msg_print("ÃÏÌ̤¬Íɤ줿...");
6181 msg_print("The ground trembles...");
6184 earthquake(ty, tx, 4 + randint0(4));
6185 if (!one_in_(6)) break;
6187 case 3: case 4: case 5: case 6:
6190 int dam = damroll(10, 10);
6192 msg_print("½ã¿è¤ÊËâÎϤμ¡¸µ¤Ø¤ÎÈ⤬³«¤¤¤¿¡ª");
6194 msg_print("A portal opens to a plane of raw mana!");
6197 project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
6198 if (!one_in_(6)) break;
6204 msg_print("¶õ´Ö¤¬ÏĤó¤À¡ª");
6206 msg_print("Space warps about you!");
6209 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE, TRUE);
6210 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
6211 if (!one_in_(6)) break;
6213 case 9: case 10: case 11:
6215 msg_print("¥¨¥Í¥ë¥®¡¼¤Î¤¦¤Í¤ê¤ò´¶¤¸¤¿¡ª");
6217 msg_print("You feel a surge of energy!");
6220 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
6221 if (!one_in_(6)) break;
6222 case 12: case 13: case 14: case 15: case 16:
6223 aggravate_monsters(0);
6224 if (!one_in_(6)) break;
6226 count += activate_hi_summon(ty, tx, TRUE);
6227 if (!one_in_(6)) break;
6228 case 19: case 20: case 21: case 22:
6230 bool pet = !one_in_(3);
6231 u32b mode = PM_ALLOW_GROUP;
6233 if (pet) mode |= PM_FORCE_PET;
6234 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
6236 count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
6237 if (!one_in_(6)) break;
6239 case 23: case 24: case 25:
6240 if (p_ptr->hold_life && (randint0(100) < 75)) break;
6242 msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
6244 msg_print("You feel your life draining away...");
6247 if (p_ptr->hold_life) lose_exp(p_ptr->exp / 160);
6248 else lose_exp(p_ptr->exp / 16);
6249 if (!one_in_(6)) break;
6250 case 26: case 27: case 28:
6259 (void)do_dec_stat(i);
6268 (void)do_dec_stat(randint0(6));
6277 if (p_ptr->inside_battle)
6279 p_ptr->health_who = c_ptr->m_idx;
6280 p_ptr->redraw |= (PR_HEALTH);
6284 /* XXX XXX XXX Verify this code */
6286 /* Update the monster */
6287 update_mon(c_ptr->m_idx, FALSE);
6289 /* Redraw the monster grid */
6293 /* Update monster recall window */
6294 if (p_ptr->monster_race_idx == m_ptr->r_idx)
6297 p_ptr->window |= (PW_MONSTER);
6300 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
6304 if (!projectable(m_ptr->fy, m_ptr->fx, py, px) && !(flg & PROJECT_NO_HANGEKI))
6306 set_target(m_ptr, monster_target_y, monster_target_x);
6309 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
6311 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
6315 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
6317 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
6318 rakubadam_m = (dam > 200) ? 200 : dam;
6327 /* Get local object */
6330 /* Prepare to make a Blade of Chaos */
6331 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
6333 q_ptr->pval = photo;
6335 /* Mark the item as fully known */
6336 q_ptr->ident |= (IDENT_MENTAL);
6338 /* Drop it in the dungeon */
6339 (void)drop_near(q_ptr, -1, py, px);
6347 /* Return "Anything seen?" */
6353 * Helper function for "project()" below.
6355 * Handle a beam/bolt/ball causing damage to the player.
6357 * This routine takes a "source monster" (by index), a "distance", a default
6358 * "damage", and a "damage type". See "project_m()" above.
6360 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
6361 * is reduced (see "project_m()" above). This can happen if a monster breathes
6362 * at the player and hits a wall instead.
6364 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
6365 * to know if this is actually a ball or a bolt spell
6368 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
6369 * we just assume that the effects were obvious, for historical reasons.
6371 static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
6376 /* Hack -- assume obvious */
6377 bool obvious = TRUE;
6379 /* Player blind-ness */
6380 bool blind = (p_ptr->blind ? TRUE : FALSE);
6382 /* Player needs a "description" (he is blind) */
6385 /* Source monster */
6386 monster_type *m_ptr = NULL;
6388 /* Monster name (for attacks) */
6391 /* Monster name (for damage) */
6394 /* Hack -- messages */
6400 /* Player is not here */
6401 if (!player_bold(y, x)) return (FALSE);
6403 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
6409 /* Player cannot hurt himself */
6410 if (!who) return (FALSE);
6411 if (who == p_ptr->riding) return (FALSE);
6413 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
6416 int max_attempts = 10;
6419 if (blind) msg_print("²¿¤«¤¬Ä·¤ÍÊ֤ä¿¡ª");
6420 else if (p_ptr->special_defense & KATA_FUUJIN) msg_print("É÷¤ÎÇ¡¤¯Éð´ï¤ò¿¶¤ë¤Ã¤ÆÃƤÊÖ¤·¤¿¡ª");
6421 else msg_print("¹¶·â¤¬Ä·¤ÍÊ֤ä¿¡ª");
6423 if (blind) msg_print("Something bounces!");
6424 else msg_print("The attack bounces!");
6428 /* Choose 'new' target */
6431 t_y = m_list[who].fy - 1 + randint1(3);
6432 t_x = m_list[who].fx - 1 + randint1(3);
6435 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
6437 if (max_attempts < 1)
6439 t_y = m_list[who].fy;
6440 t_x = m_list[who].fx;
6443 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
6450 /* Limit maximum damage */
6451 if (dam > 1600) dam = 1600;
6453 /* Reduce damage by distance */
6454 dam = (dam + r) / (r + 1);
6457 /* If the player is blind, be more descriptive */
6458 if (blind) fuzzy = TRUE;
6463 /* Get the source monster */
6464 m_ptr = &m_list[who];
6465 /* Extract the monster level */
6466 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
6468 /* Get the monster name */
6469 monster_desc(m_name, m_ptr, 0);
6471 /* Get the monster's real name (gotten before polymorph!) */
6472 strcpy(killer, who_name);
6477 strcpy(killer, "æ«");
6479 strcpy(killer, "a trap");
6483 /* Analyze the damage */
6486 /* Standard damage -- hurts inventory too */
6490 if (fuzzy) msg_print("»À¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6492 if (fuzzy) msg_print("You are hit by acid!");
6495 get_damage = acid_dam(dam, killer, monspell);
6499 /* Standard damage -- hurts inventory too */
6503 if (fuzzy) msg_print("²Ð±ê¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6505 if (fuzzy) msg_print("You are hit by fire!");
6508 get_damage = fire_dam(dam, killer, monspell);
6512 /* Standard damage -- hurts inventory too */
6516 if (fuzzy) msg_print("Î䵤¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6518 if (fuzzy) msg_print("You are hit by cold!");
6521 get_damage = cold_dam(dam, killer, monspell);
6525 /* Standard damage -- hurts inventory too */
6529 if (fuzzy) msg_print("ÅÅ·â¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6531 if (fuzzy) msg_print("You are hit by lightning!");
6534 get_damage = elec_dam(dam, killer, monspell);
6538 /* Standard damage -- also poisons player */
6541 bool double_resist = IS_OPPOSE_POIS();
6543 if (fuzzy) msg_print("ÆǤǹ¶·â¤µ¤ì¤¿¡ª");
6545 if (fuzzy) msg_print("You are hit by poison!");
6548 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
6549 if (double_resist) dam = (dam + 2) / 3;
6551 if ((!(double_resist || p_ptr->resist_pois)) &&
6552 one_in_(HURT_CHANCE))
6557 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6559 if (!(double_resist || p_ptr->resist_pois))
6561 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6566 /* Standard damage -- also poisons / mutates player */
6569 bool double_resist = IS_OPPOSE_POIS();
6571 if (fuzzy) msg_print("Êü¼Íǽ¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6573 if (fuzzy) msg_print("You are hit by radiation!");
6576 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
6577 if (double_resist) dam = (2 * dam + 2) / 5;
6578 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6579 if (!(double_resist || p_ptr->resist_pois))
6581 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
6583 if (one_in_(5)) /* 6 */
6586 msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
6588 msg_print("You undergo a freakish metamorphosis!");
6591 if (one_in_(4)) /* 4 */
6599 inven_damage(set_acid_destroy, 2);
6605 /* Standard damage */
6609 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6611 if (fuzzy) msg_print("You are hit by something!");
6614 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6618 /* Holy Orb -- Player only takes partial damage */
6622 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6624 if (fuzzy) msg_print("You are hit by something!");
6627 if (p_ptr->align > 10)
6629 else if (p_ptr->align < -10)
6631 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6638 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6640 if (fuzzy) msg_print("You are hit by something!");
6643 if (p_ptr->align > 10)
6645 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6649 /* Arrow -- XXX no dodging */
6653 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6655 if (fuzzy) msg_print("You are hit by something sharp!");
6658 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
6661 msg_print("Ìð¤ò»Â¤ê¼Î¤Æ¤¿¡ª");
6663 msg_print("You cut down the arrow!");
6667 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6671 /* Plasma -- XXX No resist */
6675 if (fuzzy) msg_print("²¿¤«¤È¤Æ¤âÇ®¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6677 if (fuzzy) msg_print("You are hit by something *HOT*!");
6680 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6682 if (!p_ptr->resist_sound)
6684 int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
6685 (void)set_stun(p_ptr->stun + k);
6688 if (!(p_ptr->resist_fire ||
6690 p_ptr->immune_fire))
6692 inven_damage(set_acid_destroy, 3);
6698 /* Nether -- drain experience */
6702 if (fuzzy) msg_print("ÃϹö¤ÎÎϤǹ¶·â¤µ¤ì¤¿¡ª");
6704 if (fuzzy) msg_print("You are hit by nether forces!");
6708 if (p_ptr->resist_neth)
6710 if (!prace_is_(RACE_SPECTRE))
6711 dam *= 6; dam /= (randint1(4) + 7);
6713 else drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
6715 if (prace_is_(RACE_SPECTRE))
6718 msg_print("µ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
6720 msg_print("You feel invigorated!");
6724 learn_spell(monspell);
6728 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6734 /* Water -- stun/confuse */
6738 if (fuzzy) msg_print("²¿¤«¼¾¤Ã¤¿¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6740 if (fuzzy) msg_print("You are hit by something wet!");
6743 if (!p_ptr->resist_sound)
6745 set_stun(p_ptr->stun + randint1(40));
6747 if (!p_ptr->resist_conf)
6749 set_confused(p_ptr->confused + randint1(5) + 5);
6754 inven_damage(set_cold_destroy, 3);
6757 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6761 /* Chaos -- many effects */
6765 if (fuzzy) msg_print("̵Ãá½ø¤ÎÇÈÆ°¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6767 if (fuzzy) msg_print("You are hit by a wave of anarchy!");
6770 if (p_ptr->resist_chaos)
6772 dam *= 6; dam /= (randint1(4) + 7);
6774 if (!p_ptr->resist_conf)
6776 (void)set_confused(p_ptr->confused + randint0(20) + 10);
6778 if (!p_ptr->resist_chaos)
6780 (void)set_image(p_ptr->image + randint1(10));
6784 msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
6786 msg_print("Your body is twisted by chaos!");
6789 (void)gain_random_mutation(0);
6792 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
6794 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
6796 if (!p_ptr->resist_chaos || one_in_(9))
6798 inven_damage(set_elec_destroy, 2);
6799 inven_damage(set_fire_destroy, 2);
6801 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6805 /* Shards -- mostly cutting */
6809 if (fuzzy) msg_print("²¿¤«±Ô¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6811 if (fuzzy) msg_print("You are hit by something sharp!");
6814 if (p_ptr->resist_shard)
6816 dam *= 6; dam /= (randint1(4) + 7);
6820 (void)set_cut(p_ptr->cut + dam);
6823 if (!p_ptr->resist_shard || one_in_(13))
6825 inven_damage(set_cold_destroy, 2);
6828 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6832 /* Sound -- mostly stunning */
6836 if (fuzzy) msg_print("¹ì²»¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6838 if (fuzzy) msg_print("You are hit by a loud noise!");
6841 if (p_ptr->resist_sound)
6843 dam *= 5; dam /= (randint1(4) + 7);
6847 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
6848 (void)set_stun(p_ptr->stun + k);
6851 if (!p_ptr->resist_sound || one_in_(13))
6853 inven_damage(set_cold_destroy, 2);
6856 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6860 /* Pure confusion */
6864 if (fuzzy) msg_print("²¿¤«º®Í𤹤ë¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6866 if (fuzzy) msg_print("You are hit by something puzzling!");
6869 if (p_ptr->resist_conf)
6871 dam *= 5; dam /= (randint1(4) + 7);
6873 if (!p_ptr->resist_conf)
6875 (void)set_confused(p_ptr->confused + randint1(20) + 10);
6877 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6881 /* Disenchantment -- see above */
6885 if (fuzzy) msg_print("²¿¤«¤µ¤¨¤Ê¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6887 if (fuzzy) msg_print("You are hit by something static!");
6890 if (p_ptr->resist_disen)
6892 dam *= 6; dam /= (randint1(4) + 7);
6896 (void)apply_disenchant(0);
6898 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6902 /* Nexus -- see above */
6906 if (fuzzy) msg_print("²¿¤«´ñ̯¤Ê¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6908 if (fuzzy) msg_print("You are hit by something strange!");
6911 if (p_ptr->resist_nexus)
6913 dam *= 6; dam /= (randint1(4) + 7);
6919 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6923 /* Force -- mostly stun */
6927 if (fuzzy) msg_print("±¿Æ°¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6929 if (fuzzy) msg_print("You are hit by kinetic force!");
6932 if (!p_ptr->resist_sound)
6934 (void)set_stun(p_ptr->stun + randint1(20));
6936 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6941 /* Rocket -- stun, cut */
6945 if (fuzzy) msg_print("Çúȯ¤¬¤¢¤Ã¤¿¡ª");
6947 if (fuzzy) msg_print("There is an explosion!");
6950 if (!p_ptr->resist_sound)
6952 (void)set_stun(p_ptr->stun + randint1(20));
6954 if (p_ptr->resist_shard)
6960 (void)set_cut(p_ptr-> cut + ( dam / 2));
6963 if ((!p_ptr->resist_shard) || one_in_(12))
6965 inven_damage(set_cold_destroy, 3);
6968 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6972 /* Inertia -- slowness */
6976 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6978 if (fuzzy) msg_print("You are hit by something slow!");
6981 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
6982 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
6986 /* Lite -- blinding */
6990 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
6992 if (fuzzy) msg_print("You are hit by something!");
6995 if (p_ptr->resist_lite)
6997 dam *= 4; dam /= (randint1(4) + 7);
6999 else if (!blind && !p_ptr->resist_blind)
7001 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7003 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
7006 msg_print("¸÷¤ÇÆùÂΤ¬¾Ç¤¬¤µ¤ì¤¿¡ª");
7008 msg_print("The light scorches your flesh!");
7013 else if (prace_is_(RACE_S_FAIRY))
7017 if (p_ptr->wraith_form) dam *= 2;
7018 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7020 if (p_ptr->wraith_form)
7022 p_ptr->wraith_form = 0;
7024 msg_print("Á®¸÷¤Î¤¿¤áÈóʪ¼ÁŪ¤Ê±Æ¤Î¸ºß¤Ç¤¤¤é¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£");
7026 msg_print("The light forces you out of your incorporeal shadow form.");
7029 p_ptr->redraw |= PR_MAP;
7030 /* Update monsters */
7031 p_ptr->update |= (PU_MONSTERS);
7033 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
7035 /* Redraw status bar */
7036 p_ptr->redraw |= (PR_STATUS);
7043 /* Dark -- blinding */
7047 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7049 if (fuzzy) msg_print("You are hit by something!");
7052 if (p_ptr->resist_dark)
7054 dam *= 4; dam /= (randint1(4) + 7);
7056 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
7058 else if (!blind && !p_ptr->resist_blind)
7060 (void)set_blind(p_ptr->blind + randint1(5) + 2);
7062 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7066 /* Time -- bolt fewer effects XXX */
7070 if (fuzzy) msg_print("²áµî¤«¤é¤Î¾×·â¤Ë¹¶·â¤µ¤ì¤¿¡ª");
7072 if (fuzzy) msg_print("You are hit by a blast from the past!");
7075 if (p_ptr->resist_time)
7078 dam /= (randint1(4) + 7);
7080 msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
7082 msg_print("You feel as if time is passing you by.");
7088 switch (randint1(10))
7090 case 1: case 2: case 3: case 4: case 5:
7092 if (p_ptr->prace == RACE_ANDROID) break;
7094 msg_print("¿ÍÀ¸¤¬µÕÌá¤ê¤·¤¿µ¤¤¬¤¹¤ë¡£");
7096 msg_print("You feel life has clocked back.");
7099 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
7103 case 6: case 7: case 8: case 9:
7105 switch (randint1(6))
7108 case 1: k = A_STR; act = "¶¯¤¯"; break;
7109 case 2: k = A_INT; act = "ÁïÌÀ¤Ç"; break;
7110 case 3: k = A_WIS; act = "¸ÌÀ¤Ç"; break;
7111 case 4: k = A_DEX; act = "´ïÍѤÇ"; break;
7112 case 5: k = A_CON; act = "·ò¹¯¤Ç"; break;
7113 case 6: k = A_CHR; act = "Èþ¤·¤¯"; break;
7115 case 1: k = A_STR; act = "strong"; break;
7116 case 2: k = A_INT; act = "bright"; break;
7117 case 3: k = A_WIS; act = "wise"; break;
7118 case 4: k = A_DEX; act = "agile"; break;
7119 case 5: k = A_CON; act = "hale"; break;
7120 case 6: k = A_CHR; act = "beautiful"; break;
7126 msg_format("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤É%s¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£", act);
7128 msg_format("You're not as %s as you used to be...", act);
7132 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
7133 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7134 p_ptr->update |= (PU_BONUS);
7141 msg_print("¤¢¤Ê¤¿¤Ï°ÊÁ°¤Û¤ÉÎ϶¯¤¯¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤¿...¡£");
7143 msg_print("You're not as powerful as you used to be...");
7147 for (k = 0; k < 6; k++)
7149 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
7150 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
7152 p_ptr->update |= (PU_BONUS);
7158 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7162 /* Gravity -- stun plus slowness plus teleport */
7166 if (fuzzy) msg_print("²¿¤«½Å¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7167 msg_print("¼þÊդνÅÎϤ¬¤æ¤¬¤ó¤À¡£");
7169 if (fuzzy) msg_print("You are hit by something heavy!");
7170 msg_print("Gravity warps around you.");
7173 teleport_player(5, TRUE);
7174 if (!p_ptr->levitation)
7175 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7176 if (!(p_ptr->resist_sound || p_ptr->levitation))
7178 int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
7179 (void)set_stun(p_ptr->stun + k);
7181 if (p_ptr->levitation)
7183 dam = (dam * 2) / 3;
7186 if (!p_ptr->levitation || one_in_(13))
7188 inven_damage(set_cold_destroy, 2);
7191 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7195 /* Standard damage */
7196 case GF_DISINTEGRATE:
7199 if (fuzzy) msg_print("½ã¿è¤Ê¥¨¥Í¥ë¥®¡¼¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7201 if (fuzzy) msg_print("You are hit by pure energy!");
7204 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7211 if (fuzzy) msg_print("²¿¤é¤«¤Î¹¶·â¤Ë¤è¤Ã¤Æµ¤Ê¬¤¬¤è¤¯¤Ê¤Ã¤¿¡£");
7213 if (fuzzy) msg_print("You are hit by something invigorating!");
7216 (void)hp_player(dam);
7224 if (fuzzy) msg_print("²¿¤«¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7226 if (fuzzy) msg_print("You are hit by something!");
7229 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
7237 if (fuzzy) msg_print("²¿¤«ÃÙ¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7239 if (fuzzy) msg_print("You are hit by something slow!");
7242 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7248 if (p_ptr->free_act) break;
7250 if (fuzzy) msg_print("̲¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª");
7252 if (fuzzy) msg_print("You fall asleep!");
7256 if (ironman_nightmare)
7259 msg_print("¶²¤í¤·¤¤¸÷·Ê¤¬Æ¬¤ËÉ⤫¤ó¤Ç¤¤¿¡£");
7261 msg_print("A horrible vision enters your mind.");
7265 /* Pick a nightmare */
7266 get_mon_num_prep(get_nightmare, NULL);
7268 /* Have some nightmares */
7269 have_nightmare(get_mon_num(MAX_DEPTH));
7271 /* Remove the monster restriction */
7272 get_mon_num_prep(NULL, NULL);
7275 set_paralyzed(p_ptr->paralyzed + dam);
7286 if (fuzzy) msg_print("ËâË¡¤Î¥ª¡¼¥é¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7288 if (fuzzy) msg_print("You are hit by an aura of magic!");
7291 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7299 if (fuzzy) msg_print("¥¨¥Í¥ë¥®¡¼¤Î²ô¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7301 if (fuzzy) msg_print("You are hit by an energy!");
7304 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
7312 if (fuzzy) msg_print("²¿¤«¤¬¶õ¤«¤é¤¢¤Ê¤¿¤ÎƬ¾å¤ËÍî¤Á¤Æ¤¤¿¡ª");
7314 if (fuzzy) msg_print("Something falls from the sky on you!");
7317 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7318 if (!p_ptr->resist_shard || one_in_(13))
7320 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
7321 inven_damage(set_cold_destroy, 2);
7327 /* Ice -- cold plus stun plus cuts */
7331 if (fuzzy) msg_print("²¿¤«±Ô¤¯Î䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7333 if (fuzzy) msg_print("You are hit by something sharp and cold!");
7336 cold_dam(dam, killer, monspell);
7337 if (!p_ptr->resist_shard)
7339 (void)set_cut(p_ptr->cut + damroll(5, 8));
7341 if (!p_ptr->resist_sound)
7343 (void)set_stun(p_ptr->stun + randint1(15));
7346 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
7348 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
7358 if (fuzzy) msg_print("²¿¤«Èó¾ï¤ËÎ䤿¤¤¤â¤Î¤Ç¹¶·â¤µ¤ì¤¿¡ª");
7360 if (fuzzy) msg_print("You are hit by something extremely cold!");
7364 if (p_ptr->mimic_form)
7366 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
7367 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7372 switch (p_ptr->prace)
7374 /* Some races are immune */
7388 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7404 if (who > 0) msg_format("%^s¤ËÀº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
7405 else msg_print("Àº¿À¥¨¥Í¥ë¥®¡¼¤òµÛ¤¤¼è¤é¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª");
7407 if (who > 0) msg_format("%^s draws psychic energy from you!", m_name);
7408 else msg_print("Your psychic energy is drawn!");
7412 if (dam >= p_ptr->csp)
7416 p_ptr->csp_frac = 0;
7425 learn_spell(monspell);
7428 p_ptr->redraw |= (PR_MANA);
7431 p_ptr->window |= (PW_PLAYER);
7432 p_ptr->window |= (PW_SPELL);
7436 /* Heal the monster */
7437 if (m_ptr->hp < m_ptr->maxhp)
7440 m_ptr->hp += (6 * dam);
7441 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
7443 /* Redraw (later) if needed */
7444 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
7445 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
7447 /* Special message */
7451 msg_format("%^s¤Ïµ¤Ê¬¤¬Îɤµ¤½¤¦¤À¡£", m_name);
7453 msg_format("%^s appears healthier.", m_name);
7467 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7470 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7472 msg_print("You resist the effects!");
7474 learn_spell(monspell);
7479 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7481 msg_print("Your mind is blasted by psyonic energy.");
7484 if (!p_ptr->resist_conf)
7486 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7489 if (!p_ptr->resist_chaos && one_in_(3))
7491 (void)set_image(p_ptr->image + randint0(250) + 150);
7498 p_ptr->csp_frac = 0;
7500 p_ptr->redraw |= PR_MANA;
7502 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7508 case GF_BRAIN_SMASH:
7510 if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
7513 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7515 msg_print("You resist the effects!");
7517 learn_spell(monspell);
7522 msg_print("ÎîŪ¥¨¥Í¥ë¥®¡¼¤ÇÀº¿À¤¬¹¶·â¤µ¤ì¤¿¡£");
7524 msg_print("Your mind is blasted by psionic energy.");
7531 p_ptr->csp_frac = 0;
7533 p_ptr->redraw |= PR_MANA;
7535 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7536 if (!p_ptr->resist_blind)
7538 (void)set_blind(p_ptr->blind + 8 + randint0(8));
7540 if (!p_ptr->resist_conf)
7542 (void)set_confused(p_ptr->confused + randint0(4) + 4);
7544 if (!p_ptr->free_act)
7546 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
7548 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
7550 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7551 (void)do_dec_stat(A_INT);
7552 while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
7553 (void)do_dec_stat(A_WIS);
7555 if (!p_ptr->resist_chaos)
7557 (void)set_image(p_ptr->image + randint0(250) + 150);
7566 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7569 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7571 msg_print("You resist the effects!");
7573 learn_spell(monspell);
7577 curse_equipment(15, 0);
7578 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7586 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7589 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7591 msg_print("You resist the effects!");
7593 learn_spell(monspell);
7597 curse_equipment(25, MIN(rlev/2-15, 5));
7598 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7606 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7609 msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7611 msg_print("You resist the effects!");
7613 learn_spell(monspell);
7617 curse_equipment(33, MIN(rlev/2-15, 15));
7618 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7626 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
7629 msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
7631 msg_print("You resist the effects!");
7633 learn_spell(monspell);
7637 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
7638 (void)set_cut(p_ptr->cut + damroll(10, 10));
7646 if (randint0(100 + rlev/2) < p_ptr->skill_sav)
7649 msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
7651 msg_format("You resist the effects!");
7653 learn_spell(monspell);
7658 msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
7660 msg_print("You feel your life fade away!");
7663 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
7664 curse_equipment(40, 20);
7666 if (p_ptr->chp < 1) p_ptr->chp = 1;
7681 if (p_ptr->tim_eyeeye && get_damage > 0 && !p_ptr->is_dead)
7684 msg_format("¹¶·â¤¬%s¼«¿È¤ò½ý¤Ä¤±¤¿¡ª", m_name);
7686 char m_name_self[80];
7689 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
7691 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
7693 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
7694 set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
7697 if (p_ptr->riding && dam > 0)
7699 rakubadam_p = (dam > 200) ? 200 : dam;
7707 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
7713 /* Return "Anything seen?" */
7719 * Find the distance from (x, y) to a line.
7721 int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
7723 /* Vector from (x, y) to (x1, y1) */
7732 int pd = distance(y1, x1, y, x);
7733 int nd = distance(y1, x1, y2, x2);
7735 if (pd > nd) return distance(y, x, y2, x2);
7737 /* Component of P on N */
7738 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
7740 /* Absolute value */
7741 return((nd >= 0) ? nd : 0 - nd);
7748 * Modified version of los() for calculation of disintegration balls.
7749 * Disintegration effects are stopped by permanent walls.
7751 bool in_disintegration_range(int y1, int x1, int y2, int x2)
7771 /* Slope, or 1/Slope, of LOS */
7775 /* Extract the offset */
7779 /* Extract the absolute offset */
7784 /* Handle adjacent (or identical) grids */
7785 if ((ax < 2) && (ay < 2)) return (TRUE);
7788 /* Paranoia -- require "safe" origin */
7789 /* if (!in_bounds(y1, x1)) return (FALSE); */
7792 /* Directly South/North */
7795 /* South -- check for walls */
7798 for (ty = y1 + 1; ty < y2; ty++)
7800 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7804 /* North -- check for walls */
7807 for (ty = y1 - 1; ty > y2; ty--)
7809 if (cave_stop_disintegration(ty, x1)) return (FALSE);
7817 /* Directly East/West */
7820 /* East -- check for walls */
7823 for (tx = x1 + 1; tx < x2; tx++)
7825 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7829 /* West -- check for walls */
7832 for (tx = x1 - 1; tx > x2; tx--)
7834 if (cave_stop_disintegration(y1, tx)) return (FALSE);
7843 /* Extract some signs */
7844 sx = (dx < 0) ? -1 : 1;
7845 sy = (dy < 0) ? -1 : 1;
7848 /* Vertical "knights" */
7853 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
7857 /* Horizontal "knights" */
7862 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
7867 /* Calculate scale factor div 2 */
7870 /* Calculate scale factor */
7874 /* Travel horizontally */
7877 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
7883 /* Consider the special case where slope == 1. */
7894 /* Note (below) the case (qy == f2), where */
7895 /* the LOS exactly meets the corner of a tile. */
7898 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7909 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7922 /* Travel vertically */
7925 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
7941 /* Note (below) the case (qx == f2), where */
7942 /* the LOS exactly meets the corner of a tile. */
7945 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7956 if (cave_stop_disintegration(ty, tx)) return (FALSE);
7977 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)
7982 int brev = rad * rad / dist;
7986 int mdis = distance(y1, x1, y2, x2) + rad;
7988 while (bdis <= mdis)
7992 if ((0 < dist) && (path_n < dist))
7994 int ny = GRID_Y(path_g[path_n]);
7995 int nx = GRID_X(path_g[path_n]);
7996 int nd = distance(ny, nx, y1, x1);
7998 /* Get next base point */
8007 /* Travel from center outward */
8008 for (cdis = 0; cdis <= brad; cdis++)
8010 /* Scan the maximal blast area of radius "cdis" */
8011 for (y = by - cdis; y <= by + cdis; y++)
8013 for (x = bx - cdis; x <= bx + cdis; x++)
8015 /* Ignore "illegal" locations */
8016 if (!in_bounds(y, x)) continue;
8018 /* Enforce a circular "ripple" */
8019 if (distance(y1, x1, y, x) != bdis) continue;
8021 /* Enforce an arc */
8022 if (distance(by, bx, y, x) != cdis) continue;
8028 /* Lights are stopped by opaque terrains */
8029 if (!los(by, bx, y, x)) continue;
8031 case GF_DISINTEGRATE:
8032 /* Disintegration are stopped only by perma-walls */
8033 if (!in_disintegration_range(by, bx, y, x)) continue;
8036 /* Ball explosions are stopped by walls */
8037 if (!projectable(by, bx, y, x)) continue;
8041 /* Save this grid */
8049 /* Encode some more "radius" info */
8050 gm[bdis + 1] = *pgrids;
8052 /* Increase the size */
8053 brad = rad * (path_n + brev) / (dist + brev);
8055 /* Find the next ripple */
8059 /* Store the effect size */
8065 * Generic "beam"/"bolt"/"ball" projection routine.
8068 * who: Index of "source" monster (zero for "player")
8069 * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
8070 * y,x: Target location (or location to travel "towards")
8071 * dam: Base damage roll to apply to affected monsters (or player)
8072 * typ: Type of damage to apply to monsters (and objects)
8073 * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
8076 * TRUE if any "effects" of the projection were observed, else FALSE
8078 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
8079 * towards a given location (optionally passing over the heads of interposing
8080 * monsters), and have it do a given amount of damage to the monsters (and
8081 * optionally objects) within the given radius of the final location.
8083 * A "bolt" travels from source to target and affects only the target grid.
8084 * A "beam" travels from source to target, affecting all grids passed through.
8085 * A "ball" travels from source to the target, exploding at the target, and
8086 * affecting everything within the given radius of the target location.
8088 * Traditionally, a "bolt" does not affect anything on the ground, and does
8089 * not pass over the heads of interposing monsters, much like a traditional
8090 * missile, and will "stop" abruptly at the "target" even if no monster is
8091 * positioned there, while a "ball", on the other hand, passes over the heads
8092 * of monsters between the source and target, and affects everything except
8093 * the source monster which lies within the final radius, while a "beam"
8094 * affects every monster between the source and target, except for the casting
8095 * monster (or player), and rarely affects things on the ground.
8097 * Two special flags allow us to use this function in special ways, the
8098 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
8099 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
8100 * actually projecting from the source monster (or player).
8102 * The player will only get "experience" for monsters killed by himself
8103 * Unique monsters can only be destroyed by attacks from the player
8105 * Only 256 grids can be affected per projection, limiting the effective
8106 * "radius" of standard ball attacks to nine units (diameter nineteen).
8108 * One can project in a given "direction" by combining PROJECT_THRU with small
8109 * offsets to the initial location (see "line_spell()"), or by calculating
8110 * "virtual targets" far away from the player.
8112 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
8113 * continuing until it actually hits somethings (useful for "stone to mud").
8115 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
8117 * Balls must explode BEFORE hitting walls, or they would affect monsters
8118 * on both sides of a wall. Some bug reports indicate that this is still
8119 * happening in 2.7.8 for Windows, though it appears to be impossible.
8121 * We "pre-calculate" the blast area only in part for efficiency.
8122 * More importantly, this lets us do "explosions" from the "inside" out.
8123 * This results in a more logical distribution of "blast" treasure.
8124 * It also produces a better (in my opinion) animation of the explosion.
8125 * It could be (but is not) used to have the treasure dropped by monsters
8126 * in the middle of the explosion fall "outwards", and then be damaged by
8127 * the blast as it spreads outwards towards the treasure drop location.
8129 * Walls and doors are included in the blast area, so that they can be
8130 * "burned" or "melted" in later versions.
8132 * This algorithm is intended to maximize simplicity, not necessarily
8133 * efficiency, since this function is not a bottleneck in the code.
8135 * We apply the blast effect from ground zero outwards, in several passes,
8136 * first affecting features, then objects, then monsters, then the player.
8137 * This allows walls to be removed before checking the object or monster
8138 * in the wall, and protects objects which are dropped by monsters killed
8139 * in the blast, and allows the player to see all affects before he is
8140 * killed or teleported away. The semantics of this method are open to
8141 * various interpretations, but they seem to work well in practice.
8143 * We process the blast area from ground-zero outwards to allow for better
8144 * distribution of treasure dropped by monsters, and because it provides a
8145 * pleasing visual effect at low cost.
8147 * Note that the damage done by "ball" explosions decreases with distance.
8148 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
8150 * Notice the "napalm" effect of "beam" weapons. First they "project" to
8151 * the target, and then the damage "flows" along this beam of destruction.
8152 * The damage at every grid is the same as at the "center" of a "ball"
8153 * explosion, since the "beam" grids are treated as if they ARE at the
8154 * center of a "ball" explosion.
8156 * Currently, specifying "beam" plus "ball" means that locations which are
8157 * covered by the initial "beam", and also covered by the final "ball", except
8158 * for the final grid (the epicenter of the ball), will be "hit twice", once
8159 * by the initial beam, and once by the exploding ball. For the grid right
8160 * next to the epicenter, this results in 150% damage being done. The center
8161 * does not have this problem, for the same reason the final grid in a "beam"
8162 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
8163 * grids which are covered by the "ball" will NOT work, as then they will
8164 * receive LESS damage than they should. Do not combine "beam" with "ball".
8166 * The array "gy[],gx[]" with current size "grids" is used to hold the
8167 * collected locations of all grids in the "blast area" plus "beam path".
8169 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
8170 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
8171 * first blast grid (see above) with radius "N" from the blast center. Note
8172 * that only the first gm[1] grids in the blast area thus take full damage.
8173 * Also, note that gm[rad+1] is always equal to "grids", which is the total
8174 * number of blast grids.
8176 * Note that once the projection is complete, (y2,x2) holds the final location
8177 * of bolts/beams, and the "epicenter" of balls.
8179 * Note also that "rad" specifies the "inclusive" radius of projection blast,
8180 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
8181 * implementation of the "distance" function. Also, a bolt can be properly
8182 * viewed as a "ball" with a "rad" of "zero".
8184 * Note that if no "target" is reached before the beam/bolt/ball travels the
8185 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
8186 * may be relevant even for bolts, since they have a "1x1" mini-blast.
8188 * Note that for consistency, we "pretend" that the bolt actually takes "time"
8189 * to move from point A to point B, even if the player cannot see part of the
8190 * projection path. Note that in general, the player will *always* see part
8191 * of the path, since it either starts at the player or ends on the player.
8193 * Hack -- we assume that every "projection" is "self-illuminating".
8195 * Hack -- when only a single monster is affected, we automatically track
8196 * (and recall) that monster, unless "PROJECT_JUMP" is used.
8198 * Note that all projections now "explode" at their final destination, even
8199 * if they were being projected at a more distant destination. This means
8200 * that "ball" spells will *always* explode.
8202 * Note that we must call "handle_stuff()" after affecting terrain features
8203 * in the blast radius, in case the "illumination" of the grid was changed,
8204 * and "update_view()" and "update_monsters()" need to be called.
8206 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
8216 int y_saver, x_saver; /* For reflecting monsters */
8218 int msec = delay_factor * delay_factor * delay_factor;
8220 /* Assume the player sees nothing */
8221 bool notice = FALSE;
8223 /* Assume the player has seen nothing */
8224 bool visual = FALSE;
8226 /* Assume the player has seen no blast grids */
8229 /* Assume to be a normal ball spell */
8230 bool breath = FALSE;
8232 /* Is the player blind? */
8233 bool blind = (p_ptr->blind ? TRUE : FALSE);
8235 bool old_hide = FALSE;
8237 /* Number of grids in the "path" */
8240 /* Actual grids in the "path" */
8243 /* Number of grids in the "blast area" (including the "beam" path) */
8246 /* Coordinates of the affected grids */
8247 byte gx[1024], gy[1024];
8249 /* Encoded "radius" info (see above) */
8252 /* Actual radius encoded in gm[] */
8257 /* Attacker's name (prepared before polymorph)*/
8260 /* Initialize by null string */
8266 /* Default target of monsterspell is player */
8267 monster_target_y=py;
8268 monster_target_x=px;
8270 /* Hack -- Jump to target */
8271 if (flg & (PROJECT_JUMP))
8276 /* Clear the flag */
8277 flg &= ~(PROJECT_JUMP);
8282 /* Start at player */
8289 /* Start at monster */
8292 x1 = m_list[who].fx;
8293 y1 = m_list[who].fy;
8294 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
8307 /* Default "destination" */
8312 /* Hack -- verify stuff */
8313 if (flg & (PROJECT_THRU))
8315 if ((x1 == x2) && (y1 == y2))
8317 flg &= ~(PROJECT_THRU);
8321 /* Handle a breath attack */
8326 if (flg & PROJECT_HIDE) old_hide = TRUE;
8327 flg |= PROJECT_HIDE;
8331 /* Hack -- Assume there will be no blast (max radius 32) */
8332 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
8340 /* Collect beam grids */
8341 if (flg & (PROJECT_BEAM))
8352 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
8354 case GF_DISINTEGRATE:
8355 flg |= (PROJECT_GRID);
8356 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
8360 /* Calculate the projection path */
8362 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
8364 /* Hack -- Handle stuff */
8367 /* Giga-Hack SEEKER & SUPER_RAY */
8369 if( typ == GF_SEEKER )
8379 for (i = 0; i < path_n; ++i)
8384 int ny = GRID_Y(path_g[i]);
8385 int nx = GRID_X(path_g[i]);
8396 /* Only do visuals if requested */
8397 if (!blind && !(flg & (PROJECT_HIDE)))
8399 /* Only do visuals if the player can "see" the bolt */
8400 if (panel_contains(y, x) && player_has_los_bold(y, x))
8407 /* Obtain the bolt pict */
8408 p = bolt_pict(oy, ox, y, x, typ);
8410 /* Extract attr/char */
8414 /* Visual effects */
8415 print_rel(c, a, y, x);
8416 move_cursor_relative(y, x);
8417 /*if (fresh_before)*/ Term_fresh();
8418 Term_xtra(TERM_XTRA_DELAY, msec);
8420 /*if (fresh_before)*/ Term_fresh();
8422 /* Display "beam" grids */
8423 if (flg & (PROJECT_BEAM))
8425 /* Obtain the explosion pict */
8426 p = bolt_pict(y, x, y, x, typ);
8428 /* Extract attr/char */
8432 /* Visual effects */
8433 print_rel(c, a, y, x);
8436 /* Hack -- Activate delay */
8440 /* Hack -- delay anyway for consistency */
8443 /* Delay for consistency */
8444 Term_xtra(TERM_XTRA_DELAY, msec);
8447 if(project_o(0,0,y,x,dam,GF_SEEKER))notice=TRUE;
8448 if( is_mirror_grid(&cave[y][x]))
8450 /* The target of monsterspell becomes tha mirror(broken) */
8451 monster_target_y=(s16b)y;
8452 monster_target_x=(s16b)x;
8455 next_mirror( &oy,&ox,y,x );
8457 path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
8458 for( j = last_i; j <=i ; j++ )
8460 y = GRID_Y(path_g[j]);
8461 x = GRID_X(path_g[j]);
8462 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))notice=TRUE;
8463 if(!who && (project_m_n==1) && !jump ){
8464 if(cave[project_m_y][project_m_x].m_idx >0 ){
8465 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8467 /* Hack -- auto-recall */
8468 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8470 /* Hack - auto-track */
8471 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8474 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8479 for( i = last_i ; i < path_n ; i++ )
8482 y = GRID_Y(path_g[i]);
8483 x = GRID_X(path_g[i]);
8484 if(project_m(0,0,y,x,dam,GF_SEEKER,flg))
8486 if(!who && (project_m_n==1) && !jump ){
8487 if(cave[project_m_y][project_m_x].m_idx >0 ){
8488 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8490 /* Hack -- auto-recall */
8491 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8493 /* Hack - auto-track */
8494 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8497 (void)project_f(0,0,y,x,dam,GF_SEEKER);
8501 else if(typ == GF_SUPER_RAY){
8503 int second_step = 0;
8510 for (i = 0; i < path_n; ++i)
8515 int ny = GRID_Y(path_g[i]);
8516 int nx = GRID_X(path_g[i]);
8527 /* Only do visuals if requested */
8528 if (!blind && !(flg & (PROJECT_HIDE)))
8530 /* Only do visuals if the player can "see" the bolt */
8531 if (panel_contains(y, x) && player_has_los_bold(y, x))
8538 /* Obtain the bolt pict */
8539 p = bolt_pict(oy, ox, y, x, typ);
8541 /* Extract attr/char */
8545 /* Visual effects */
8546 print_rel(c, a, y, x);
8547 move_cursor_relative(y, x);
8548 /*if (fresh_before)*/ Term_fresh();
8549 Term_xtra(TERM_XTRA_DELAY, msec);
8551 /*if (fresh_before)*/ Term_fresh();
8553 /* Display "beam" grids */
8554 if (flg & (PROJECT_BEAM))
8556 /* Obtain the explosion pict */
8557 p = bolt_pict(y, x, y, x, typ);
8559 /* Extract attr/char */
8563 /* Visual effects */
8564 print_rel(c, a, y, x);
8567 /* Hack -- Activate delay */
8571 /* Hack -- delay anyway for consistency */
8574 /* Delay for consistency */
8575 Term_xtra(TERM_XTRA_DELAY, msec);
8578 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
8579 if (!cave_have_flag_bold(y, x, FF_PROJECT))
8581 if( second_step )continue;
8584 if( is_mirror_grid(&cave[y][x]) && !second_step )
8586 /* The target of monsterspell becomes tha mirror(broken) */
8587 monster_target_y=(s16b)y;
8588 monster_target_x=(s16b)x;
8591 for( j = 0; j <=i ; j++ )
8593 y = GRID_Y(path_g[j]);
8594 x = GRID_X(path_g[j]);
8595 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8599 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
8600 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
8601 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
8602 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
8603 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
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);
8609 for( i = 0; i < path_n ; i++ )
8612 y = GRID_Y(path_g[i]);
8613 x = GRID_X(path_g[i]);
8614 (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg);
8615 if(!who && (project_m_n==1) && !jump ){
8616 if(cave[project_m_y][project_m_x].m_idx >0 ){
8617 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
8619 /* Hack -- auto-recall */
8620 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
8622 /* Hack - auto-track */
8623 if (m_ptr->ml) health_track(cave[project_m_y][project_m_x].m_idx);
8626 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
8631 /* Project along the path */
8632 for (i = 0; i < path_n; ++i)
8637 int ny = GRID_Y(path_g[i]);
8638 int nx = GRID_X(path_g[i]);
8640 if (flg & PROJECT_DISI)
8642 /* Hack -- Balls explode before reaching walls */
8643 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
8645 else if (flg & PROJECT_LOS)
8647 /* Hack -- Balls explode before reaching walls */
8648 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
8652 /* Hack -- Balls explode before reaching walls */
8653 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
8660 /* Collect beam grids */
8661 if (flg & (PROJECT_BEAM))
8668 /* Only do visuals if requested */
8669 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
8671 /* Only do visuals if the player can "see" the bolt */
8672 if (panel_contains(y, x) && player_has_los_bold(y, x))
8679 /* Obtain the bolt pict */
8680 p = bolt_pict(oy, ox, y, x, typ);
8682 /* Extract attr/char */
8686 /* Visual effects */
8687 print_rel(c, a, y, x);
8688 move_cursor_relative(y, x);
8689 /*if (fresh_before)*/ Term_fresh();
8690 Term_xtra(TERM_XTRA_DELAY, msec);
8692 /*if (fresh_before)*/ Term_fresh();
8694 /* Display "beam" grids */
8695 if (flg & (PROJECT_BEAM))
8697 /* Obtain the explosion pict */
8698 p = bolt_pict(y, x, y, x, typ);
8700 /* Extract attr/char */
8704 /* Visual effects */
8705 print_rel(c, a, y, x);
8708 /* Hack -- Activate delay */
8712 /* Hack -- delay anyway for consistency */
8715 /* Delay for consistency */
8716 Term_xtra(TERM_XTRA_DELAY, msec);
8723 /* Save the "blast epicenter" */
8727 if (breath && !path_n)
8733 flg &= ~(PROJECT_HIDE);
8737 /* Start the "explosion" */
8740 /* Hack -- make sure beams get to "explode" */
8748 /* If we found a "target", explode there */
8749 if (dist <= MAX_RANGE)
8751 /* Mega-Hack -- remove the final "beam" grid */
8752 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
8755 * Create a conical breath attack
8766 flg &= ~(PROJECT_HIDE);
8768 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
8772 /* Determine the blast area, work from the inside out */
8773 for (dist = 0; dist <= rad; dist++)
8775 /* Scan the maximal blast area of radius "dist" */
8776 for (y = by - dist; y <= by + dist; y++)
8778 for (x = bx - dist; x <= bx + dist; x++)
8780 /* Ignore "illegal" locations */
8781 if (!in_bounds2(y, x)) continue;
8783 /* Enforce a "circular" explosion */
8784 if (distance(by, bx, y, x) != dist) continue;
8790 /* Lights are stopped by opaque terrains */
8791 if (!los(by, bx, y, x)) continue;
8793 case GF_DISINTEGRATE:
8794 /* Disintegration are stopped only by perma-walls */
8795 if (!in_disintegration_range(by, bx, y, x)) continue;
8798 /* Ball explosions are stopped by walls */
8799 if (!projectable(by, bx, y, x)) continue;
8803 /* Save this grid */
8810 /* Encode some more "radius" info */
8816 /* Speed -- ignore "non-explosions" */
8817 if (!grids) return (FALSE);
8820 /* Display the "blast area" if requested */
8821 if (!blind && !(flg & (PROJECT_HIDE)))
8823 /* Then do the "blast", from inside out */
8824 for (t = 0; t <= gm_rad; t++)
8826 /* Dump everything with this radius */
8827 for (i = gm[t]; i < gm[t+1]; i++)
8829 /* Extract the location */
8833 /* Only do visuals if the player can "see" the blast */
8834 if (panel_contains(y, x) && player_has_los_bold(y, x))
8843 /* Obtain the explosion pict */
8844 p = bolt_pict(y, x, y, x, typ);
8846 /* Extract attr/char */
8850 /* Visual effects -- Display */
8851 print_rel(c, a, y, x);
8855 /* Hack -- center the cursor */
8856 move_cursor_relative(by, bx);
8858 /* Flush each "radius" seperately */
8859 /*if (fresh_before)*/ Term_fresh();
8861 /* Delay (efficiently) */
8862 if (visual || drawn)
8864 Term_xtra(TERM_XTRA_DELAY, msec);
8868 /* Flush the erasing */
8871 /* Erase the explosion drawn above */
8872 for (i = 0; i < grids; i++)
8874 /* Extract the location */
8878 /* Hack -- Erase if needed */
8879 if (panel_contains(y, x) && player_has_los_bold(y, x))
8885 /* Hack -- center the cursor */
8886 move_cursor_relative(by, bx);
8888 /* Flush the explosion */
8889 /*if (fresh_before)*/ Term_fresh();
8894 /* Update stuff if needed */
8895 if (p_ptr->update) update_stuff();
8898 /* Check features */
8899 if (flg & (PROJECT_GRID))
8901 /* Start with "dist" of zero */
8904 /* Scan for features */
8905 for (i = 0; i < grids; i++)
8907 /* Hack -- Notice new "dist" values */
8908 if (gm[dist+1] == i) dist++;
8910 /* Get the grid location */
8914 /* Find the closest point in the blast */
8917 int d = dist_to_line(y, x, y1, x1, by, bx);
8919 /* Affect the grid */
8920 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
8924 /* Affect the grid */
8925 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
8930 /* Update stuff if needed */
8931 if (p_ptr->update) update_stuff();
8934 if (flg & (PROJECT_ITEM))
8936 /* Start with "dist" of zero */
8939 /* Scan for objects */
8940 for (i = 0; i < grids; i++)
8942 /* Hack -- Notice new "dist" values */
8943 if (gm[dist+1] == i) dist++;
8945 /* Get the grid location */
8949 /* Find the closest point in the blast */
8952 int d = dist_to_line(y, x, y1, x1, by, bx);
8954 /* Affect the object in the grid */
8955 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
8959 /* Affect the object in the grid */
8960 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
8966 /* Check monsters */
8967 if (flg & (PROJECT_KILL))
8974 /* Start with "dist" of zero */
8977 /* Scan for monsters */
8978 for (i = 0; i < grids; i++)
8982 /* Hack -- Notice new "dist" values */
8983 if (gm[dist + 1] == i) dist++;
8985 /* Get the grid location */
8989 /* A single bolt may be reflected */
8992 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
8993 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
8995 if ((ref_ptr->flags2 & RF2_REFLECTING) && (flg & PROJECT_REFLECTABLE) && (!who || dist_hack > 1) && !one_in_(10))
8998 int max_attempts = 10;
9000 /* Choose 'new' target */
9003 t_y = y_saver - 1 + randint1(3);
9004 t_x = x_saver - 1 + randint1(3);
9007 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
9009 if (max_attempts < 1)
9018 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
9019 msg_print("¡ÖËÌÅÍ¿À·ý±üµÁ¡¦Æó»Ø¿¿¶õÇÄ¡ª¡×");
9020 else if (m_ptr->r_idx == MON_DIO) msg_print("¥Ç¥£¥ª¡¦¥Ö¥é¥ó¥É¡¼¤Ï»Ø°ìËܤǹ¶·â¤òÃƤÊÖ¤·¤¿¡ª");
9021 else msg_print("¹¶·â¤ÏÄ·¤ÍÊ֤ä¿¡ª");
9023 msg_print("The attack bounces!");
9026 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
9028 /* Reflected bolts randomly target either one */
9029 if (one_in_(2)) flg |= PROJECT_PLAYER;
9030 else flg &= ~(PROJECT_PLAYER);
9032 /* The bolt is reflected */
9033 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
9035 /* Don't affect the monster any longer */
9041 /* Find the closest point in the blast */
9044 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9048 effective_dist = dist;
9052 /* There is the riding player on this monster */
9053 if (p_ptr->riding && player_bold(y, x))
9055 /* Aimed on the player */
9056 if (flg & PROJECT_PLAYER)
9058 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9061 * A beam or bolt is well aimed
9063 * So don't affects the mount.
9070 * The spell is not well aimed,
9071 * So partly affect the mount too.
9078 * This grid is the original target.
9079 * Or aimed on your horse.
9081 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
9083 /* Hit the mount with full damage */
9087 * Otherwise this grid is not the
9088 * original target, it means that line
9089 * of fire is obstructed by this
9093 * A beam or bolt will hit either
9094 * player or mount. Choose randomly.
9096 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
9100 /* Hit the mount with full damage */
9104 /* Hit the player later */
9105 flg |= PROJECT_PLAYER;
9107 /* Don't affect the mount */
9113 * The spell is not well aimed, so
9114 * partly affect both player and
9123 /* Affect the monster in the grid */
9124 if (project_m(who, effective_dist, y, x, dam, typ,flg)) notice = TRUE;
9128 /* Player affected one monster (without "jumping") */
9129 if (!who && (project_m_n == 1) && !jump)
9135 /* Track if possible */
9136 if (cave[y][x].m_idx > 0)
9138 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
9140 /* Hack -- auto-recall */
9141 if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
9143 /* Hack - auto-track */
9144 if (m_ptr->ml) health_track(cave[y][x].m_idx);
9151 if (flg & (PROJECT_KILL))
9153 /* Start with "dist" of zero */
9156 /* Scan for player */
9157 for (i = 0; i < grids; i++)
9161 /* Hack -- Notice new "dist" values */
9162 if (gm[dist+1] == i) dist++;
9164 /* Get the grid location */
9168 /* Affect the player? */
9169 if (!player_bold(y, x)) continue;
9171 /* Find the closest point in the blast */
9174 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
9178 effective_dist = dist;
9181 /* Target may be your horse */
9184 /* Aimed on the player */
9185 if (flg & PROJECT_PLAYER)
9187 /* Hit the player with full damage */
9191 * Hack -- When this grid was not the
9192 * original target, a beam or bolt
9193 * would hit either player or mount,
9194 * and should be choosen randomly.
9196 * But already choosen to hit the
9197 * mount at this point.
9199 * Or aimed on your horse.
9201 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
9204 * A beam or bolt is well aimed
9206 * So don't affects the player.
9213 * The spell is not well aimed,
9214 * So partly affect the player too.
9220 /* Affect the player */
9221 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
9229 monster_desc(m_name, &m_list[p_ptr->riding], 0);
9231 if (rakubadam_m > 0)
9233 if (rakuba(rakubadam_m, FALSE))
9236 msg_format("%^s¤Ë¿¶¤êÍî¤È¤µ¤ì¤¿¡ª", m_name);
9238 msg_format("%^s has thrown you off!", m_name);
9242 if (p_ptr->riding && rakubadam_p > 0)
9244 if(rakuba(rakubadam_p, FALSE))
9247 msg_format("%^s¤«¤éÍî¤Á¤Æ¤·¤Þ¤Ã¤¿¡ª", m_name);
9249 msg_format("You have fallen from %s.", m_name);
9255 /* Return "something was noticed" */
9259 bool binding_field( int dam )
9261 int mirror_x[10],mirror_y[10]; /* ¶À¤Ï¤â¤Ã¤È¾¯¤Ê¤¤ */
9262 int mirror_num=0; /* ¶À¤Î¿ô */
9267 int msec= delay_factor*delay_factor*delay_factor;
9273 /* Default target of monsterspell is player */
9274 monster_target_y=py;
9275 monster_target_x=px;
9277 for( x=0 ; x < cur_wid ; x++ )
9279 for( y=0 ; y < cur_hgt ; y++ )
9281 if( is_mirror_grid(&cave[y][x]) &&
9282 distance(py,px,y,x) <= MAX_RANGE &&
9283 distance(py,px,y,x) != 0 &&
9284 player_has_los_bold(y,x) &&
9285 projectable(py, px, y, x)
9287 mirror_y[mirror_num]=y;
9288 mirror_x[mirror_num]=x;
9294 if( mirror_num < 2 )return FALSE;
9296 point_x[0] = randint0( mirror_num );
9298 point_x[1] = randint0( mirror_num );
9300 while( point_x[0] == point_x[1] );
9302 point_y[0]=mirror_y[point_x[0]];
9303 point_x[0]=mirror_x[point_x[0]];
9304 point_y[1]=mirror_y[point_x[1]];
9305 point_x[1]=mirror_x[point_x[1]];
9309 x=point_x[0]+point_x[1]+point_x[2];
9310 y=point_y[0]+point_y[1]+point_y[2];
9312 centersign = (point_x[0]*3-x)*(point_y[1]*3-y)
9313 - (point_y[0]*3-y)*(point_x[1]*3-x);
9314 if( centersign == 0 )return FALSE;
9316 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
9317 x1 = x1 < point_x[2] ? x1 : point_x[2];
9318 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
9319 y1 = y1 < point_y[2] ? y1 : point_y[2];
9321 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
9322 x2 = x2 > point_x[2] ? x2 : point_x[2];
9323 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
9324 y2 = y2 > point_y[2] ? y2 : point_y[2];
9326 for( y=y1 ; y <=y2 ; y++ ){
9327 for( x=x1 ; x <=x2 ; x++ ){
9328 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9329 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9330 centersign*( (point_x[1]-x)*(point_y[2]-y)
9331 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9332 centersign*( (point_x[2]-x)*(point_y[0]-y)
9333 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9335 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9336 /* Visual effects */
9338 && panel_contains(y,x)){
9339 p = bolt_pict(y,x,y,x, GF_MANA );
9340 print_rel(PICT_C(p), PICT_A(p),y,x);
9341 move_cursor_relative(y, x);
9342 /*if (fresh_before)*/ Term_fresh();
9343 Term_xtra(TERM_XTRA_DELAY, msec);
9349 for( y=y1 ; y <=y2 ; y++ ){
9350 for( x=x1 ; x <=x2 ; x++ ){
9351 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9352 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9353 centersign*( (point_x[1]-x)*(point_y[2]-y)
9354 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9355 centersign*( (point_x[2]-x)*(point_y[0]-y)
9356 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9358 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9359 (void)project_f(0,0,y,x,dam,GF_MANA);
9364 for( y=y1 ; y <=y2 ; y++ ){
9365 for( x=x1 ; x <=x2 ; x++ ){
9366 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9367 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9368 centersign*( (point_x[1]-x)*(point_y[2]-y)
9369 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9370 centersign*( (point_x[2]-x)*(point_y[0]-y)
9371 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9373 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9374 (void)project_o(0,0,y,x,dam,GF_MANA);
9379 for( y=y1 ; y <=y2 ; y++ ){
9380 for( x=x1 ; x <=x2 ; x++ ){
9381 if( centersign*( (point_x[0]-x)*(point_y[1]-y)
9382 -(point_y[0]-y)*(point_x[1]-x)) >=0 &&
9383 centersign*( (point_x[1]-x)*(point_y[2]-y)
9384 -(point_y[1]-y)*(point_x[2]-x)) >=0 &&
9385 centersign*( (point_x[2]-x)*(point_y[0]-y)
9386 -(point_y[2]-y)*(point_x[0]-x)) >=0 )
9388 if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
9389 (void)project_m(0,0,y,x,dam,GF_MANA,
9390 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP));
9397 msg_print("¶À¤¬·ë³¦¤ËÂѤ¨¤¤ì¤º¡¢²õ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
9399 msg_print("The field broke a mirror");
9401 remove_mirror(point_y[0],point_x[0]);
9407 void seal_of_mirror( int dam )
9411 for( x = 0 ; x < cur_wid ; x++ )
9413 for( y = 0 ; y < cur_hgt ; y++ )
9415 if( is_mirror_grid(&cave[y][x]))
9417 if(project_m(0,0,y,x,dam,GF_GENOCIDE,
9418 (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP)))
9420 if( !cave[y][x].m_idx )