3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "object-curse.h"
18 #include "player-damage.h"
21 #include "monster-status.h"
22 #include "spells-diceroll.h"
23 #include "spells-summon.h"
24 #include "monsterrace-hook.h"
28 #include "projection.h"
33 #include "player-status.h"
34 #include "realm-hex.h"
37 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
38 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
40 int project_length = 0; /*!< 投射の射程距離 */
45 * @brief 配置した鏡リストの次を取得する /
46 * Get another mirror. for SEEKER
47 * @param next_y 次の鏡のy座標を返す参照ポインタ
48 * @param next_x 次の鏡のx座標を返す参照ポインタ
49 * @param cury 現在の鏡のy座標
50 * @param curx 現在の鏡のx座標
52 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
54 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
55 int mirror_num = 0; /* 鏡の数 */
59 for (x = 0; x < cur_wid; x++)
61 for (y = 0; y < cur_hgt; y++)
63 if (is_mirror_grid(&grid_array[y][x])) {
64 mirror_y[mirror_num] = y;
65 mirror_x[mirror_num] = x;
72 num = randint0(mirror_num);
73 *next_y = mirror_y[num];
74 *next_x = mirror_x[num];
77 *next_y = cury + randint0(5) - 2;
78 *next_x = curx + randint0(5) - 2;
83 * @brief 万色表現用にランダムな色を選択する関数 /
84 * Get a legal "multi-hued" color for drawing "spells"
88 static TERM_COLOR mh_attr(int max)
90 switch (randint1(max))
92 case 1: return (TERM_RED);
93 case 2: return (TERM_GREEN);
94 case 3: return (TERM_BLUE);
95 case 4: return (TERM_YELLOW);
96 case 5: return (TERM_ORANGE);
97 case 6: return (TERM_VIOLET);
98 case 7: return (TERM_L_RED);
99 case 8: return (TERM_L_GREEN);
100 case 9: return (TERM_L_BLUE);
101 case 10: return (TERM_UMBER);
102 case 11: return (TERM_L_UMBER);
103 case 12: return (TERM_SLATE);
104 case 13: return (TERM_WHITE);
105 case 14: return (TERM_L_WHITE);
106 case 15: return (TERM_L_DARK);
114 * @brief 魔法属性に応じたエフェクトの色を返す /
115 * Return a color to use for the bolt/ball spells
119 static TERM_COLOR spell_color(int type)
121 /* Check if A.B.'s new graphics should be used (rr9) */
122 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
127 case GF_PSY_SPEAR: return (0x06);
128 case GF_MISSILE: return (0x0F);
129 case GF_ACID: return (0x04);
130 case GF_ELEC: return (0x02);
131 case GF_FIRE: return (0x00);
132 case GF_COLD: return (0x01);
133 case GF_POIS: return (0x03);
134 case GF_HOLY_FIRE: return (0x00);
135 case GF_HELL_FIRE: return (0x00);
136 case GF_MANA: return (0x0E);
138 case GF_SEEKER: return (0x0E);
139 case GF_SUPER_RAY: return (0x0E);
141 case GF_ARROW: return (0x0F);
142 case GF_WATER: return (0x04);
143 case GF_NETHER: return (0x07);
144 case GF_CHAOS: return (mh_attr(15));
145 case GF_DISENCHANT: return (0x05);
146 case GF_NEXUS: return (0x0C);
147 case GF_CONFUSION: return (mh_attr(4));
148 case GF_SOUND: return (0x09);
149 case GF_SHARDS: return (0x08);
150 case GF_FORCE: return (0x09);
151 case GF_INERTIAL: return (0x09);
152 case GF_GRAVITY: return (0x09);
153 case GF_TIME: return (0x09);
154 case GF_LITE_WEAK: return (0x06);
155 case GF_LITE: return (0x06);
156 case GF_DARK_WEAK: return (0x07);
157 case GF_DARK: return (0x07);
158 case GF_PLASMA: return (0x0B);
159 case GF_METEOR: return (0x00);
160 case GF_ICE: return (0x01);
161 case GF_ROCKET: return (0x0F);
162 case GF_DEATH_RAY: return (0x07);
163 case GF_NUKE: return (mh_attr(2));
164 case GF_DISINTEGRATE: return (0x05);
176 case GF_CAUSE_4: return (0x0E);
177 case GF_HAND_DOOM: return (0x07);
178 case GF_CAPTURE : return (0x0E);
179 case GF_IDENTIFY: return (0x01);
180 case GF_ATTACK: return (0x0F);
181 case GF_PHOTO : return (0x06);
184 /* Normal tiles or ASCII */
190 /* Lookup the default colors for this type */
191 concptr s = quark_str(gf_color[type]);
193 if (!s) return (TERM_WHITE);
195 /* Pick a random color */
196 c = s[randint0(strlen(s))];
198 /* Lookup this color */
199 a = my_strchr(color_char, c) - color_char;
201 /* Invalid color (note check for < 0 removed, gave a silly
202 * warning because bytes are always >= 0 -- RG) */
203 if (a > 15) return (TERM_WHITE);
209 /* Standard "color" */
215 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
216 * Find the attr/char pair to use for a spell effect
225 * It is moving (or has moved) from (x,y) to (nx,ny).
226 * If the distance is not "one", we (may) return "*".
229 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
239 if ((ny == y) && (nx == x)) base = 0x30;
242 else if (nx == x) base = 0x40;
245 else if (ny == y) base = 0x50;
248 else if ((ny - y) == (x - nx)) base = 0x60;
251 else if ((ny - y) == (nx - x)) base = 0x70;
256 /* Basic spell color */
257 k = spell_color(typ);
259 /* Obtain attr/char */
260 a = misc_to_attr[base + k];
261 c = misc_to_char[base + k];
270 * Mega-Hack -- track "affected" monsters (see "project()" comments)
272 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
273 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
274 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
275 /* Mega-Hack -- monsters target */
276 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
277 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
281 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
282 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
283 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
284 * @param y 目標Y座標 / Target y location (or location to travel "towards")
285 * @param x 目標X座標 / Target x location (or location to travel "towards")
286 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
287 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
288 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
291 * We are called both for "beam" effects and "ball" effects.
293 * The "r" parameter is the "distance from ground zero".
295 * Note that we determine if the player can "see" anything that happens
296 * by taking into account: blindness, line-of-sight, and illumination.
298 * We return "TRUE" if the effect of the projection is "obvious".
300 * We also "see" grids which are "memorized", probably a hack
302 * Perhaps we should affect doors?
305 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
307 grid_type *g_ptr = &grid_array[y][x];
308 feature_type *f_ptr = &f_info[g_ptr->feat];
310 bool obvious = FALSE;
311 bool known = player_has_los_bold(y, x);
316 /* Reduce damage by distance */
317 dam = (dam + r) / (r + 1);
320 if (have_flag(f_ptr->flags, FF_TREE))
328 message = _("枯れた", "was blasted."); break;
330 message = _("縮んだ", "shrank."); break;
332 message = _("溶けた", "melted."); break;
335 message = _("凍り、砕け散った", "was frozen and smashed."); break;
339 message = _("燃えた", "burns up!"); break;
351 message = _("粉砕された", "was crushed."); break;
353 message = NULL; break;
357 msg_format(_("木は%s。", "A tree %s"), message);
358 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
361 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
365 /* Analyze the type */
368 /* Ignore most effects */
403 /* Destroy Traps (and Locks) */
406 /* Reveal secret doors */
407 if (is_hidden_door(g_ptr))
412 /* Check line of sight */
420 if (is_trap(g_ptr->feat))
422 /* Check line of sight */
425 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
429 /* Destroy the trap */
430 cave_alter_feat(y, x, FF_DISARM);
433 /* Locked doors are unlocked */
434 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
436 s16b old_feat = g_ptr->feat;
438 /* Unlock the door */
439 cave_alter_feat(y, x, FF_DISARM);
441 /* Check line of sound */
442 if (known && (old_feat != g_ptr->feat))
444 msg_print(_("カチッと音がした!", "Click!"));
449 /* Remove "unsafe" flag if player is not blind */
450 if (!p_ptr->blind && player_has_los_bold(y, x))
452 g_ptr->info &= ~(CAVE_UNSAFE);
460 /* Destroy Doors (and traps) */
463 /* Destroy all doors and traps */
464 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
466 /* Check line of sight */
469 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
473 /* Destroy the feature */
474 cave_alter_feat(y, x, FF_TUNNEL);
477 /* Remove "unsafe" flag if player is not blind */
478 if (!p_ptr->blind && player_has_los_bold(y, x))
480 g_ptr->info &= ~(CAVE_UNSAFE);
488 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
490 if (have_flag(f_ptr->flags, FF_SPIKE))
492 s16b old_mimic = g_ptr->mimic;
493 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
495 cave_alter_feat(y, x, FF_SPIKE);
496 g_ptr->mimic = old_mimic;
501 /* Check line of sight */
502 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
504 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
511 /* Destroy walls (and doors) */
514 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
516 if (known && (g_ptr->info & (CAVE_MARK)))
518 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
522 /* Destroy the wall */
523 cave_alter_feat(y, x, FF_HURT_ROCK);
525 /* Update some things */
526 p_ptr->update |= (PU_FLOW);
534 if (!cave_naked_bold(y, x)) break;
535 if (player_bold(y, x)) break;
536 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
537 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
549 if (!cave_naked_bold(y, x)) break;
550 if (player_bold(y, x)) break;
551 cave_set_feat(y, x, feat_tree);
552 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
558 if (!cave_naked_bold(y, x)) break;
559 g_ptr->info |= CAVE_OBJECT;
560 g_ptr->mimic = feat_glyph;
568 if (!cave_naked_bold(y, x)) break;
569 if (player_bold(y, x)) break;
570 cave_set_feat(y, x, feat_granite);
576 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
579 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
580 cave_set_feat(y, x, feat_shallow_lava);
584 cave_set_feat(y, x, feat_deep_lava);
591 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
594 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
595 cave_set_feat(y, x, feat_shallow_water);
599 cave_set_feat(y, x, feat_deep_water);
604 /* Lite up the grid */
608 /* Turn on the light */
609 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
611 g_ptr->info |= (CAVE_GLOW);
614 update_local_illumination(y, x);
617 if (player_can_see_bold(y, x)) obvious = TRUE;
619 /* Mega-Hack -- Update the monster in the affected grid */
620 /* This allows "spear of light" (etc) to work "correctly" */
621 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
623 if (p_ptr->special_defense & NINJA_S_STEALTH)
625 if (player_bold(y, x)) set_superstealth(FALSE);
632 /* Darken the grid */
636 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
639 /* Turn off the light. */
642 if (dun_level || !is_daytime())
644 for (j = 0; j < 9; j++)
646 int by = y + ddy_ddd[j];
647 int bx = x + ddx_ddd[j];
649 if (in_bounds2(by, bx))
651 grid_type *cc_ptr = &grid_array[by][bx];
653 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
664 g_ptr->info &= ~(CAVE_GLOW);
666 /* Hack -- Forget "boring" grids */
667 if (!have_flag(f_ptr->flags, FF_REMEMBER))
670 g_ptr->info &= ~(CAVE_MARK);
677 update_local_illumination(y, x);
679 if (player_can_see_bold(y, x)) obvious = TRUE;
681 /* Mega-Hack -- Update the monster in the affected grid */
682 /* This allows "spear of light" (etc) to work "correctly" */
683 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
693 if (is_mirror_grid(g_ptr))
695 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
698 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
701 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
703 if (known && (g_ptr->info & CAVE_MARK))
705 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
709 /* Destroy the wall */
710 cave_alter_feat(y, x, FF_HURT_ROCK);
712 /* Update some things */
713 p_ptr->update |= (PU_FLOW);
720 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
722 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
725 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
728 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
730 if (known && (g_ptr->info & CAVE_MARK))
732 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
736 /* Destroy the wall */
737 cave_alter_feat(y, x, FF_HURT_ROCK);
739 /* Update some things */
740 p_ptr->update |= (PU_FLOW);
745 case GF_DISINTEGRATE:
747 /* Destroy mirror/glyph */
748 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
751 /* Permanent features don't get effect */
752 /* But not protect monsters and other objects */
753 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
755 cave_alter_feat(y, x, FF_HURT_DISI);
757 /* Update some things -- similar to GF_KILL_WALL */
758 p_ptr->update |= (PU_FLOW);
765 /* Return "Anything seen?" */
772 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
773 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
774 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
775 * @param y 目標Y座標 / Target y location (or location to travel "towards")
776 * @param x 目標X座標 / Target x location (or location to travel "towards")
777 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
778 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
779 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
782 * We are called from "project()" to "damage" objects
784 * We are called both for "beam" effects and "ball" effects.
786 * Perhaps we should only SOMETIMES damage things on the ground.
788 * The "r" parameter is the "distance from ground zero".
790 * Note that we determine if the player can "see" anything that happens
791 * by taking into account: blindness, line-of-sight, and illumination.
793 * We also "see" grids which are "memorized", probably a hack
795 * We return "TRUE" if the effect of the projection is "obvious".
798 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
800 grid_type *g_ptr = &grid_array[y][x];
802 OBJECT_IDX this_o_idx, next_o_idx = 0;
804 bool obvious = FALSE;
805 bool known = player_has_los_bold(y, x);
807 BIT_FLAGS flgs[TR_FLAG_SIZE];
809 GAME_TEXT o_name[MAX_NLEN];
811 KIND_OBJECT_IDX k_idx = 0;
812 bool is_potion = FALSE;
817 /* Reduce damage by distance */
818 dam = (dam + r) / (r + 1);
821 /* Scan all objects in the grid */
822 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
824 object_type *o_ptr = &o_list[this_o_idx];
828 bool do_kill = FALSE;
830 concptr note_kill = NULL;
833 /* Get the "plural"-ness */
834 bool plural = (o_ptr->number > 1);
837 /* Acquire next object */
838 next_o_idx = o_ptr->next_o_idx;
839 object_flags(o_ptr, flgs);
841 /* Check for artifact */
842 if (object_is_artifact(o_ptr)) is_art = TRUE;
844 /* Analyze the type */
847 /* Acid -- Lots of things */
850 if (hates_acid(o_ptr))
853 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
854 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
859 /* Elec -- Rings and Wands */
862 if (hates_elec(o_ptr))
865 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
866 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
871 /* Fire -- Flammable objects */
874 if (hates_fire(o_ptr))
877 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
878 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
883 /* Cold -- potions and flasks */
886 if (hates_cold(o_ptr))
888 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
890 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
898 if (hates_fire(o_ptr))
901 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
902 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
904 if (hates_elec(o_ptr))
908 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
909 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
917 if (hates_fire(o_ptr))
920 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
921 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
923 if (hates_cold(o_ptr))
927 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
928 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
933 /* Hack -- break potions and such */
939 if (hates_cold(o_ptr))
941 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
947 /* Mana and Chaos -- destroy everything */
953 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
957 case GF_DISINTEGRATE:
960 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
967 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
968 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
969 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
973 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
977 if (object_is_cursed(o_ptr))
980 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
987 identify_item(o_ptr);
989 /* Auto-inscription */
990 autopick_alter_item((-this_o_idx), FALSE);
998 /* Chests are noticed only if trapped or locked */
999 if (o_ptr->tval == TV_CHEST)
1001 /* Disarm/Unlock traps */
1002 if (o_ptr->pval > 0)
1004 /* Disarm or Unlock */
1005 o_ptr->pval = (0 - o_ptr->pval);
1008 object_known(o_ptr);
1010 if (known && (o_ptr->marked & OM_FOUND))
1012 msg_print(_("カチッと音がした!", "Click!"));
1022 if (o_ptr->tval == TV_CORPSE)
1025 BIT_FLAGS mode = 0L;
1027 if (!who || is_pet(&m_list[who]))
1028 mode |= PM_FORCE_PET;
1030 for (i = 0; i < o_ptr->number ; i++)
1032 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1033 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1037 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1041 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1043 note_kill = _("生き返った。", " revived.");
1045 else if (!note_kill)
1047 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1058 /* Attempt to destroy the object */
1061 /* Effect "observed" */
1062 if (known && (o_ptr->marked & OM_FOUND))
1065 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1068 /* Artifacts, and other objects, get to resist */
1069 if (is_art || ignore)
1071 /* Observe the resist */
1072 if (known && (o_ptr->marked & OM_FOUND))
1074 msg_format(_("%sは影響を受けない!",
1075 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1082 /* Describe if needed */
1083 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1085 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1088 k_idx = o_ptr->k_idx;
1089 is_potion = object_is_potion(o_ptr);
1090 delete_object_idx(this_o_idx);
1092 /* Potions produce effects when 'shattered' */
1095 (void)potion_smash_effect(who, y, x, k_idx);
1103 /* Return "Anything seen?" */
1109 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1110 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1111 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1112 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1113 * @param x 目標X座標 / Target x location (or location to travel "towards")
1114 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1115 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1117 * @param see_s_msg TRUEならばメッセージを表示する
1118 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1121 * This routine takes a "source monster" (by index) which is mostly used to
1122 * determine if the player is causing the damage, and a "radius" (see below),
1123 * which is used to decrease the power of explosions with distance, and a
1124 * location, via integers which are modified by certain types of attacks
1125 * (polymorph and teleport being the obvious ones), a default damage, which
1126 * is modified as needed based on various properties, and finally a "damage
1127 * type" (see below).
1130 * Note that this routine can handle "no damage" attacks (like teleport) by
1131 * taking a "zero" damage, and can even take "parameters" to attacks (like
1132 * confuse) by accepting a "damage", using it to calculate the effect, and
1133 * then setting the damage to zero. Note that the "damage" parameter is
1134 * divided by the radius, so monsters not at the "epicenter" will not take
1135 * as much damage (or whatever)...
1138 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1139 * may result in a dereference of an invalid pointer.
1142 * Various messages are produced, and damage is applied.
1145 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1146 * actually be "made" of that substance, or "breathe" big balls of it.
1147 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1149 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1150 * and hurts evil less. If can breath nether, then it resists it as well.
1153 * Damage reductions use the following formulas:
1154 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1155 * gives avg damage of .655, ranging from .858 to .500
1156 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1157 * gives avg damage of .544, ranging from .714 to .417
1158 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1159 * gives avg damage of .444, ranging from .556 to .333
1160 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1161 * gives avg damage of .327, ranging from .427 to .250
1162 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1163 * gives something simple.
1166 * In this function, "result" messages are postponed until the end, where
1167 * the "note" string is appended to the monster name, if not NULL. So,
1168 * to make a spell have "no effect" just set "note" to NULL. You should
1169 * also set "notice" to FALSE, or the player will learn what the spell does.
1172 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1176 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1180 grid_type *g_ptr = &grid_array[y][x];
1182 monster_type *m_ptr = &m_list[g_ptr->m_idx];
1183 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1185 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1189 /* Is the monster "seen"? */
1190 bool seen = m_ptr->ml;
1191 bool seen_msg = is_seen(m_ptr);
1193 bool slept = (bool)MON_CSLEEP(m_ptr);
1195 /* Were the effects "obvious" (if seen)? */
1196 bool obvious = FALSE;
1198 /* Can the player know about this effect? */
1199 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1201 /* Were the effects "irrelevant"? */
1202 bool skipped = FALSE;
1204 /* Gets the monster angry at the source of the effect? */
1205 bool get_angry = FALSE;
1207 /* Polymorph setting (true or false) */
1208 bool do_poly = FALSE;
1210 /* Teleport setting (max distance) */
1213 /* Confusion setting (amount to confuse) */
1216 /* Stunning setting (amount to stun) */
1219 /* Sleep amount (amount to sleep) */
1222 /* Fear amount (amount to fear) */
1225 /* Time amount (amount to time) */
1228 bool heal_leper = FALSE;
1230 /* Hold the monster name */
1231 GAME_TEXT m_name[MAX_NLEN];
1234 PARAMETER_VALUE photo = 0;
1236 /* Assume no note */
1237 concptr note = NULL;
1239 /* Assume a default death */
1240 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1242 POSITION ty = m_ptr->fy;
1243 POSITION tx = m_ptr->fx;
1245 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1248 if (!g_ptr->m_idx) return (FALSE);
1250 /* Never affect projector */
1251 if (who && (g_ptr->m_idx == who)) return (FALSE);
1252 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1253 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1255 /* Don't affect already death monsters */
1256 /* Prevents problems with chain reactions of exploding monsters */
1257 if (m_ptr->hp < 0) return (FALSE);
1259 /* Reduce damage by distance */
1260 dam = (dam + r) / (r + 1);
1263 /* Get the monster name (BEFORE polymorphing) */
1264 monster_desc(m_name, m_ptr, 0);
1266 /* Get the monster possessive ("his"/"her"/"its") */
1267 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1269 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1271 /* Analyze the damage type */
1274 /* Magic Missile -- pure damage */
1277 if (seen) obvious = TRUE;
1279 if (r_ptr->flagsr & RFR_RES_ALL)
1281 note = _("には完全な耐性がある!", " is immune.");
1283 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1292 if (seen) obvious = TRUE;
1294 if (r_ptr->flagsr & RFR_RES_ALL)
1296 note = _("には完全な耐性がある!", " is immune.");
1298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1301 if (r_ptr->flagsr & RFR_IM_ACID)
1303 note = _("にはかなり耐性がある!", " resists a lot.");
1305 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1313 if (seen) obvious = TRUE;
1315 if (r_ptr->flagsr & RFR_RES_ALL)
1317 note = _("には完全な耐性がある!", " is immune.");
1319 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1322 if (r_ptr->flagsr & RFR_IM_ELEC)
1324 note = _("にはかなり耐性がある!", " resists a lot.");
1326 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1334 if (seen) obvious = TRUE;
1336 if (r_ptr->flagsr & RFR_RES_ALL)
1338 note = _("には完全な耐性がある!", " is immune.");
1340 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1343 if (r_ptr->flagsr & RFR_IM_FIRE)
1345 note = _("にはかなり耐性がある!", " resists a lot.");
1347 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1349 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1351 note = _("はひどい痛手をうけた。", " is hit hard.");
1353 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1361 if (seen) obvious = TRUE;
1363 if (r_ptr->flagsr & RFR_RES_ALL)
1365 note = _("には完全な耐性がある!", " is immune.");
1367 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1370 if (r_ptr->flagsr & RFR_IM_COLD)
1372 note = _("にはかなり耐性がある!", " resists a lot.");
1374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1376 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1378 note = _("はひどい痛手をうけた。", " is hit hard.");
1380 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1388 if (seen) obvious = TRUE;
1390 if (r_ptr->flagsr & RFR_RES_ALL)
1392 note = _("には完全な耐性がある!", " is immune.");
1394 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1397 if (r_ptr->flagsr & RFR_IM_POIS)
1399 note = _("にはかなり耐性がある!", " resists a lot.");
1401 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1409 if (seen) obvious = TRUE;
1411 if (r_ptr->flagsr & RFR_RES_ALL)
1413 note = _("には完全な耐性がある!", " is immune.");
1415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1418 if (r_ptr->flagsr & RFR_IM_POIS)
1420 note = _("には耐性がある。", " resists.");
1421 dam *= 3; dam /= randint1(6) + 6;
1422 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1424 else if (one_in_(3)) do_poly = TRUE;
1428 /* Hellfire -- hurts Evil */
1431 if (seen) obvious = TRUE;
1433 if (r_ptr->flagsr & RFR_RES_ALL)
1435 note = _("には完全な耐性がある!", " is immune.");
1437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1440 if (r_ptr->flags3 & RF3_GOOD)
1442 note = _("はひどい痛手をうけた。", " is hit hard.");
1444 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1449 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1452 if (seen) obvious = TRUE;
1454 if (r_ptr->flagsr & RFR_RES_ALL)
1456 note = _("には完全な耐性がある!", " is immune.");
1458 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1461 if (r_ptr->flags3 & RF3_GOOD)
1463 note = _("には完全な耐性がある!", " is immune.");
1465 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1467 else if (r_ptr->flags3 & RF3_EVIL)
1470 note = _("はひどい痛手をうけた。", " is hit hard.");
1471 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1475 note = _("には耐性がある。", " resists.");
1476 dam *= 3; dam /= randint1(6) + 6;
1481 /* Arrow -- XXX no defense */
1484 if (seen) obvious = TRUE;
1486 if (r_ptr->flagsr & RFR_RES_ALL)
1488 note = _("には完全な耐性がある!", " is immune.");
1490 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1496 /* Plasma -- XXX perhaps check ELEC or FIRE */
1499 if (seen) obvious = TRUE;
1501 if (r_ptr->flagsr & RFR_RES_ALL)
1503 note = _("には完全な耐性がある!", " is immune.");
1505 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1508 if (r_ptr->flagsr & RFR_RES_PLAS)
1510 note = _("には耐性がある。", " resists.");
1511 dam *= 3; dam /= randint1(6) + 6;
1512 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1517 /* Nether -- see above */
1520 if (seen) obvious = TRUE;
1522 if (r_ptr->flagsr & RFR_RES_ALL)
1524 note = _("には完全な耐性がある!", " is immune.");
1526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1529 if (r_ptr->flagsr & RFR_RES_NETH)
1531 if (r_ptr->flags3 & RF3_UNDEAD)
1533 note = _("には完全な耐性がある!", " is immune.");
1535 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1539 note = _("には耐性がある。", " resists.");
1540 dam *= 3; dam /= randint1(6) + 6;
1542 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1544 else if (r_ptr->flags3 & RF3_EVIL)
1546 note = _("はいくらか耐性を示した。", " resists somewhat.");
1548 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1553 /* Water (acid) damage -- Water spirits/elementals are immune */
1556 if (seen) obvious = TRUE;
1558 if (r_ptr->flagsr & RFR_RES_ALL)
1560 note = _("には完全な耐性がある!", " is immune.");
1562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1565 if (r_ptr->flagsr & RFR_RES_WATE)
1567 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1569 note = _("には完全な耐性がある!", " is immune.");
1574 note = _("には耐性がある。", " resists.");
1575 dam *= 3; dam /= randint1(6) + 6;
1577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1582 /* Chaos -- Chaos breathers resist */
1585 if (seen) obvious = TRUE;
1587 if (r_ptr->flagsr & RFR_RES_ALL)
1589 note = _("には完全な耐性がある!", " is immune.");
1591 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1594 if (r_ptr->flagsr & RFR_RES_CHAO)
1596 note = _("には耐性がある。", " resists.");
1597 dam *= 3; dam /= randint1(6) + 6;
1598 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1600 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1602 note = _("はいくらか耐性を示した。", " resists somewhat.");
1603 dam *= 3; dam /= randint1(6) + 6;
1604 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1609 do_conf = (5 + randint1(11) + r) / (r + 1);
1614 /* Shards -- Shard breathers resist */
1617 if (seen) obvious = TRUE;
1619 if (r_ptr->flagsr & RFR_RES_ALL)
1621 note = _("には完全な耐性がある!", " is immune.");
1623 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1626 if (r_ptr->flagsr & RFR_RES_SHAR)
1628 note = _("には耐性がある。", " resists.");
1629 dam *= 3; dam /= randint1(6) + 6;
1630 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1635 /* Rocket: Shard resistance helps */
1638 if (seen) obvious = TRUE;
1640 if (r_ptr->flagsr & RFR_RES_ALL)
1642 note = _("には完全な耐性がある!", " is immune.");
1644 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1647 if (r_ptr->flagsr & RFR_RES_SHAR)
1649 note = _("はいくらか耐性を示した。", " resists somewhat.");
1651 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1657 /* Sound -- Sound breathers resist */
1660 if (seen) obvious = TRUE;
1662 if (r_ptr->flagsr & RFR_RES_ALL)
1664 note = _("には完全な耐性がある!", " is immune.");
1666 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1669 if (r_ptr->flagsr & RFR_RES_SOUN)
1671 note = _("には耐性がある。", " resists.");
1672 dam *= 2; dam /= randint1(6) + 6;
1673 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1675 else do_stun = (10 + randint1(15) + r) / (r + 1);
1682 if (seen) obvious = TRUE;
1684 if (r_ptr->flagsr & RFR_RES_ALL)
1686 note = _("には完全な耐性がある!", " is immune.");
1688 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1691 if (r_ptr->flags3 & RF3_NO_CONF)
1693 note = _("には耐性がある。", " resists.");
1694 dam *= 3; dam /= randint1(6) + 6;
1695 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1697 else do_conf = (10 + randint1(15) + r) / (r + 1);
1701 /* Disenchantment -- Breathers and Disenchanters resist */
1704 if (seen) obvious = TRUE;
1706 if (r_ptr->flagsr & RFR_RES_ALL)
1708 note = _("には完全な耐性がある!", " is immune.");
1710 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1713 if (r_ptr->flagsr & RFR_RES_DISE)
1715 note = _("には耐性がある。", " resists.");
1716 dam *= 3; dam /= randint1(6) + 6;
1717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1722 /* Nexus -- Breathers and Existers resist */
1725 if (seen) obvious = TRUE;
1727 if (r_ptr->flagsr & RFR_RES_ALL)
1729 note = _("には完全な耐性がある!", " is immune.");
1731 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1734 if (r_ptr->flagsr & RFR_RES_NEXU)
1736 note = _("には耐性がある。", " resists.");
1737 dam *= 3; dam /= randint1(6) + 6;
1738 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1746 if (seen) obvious = TRUE;
1748 if (r_ptr->flagsr & RFR_RES_ALL)
1750 note = _("には完全な耐性がある!", " is immune.");
1752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1755 if (r_ptr->flagsr & RFR_RES_WALL)
1757 note = _("には耐性がある。", " resists.");
1758 dam *= 3; dam /= randint1(6) + 6;
1759 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1761 else do_stun = (randint1(15) + r) / (r + 1);
1765 /* Inertia -- breathers resist */
1768 if (seen) obvious = TRUE;
1770 if (r_ptr->flagsr & RFR_RES_ALL)
1772 note = _("には完全な耐性がある!", " is immune.");
1774 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1777 if (r_ptr->flagsr & RFR_RES_INER)
1779 note = _("には耐性がある。", " resists.");
1780 dam *= 3; dam /= randint1(6) + 6;
1781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1785 /* Powerful monsters can resist */
1786 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1787 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1791 /* Normal monsters slow down */
1794 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1796 note = _("の動きが遅くなった。", " starts moving slower.");
1803 /* Time -- breathers resist */
1806 if (seen) obvious = TRUE;
1808 if (r_ptr->flagsr & RFR_RES_ALL)
1810 note = _("には完全な耐性がある!", " is immune.");
1812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1815 if (r_ptr->flagsr & RFR_RES_TIME)
1817 note = _("には耐性がある。", " resists.");
1818 dam *= 3; dam /= randint1(6) + 6;
1819 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1821 else do_time = (dam + 1) / 2;
1825 /* Gravity -- breathers resist */
1828 bool resist_tele = FALSE;
1830 if (seen) obvious = TRUE;
1832 if (r_ptr->flagsr & RFR_RES_ALL)
1834 note = _("には完全な耐性がある!", " is immune.");
1836 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1839 if (r_ptr->flagsr & RFR_RES_TELE)
1841 if (r_ptr->flags1 & (RF1_UNIQUE))
1843 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1844 note = _("には効果がなかった。", " is unaffected!");
1847 else if (r_ptr->level > randint1(100))
1849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1850 note = _("には耐性がある!", " resists!");
1855 if (!resist_tele) do_dist = 10;
1857 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1859 if (r_ptr->flagsr & RFR_RES_GRAV)
1861 note = _("には耐性がある!", " resists!");
1862 dam *= 3; dam /= randint1(6) + 6;
1864 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1869 /* Powerful monsters can resist */
1870 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1871 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1875 /* Normal monsters slow down */
1878 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1880 note = _("の動きが遅くなった。", " starts moving slower.");
1885 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1887 /* Attempt a saving throw */
1888 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1889 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1893 /* No obvious effect */
1894 note = _("には効果がなかった。", " is unaffected!");
1906 if (seen) obvious = TRUE;
1908 if (r_ptr->flagsr & RFR_RES_ALL)
1910 note = _("には完全な耐性がある!", " is immune.");
1912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1920 case GF_DISINTEGRATE:
1922 if (seen) obvious = TRUE;
1924 if (r_ptr->flagsr & RFR_RES_ALL)
1926 note = _("には完全な耐性がある!", " is immune.");
1928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1931 if (r_ptr->flags3 & RF3_HURT_ROCK)
1933 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1934 note = _("の皮膚がただれた!", " loses some skin!");
1935 note_dies = _("は蒸発した!", " evaporates!");
1943 if (seen) obvious = TRUE;
1945 /* PSI only works if the monster can see you! -- RG */
1946 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1949 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1954 if (r_ptr->flagsr & RFR_RES_ALL)
1956 note = _("には完全な耐性がある!", " is immune.");
1958 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1961 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1964 note = _("には完全な耐性がある!", " is immune.");
1965 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1968 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1969 (r_ptr->flags3 & RF3_ANIMAL) ||
1970 (r_ptr->level > randint1(3 * dam)))
1972 note = _("には耐性がある!", " resists!");
1976 * Powerful demons & undead can turn a mindcrafter's
1977 * attacks back on them
1979 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1980 (r_ptr->level > p_ptr->lev / 2) &&
1984 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1985 (seen ? "%^s's corrupted mind backlashes your attack!" :
1986 "%^ss corrupted mind backlashes your attack!")), m_name);
1989 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1991 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1995 /* Injure +/- confusion */
1996 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1997 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1998 if (one_in_(4) && !CHECK_MULTISHADOW())
2000 switch (randint1(4))
2003 set_confused(p_ptr->confused + 3 + randint1(dam));
2006 set_stun(p_ptr->stun + randint1(dam));
2010 if (r_ptr->flags3 & RF3_NO_FEAR)
2011 note = _("には効果がなかった。", " is unaffected.");
2013 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2017 if (!p_ptr->free_act)
2018 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2027 if ((dam > 0) && one_in_(4))
2029 switch (randint1(4))
2032 do_conf = 3 + randint1(dam);
2035 do_stun = 3 + randint1(dam);
2038 do_fear = 3 + randint1(dam);
2041 note = _("は眠り込んでしまった!", " falls asleep!");
2042 do_sleep = 3 + randint1(dam);
2047 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2053 if (seen) obvious = TRUE;
2055 if (r_ptr->flagsr & RFR_RES_ALL)
2057 note = _("には完全な耐性がある!", " is immune.");
2059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2062 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2065 note = _("には完全な耐性がある!", " is immune.");
2067 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2068 (r_ptr->flags3 & RF3_ANIMAL) ||
2069 (r_ptr->level > randint1(3 * dam)))
2071 note = _("には耐性がある!", " resists!");
2075 * Powerful demons & undead can turn a mindcrafter's
2076 * attacks back on them
2078 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2079 (r_ptr->level > p_ptr->lev / 2) &&
2083 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2084 (seen ? "%^s's corrupted mind backlashes your attack!" :
2085 "%^ss corrupted mind backlashes your attack!")), m_name);
2087 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2089 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2093 /* Injure + mana drain */
2094 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2095 if (!CHECK_MULTISHADOW())
2097 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2098 p_ptr->csp -= damroll(5, dam) / 2;
2099 if (p_ptr->csp < 0) p_ptr->csp = 0;
2100 p_ptr->redraw |= PR_MANA;
2101 p_ptr->window |= (PW_SPELL);
2103 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2110 int b = damroll(5, dam) / 4;
2111 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2112 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2113 (seen ? "You convert %s's pain into %s!" :
2114 "You convert %ss pain into %s!"));
2115 msg_format(msg, m_name, str);
2117 b = MIN(p_ptr->msp, p_ptr->csp + b);
2119 p_ptr->redraw |= PR_MANA;
2120 p_ptr->window |= (PW_SPELL);
2122 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2126 case GF_TELEKINESIS:
2128 if (seen) obvious = TRUE;
2130 if (r_ptr->flagsr & RFR_RES_ALL)
2132 note = _("には完全な耐性がある!", " is immune.");
2134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2139 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2144 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2146 /* Attempt a saving throw */
2147 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2148 (r_ptr->level > 5 + randint1(dam)))
2152 /* No obvious effect */
2158 /* Psycho-spear -- powerful magic missile */
2161 if (seen) obvious = TRUE;
2163 if (r_ptr->flagsr & RFR_RES_ALL)
2165 note = _("には完全な耐性がある!", " is immune.");
2167 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2173 /* Meteor -- powerful magic missile */
2176 if (seen) obvious = TRUE;
2178 if (r_ptr->flagsr & RFR_RES_ALL)
2180 note = _("には完全な耐性がある!", " is immune.");
2182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2190 if (!is_hostile(m_ptr)) break;
2192 if (seen) obvious = TRUE;
2194 if (r_ptr->flagsr & RFR_RES_ALL)
2196 note = _("には効果がなかった!", " is immune.");
2198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2201 /* Attempt a saving throw */
2202 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2203 (r_ptr->flags3 & RF3_NO_CONF) ||
2204 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2206 /* Memorize a flag */
2207 if (r_ptr->flags3 & RF3_NO_CONF)
2209 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2216 * Powerful demons & undead can turn a mindcrafter's
2217 * attacks back on them
2219 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2220 (r_ptr->level > p_ptr->lev / 2) &&
2224 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2225 (seen ? "%^s's corrupted mind backlashes your attack!" :
2226 "%^ss corrupted mind backlashes your attack!")), m_name);
2229 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2231 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2235 /* Confuse, stun, terrify */
2236 switch (randint1(4))
2239 set_stun(p_ptr->stun + dam / 2);
2242 set_confused(p_ptr->confused + dam / 2);
2246 if (r_ptr->flags3 & RF3_NO_FEAR)
2247 note = _("には効果がなかった。", " is unaffected.");
2249 set_afraid(p_ptr->afraid + dam);
2256 /* No obvious effect */
2257 note = _("には効果がなかった。", " is unaffected.");
2263 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2265 note = _("があなたに隷属した。", " is in your thrall!");
2270 switch (randint1(4))
2284 /* No "real" damage */
2291 /* Ice -- Cold + Cuts + Stun */
2294 if (seen) obvious = TRUE;
2296 if (r_ptr->flagsr & RFR_RES_ALL)
2298 note = _("には完全な耐性がある!", " is immune.");
2300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2303 do_stun = (randint1(15) + 1) / (r + 1);
2304 if (r_ptr->flagsr & RFR_IM_COLD)
2306 note = _("にはかなり耐性がある!", " resists a lot.");
2308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2310 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2312 note = _("はひどい痛手をうけた。", " is hit hard.");
2314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2321 case GF_HYPODYNAMIA:
2323 if (seen) obvious = TRUE;
2325 if (r_ptr->flagsr & RFR_RES_ALL)
2327 note = _("には完全な耐性がある!", " is immune.");
2329 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2332 if (!monster_living(m_ptr->r_idx))
2334 if (is_original_ap_and_seen(m_ptr))
2336 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2337 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2338 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2340 note = _("には効果がなかった。", " is unaffected.");
2344 else do_time = (dam+7)/8;
2352 if (seen) obvious = TRUE;
2354 if (r_ptr->flagsr & RFR_RES_ALL)
2356 note = _("には完全な耐性がある!", " is immune.");
2358 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2361 if (!monster_living(m_ptr->r_idx))
2363 if (is_original_ap_and_seen(m_ptr))
2365 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2366 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2367 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2369 note = _("には完全な耐性がある!", " is immune.");
2373 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2374 (randint1(888) != 666)) ||
2375 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2376 randint1(100) != 66))
2378 note = _("には耐性がある!", " resists!");
2386 /* Polymorph monster (Use "dam" as "power") */
2389 if (seen) obvious = TRUE;
2391 if (r_ptr->flagsr & RFR_RES_ALL)
2393 note = _("には効果がなかった。", " is unaffected.");
2395 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2398 /* Attempt to polymorph (see below) */
2401 /* Powerful monsters can resist */
2402 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2403 (r_ptr->flags1 & RF1_QUESTOR) ||
2404 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2406 note = _("には効果がなかった。", " is unaffected.");
2411 /* No "real" damage */
2418 /* Clone monsters (Ignore "dam") */
2421 if (seen) obvious = TRUE;
2423 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2425 note = _("には効果がなかった。", " is unaffected.");
2430 m_ptr->hp = m_ptr->maxhp;
2432 /* Attempt to clone. */
2433 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2435 note = _("が分裂した!", " spawns!");
2439 /* No "real" damage */
2446 /* Heal Monster (use "dam" as amount of healing) */
2449 if (seen) obvious = TRUE;
2452 (void)set_monster_csleep(g_ptr->m_idx, 0);
2454 if (m_ptr->maxhp < m_ptr->max_maxhp)
2456 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2457 m_ptr->maxhp = m_ptr->max_maxhp;
2462 /* Redraw (later) if needed */
2463 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2464 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2472 if (seen) obvious = TRUE;
2475 (void)set_monster_csleep(g_ptr->m_idx, 0);
2476 if (MON_STUNNED(m_ptr))
2478 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2479 (void)set_monster_stunned(g_ptr->m_idx, 0);
2481 if (MON_CONFUSED(m_ptr))
2483 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2484 (void)set_monster_confused(g_ptr->m_idx, 0);
2486 if (MON_MONFEAR(m_ptr))
2488 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2489 (void)set_monster_monfear(g_ptr->m_idx, 0);
2493 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2496 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2500 chg_virtue(V_VITALITY, 1);
2502 if (r_ptr->flags1 & RF1_UNIQUE)
2503 chg_virtue(V_INDIVIDUALISM, 1);
2505 if (is_friendly(m_ptr))
2506 chg_virtue(V_HONOUR, 1);
2507 else if (!(r_ptr->flags3 & RF3_EVIL))
2509 if (r_ptr->flags3 & RF3_GOOD)
2510 chg_virtue(V_COMPASSION, 2);
2512 chg_virtue(V_COMPASSION, 1);
2515 if (r_ptr->flags3 & RF3_ANIMAL)
2516 chg_virtue(V_NATURE, 1);
2519 if (m_ptr->r_idx == MON_LEPER)
2522 if (!who) chg_virtue(V_COMPASSION, 5);
2525 /* Redraw (later) if needed */
2526 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2527 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2529 note = _("は体力を回復したようだ。", " looks healthier.");
2531 /* No "real" damage */
2537 /* Speed Monster (Ignore "dam") */
2540 if (seen) obvious = TRUE;
2543 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2545 note = _("の動きが速くなった。", " starts moving faster.");
2550 if (r_ptr->flags1 & RF1_UNIQUE)
2551 chg_virtue(V_INDIVIDUALISM, 1);
2552 if (is_friendly(m_ptr))
2553 chg_virtue(V_HONOUR, 1);
2556 /* No "real" damage */
2562 /* Slow Monster (Use "dam" as "power") */
2565 if (seen) obvious = TRUE;
2567 if (r_ptr->flagsr & RFR_RES_ALL)
2569 note = _("には効果がなかった。", " is unaffected.");
2571 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2574 /* Powerful monsters can resist */
2575 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2576 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2578 note = _("には効果がなかった。", " is unaffected.");
2582 /* Normal monsters slow down */
2585 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2587 note = _("の動きが遅くなった。", " starts moving slower.");
2591 /* No "real" damage */
2597 /* Sleep (Use "dam" as "power") */
2600 if (seen) obvious = TRUE;
2602 if (r_ptr->flagsr & RFR_RES_ALL)
2604 note = _("には効果がなかった。", " is unaffected.");
2606 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2609 /* Attempt a saving throw */
2610 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2611 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2612 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2614 /* Memorize a flag */
2615 if (r_ptr->flags3 & RF3_NO_SLEEP)
2617 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2619 /* No obvious effect */
2620 note = _("には効果がなかった。", " is unaffected.");
2625 /* Go to sleep (much) later */
2626 note = _("は眠り込んでしまった!", " falls asleep!");
2630 /* No "real" damage */
2636 /* Sleep (Use "dam" as "power") */
2637 case GF_STASIS_EVIL:
2639 if (seen) obvious = TRUE;
2641 if (r_ptr->flagsr & RFR_RES_ALL)
2643 note = _("には効果がなかった!", " is immune.");
2645 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2648 /* Attempt a saving throw */
2649 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2650 !(r_ptr->flags3 & RF3_EVIL) ||
2651 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2653 note = _("には効果がなかった。", " is unaffected.");
2658 /* Go to sleep (much) later */
2659 note = _("は動けなくなった!", " is suspended!");
2663 /* No "real" damage */
2668 /* Sleep (Use "dam" as "power") */
2671 if (seen) obvious = TRUE;
2673 if (r_ptr->flagsr & RFR_RES_ALL)
2675 note = _("には効果がなかった。", " is unaffected.");
2677 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2680 /* Attempt a saving throw */
2681 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2682 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2684 note = _("には効果がなかった。", " is unaffected.");
2689 /* Go to sleep (much) later */
2690 note = _("は動けなくなった!", " is suspended!");
2694 /* No "real" damage */
2703 vir = virtue_number(V_HARMONY);
2706 dam += p_ptr->virtues[vir-1]/10;
2709 vir = virtue_number(V_INDIVIDUALISM);
2712 dam -= p_ptr->virtues[vir-1]/20;
2715 if (seen) obvious = TRUE;
2717 /* Attempt a saving throw */
2718 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2722 /* No obvious effect */
2723 note = _("には効果がなかった。", " is unaffected.");
2726 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2728 else if (p_ptr->cursed & TRC_AGGRAVATE)
2730 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2731 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2735 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2738 chg_virtue(V_INDIVIDUALISM, -1);
2739 if (r_ptr->flags3 & RF3_ANIMAL)
2740 chg_virtue(V_NATURE, 1);
2743 /* No "real" damage */
2748 /* Control undead */
2749 case GF_CONTROL_UNDEAD:
2752 if (seen) obvious = TRUE;
2754 vir = virtue_number(V_UNLIFE);
2757 dam += p_ptr->virtues[vir-1]/10;
2760 vir = virtue_number(V_INDIVIDUALISM);
2763 dam -= p_ptr->virtues[vir-1]/20;
2766 /* Attempt a saving throw */
2767 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2768 !(r_ptr->flags3 & RF3_UNDEAD))
2770 /* No obvious effect */
2771 note = _("には効果がなかった。", " is unaffected.");
2773 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2775 else if (p_ptr->cursed & TRC_AGGRAVATE)
2777 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2778 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2782 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2786 /* No "real" damage */
2792 case GF_CONTROL_DEMON:
2795 if (seen) obvious = TRUE;
2797 vir = virtue_number(V_UNLIFE);
2800 dam += p_ptr->virtues[vir-1]/10;
2803 vir = virtue_number(V_INDIVIDUALISM);
2806 dam -= p_ptr->virtues[vir-1]/20;
2809 /* Attempt a saving throw */
2810 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2811 !(r_ptr->flags3 & RF3_DEMON))
2813 /* No obvious effect */
2814 note = _("には効果がなかった。", " is unaffected.");
2816 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2818 else if (p_ptr->cursed & TRC_AGGRAVATE)
2820 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2821 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2825 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2829 /* No "real" damage */
2835 case GF_CONTROL_ANIMAL:
2838 if (seen) obvious = TRUE;
2840 vir = virtue_number(V_NATURE);
2843 dam += p_ptr->virtues[vir-1]/10;
2846 vir = virtue_number(V_INDIVIDUALISM);
2849 dam -= p_ptr->virtues[vir-1]/20;
2852 /* Attempt a saving throw */
2853 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2854 !(r_ptr->flags3 & RF3_ANIMAL))
2857 /* No obvious effect */
2858 note = _("には効果がなかった。", " is unaffected.");
2860 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2862 else if (p_ptr->cursed & TRC_AGGRAVATE)
2864 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2865 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2869 note = _("はなついた。", " is tamed!");
2871 if (r_ptr->flags3 & RF3_ANIMAL)
2872 chg_virtue(V_NATURE, 1);
2875 /* No "real" damage */
2881 case GF_CHARM_LIVING:
2885 vir = virtue_number(V_UNLIFE);
2886 if (seen) obvious = TRUE;
2888 vir = virtue_number(V_UNLIFE);
2891 dam -= p_ptr->virtues[vir-1]/10;
2894 vir = virtue_number(V_INDIVIDUALISM);
2897 dam -= p_ptr->virtues[vir-1]/20;
2900 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2902 /* Attempt a saving throw */
2903 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2904 !monster_living(m_ptr->r_idx))
2907 /* No obvious effect */
2908 note = _("には効果がなかった。", " is unaffected.");
2910 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2912 else if (p_ptr->cursed & TRC_AGGRAVATE)
2914 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2915 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2919 note = _("を支配した。", " is tamed!");
2921 if (r_ptr->flags3 & RF3_ANIMAL)
2922 chg_virtue(V_NATURE, 1);
2925 /* No "real" damage */
2930 /* Confusion (Use "dam" as "power") */
2933 if (seen) obvious = TRUE;
2935 if (r_ptr->flagsr & RFR_RES_ALL)
2937 note = _("には効果がなかった。", " is unaffected.");
2939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2942 /* Get confused later */
2943 do_conf = damroll(3, (dam / 2)) + 1;
2945 /* Attempt a saving throw */
2946 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2947 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2948 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2950 /* Memorize a flag */
2951 if (r_ptr->flags3 & (RF3_NO_CONF))
2953 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2959 /* No obvious effect */
2960 note = _("には効果がなかった。", " is unaffected.");
2964 /* No "real" damage */
2971 if (seen) obvious = TRUE;
2973 if (r_ptr->flagsr & RFR_RES_ALL)
2975 note = _("には効果がなかった。", " is unaffected.");
2977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2980 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2982 /* Attempt a saving throw */
2983 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2984 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2989 /* No obvious effect */
2990 note = _("には効果がなかった。", " is unaffected.");
2994 /* No "real" damage */
3002 /* Lite, but only hurts susceptible creatures */
3010 if (r_ptr->flagsr & RFR_RES_ALL)
3016 if (r_ptr->flags3 & (RF3_HURT_LITE))
3018 /* Obvious effect */
3019 if (seen) obvious = TRUE;
3021 /* Memorize the effects */
3022 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3024 /* Special effect */
3025 note = _("は光に身をすくめた!", " cringes from the light!");
3026 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3029 /* Normally no damage */
3041 /* Lite -- opposite of Dark */
3044 if (seen) obvious = TRUE;
3046 if (r_ptr->flagsr & RFR_RES_ALL)
3048 note = _("には完全な耐性がある!", " is immune.");
3050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3053 if (r_ptr->flagsr & RFR_RES_LITE)
3055 note = _("には耐性がある!", " resists!");
3056 dam *= 2; dam /= (randint1(6)+6);
3057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3059 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3061 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3062 note = _("は光に身をすくめた!", " cringes from the light!");
3063 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3070 /* Dark -- opposite of Lite */
3073 if (seen) obvious = TRUE;
3075 if (r_ptr->flagsr & RFR_RES_ALL)
3077 note = _("には完全な耐性がある!", " is immune.");
3079 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3082 if (r_ptr->flagsr & RFR_RES_DARK)
3084 note = _("には耐性がある!", " resists!");
3085 dam *= 2; dam /= (randint1(6)+6);
3086 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3095 if (r_ptr->flagsr & RFR_RES_ALL)
3100 /* Hurt by rock remover */
3101 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3104 if (seen) obvious = TRUE;
3106 /* Memorize the effects */
3107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3109 /* Cute little message */
3110 note = _("の皮膚がただれた!", " loses some skin!");
3111 note_dies = _("はドロドロに溶けた!", " dissolves!");
3114 /* Usually, ignore the effects */
3125 /* Teleport undead (Use "dam" as "power") */
3126 case GF_AWAY_UNDEAD:
3128 /* Only affect undead */
3129 if (r_ptr->flags3 & (RF3_UNDEAD))
3131 bool resists_tele = FALSE;
3133 if (r_ptr->flagsr & RFR_RES_TELE)
3135 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3138 note = _("には効果がなかった。", " is unaffected.");
3139 resists_tele = TRUE;
3141 else if (r_ptr->level > randint1(100))
3143 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3144 note = _("には耐性がある!", " resists!");
3145 resists_tele = TRUE;
3151 if (seen) obvious = TRUE;
3152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3164 /* No "real" damage */
3170 /* Teleport evil (Use "dam" as "power") */
3173 /* Only affect evil */
3174 if (r_ptr->flags3 & (RF3_EVIL))
3176 bool resists_tele = FALSE;
3178 if (r_ptr->flagsr & RFR_RES_TELE)
3180 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3183 note = _("には効果がなかった。", " is unaffected.");
3184 resists_tele = TRUE;
3186 else if (r_ptr->level > randint1(100))
3188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3189 note = _("には耐性がある!", " resists!");
3190 resists_tele = TRUE;
3196 if (seen) obvious = TRUE;
3197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3209 /* No "real" damage */
3215 /* Teleport monster (Use "dam" as "power") */
3218 bool resists_tele = FALSE;
3219 if (r_ptr->flagsr & RFR_RES_TELE)
3221 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3223 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3224 note = _("には効果がなかった。", " is unaffected.");
3225 resists_tele = TRUE;
3227 else if (r_ptr->level > randint1(100))
3229 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3230 note = _("には耐性がある!", " resists!");
3231 resists_tele = TRUE;
3237 if (seen) obvious = TRUE;
3239 /* Prepare to teleport */
3243 /* No "real" damage */
3249 /* Turn undead (Use "dam" as "power") */
3250 case GF_TURN_UNDEAD:
3252 if (r_ptr->flagsr & RFR_RES_ALL)
3257 /* Only affect undead */
3258 if (r_ptr->flags3 & (RF3_UNDEAD))
3260 if (seen) obvious = TRUE;
3262 /* Learn about type */
3263 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3265 /* Apply some fear */
3266 do_fear = damroll(3, (dam / 2)) + 1;
3268 /* Attempt a saving throw */
3269 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3271 /* No obvious effect */
3272 note = _("には効果がなかった。", " is unaffected.");
3285 /* No "real" damage */
3291 /* Turn evil (Use "dam" as "power") */
3294 if (r_ptr->flagsr & RFR_RES_ALL)
3299 /* Only affect evil */
3300 if (r_ptr->flags3 & (RF3_EVIL))
3302 if (seen) obvious = TRUE;
3304 /* Learn about type */
3305 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3307 /* Apply some fear */
3308 do_fear = damroll(3, (dam / 2)) + 1;
3310 /* Attempt a saving throw */
3311 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3313 /* No obvious effect */
3314 note = _("には効果がなかった。", " is unaffected.");
3327 /* No "real" damage */
3333 /* Turn monster (Use "dam" as "power") */
3336 if (r_ptr->flagsr & RFR_RES_ALL)
3341 if (seen) obvious = TRUE;
3343 /* Apply some fear */
3344 do_fear = damroll(3, (dam / 2)) + 1;
3346 /* Attempt a saving throw */
3347 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3348 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3349 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3351 /* No obvious effect */
3352 note = _("には効果がなかった。", " is unaffected.");
3357 /* No "real" damage */
3364 case GF_DISP_UNDEAD:
3366 if (r_ptr->flagsr & RFR_RES_ALL)
3372 /* Only affect undead */
3373 if (r_ptr->flags3 & (RF3_UNDEAD))
3375 if (seen) obvious = TRUE;
3377 /* Learn about type */
3378 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3380 note = _("は身震いした。", " shudders.");
3381 note_dies = _("はドロドロに溶けた!", " dissolves!");
3401 if (r_ptr->flagsr & RFR_RES_ALL)
3407 /* Only affect evil */
3408 if (r_ptr->flags3 & (RF3_EVIL))
3410 if (seen) obvious = TRUE;
3412 /* Learn about type */
3413 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3415 note = _("は身震いした。", " shudders.");
3416 note_dies = _("はドロドロに溶けた!", " dissolves!");
3435 if (r_ptr->flagsr & RFR_RES_ALL)
3441 /* Only affect good */
3442 if (r_ptr->flags3 & (RF3_GOOD))
3444 if (seen) obvious = TRUE;
3446 /* Learn about type */
3447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3449 note = _("は身震いした。", " shudders.");
3450 note_dies = _("はドロドロに溶けた!", " dissolves!");
3467 case GF_DISP_LIVING:
3469 if (r_ptr->flagsr & RFR_RES_ALL)
3475 /* Only affect non-undead */
3476 if (monster_living(m_ptr->r_idx))
3478 if (seen) obvious = TRUE;
3480 note = _("は身震いした。", " shudders.");
3481 note_dies = _("はドロドロに溶けた!", " dissolves!");
3500 if (r_ptr->flagsr & RFR_RES_ALL)
3506 /* Only affect demons */
3507 if (r_ptr->flags3 & (RF3_DEMON))
3509 if (seen) obvious = TRUE;
3511 /* Learn about type */
3512 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3514 note = _("は身震いした。", " shudders.");
3515 note_dies = _("はドロドロに溶けた!", " dissolves!");
3531 /* Dispel monster */
3534 if (r_ptr->flagsr & RFR_RES_ALL)
3540 if (seen) obvious = TRUE;
3542 note = _("は身震いした。", " shudders.");
3543 note_dies = _("はドロドロに溶けた!", " dissolves!");
3550 if (seen) obvious = TRUE;
3552 if (r_ptr->flagsr & RFR_RES_ALL)
3554 note = _("には完全な耐性がある!", " is immune.");
3556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3560 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3564 /* Heal the monster */
3565 if (caster_ptr->hp < caster_ptr->maxhp)
3568 caster_ptr->hp += dam;
3569 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3571 /* Redraw (later) if needed */
3572 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3573 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3575 /* Special message */
3578 monster_desc(killer, caster_ptr, 0);
3579 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3585 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3586 (void)hp_player(dam);
3591 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3600 if (seen) obvious = TRUE;
3601 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3603 if (r_ptr->flagsr & RFR_RES_ALL)
3605 note = _("には完全な耐性がある!", " is immune.");
3607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3611 /* Attempt a saving throw */
3612 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3613 (r_ptr->flags3 & RF3_NO_CONF) ||
3614 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3616 /* Memorize a flag */
3617 if (r_ptr->flags3 & (RF3_NO_CONF))
3619 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3621 note = _("には効果がなかった。", " is unaffected.");
3624 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3627 note = _("には完全な耐性がある!", " is immune.");
3630 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3633 note = _("には耐性がある。", " resists.");
3638 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3639 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3641 if (who > 0) do_conf = randint0(4) + 4;
3642 else do_conf = randint0(8) + 8;
3648 case GF_BRAIN_SMASH:
3650 if (seen) obvious = TRUE;
3651 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3653 if (r_ptr->flagsr & RFR_RES_ALL)
3655 note = _("には完全な耐性がある!", " is immune.");
3657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3661 /* Attempt a saving throw */
3662 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3663 (r_ptr->flags3 & RF3_NO_CONF) ||
3664 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3666 /* Memorize a flag */
3667 if (r_ptr->flags3 & (RF3_NO_CONF))
3669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3671 note = _("には効果がなかった。", " is unaffected.");
3674 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3676 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3677 note = _("には完全な耐性がある!", " is immune.");
3680 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3683 note = _("には耐性がある!", " resists!");
3688 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3689 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3693 do_conf = randint0(4) + 4;
3694 do_stun = randint0(4) + 4;
3698 do_conf = randint0(8) + 8;
3699 do_stun = randint0(8) + 8;
3701 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3709 if (seen) obvious = TRUE;
3710 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3712 if (r_ptr->flagsr & RFR_RES_ALL)
3714 note = _("には完全な耐性がある!", " is immune.");
3716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3720 /* Attempt a saving throw */
3721 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3723 note = _("には効果がなかった。", " is unaffected.");
3732 if (seen) obvious = TRUE;
3733 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3735 if (r_ptr->flagsr & RFR_RES_ALL)
3737 note = _("には完全な耐性がある!", " is immune.");
3739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3743 /* Attempt a saving throw */
3744 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3746 note = _("には効果がなかった。", " is unaffected.");
3755 if (seen) obvious = TRUE;
3756 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3758 if (r_ptr->flagsr & RFR_RES_ALL)
3760 note = _("には完全な耐性がある!", " is immune.");
3762 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3766 /* Attempt a saving throw */
3767 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3769 note = _("には効果がなかった。", " is unaffected.");
3778 if (seen) obvious = TRUE;
3780 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3781 "You point at %s, screaming the word, 'DIE!'."), m_name);
3783 if (r_ptr->flagsr & RFR_RES_ALL)
3785 note = _("には完全な耐性がある!", " is immune.");
3787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3791 /* Attempt a saving throw */
3792 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3794 note = _("には効果がなかった。", " is unaffected.");
3803 if (seen) obvious = TRUE;
3805 if (r_ptr->flagsr & RFR_RES_ALL)
3807 note = _("には完全な耐性がある!", " is immune.");
3809 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3813 if (r_ptr->flags1 & RF1_UNIQUE)
3815 note = _("には効果がなかった。", " is unaffected.");
3820 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3821 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3823 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3825 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3829 note = _("は耐性を持っている!", "resists!");
3836 /* Capture monster */
3840 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3841 (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)
3843 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3848 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3849 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3850 nokori_hp = m_ptr->maxhp * 3 / 10;
3852 nokori_hp = m_ptr->maxhp * 3 / 20;
3854 if (m_ptr->hp >= nokori_hp)
3856 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3859 else if (m_ptr->hp < randint0(nokori_hp))
3861 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3862 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3863 cap_mon = m_ptr->r_idx;
3864 cap_mspeed = m_ptr->mspeed;
3866 cap_maxhp = m_ptr->max_maxhp;
3867 cap_nickname = m_ptr->nickname; /* Quark transfer */
3868 if (g_ptr->m_idx == p_ptr->riding)
3870 if (rakuba(-1, FALSE))
3872 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3876 delete_monster_idx(g_ptr->m_idx);
3882 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3888 /* Attack (Use "dam" as attack type) */
3891 /* Return this monster's death */
3892 return py_attack(y, x, dam);
3895 /* Sleep (Use "dam" as "power") */
3901 if (seen) obvious = TRUE;
3903 if (r_ptr->flagsr & RFR_RES_ALL)
3905 note = _("には効果がなかった。", " is unaffected.");
3907 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3910 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3912 note = _("には効果がなかった。", " is unaffected.");
3915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3918 if (MON_CSLEEP(m_ptr))
3920 note = _("には効果がなかった。", " is unaffected.");
3926 if (one_in_(5)) effect = 1;
3927 else if (one_in_(4)) effect = 2;
3928 else if (one_in_(3)) effect = 3;
3933 /* Powerful monsters can resist */
3934 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3935 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3937 note = _("には効果がなかった。", " is unaffected.");
3941 /* Normal monsters slow down */
3944 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3946 note = _("の動きが遅くなった。", " starts moving slower.");
3951 else if (effect == 2)
3953 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3955 /* Attempt a saving throw */
3956 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3957 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3962 /* No obvious effect */
3963 note = _("には効果がなかった。", " is unaffected.");
3968 else if (effect == 3)
3970 /* Attempt a saving throw */
3971 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3972 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3973 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3975 /* Memorize a flag */
3976 if (r_ptr->flags3 & RF3_NO_SLEEP)
3978 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3981 /* No obvious effect */
3982 note = _("には効果がなかった。", " is unaffected.");
3987 /* Go to sleep (much) later */
3988 note = _("は眠り込んでしまった!", " falls asleep!");
3995 note = _("には効果がなかった。", " is unaffected.");
3998 /* No "real" damage */
4006 if (seen) obvious = TRUE;
4008 if (r_ptr->flagsr & RFR_RES_ALL)
4010 note = _("には効果がなかった。", " is unaffected.");
4012 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4016 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4018 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4019 chg_virtue(V_VITALITY, -1);
4029 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4031 if (r_ptr->flags3 & (RF3_HURT_LITE))
4033 /* Obvious effect */
4034 if (seen) obvious = TRUE;
4036 /* Memorize the effects */
4037 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4039 /* Special effect */
4040 note = _("は光に身をすくめた!", " cringes from the light!");
4041 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4044 /* Normally no damage */
4051 photo = m_ptr->r_idx;
4058 case GF_BLOOD_CURSE:
4060 if (seen) obvious = TRUE;
4062 if (r_ptr->flagsr & RFR_RES_ALL)
4064 note = _("には完全な耐性がある!", " is immune.");
4066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4074 bool success = FALSE;
4075 if (seen) obvious = TRUE;
4077 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4079 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4080 if (dam < 1) dam = 1;
4082 /* No need to tame your pet */
4085 note = _("の動きが速くなった。", " starts moving faster.");
4086 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
4090 /* Attempt a saving throw */
4091 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4092 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4093 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4094 (p_ptr->cursed & TRC_AGGRAVATE) ||
4095 ((r_ptr->level+10) > randint1(dam)))
4098 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4102 note = _("を支配した。", " is tamed!");
4104 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
4106 /* Learn about type */
4107 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4114 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4116 do_fear = randint1(90)+10;
4118 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4121 /* No "real" damage */
4128 if (seen) obvious = TRUE;
4130 if (r_ptr->flagsr & RFR_RES_ALL)
4132 note = _("には完全な耐性がある!", " is immune.");
4134 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4138 /* Attempt a saving throw */
4139 if (randint0(100 + dam) < (r_ptr->level + 50))
4141 note = _("には効果がなかった。", " is unaffected.");
4161 /* Absolutely no effect */
4162 if (skipped) return (FALSE);
4164 /* "Unique" monsters cannot be polymorphed */
4165 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4167 /* Quest monsters cannot be polymorphed */
4168 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4170 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4172 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4173 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4175 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4180 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4181 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4184 /* Modify the damage */
4186 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4187 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4189 /* Check for death */
4190 if (dam > m_ptr->hp)
4192 /* Extract method of death */
4197 /* Sound and Impact resisters never stun */
4199 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4200 !(r_ptr->flags3 & RF3_NO_STUN))
4202 if (seen) obvious = TRUE;
4205 if (MON_STUNNED(m_ptr))
4207 note = _("はひどくもうろうとした。", " is more dazed.");
4208 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4212 note = _("はもうろうとした。", " is dazed.");
4217 (void)set_monster_stunned(g_ptr->m_idx, tmp);
4223 /* Confusion and Chaos resisters (and sleepers) never confuse */
4225 !(r_ptr->flags3 & RF3_NO_CONF) &&
4226 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4228 if (seen) obvious = TRUE;
4230 /* Already partially confused */
4231 if (MON_CONFUSED(m_ptr))
4233 note = _("はさらに混乱したようだ。", " looks more confused.");
4234 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4237 /* Was not confused */
4240 note = _("は混乱したようだ。", " looks confused.");
4244 /* Apply confusion */
4245 (void)set_monster_confused(g_ptr->m_idx, tmp);
4253 if (seen) obvious = TRUE;
4255 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4259 note = _("は弱くなったようだ。", " seems weakened.");
4260 m_ptr->maxhp -= do_time;
4261 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4266 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4267 if (do_poly && (randint1(90) > r_ptr->level))
4269 if (polymorph_monster(y, x))
4271 if (seen) obvious = TRUE;
4273 /* Monster polymorphs */
4274 note = _("が変身した!", " changes!");
4276 /* Turn off the damage */
4282 note = _("には効果がなかった。", " is unaffected.");
4285 /* Hack -- Get new monster */
4286 m_ptr = &m_list[g_ptr->m_idx];
4288 /* Hack -- Get new race */
4289 r_ptr = &r_info[m_ptr->r_idx];
4292 /* Handle "teleport" */
4295 if (seen) obvious = TRUE;
4297 note = _("が消え去った!", " disappears!");
4299 if (!who) chg_virtue(V_VALOUR, -1);
4302 teleport_away(g_ptr->m_idx, do_dist,
4303 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4305 /* Hack -- get new location */
4309 /* Hack -- get new grid */
4310 g_ptr = &grid_array[y][x];
4317 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4324 if (typ == GF_DRAIN_MANA)
4326 /* Drain mana does nothing */
4329 /* If another monster did the damage, hurt the monster by hand */
4332 /* Redraw (later) if needed */
4333 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4334 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4336 /* Wake the monster up */
4337 (void)set_monster_csleep(g_ptr->m_idx, 0);
4339 /* Hurt the monster */
4347 if (is_pet(m_ptr) && !(m_ptr->ml))
4350 /* Give detailed messages if destroyed */
4353 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4356 msg_format("%^s%s", m_name, note);
4364 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4366 /* Generate treasure, etc */
4367 monster_death(g_ptr->m_idx, FALSE);
4370 delete_monster_idx(g_ptr->m_idx);
4374 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4378 /* Damaged monster */
4381 /* Give detailed messages if visible or destroyed */
4382 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4384 /* Hack -- Pain message */
4387 message_pain(g_ptr->m_idx, dam);
4394 /* Hack -- handle sleep */
4395 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
4399 else if (heal_leper)
4401 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4403 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4405 char m2_name[MAX_NLEN];
4407 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4408 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4411 delete_monster_idx(g_ptr->m_idx);
4414 /* If the player did it, give him experience, check fear */
4419 /* Hurt the monster, check for fear and death */
4420 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
4425 /* Damaged monster */
4428 /* HACK - anger the monster before showing the sleep message */
4429 if (do_sleep) anger_monster(m_ptr);
4431 /* Give detailed messages if visible or destroyed */
4432 if (note && seen_msg)
4433 msg_format(_("%s%s", "%^s%s"), m_name, note);
4435 /* Hack -- Pain message */
4436 else if (known && (dam || !do_fear))
4438 message_pain(g_ptr->m_idx, dam);
4441 /* Anger monsters */
4442 if (((dam > 0) || get_angry) && !do_sleep)
4443 anger_monster(m_ptr);
4445 if ((fear || do_fear) && seen)
4448 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4451 /* Hack -- handle sleep */
4452 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
4456 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4458 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4462 switch (randint1(28))
4467 msg_print(_("地面が揺れた...", "The ground trembles..."));
4468 earthquake(ty, tx, 4 + randint0(4));
4469 if (!one_in_(6)) break;
4471 case 3: case 4: case 5: case 6:
4474 int extra_dam = damroll(10, 10);
4475 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4477 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4478 if (!one_in_(6)) break;
4483 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4485 if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4486 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4487 if (!one_in_(6)) break;
4489 case 9: case 10: case 11:
4490 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4491 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4492 if (!one_in_(6)) break;
4493 case 12: case 13: case 14: case 15: case 16:
4494 aggravate_monsters(0);
4495 if (!one_in_(6)) break;
4497 count += activate_hi_summon(ty, tx, TRUE);
4498 if (!one_in_(6)) break;
4499 case 19: case 20: case 21: case 22:
4501 bool pet = !one_in_(3);
4502 BIT_FLAGS mode = PM_ALLOW_GROUP;
4504 if (pet) mode |= PM_FORCE_PET;
4505 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4507 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode, '\0');
4508 if (!one_in_(6)) break;
4510 case 23: case 24: case 25:
4511 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4512 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4514 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4515 else lose_exp(p_ptr->exp / 16);
4516 if (!one_in_(6)) break;
4517 case 26: case 27: case 28:
4526 (void)do_dec_stat(i);
4535 (void)do_dec_stat(randint0(6));
4544 if (p_ptr->inside_battle)
4546 p_ptr->health_who = g_ptr->m_idx;
4547 p_ptr->redraw |= (PR_HEALTH);
4551 /* Verify this code */
4552 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
4554 /* Redraw the monster grid */
4558 /* Update monster recall window */
4559 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
4561 p_ptr->window |= (PW_MONSTER);
4564 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
4568 if (!(flg & PROJECT_NO_HANGEKI))
4570 set_target(m_ptr, monster_target_y, monster_target_x);
4573 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
4575 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
4579 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
4581 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
4582 rakubadam_m = (dam > 200) ? 200 : dam;
4592 /* Prepare to make a Blade of Chaos */
4593 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
4595 q_ptr->pval = photo;
4597 /* Mark the item as fully known */
4598 q_ptr->ident |= (IDENT_MENTAL);
4599 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
4607 /* Return "Anything seen?" */
4612 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
4613 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4614 * @param who_name 効果を起こしたモンスターの名前
4615 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4616 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4617 * @param x 目標X座標 / Target x location (or location to travel "towards")
4618 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4619 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4621 * @param monspell 効果元のモンスター魔法ID
4622 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4624 * Handle a beam/bolt/ball causing damage to the player.
4625 * This routine takes a "source monster" (by index), a "distance", a default
4626 * "damage", and a "damage type". See "project_m()" above.
4627 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
4628 * is reduced (see "project_m()" above). This can happen if a monster breathes
4629 * at the player and hits a wall instead.
4630 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
4631 * to know if this is actually a ball or a bolt spell
4632 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
4633 * we just assume that the effects were obvious, for historical reasons.
4635 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
4640 /* Hack -- assume obvious */
4641 bool obvious = TRUE;
4643 /* Player blind-ness */
4644 bool blind = (p_ptr->blind ? TRUE : FALSE);
4646 /* Player needs a "description" (he is blind) */
4649 /* Source monster */
4650 monster_type *m_ptr = NULL;
4652 /* Monster name (for attacks) */
4653 GAME_TEXT m_name[MAX_NLEN];
4655 /* Monster name (for damage) */
4658 /* Hack -- messages */
4664 /* Player is not here */
4665 if (!player_bold(y, x)) return (FALSE);
4667 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4669 if (kawarimi(TRUE)) return FALSE;
4672 /* Player cannot hurt himself */
4673 if (!who) return (FALSE);
4674 if (who == p_ptr->riding) return (FALSE);
4676 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4679 int max_attempts = 10;
4680 sound(SOUND_REFLECT);
4683 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4684 else if (p_ptr->special_defense & KATA_FUUJIN)
4685 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4687 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4690 /* Choose 'new' target */
4695 t_y = m_list[who].fy - 1 + randint1(3);
4696 t_x = m_list[who].fx - 1 + randint1(3);
4699 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4701 if (max_attempts < 1)
4703 t_y = m_list[who].fy;
4704 t_x = m_list[who].fx;
4709 t_y = p_ptr->y - 1 + randint1(3);
4710 t_x = p_ptr->x - 1 + randint1(3);
4713 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4715 disturb(TRUE, TRUE);
4719 /* Limit maximum damage */
4720 if (dam > 1600) dam = 1600;
4722 /* Reduce damage by distance */
4723 dam = (dam + r) / (r + 1);
4726 /* If the player is blind, be more descriptive */
4727 if (blind) fuzzy = TRUE;
4732 m_ptr = &m_list[who];
4733 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4734 monster_desc(m_name, m_ptr, 0);
4736 /* Get the monster's real name (gotten before polymorph!) */
4737 strcpy(killer, who_name);
4743 case PROJECT_WHO_UNCTRL_POWER:
4744 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4747 case PROJECT_WHO_GLASS_SHARDS:
4748 strcpy(killer, _("ガラスの破片", "shards of glass"));
4752 strcpy(killer, _("罠", "a trap"));
4757 strcpy(m_name, killer);
4760 /* Analyze the damage */
4763 /* Standard damage -- hurts inventory too */
4766 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4767 get_damage = acid_dam(dam, killer, monspell, FALSE);
4771 /* Standard damage -- hurts inventory too */
4774 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4775 get_damage = fire_dam(dam, killer, monspell, FALSE);
4779 /* Standard damage -- hurts inventory too */
4782 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4783 get_damage = cold_dam(dam, killer, monspell, FALSE);
4787 /* Standard damage -- hurts inventory too */
4790 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4791 get_damage = elec_dam(dam, killer, monspell, FALSE);
4795 /* Standard damage -- also poisons player */
4798 bool double_resist = IS_OPPOSE_POIS();
4799 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4801 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4802 if (double_resist) dam = (dam + 2) / 3;
4804 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4809 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4811 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4813 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4818 /* Standard damage -- also poisons / mutates player */
4821 bool double_resist = IS_OPPOSE_POIS();
4822 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4824 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4825 if (double_resist) dam = (2 * dam + 2) / 5;
4826 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4827 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4829 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4831 if (one_in_(5)) /* 6 */
4833 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4834 if (one_in_(4)) /* 4 */
4842 inven_damage(set_acid_destroy, 2);
4848 /* Standard damage */
4851 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4852 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4856 /* Holy Orb -- Player only takes partial damage */
4859 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4860 if (p_ptr->align > 10)
4862 else if (p_ptr->align < -10)
4864 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4870 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4871 if (p_ptr->align > 10)
4873 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4877 /* Arrow -- XXX no dodging */
4882 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4884 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4886 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4889 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4893 /* Plasma -- XXX No resist */
4896 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4897 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4899 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4901 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4902 (void)set_stun(p_ptr->stun + plus_stun);
4905 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4907 inven_damage(set_acid_destroy, 3);
4913 /* Nether -- drain experience */
4916 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4917 if (p_ptr->resist_neth)
4919 if (!prace_is_(RACE_SPECTRE))
4921 dam *= 6; dam /= (randint1(4) + 7);
4924 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4926 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4928 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4930 learn_spell(monspell);
4934 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4940 /* Water -- stun/confuse */
4943 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4944 if (!CHECK_MULTISHADOW())
4946 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4948 set_stun(p_ptr->stun + randint1(40));
4950 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4952 set_confused(p_ptr->confused + randint1(5) + 5);
4955 if (one_in_(5) && !p_ptr->resist_water)
4957 inven_damage(set_cold_destroy, 3);
4960 if (p_ptr->resist_water) get_damage /= 4;
4963 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4967 /* Chaos -- many effects */
4970 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4971 if (p_ptr->resist_chaos)
4973 dam *= 6; dam /= (randint1(4) + 7);
4976 if (!CHECK_MULTISHADOW())
4978 if (!p_ptr->resist_conf)
4980 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4982 if (!p_ptr->resist_chaos)
4984 (void)set_image(p_ptr->image + randint1(10));
4987 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4988 (void)gain_random_mutation(0);
4991 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4993 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4996 if (!p_ptr->resist_chaos || one_in_(9))
4998 inven_damage(set_elec_destroy, 2);
4999 inven_damage(set_fire_destroy, 2);
5003 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5007 /* Shards -- mostly cutting */
5010 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5011 if (p_ptr->resist_shard)
5013 dam *= 6; dam /= (randint1(4) + 7);
5015 else if (!CHECK_MULTISHADOW())
5017 (void)set_cut(p_ptr->cut + dam);
5020 if (!p_ptr->resist_shard || one_in_(13))
5022 inven_damage(set_cold_destroy, 2);
5025 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5029 /* Sound -- mostly stunning */
5032 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5033 if (p_ptr->resist_sound)
5035 dam *= 5; dam /= (randint1(4) + 7);
5037 else if (!CHECK_MULTISHADOW())
5039 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5040 (void)set_stun(p_ptr->stun + plus_stun);
5043 if (!p_ptr->resist_sound || one_in_(13))
5045 inven_damage(set_cold_destroy, 2);
5048 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5052 /* Pure confusion */
5055 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5056 if (p_ptr->resist_conf)
5058 dam *= 5; dam /= (randint1(4) + 7);
5060 else if (!CHECK_MULTISHADOW())
5062 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5064 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5068 /* Disenchantment -- see above */
5071 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5072 if (p_ptr->resist_disen)
5074 dam *= 6; dam /= (randint1(4) + 7);
5076 else if (!CHECK_MULTISHADOW())
5078 (void)apply_disenchant(0);
5080 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5084 /* Nexus -- see above */
5087 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5088 if (p_ptr->resist_nexus)
5090 dam *= 6; dam /= (randint1(4) + 7);
5092 else if (!CHECK_MULTISHADOW())
5096 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5100 /* Force -- mostly stun */
5103 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5104 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5106 (void)set_stun(p_ptr->stun + randint1(20));
5108 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5113 /* Rocket -- stun, cut */
5116 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5117 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5119 (void)set_stun(p_ptr->stun + randint1(20));
5122 if (p_ptr->resist_shard)
5126 else if (!CHECK_MULTISHADOW())
5128 (void)set_cut(p_ptr->cut + (dam / 2));
5131 if (!p_ptr->resist_shard || one_in_(12))
5133 inven_damage(set_cold_destroy, 3);
5136 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5140 /* Inertia -- slowness */
5143 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5144 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5145 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5149 /* Lite -- blinding */
5152 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5153 if (p_ptr->resist_lite)
5155 dam *= 4; dam /= (randint1(4) + 7);
5157 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5159 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5162 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5164 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5167 else if (prace_is_(RACE_S_FAIRY))
5172 if (p_ptr->wraith_form) dam *= 2;
5173 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5175 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5177 p_ptr->wraith_form = 0;
5178 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5179 "The light forces you out of your incorporeal shadow form."));
5181 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5182 p_ptr->update |= (PU_MONSTERS);
5183 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5189 /* Dark -- blinding */
5192 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5193 if (p_ptr->resist_dark)
5195 dam *= 4; dam /= (randint1(4) + 7);
5197 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5199 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5201 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5203 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5207 /* Time -- bolt fewer effects XXX */
5210 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5211 if (p_ptr->resist_time)
5214 dam /= (randint1(4) + 7);
5215 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5217 else if (!CHECK_MULTISHADOW())
5219 switch (randint1(10))
5221 case 1: case 2: case 3: case 4: case 5:
5223 if (p_ptr->prace == RACE_ANDROID) break;
5224 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5225 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5229 case 6: case 7: case 8: case 9:
5231 switch (randint1(6))
5233 case 1: k = A_STR; act = _("強く", "strong"); break;
5234 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5235 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5236 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5237 case 5: k = A_CON; act = _("健康で", "hale"); break;
5238 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5241 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5242 "You're not as %s as you used to be..."), act);
5244 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5245 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5246 p_ptr->update |= (PU_BONUS);
5252 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5253 "You're not as powerful as you used to be..."));
5255 for (k = 0; k < A_MAX; k++)
5257 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5258 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5260 p_ptr->update |= (PU_BONUS);
5266 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5270 /* Gravity -- stun plus slowness plus teleport */
5273 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5274 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5276 if (!CHECK_MULTISHADOW())
5278 teleport_player(5, TELEPORT_PASSIVE);
5279 if (!p_ptr->levitation)
5280 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5281 if (!(p_ptr->resist_sound || p_ptr->levitation))
5283 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5284 (void)set_stun(p_ptr->stun + plus_stun);
5287 if (p_ptr->levitation)
5289 dam = (dam * 2) / 3;
5292 if (!p_ptr->levitation || one_in_(13))
5294 inven_damage(set_cold_destroy, 2);
5297 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5301 /* Standard damage */
5302 case GF_DISINTEGRATE:
5304 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5306 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5312 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5314 (void)hp_player(dam);
5321 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5322 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5329 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5330 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5336 if (p_ptr->free_act) break;
5337 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5339 if (ironman_nightmare)
5341 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5342 /* Have some nightmares */
5343 sanity_blast(NULL, FALSE);
5346 set_paralyzed(p_ptr->paralyzed + dam);
5356 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5357 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5364 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5365 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5372 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5374 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5375 if (!p_ptr->resist_shard || one_in_(13))
5377 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5378 inven_damage(set_cold_destroy, 2);
5384 /* Ice -- cold plus stun plus cuts */
5387 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5388 get_damage = cold_dam(dam, killer, monspell, FALSE);
5389 if (!CHECK_MULTISHADOW())
5391 if (!p_ptr->resist_shard)
5393 (void)set_cut(p_ptr->cut + damroll(5, 8));
5395 if (!p_ptr->resist_sound)
5397 (void)set_stun(p_ptr->stun + randint1(15));
5400 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5402 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5412 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5414 if (p_ptr->mimic_form)
5416 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5417 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5422 switch (p_ptr->prace)
5424 /* Some races are immune */
5438 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5450 if (CHECK_MULTISHADOW())
5452 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5454 else if (p_ptr->csp)
5458 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5460 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5463 if (dam >= p_ptr->csp)
5467 p_ptr->csp_frac = 0;
5476 learn_spell(monspell);
5477 p_ptr->redraw |= (PR_MANA);
5478 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5482 /* Heal the monster */
5483 if (m_ptr->hp < m_ptr->maxhp)
5487 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5489 /* Redraw (later) if needed */
5490 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5491 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5493 /* Special message */
5496 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5509 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5511 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5512 learn_spell(monspell);
5516 if (!CHECK_MULTISHADOW())
5518 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5520 if (!p_ptr->resist_conf)
5522 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5525 if (!p_ptr->resist_chaos && one_in_(3))
5527 (void)set_image(p_ptr->image + randint0(250) + 150);
5534 p_ptr->csp_frac = 0;
5536 p_ptr->redraw |= PR_MANA;
5539 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5545 case GF_BRAIN_SMASH:
5547 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5549 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5550 learn_spell(monspell);
5554 if (!CHECK_MULTISHADOW())
5556 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5562 p_ptr->csp_frac = 0;
5564 p_ptr->redraw |= PR_MANA;
5567 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5568 if (!CHECK_MULTISHADOW())
5570 if (!p_ptr->resist_blind)
5572 (void)set_blind(p_ptr->blind + 8 + randint0(8));
5574 if (!p_ptr->resist_conf)
5576 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5578 if (!p_ptr->free_act)
5580 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
5582 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5584 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5585 (void)do_dec_stat(A_INT);
5586 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5587 (void)do_dec_stat(A_WIS);
5589 if (!p_ptr->resist_chaos)
5591 (void)set_image(p_ptr->image + randint0(250) + 150);
5601 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5603 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5604 learn_spell(monspell);
5608 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
5609 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5617 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5619 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5620 learn_spell(monspell);
5624 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
5625 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5633 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5635 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5636 learn_spell(monspell);
5640 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5641 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5649 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5651 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5652 learn_spell(monspell);
5656 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5657 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5665 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5667 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5668 learn_spell(monspell);
5672 if (!CHECK_MULTISHADOW())
5674 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5675 curse_equipment(40, 20);
5678 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5680 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
5695 /* Hex - revenge damage stored */
5696 revenge_store(get_damage);
5698 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5699 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5701 GAME_TEXT m_name_self[80];
5704 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5706 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5707 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5708 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5711 if (p_ptr->riding && dam > 0)
5713 rakubadam_p = (dam > 200) ? 200 : dam;
5717 disturb(TRUE, TRUE);
5720 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5722 (void)kawarimi(FALSE);
5725 /* Return "Anything seen?" */
5731 * Find the distance from (x, y) to a line.
5733 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5735 /* Vector from (x, y) to (x1, y1) */
5736 POSITION py = y1 - y;
5737 POSITION px = x1 - x;
5740 POSITION ny = x2 - x1;
5741 POSITION nx = y1 - y2;
5744 POSITION pd = distance(y1, x1, y, x);
5745 POSITION nd = distance(y1, x1, y2, x2);
5747 if (pd > nd) return distance(y, x, y2, x2);
5749 /* Component of P on N */
5750 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5752 /* Absolute value */
5753 return((nd >= 0) ? nd : 0 - nd);
5760 * Modified version of los() for calculation of disintegration balls.
5761 * Disintegration effects are stopped by permanent walls.
5763 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5765 POSITION dx, dy; /* Delta */
5766 POSITION ax, ay; /* Absolute */
5767 POSITION sx, sy; /* Signs */
5768 POSITION qx, qy; /* Fractions */
5769 POSITION tx, ty; /* Scanners */
5770 POSITION f1, f2; /* Scale factors */
5771 POSITION m; /* Slope, or 1/Slope, of LOS */
5773 /* Extract the offset */
5777 /* Extract the absolute offset */
5781 /* Handle adjacent (or identical) grids */
5782 if ((ax < 2) && (ay < 2)) return (TRUE);
5784 /* Paranoia -- require "safe" origin */
5785 /* if (!in_bounds(y1, x1)) return (FALSE); */
5787 /* Directly South/North */
5790 /* South -- check for walls */
5793 for (ty = y1 + 1; ty < y2; ty++)
5795 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5799 /* North -- check for walls */
5802 for (ty = y1 - 1; ty > y2; ty--)
5804 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5812 /* Directly East/West */
5815 /* East -- check for walls */
5818 for (tx = x1 + 1; tx < x2; tx++)
5820 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5824 /* West -- check for walls */
5827 for (tx = x1 - 1; tx > x2; tx--)
5829 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5837 /* Extract some signs */
5838 sx = (dx < 0) ? -1 : 1;
5839 sy = (dy < 0) ? -1 : 1;
5841 /* Vertical "knights" */
5846 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5850 /* Horizontal "knights" */
5855 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5859 /* Calculate scale factor div 2 */
5862 /* Calculate scale factor */
5866 /* Travel horizontally */
5869 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5875 /* Consider the special case where slope == 1. */
5886 /* Note (below) the case (qy == f2), where */
5887 /* the LOS exactly meets the corner of a tile. */
5890 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5901 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5914 /* Travel vertically */
5917 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5933 /* Note (below) the case (qx == f2), where */
5934 /* the LOS exactly meets the corner of a tile. */
5937 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5948 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5969 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
5974 int brev = rad * rad / dist;
5978 int mdis = distance(y1, x1, y2, x2) + rad;
5980 while (bdis <= mdis)
5984 if ((0 < dist) && (path_n < dist))
5986 POSITION ny = GRID_Y(path_g[path_n]);
5987 POSITION nx = GRID_X(path_g[path_n]);
5988 POSITION nd = distance(ny, nx, y1, x1);
5990 /* Get next base point */
5999 /* Travel from center outward */
6000 for (cdis = 0; cdis <= brad; cdis++)
6002 /* Scan the maximal blast area of radius "cdis" */
6003 for (y = by - cdis; y <= by + cdis; y++)
6005 for (x = bx - cdis; x <= bx + cdis; x++)
6007 /* Ignore "illegal" locations */
6008 if (!in_bounds(y, x)) continue;
6010 /* Enforce a circular "ripple" */
6011 if (distance(y1, x1, y, x) != bdis) continue;
6013 /* Enforce an arc */
6014 if (distance(by, bx, y, x) != cdis) continue;
6020 /* Lights are stopped by opaque terrains */
6021 if (!los(by, bx, y, x)) continue;
6023 case GF_DISINTEGRATE:
6024 /* Disintegration are stopped only by perma-walls */
6025 if (!in_disintegration_range(by, bx, y, x)) continue;
6028 /* Ball explosions are stopped by walls */
6029 if (!projectable(by, bx, y, x)) continue;
6033 /* Save this grid */
6041 /* Encode some more "radius" info */
6042 gm[bdis + 1] = *pgrids;
6044 /* Increase the size */
6045 brad = rad * (path_n + brev) / (dist + brev);
6047 /* Find the next ripple */
6051 /* Store the effect size */
6057 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6058 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6059 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6060 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6061 * @param x 目標X座標 / Target x location (or location to travel "towards")
6062 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6063 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6064 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6065 * @param monspell 効果元のモンスター魔法ID
6066 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6069 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6070 * towards a given location (optionally passing over the heads of interposing
6071 * monsters), and have it do a given amount of damage to the monsters (and
6072 * optionally objects) within the given radius of the final location.
6074 * A "bolt" travels from source to target and affects only the target grid.
6075 * A "beam" travels from source to target, affecting all grids passed through.
6076 * A "ball" travels from source to the target, exploding at the target, and
6077 * affecting everything within the given radius of the target location.
6079 * Traditionally, a "bolt" does not affect anything on the ground, and does
6080 * not pass over the heads of interposing monsters, much like a traditional
6081 * missile, and will "stop" abruptly at the "target" even if no monster is
6082 * positioned there, while a "ball", on the other hand, passes over the heads
6083 * of monsters between the source and target, and affects everything except
6084 * the source monster which lies within the final radius, while a "beam"
6085 * affects every monster between the source and target, except for the casting
6086 * monster (or player), and rarely affects things on the ground.
6088 * Two special flags allow us to use this function in special ways, the
6089 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6090 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6091 * actually projecting from the source monster (or player).
6093 * The player will only get "experience" for monsters killed by himself
6094 * Unique monsters can only be destroyed by attacks from the player
6096 * Only 256 grids can be affected per projection, limiting the effective
6097 * "radius" of standard ball attacks to nine units (diameter nineteen).
6099 * One can project in a given "direction" by combining PROJECT_THRU with small
6100 * offsets to the initial location (see "line_spell()"), or by calculating
6101 * "virtual targets" far away from the player.
6103 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6104 * continuing until it actually hits somethings (useful for "stone to mud").
6106 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6108 * Balls must explode BEFORE hitting walls, or they would affect monsters
6109 * on both sides of a wall. Some bug reports indicate that this is still
6110 * happening in 2.7.8 for Windows, though it appears to be impossible.
6112 * We "pre-calculate" the blast area only in part for efficiency.
6113 * More importantly, this lets us do "explosions" from the "inside" out.
6114 * This results in a more logical distribution of "blast" treasure.
6115 * It also produces a better (in my opinion) animation of the explosion.
6116 * It could be (but is not) used to have the treasure dropped by monsters
6117 * in the middle of the explosion fall "outwards", and then be damaged by
6118 * the blast as it spreads outwards towards the treasure drop location.
6120 * Walls and doors are included in the blast area, so that they can be
6121 * "burned" or "melted" in later versions.
6123 * This algorithm is intended to maximize simplicity, not necessarily
6124 * efficiency, since this function is not a bottleneck in the code.
6126 * We apply the blast effect from ground zero outwards, in several passes,
6127 * first affecting features, then objects, then monsters, then the player.
6128 * This allows walls to be removed before checking the object or monster
6129 * in the wall, and protects objects which are dropped by monsters killed
6130 * in the blast, and allows the player to see all affects before he is
6131 * killed or teleported away. The semantics of this method are open to
6132 * various interpretations, but they seem to work well in practice.
6134 * We process the blast area from ground-zero outwards to allow for better
6135 * distribution of treasure dropped by monsters, and because it provides a
6136 * pleasing visual effect at low cost.
6138 * Note that the damage done by "ball" explosions decreases with distance.
6139 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6141 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6142 * the target, and then the damage "flows" along this beam of destruction.
6143 * The damage at every grid is the same as at the "center" of a "ball"
6144 * explosion, since the "beam" grids are treated as if they ARE at the
6145 * center of a "ball" explosion.
6147 * Currently, specifying "beam" plus "ball" means that locations which are
6148 * covered by the initial "beam", and also covered by the final "ball", except
6149 * for the final grid (the epicenter of the ball), will be "hit twice", once
6150 * by the initial beam, and once by the exploding ball. For the grid right
6151 * next to the epicenter, this results in 150% damage being done. The center
6152 * does not have this problem, for the same reason the final grid in a "beam"
6153 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6154 * grids which are covered by the "ball" will NOT work, as then they will
6155 * receive LESS damage than they should. Do not combine "beam" with "ball".
6157 * The array "gy[],gx[]" with current size "grids" is used to hold the
6158 * collected locations of all grids in the "blast area" plus "beam path".
6160 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6161 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6162 * first blast grid (see above) with radius "N" from the blast center. Note
6163 * that only the first gm[1] grids in the blast area thus take full damage.
6164 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6165 * number of blast grids.
6167 * Note that once the projection is complete, (y2,x2) holds the final location
6168 * of bolts/beams, and the "epicenter" of balls.
6170 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6171 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6172 * implementation of the "distance" function. Also, a bolt can be properly
6173 * viewed as a "ball" with a "rad" of "zero".
6175 * Note that if no "target" is reached before the beam/bolt/ball travels the
6176 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6177 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6179 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6180 * to move from point A to point B, even if the player cannot see part of the
6181 * projection path. Note that in general, the player will *always* see part
6182 * of the path, since it either starts at the player or ends on the player.
6184 * Hack -- we assume that every "projection" is "self-illuminating".
6186 * Hack -- when only a single monster is affected, we automatically track
6187 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6189 * Note that all projections now "explode" at their final destination, even
6190 * if they were being projected at a more distant destination. This means
6191 * that "ball" spells will *always* explode.
6193 * Note that we must call "handle_stuff()" after affecting terrain features
6194 * in the blast radius, in case the "illumination" of the grid was changed,
6195 * and "update_view()" and "update_monsters()" need to be called.
6198 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6208 POSITION y_saver, x_saver; /* For reflecting monsters */
6210 int msec = delay_factor * delay_factor * delay_factor;
6212 /* Assume the player sees nothing */
6213 bool notice = FALSE;
6215 /* Assume the player has seen nothing */
6216 bool visual = FALSE;
6218 /* Assume the player has seen no blast grids */
6221 /* Assume to be a normal ball spell */
6222 bool breath = FALSE;
6224 /* Is the player blind? */
6225 bool blind = (p_ptr->blind ? TRUE : FALSE);
6227 bool old_hide = FALSE;
6229 /* Number of grids in the "path" */
6232 /* Actual grids in the "path" */
6235 /* Number of grids in the "blast area" (including the "beam" path) */
6238 /* Coordinates of the affected grids */
6239 POSITION gx[1024], gy[1024];
6241 /* Encoded "radius" info (see above) */
6244 /* Actual radius encoded in gm[] */
6245 POSITION gm_rad = rad;
6249 /* Attacker's name (prepared before polymorph)*/
6250 GAME_TEXT who_name[MAX_NLEN];
6252 /* Can the player see the source of this effect? */
6253 bool see_s_msg = TRUE;
6255 /* Initialize by null string */
6261 /* Default target of monsterspell is player */
6262 monster_target_y = p_ptr->y;
6263 monster_target_x = p_ptr->x;
6265 /* Hack -- Jump to target */
6266 if (flg & (PROJECT_JUMP))
6271 /* Clear the flag */
6272 flg &= ~(PROJECT_JUMP);
6277 /* Start at player */
6284 /* Start at monster */
6287 x1 = m_list[who].fx;
6288 y1 = m_list[who].fy;
6289 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6301 /* Default "destination" */
6306 /* Hack -- verify stuff */
6307 if (flg & (PROJECT_THRU))
6309 if ((x1 == x2) && (y1 == y2))
6311 flg &= ~(PROJECT_THRU);
6315 /* Handle a breath attack */
6320 if (flg & PROJECT_HIDE) old_hide = TRUE;
6321 flg |= PROJECT_HIDE;
6325 /* Hack -- Assume there will be no blast (max radius 32) */
6326 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6334 /* Collect beam grids */
6335 if (flg & (PROJECT_BEAM))
6346 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6348 case GF_DISINTEGRATE:
6349 flg |= (PROJECT_GRID);
6350 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6354 /* Calculate the projection path */
6356 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6359 /* Giga-Hack SEEKER & SUPER_RAY */
6361 if( typ == GF_SEEKER )
6371 for (i = 0; i < path_n; ++i)
6376 POSITION ny = GRID_Y(path_g[i]);
6377 POSITION nx = GRID_X(path_g[i]);
6388 /* Only do visuals if requested */
6389 if (!blind && !(flg & (PROJECT_HIDE)))
6391 /* Only do visuals if the player can "see" the bolt */
6392 if (panel_contains(y, x) && player_has_los_bold(y, x))
6399 /* Obtain the bolt pict */
6400 p = bolt_pict(oy, ox, y, x, typ);
6402 /* Extract attr/char */
6406 /* Visual effects */
6407 print_rel(c, a, y, x);
6408 move_cursor_relative(y, x);
6409 /*if (fresh_before)*/ Term_fresh();
6410 Term_xtra(TERM_XTRA_DELAY, msec);
6412 /*if (fresh_before)*/ Term_fresh();
6414 /* Display "beam" grids */
6415 if (flg & (PROJECT_BEAM))
6417 /* Obtain the explosion pict */
6418 p = bolt_pict(y, x, y, x, typ);
6420 /* Extract attr/char */
6424 /* Visual effects */
6425 print_rel(c, a, y, x);
6428 /* Hack -- Activate delay */
6432 /* Hack -- delay anyway for consistency */
6435 /* Delay for consistency */
6436 Term_xtra(TERM_XTRA_DELAY, msec);
6439 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6440 if (is_mirror_grid(&grid_array[y][x]))
6442 /* The target of monsterspell becomes tha mirror(broken) */
6443 monster_target_y = y;
6444 monster_target_x = x;
6446 remove_mirror(y, x);
6447 next_mirror(&oy, &ox, y, x);
6449 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6450 for (j = last_i; j <= i; j++)
6452 y = GRID_Y(path_g[j]);
6453 x = GRID_X(path_g[j]);
6454 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6455 if (!who && (project_m_n == 1) && !jump) {
6456 if (grid_array[project_m_y][project_m_x].m_idx > 0) {
6457 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6461 /* Hack -- auto-recall */
6462 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6464 /* Hack - auto-track */
6465 health_track(grid_array[project_m_y][project_m_x].m_idx);
6469 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6474 for(i = last_i ; i < path_n ; i++)
6477 py = GRID_Y(path_g[i]);
6478 px = GRID_X(path_g[i]);
6479 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6481 if (!who && (project_m_n == 1) && !jump) {
6482 if (grid_array[project_m_y][project_m_x].m_idx > 0)
6484 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6488 /* Hack -- auto-recall */
6489 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6491 /* Hack - auto-track */
6492 health_track(grid_array[project_m_y][project_m_x].m_idx);
6496 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6500 else if(typ == GF_SUPER_RAY){
6502 int second_step = 0;
6509 for (i = 0; i < path_n; ++i)
6514 POSITION ny = GRID_Y(path_g[i]);
6515 POSITION nx = GRID_X(path_g[i]);
6526 /* Only do visuals if requested */
6527 if (!blind && !(flg & (PROJECT_HIDE)))
6529 /* Only do visuals if the player can "see" the bolt */
6530 if (panel_contains(y, x) && player_has_los_bold(y, x))
6537 /* Obtain the bolt pict */
6538 p = bolt_pict(oy, ox, y, x, typ);
6540 /* Extract attr/char */
6544 /* Visual effects */
6545 print_rel(c, a, y, x);
6546 move_cursor_relative(y, x);
6547 /*if (fresh_before)*/ Term_fresh();
6548 Term_xtra(TERM_XTRA_DELAY, msec);
6550 /*if (fresh_before)*/ Term_fresh();
6552 /* Display "beam" grids */
6553 if (flg & (PROJECT_BEAM))
6555 /* Obtain the explosion pict */
6556 p = bolt_pict(y, x, y, x, typ);
6558 /* Extract attr/char */
6562 /* Visual effects */
6563 print_rel(c, a, y, x);
6566 /* Hack -- Activate delay */
6570 /* Hack -- delay anyway for consistency */
6573 /* Delay for consistency */
6574 Term_xtra(TERM_XTRA_DELAY, msec);
6577 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
6578 if (!cave_have_flag_bold(y, x, FF_PROJECT))
6580 if( second_step )continue;
6583 if( is_mirror_grid(&grid_array[y][x]) && !second_step )
6585 /* The target of monsterspell becomes tha mirror(broken) */
6586 monster_target_y=(s16b)y;
6587 monster_target_x=(s16b)x;
6590 for( j = 0; j <=i ; j++ )
6592 y = GRID_Y(path_g[j]);
6593 x = GRID_X(path_g[j]);
6594 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
6598 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
6599 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
6600 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
6601 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
6602 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
6603 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
6604 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
6605 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
6608 for( i = 0; i < path_n ; i++ )
6611 py = GRID_Y(path_g[i]);
6612 px = GRID_X(path_g[i]);
6613 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
6614 if(!who && (project_m_n == 1) && !jump){
6615 if(grid_array[project_m_y][project_m_x].m_idx >0 ){
6616 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6620 /* Hack -- auto-recall */
6621 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6623 /* Hack - auto-track */
6624 health_track(grid_array[project_m_y][project_m_x].m_idx);
6628 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
6633 /* Project along the path */
6634 for (i = 0; i < path_n; ++i)
6639 POSITION ny = GRID_Y(path_g[i]);
6640 POSITION nx = GRID_X(path_g[i]);
6642 if (flg & PROJECT_DISI)
6644 /* Hack -- Balls explode before reaching walls */
6645 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
6647 else if (flg & PROJECT_LOS)
6649 /* Hack -- Balls explode before reaching walls */
6650 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6654 /* Hack -- Balls explode before reaching walls */
6655 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6662 /* Collect beam grids */
6663 if (flg & (PROJECT_BEAM))
6670 /* Only do visuals if requested */
6671 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6673 /* Only do visuals if the player can "see" the bolt */
6674 if (panel_contains(y, x) && player_has_los_bold(y, x))
6681 /* Obtain the bolt pict */
6682 p = bolt_pict(oy, ox, y, x, typ);
6684 /* Extract attr/char */
6688 /* Visual effects */
6689 print_rel(c, a, y, x);
6690 move_cursor_relative(y, x);
6691 /*if (fresh_before)*/ Term_fresh();
6692 Term_xtra(TERM_XTRA_DELAY, msec);
6694 /*if (fresh_before)*/ Term_fresh();
6696 /* Display "beam" grids */
6697 if (flg & (PROJECT_BEAM))
6699 /* Obtain the explosion pict */
6700 p = bolt_pict(y, x, y, x, typ);
6702 /* Extract attr/char */
6706 /* Visual effects */
6707 print_rel(c, a, y, x);
6710 /* Hack -- Activate delay */
6714 /* Hack -- delay anyway for consistency */
6717 /* Delay for consistency */
6718 Term_xtra(TERM_XTRA_DELAY, msec);
6725 /* Save the "blast epicenter" */
6729 if (breath && !path_n)
6735 flg &= ~(PROJECT_HIDE);
6739 /* Start the "explosion" */
6742 /* Hack -- make sure beams get to "explode" */
6750 /* If we found a "target", explode there */
6751 if (dist <= MAX_RANGE)
6753 /* Mega-Hack -- remove the final "beam" grid */
6754 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6757 * Create a conical breath attack
6768 flg &= ~(PROJECT_HIDE);
6770 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6774 /* Determine the blast area, work from the inside out */
6775 for (dist = 0; dist <= rad; dist++)
6777 /* Scan the maximal blast area of radius "dist" */
6778 for (y = by - dist; y <= by + dist; y++)
6780 for (x = bx - dist; x <= bx + dist; x++)
6782 /* Ignore "illegal" locations */
6783 if (!in_bounds2(y, x)) continue;
6785 /* Enforce a "circular" explosion */
6786 if (distance(by, bx, y, x) != dist) continue;
6792 /* Lights are stopped by opaque terrains */
6793 if (!los(by, bx, y, x)) continue;
6795 case GF_DISINTEGRATE:
6796 /* Disintegration are stopped only by perma-walls */
6797 if (!in_disintegration_range(by, bx, y, x)) continue;
6800 /* Ball explosions are stopped by walls */
6801 if (!projectable(by, bx, y, x)) continue;
6805 /* Save this grid */
6812 /* Encode some more "radius" info */
6818 /* Speed -- ignore "non-explosions" */
6819 if (!grids) return (FALSE);
6822 /* Display the "blast area" if requested */
6823 if (!blind && !(flg & (PROJECT_HIDE)))
6825 /* Then do the "blast", from inside out */
6826 for (t = 0; t <= gm_rad; t++)
6828 /* Dump everything with this radius */
6829 for (i = gm[t]; i < gm[t+1]; i++)
6831 /* Extract the location */
6835 /* Only do visuals if the player can "see" the blast */
6836 if (panel_contains(y, x) && player_has_los_bold(y, x))
6845 /* Obtain the explosion pict */
6846 p = bolt_pict(y, x, y, x, typ);
6848 /* Extract attr/char */
6852 /* Visual effects -- Display */
6853 print_rel(c, a, y, x);
6857 /* Hack -- center the cursor */
6858 move_cursor_relative(by, bx);
6860 /* Flush each "radius" seperately */
6861 /*if (fresh_before)*/ Term_fresh();
6863 /* Delay (efficiently) */
6864 if (visual || drawn)
6866 Term_xtra(TERM_XTRA_DELAY, msec);
6870 /* Flush the erasing */
6873 /* Erase the explosion drawn above */
6874 for (i = 0; i < grids; i++)
6876 /* Extract the location */
6880 /* Hack -- Erase if needed */
6881 if (panel_contains(y, x) && player_has_los_bold(y, x))
6887 /* Hack -- center the cursor */
6888 move_cursor_relative(by, bx);
6890 /* Flush the explosion */
6891 /*if (fresh_before)*/ Term_fresh();
6895 update_creature(p_ptr);
6897 if (flg & PROJECT_KILL)
6899 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
6900 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6904 /* Check features */
6905 if (flg & (PROJECT_GRID))
6907 /* Start with "dist" of zero */
6910 /* Scan for features */
6911 for (i = 0; i < grids; i++)
6913 /* Hack -- Notice new "dist" values */
6914 if (gm[dist+1] == i) dist++;
6916 /* Get the grid location */
6920 /* Find the closest point in the blast */
6923 int d = dist_to_line(y, x, y1, x1, by, bx);
6925 /* Affect the grid */
6926 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6930 /* Affect the grid */
6931 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6936 update_creature(p_ptr);
6939 if (flg & (PROJECT_ITEM))
6941 /* Start with "dist" of zero */
6944 /* Scan for objects */
6945 for (i = 0; i < grids; i++)
6947 /* Hack -- Notice new "dist" values */
6948 if (gm[dist+1] == i) dist++;
6950 /* Get the grid location */
6954 /* Find the closest point in the blast */
6957 int d = dist_to_line(y, x, y1, x1, by, bx);
6959 /* Affect the object in the grid */
6960 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6964 /* Affect the object in the grid */
6965 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6971 /* Check monsters */
6972 if (flg & (PROJECT_KILL))
6979 /* Start with "dist" of zero */
6982 /* Scan for monsters */
6983 for (i = 0; i < grids; i++)
6987 /* Hack -- Notice new "dist" values */
6988 if (gm[dist + 1] == i) dist++;
6990 /* Get the grid location */
6994 /* A single bolt may be reflected */
6997 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6998 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7000 if ((flg & PROJECT_REFLECTABLE) && grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7001 ((grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7002 (!who || dist_hack > 1) && !one_in_(10))
7005 int max_attempts = 10;
7007 /* Choose 'new' target */
7010 t_y = y_saver - 1 + randint1(3);
7011 t_x = x_saver - 1 + randint1(3);
7014 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7016 if (max_attempts < 1)
7022 sound(SOUND_REFLECT);
7025 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7026 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7027 else if (m_ptr->r_idx == MON_DIO)
7028 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7030 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7032 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7034 /* Reflected bolts randomly target either one */
7035 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7036 else flg |= PROJECT_PLAYER;
7038 /* The bolt is reflected */
7039 project(grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7041 /* Don't affect the monster any longer */
7047 /* Find the closest point in the blast */
7050 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7054 effective_dist = dist;
7058 /* There is the riding player on this monster */
7059 if (p_ptr->riding && player_bold(y, x))
7061 /* Aimed on the player */
7062 if (flg & PROJECT_PLAYER)
7064 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7067 * A beam or bolt is well aimed
7069 * So don't affects the mount.
7076 * The spell is not well aimed,
7077 * So partly affect the mount too.
7084 * This grid is the original target.
7085 * Or aimed on your horse.
7087 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7089 /* Hit the mount with full damage */
7093 * Otherwise this grid is not the
7094 * original target, it means that line
7095 * of fire is obstructed by this
7099 * A beam or bolt will hit either
7100 * player or mount. Choose randomly.
7102 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7106 /* Hit the mount with full damage */
7110 /* Hit the player later */
7111 flg |= PROJECT_PLAYER;
7113 /* Don't affect the mount */
7119 * The spell is not well aimed, so
7120 * partly affect both player and
7129 /* Affect the monster in the grid */
7130 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7134 /* Player affected one monster (without "jumping") */
7135 if (!who && (project_m_n == 1) && !jump)
7140 /* Track if possible */
7141 if (grid_array[y][x].m_idx > 0)
7143 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
7147 /* Hack -- auto-recall */
7148 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7150 /* Hack - auto-track */
7151 if (m_ptr->ml) health_track(grid_array[y][x].m_idx);
7159 if (flg & (PROJECT_KILL))
7161 /* Start with "dist" of zero */
7164 /* Scan for player */
7165 for (i = 0; i < grids; i++)
7169 /* Hack -- Notice new "dist" values */
7170 if (gm[dist+1] == i) dist++;
7172 /* Get the grid location */
7176 /* Affect the player? */
7177 if (!player_bold(y, x)) continue;
7179 /* Find the closest point in the blast */
7182 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7186 effective_dist = dist;
7189 /* Target may be your horse */
7192 /* Aimed on the player */
7193 if (flg & PROJECT_PLAYER)
7195 /* Hit the player with full damage */
7199 * Hack -- When this grid was not the
7200 * original target, a beam or bolt
7201 * would hit either player or mount,
7202 * and should be choosen randomly.
7204 * But already choosen to hit the
7205 * mount at this point.
7207 * Or aimed on your horse.
7209 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7212 * A beam or bolt is well aimed
7214 * So don't affects the player.
7221 * The spell is not well aimed,
7222 * So partly affect the player too.
7228 /* Affect the player */
7229 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7235 GAME_TEXT m_name[MAX_NLEN];
7237 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7239 if (rakubadam_m > 0)
7241 if (rakuba(rakubadam_m, FALSE))
7243 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7246 if (p_ptr->riding && rakubadam_p > 0)
7248 if(rakuba(rakubadam_p, FALSE))
7250 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7255 /* Return "something was noticed" */
7260 * @brief 鏡魔法「封魔結界」の効果処理
7262 * @return 効果があったらTRUEを返す
7264 bool binding_field(HIT_POINT dam)
7266 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7267 int mirror_num = 0; /* 鏡の数 */
7269 POSITION centersign;
7270 POSITION x1, x2, y1, y2;
7272 int msec = delay_factor*delay_factor*delay_factor;
7275 POSITION point_x[3];
7276 POSITION point_y[3];
7278 /* Default target of monsterspell is player */
7279 monster_target_y = p_ptr->y;
7280 monster_target_x = p_ptr->x;
7282 for (x = 0; x < cur_wid; x++)
7284 for (y = 0; y < cur_hgt; y++)
7286 if (is_mirror_grid(&grid_array[y][x]) &&
7287 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7288 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7289 player_has_los_bold(y, x) &&
7290 projectable(p_ptr->y, p_ptr->x, y, x)
7292 mirror_y[mirror_num] = y;
7293 mirror_x[mirror_num] = x;
7299 if (mirror_num < 2)return FALSE;
7301 point_x[0] = randint0(mirror_num);
7303 point_x[1] = randint0(mirror_num);
7304 } while (point_x[0] == point_x[1]);
7306 point_y[0] = mirror_y[point_x[0]];
7307 point_x[0] = mirror_x[point_x[0]];
7308 point_y[1] = mirror_y[point_x[1]];
7309 point_x[1] = mirror_x[point_x[1]];
7310 point_y[2] = p_ptr->y;
7311 point_x[2] = p_ptr->x;
7313 x = point_x[0] + point_x[1] + point_x[2];
7314 y = point_y[0] + point_y[1] + point_y[2];
7316 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7317 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7318 if (centersign == 0)return FALSE;
7320 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7321 x1 = x1 < point_x[2] ? x1 : point_x[2];
7322 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7323 y1 = y1 < point_y[2] ? y1 : point_y[2];
7325 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7326 x2 = x2 > point_x[2] ? x2 : point_x[2];
7327 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7328 y2 = y2 > point_y[2] ? y2 : point_y[2];
7330 for (y = y1; y <= y2; y++) {
7331 for (x = x1; x <= x2; x++) {
7332 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7333 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7334 centersign*((point_x[1] - x)*(point_y[2] - y)
7335 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7336 centersign*((point_x[2] - x)*(point_y[0] - y)
7337 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7339 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7340 /* Visual effects */
7342 && panel_contains(y, x)) {
7343 p = bolt_pict(y, x, y, x, GF_MANA);
7344 print_rel(PICT_C(p), PICT_A(p), y, x);
7345 move_cursor_relative(y, x);
7346 /*if (fresh_before)*/ Term_fresh();
7347 Term_xtra(TERM_XTRA_DELAY, msec);
7353 for (y = y1; y <= y2; y++) {
7354 for (x = x1; x <= x2; x++) {
7355 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7356 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7357 centersign*((point_x[1] - x)*(point_y[2] - y)
7358 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7359 centersign*((point_x[2] - x)*(point_y[0] - y)
7360 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7362 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7363 (void)project_f(0, 0, y, x, dam, GF_MANA);
7368 for (y = y1; y <= y2; y++) {
7369 for (x = x1; x <= x2; x++) {
7370 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7371 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7372 centersign*((point_x[1] - x)*(point_y[2] - y)
7373 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7374 centersign*((point_x[2] - x)*(point_y[0] - y)
7375 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7377 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7378 (void)project_o(0, 0, y, x, dam, GF_MANA);
7383 for (y = y1; y <= y2; y++) {
7384 for (x = x1; x <= x2; x++) {
7385 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7386 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7387 centersign*((point_x[1] - x)*(point_y[2] - y)
7388 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7389 centersign*((point_x[2] - x)*(point_y[0] - y)
7390 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7392 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7393 (void)project_m(0, 0, y, x, dam, GF_MANA,
7394 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7400 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7401 remove_mirror(point_y[0], point_x[0]);
7408 * @brief 鏡魔法「鏡の封印」の効果処理
7410 * @return 効果があったらTRUEを返す
7412 void seal_of_mirror(HIT_POINT dam)
7416 for (x = 0; x < cur_wid; x++)
7418 for (y = 0; y < cur_hgt; y++)
7420 if (is_mirror_grid(&grid_array[y][x]))
7422 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7423 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7425 if (!grid_array[y][x].m_idx)
7427 remove_mirror(y, x);
7439 * @brief 領域魔法に応じて技能の名称を返す。
7440 * @param tval 魔法書のtval
7441 * @return 領域魔法の技能名称を保管した文字列ポインタ
7443 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
7447 case TV_HISSATSU_BOOK:
7448 return _("必殺技", "art");
7450 return _("祈り", "prayer");
7452 return _("歌", "song");
7454 return _("呪文", "spell");