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(&cave[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 cave_type *c_ptr = &cave[y][x];
308 feature_type *f_ptr = &f_info[c_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 (c_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(c_ptr))
412 /* Check line of sight */
420 if (is_trap(c_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(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
436 s16b old_feat = c_ptr->feat;
438 /* Unlock the door */
439 cave_alter_feat(y, x, FF_DISARM);
441 /* Check line of sound */
442 if (known && (old_feat != c_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 c_ptr->info &= ~(CAVE_UNSAFE);
460 /* Destroy Doors (and traps) */
463 /* Destroy all doors and traps */
464 if (is_trap(c_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 c_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 = c_ptr->mimic;
493 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
495 cave_alter_feat(y, x, FF_SPIKE);
496 c_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 && (c_ptr->info & (CAVE_MARK)))
518 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(c_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);
535 /* Require a "naked" floor grid */
536 if (!cave_naked_bold(y, x)) break;
538 /* Not on the player */
539 if (player_bold(y, x)) break;
541 /* Create a closed door */
542 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
545 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
562 /* Require a "naked" floor grid */
563 if (!cave_naked_bold(y, x)) break;
565 /* Not on the player */
566 if (player_bold(y, x)) break;
568 /* Create a closed door */
569 cave_set_feat(y, x, feat_tree);
572 if (c_ptr->info & (CAVE_MARK)) obvious = TRUE;
580 /* Require a "naked" floor grid */
581 if (!cave_naked_bold(y, x)) break;
584 c_ptr->info |= CAVE_OBJECT;
585 c_ptr->mimic = feat_glyph;
596 /* Require a "naked" floor grid */
597 if (!cave_naked_bold(y, x)) break;
599 /* Not on the player */
600 if (player_bold(y, x)) break;
603 cave_set_feat(y, x, feat_granite);
611 /* Ignore permanent grid */
612 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
617 /* Ignore grid without enough space */
618 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
620 /* Place a shallow lava */
621 cave_set_feat(y, x, feat_shallow_lava);
626 /* Place a deep lava */
627 cave_set_feat(y, x, feat_deep_lava);
634 /* Ignore permanent grid */
635 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
640 /* Ignore grid without enough space */
641 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
643 /* Place a shallow water */
644 cave_set_feat(y, x, feat_shallow_water);
649 /* Place a deep water */
650 cave_set_feat(y, x, feat_deep_water);
655 /* Lite up the grid */
659 /* Turn on the light */
660 if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
662 c_ptr->info |= (CAVE_GLOW);
665 update_local_illumination(y, x);
668 if (player_can_see_bold(y, x)) obvious = TRUE;
670 /* Mega-Hack -- Update the monster in the affected grid */
671 /* This allows "spear of light" (etc) to work "correctly" */
672 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
674 if (p_ptr->special_defense & NINJA_S_STEALTH)
676 if (player_bold(y, x)) set_superstealth(FALSE);
683 /* Darken the grid */
687 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(c_ptr);
690 /* Turn off the light. */
693 if (dun_level || !is_daytime())
695 for (j = 0; j < 9; j++)
697 int by = y + ddy_ddd[j];
698 int bx = x + ddx_ddd[j];
700 if (in_bounds2(by, bx))
702 cave_type *cc_ptr = &cave[by][bx];
704 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
715 c_ptr->info &= ~(CAVE_GLOW);
717 /* Hack -- Forget "boring" grids */
718 if (!have_flag(f_ptr->flags, FF_REMEMBER))
721 c_ptr->info &= ~(CAVE_MARK);
728 update_local_illumination(y, x);
730 if (player_can_see_bold(y, x)) obvious = TRUE;
732 /* Mega-Hack -- Update the monster in the affected grid */
733 /* This allows "spear of light" (etc) to work "correctly" */
734 if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE);
744 if (is_mirror_grid(c_ptr))
746 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
749 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
752 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
754 if (known && (c_ptr->info & CAVE_MARK))
756 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
760 /* Destroy the wall */
761 cave_alter_feat(y, x, FF_HURT_ROCK);
763 /* Update some things */
764 p_ptr->update |= (PU_FLOW);
771 if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
773 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
776 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
779 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
781 if (known && (c_ptr->info & CAVE_MARK))
783 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(c_ptr)].name);
787 /* Destroy the wall */
788 cave_alter_feat(y, x, FF_HURT_ROCK);
790 /* Update some things */
791 p_ptr->update |= (PU_FLOW);
796 case GF_DISINTEGRATE:
798 /* Destroy mirror/glyph */
799 if (is_mirror_grid(c_ptr) || is_glyph_grid(c_ptr) || is_explosive_rune_grid(c_ptr))
802 /* Permanent features don't get effect */
803 /* But not protect monsters and other objects */
804 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
806 cave_alter_feat(y, x, FF_HURT_DISI);
808 /* Update some things -- similar to GF_KILL_WALL */
809 p_ptr->update |= (PU_FLOW);
816 /* Return "Anything seen?" */
823 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
824 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
825 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
826 * @param y 目標Y座標 / Target y location (or location to travel "towards")
827 * @param x 目標X座標 / Target x location (or location to travel "towards")
828 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
829 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
830 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
833 * We are called from "project()" to "damage" objects
835 * We are called both for "beam" effects and "ball" effects.
837 * Perhaps we should only SOMETIMES damage things on the ground.
839 * The "r" parameter is the "distance from ground zero".
841 * Note that we determine if the player can "see" anything that happens
842 * by taking into account: blindness, line-of-sight, and illumination.
844 * We also "see" grids which are "memorized", probably a hack
846 * We return "TRUE" if the effect of the projection is "obvious".
849 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
851 cave_type *c_ptr = &cave[y][x];
853 OBJECT_IDX this_o_idx, next_o_idx = 0;
855 bool obvious = FALSE;
856 bool known = player_has_los_bold(y, x);
858 BIT_FLAGS flgs[TR_FLAG_SIZE];
860 GAME_TEXT o_name[MAX_NLEN];
862 KIND_OBJECT_IDX k_idx = 0;
863 bool is_potion = FALSE;
868 /* Reduce damage by distance */
869 dam = (dam + r) / (r + 1);
872 /* Scan all objects in the grid */
873 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
875 object_type *o_ptr = &o_list[this_o_idx];
879 bool do_kill = FALSE;
881 concptr note_kill = NULL;
884 /* Get the "plural"-ness */
885 bool plural = (o_ptr->number > 1);
888 /* Acquire next object */
889 next_o_idx = o_ptr->next_o_idx;
890 object_flags(o_ptr, flgs);
892 /* Check for artifact */
893 if (object_is_artifact(o_ptr)) is_art = TRUE;
895 /* Analyze the type */
898 /* Acid -- Lots of things */
901 if (hates_acid(o_ptr))
904 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
905 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
910 /* Elec -- Rings and Wands */
913 if (hates_elec(o_ptr))
916 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
917 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
922 /* Fire -- Flammable objects */
925 if (hates_fire(o_ptr))
928 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
929 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
934 /* Cold -- potions and flasks */
937 if (hates_cold(o_ptr))
939 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
941 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
949 if (hates_fire(o_ptr))
952 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
953 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
955 if (hates_elec(o_ptr))
959 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
960 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
968 if (hates_fire(o_ptr))
971 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
972 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
974 if (hates_cold(o_ptr))
978 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
979 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
984 /* Hack -- break potions and such */
990 if (hates_cold(o_ptr))
992 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
998 /* Mana and Chaos -- destroy everything */
1004 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1008 case GF_DISINTEGRATE:
1011 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
1018 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1019 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
1020 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
1024 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
1028 if (object_is_cursed(o_ptr))
1031 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
1038 identify_item(o_ptr);
1040 /* Auto-inscription */
1041 autopick_alter_item((-this_o_idx), FALSE);
1049 /* Chests are noticed only if trapped or locked */
1050 if (o_ptr->tval == TV_CHEST)
1052 /* Disarm/Unlock traps */
1053 if (o_ptr->pval > 0)
1055 /* Disarm or Unlock */
1056 o_ptr->pval = (0 - o_ptr->pval);
1059 object_known(o_ptr);
1061 if (known && (o_ptr->marked & OM_FOUND))
1063 msg_print(_("カチッと音がした!", "Click!"));
1073 if (o_ptr->tval == TV_CORPSE)
1076 BIT_FLAGS mode = 0L;
1078 if (!who || is_pet(&m_list[who]))
1079 mode |= PM_FORCE_PET;
1081 for (i = 0; i < o_ptr->number ; i++)
1083 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1084 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1088 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1092 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1094 note_kill = _("生き返った。", " revived.");
1096 else if (!note_kill)
1098 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1109 /* Attempt to destroy the object */
1112 /* Effect "observed" */
1113 if (known && (o_ptr->marked & OM_FOUND))
1116 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1119 /* Artifacts, and other objects, get to resist */
1120 if (is_art || ignore)
1122 /* Observe the resist */
1123 if (known && (o_ptr->marked & OM_FOUND))
1125 msg_format(_("%sは影響を受けない!",
1126 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1133 /* Describe if needed */
1134 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1136 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1139 k_idx = o_ptr->k_idx;
1140 is_potion = object_is_potion(o_ptr);
1141 delete_object_idx(this_o_idx);
1143 /* Potions produce effects when 'shattered' */
1146 (void)potion_smash_effect(who, y, x, k_idx);
1154 /* Return "Anything seen?" */
1160 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1161 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1162 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1163 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1164 * @param x 目標X座標 / Target x location (or location to travel "towards")
1165 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1166 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1168 * @param see_s_msg TRUEならばメッセージを表示する
1169 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1172 * This routine takes a "source monster" (by index) which is mostly used to
1173 * determine if the player is causing the damage, and a "radius" (see below),
1174 * which is used to decrease the power of explosions with distance, and a
1175 * location, via integers which are modified by certain types of attacks
1176 * (polymorph and teleport being the obvious ones), a default damage, which
1177 * is modified as needed based on various properties, and finally a "damage
1178 * type" (see below).
1181 * Note that this routine can handle "no damage" attacks (like teleport) by
1182 * taking a "zero" damage, and can even take "parameters" to attacks (like
1183 * confuse) by accepting a "damage", using it to calculate the effect, and
1184 * then setting the damage to zero. Note that the "damage" parameter is
1185 * divided by the radius, so monsters not at the "epicenter" will not take
1186 * as much damage (or whatever)...
1189 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1190 * may result in a dereference of an invalid pointer.
1193 * Various messages are produced, and damage is applied.
1196 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1197 * actually be "made" of that substance, or "breathe" big balls of it.
1198 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1200 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1201 * and hurts evil less. If can breath nether, then it resists it as well.
1204 * Damage reductions use the following formulas:
1205 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1206 * gives avg damage of .655, ranging from .858 to .500
1207 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1208 * gives avg damage of .544, ranging from .714 to .417
1209 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1210 * gives avg damage of .444, ranging from .556 to .333
1211 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1212 * gives avg damage of .327, ranging from .427 to .250
1213 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1214 * gives something simple.
1217 * In this function, "result" messages are postponed until the end, where
1218 * the "note" string is appended to the monster name, if not NULL. So,
1219 * to make a spell have "no effect" just set "note" to NULL. You should
1220 * also set "notice" to FALSE, or the player will learn what the spell does.
1223 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1227 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)
1231 cave_type *c_ptr = &cave[y][x];
1233 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1234 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1236 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1240 /* Is the monster "seen"? */
1241 bool seen = m_ptr->ml;
1242 bool seen_msg = is_seen(m_ptr);
1244 bool slept = (bool)MON_CSLEEP(m_ptr);
1246 /* Were the effects "obvious" (if seen)? */
1247 bool obvious = FALSE;
1249 /* Can the player know about this effect? */
1250 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1252 /* Were the effects "irrelevant"? */
1253 bool skipped = FALSE;
1255 /* Gets the monster angry at the source of the effect? */
1256 bool get_angry = FALSE;
1258 /* Polymorph setting (true or false) */
1259 bool do_poly = FALSE;
1261 /* Teleport setting (max distance) */
1264 /* Confusion setting (amount to confuse) */
1267 /* Stunning setting (amount to stun) */
1270 /* Sleep amount (amount to sleep) */
1273 /* Fear amount (amount to fear) */
1276 /* Time amount (amount to time) */
1279 bool heal_leper = FALSE;
1281 /* Hold the monster name */
1282 GAME_TEXT m_name[MAX_NLEN];
1285 PARAMETER_VALUE photo = 0;
1287 /* Assume no note */
1288 concptr note = NULL;
1290 /* Assume a default death */
1291 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1293 POSITION ty = m_ptr->fy;
1294 POSITION tx = m_ptr->fx;
1296 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1299 if (!c_ptr->m_idx) return (FALSE);
1301 /* Never affect projector */
1302 if (who && (c_ptr->m_idx == who)) return (FALSE);
1303 if ((c_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1304 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1306 /* Don't affect already death monsters */
1307 /* Prevents problems with chain reactions of exploding monsters */
1308 if (m_ptr->hp < 0) return (FALSE);
1310 /* Reduce damage by distance */
1311 dam = (dam + r) / (r + 1);
1314 /* Get the monster name (BEFORE polymorphing) */
1315 monster_desc(m_name, m_ptr, 0);
1317 /* Get the monster possessive ("his"/"her"/"its") */
1318 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1320 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1322 /* Analyze the damage type */
1325 /* Magic Missile -- pure damage */
1328 if (seen) obvious = TRUE;
1330 if (r_ptr->flagsr & RFR_RES_ALL)
1332 note = _("には完全な耐性がある!", " is immune.");
1334 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1343 if (seen) obvious = TRUE;
1345 if (r_ptr->flagsr & RFR_RES_ALL)
1347 note = _("には完全な耐性がある!", " is immune.");
1349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1352 if (r_ptr->flagsr & RFR_IM_ACID)
1354 note = _("にはかなり耐性がある!", " resists a lot.");
1356 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1364 if (seen) obvious = TRUE;
1366 if (r_ptr->flagsr & RFR_RES_ALL)
1368 note = _("には完全な耐性がある!", " is immune.");
1370 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1373 if (r_ptr->flagsr & RFR_IM_ELEC)
1375 note = _("にはかなり耐性がある!", " resists a lot.");
1377 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1385 if (seen) obvious = TRUE;
1387 if (r_ptr->flagsr & RFR_RES_ALL)
1389 note = _("には完全な耐性がある!", " is immune.");
1391 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1394 if (r_ptr->flagsr & RFR_IM_FIRE)
1396 note = _("にはかなり耐性がある!", " resists a lot.");
1398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1400 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1402 note = _("はひどい痛手をうけた。", " is hit hard.");
1404 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1412 if (seen) obvious = TRUE;
1414 if (r_ptr->flagsr & RFR_RES_ALL)
1416 note = _("には完全な耐性がある!", " is immune.");
1418 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1421 if (r_ptr->flagsr & RFR_IM_COLD)
1423 note = _("にはかなり耐性がある!", " resists a lot.");
1425 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1427 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1429 note = _("はひどい痛手をうけた。", " is hit hard.");
1431 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1439 if (seen) obvious = TRUE;
1441 if (r_ptr->flagsr & RFR_RES_ALL)
1443 note = _("には完全な耐性がある!", " is immune.");
1445 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1448 if (r_ptr->flagsr & RFR_IM_POIS)
1450 note = _("にはかなり耐性がある!", " resists a lot.");
1452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1460 if (seen) obvious = TRUE;
1462 if (r_ptr->flagsr & RFR_RES_ALL)
1464 note = _("には完全な耐性がある!", " is immune.");
1466 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1469 if (r_ptr->flagsr & RFR_IM_POIS)
1471 note = _("には耐性がある。", " resists.");
1472 dam *= 3; dam /= randint1(6) + 6;
1473 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1475 else if (one_in_(3)) do_poly = TRUE;
1479 /* Hellfire -- hurts Evil */
1482 if (seen) obvious = TRUE;
1484 if (r_ptr->flagsr & RFR_RES_ALL)
1486 note = _("には完全な耐性がある!", " is immune.");
1488 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1491 if (r_ptr->flags3 & RF3_GOOD)
1493 note = _("はひどい痛手をうけた。", " is hit hard.");
1495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1500 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1503 if (seen) obvious = TRUE;
1505 if (r_ptr->flagsr & RFR_RES_ALL)
1507 note = _("には完全な耐性がある!", " is immune.");
1509 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1512 if (r_ptr->flags3 & RF3_GOOD)
1514 note = _("には完全な耐性がある!", " is immune.");
1516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1518 else if (r_ptr->flags3 & RF3_EVIL)
1521 note = _("はひどい痛手をうけた。", " is hit hard.");
1522 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1526 note = _("には耐性がある。", " resists.");
1527 dam *= 3; dam /= randint1(6) + 6;
1532 /* Arrow -- XXX no defense */
1535 if (seen) obvious = TRUE;
1537 if (r_ptr->flagsr & RFR_RES_ALL)
1539 note = _("には完全な耐性がある!", " is immune.");
1541 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1547 /* Plasma -- XXX perhaps check ELEC or FIRE */
1550 if (seen) obvious = TRUE;
1552 if (r_ptr->flagsr & RFR_RES_ALL)
1554 note = _("には完全な耐性がある!", " is immune.");
1556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1559 if (r_ptr->flagsr & RFR_RES_PLAS)
1561 note = _("には耐性がある。", " resists.");
1562 dam *= 3; dam /= randint1(6) + 6;
1563 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1568 /* Nether -- see above */
1571 if (seen) obvious = TRUE;
1573 if (r_ptr->flagsr & RFR_RES_ALL)
1575 note = _("には完全な耐性がある!", " is immune.");
1577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1580 if (r_ptr->flagsr & RFR_RES_NETH)
1582 if (r_ptr->flags3 & RF3_UNDEAD)
1584 note = _("には完全な耐性がある!", " is immune.");
1586 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1590 note = _("には耐性がある。", " resists.");
1591 dam *= 3; dam /= randint1(6) + 6;
1593 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1595 else if (r_ptr->flags3 & RF3_EVIL)
1597 note = _("はいくらか耐性を示した。", " resists somewhat.");
1599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1604 /* Water (acid) damage -- Water spirits/elementals are immune */
1607 if (seen) obvious = TRUE;
1609 if (r_ptr->flagsr & RFR_RES_ALL)
1611 note = _("には完全な耐性がある!", " is immune.");
1613 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1616 if (r_ptr->flagsr & RFR_RES_WATE)
1618 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1620 note = _("には完全な耐性がある!", " is immune.");
1625 note = _("には耐性がある。", " resists.");
1626 dam *= 3; dam /= randint1(6) + 6;
1628 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1633 /* Chaos -- Chaos breathers resist */
1636 if (seen) obvious = TRUE;
1638 if (r_ptr->flagsr & RFR_RES_ALL)
1640 note = _("には完全な耐性がある!", " is immune.");
1642 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1645 if (r_ptr->flagsr & RFR_RES_CHAO)
1647 note = _("には耐性がある。", " resists.");
1648 dam *= 3; dam /= randint1(6) + 6;
1649 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1651 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1653 note = _("はいくらか耐性を示した。", " resists somewhat.");
1654 dam *= 3; dam /= randint1(6) + 6;
1655 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1660 do_conf = (5 + randint1(11) + r) / (r + 1);
1665 /* Shards -- Shard breathers resist */
1668 if (seen) obvious = TRUE;
1670 if (r_ptr->flagsr & RFR_RES_ALL)
1672 note = _("には完全な耐性がある!", " is immune.");
1674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1677 if (r_ptr->flagsr & RFR_RES_SHAR)
1679 note = _("には耐性がある。", " resists.");
1680 dam *= 3; dam /= randint1(6) + 6;
1681 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1686 /* Rocket: Shard resistance helps */
1689 if (seen) obvious = TRUE;
1691 if (r_ptr->flagsr & RFR_RES_ALL)
1693 note = _("には完全な耐性がある!", " is immune.");
1695 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1698 if (r_ptr->flagsr & RFR_RES_SHAR)
1700 note = _("はいくらか耐性を示した。", " resists somewhat.");
1702 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1708 /* Sound -- Sound breathers resist */
1711 if (seen) obvious = TRUE;
1713 if (r_ptr->flagsr & RFR_RES_ALL)
1715 note = _("には完全な耐性がある!", " is immune.");
1717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1720 if (r_ptr->flagsr & RFR_RES_SOUN)
1722 note = _("には耐性がある。", " resists.");
1723 dam *= 2; dam /= randint1(6) + 6;
1724 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1726 else do_stun = (10 + randint1(15) + r) / (r + 1);
1733 if (seen) obvious = TRUE;
1735 if (r_ptr->flagsr & RFR_RES_ALL)
1737 note = _("には完全な耐性がある!", " is immune.");
1739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1742 if (r_ptr->flags3 & RF3_NO_CONF)
1744 note = _("には耐性がある。", " resists.");
1745 dam *= 3; dam /= randint1(6) + 6;
1746 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1748 else do_conf = (10 + randint1(15) + r) / (r + 1);
1752 /* Disenchantment -- Breathers and Disenchanters resist */
1755 if (seen) obvious = TRUE;
1757 if (r_ptr->flagsr & RFR_RES_ALL)
1759 note = _("には完全な耐性がある!", " is immune.");
1761 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1764 if (r_ptr->flagsr & RFR_RES_DISE)
1766 note = _("には耐性がある。", " resists.");
1767 dam *= 3; dam /= randint1(6) + 6;
1768 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1773 /* Nexus -- Breathers and Existers resist */
1776 if (seen) obvious = TRUE;
1778 if (r_ptr->flagsr & RFR_RES_ALL)
1780 note = _("には完全な耐性がある!", " is immune.");
1782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1785 if (r_ptr->flagsr & RFR_RES_NEXU)
1787 note = _("には耐性がある。", " resists.");
1788 dam *= 3; dam /= randint1(6) + 6;
1789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1797 if (seen) obvious = TRUE;
1799 if (r_ptr->flagsr & RFR_RES_ALL)
1801 note = _("には完全な耐性がある!", " is immune.");
1803 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1806 if (r_ptr->flagsr & RFR_RES_WALL)
1808 note = _("には耐性がある。", " resists.");
1809 dam *= 3; dam /= randint1(6) + 6;
1810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1812 else do_stun = (randint1(15) + r) / (r + 1);
1816 /* Inertia -- breathers resist */
1819 if (seen) obvious = TRUE;
1821 if (r_ptr->flagsr & RFR_RES_ALL)
1823 note = _("には完全な耐性がある!", " is immune.");
1825 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1828 if (r_ptr->flagsr & RFR_RES_INER)
1830 note = _("には耐性がある。", " resists.");
1831 dam *= 3; dam /= randint1(6) + 6;
1832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1836 /* Powerful monsters can resist */
1837 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1838 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1842 /* Normal monsters slow down */
1845 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1847 note = _("の動きが遅くなった。", " starts moving slower.");
1854 /* Time -- breathers resist */
1857 if (seen) obvious = TRUE;
1859 if (r_ptr->flagsr & RFR_RES_ALL)
1861 note = _("には完全な耐性がある!", " is immune.");
1863 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1866 if (r_ptr->flagsr & RFR_RES_TIME)
1868 note = _("には耐性がある。", " resists.");
1869 dam *= 3; dam /= randint1(6) + 6;
1870 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1872 else do_time = (dam + 1) / 2;
1876 /* Gravity -- breathers resist */
1879 bool resist_tele = FALSE;
1881 if (seen) obvious = TRUE;
1883 if (r_ptr->flagsr & RFR_RES_ALL)
1885 note = _("には完全な耐性がある!", " is immune.");
1887 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1890 if (r_ptr->flagsr & RFR_RES_TELE)
1892 if (r_ptr->flags1 & (RF1_UNIQUE))
1894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1895 note = _("には効果がなかった。", " is unaffected!");
1898 else if (r_ptr->level > randint1(100))
1900 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1901 note = _("には耐性がある!", " resists!");
1906 if (!resist_tele) do_dist = 10;
1908 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1910 if (r_ptr->flagsr & RFR_RES_GRAV)
1912 note = _("には耐性がある!", " resists!");
1913 dam *= 3; dam /= randint1(6) + 6;
1915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1920 /* Powerful monsters can resist */
1921 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1922 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1926 /* Normal monsters slow down */
1929 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1931 note = _("の動きが遅くなった。", " starts moving slower.");
1936 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1938 /* Attempt a saving throw */
1939 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1940 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1944 /* No obvious effect */
1945 note = _("には効果がなかった。", " is unaffected!");
1957 if (seen) obvious = TRUE;
1959 if (r_ptr->flagsr & RFR_RES_ALL)
1961 note = _("には完全な耐性がある!", " is immune.");
1963 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1971 case GF_DISINTEGRATE:
1973 if (seen) obvious = TRUE;
1975 if (r_ptr->flagsr & RFR_RES_ALL)
1977 note = _("には完全な耐性がある!", " is immune.");
1979 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1982 if (r_ptr->flags3 & RF3_HURT_ROCK)
1984 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1985 note = _("の皮膚がただれた!", " loses some skin!");
1986 note_dies = _("は蒸発した!", " evaporates!");
1994 if (seen) obvious = TRUE;
1996 /* PSI only works if the monster can see you! -- RG */
1997 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
2000 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
2005 if (r_ptr->flagsr & RFR_RES_ALL)
2007 note = _("には完全な耐性がある!", " is immune.");
2009 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2012 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2015 note = _("には完全な耐性がある!", " is immune.");
2016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2019 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2020 (r_ptr->flags3 & RF3_ANIMAL) ||
2021 (r_ptr->level > randint1(3 * dam)))
2023 note = _("には耐性がある!", " resists!");
2027 * Powerful demons & undead can turn a mindcrafter's
2028 * attacks back on them
2030 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2031 (r_ptr->level > p_ptr->lev / 2) &&
2035 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2036 (seen ? "%^s's corrupted mind backlashes your attack!" :
2037 "%^ss corrupted mind backlashes your attack!")), m_name);
2040 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2042 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2046 /* Injure +/- confusion */
2047 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2048 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2049 if (one_in_(4) && !CHECK_MULTISHADOW())
2051 switch (randint1(4))
2054 set_confused(p_ptr->confused + 3 + randint1(dam));
2057 set_stun(p_ptr->stun + randint1(dam));
2061 if (r_ptr->flags3 & RF3_NO_FEAR)
2062 note = _("には効果がなかった。", " is unaffected.");
2064 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2068 if (!p_ptr->free_act)
2069 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2078 if ((dam > 0) && one_in_(4))
2080 switch (randint1(4))
2083 do_conf = 3 + randint1(dam);
2086 do_stun = 3 + randint1(dam);
2089 do_fear = 3 + randint1(dam);
2092 note = _("は眠り込んでしまった!", " falls asleep!");
2093 do_sleep = 3 + randint1(dam);
2098 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2104 if (seen) obvious = TRUE;
2106 if (r_ptr->flagsr & RFR_RES_ALL)
2108 note = _("には完全な耐性がある!", " is immune.");
2110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2113 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2116 note = _("には完全な耐性がある!", " is immune.");
2118 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2119 (r_ptr->flags3 & RF3_ANIMAL) ||
2120 (r_ptr->level > randint1(3 * dam)))
2122 note = _("には耐性がある!", " resists!");
2126 * Powerful demons & undead can turn a mindcrafter's
2127 * attacks back on them
2129 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2130 (r_ptr->level > p_ptr->lev / 2) &&
2134 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2135 (seen ? "%^s's corrupted mind backlashes your attack!" :
2136 "%^ss corrupted mind backlashes your attack!")), m_name);
2138 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2140 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2144 /* Injure + mana drain */
2145 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2146 if (!CHECK_MULTISHADOW())
2148 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2149 p_ptr->csp -= damroll(5, dam) / 2;
2150 if (p_ptr->csp < 0) p_ptr->csp = 0;
2151 p_ptr->redraw |= PR_MANA;
2152 p_ptr->window |= (PW_SPELL);
2154 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2161 int b = damroll(5, dam) / 4;
2162 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2163 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2164 (seen ? "You convert %s's pain into %s!" :
2165 "You convert %ss pain into %s!"));
2166 msg_format(msg, m_name, str);
2168 b = MIN(p_ptr->msp, p_ptr->csp + b);
2170 p_ptr->redraw |= PR_MANA;
2171 p_ptr->window |= (PW_SPELL);
2173 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2177 case GF_TELEKINESIS:
2179 if (seen) obvious = TRUE;
2181 if (r_ptr->flagsr & RFR_RES_ALL)
2183 note = _("には完全な耐性がある!", " is immune.");
2185 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2190 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2195 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2197 /* Attempt a saving throw */
2198 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2199 (r_ptr->level > 5 + randint1(dam)))
2203 /* No obvious effect */
2209 /* Psycho-spear -- powerful magic missile */
2212 if (seen) obvious = TRUE;
2214 if (r_ptr->flagsr & RFR_RES_ALL)
2216 note = _("には完全な耐性がある!", " is immune.");
2218 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2224 /* Meteor -- powerful magic missile */
2227 if (seen) obvious = TRUE;
2229 if (r_ptr->flagsr & RFR_RES_ALL)
2231 note = _("には完全な耐性がある!", " is immune.");
2233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2241 if (!is_hostile(m_ptr)) break;
2243 if (seen) obvious = TRUE;
2245 if (r_ptr->flagsr & RFR_RES_ALL)
2247 note = _("には効果がなかった!", " is immune.");
2249 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2252 /* Attempt a saving throw */
2253 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2254 (r_ptr->flags3 & RF3_NO_CONF) ||
2255 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2257 /* Memorize a flag */
2258 if (r_ptr->flags3 & RF3_NO_CONF)
2260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2267 * Powerful demons & undead can turn a mindcrafter's
2268 * attacks back on them
2270 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2271 (r_ptr->level > p_ptr->lev / 2) &&
2275 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2276 (seen ? "%^s's corrupted mind backlashes your attack!" :
2277 "%^ss corrupted mind backlashes your attack!")), m_name);
2280 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2282 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2286 /* Confuse, stun, terrify */
2287 switch (randint1(4))
2290 set_stun(p_ptr->stun + dam / 2);
2293 set_confused(p_ptr->confused + dam / 2);
2297 if (r_ptr->flags3 & RF3_NO_FEAR)
2298 note = _("には効果がなかった。", " is unaffected.");
2300 set_afraid(p_ptr->afraid + dam);
2307 /* No obvious effect */
2308 note = _("には効果がなかった。", " is unaffected.");
2314 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2316 note = _("があなたに隷属した。", " is in your thrall!");
2321 switch (randint1(4))
2335 /* No "real" damage */
2342 /* Ice -- Cold + Cuts + Stun */
2345 if (seen) obvious = TRUE;
2347 if (r_ptr->flagsr & RFR_RES_ALL)
2349 note = _("には完全な耐性がある!", " is immune.");
2351 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2354 do_stun = (randint1(15) + 1) / (r + 1);
2355 if (r_ptr->flagsr & RFR_IM_COLD)
2357 note = _("にはかなり耐性がある!", " resists a lot.");
2359 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2361 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2363 note = _("はひどい痛手をうけた。", " is hit hard.");
2365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2372 case GF_HYPODYNAMIA:
2374 if (seen) obvious = TRUE;
2376 if (r_ptr->flagsr & RFR_RES_ALL)
2378 note = _("には完全な耐性がある!", " is immune.");
2380 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2383 if (!monster_living(m_ptr->r_idx))
2385 if (is_original_ap_and_seen(m_ptr))
2387 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2388 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2389 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2391 note = _("には効果がなかった。", " is unaffected.");
2395 else do_time = (dam+7)/8;
2403 if (seen) obvious = TRUE;
2405 if (r_ptr->flagsr & RFR_RES_ALL)
2407 note = _("には完全な耐性がある!", " is immune.");
2409 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2412 if (!monster_living(m_ptr->r_idx))
2414 if (is_original_ap_and_seen(m_ptr))
2416 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2417 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2418 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2420 note = _("には完全な耐性がある!", " is immune.");
2424 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2425 (randint1(888) != 666)) ||
2426 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2427 randint1(100) != 66))
2429 note = _("には耐性がある!", " resists!");
2437 /* Polymorph monster (Use "dam" as "power") */
2440 if (seen) obvious = TRUE;
2442 if (r_ptr->flagsr & RFR_RES_ALL)
2444 note = _("には効果がなかった。", " is unaffected.");
2446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2449 /* Attempt to polymorph (see below) */
2452 /* Powerful monsters can resist */
2453 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2454 (r_ptr->flags1 & RF1_QUESTOR) ||
2455 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2457 note = _("には効果がなかった。", " is unaffected.");
2462 /* No "real" damage */
2469 /* Clone monsters (Ignore "dam") */
2472 if (seen) obvious = TRUE;
2474 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2476 note = _("には効果がなかった。", " is unaffected.");
2481 m_ptr->hp = m_ptr->maxhp;
2483 /* Attempt to clone. */
2484 if (multiply_monster(c_ptr->m_idx, TRUE, 0L))
2486 note = _("が分裂した!", " spawns!");
2490 /* No "real" damage */
2497 /* Heal Monster (use "dam" as amount of healing) */
2500 if (seen) obvious = TRUE;
2503 (void)set_monster_csleep(c_ptr->m_idx, 0);
2505 if (m_ptr->maxhp < m_ptr->max_maxhp)
2507 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2508 m_ptr->maxhp = m_ptr->max_maxhp;
2513 /* Redraw (later) if needed */
2514 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2515 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2523 if (seen) obvious = TRUE;
2526 (void)set_monster_csleep(c_ptr->m_idx, 0);
2527 if (MON_STUNNED(m_ptr))
2529 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2530 (void)set_monster_stunned(c_ptr->m_idx, 0);
2532 if (MON_CONFUSED(m_ptr))
2534 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2535 (void)set_monster_confused(c_ptr->m_idx, 0);
2537 if (MON_MONFEAR(m_ptr))
2539 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2540 (void)set_monster_monfear(c_ptr->m_idx, 0);
2544 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2547 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2551 chg_virtue(V_VITALITY, 1);
2553 if (r_ptr->flags1 & RF1_UNIQUE)
2554 chg_virtue(V_INDIVIDUALISM, 1);
2556 if (is_friendly(m_ptr))
2557 chg_virtue(V_HONOUR, 1);
2558 else if (!(r_ptr->flags3 & RF3_EVIL))
2560 if (r_ptr->flags3 & RF3_GOOD)
2561 chg_virtue(V_COMPASSION, 2);
2563 chg_virtue(V_COMPASSION, 1);
2566 if (r_ptr->flags3 & RF3_ANIMAL)
2567 chg_virtue(V_NATURE, 1);
2570 if (m_ptr->r_idx == MON_LEPER)
2573 if (!who) chg_virtue(V_COMPASSION, 5);
2576 /* Redraw (later) if needed */
2577 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2578 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2580 note = _("は体力を回復したようだ。", " looks healthier.");
2582 /* No "real" damage */
2588 /* Speed Monster (Ignore "dam") */
2591 if (seen) obvious = TRUE;
2594 if (set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100))
2596 note = _("の動きが速くなった。", " starts moving faster.");
2601 if (r_ptr->flags1 & RF1_UNIQUE)
2602 chg_virtue(V_INDIVIDUALISM, 1);
2603 if (is_friendly(m_ptr))
2604 chg_virtue(V_HONOUR, 1);
2607 /* No "real" damage */
2613 /* Slow Monster (Use "dam" as "power") */
2616 if (seen) obvious = TRUE;
2618 if (r_ptr->flagsr & RFR_RES_ALL)
2620 note = _("には効果がなかった。", " is unaffected.");
2622 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2625 /* Powerful monsters can resist */
2626 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2627 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2629 note = _("には効果がなかった。", " is unaffected.");
2633 /* Normal monsters slow down */
2636 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2638 note = _("の動きが遅くなった。", " starts moving slower.");
2642 /* No "real" damage */
2648 /* Sleep (Use "dam" as "power") */
2651 if (seen) obvious = TRUE;
2653 if (r_ptr->flagsr & RFR_RES_ALL)
2655 note = _("には効果がなかった。", " is unaffected.");
2657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2660 /* Attempt a saving throw */
2661 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2662 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2663 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2665 /* Memorize a flag */
2666 if (r_ptr->flags3 & RF3_NO_SLEEP)
2668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2670 /* No obvious effect */
2671 note = _("には効果がなかった。", " is unaffected.");
2676 /* Go to sleep (much) later */
2677 note = _("は眠り込んでしまった!", " falls asleep!");
2681 /* No "real" damage */
2687 /* Sleep (Use "dam" as "power") */
2688 case GF_STASIS_EVIL:
2690 if (seen) obvious = TRUE;
2692 if (r_ptr->flagsr & RFR_RES_ALL)
2694 note = _("には効果がなかった!", " is immune.");
2696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2699 /* Attempt a saving throw */
2700 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2701 !(r_ptr->flags3 & RF3_EVIL) ||
2702 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2704 note = _("には効果がなかった。", " is unaffected.");
2709 /* Go to sleep (much) later */
2710 note = _("は動けなくなった!", " is suspended!");
2714 /* No "real" damage */
2719 /* Sleep (Use "dam" as "power") */
2722 if (seen) obvious = TRUE;
2724 if (r_ptr->flagsr & RFR_RES_ALL)
2726 note = _("には効果がなかった。", " is unaffected.");
2728 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2731 /* Attempt a saving throw */
2732 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2733 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2735 note = _("には効果がなかった。", " is unaffected.");
2740 /* Go to sleep (much) later */
2741 note = _("は動けなくなった!", " is suspended!");
2745 /* No "real" damage */
2754 vir = virtue_number(V_HARMONY);
2757 dam += p_ptr->virtues[vir-1]/10;
2760 vir = virtue_number(V_INDIVIDUALISM);
2763 dam -= p_ptr->virtues[vir-1]/20;
2766 if (seen) obvious = TRUE;
2768 /* Attempt a saving throw */
2769 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2773 /* No obvious effect */
2774 note = _("には効果がなかった。", " is unaffected.");
2777 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2779 else if (p_ptr->cursed & TRC_AGGRAVATE)
2781 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2782 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2786 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2789 chg_virtue(V_INDIVIDUALISM, -1);
2790 if (r_ptr->flags3 & RF3_ANIMAL)
2791 chg_virtue(V_NATURE, 1);
2794 /* No "real" damage */
2799 /* Control undead */
2800 case GF_CONTROL_UNDEAD:
2803 if (seen) obvious = TRUE;
2805 vir = virtue_number(V_UNLIFE);
2808 dam += p_ptr->virtues[vir-1]/10;
2811 vir = virtue_number(V_INDIVIDUALISM);
2814 dam -= p_ptr->virtues[vir-1]/20;
2817 /* Attempt a saving throw */
2818 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2819 !(r_ptr->flags3 & RF3_UNDEAD))
2821 /* No obvious effect */
2822 note = _("には効果がなかった。", " is unaffected.");
2824 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2826 else if (p_ptr->cursed & TRC_AGGRAVATE)
2828 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2829 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2833 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2837 /* No "real" damage */
2843 case GF_CONTROL_DEMON:
2846 if (seen) obvious = TRUE;
2848 vir = virtue_number(V_UNLIFE);
2851 dam += p_ptr->virtues[vir-1]/10;
2854 vir = virtue_number(V_INDIVIDUALISM);
2857 dam -= p_ptr->virtues[vir-1]/20;
2860 /* Attempt a saving throw */
2861 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2862 !(r_ptr->flags3 & RF3_DEMON))
2864 /* No obvious effect */
2865 note = _("には効果がなかった。", " is unaffected.");
2867 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2869 else if (p_ptr->cursed & TRC_AGGRAVATE)
2871 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2872 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2876 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2880 /* No "real" damage */
2886 case GF_CONTROL_ANIMAL:
2889 if (seen) obvious = TRUE;
2891 vir = virtue_number(V_NATURE);
2894 dam += p_ptr->virtues[vir-1]/10;
2897 vir = virtue_number(V_INDIVIDUALISM);
2900 dam -= p_ptr->virtues[vir-1]/20;
2903 /* Attempt a saving throw */
2904 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2905 !(r_ptr->flags3 & RF3_ANIMAL))
2908 /* No obvious effect */
2909 note = _("には効果がなかった。", " is unaffected.");
2911 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2913 else if (p_ptr->cursed & TRC_AGGRAVATE)
2915 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2916 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2920 note = _("はなついた。", " is tamed!");
2922 if (r_ptr->flags3 & RF3_ANIMAL)
2923 chg_virtue(V_NATURE, 1);
2926 /* No "real" damage */
2932 case GF_CHARM_LIVING:
2936 vir = virtue_number(V_UNLIFE);
2937 if (seen) obvious = TRUE;
2939 vir = virtue_number(V_UNLIFE);
2942 dam -= p_ptr->virtues[vir-1]/10;
2945 vir = virtue_number(V_INDIVIDUALISM);
2948 dam -= p_ptr->virtues[vir-1]/20;
2951 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2953 /* Attempt a saving throw */
2954 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2955 !monster_living(m_ptr->r_idx))
2958 /* No obvious effect */
2959 note = _("には効果がなかった。", " is unaffected.");
2961 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2963 else if (p_ptr->cursed & TRC_AGGRAVATE)
2965 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2966 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2970 note = _("を支配した。", " is tamed!");
2972 if (r_ptr->flags3 & RF3_ANIMAL)
2973 chg_virtue(V_NATURE, 1);
2976 /* No "real" damage */
2981 /* Confusion (Use "dam" as "power") */
2984 if (seen) obvious = TRUE;
2986 if (r_ptr->flagsr & RFR_RES_ALL)
2988 note = _("には効果がなかった。", " is unaffected.");
2990 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2993 /* Get confused later */
2994 do_conf = damroll(3, (dam / 2)) + 1;
2996 /* Attempt a saving throw */
2997 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2998 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2999 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3001 /* Memorize a flag */
3002 if (r_ptr->flags3 & (RF3_NO_CONF))
3004 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3010 /* No obvious effect */
3011 note = _("には効果がなかった。", " is unaffected.");
3015 /* No "real" damage */
3022 if (seen) obvious = TRUE;
3024 if (r_ptr->flagsr & RFR_RES_ALL)
3026 note = _("には効果がなかった。", " is unaffected.");
3028 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3031 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
3033 /* Attempt a saving throw */
3034 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3035 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3040 /* No obvious effect */
3041 note = _("には効果がなかった。", " is unaffected.");
3045 /* No "real" damage */
3053 /* Lite, but only hurts susceptible creatures */
3061 if (r_ptr->flagsr & RFR_RES_ALL)
3067 if (r_ptr->flags3 & (RF3_HURT_LITE))
3069 /* Obvious effect */
3070 if (seen) obvious = TRUE;
3072 /* Memorize the effects */
3073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3075 /* Special effect */
3076 note = _("は光に身をすくめた!", " cringes from the light!");
3077 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3080 /* Normally no damage */
3092 /* Lite -- opposite of Dark */
3095 if (seen) obvious = TRUE;
3097 if (r_ptr->flagsr & RFR_RES_ALL)
3099 note = _("には完全な耐性がある!", " is immune.");
3101 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3104 if (r_ptr->flagsr & RFR_RES_LITE)
3106 note = _("には耐性がある!", " resists!");
3107 dam *= 2; dam /= (randint1(6)+6);
3108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3110 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3112 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3113 note = _("は光に身をすくめた!", " cringes from the light!");
3114 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3121 /* Dark -- opposite of Lite */
3124 if (seen) obvious = TRUE;
3126 if (r_ptr->flagsr & RFR_RES_ALL)
3128 note = _("には完全な耐性がある!", " is immune.");
3130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3133 if (r_ptr->flagsr & RFR_RES_DARK)
3135 note = _("には耐性がある!", " resists!");
3136 dam *= 2; dam /= (randint1(6)+6);
3137 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3146 if (r_ptr->flagsr & RFR_RES_ALL)
3151 /* Hurt by rock remover */
3152 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3155 if (seen) obvious = TRUE;
3157 /* Memorize the effects */
3158 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3160 /* Cute little message */
3161 note = _("の皮膚がただれた!", " loses some skin!");
3162 note_dies = _("はドロドロに溶けた!", " dissolves!");
3165 /* Usually, ignore the effects */
3176 /* Teleport undead (Use "dam" as "power") */
3177 case GF_AWAY_UNDEAD:
3179 /* Only affect undead */
3180 if (r_ptr->flags3 & (RF3_UNDEAD))
3182 bool resists_tele = FALSE;
3184 if (r_ptr->flagsr & RFR_RES_TELE)
3186 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3189 note = _("には効果がなかった。", " is unaffected.");
3190 resists_tele = TRUE;
3192 else if (r_ptr->level > randint1(100))
3194 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3195 note = _("には耐性がある!", " resists!");
3196 resists_tele = TRUE;
3202 if (seen) obvious = TRUE;
3203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3215 /* No "real" damage */
3221 /* Teleport evil (Use "dam" as "power") */
3224 /* Only affect evil */
3225 if (r_ptr->flags3 & (RF3_EVIL))
3227 bool resists_tele = FALSE;
3229 if (r_ptr->flagsr & RFR_RES_TELE)
3231 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3233 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3234 note = _("には効果がなかった。", " is unaffected.");
3235 resists_tele = TRUE;
3237 else if (r_ptr->level > randint1(100))
3239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3240 note = _("には耐性がある!", " resists!");
3241 resists_tele = TRUE;
3247 if (seen) obvious = TRUE;
3248 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3260 /* No "real" damage */
3266 /* Teleport monster (Use "dam" as "power") */
3269 bool resists_tele = FALSE;
3270 if (r_ptr->flagsr & RFR_RES_TELE)
3272 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3274 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3275 note = _("には効果がなかった。", " is unaffected.");
3276 resists_tele = TRUE;
3278 else if (r_ptr->level > randint1(100))
3280 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3281 note = _("には耐性がある!", " resists!");
3282 resists_tele = TRUE;
3288 if (seen) obvious = TRUE;
3290 /* Prepare to teleport */
3294 /* No "real" damage */
3300 /* Turn undead (Use "dam" as "power") */
3301 case GF_TURN_UNDEAD:
3303 if (r_ptr->flagsr & RFR_RES_ALL)
3308 /* Only affect undead */
3309 if (r_ptr->flags3 & (RF3_UNDEAD))
3311 if (seen) obvious = TRUE;
3313 /* Learn about type */
3314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3316 /* Apply some fear */
3317 do_fear = damroll(3, (dam / 2)) + 1;
3319 /* Attempt a saving throw */
3320 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3322 /* No obvious effect */
3323 note = _("には効果がなかった。", " is unaffected.");
3336 /* No "real" damage */
3342 /* Turn evil (Use "dam" as "power") */
3345 if (r_ptr->flagsr & RFR_RES_ALL)
3350 /* Only affect evil */
3351 if (r_ptr->flags3 & (RF3_EVIL))
3353 if (seen) obvious = TRUE;
3355 /* Learn about type */
3356 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3358 /* Apply some fear */
3359 do_fear = damroll(3, (dam / 2)) + 1;
3361 /* Attempt a saving throw */
3362 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3364 /* No obvious effect */
3365 note = _("には効果がなかった。", " is unaffected.");
3378 /* No "real" damage */
3384 /* Turn monster (Use "dam" as "power") */
3387 if (r_ptr->flagsr & RFR_RES_ALL)
3392 if (seen) obvious = TRUE;
3394 /* Apply some fear */
3395 do_fear = damroll(3, (dam / 2)) + 1;
3397 /* Attempt a saving throw */
3398 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3399 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3400 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3402 /* No obvious effect */
3403 note = _("には効果がなかった。", " is unaffected.");
3408 /* No "real" damage */
3415 case GF_DISP_UNDEAD:
3417 if (r_ptr->flagsr & RFR_RES_ALL)
3423 /* Only affect undead */
3424 if (r_ptr->flags3 & (RF3_UNDEAD))
3426 if (seen) obvious = TRUE;
3428 /* Learn about type */
3429 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3431 note = _("は身震いした。", " shudders.");
3432 note_dies = _("はドロドロに溶けた!", " dissolves!");
3452 if (r_ptr->flagsr & RFR_RES_ALL)
3458 /* Only affect evil */
3459 if (r_ptr->flags3 & (RF3_EVIL))
3461 if (seen) obvious = TRUE;
3463 /* Learn about type */
3464 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3466 note = _("は身震いした。", " shudders.");
3467 note_dies = _("はドロドロに溶けた!", " dissolves!");
3486 if (r_ptr->flagsr & RFR_RES_ALL)
3492 /* Only affect good */
3493 if (r_ptr->flags3 & (RF3_GOOD))
3495 if (seen) obvious = TRUE;
3497 /* Learn about type */
3498 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3500 note = _("は身震いした。", " shudders.");
3501 note_dies = _("はドロドロに溶けた!", " dissolves!");
3518 case GF_DISP_LIVING:
3520 if (r_ptr->flagsr & RFR_RES_ALL)
3526 /* Only affect non-undead */
3527 if (monster_living(m_ptr->r_idx))
3529 if (seen) obvious = TRUE;
3531 note = _("は身震いした。", " shudders.");
3532 note_dies = _("はドロドロに溶けた!", " dissolves!");
3551 if (r_ptr->flagsr & RFR_RES_ALL)
3557 /* Only affect demons */
3558 if (r_ptr->flags3 & (RF3_DEMON))
3560 if (seen) obvious = TRUE;
3562 /* Learn about type */
3563 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3565 note = _("は身震いした。", " shudders.");
3566 note_dies = _("はドロドロに溶けた!", " dissolves!");
3582 /* Dispel monster */
3585 if (r_ptr->flagsr & RFR_RES_ALL)
3591 if (seen) obvious = TRUE;
3593 note = _("は身震いした。", " shudders.");
3594 note_dies = _("はドロドロに溶けた!", " dissolves!");
3601 if (seen) obvious = TRUE;
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 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3615 /* Heal the monster */
3616 if (caster_ptr->hp < caster_ptr->maxhp)
3619 caster_ptr->hp += dam;
3620 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3622 /* Redraw (later) if needed */
3623 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3624 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3626 /* Special message */
3629 monster_desc(killer, caster_ptr, 0);
3630 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3636 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3637 (void)hp_player(dam);
3642 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3651 if (seen) obvious = TRUE;
3652 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3654 if (r_ptr->flagsr & RFR_RES_ALL)
3656 note = _("には完全な耐性がある!", " is immune.");
3658 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3662 /* Attempt a saving throw */
3663 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3664 (r_ptr->flags3 & RF3_NO_CONF) ||
3665 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3667 /* Memorize a flag */
3668 if (r_ptr->flags3 & (RF3_NO_CONF))
3670 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3672 note = _("には効果がなかった。", " is unaffected.");
3675 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3677 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3678 note = _("には完全な耐性がある!", " is immune.");
3681 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3683 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3684 note = _("には耐性がある。", " resists.");
3689 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3690 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3692 if (who > 0) do_conf = randint0(4) + 4;
3693 else do_conf = randint0(8) + 8;
3699 case GF_BRAIN_SMASH:
3701 if (seen) obvious = TRUE;
3702 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3704 if (r_ptr->flagsr & RFR_RES_ALL)
3706 note = _("には完全な耐性がある!", " is immune.");
3708 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3712 /* Attempt a saving throw */
3713 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3714 (r_ptr->flags3 & RF3_NO_CONF) ||
3715 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3717 /* Memorize a flag */
3718 if (r_ptr->flags3 & (RF3_NO_CONF))
3720 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3722 note = _("には効果がなかった。", " is unaffected.");
3725 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3727 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3728 note = _("には完全な耐性がある!", " is immune.");
3731 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3733 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3734 note = _("には耐性がある!", " resists!");
3739 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3740 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3744 do_conf = randint0(4) + 4;
3745 do_stun = randint0(4) + 4;
3749 do_conf = randint0(8) + 8;
3750 do_stun = randint0(8) + 8;
3752 (void)set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3760 if (seen) obvious = TRUE;
3761 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3763 if (r_ptr->flagsr & RFR_RES_ALL)
3765 note = _("には完全な耐性がある!", " is immune.");
3767 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3771 /* Attempt a saving throw */
3772 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3774 note = _("には効果がなかった。", " is unaffected.");
3783 if (seen) obvious = TRUE;
3784 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3786 if (r_ptr->flagsr & RFR_RES_ALL)
3788 note = _("には完全な耐性がある!", " is immune.");
3790 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3794 /* Attempt a saving throw */
3795 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3797 note = _("には効果がなかった。", " is unaffected.");
3806 if (seen) obvious = TRUE;
3807 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3809 if (r_ptr->flagsr & RFR_RES_ALL)
3811 note = _("には完全な耐性がある!", " is immune.");
3813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3817 /* Attempt a saving throw */
3818 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3820 note = _("には効果がなかった。", " is unaffected.");
3829 if (seen) obvious = TRUE;
3831 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3832 "You point at %s, screaming the word, 'DIE!'."), m_name);
3834 if (r_ptr->flagsr & RFR_RES_ALL)
3836 note = _("には完全な耐性がある!", " is immune.");
3838 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3842 /* Attempt a saving throw */
3843 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3845 note = _("には効果がなかった。", " is unaffected.");
3854 if (seen) obvious = TRUE;
3856 if (r_ptr->flagsr & RFR_RES_ALL)
3858 note = _("には完全な耐性がある!", " is immune.");
3860 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3864 if (r_ptr->flags1 & RF1_UNIQUE)
3866 note = _("には効果がなかった。", " is unaffected.");
3871 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3872 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3874 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3876 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3880 note = _("は耐性を持っている!", "resists!");
3887 /* Capture monster */
3891 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3892 (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)
3894 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3899 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3900 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3901 nokori_hp = m_ptr->maxhp * 3 / 10;
3903 nokori_hp = m_ptr->maxhp * 3 / 20;
3905 if (m_ptr->hp >= nokori_hp)
3907 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3910 else if (m_ptr->hp < randint0(nokori_hp))
3912 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
3913 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3914 cap_mon = m_ptr->r_idx;
3915 cap_mspeed = m_ptr->mspeed;
3917 cap_maxhp = m_ptr->max_maxhp;
3918 cap_nickname = m_ptr->nickname; /* Quark transfer */
3919 if (c_ptr->m_idx == p_ptr->riding)
3921 if (rakuba(-1, FALSE))
3923 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3927 delete_monster_idx(c_ptr->m_idx);
3933 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3939 /* Attack (Use "dam" as attack type) */
3942 /* Return this monster's death */
3943 return py_attack(y, x, dam);
3946 /* Sleep (Use "dam" as "power") */
3952 if (seen) obvious = TRUE;
3954 if (r_ptr->flagsr & RFR_RES_ALL)
3956 note = _("には効果がなかった。", " is unaffected.");
3958 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3961 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3963 note = _("には効果がなかった。", " is unaffected.");
3966 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3969 if (MON_CSLEEP(m_ptr))
3971 note = _("には効果がなかった。", " is unaffected.");
3977 if (one_in_(5)) effect = 1;
3978 else if (one_in_(4)) effect = 2;
3979 else if (one_in_(3)) effect = 3;
3984 /* Powerful monsters can resist */
3985 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3986 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3988 note = _("には効果がなかった。", " is unaffected.");
3992 /* Normal monsters slow down */
3995 if (set_monster_slow(c_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3997 note = _("の動きが遅くなった。", " starts moving slower.");
4002 else if (effect == 2)
4004 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
4006 /* Attempt a saving throw */
4007 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
4008 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4013 /* No obvious effect */
4014 note = _("には効果がなかった。", " is unaffected.");
4019 else if (effect == 3)
4021 /* Attempt a saving throw */
4022 if ((r_ptr->flags1 & RF1_UNIQUE) ||
4023 (r_ptr->flags3 & RF3_NO_SLEEP) ||
4024 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
4026 /* Memorize a flag */
4027 if (r_ptr->flags3 & RF3_NO_SLEEP)
4029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
4032 /* No obvious effect */
4033 note = _("には効果がなかった。", " is unaffected.");
4038 /* Go to sleep (much) later */
4039 note = _("は眠り込んでしまった!", " falls asleep!");
4046 note = _("には効果がなかった。", " is unaffected.");
4049 /* No "real" damage */
4057 if (seen) obvious = TRUE;
4059 if (r_ptr->flagsr & RFR_RES_ALL)
4061 note = _("には効果がなかった。", " is unaffected.");
4063 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4067 if (genocide_aux(c_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4069 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4070 chg_virtue(V_VITALITY, -1);
4080 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4082 if (r_ptr->flags3 & (RF3_HURT_LITE))
4084 /* Obvious effect */
4085 if (seen) obvious = TRUE;
4087 /* Memorize the effects */
4088 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4090 /* Special effect */
4091 note = _("は光に身をすくめた!", " cringes from the light!");
4092 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4095 /* Normally no damage */
4102 photo = m_ptr->r_idx;
4109 case GF_BLOOD_CURSE:
4111 if (seen) obvious = TRUE;
4113 if (r_ptr->flagsr & RFR_RES_ALL)
4115 note = _("には完全な耐性がある!", " is immune.");
4117 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4125 bool success = FALSE;
4126 if (seen) obvious = TRUE;
4128 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4130 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4131 if (dam < 1) dam = 1;
4133 /* No need to tame your pet */
4136 note = _("の動きが速くなった。", " starts moving faster.");
4137 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4141 /* Attempt a saving throw */
4142 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4143 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4144 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4145 (p_ptr->cursed & TRC_AGGRAVATE) ||
4146 ((r_ptr->level+10) > randint1(dam)))
4149 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4153 note = _("を支配した。", " is tamed!");
4155 (void)set_monster_fast(c_ptr->m_idx, MON_FAST(m_ptr) + 100);
4157 /* Learn about type */
4158 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4165 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4167 do_fear = randint1(90)+10;
4169 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4172 /* No "real" damage */
4179 if (seen) obvious = TRUE;
4181 if (r_ptr->flagsr & RFR_RES_ALL)
4183 note = _("には完全な耐性がある!", " is immune.");
4185 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4189 /* Attempt a saving throw */
4190 if (randint0(100 + dam) < (r_ptr->level + 50))
4192 note = _("には効果がなかった。", " is unaffected.");
4212 /* Absolutely no effect */
4213 if (skipped) return (FALSE);
4215 /* "Unique" monsters cannot be polymorphed */
4216 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4218 /* Quest monsters cannot be polymorphed */
4219 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4221 if (p_ptr->riding && (c_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4223 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4224 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4226 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4231 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4232 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4235 /* Modify the damage */
4237 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4238 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4240 /* Check for death */
4241 if (dam > m_ptr->hp)
4243 /* Extract method of death */
4248 /* Sound and Impact resisters never stun */
4250 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4251 !(r_ptr->flags3 & RF3_NO_STUN))
4253 if (seen) obvious = TRUE;
4256 if (MON_STUNNED(m_ptr))
4258 note = _("はひどくもうろうとした。", " is more dazed.");
4259 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4263 note = _("はもうろうとした。", " is dazed.");
4268 (void)set_monster_stunned(c_ptr->m_idx, tmp);
4274 /* Confusion and Chaos resisters (and sleepers) never confuse */
4276 !(r_ptr->flags3 & RF3_NO_CONF) &&
4277 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4279 if (seen) obvious = TRUE;
4281 /* Already partially confused */
4282 if (MON_CONFUSED(m_ptr))
4284 note = _("はさらに混乱したようだ。", " looks more confused.");
4285 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4288 /* Was not confused */
4291 note = _("は混乱したようだ。", " looks confused.");
4295 /* Apply confusion */
4296 (void)set_monster_confused(c_ptr->m_idx, tmp);
4304 if (seen) obvious = TRUE;
4306 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4310 note = _("は弱くなったようだ。", " seems weakened.");
4311 m_ptr->maxhp -= do_time;
4312 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4317 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4318 if (do_poly && (randint1(90) > r_ptr->level))
4320 if (polymorph_monster(y, x))
4322 if (seen) obvious = TRUE;
4324 /* Monster polymorphs */
4325 note = _("が変身した!", " changes!");
4327 /* Turn off the damage */
4333 note = _("には効果がなかった。", " is unaffected.");
4336 /* Hack -- Get new monster */
4337 m_ptr = &m_list[c_ptr->m_idx];
4339 /* Hack -- Get new race */
4340 r_ptr = &r_info[m_ptr->r_idx];
4343 /* Handle "teleport" */
4346 if (seen) obvious = TRUE;
4348 note = _("が消え去った!", " disappears!");
4350 if (!who) chg_virtue(V_VALOUR, -1);
4353 teleport_away(c_ptr->m_idx, do_dist,
4354 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4356 /* Hack -- get new location */
4360 /* Hack -- get new grid */
4361 c_ptr = &cave[y][x];
4368 (void)set_monster_monfear(c_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4375 if (typ == GF_DRAIN_MANA)
4377 /* Drain mana does nothing */
4380 /* If another monster did the damage, hurt the monster by hand */
4383 /* Redraw (later) if needed */
4384 if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4385 if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4387 /* Wake the monster up */
4388 (void)set_monster_csleep(c_ptr->m_idx, 0);
4390 /* Hurt the monster */
4398 if (is_pet(m_ptr) && !(m_ptr->ml))
4401 /* Give detailed messages if destroyed */
4404 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4407 msg_format("%^s%s", m_name, note);
4415 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4417 /* Generate treasure, etc */
4418 monster_death(c_ptr->m_idx, FALSE);
4421 delete_monster_idx(c_ptr->m_idx);
4425 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4429 /* Damaged monster */
4432 /* Give detailed messages if visible or destroyed */
4433 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4435 /* Hack -- Pain message */
4438 message_pain(c_ptr->m_idx, dam);
4445 /* Hack -- handle sleep */
4446 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4450 else if (heal_leper)
4452 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4454 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4456 char m2_name[MAX_NLEN];
4458 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4459 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4462 delete_monster_idx(c_ptr->m_idx);
4465 /* If the player did it, give him experience, check fear */
4470 /* Hurt the monster, check for fear and death */
4471 if (mon_take_hit(c_ptr->m_idx, dam, &fear, note_dies))
4476 /* Damaged monster */
4479 /* HACK - anger the monster before showing the sleep message */
4480 if (do_sleep) anger_monster(m_ptr);
4482 /* Give detailed messages if visible or destroyed */
4483 if (note && seen_msg)
4484 msg_format(_("%s%s", "%^s%s"), m_name, note);
4486 /* Hack -- Pain message */
4487 else if (known && (dam || !do_fear))
4489 message_pain(c_ptr->m_idx, dam);
4492 /* Anger monsters */
4493 if (((dam > 0) || get_angry) && !do_sleep)
4494 anger_monster(m_ptr);
4496 if ((fear || do_fear) && seen)
4499 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4502 /* Hack -- handle sleep */
4503 if (do_sleep) (void)set_monster_csleep(c_ptr->m_idx, do_sleep);
4507 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4509 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4513 switch (randint1(28))
4518 msg_print(_("地面が揺れた...", "The ground trembles..."));
4519 earthquake(ty, tx, 4 + randint0(4));
4520 if (!one_in_(6)) break;
4522 case 3: case 4: case 5: case 6:
4525 int extra_dam = damroll(10, 10);
4526 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4528 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4529 if (!one_in_(6)) break;
4534 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4536 if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4537 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4538 if (!one_in_(6)) break;
4540 case 9: case 10: case 11:
4541 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4542 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4543 if (!one_in_(6)) break;
4544 case 12: case 13: case 14: case 15: case 16:
4545 aggravate_monsters(0);
4546 if (!one_in_(6)) break;
4548 count += activate_hi_summon(ty, tx, TRUE);
4549 if (!one_in_(6)) break;
4550 case 19: case 20: case 21: case 22:
4552 bool pet = !one_in_(3);
4553 BIT_FLAGS mode = PM_ALLOW_GROUP;
4555 if (pet) mode |= PM_FORCE_PET;
4556 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4558 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');
4559 if (!one_in_(6)) break;
4561 case 23: case 24: case 25:
4562 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4563 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4565 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4566 else lose_exp(p_ptr->exp / 16);
4567 if (!one_in_(6)) break;
4568 case 26: case 27: case 28:
4577 (void)do_dec_stat(i);
4586 (void)do_dec_stat(randint0(6));
4595 if (p_ptr->inside_battle)
4597 p_ptr->health_who = c_ptr->m_idx;
4598 p_ptr->redraw |= (PR_HEALTH);
4602 /* Verify this code */
4603 if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE);
4605 /* Redraw the monster grid */
4609 /* Update monster recall window */
4610 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
4612 p_ptr->window |= (PW_MONSTER);
4615 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
4619 if (!(flg & PROJECT_NO_HANGEKI))
4621 set_target(m_ptr, monster_target_y, monster_target_x);
4624 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
4626 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
4630 if (p_ptr->riding && (p_ptr->riding == c_ptr->m_idx) && (dam > 0))
4632 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
4633 rakubadam_m = (dam > 200) ? 200 : dam;
4643 /* Prepare to make a Blade of Chaos */
4644 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
4646 q_ptr->pval = photo;
4648 /* Mark the item as fully known */
4649 q_ptr->ident |= (IDENT_MENTAL);
4650 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
4658 /* Return "Anything seen?" */
4663 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
4664 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4665 * @param who_name 効果を起こしたモンスターの名前
4666 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4667 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4668 * @param x 目標X座標 / Target x location (or location to travel "towards")
4669 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4670 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4672 * @param monspell 効果元のモンスター魔法ID
4673 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4675 * Handle a beam/bolt/ball causing damage to the player.
4676 * This routine takes a "source monster" (by index), a "distance", a default
4677 * "damage", and a "damage type". See "project_m()" above.
4678 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
4679 * is reduced (see "project_m()" above). This can happen if a monster breathes
4680 * at the player and hits a wall instead.
4681 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
4682 * to know if this is actually a ball or a bolt spell
4683 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
4684 * we just assume that the effects were obvious, for historical reasons.
4686 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)
4691 /* Hack -- assume obvious */
4692 bool obvious = TRUE;
4694 /* Player blind-ness */
4695 bool blind = (p_ptr->blind ? TRUE : FALSE);
4697 /* Player needs a "description" (he is blind) */
4700 /* Source monster */
4701 monster_type *m_ptr = NULL;
4703 /* Monster name (for attacks) */
4704 GAME_TEXT m_name[MAX_NLEN];
4706 /* Monster name (for damage) */
4709 /* Hack -- messages */
4715 /* Player is not here */
4716 if (!player_bold(y, x)) return (FALSE);
4718 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4720 if (kawarimi(TRUE)) return FALSE;
4723 /* Player cannot hurt himself */
4724 if (!who) return (FALSE);
4725 if (who == p_ptr->riding) return (FALSE);
4727 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4730 int max_attempts = 10;
4731 sound(SOUND_REFLECT);
4734 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4735 else if (p_ptr->special_defense & KATA_FUUJIN)
4736 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4738 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4741 /* Choose 'new' target */
4746 t_y = m_list[who].fy - 1 + randint1(3);
4747 t_x = m_list[who].fx - 1 + randint1(3);
4750 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4752 if (max_attempts < 1)
4754 t_y = m_list[who].fy;
4755 t_x = m_list[who].fx;
4760 t_y = p_ptr->y - 1 + randint1(3);
4761 t_x = p_ptr->x - 1 + randint1(3);
4764 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4766 disturb(TRUE, TRUE);
4770 /* Limit maximum damage */
4771 if (dam > 1600) dam = 1600;
4773 /* Reduce damage by distance */
4774 dam = (dam + r) / (r + 1);
4777 /* If the player is blind, be more descriptive */
4778 if (blind) fuzzy = TRUE;
4783 m_ptr = &m_list[who];
4784 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4785 monster_desc(m_name, m_ptr, 0);
4787 /* Get the monster's real name (gotten before polymorph!) */
4788 strcpy(killer, who_name);
4794 case PROJECT_WHO_UNCTRL_POWER:
4795 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4798 case PROJECT_WHO_GLASS_SHARDS:
4799 strcpy(killer, _("ガラスの破片", "shards of glass"));
4803 strcpy(killer, _("罠", "a trap"));
4808 strcpy(m_name, killer);
4811 /* Analyze the damage */
4814 /* Standard damage -- hurts inventory too */
4817 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4818 get_damage = acid_dam(dam, killer, monspell, FALSE);
4822 /* Standard damage -- hurts inventory too */
4825 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4826 get_damage = fire_dam(dam, killer, monspell, FALSE);
4830 /* Standard damage -- hurts inventory too */
4833 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4834 get_damage = cold_dam(dam, killer, monspell, FALSE);
4838 /* Standard damage -- hurts inventory too */
4841 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4842 get_damage = elec_dam(dam, killer, monspell, FALSE);
4846 /* Standard damage -- also poisons player */
4849 bool double_resist = IS_OPPOSE_POIS();
4850 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4852 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4853 if (double_resist) dam = (dam + 2) / 3;
4855 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4860 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4862 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4864 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4869 /* Standard damage -- also poisons / mutates player */
4872 bool double_resist = IS_OPPOSE_POIS();
4873 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4875 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4876 if (double_resist) dam = (2 * dam + 2) / 5;
4877 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4878 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4880 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4882 if (one_in_(5)) /* 6 */
4884 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4885 if (one_in_(4)) /* 4 */
4893 inven_damage(set_acid_destroy, 2);
4899 /* Standard damage */
4902 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4903 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4907 /* Holy Orb -- Player only takes partial damage */
4910 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4911 if (p_ptr->align > 10)
4913 else if (p_ptr->align < -10)
4915 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4921 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4922 if (p_ptr->align > 10)
4924 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4928 /* Arrow -- XXX no dodging */
4933 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4935 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4937 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4940 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4944 /* Plasma -- XXX No resist */
4947 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4948 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4950 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4952 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4953 (void)set_stun(p_ptr->stun + plus_stun);
4956 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4958 inven_damage(set_acid_destroy, 3);
4964 /* Nether -- drain experience */
4967 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4968 if (p_ptr->resist_neth)
4970 if (!prace_is_(RACE_SPECTRE))
4972 dam *= 6; dam /= (randint1(4) + 7);
4975 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4977 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4979 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4981 learn_spell(monspell);
4985 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4991 /* Water -- stun/confuse */
4994 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4995 if (!CHECK_MULTISHADOW())
4997 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4999 set_stun(p_ptr->stun + randint1(40));
5001 if (!p_ptr->resist_conf && !p_ptr->resist_water)
5003 set_confused(p_ptr->confused + randint1(5) + 5);
5006 if (one_in_(5) && !p_ptr->resist_water)
5008 inven_damage(set_cold_destroy, 3);
5011 if (p_ptr->resist_water) get_damage /= 4;
5014 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5018 /* Chaos -- many effects */
5021 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
5022 if (p_ptr->resist_chaos)
5024 dam *= 6; dam /= (randint1(4) + 7);
5027 if (!CHECK_MULTISHADOW())
5029 if (!p_ptr->resist_conf)
5031 (void)set_confused(p_ptr->confused + randint0(20) + 10);
5033 if (!p_ptr->resist_chaos)
5035 (void)set_image(p_ptr->image + randint1(10));
5038 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
5039 (void)gain_random_mutation(0);
5042 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
5044 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
5047 if (!p_ptr->resist_chaos || one_in_(9))
5049 inven_damage(set_elec_destroy, 2);
5050 inven_damage(set_fire_destroy, 2);
5054 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5058 /* Shards -- mostly cutting */
5061 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5062 if (p_ptr->resist_shard)
5064 dam *= 6; dam /= (randint1(4) + 7);
5066 else if (!CHECK_MULTISHADOW())
5068 (void)set_cut(p_ptr->cut + dam);
5071 if (!p_ptr->resist_shard || one_in_(13))
5073 inven_damage(set_cold_destroy, 2);
5076 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5080 /* Sound -- mostly stunning */
5083 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5084 if (p_ptr->resist_sound)
5086 dam *= 5; dam /= (randint1(4) + 7);
5088 else if (!CHECK_MULTISHADOW())
5090 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5091 (void)set_stun(p_ptr->stun + plus_stun);
5094 if (!p_ptr->resist_sound || one_in_(13))
5096 inven_damage(set_cold_destroy, 2);
5099 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5103 /* Pure confusion */
5106 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5107 if (p_ptr->resist_conf)
5109 dam *= 5; dam /= (randint1(4) + 7);
5111 else if (!CHECK_MULTISHADOW())
5113 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5115 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5119 /* Disenchantment -- see above */
5122 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5123 if (p_ptr->resist_disen)
5125 dam *= 6; dam /= (randint1(4) + 7);
5127 else if (!CHECK_MULTISHADOW())
5129 (void)apply_disenchant(0);
5131 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5135 /* Nexus -- see above */
5138 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5139 if (p_ptr->resist_nexus)
5141 dam *= 6; dam /= (randint1(4) + 7);
5143 else if (!CHECK_MULTISHADOW())
5147 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5151 /* Force -- mostly stun */
5154 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5155 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5157 (void)set_stun(p_ptr->stun + randint1(20));
5159 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5164 /* Rocket -- stun, cut */
5167 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5168 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5170 (void)set_stun(p_ptr->stun + randint1(20));
5173 if (p_ptr->resist_shard)
5177 else if (!CHECK_MULTISHADOW())
5179 (void)set_cut(p_ptr->cut + (dam / 2));
5182 if (!p_ptr->resist_shard || one_in_(12))
5184 inven_damage(set_cold_destroy, 3);
5187 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5191 /* Inertia -- slowness */
5194 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5195 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5196 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5200 /* Lite -- blinding */
5203 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5204 if (p_ptr->resist_lite)
5206 dam *= 4; dam /= (randint1(4) + 7);
5208 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5210 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5213 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5215 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5218 else if (prace_is_(RACE_S_FAIRY))
5223 if (p_ptr->wraith_form) dam *= 2;
5224 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5226 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5228 p_ptr->wraith_form = 0;
5229 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5230 "The light forces you out of your incorporeal shadow form."));
5232 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5233 p_ptr->update |= (PU_MONSTERS);
5234 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5240 /* Dark -- blinding */
5243 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5244 if (p_ptr->resist_dark)
5246 dam *= 4; dam /= (randint1(4) + 7);
5248 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5250 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5252 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5254 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5258 /* Time -- bolt fewer effects XXX */
5261 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5262 if (p_ptr->resist_time)
5265 dam /= (randint1(4) + 7);
5266 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5268 else if (!CHECK_MULTISHADOW())
5270 switch (randint1(10))
5272 case 1: case 2: case 3: case 4: case 5:
5274 if (p_ptr->prace == RACE_ANDROID) break;
5275 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5276 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5280 case 6: case 7: case 8: case 9:
5282 switch (randint1(6))
5284 case 1: k = A_STR; act = _("強く", "strong"); break;
5285 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5286 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5287 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5288 case 5: k = A_CON; act = _("健康で", "hale"); break;
5289 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5292 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5293 "You're not as %s as you used to be..."), act);
5295 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5296 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5297 p_ptr->update |= (PU_BONUS);
5303 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5304 "You're not as powerful as you used to be..."));
5306 for (k = 0; k < A_MAX; k++)
5308 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5309 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5311 p_ptr->update |= (PU_BONUS);
5317 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5321 /* Gravity -- stun plus slowness plus teleport */
5324 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5325 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5327 if (!CHECK_MULTISHADOW())
5329 teleport_player(5, TELEPORT_PASSIVE);
5330 if (!p_ptr->levitation)
5331 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5332 if (!(p_ptr->resist_sound || p_ptr->levitation))
5334 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5335 (void)set_stun(p_ptr->stun + plus_stun);
5338 if (p_ptr->levitation)
5340 dam = (dam * 2) / 3;
5343 if (!p_ptr->levitation || one_in_(13))
5345 inven_damage(set_cold_destroy, 2);
5348 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5352 /* Standard damage */
5353 case GF_DISINTEGRATE:
5355 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5357 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5363 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5365 (void)hp_player(dam);
5372 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5373 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5380 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5381 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5387 if (p_ptr->free_act) break;
5388 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5390 if (ironman_nightmare)
5392 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5393 /* Have some nightmares */
5394 sanity_blast(NULL, FALSE);
5397 set_paralyzed(p_ptr->paralyzed + dam);
5407 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5408 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5415 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5416 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5423 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5425 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5426 if (!p_ptr->resist_shard || one_in_(13))
5428 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5429 inven_damage(set_cold_destroy, 2);
5435 /* Ice -- cold plus stun plus cuts */
5438 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5439 get_damage = cold_dam(dam, killer, monspell, FALSE);
5440 if (!CHECK_MULTISHADOW())
5442 if (!p_ptr->resist_shard)
5444 (void)set_cut(p_ptr->cut + damroll(5, 8));
5446 if (!p_ptr->resist_sound)
5448 (void)set_stun(p_ptr->stun + randint1(15));
5451 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5453 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5463 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5465 if (p_ptr->mimic_form)
5467 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5468 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5473 switch (p_ptr->prace)
5475 /* Some races are immune */
5489 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5501 if (CHECK_MULTISHADOW())
5503 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5505 else if (p_ptr->csp)
5509 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5511 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5514 if (dam >= p_ptr->csp)
5518 p_ptr->csp_frac = 0;
5527 learn_spell(monspell);
5528 p_ptr->redraw |= (PR_MANA);
5529 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5533 /* Heal the monster */
5534 if (m_ptr->hp < m_ptr->maxhp)
5538 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5540 /* Redraw (later) if needed */
5541 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5542 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5544 /* Special message */
5547 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5560 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5562 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5563 learn_spell(monspell);
5567 if (!CHECK_MULTISHADOW())
5569 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5571 if (!p_ptr->resist_conf)
5573 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5576 if (!p_ptr->resist_chaos && one_in_(3))
5578 (void)set_image(p_ptr->image + randint0(250) + 150);
5585 p_ptr->csp_frac = 0;
5587 p_ptr->redraw |= PR_MANA;
5590 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5596 case GF_BRAIN_SMASH:
5598 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5600 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5601 learn_spell(monspell);
5605 if (!CHECK_MULTISHADOW())
5607 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5613 p_ptr->csp_frac = 0;
5615 p_ptr->redraw |= PR_MANA;
5618 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5619 if (!CHECK_MULTISHADOW())
5621 if (!p_ptr->resist_blind)
5623 (void)set_blind(p_ptr->blind + 8 + randint0(8));
5625 if (!p_ptr->resist_conf)
5627 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5629 if (!p_ptr->free_act)
5631 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
5633 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5635 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5636 (void)do_dec_stat(A_INT);
5637 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5638 (void)do_dec_stat(A_WIS);
5640 if (!p_ptr->resist_chaos)
5642 (void)set_image(p_ptr->image + randint0(250) + 150);
5652 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5654 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5655 learn_spell(monspell);
5659 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
5660 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5668 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5670 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5671 learn_spell(monspell);
5675 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
5676 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5684 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5686 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5687 learn_spell(monspell);
5691 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5692 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5700 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5702 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5703 learn_spell(monspell);
5707 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5708 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5716 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5718 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5719 learn_spell(monspell);
5723 if (!CHECK_MULTISHADOW())
5725 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5726 curse_equipment(40, 20);
5729 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5731 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
5746 /* Hex - revenge damage stored */
5747 revenge_store(get_damage);
5749 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5750 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5752 GAME_TEXT m_name_self[80];
5755 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5757 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5758 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5759 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5762 if (p_ptr->riding && dam > 0)
5764 rakubadam_p = (dam > 200) ? 200 : dam;
5768 disturb(TRUE, TRUE);
5771 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5773 (void)kawarimi(FALSE);
5776 /* Return "Anything seen?" */
5782 * Find the distance from (x, y) to a line.
5784 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5786 /* Vector from (x, y) to (x1, y1) */
5787 POSITION py = y1 - y;
5788 POSITION px = x1 - x;
5791 POSITION ny = x2 - x1;
5792 POSITION nx = y1 - y2;
5795 POSITION pd = distance(y1, x1, y, x);
5796 POSITION nd = distance(y1, x1, y2, x2);
5798 if (pd > nd) return distance(y, x, y2, x2);
5800 /* Component of P on N */
5801 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5803 /* Absolute value */
5804 return((nd >= 0) ? nd : 0 - nd);
5811 * Modified version of los() for calculation of disintegration balls.
5812 * Disintegration effects are stopped by permanent walls.
5814 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5816 POSITION dx, dy; /* Delta */
5817 POSITION ax, ay; /* Absolute */
5818 POSITION sx, sy; /* Signs */
5819 POSITION qx, qy; /* Fractions */
5820 POSITION tx, ty; /* Scanners */
5821 POSITION f1, f2; /* Scale factors */
5822 POSITION m; /* Slope, or 1/Slope, of LOS */
5824 /* Extract the offset */
5828 /* Extract the absolute offset */
5832 /* Handle adjacent (or identical) grids */
5833 if ((ax < 2) && (ay < 2)) return (TRUE);
5835 /* Paranoia -- require "safe" origin */
5836 /* if (!in_bounds(y1, x1)) return (FALSE); */
5838 /* Directly South/North */
5841 /* South -- check for walls */
5844 for (ty = y1 + 1; ty < y2; ty++)
5846 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5850 /* North -- check for walls */
5853 for (ty = y1 - 1; ty > y2; ty--)
5855 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5863 /* Directly East/West */
5866 /* East -- check for walls */
5869 for (tx = x1 + 1; tx < x2; tx++)
5871 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5875 /* West -- check for walls */
5878 for (tx = x1 - 1; tx > x2; tx--)
5880 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5888 /* Extract some signs */
5889 sx = (dx < 0) ? -1 : 1;
5890 sy = (dy < 0) ? -1 : 1;
5892 /* Vertical "knights" */
5897 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5901 /* Horizontal "knights" */
5906 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5910 /* Calculate scale factor div 2 */
5913 /* Calculate scale factor */
5917 /* Travel horizontally */
5920 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5926 /* Consider the special case where slope == 1. */
5937 /* Note (below) the case (qy == f2), where */
5938 /* the LOS exactly meets the corner of a tile. */
5941 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5952 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5965 /* Travel vertically */
5968 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5984 /* Note (below) the case (qx == f2), where */
5985 /* the LOS exactly meets the corner of a tile. */
5988 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5999 if (cave_stop_disintegration(ty, tx)) return (FALSE);
6020 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)
6025 int brev = rad * rad / dist;
6029 int mdis = distance(y1, x1, y2, x2) + rad;
6031 while (bdis <= mdis)
6035 if ((0 < dist) && (path_n < dist))
6037 POSITION ny = GRID_Y(path_g[path_n]);
6038 POSITION nx = GRID_X(path_g[path_n]);
6039 POSITION nd = distance(ny, nx, y1, x1);
6041 /* Get next base point */
6050 /* Travel from center outward */
6051 for (cdis = 0; cdis <= brad; cdis++)
6053 /* Scan the maximal blast area of radius "cdis" */
6054 for (y = by - cdis; y <= by + cdis; y++)
6056 for (x = bx - cdis; x <= bx + cdis; x++)
6058 /* Ignore "illegal" locations */
6059 if (!in_bounds(y, x)) continue;
6061 /* Enforce a circular "ripple" */
6062 if (distance(y1, x1, y, x) != bdis) continue;
6064 /* Enforce an arc */
6065 if (distance(by, bx, y, x) != cdis) continue;
6071 /* Lights are stopped by opaque terrains */
6072 if (!los(by, bx, y, x)) continue;
6074 case GF_DISINTEGRATE:
6075 /* Disintegration are stopped only by perma-walls */
6076 if (!in_disintegration_range(by, bx, y, x)) continue;
6079 /* Ball explosions are stopped by walls */
6080 if (!projectable(by, bx, y, x)) continue;
6084 /* Save this grid */
6092 /* Encode some more "radius" info */
6093 gm[bdis + 1] = *pgrids;
6095 /* Increase the size */
6096 brad = rad * (path_n + brev) / (dist + brev);
6098 /* Find the next ripple */
6102 /* Store the effect size */
6108 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6109 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6110 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6111 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6112 * @param x 目標X座標 / Target x location (or location to travel "towards")
6113 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6114 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6115 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6116 * @param monspell 効果元のモンスター魔法ID
6117 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6120 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6121 * towards a given location (optionally passing over the heads of interposing
6122 * monsters), and have it do a given amount of damage to the monsters (and
6123 * optionally objects) within the given radius of the final location.
6125 * A "bolt" travels from source to target and affects only the target grid.
6126 * A "beam" travels from source to target, affecting all grids passed through.
6127 * A "ball" travels from source to the target, exploding at the target, and
6128 * affecting everything within the given radius of the target location.
6130 * Traditionally, a "bolt" does not affect anything on the ground, and does
6131 * not pass over the heads of interposing monsters, much like a traditional
6132 * missile, and will "stop" abruptly at the "target" even if no monster is
6133 * positioned there, while a "ball", on the other hand, passes over the heads
6134 * of monsters between the source and target, and affects everything except
6135 * the source monster which lies within the final radius, while a "beam"
6136 * affects every monster between the source and target, except for the casting
6137 * monster (or player), and rarely affects things on the ground.
6139 * Two special flags allow us to use this function in special ways, the
6140 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6141 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6142 * actually projecting from the source monster (or player).
6144 * The player will only get "experience" for monsters killed by himself
6145 * Unique monsters can only be destroyed by attacks from the player
6147 * Only 256 grids can be affected per projection, limiting the effective
6148 * "radius" of standard ball attacks to nine units (diameter nineteen).
6150 * One can project in a given "direction" by combining PROJECT_THRU with small
6151 * offsets to the initial location (see "line_spell()"), or by calculating
6152 * "virtual targets" far away from the player.
6154 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6155 * continuing until it actually hits somethings (useful for "stone to mud").
6157 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6159 * Balls must explode BEFORE hitting walls, or they would affect monsters
6160 * on both sides of a wall. Some bug reports indicate that this is still
6161 * happening in 2.7.8 for Windows, though it appears to be impossible.
6163 * We "pre-calculate" the blast area only in part for efficiency.
6164 * More importantly, this lets us do "explosions" from the "inside" out.
6165 * This results in a more logical distribution of "blast" treasure.
6166 * It also produces a better (in my opinion) animation of the explosion.
6167 * It could be (but is not) used to have the treasure dropped by monsters
6168 * in the middle of the explosion fall "outwards", and then be damaged by
6169 * the blast as it spreads outwards towards the treasure drop location.
6171 * Walls and doors are included in the blast area, so that they can be
6172 * "burned" or "melted" in later versions.
6174 * This algorithm is intended to maximize simplicity, not necessarily
6175 * efficiency, since this function is not a bottleneck in the code.
6177 * We apply the blast effect from ground zero outwards, in several passes,
6178 * first affecting features, then objects, then monsters, then the player.
6179 * This allows walls to be removed before checking the object or monster
6180 * in the wall, and protects objects which are dropped by monsters killed
6181 * in the blast, and allows the player to see all affects before he is
6182 * killed or teleported away. The semantics of this method are open to
6183 * various interpretations, but they seem to work well in practice.
6185 * We process the blast area from ground-zero outwards to allow for better
6186 * distribution of treasure dropped by monsters, and because it provides a
6187 * pleasing visual effect at low cost.
6189 * Note that the damage done by "ball" explosions decreases with distance.
6190 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6192 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6193 * the target, and then the damage "flows" along this beam of destruction.
6194 * The damage at every grid is the same as at the "center" of a "ball"
6195 * explosion, since the "beam" grids are treated as if they ARE at the
6196 * center of a "ball" explosion.
6198 * Currently, specifying "beam" plus "ball" means that locations which are
6199 * covered by the initial "beam", and also covered by the final "ball", except
6200 * for the final grid (the epicenter of the ball), will be "hit twice", once
6201 * by the initial beam, and once by the exploding ball. For the grid right
6202 * next to the epicenter, this results in 150% damage being done. The center
6203 * does not have this problem, for the same reason the final grid in a "beam"
6204 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6205 * grids which are covered by the "ball" will NOT work, as then they will
6206 * receive LESS damage than they should. Do not combine "beam" with "ball".
6208 * The array "gy[],gx[]" with current size "grids" is used to hold the
6209 * collected locations of all grids in the "blast area" plus "beam path".
6211 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6212 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6213 * first blast grid (see above) with radius "N" from the blast center. Note
6214 * that only the first gm[1] grids in the blast area thus take full damage.
6215 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6216 * number of blast grids.
6218 * Note that once the projection is complete, (y2,x2) holds the final location
6219 * of bolts/beams, and the "epicenter" of balls.
6221 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6222 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6223 * implementation of the "distance" function. Also, a bolt can be properly
6224 * viewed as a "ball" with a "rad" of "zero".
6226 * Note that if no "target" is reached before the beam/bolt/ball travels the
6227 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6228 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6230 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6231 * to move from point A to point B, even if the player cannot see part of the
6232 * projection path. Note that in general, the player will *always* see part
6233 * of the path, since it either starts at the player or ends on the player.
6235 * Hack -- we assume that every "projection" is "self-illuminating".
6237 * Hack -- when only a single monster is affected, we automatically track
6238 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6240 * Note that all projections now "explode" at their final destination, even
6241 * if they were being projected at a more distant destination. This means
6242 * that "ball" spells will *always* explode.
6244 * Note that we must call "handle_stuff()" after affecting terrain features
6245 * in the blast radius, in case the "illumination" of the grid was changed,
6246 * and "update_view()" and "update_monsters()" need to be called.
6249 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6259 POSITION y_saver, x_saver; /* For reflecting monsters */
6261 int msec = delay_factor * delay_factor * delay_factor;
6263 /* Assume the player sees nothing */
6264 bool notice = FALSE;
6266 /* Assume the player has seen nothing */
6267 bool visual = FALSE;
6269 /* Assume the player has seen no blast grids */
6272 /* Assume to be a normal ball spell */
6273 bool breath = FALSE;
6275 /* Is the player blind? */
6276 bool blind = (p_ptr->blind ? TRUE : FALSE);
6278 bool old_hide = FALSE;
6280 /* Number of grids in the "path" */
6283 /* Actual grids in the "path" */
6286 /* Number of grids in the "blast area" (including the "beam" path) */
6289 /* Coordinates of the affected grids */
6290 POSITION gx[1024], gy[1024];
6292 /* Encoded "radius" info (see above) */
6295 /* Actual radius encoded in gm[] */
6296 POSITION gm_rad = rad;
6300 /* Attacker's name (prepared before polymorph)*/
6301 GAME_TEXT who_name[MAX_NLEN];
6303 /* Can the player see the source of this effect? */
6304 bool see_s_msg = TRUE;
6306 /* Initialize by null string */
6312 /* Default target of monsterspell is player */
6313 monster_target_y = p_ptr->y;
6314 monster_target_x = p_ptr->x;
6316 /* Hack -- Jump to target */
6317 if (flg & (PROJECT_JUMP))
6322 /* Clear the flag */
6323 flg &= ~(PROJECT_JUMP);
6328 /* Start at player */
6335 /* Start at monster */
6338 x1 = m_list[who].fx;
6339 y1 = m_list[who].fy;
6340 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6352 /* Default "destination" */
6357 /* Hack -- verify stuff */
6358 if (flg & (PROJECT_THRU))
6360 if ((x1 == x2) && (y1 == y2))
6362 flg &= ~(PROJECT_THRU);
6366 /* Handle a breath attack */
6371 if (flg & PROJECT_HIDE) old_hide = TRUE;
6372 flg |= PROJECT_HIDE;
6376 /* Hack -- Assume there will be no blast (max radius 32) */
6377 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6385 /* Collect beam grids */
6386 if (flg & (PROJECT_BEAM))
6397 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6399 case GF_DISINTEGRATE:
6400 flg |= (PROJECT_GRID);
6401 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6405 /* Calculate the projection path */
6407 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6410 /* Giga-Hack SEEKER & SUPER_RAY */
6412 if( typ == GF_SEEKER )
6422 for (i = 0; i < path_n; ++i)
6427 int ny = GRID_Y(path_g[i]);
6428 int nx = GRID_X(path_g[i]);
6439 /* Only do visuals if requested */
6440 if (!blind && !(flg & (PROJECT_HIDE)))
6442 /* Only do visuals if the player can "see" the bolt */
6443 if (panel_contains(y, x) && player_has_los_bold(y, x))
6450 /* Obtain the bolt pict */
6451 p = bolt_pict(oy, ox, y, x, typ);
6453 /* Extract attr/char */
6457 /* Visual effects */
6458 print_rel(c, a, y, x);
6459 move_cursor_relative(y, x);
6460 /*if (fresh_before)*/ Term_fresh();
6461 Term_xtra(TERM_XTRA_DELAY, msec);
6463 /*if (fresh_before)*/ Term_fresh();
6465 /* Display "beam" grids */
6466 if (flg & (PROJECT_BEAM))
6468 /* Obtain the explosion pict */
6469 p = bolt_pict(y, x, y, x, typ);
6471 /* Extract attr/char */
6475 /* Visual effects */
6476 print_rel(c, a, y, x);
6479 /* Hack -- Activate delay */
6483 /* Hack -- delay anyway for consistency */
6486 /* Delay for consistency */
6487 Term_xtra(TERM_XTRA_DELAY, msec);
6490 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6491 if (is_mirror_grid(&cave[y][x]))
6493 /* The target of monsterspell becomes tha mirror(broken) */
6494 monster_target_y = y;
6495 monster_target_x = x;
6497 remove_mirror(y, x);
6498 next_mirror(&oy, &ox, y, x);
6500 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6501 for (j = last_i; j <= i; j++)
6503 y = GRID_Y(path_g[j]);
6504 x = GRID_X(path_g[j]);
6505 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6506 if (!who && (project_m_n == 1) && !jump) {
6507 if (cave[project_m_y][project_m_x].m_idx > 0) {
6508 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6512 /* Hack -- auto-recall */
6513 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6515 /* Hack - auto-track */
6516 health_track(cave[project_m_y][project_m_x].m_idx);
6520 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6525 for(i = last_i ; i < path_n ; i++)
6528 py = GRID_Y(path_g[i]);
6529 px = GRID_X(path_g[i]);
6530 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6532 if (!who && (project_m_n == 1) && !jump) {
6533 if (cave[project_m_y][project_m_x].m_idx > 0)
6535 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6539 /* Hack -- auto-recall */
6540 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6542 /* Hack - auto-track */
6543 health_track(cave[project_m_y][project_m_x].m_idx);
6547 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6551 else if(typ == GF_SUPER_RAY){
6553 int second_step = 0;
6560 for (i = 0; i < path_n; ++i)
6565 POSITION ny = GRID_Y(path_g[i]);
6566 POSITION nx = GRID_X(path_g[i]);
6577 /* Only do visuals if requested */
6578 if (!blind && !(flg & (PROJECT_HIDE)))
6580 /* Only do visuals if the player can "see" the bolt */
6581 if (panel_contains(y, x) && player_has_los_bold(y, x))
6588 /* Obtain the bolt pict */
6589 p = bolt_pict(oy, ox, y, x, typ);
6591 /* Extract attr/char */
6595 /* Visual effects */
6596 print_rel(c, a, y, x);
6597 move_cursor_relative(y, x);
6598 /*if (fresh_before)*/ Term_fresh();
6599 Term_xtra(TERM_XTRA_DELAY, msec);
6601 /*if (fresh_before)*/ Term_fresh();
6603 /* Display "beam" grids */
6604 if (flg & (PROJECT_BEAM))
6606 /* Obtain the explosion pict */
6607 p = bolt_pict(y, x, y, x, typ);
6609 /* Extract attr/char */
6613 /* Visual effects */
6614 print_rel(c, a, y, x);
6617 /* Hack -- Activate delay */
6621 /* Hack -- delay anyway for consistency */
6624 /* Delay for consistency */
6625 Term_xtra(TERM_XTRA_DELAY, msec);
6628 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
6629 if (!cave_have_flag_bold(y, x, FF_PROJECT))
6631 if( second_step )continue;
6634 if( is_mirror_grid(&cave[y][x]) && !second_step )
6636 /* The target of monsterspell becomes tha mirror(broken) */
6637 monster_target_y=(s16b)y;
6638 monster_target_x=(s16b)x;
6641 for( j = 0; j <=i ; j++ )
6643 y = GRID_Y(path_g[j]);
6644 x = GRID_X(path_g[j]);
6645 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
6649 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
6650 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
6651 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
6652 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
6653 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
6654 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
6655 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
6656 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
6659 for( i = 0; i < path_n ; i++ )
6662 py = GRID_Y(path_g[i]);
6663 px = GRID_X(path_g[i]);
6664 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
6665 if(!who && (project_m_n == 1) && !jump){
6666 if(cave[project_m_y][project_m_x].m_idx >0 ){
6667 monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
6671 /* Hack -- auto-recall */
6672 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6674 /* Hack - auto-track */
6675 health_track(cave[project_m_y][project_m_x].m_idx);
6679 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
6684 /* Project along the path */
6685 for (i = 0; i < path_n; ++i)
6690 POSITION ny = GRID_Y(path_g[i]);
6691 POSITION nx = GRID_X(path_g[i]);
6693 if (flg & PROJECT_DISI)
6695 /* Hack -- Balls explode before reaching walls */
6696 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
6698 else if (flg & PROJECT_LOS)
6700 /* Hack -- Balls explode before reaching walls */
6701 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6705 /* Hack -- Balls explode before reaching walls */
6706 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6713 /* Collect beam grids */
6714 if (flg & (PROJECT_BEAM))
6721 /* Only do visuals if requested */
6722 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6724 /* Only do visuals if the player can "see" the bolt */
6725 if (panel_contains(y, x) && player_has_los_bold(y, x))
6732 /* Obtain the bolt pict */
6733 p = bolt_pict(oy, ox, y, x, typ);
6735 /* Extract attr/char */
6739 /* Visual effects */
6740 print_rel(c, a, y, x);
6741 move_cursor_relative(y, x);
6742 /*if (fresh_before)*/ Term_fresh();
6743 Term_xtra(TERM_XTRA_DELAY, msec);
6745 /*if (fresh_before)*/ Term_fresh();
6747 /* Display "beam" grids */
6748 if (flg & (PROJECT_BEAM))
6750 /* Obtain the explosion pict */
6751 p = bolt_pict(y, x, y, x, typ);
6753 /* Extract attr/char */
6757 /* Visual effects */
6758 print_rel(c, a, y, x);
6761 /* Hack -- Activate delay */
6765 /* Hack -- delay anyway for consistency */
6768 /* Delay for consistency */
6769 Term_xtra(TERM_XTRA_DELAY, msec);
6776 /* Save the "blast epicenter" */
6780 if (breath && !path_n)
6786 flg &= ~(PROJECT_HIDE);
6790 /* Start the "explosion" */
6793 /* Hack -- make sure beams get to "explode" */
6801 /* If we found a "target", explode there */
6802 if (dist <= MAX_RANGE)
6804 /* Mega-Hack -- remove the final "beam" grid */
6805 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6808 * Create a conical breath attack
6819 flg &= ~(PROJECT_HIDE);
6821 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6825 /* Determine the blast area, work from the inside out */
6826 for (dist = 0; dist <= rad; dist++)
6828 /* Scan the maximal blast area of radius "dist" */
6829 for (y = by - dist; y <= by + dist; y++)
6831 for (x = bx - dist; x <= bx + dist; x++)
6833 /* Ignore "illegal" locations */
6834 if (!in_bounds2(y, x)) continue;
6836 /* Enforce a "circular" explosion */
6837 if (distance(by, bx, y, x) != dist) continue;
6843 /* Lights are stopped by opaque terrains */
6844 if (!los(by, bx, y, x)) continue;
6846 case GF_DISINTEGRATE:
6847 /* Disintegration are stopped only by perma-walls */
6848 if (!in_disintegration_range(by, bx, y, x)) continue;
6851 /* Ball explosions are stopped by walls */
6852 if (!projectable(by, bx, y, x)) continue;
6856 /* Save this grid */
6863 /* Encode some more "radius" info */
6869 /* Speed -- ignore "non-explosions" */
6870 if (!grids) return (FALSE);
6873 /* Display the "blast area" if requested */
6874 if (!blind && !(flg & (PROJECT_HIDE)))
6876 /* Then do the "blast", from inside out */
6877 for (t = 0; t <= gm_rad; t++)
6879 /* Dump everything with this radius */
6880 for (i = gm[t]; i < gm[t+1]; i++)
6882 /* Extract the location */
6886 /* Only do visuals if the player can "see" the blast */
6887 if (panel_contains(y, x) && player_has_los_bold(y, x))
6896 /* Obtain the explosion pict */
6897 p = bolt_pict(y, x, y, x, typ);
6899 /* Extract attr/char */
6903 /* Visual effects -- Display */
6904 print_rel(c, a, y, x);
6908 /* Hack -- center the cursor */
6909 move_cursor_relative(by, bx);
6911 /* Flush each "radius" seperately */
6912 /*if (fresh_before)*/ Term_fresh();
6914 /* Delay (efficiently) */
6915 if (visual || drawn)
6917 Term_xtra(TERM_XTRA_DELAY, msec);
6921 /* Flush the erasing */
6924 /* Erase the explosion drawn above */
6925 for (i = 0; i < grids; i++)
6927 /* Extract the location */
6931 /* Hack -- Erase if needed */
6932 if (panel_contains(y, x) && player_has_los_bold(y, x))
6938 /* Hack -- center the cursor */
6939 move_cursor_relative(by, bx);
6941 /* Flush the explosion */
6942 /*if (fresh_before)*/ Term_fresh();
6946 update_creature(p_ptr);
6948 if (flg & PROJECT_KILL)
6950 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
6951 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6955 /* Check features */
6956 if (flg & (PROJECT_GRID))
6958 /* Start with "dist" of zero */
6961 /* Scan for features */
6962 for (i = 0; i < grids; i++)
6964 /* Hack -- Notice new "dist" values */
6965 if (gm[dist+1] == i) dist++;
6967 /* Get the grid location */
6971 /* Find the closest point in the blast */
6974 int d = dist_to_line(y, x, y1, x1, by, bx);
6976 /* Affect the grid */
6977 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6981 /* Affect the grid */
6982 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6987 update_creature(p_ptr);
6990 if (flg & (PROJECT_ITEM))
6992 /* Start with "dist" of zero */
6995 /* Scan for objects */
6996 for (i = 0; i < grids; i++)
6998 /* Hack -- Notice new "dist" values */
6999 if (gm[dist+1] == i) dist++;
7001 /* Get the grid location */
7005 /* Find the closest point in the blast */
7008 int d = dist_to_line(y, x, y1, x1, by, bx);
7010 /* Affect the object in the grid */
7011 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
7015 /* Affect the object in the grid */
7016 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
7022 /* Check monsters */
7023 if (flg & (PROJECT_KILL))
7030 /* Start with "dist" of zero */
7033 /* Scan for monsters */
7034 for (i = 0; i < grids; i++)
7038 /* Hack -- Notice new "dist" values */
7039 if (gm[dist + 1] == i) dist++;
7041 /* Get the grid location */
7045 /* A single bolt may be reflected */
7048 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7049 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7051 if ((flg & PROJECT_REFLECTABLE) && cave[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7052 ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7053 (!who || dist_hack > 1) && !one_in_(10))
7056 int max_attempts = 10;
7058 /* Choose 'new' target */
7061 t_y = y_saver - 1 + randint1(3);
7062 t_x = x_saver - 1 + randint1(3);
7065 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7067 if (max_attempts < 1)
7073 sound(SOUND_REFLECT);
7076 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7077 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7078 else if (m_ptr->r_idx == MON_DIO)
7079 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7081 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7083 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7085 /* Reflected bolts randomly target either one */
7086 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7087 else flg |= PROJECT_PLAYER;
7089 /* The bolt is reflected */
7090 project(cave[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7092 /* Don't affect the monster any longer */
7098 /* Find the closest point in the blast */
7101 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7105 effective_dist = dist;
7109 /* There is the riding player on this monster */
7110 if (p_ptr->riding && player_bold(y, x))
7112 /* Aimed on the player */
7113 if (flg & PROJECT_PLAYER)
7115 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7118 * A beam or bolt is well aimed
7120 * So don't affects the mount.
7127 * The spell is not well aimed,
7128 * So partly affect the mount too.
7135 * This grid is the original target.
7136 * Or aimed on your horse.
7138 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7140 /* Hit the mount with full damage */
7144 * Otherwise this grid is not the
7145 * original target, it means that line
7146 * of fire is obstructed by this
7150 * A beam or bolt will hit either
7151 * player or mount. Choose randomly.
7153 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7157 /* Hit the mount with full damage */
7161 /* Hit the player later */
7162 flg |= PROJECT_PLAYER;
7164 /* Don't affect the mount */
7170 * The spell is not well aimed, so
7171 * partly affect both player and
7180 /* Affect the monster in the grid */
7181 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7185 /* Player affected one monster (without "jumping") */
7186 if (!who && (project_m_n == 1) && !jump)
7191 /* Track if possible */
7192 if (cave[y][x].m_idx > 0)
7194 monster_type *m_ptr = &m_list[cave[y][x].m_idx];
7198 /* Hack -- auto-recall */
7199 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7201 /* Hack - auto-track */
7202 if (m_ptr->ml) health_track(cave[y][x].m_idx);
7210 if (flg & (PROJECT_KILL))
7212 /* Start with "dist" of zero */
7215 /* Scan for player */
7216 for (i = 0; i < grids; i++)
7220 /* Hack -- Notice new "dist" values */
7221 if (gm[dist+1] == i) dist++;
7223 /* Get the grid location */
7227 /* Affect the player? */
7228 if (!player_bold(y, x)) continue;
7230 /* Find the closest point in the blast */
7233 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7237 effective_dist = dist;
7240 /* Target may be your horse */
7243 /* Aimed on the player */
7244 if (flg & PROJECT_PLAYER)
7246 /* Hit the player with full damage */
7250 * Hack -- When this grid was not the
7251 * original target, a beam or bolt
7252 * would hit either player or mount,
7253 * and should be choosen randomly.
7255 * But already choosen to hit the
7256 * mount at this point.
7258 * Or aimed on your horse.
7260 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7263 * A beam or bolt is well aimed
7265 * So don't affects the player.
7272 * The spell is not well aimed,
7273 * So partly affect the player too.
7279 /* Affect the player */
7280 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7286 GAME_TEXT m_name[MAX_NLEN];
7288 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7290 if (rakubadam_m > 0)
7292 if (rakuba(rakubadam_m, FALSE))
7294 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7297 if (p_ptr->riding && rakubadam_p > 0)
7299 if(rakuba(rakubadam_p, FALSE))
7301 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7306 /* Return "something was noticed" */
7311 * @brief 鏡魔法「封魔結界」の効果処理
7313 * @return 効果があったらTRUEを返す
7315 bool binding_field(HIT_POINT dam)
7317 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7318 int mirror_num = 0; /* 鏡の数 */
7320 POSITION centersign;
7321 POSITION x1, x2, y1, y2;
7323 int msec = delay_factor*delay_factor*delay_factor;
7326 POSITION point_x[3];
7327 POSITION point_y[3];
7329 /* Default target of monsterspell is player */
7330 monster_target_y = p_ptr->y;
7331 monster_target_x = p_ptr->x;
7333 for (x = 0; x < cur_wid; x++)
7335 for (y = 0; y < cur_hgt; y++)
7337 if (is_mirror_grid(&cave[y][x]) &&
7338 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7339 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7340 player_has_los_bold(y, x) &&
7341 projectable(p_ptr->y, p_ptr->x, y, x)
7343 mirror_y[mirror_num] = y;
7344 mirror_x[mirror_num] = x;
7350 if (mirror_num < 2)return FALSE;
7352 point_x[0] = randint0(mirror_num);
7354 point_x[1] = randint0(mirror_num);
7355 } while (point_x[0] == point_x[1]);
7357 point_y[0] = mirror_y[point_x[0]];
7358 point_x[0] = mirror_x[point_x[0]];
7359 point_y[1] = mirror_y[point_x[1]];
7360 point_x[1] = mirror_x[point_x[1]];
7361 point_y[2] = p_ptr->y;
7362 point_x[2] = p_ptr->x;
7364 x = point_x[0] + point_x[1] + point_x[2];
7365 y = point_y[0] + point_y[1] + point_y[2];
7367 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7368 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7369 if (centersign == 0)return FALSE;
7371 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7372 x1 = x1 < point_x[2] ? x1 : point_x[2];
7373 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7374 y1 = y1 < point_y[2] ? y1 : point_y[2];
7376 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7377 x2 = x2 > point_x[2] ? x2 : point_x[2];
7378 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7379 y2 = y2 > point_y[2] ? y2 : point_y[2];
7381 for (y = y1; y <= y2; y++) {
7382 for (x = x1; x <= x2; x++) {
7383 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7384 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7385 centersign*((point_x[1] - x)*(point_y[2] - y)
7386 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7387 centersign*((point_x[2] - x)*(point_y[0] - y)
7388 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7390 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7391 /* Visual effects */
7393 && panel_contains(y, x)) {
7394 p = bolt_pict(y, x, y, x, GF_MANA);
7395 print_rel(PICT_C(p), PICT_A(p), y, x);
7396 move_cursor_relative(y, x);
7397 /*if (fresh_before)*/ Term_fresh();
7398 Term_xtra(TERM_XTRA_DELAY, msec);
7404 for (y = y1; y <= y2; y++) {
7405 for (x = x1; x <= x2; x++) {
7406 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7407 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7408 centersign*((point_x[1] - x)*(point_y[2] - y)
7409 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7410 centersign*((point_x[2] - x)*(point_y[0] - y)
7411 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7413 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7414 (void)project_f(0, 0, y, x, dam, GF_MANA);
7419 for (y = y1; y <= y2; y++) {
7420 for (x = x1; x <= x2; x++) {
7421 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7422 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7423 centersign*((point_x[1] - x)*(point_y[2] - y)
7424 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7425 centersign*((point_x[2] - x)*(point_y[0] - y)
7426 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7428 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7429 (void)project_o(0, 0, y, x, dam, GF_MANA);
7434 for (y = y1; y <= y2; y++) {
7435 for (x = x1; x <= x2; x++) {
7436 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7437 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7438 centersign*((point_x[1] - x)*(point_y[2] - y)
7439 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7440 centersign*((point_x[2] - x)*(point_y[0] - y)
7441 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7443 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7444 (void)project_m(0, 0, y, x, dam, GF_MANA,
7445 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7451 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7452 remove_mirror(point_y[0], point_x[0]);
7459 * @brief 鏡魔法「鏡の封印」の効果処理
7461 * @return 効果があったらTRUEを返す
7463 void seal_of_mirror(HIT_POINT dam)
7467 for (x = 0; x < cur_wid; x++)
7469 for (y = 0; y < cur_hgt; y++)
7471 if (is_mirror_grid(&cave[y][x]))
7473 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7474 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7476 if (!cave[y][x].m_idx)
7478 remove_mirror(y, x);
7490 * @brief 領域魔法に応じて技能の名称を返す。
7491 * @param tval 魔法書のtval
7492 * @return 領域魔法の技能名称を保管した文字列ポインタ
7494 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
7498 case TV_HISSATSU_BOOK:
7499 return _("必殺技", "art");
7501 return _("祈り", "prayer");
7503 return _("歌", "song");
7505 return _("呪文", "spell");