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"
35 #include "object-hook.h"
38 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
39 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
41 int project_length = 0; /*!< 投射の射程距離 */
46 * @brief 配置した鏡リストの次を取得する /
47 * Get another mirror. for SEEKER
48 * @param next_y 次の鏡のy座標を返す参照ポインタ
49 * @param next_x 次の鏡のx座標を返す参照ポインタ
50 * @param cury 現在の鏡のy座標
51 * @param curx 現在の鏡のx座標
53 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
55 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
56 int mirror_num = 0; /* 鏡の数 */
60 for (x = 0; x < cur_wid; x++)
62 for (y = 0; y < cur_hgt; y++)
64 if (is_mirror_grid(&grid_array[y][x])) {
65 mirror_y[mirror_num] = y;
66 mirror_x[mirror_num] = x;
73 num = randint0(mirror_num);
74 *next_y = mirror_y[num];
75 *next_x = mirror_x[num];
78 *next_y = cury + randint0(5) - 2;
79 *next_x = curx + randint0(5) - 2;
84 * @brief 万色表現用にランダムな色を選択する関数 /
85 * Get a legal "multi-hued" color for drawing "spells"
89 static TERM_COLOR mh_attr(int max)
91 switch (randint1(max))
93 case 1: return (TERM_RED);
94 case 2: return (TERM_GREEN);
95 case 3: return (TERM_BLUE);
96 case 4: return (TERM_YELLOW);
97 case 5: return (TERM_ORANGE);
98 case 6: return (TERM_VIOLET);
99 case 7: return (TERM_L_RED);
100 case 8: return (TERM_L_GREEN);
101 case 9: return (TERM_L_BLUE);
102 case 10: return (TERM_UMBER);
103 case 11: return (TERM_L_UMBER);
104 case 12: return (TERM_SLATE);
105 case 13: return (TERM_WHITE);
106 case 14: return (TERM_L_WHITE);
107 case 15: return (TERM_L_DARK);
115 * @brief 魔法属性に応じたエフェクトの色を返す /
116 * Return a color to use for the bolt/ball spells
120 static TERM_COLOR spell_color(int type)
122 /* Check if A.B.'s new graphics should be used (rr9) */
123 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
128 case GF_PSY_SPEAR: return (0x06);
129 case GF_MISSILE: return (0x0F);
130 case GF_ACID: return (0x04);
131 case GF_ELEC: return (0x02);
132 case GF_FIRE: return (0x00);
133 case GF_COLD: return (0x01);
134 case GF_POIS: return (0x03);
135 case GF_HOLY_FIRE: return (0x00);
136 case GF_HELL_FIRE: return (0x00);
137 case GF_MANA: return (0x0E);
139 case GF_SEEKER: return (0x0E);
140 case GF_SUPER_RAY: return (0x0E);
142 case GF_ARROW: return (0x0F);
143 case GF_WATER: return (0x04);
144 case GF_NETHER: return (0x07);
145 case GF_CHAOS: return (mh_attr(15));
146 case GF_DISENCHANT: return (0x05);
147 case GF_NEXUS: return (0x0C);
148 case GF_CONFUSION: return (mh_attr(4));
149 case GF_SOUND: return (0x09);
150 case GF_SHARDS: return (0x08);
151 case GF_FORCE: return (0x09);
152 case GF_INERTIAL: return (0x09);
153 case GF_GRAVITY: return (0x09);
154 case GF_TIME: return (0x09);
155 case GF_LITE_WEAK: return (0x06);
156 case GF_LITE: return (0x06);
157 case GF_DARK_WEAK: return (0x07);
158 case GF_DARK: return (0x07);
159 case GF_PLASMA: return (0x0B);
160 case GF_METEOR: return (0x00);
161 case GF_ICE: return (0x01);
162 case GF_ROCKET: return (0x0F);
163 case GF_DEATH_RAY: return (0x07);
164 case GF_NUKE: return (mh_attr(2));
165 case GF_DISINTEGRATE: return (0x05);
177 case GF_CAUSE_4: return (0x0E);
178 case GF_HAND_DOOM: return (0x07);
179 case GF_CAPTURE : return (0x0E);
180 case GF_IDENTIFY: return (0x01);
181 case GF_ATTACK: return (0x0F);
182 case GF_PHOTO : return (0x06);
185 /* Normal tiles or ASCII */
191 /* Lookup the default colors for this type */
192 concptr s = quark_str(gf_color[type]);
194 if (!s) return (TERM_WHITE);
196 /* Pick a random color */
197 c = s[randint0(strlen(s))];
199 /* Lookup this color */
200 a = my_strchr(color_char, c) - color_char;
202 /* Invalid color (note check for < 0 removed, gave a silly
203 * warning because bytes are always >= 0 -- RG) */
204 if (a > 15) return (TERM_WHITE);
210 /* Standard "color" */
216 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
217 * Find the attr/char pair to use for a spell effect
226 * It is moving (or has moved) from (x,y) to (nx,ny).
227 * If the distance is not "one", we (may) return "*".
230 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
240 if ((ny == y) && (nx == x)) base = 0x30;
243 else if (nx == x) base = 0x40;
246 else if (ny == y) base = 0x50;
249 else if ((ny - y) == (x - nx)) base = 0x60;
252 else if ((ny - y) == (nx - x)) base = 0x70;
257 /* Basic spell color */
258 k = spell_color(typ);
260 /* Obtain attr/char */
261 a = misc_to_attr[base + k];
262 c = misc_to_char[base + k];
271 * Mega-Hack -- track "affected" monsters (see "project()" comments)
273 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
274 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
275 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
276 /* Mega-Hack -- monsters target */
277 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
278 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
282 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
283 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
284 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
285 * @param y 目標Y座標 / Target y location (or location to travel "towards")
286 * @param x 目標X座標 / Target x location (or location to travel "towards")
287 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
288 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
289 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
292 * We are called both for "beam" effects and "ball" effects.
294 * The "r" parameter is the "distance from ground zero".
296 * Note that we determine if the player can "see" anything that happens
297 * by taking into account: blindness, line-of-sight, and illumination.
299 * We return "TRUE" if the effect of the projection is "obvious".
301 * We also "see" grids which are "memorized", probably a hack
303 * Perhaps we should affect doors?
306 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
308 grid_type *g_ptr = &grid_array[y][x];
309 feature_type *f_ptr = &f_info[g_ptr->feat];
311 bool obvious = FALSE;
312 bool known = player_has_los_bold(y, x);
317 /* Reduce damage by distance */
318 dam = (dam + r) / (r + 1);
321 if (have_flag(f_ptr->flags, FF_TREE))
329 message = _("枯れた", "was blasted."); break;
331 message = _("縮んだ", "shrank."); break;
333 message = _("溶けた", "melted."); break;
336 message = _("凍り、砕け散った", "was frozen and smashed."); break;
340 message = _("燃えた", "burns up!"); break;
352 message = _("粉砕された", "was crushed."); break;
354 message = NULL; break;
358 msg_format(_("木は%s。", "A tree %s"), message);
359 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
362 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
366 /* Analyze the type */
369 /* Ignore most effects */
404 /* Destroy Traps (and Locks) */
407 /* Reveal secret doors */
408 if (is_hidden_door(g_ptr))
413 /* Check line of sight */
421 if (is_trap(g_ptr->feat))
423 /* Check line of sight */
426 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
430 /* Destroy the trap */
431 cave_alter_feat(y, x, FF_DISARM);
434 /* Locked doors are unlocked */
435 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
437 s16b old_feat = g_ptr->feat;
439 /* Unlock the door */
440 cave_alter_feat(y, x, FF_DISARM);
442 /* Check line of sound */
443 if (known && (old_feat != g_ptr->feat))
445 msg_print(_("カチッと音がした!", "Click!"));
450 /* Remove "unsafe" flag if player is not blind */
451 if (!p_ptr->blind && player_has_los_bold(y, x))
453 g_ptr->info &= ~(CAVE_UNSAFE);
461 /* Destroy Doors (and traps) */
464 /* Destroy all doors and traps */
465 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
467 /* Check line of sight */
470 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
474 /* Destroy the feature */
475 cave_alter_feat(y, x, FF_TUNNEL);
478 /* Remove "unsafe" flag if player is not blind */
479 if (!p_ptr->blind && player_has_los_bold(y, x))
481 g_ptr->info &= ~(CAVE_UNSAFE);
489 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
491 if (have_flag(f_ptr->flags, FF_SPIKE))
493 s16b old_mimic = g_ptr->mimic;
494 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
496 cave_alter_feat(y, x, FF_SPIKE);
497 g_ptr->mimic = old_mimic;
502 /* Check line of sight */
503 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
505 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
512 /* Destroy walls (and doors) */
515 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
517 if (known && (g_ptr->info & (CAVE_MARK)))
519 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
523 /* Destroy the wall */
524 cave_alter_feat(y, x, FF_HURT_ROCK);
526 /* Update some things */
527 p_ptr->update |= (PU_FLOW);
535 if (!cave_naked_bold(y, x)) break;
536 if (player_bold(y, x)) break;
537 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
538 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
550 if (!cave_naked_bold(y, x)) break;
551 if (player_bold(y, x)) break;
552 cave_set_feat(y, x, feat_tree);
553 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
559 if (!cave_naked_bold(y, x)) break;
560 g_ptr->info |= CAVE_OBJECT;
561 g_ptr->mimic = feat_glyph;
569 if (!cave_naked_bold(y, x)) break;
570 if (player_bold(y, x)) break;
571 cave_set_feat(y, x, feat_granite);
577 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
580 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
581 cave_set_feat(y, x, feat_shallow_lava);
585 cave_set_feat(y, x, feat_deep_lava);
592 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
595 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
596 cave_set_feat(y, x, feat_shallow_water);
600 cave_set_feat(y, x, feat_deep_water);
605 /* Lite up the grid */
609 /* Turn on the light */
610 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
612 g_ptr->info |= (CAVE_GLOW);
615 update_local_illumination(y, x);
618 if (player_can_see_bold(y, x)) obvious = TRUE;
620 /* Mega-Hack -- Update the monster in the affected grid */
621 /* This allows "spear of light" (etc) to work "correctly" */
622 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
624 if (p_ptr->special_defense & NINJA_S_STEALTH)
626 if (player_bold(y, x)) set_superstealth(FALSE);
633 /* Darken the grid */
637 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
640 /* Turn off the light. */
643 if (dun_level || !is_daytime())
645 for (j = 0; j < 9; j++)
647 int by = y + ddy_ddd[j];
648 int bx = x + ddx_ddd[j];
650 if (in_bounds2(by, bx))
652 grid_type *cc_ptr = &grid_array[by][bx];
654 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
665 g_ptr->info &= ~(CAVE_GLOW);
667 /* Hack -- Forget "boring" grids */
668 if (!have_flag(f_ptr->flags, FF_REMEMBER))
671 g_ptr->info &= ~(CAVE_MARK);
678 update_local_illumination(y, x);
680 if (player_can_see_bold(y, x)) obvious = TRUE;
682 /* Mega-Hack -- Update the monster in the affected grid */
683 /* This allows "spear of light" (etc) to work "correctly" */
684 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
694 if (is_mirror_grid(g_ptr))
696 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
699 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
702 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
704 if (known && (g_ptr->info & CAVE_MARK))
706 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
710 /* Destroy the wall */
711 cave_alter_feat(y, x, FF_HURT_ROCK);
713 /* Update some things */
714 p_ptr->update |= (PU_FLOW);
721 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
723 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
726 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
729 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
731 if (known && (g_ptr->info & CAVE_MARK))
733 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
737 /* Destroy the wall */
738 cave_alter_feat(y, x, FF_HURT_ROCK);
740 /* Update some things */
741 p_ptr->update |= (PU_FLOW);
746 case GF_DISINTEGRATE:
748 /* Destroy mirror/glyph */
749 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
752 /* Permanent features don't get effect */
753 /* But not protect monsters and other objects */
754 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
756 cave_alter_feat(y, x, FF_HURT_DISI);
758 /* Update some things -- similar to GF_KILL_WALL */
759 p_ptr->update |= (PU_FLOW);
766 /* Return "Anything seen?" */
773 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
774 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
775 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
776 * @param y 目標Y座標 / Target y location (or location to travel "towards")
777 * @param x 目標X座標 / Target x location (or location to travel "towards")
778 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
779 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
780 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
783 * We are called from "project()" to "damage" objects
785 * We are called both for "beam" effects and "ball" effects.
787 * Perhaps we should only SOMETIMES damage things on the ground.
789 * The "r" parameter is the "distance from ground zero".
791 * Note that we determine if the player can "see" anything that happens
792 * by taking into account: blindness, line-of-sight, and illumination.
794 * We also "see" grids which are "memorized", probably a hack
796 * We return "TRUE" if the effect of the projection is "obvious".
799 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
801 grid_type *g_ptr = &grid_array[y][x];
803 OBJECT_IDX this_o_idx, next_o_idx = 0;
805 bool obvious = FALSE;
806 bool known = player_has_los_bold(y, x);
808 BIT_FLAGS flgs[TR_FLAG_SIZE];
810 GAME_TEXT o_name[MAX_NLEN];
812 KIND_OBJECT_IDX k_idx = 0;
813 bool is_potion = FALSE;
818 /* Reduce damage by distance */
819 dam = (dam + r) / (r + 1);
822 /* Scan all objects in the grid */
823 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
825 object_type *o_ptr = &o_list[this_o_idx];
829 bool do_kill = FALSE;
831 concptr note_kill = NULL;
834 /* Get the "plural"-ness */
835 bool plural = (o_ptr->number > 1);
838 /* Acquire next object */
839 next_o_idx = o_ptr->next_o_idx;
840 object_flags(o_ptr, flgs);
842 /* Check for artifact */
843 if (object_is_artifact(o_ptr)) is_art = TRUE;
845 /* Analyze the type */
848 /* Acid -- Lots of things */
851 if (hates_acid(o_ptr))
854 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
855 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
860 /* Elec -- Rings and Wands */
863 if (hates_elec(o_ptr))
866 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
867 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
872 /* Fire -- Flammable objects */
875 if (hates_fire(o_ptr))
878 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
879 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
884 /* Cold -- potions and flasks */
887 if (hates_cold(o_ptr))
889 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
891 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
899 if (hates_fire(o_ptr))
902 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
903 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
905 if (hates_elec(o_ptr))
909 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
910 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
918 if (hates_fire(o_ptr))
921 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
922 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
924 if (hates_cold(o_ptr))
928 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
929 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
934 /* Hack -- break potions and such */
940 if (hates_cold(o_ptr))
942 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
948 /* Mana and Chaos -- destroy everything */
954 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
958 case GF_DISINTEGRATE:
961 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
968 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
969 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
970 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
974 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
978 if (object_is_cursed(o_ptr))
981 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
988 identify_item(o_ptr);
990 /* Auto-inscription */
991 autopick_alter_item((-this_o_idx), FALSE);
999 /* Chests are noticed only if trapped or locked */
1000 if (o_ptr->tval == TV_CHEST)
1002 /* Disarm/Unlock traps */
1003 if (o_ptr->pval > 0)
1005 /* Disarm or Unlock */
1006 o_ptr->pval = (0 - o_ptr->pval);
1009 object_known(o_ptr);
1011 if (known && (o_ptr->marked & OM_FOUND))
1013 msg_print(_("カチッと音がした!", "Click!"));
1023 if (o_ptr->tval == TV_CORPSE)
1026 BIT_FLAGS mode = 0L;
1028 if (!who || is_pet(&m_list[who]))
1029 mode |= PM_FORCE_PET;
1031 for (i = 0; i < o_ptr->number ; i++)
1033 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1034 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1038 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1042 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1044 note_kill = _("生き返った。", " revived.");
1046 else if (!note_kill)
1048 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1059 /* Attempt to destroy the object */
1062 /* Effect "observed" */
1063 if (known && (o_ptr->marked & OM_FOUND))
1066 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1069 /* Artifacts, and other objects, get to resist */
1070 if (is_art || ignore)
1072 /* Observe the resist */
1073 if (known && (o_ptr->marked & OM_FOUND))
1075 msg_format(_("%sは影響を受けない!",
1076 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1083 /* Describe if needed */
1084 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1086 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1089 k_idx = o_ptr->k_idx;
1090 is_potion = object_is_potion(o_ptr);
1091 delete_object_idx(this_o_idx);
1093 /* Potions produce effects when 'shattered' */
1096 (void)potion_smash_effect(who, y, x, k_idx);
1104 /* Return "Anything seen?" */
1110 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1111 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1112 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1113 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1114 * @param x 目標X座標 / Target x location (or location to travel "towards")
1115 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1116 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1118 * @param see_s_msg TRUEならばメッセージを表示する
1119 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1122 * This routine takes a "source monster" (by index) which is mostly used to
1123 * determine if the player is causing the damage, and a "radius" (see below),
1124 * which is used to decrease the power of explosions with distance, and a
1125 * location, via integers which are modified by certain types of attacks
1126 * (polymorph and teleport being the obvious ones), a default damage, which
1127 * is modified as needed based on various properties, and finally a "damage
1128 * type" (see below).
1131 * Note that this routine can handle "no damage" attacks (like teleport) by
1132 * taking a "zero" damage, and can even take "parameters" to attacks (like
1133 * confuse) by accepting a "damage", using it to calculate the effect, and
1134 * then setting the damage to zero. Note that the "damage" parameter is
1135 * divided by the radius, so monsters not at the "epicenter" will not take
1136 * as much damage (or whatever)...
1139 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1140 * may result in a dereference of an invalid pointer.
1143 * Various messages are produced, and damage is applied.
1146 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1147 * actually be "made" of that substance, or "breathe" big balls of it.
1148 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1150 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1151 * and hurts evil less. If can breath nether, then it resists it as well.
1154 * Damage reductions use the following formulas:
1155 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1156 * gives avg damage of .655, ranging from .858 to .500
1157 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1158 * gives avg damage of .544, ranging from .714 to .417
1159 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1160 * gives avg damage of .444, ranging from .556 to .333
1161 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1162 * gives avg damage of .327, ranging from .427 to .250
1163 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1164 * gives something simple.
1167 * In this function, "result" messages are postponed until the end, where
1168 * the "note" string is appended to the monster name, if not NULL. So,
1169 * to make a spell have "no effect" just set "note" to NULL. You should
1170 * also set "notice" to FALSE, or the player will learn what the spell does.
1173 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1177 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)
1181 grid_type *g_ptr = &grid_array[y][x];
1183 monster_type *m_ptr = &m_list[g_ptr->m_idx];
1184 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1186 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1190 /* Is the monster "seen"? */
1191 bool seen = m_ptr->ml;
1192 bool seen_msg = is_seen(m_ptr);
1194 bool slept = (bool)MON_CSLEEP(m_ptr);
1196 /* Were the effects "obvious" (if seen)? */
1197 bool obvious = FALSE;
1199 /* Can the player know about this effect? */
1200 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1202 /* Were the effects "irrelevant"? */
1203 bool skipped = FALSE;
1205 /* Gets the monster angry at the source of the effect? */
1206 bool get_angry = FALSE;
1208 /* Polymorph setting (true or false) */
1209 bool do_poly = FALSE;
1211 /* Teleport setting (max distance) */
1214 /* Confusion setting (amount to confuse) */
1217 /* Stunning setting (amount to stun) */
1220 /* Sleep amount (amount to sleep) */
1223 /* Fear amount (amount to fear) */
1226 /* Time amount (amount to time) */
1229 bool heal_leper = FALSE;
1231 /* Hold the monster name */
1232 GAME_TEXT m_name[MAX_NLEN];
1235 PARAMETER_VALUE photo = 0;
1237 /* Assume no note */
1238 concptr note = NULL;
1240 /* Assume a default death */
1241 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1243 POSITION ty = m_ptr->fy;
1244 POSITION tx = m_ptr->fx;
1246 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1249 if (!g_ptr->m_idx) return (FALSE);
1251 /* Never affect projector */
1252 if (who && (g_ptr->m_idx == who)) return (FALSE);
1253 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1254 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1256 /* Don't affect already death monsters */
1257 /* Prevents problems with chain reactions of exploding monsters */
1258 if (m_ptr->hp < 0) return (FALSE);
1260 /* Reduce damage by distance */
1261 dam = (dam + r) / (r + 1);
1264 /* Get the monster name (BEFORE polymorphing) */
1265 monster_desc(m_name, m_ptr, 0);
1267 /* Get the monster possessive ("his"/"her"/"its") */
1268 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1270 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1272 /* Analyze the damage type */
1275 /* Magic Missile -- pure damage */
1278 if (seen) obvious = TRUE;
1280 if (r_ptr->flagsr & RFR_RES_ALL)
1282 note = _("には完全な耐性がある!", " is immune.");
1284 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1293 if (seen) obvious = TRUE;
1295 if (r_ptr->flagsr & RFR_RES_ALL)
1297 note = _("には完全な耐性がある!", " is immune.");
1299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1302 if (r_ptr->flagsr & RFR_IM_ACID)
1304 note = _("にはかなり耐性がある!", " resists a lot.");
1306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1314 if (seen) obvious = TRUE;
1316 if (r_ptr->flagsr & RFR_RES_ALL)
1318 note = _("には完全な耐性がある!", " is immune.");
1320 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1323 if (r_ptr->flagsr & RFR_IM_ELEC)
1325 note = _("にはかなり耐性がある!", " resists a lot.");
1327 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1335 if (seen) obvious = TRUE;
1337 if (r_ptr->flagsr & RFR_RES_ALL)
1339 note = _("には完全な耐性がある!", " is immune.");
1341 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1344 if (r_ptr->flagsr & RFR_IM_FIRE)
1346 note = _("にはかなり耐性がある!", " resists a lot.");
1348 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1350 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1352 note = _("はひどい痛手をうけた。", " is hit hard.");
1354 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1362 if (seen) obvious = TRUE;
1364 if (r_ptr->flagsr & RFR_RES_ALL)
1366 note = _("には完全な耐性がある!", " is immune.");
1368 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1371 if (r_ptr->flagsr & RFR_IM_COLD)
1373 note = _("にはかなり耐性がある!", " resists a lot.");
1375 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1377 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1379 note = _("はひどい痛手をうけた。", " is hit hard.");
1381 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1389 if (seen) obvious = TRUE;
1391 if (r_ptr->flagsr & RFR_RES_ALL)
1393 note = _("には完全な耐性がある!", " is immune.");
1395 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1398 if (r_ptr->flagsr & RFR_IM_POIS)
1400 note = _("にはかなり耐性がある!", " resists a lot.");
1402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1410 if (seen) obvious = TRUE;
1412 if (r_ptr->flagsr & RFR_RES_ALL)
1414 note = _("には完全な耐性がある!", " is immune.");
1416 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1419 if (r_ptr->flagsr & RFR_IM_POIS)
1421 note = _("には耐性がある。", " resists.");
1422 dam *= 3; dam /= randint1(6) + 6;
1423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1425 else if (one_in_(3)) do_poly = TRUE;
1429 /* Hellfire -- hurts Evil */
1432 if (seen) obvious = TRUE;
1434 if (r_ptr->flagsr & RFR_RES_ALL)
1436 note = _("には完全な耐性がある!", " is immune.");
1438 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1441 if (r_ptr->flags3 & RF3_GOOD)
1443 note = _("はひどい痛手をうけた。", " is hit hard.");
1445 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1450 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1453 if (seen) obvious = TRUE;
1455 if (r_ptr->flagsr & RFR_RES_ALL)
1457 note = _("には完全な耐性がある!", " is immune.");
1459 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1462 if (r_ptr->flags3 & RF3_GOOD)
1464 note = _("には完全な耐性がある!", " is immune.");
1466 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_GOOD;
1468 else if (r_ptr->flags3 & RF3_EVIL)
1471 note = _("はひどい痛手をうけた。", " is hit hard.");
1472 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1476 note = _("には耐性がある。", " resists.");
1477 dam *= 3; dam /= randint1(6) + 6;
1482 /* Arrow -- XXX no defense */
1485 if (seen) obvious = TRUE;
1487 if (r_ptr->flagsr & RFR_RES_ALL)
1489 note = _("には完全な耐性がある!", " is immune.");
1491 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1497 /* Plasma -- XXX perhaps check ELEC or FIRE */
1500 if (seen) obvious = TRUE;
1502 if (r_ptr->flagsr & RFR_RES_ALL)
1504 note = _("には完全な耐性がある!", " is immune.");
1506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1509 if (r_ptr->flagsr & RFR_RES_PLAS)
1511 note = _("には耐性がある。", " resists.");
1512 dam *= 3; dam /= randint1(6) + 6;
1513 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1518 /* Nether -- see above */
1521 if (seen) obvious = TRUE;
1523 if (r_ptr->flagsr & RFR_RES_ALL)
1525 note = _("には完全な耐性がある!", " is immune.");
1527 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1530 if (r_ptr->flagsr & RFR_RES_NETH)
1532 if (r_ptr->flags3 & RF3_UNDEAD)
1534 note = _("には完全な耐性がある!", " is immune.");
1536 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1540 note = _("には耐性がある。", " resists.");
1541 dam *= 3; dam /= randint1(6) + 6;
1543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1545 else if (r_ptr->flags3 & RF3_EVIL)
1547 note = _("はいくらか耐性を示した。", " resists somewhat.");
1549 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1554 /* Water (acid) damage -- Water spirits/elementals are immune */
1557 if (seen) obvious = TRUE;
1559 if (r_ptr->flagsr & RFR_RES_ALL)
1561 note = _("には完全な耐性がある!", " is immune.");
1563 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1566 if (r_ptr->flagsr & RFR_RES_WATE)
1568 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1570 note = _("には完全な耐性がある!", " is immune.");
1575 note = _("には耐性がある。", " resists.");
1576 dam *= 3; dam /= randint1(6) + 6;
1578 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1583 /* Chaos -- Chaos breathers resist */
1586 if (seen) obvious = TRUE;
1588 if (r_ptr->flagsr & RFR_RES_ALL)
1590 note = _("には完全な耐性がある!", " is immune.");
1592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1595 if (r_ptr->flagsr & RFR_RES_CHAO)
1597 note = _("には耐性がある。", " resists.");
1598 dam *= 3; dam /= randint1(6) + 6;
1599 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1601 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1603 note = _("はいくらか耐性を示した。", " resists somewhat.");
1604 dam *= 3; dam /= randint1(6) + 6;
1605 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1610 do_conf = (5 + randint1(11) + r) / (r + 1);
1615 /* Shards -- Shard breathers resist */
1618 if (seen) obvious = TRUE;
1620 if (r_ptr->flagsr & RFR_RES_ALL)
1622 note = _("には完全な耐性がある!", " is immune.");
1624 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1627 if (r_ptr->flagsr & RFR_RES_SHAR)
1629 note = _("には耐性がある。", " resists.");
1630 dam *= 3; dam /= randint1(6) + 6;
1631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1636 /* Rocket: Shard resistance helps */
1639 if (seen) obvious = TRUE;
1641 if (r_ptr->flagsr & RFR_RES_ALL)
1643 note = _("には完全な耐性がある!", " is immune.");
1645 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1648 if (r_ptr->flagsr & RFR_RES_SHAR)
1650 note = _("はいくらか耐性を示した。", " resists somewhat.");
1652 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1658 /* Sound -- Sound breathers resist */
1661 if (seen) obvious = TRUE;
1663 if (r_ptr->flagsr & RFR_RES_ALL)
1665 note = _("には完全な耐性がある!", " is immune.");
1667 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1670 if (r_ptr->flagsr & RFR_RES_SOUN)
1672 note = _("には耐性がある。", " resists.");
1673 dam *= 2; dam /= randint1(6) + 6;
1674 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1676 else do_stun = (10 + randint1(15) + r) / (r + 1);
1683 if (seen) obvious = TRUE;
1685 if (r_ptr->flagsr & RFR_RES_ALL)
1687 note = _("には完全な耐性がある!", " is immune.");
1689 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1692 if (r_ptr->flags3 & RF3_NO_CONF)
1694 note = _("には耐性がある。", " resists.");
1695 dam *= 3; dam /= randint1(6) + 6;
1696 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1698 else do_conf = (10 + randint1(15) + r) / (r + 1);
1702 /* Disenchantment -- Breathers and Disenchanters resist */
1705 if (seen) obvious = TRUE;
1707 if (r_ptr->flagsr & RFR_RES_ALL)
1709 note = _("には完全な耐性がある!", " is immune.");
1711 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1714 if (r_ptr->flagsr & RFR_RES_DISE)
1716 note = _("には耐性がある。", " resists.");
1717 dam *= 3; dam /= randint1(6) + 6;
1718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1723 /* Nexus -- Breathers and Existers resist */
1726 if (seen) obvious = TRUE;
1728 if (r_ptr->flagsr & RFR_RES_ALL)
1730 note = _("には完全な耐性がある!", " is immune.");
1732 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1735 if (r_ptr->flagsr & RFR_RES_NEXU)
1737 note = _("には耐性がある。", " resists.");
1738 dam *= 3; dam /= randint1(6) + 6;
1739 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1747 if (seen) obvious = TRUE;
1749 if (r_ptr->flagsr & RFR_RES_ALL)
1751 note = _("には完全な耐性がある!", " is immune.");
1753 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1756 if (r_ptr->flagsr & RFR_RES_WALL)
1758 note = _("には耐性がある。", " resists.");
1759 dam *= 3; dam /= randint1(6) + 6;
1760 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1762 else do_stun = (randint1(15) + r) / (r + 1);
1766 /* Inertia -- breathers resist */
1769 if (seen) obvious = TRUE;
1771 if (r_ptr->flagsr & RFR_RES_ALL)
1773 note = _("には完全な耐性がある!", " is immune.");
1775 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1778 if (r_ptr->flagsr & RFR_RES_INER)
1780 note = _("には耐性がある。", " resists.");
1781 dam *= 3; dam /= randint1(6) + 6;
1782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1786 /* Powerful monsters can resist */
1787 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1788 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1792 /* Normal monsters slow down */
1795 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1797 note = _("の動きが遅くなった。", " starts moving slower.");
1804 /* Time -- breathers resist */
1807 if (seen) obvious = TRUE;
1809 if (r_ptr->flagsr & RFR_RES_ALL)
1811 note = _("には完全な耐性がある!", " is immune.");
1813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1816 if (r_ptr->flagsr & RFR_RES_TIME)
1818 note = _("には耐性がある。", " resists.");
1819 dam *= 3; dam /= randint1(6) + 6;
1820 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1822 else do_time = (dam + 1) / 2;
1826 /* Gravity -- breathers resist */
1829 bool resist_tele = FALSE;
1831 if (seen) obvious = TRUE;
1833 if (r_ptr->flagsr & RFR_RES_ALL)
1835 note = _("には完全な耐性がある!", " is immune.");
1837 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1840 if (r_ptr->flagsr & RFR_RES_TELE)
1842 if (r_ptr->flags1 & (RF1_UNIQUE))
1844 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1845 note = _("には効果がなかった。", " is unaffected!");
1848 else if (r_ptr->level > randint1(100))
1850 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1851 note = _("には耐性がある!", " resists!");
1856 if (!resist_tele) do_dist = 10;
1858 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1860 if (r_ptr->flagsr & RFR_RES_GRAV)
1862 note = _("には耐性がある!", " resists!");
1863 dam *= 3; dam /= randint1(6) + 6;
1865 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1870 /* Powerful monsters can resist */
1871 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1872 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1876 /* Normal monsters slow down */
1879 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1881 note = _("の動きが遅くなった。", " starts moving slower.");
1886 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1888 /* Attempt a saving throw */
1889 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1890 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1894 /* No obvious effect */
1895 note = _("には効果がなかった。", " is unaffected!");
1907 if (seen) obvious = TRUE;
1909 if (r_ptr->flagsr & RFR_RES_ALL)
1911 note = _("には完全な耐性がある!", " is immune.");
1913 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1921 case GF_DISINTEGRATE:
1923 if (seen) obvious = TRUE;
1925 if (r_ptr->flagsr & RFR_RES_ALL)
1927 note = _("には完全な耐性がある!", " is immune.");
1929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1932 if (r_ptr->flags3 & RF3_HURT_ROCK)
1934 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1935 note = _("の皮膚がただれた!", " loses some skin!");
1936 note_dies = _("は蒸発した!", " evaporates!");
1944 if (seen) obvious = TRUE;
1946 /* PSI only works if the monster can see you! -- RG */
1947 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1950 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1955 if (r_ptr->flagsr & RFR_RES_ALL)
1957 note = _("には完全な耐性がある!", " is immune.");
1959 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1962 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1965 note = _("には完全な耐性がある!", " is immune.");
1966 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1969 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1970 (r_ptr->flags3 & RF3_ANIMAL) ||
1971 (r_ptr->level > randint1(3 * dam)))
1973 note = _("には耐性がある!", " resists!");
1977 * Powerful demons & undead can turn a mindcrafter's
1978 * attacks back on them
1980 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1981 (r_ptr->level > p_ptr->lev / 2) &&
1985 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1986 (seen ? "%^s's corrupted mind backlashes your attack!" :
1987 "%^ss corrupted mind backlashes your attack!")), m_name);
1990 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1992 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1996 /* Injure +/- confusion */
1997 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1998 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1999 if (one_in_(4) && !CHECK_MULTISHADOW())
2001 switch (randint1(4))
2004 set_confused(p_ptr->confused + 3 + randint1(dam));
2007 set_stun(p_ptr->stun + randint1(dam));
2011 if (r_ptr->flags3 & RF3_NO_FEAR)
2012 note = _("には効果がなかった。", " is unaffected.");
2014 set_afraid(p_ptr->afraid + 3 + randint1(dam));
2018 if (!p_ptr->free_act)
2019 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
2028 if ((dam > 0) && one_in_(4))
2030 switch (randint1(4))
2033 do_conf = 3 + randint1(dam);
2036 do_stun = 3 + randint1(dam);
2039 do_fear = 3 + randint1(dam);
2042 note = _("は眠り込んでしまった!", " falls asleep!");
2043 do_sleep = 3 + randint1(dam);
2048 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2054 if (seen) obvious = TRUE;
2056 if (r_ptr->flagsr & RFR_RES_ALL)
2058 note = _("には完全な耐性がある!", " is immune.");
2060 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2063 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2066 note = _("には完全な耐性がある!", " is immune.");
2068 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
2069 (r_ptr->flags3 & RF3_ANIMAL) ||
2070 (r_ptr->level > randint1(3 * dam)))
2072 note = _("には耐性がある!", " resists!");
2076 * Powerful demons & undead can turn a mindcrafter's
2077 * attacks back on them
2079 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2080 (r_ptr->level > p_ptr->lev / 2) &&
2084 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2085 (seen ? "%^s's corrupted mind backlashes your attack!" :
2086 "%^ss corrupted mind backlashes your attack!")), m_name);
2088 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
2090 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
2094 /* Injure + mana drain */
2095 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2096 if (!CHECK_MULTISHADOW())
2098 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
2099 p_ptr->csp -= damroll(5, dam) / 2;
2100 if (p_ptr->csp < 0) p_ptr->csp = 0;
2101 p_ptr->redraw |= PR_MANA;
2102 p_ptr->window |= (PW_SPELL);
2104 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
2111 int b = damroll(5, dam) / 4;
2112 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
2113 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
2114 (seen ? "You convert %s's pain into %s!" :
2115 "You convert %ss pain into %s!"));
2116 msg_format(msg, m_name, str);
2118 b = MIN(p_ptr->msp, p_ptr->csp + b);
2120 p_ptr->redraw |= PR_MANA;
2121 p_ptr->window |= (PW_SPELL);
2123 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2127 case GF_TELEKINESIS:
2129 if (seen) obvious = TRUE;
2131 if (r_ptr->flagsr & RFR_RES_ALL)
2133 note = _("には完全な耐性がある!", " is immune.");
2135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2140 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
2145 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
2147 /* Attempt a saving throw */
2148 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2149 (r_ptr->level > 5 + randint1(dam)))
2153 /* No obvious effect */
2159 /* Psycho-spear -- powerful magic missile */
2162 if (seen) obvious = TRUE;
2164 if (r_ptr->flagsr & RFR_RES_ALL)
2166 note = _("には完全な耐性がある!", " is immune.");
2168 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2174 /* Meteor -- powerful magic missile */
2177 if (seen) obvious = TRUE;
2179 if (r_ptr->flagsr & RFR_RES_ALL)
2181 note = _("には完全な耐性がある!", " is immune.");
2183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2191 if (!is_hostile(m_ptr)) break;
2193 if (seen) obvious = TRUE;
2195 if (r_ptr->flagsr & RFR_RES_ALL)
2197 note = _("には効果がなかった!", " is immune.");
2199 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2202 /* Attempt a saving throw */
2203 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
2204 (r_ptr->flags3 & RF3_NO_CONF) ||
2205 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2207 /* Memorize a flag */
2208 if (r_ptr->flags3 & RF3_NO_CONF)
2210 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2217 * Powerful demons & undead can turn a mindcrafter's
2218 * attacks back on them
2220 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
2221 (r_ptr->level > p_ptr->lev / 2) &&
2225 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
2226 (seen ? "%^s's corrupted mind backlashes your attack!" :
2227 "%^ss corrupted mind backlashes your attack!")), m_name);
2230 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2232 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2236 /* Confuse, stun, terrify */
2237 switch (randint1(4))
2240 set_stun(p_ptr->stun + dam / 2);
2243 set_confused(p_ptr->confused + dam / 2);
2247 if (r_ptr->flags3 & RF3_NO_FEAR)
2248 note = _("には効果がなかった。", " is unaffected.");
2250 set_afraid(p_ptr->afraid + dam);
2257 /* No obvious effect */
2258 note = _("には効果がなかった。", " is unaffected.");
2264 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2266 note = _("があなたに隷属した。", " is in your thrall!");
2271 switch (randint1(4))
2285 /* No "real" damage */
2292 /* Ice -- Cold + Cuts + Stun */
2295 if (seen) obvious = TRUE;
2297 if (r_ptr->flagsr & RFR_RES_ALL)
2299 note = _("には完全な耐性がある!", " is immune.");
2301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2304 do_stun = (randint1(15) + 1) / (r + 1);
2305 if (r_ptr->flagsr & RFR_IM_COLD)
2307 note = _("にはかなり耐性がある!", " resists a lot.");
2309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2311 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2313 note = _("はひどい痛手をうけた。", " is hit hard.");
2315 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2322 case GF_HYPODYNAMIA:
2324 if (seen) obvious = TRUE;
2326 if (r_ptr->flagsr & RFR_RES_ALL)
2328 note = _("には完全な耐性がある!", " is immune.");
2330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2333 if (!monster_living(m_ptr->r_idx))
2335 if (is_original_ap_and_seen(m_ptr))
2337 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2338 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2339 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2341 note = _("には効果がなかった。", " is unaffected.");
2345 else do_time = (dam+7)/8;
2353 if (seen) obvious = TRUE;
2355 if (r_ptr->flagsr & RFR_RES_ALL)
2357 note = _("には完全な耐性がある!", " is immune.");
2359 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2362 if (!monster_living(m_ptr->r_idx))
2364 if (is_original_ap_and_seen(m_ptr))
2366 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2367 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2368 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2370 note = _("には完全な耐性がある!", " is immune.");
2374 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2375 (randint1(888) != 666)) ||
2376 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2377 randint1(100) != 66))
2379 note = _("には耐性がある!", " resists!");
2387 /* Polymorph monster (Use "dam" as "power") */
2390 if (seen) obvious = TRUE;
2392 if (r_ptr->flagsr & RFR_RES_ALL)
2394 note = _("には効果がなかった。", " is unaffected.");
2396 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2399 /* Attempt to polymorph (see below) */
2402 /* Powerful monsters can resist */
2403 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2404 (r_ptr->flags1 & RF1_QUESTOR) ||
2405 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2407 note = _("には効果がなかった。", " is unaffected.");
2412 /* No "real" damage */
2419 /* Clone monsters (Ignore "dam") */
2422 if (seen) obvious = TRUE;
2424 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2426 note = _("には効果がなかった。", " is unaffected.");
2431 m_ptr->hp = m_ptr->maxhp;
2433 /* Attempt to clone. */
2434 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2436 note = _("が分裂した!", " spawns!");
2440 /* No "real" damage */
2447 /* Heal Monster (use "dam" as amount of healing) */
2450 if (seen) obvious = TRUE;
2453 (void)set_monster_csleep(g_ptr->m_idx, 0);
2455 if (m_ptr->maxhp < m_ptr->max_maxhp)
2457 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2458 m_ptr->maxhp = m_ptr->max_maxhp;
2463 /* Redraw (later) if needed */
2464 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2465 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2473 if (seen) obvious = TRUE;
2476 (void)set_monster_csleep(g_ptr->m_idx, 0);
2477 if (MON_STUNNED(m_ptr))
2479 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2480 (void)set_monster_stunned(g_ptr->m_idx, 0);
2482 if (MON_CONFUSED(m_ptr))
2484 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2485 (void)set_monster_confused(g_ptr->m_idx, 0);
2487 if (MON_MONFEAR(m_ptr))
2489 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2490 (void)set_monster_monfear(g_ptr->m_idx, 0);
2494 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2497 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2501 chg_virtue(V_VITALITY, 1);
2503 if (r_ptr->flags1 & RF1_UNIQUE)
2504 chg_virtue(V_INDIVIDUALISM, 1);
2506 if (is_friendly(m_ptr))
2507 chg_virtue(V_HONOUR, 1);
2508 else if (!(r_ptr->flags3 & RF3_EVIL))
2510 if (r_ptr->flags3 & RF3_GOOD)
2511 chg_virtue(V_COMPASSION, 2);
2513 chg_virtue(V_COMPASSION, 1);
2516 if (r_ptr->flags3 & RF3_ANIMAL)
2517 chg_virtue(V_NATURE, 1);
2520 if (m_ptr->r_idx == MON_LEPER)
2523 if (!who) chg_virtue(V_COMPASSION, 5);
2526 /* Redraw (later) if needed */
2527 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2528 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2530 note = _("は体力を回復したようだ。", " looks healthier.");
2532 /* No "real" damage */
2538 /* Speed Monster (Ignore "dam") */
2541 if (seen) obvious = TRUE;
2544 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2546 note = _("の動きが速くなった。", " starts moving faster.");
2551 if (r_ptr->flags1 & RF1_UNIQUE)
2552 chg_virtue(V_INDIVIDUALISM, 1);
2553 if (is_friendly(m_ptr))
2554 chg_virtue(V_HONOUR, 1);
2557 /* No "real" damage */
2563 /* Slow Monster (Use "dam" as "power") */
2566 if (seen) obvious = TRUE;
2568 if (r_ptr->flagsr & RFR_RES_ALL)
2570 note = _("には効果がなかった。", " is unaffected.");
2572 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2575 /* Powerful monsters can resist */
2576 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2577 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2579 note = _("には効果がなかった。", " is unaffected.");
2583 /* Normal monsters slow down */
2586 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2588 note = _("の動きが遅くなった。", " starts moving slower.");
2592 /* No "real" damage */
2598 /* Sleep (Use "dam" as "power") */
2601 if (seen) obvious = TRUE;
2603 if (r_ptr->flagsr & RFR_RES_ALL)
2605 note = _("には効果がなかった。", " is unaffected.");
2607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2610 /* Attempt a saving throw */
2611 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2612 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2613 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2615 /* Memorize a flag */
2616 if (r_ptr->flags3 & RF3_NO_SLEEP)
2618 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2620 /* No obvious effect */
2621 note = _("には効果がなかった。", " is unaffected.");
2626 /* Go to sleep (much) later */
2627 note = _("は眠り込んでしまった!", " falls asleep!");
2631 /* No "real" damage */
2637 /* Sleep (Use "dam" as "power") */
2638 case GF_STASIS_EVIL:
2640 if (seen) obvious = TRUE;
2642 if (r_ptr->flagsr & RFR_RES_ALL)
2644 note = _("には効果がなかった!", " is immune.");
2646 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2649 /* Attempt a saving throw */
2650 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2651 !(r_ptr->flags3 & RF3_EVIL) ||
2652 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2654 note = _("には効果がなかった。", " is unaffected.");
2659 /* Go to sleep (much) later */
2660 note = _("は動けなくなった!", " is suspended!");
2664 /* No "real" damage */
2669 /* Sleep (Use "dam" as "power") */
2672 if (seen) obvious = TRUE;
2674 if (r_ptr->flagsr & RFR_RES_ALL)
2676 note = _("には効果がなかった。", " is unaffected.");
2678 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2681 /* Attempt a saving throw */
2682 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2683 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2685 note = _("には効果がなかった。", " is unaffected.");
2690 /* Go to sleep (much) later */
2691 note = _("は動けなくなった!", " is suspended!");
2695 /* No "real" damage */
2704 vir = virtue_number(V_HARMONY);
2707 dam += p_ptr->virtues[vir-1]/10;
2710 vir = virtue_number(V_INDIVIDUALISM);
2713 dam -= p_ptr->virtues[vir-1]/20;
2716 if (seen) obvious = TRUE;
2718 /* Attempt a saving throw */
2719 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2723 /* No obvious effect */
2724 note = _("には効果がなかった。", " is unaffected.");
2727 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2729 else if (p_ptr->cursed & TRC_AGGRAVATE)
2731 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2732 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2736 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2739 chg_virtue(V_INDIVIDUALISM, -1);
2740 if (r_ptr->flags3 & RF3_ANIMAL)
2741 chg_virtue(V_NATURE, 1);
2744 /* No "real" damage */
2749 /* Control undead */
2750 case GF_CONTROL_UNDEAD:
2753 if (seen) obvious = TRUE;
2755 vir = virtue_number(V_UNLIFE);
2758 dam += p_ptr->virtues[vir-1]/10;
2761 vir = virtue_number(V_INDIVIDUALISM);
2764 dam -= p_ptr->virtues[vir-1]/20;
2767 /* Attempt a saving throw */
2768 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2769 !(r_ptr->flags3 & RF3_UNDEAD))
2771 /* No obvious effect */
2772 note = _("には効果がなかった。", " is unaffected.");
2774 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2776 else if (p_ptr->cursed & TRC_AGGRAVATE)
2778 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2779 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2783 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2787 /* No "real" damage */
2793 case GF_CONTROL_DEMON:
2796 if (seen) obvious = TRUE;
2798 vir = virtue_number(V_UNLIFE);
2801 dam += p_ptr->virtues[vir-1]/10;
2804 vir = virtue_number(V_INDIVIDUALISM);
2807 dam -= p_ptr->virtues[vir-1]/20;
2810 /* Attempt a saving throw */
2811 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2812 !(r_ptr->flags3 & RF3_DEMON))
2814 /* No obvious effect */
2815 note = _("には効果がなかった。", " is unaffected.");
2817 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2819 else if (p_ptr->cursed & TRC_AGGRAVATE)
2821 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2822 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2826 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2830 /* No "real" damage */
2836 case GF_CONTROL_ANIMAL:
2839 if (seen) obvious = TRUE;
2841 vir = virtue_number(V_NATURE);
2844 dam += p_ptr->virtues[vir-1]/10;
2847 vir = virtue_number(V_INDIVIDUALISM);
2850 dam -= p_ptr->virtues[vir-1]/20;
2853 /* Attempt a saving throw */
2854 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2855 !(r_ptr->flags3 & RF3_ANIMAL))
2858 /* No obvious effect */
2859 note = _("には効果がなかった。", " is unaffected.");
2861 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2863 else if (p_ptr->cursed & TRC_AGGRAVATE)
2865 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2866 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2870 note = _("はなついた。", " is tamed!");
2872 if (r_ptr->flags3 & RF3_ANIMAL)
2873 chg_virtue(V_NATURE, 1);
2876 /* No "real" damage */
2882 case GF_CHARM_LIVING:
2886 vir = virtue_number(V_UNLIFE);
2887 if (seen) obvious = TRUE;
2889 vir = virtue_number(V_UNLIFE);
2892 dam -= p_ptr->virtues[vir-1]/10;
2895 vir = virtue_number(V_INDIVIDUALISM);
2898 dam -= p_ptr->virtues[vir-1]/20;
2901 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2903 /* Attempt a saving throw */
2904 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2905 !monster_living(m_ptr->r_idx))
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 */
2931 /* Confusion (Use "dam" as "power") */
2934 if (seen) obvious = TRUE;
2936 if (r_ptr->flagsr & RFR_RES_ALL)
2938 note = _("には効果がなかった。", " is unaffected.");
2940 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2943 /* Get confused later */
2944 do_conf = damroll(3, (dam / 2)) + 1;
2946 /* Attempt a saving throw */
2947 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2948 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2949 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2951 /* Memorize a flag */
2952 if (r_ptr->flags3 & (RF3_NO_CONF))
2954 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2960 /* No obvious effect */
2961 note = _("には効果がなかった。", " is unaffected.");
2965 /* No "real" damage */
2972 if (seen) obvious = TRUE;
2974 if (r_ptr->flagsr & RFR_RES_ALL)
2976 note = _("には効果がなかった。", " is unaffected.");
2978 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
2981 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2983 /* Attempt a saving throw */
2984 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2985 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2990 /* No obvious effect */
2991 note = _("には効果がなかった。", " is unaffected.");
2995 /* No "real" damage */
3003 /* Lite, but only hurts susceptible creatures */
3011 if (r_ptr->flagsr & RFR_RES_ALL)
3017 if (r_ptr->flags3 & (RF3_HURT_LITE))
3019 /* Obvious effect */
3020 if (seen) obvious = TRUE;
3022 /* Memorize the effects */
3023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3025 /* Special effect */
3026 note = _("は光に身をすくめた!", " cringes from the light!");
3027 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3030 /* Normally no damage */
3042 /* Lite -- opposite of Dark */
3045 if (seen) obvious = TRUE;
3047 if (r_ptr->flagsr & RFR_RES_ALL)
3049 note = _("には完全な耐性がある!", " is immune.");
3051 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3054 if (r_ptr->flagsr & RFR_RES_LITE)
3056 note = _("には耐性がある!", " resists!");
3057 dam *= 2; dam /= (randint1(6)+6);
3058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
3060 else if (r_ptr->flags3 & (RF3_HURT_LITE))
3062 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3063 note = _("は光に身をすくめた!", " cringes from the light!");
3064 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3071 /* Dark -- opposite of Lite */
3074 if (seen) obvious = TRUE;
3076 if (r_ptr->flagsr & RFR_RES_ALL)
3078 note = _("には完全な耐性がある!", " is immune.");
3080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3083 if (r_ptr->flagsr & RFR_RES_DARK)
3085 note = _("には耐性がある!", " resists!");
3086 dam *= 2; dam /= (randint1(6)+6);
3087 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
3096 if (r_ptr->flagsr & RFR_RES_ALL)
3101 /* Hurt by rock remover */
3102 if (r_ptr->flags3 & (RF3_HURT_ROCK))
3105 if (seen) obvious = TRUE;
3107 /* Memorize the effects */
3108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
3110 /* Cute little message */
3111 note = _("の皮膚がただれた!", " loses some skin!");
3112 note_dies = _("はドロドロに溶けた!", " dissolves!");
3115 /* Usually, ignore the effects */
3126 /* Teleport undead (Use "dam" as "power") */
3127 case GF_AWAY_UNDEAD:
3129 /* Only affect undead */
3130 if (r_ptr->flags3 & (RF3_UNDEAD))
3132 bool resists_tele = FALSE;
3134 if (r_ptr->flagsr & RFR_RES_TELE)
3136 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3138 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3139 note = _("には効果がなかった。", " is unaffected.");
3140 resists_tele = TRUE;
3142 else if (r_ptr->level > randint1(100))
3144 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3145 note = _("には耐性がある!", " resists!");
3146 resists_tele = TRUE;
3152 if (seen) obvious = TRUE;
3153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3165 /* No "real" damage */
3171 /* Teleport evil (Use "dam" as "power") */
3174 /* Only affect evil */
3175 if (r_ptr->flags3 & (RF3_EVIL))
3177 bool resists_tele = FALSE;
3179 if (r_ptr->flagsr & RFR_RES_TELE)
3181 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3183 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3184 note = _("には効果がなかった。", " is unaffected.");
3185 resists_tele = TRUE;
3187 else if (r_ptr->level > randint1(100))
3189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3190 note = _("には耐性がある!", " resists!");
3191 resists_tele = TRUE;
3197 if (seen) obvious = TRUE;
3198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3210 /* No "real" damage */
3216 /* Teleport monster (Use "dam" as "power") */
3219 bool resists_tele = FALSE;
3220 if (r_ptr->flagsr & RFR_RES_TELE)
3222 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
3224 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3225 note = _("には効果がなかった。", " is unaffected.");
3226 resists_tele = TRUE;
3228 else if (r_ptr->level > randint1(100))
3230 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3231 note = _("には耐性がある!", " resists!");
3232 resists_tele = TRUE;
3238 if (seen) obvious = TRUE;
3240 /* Prepare to teleport */
3244 /* No "real" damage */
3250 /* Turn undead (Use "dam" as "power") */
3251 case GF_TURN_UNDEAD:
3253 if (r_ptr->flagsr & RFR_RES_ALL)
3258 /* Only affect undead */
3259 if (r_ptr->flags3 & (RF3_UNDEAD))
3261 if (seen) obvious = TRUE;
3263 /* Learn about type */
3264 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3266 /* Apply some fear */
3267 do_fear = damroll(3, (dam / 2)) + 1;
3269 /* Attempt a saving throw */
3270 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3272 /* No obvious effect */
3273 note = _("には効果がなかった。", " is unaffected.");
3286 /* No "real" damage */
3292 /* Turn evil (Use "dam" as "power") */
3295 if (r_ptr->flagsr & RFR_RES_ALL)
3300 /* Only affect evil */
3301 if (r_ptr->flags3 & (RF3_EVIL))
3303 if (seen) obvious = TRUE;
3305 /* Learn about type */
3306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3308 /* Apply some fear */
3309 do_fear = damroll(3, (dam / 2)) + 1;
3311 /* Attempt a saving throw */
3312 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
3314 /* No obvious effect */
3315 note = _("には効果がなかった。", " is unaffected.");
3328 /* No "real" damage */
3334 /* Turn monster (Use "dam" as "power") */
3337 if (r_ptr->flagsr & RFR_RES_ALL)
3342 if (seen) obvious = TRUE;
3344 /* Apply some fear */
3345 do_fear = damroll(3, (dam / 2)) + 1;
3347 /* Attempt a saving throw */
3348 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3349 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
3350 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3352 /* No obvious effect */
3353 note = _("には効果がなかった。", " is unaffected.");
3358 /* No "real" damage */
3365 case GF_DISP_UNDEAD:
3367 if (r_ptr->flagsr & RFR_RES_ALL)
3373 /* Only affect undead */
3374 if (r_ptr->flags3 & (RF3_UNDEAD))
3376 if (seen) obvious = TRUE;
3378 /* Learn about type */
3379 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3381 note = _("は身震いした。", " shudders.");
3382 note_dies = _("はドロドロに溶けた!", " dissolves!");
3402 if (r_ptr->flagsr & RFR_RES_ALL)
3408 /* Only affect evil */
3409 if (r_ptr->flags3 & (RF3_EVIL))
3411 if (seen) obvious = TRUE;
3413 /* Learn about type */
3414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3416 note = _("は身震いした。", " shudders.");
3417 note_dies = _("はドロドロに溶けた!", " dissolves!");
3436 if (r_ptr->flagsr & RFR_RES_ALL)
3442 /* Only affect good */
3443 if (r_ptr->flags3 & (RF3_GOOD))
3445 if (seen) obvious = TRUE;
3447 /* Learn about type */
3448 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3450 note = _("は身震いした。", " shudders.");
3451 note_dies = _("はドロドロに溶けた!", " dissolves!");
3468 case GF_DISP_LIVING:
3470 if (r_ptr->flagsr & RFR_RES_ALL)
3476 /* Only affect non-undead */
3477 if (monster_living(m_ptr->r_idx))
3479 if (seen) obvious = TRUE;
3481 note = _("は身震いした。", " shudders.");
3482 note_dies = _("はドロドロに溶けた!", " dissolves!");
3501 if (r_ptr->flagsr & RFR_RES_ALL)
3507 /* Only affect demons */
3508 if (r_ptr->flags3 & (RF3_DEMON))
3510 if (seen) obvious = TRUE;
3512 /* Learn about type */
3513 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3515 note = _("は身震いした。", " shudders.");
3516 note_dies = _("はドロドロに溶けた!", " dissolves!");
3532 /* Dispel monster */
3535 if (r_ptr->flagsr & RFR_RES_ALL)
3541 if (seen) obvious = TRUE;
3543 note = _("は身震いした。", " shudders.");
3544 note_dies = _("はドロドロに溶けた!", " dissolves!");
3551 if (seen) obvious = TRUE;
3553 if (r_ptr->flagsr & RFR_RES_ALL)
3555 note = _("には完全な耐性がある!", " is immune.");
3557 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3561 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3565 /* Heal the monster */
3566 if (caster_ptr->hp < caster_ptr->maxhp)
3569 caster_ptr->hp += dam;
3570 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3572 /* Redraw (later) if needed */
3573 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3574 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3576 /* Special message */
3579 monster_desc(killer, caster_ptr, 0);
3580 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3586 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3587 (void)hp_player(dam);
3592 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3601 if (seen) obvious = TRUE;
3602 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3604 if (r_ptr->flagsr & RFR_RES_ALL)
3606 note = _("には完全な耐性がある!", " is immune.");
3608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3612 /* Attempt a saving throw */
3613 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3614 (r_ptr->flags3 & RF3_NO_CONF) ||
3615 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3617 /* Memorize a flag */
3618 if (r_ptr->flags3 & (RF3_NO_CONF))
3620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3622 note = _("には効果がなかった。", " is unaffected.");
3625 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3627 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3628 note = _("には完全な耐性がある!", " is immune.");
3631 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3633 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3634 note = _("には耐性がある。", " resists.");
3639 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3640 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3642 if (who > 0) do_conf = randint0(4) + 4;
3643 else do_conf = randint0(8) + 8;
3649 case GF_BRAIN_SMASH:
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.");
3694 do_conf = randint0(4) + 4;
3695 do_stun = randint0(4) + 4;
3699 do_conf = randint0(8) + 8;
3700 do_stun = randint0(8) + 8;
3702 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3710 if (seen) obvious = TRUE;
3711 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3713 if (r_ptr->flagsr & RFR_RES_ALL)
3715 note = _("には完全な耐性がある!", " is immune.");
3717 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3721 /* Attempt a saving throw */
3722 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3724 note = _("には効果がなかった。", " is unaffected.");
3733 if (seen) obvious = TRUE;
3734 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3736 if (r_ptr->flagsr & RFR_RES_ALL)
3738 note = _("には完全な耐性がある!", " is immune.");
3740 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3744 /* Attempt a saving throw */
3745 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3747 note = _("には効果がなかった。", " is unaffected.");
3756 if (seen) obvious = TRUE;
3757 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3759 if (r_ptr->flagsr & RFR_RES_ALL)
3761 note = _("には完全な耐性がある!", " is immune.");
3763 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3767 /* Attempt a saving throw */
3768 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3770 note = _("には効果がなかった。", " is unaffected.");
3779 if (seen) obvious = TRUE;
3781 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3782 "You point at %s, screaming the word, 'DIE!'."), m_name);
3784 if (r_ptr->flagsr & RFR_RES_ALL)
3786 note = _("には完全な耐性がある!", " is immune.");
3788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3792 /* Attempt a saving throw */
3793 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3795 note = _("には効果がなかった。", " is unaffected.");
3804 if (seen) obvious = TRUE;
3806 if (r_ptr->flagsr & RFR_RES_ALL)
3808 note = _("には完全な耐性がある!", " is immune.");
3810 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3814 if (r_ptr->flags1 & RF1_UNIQUE)
3816 note = _("には効果がなかった。", " is unaffected.");
3821 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3822 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3824 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3826 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3830 note = _("は耐性を持っている!", "resists!");
3837 /* Capture monster */
3841 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3842 (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)
3844 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3849 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3850 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3851 nokori_hp = m_ptr->maxhp * 3 / 10;
3853 nokori_hp = m_ptr->maxhp * 3 / 20;
3855 if (m_ptr->hp >= nokori_hp)
3857 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3860 else if (m_ptr->hp < randint0(nokori_hp))
3862 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3863 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3864 cap_mon = m_ptr->r_idx;
3865 cap_mspeed = m_ptr->mspeed;
3867 cap_maxhp = m_ptr->max_maxhp;
3868 cap_nickname = m_ptr->nickname; /* Quark transfer */
3869 if (g_ptr->m_idx == p_ptr->riding)
3871 if (rakuba(-1, FALSE))
3873 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3877 delete_monster_idx(g_ptr->m_idx);
3883 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3889 /* Attack (Use "dam" as attack type) */
3892 /* Return this monster's death */
3893 return py_attack(y, x, dam);
3896 /* Sleep (Use "dam" as "power") */
3902 if (seen) obvious = TRUE;
3904 if (r_ptr->flagsr & RFR_RES_ALL)
3906 note = _("には効果がなかった。", " is unaffected.");
3908 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
3911 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3913 note = _("には効果がなかった。", " is unaffected.");
3916 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3919 if (MON_CSLEEP(m_ptr))
3921 note = _("には効果がなかった。", " is unaffected.");
3927 if (one_in_(5)) effect = 1;
3928 else if (one_in_(4)) effect = 2;
3929 else if (one_in_(3)) effect = 3;
3934 /* Powerful monsters can resist */
3935 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3936 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3938 note = _("には効果がなかった。", " is unaffected.");
3942 /* Normal monsters slow down */
3945 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3947 note = _("の動きが遅くなった。", " starts moving slower.");
3952 else if (effect == 2)
3954 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3956 /* Attempt a saving throw */
3957 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3958 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3963 /* No obvious effect */
3964 note = _("には効果がなかった。", " is unaffected.");
3969 else if (effect == 3)
3971 /* Attempt a saving throw */
3972 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3973 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3974 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3976 /* Memorize a flag */
3977 if (r_ptr->flags3 & RF3_NO_SLEEP)
3979 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3982 /* No obvious effect */
3983 note = _("には効果がなかった。", " is unaffected.");
3988 /* Go to sleep (much) later */
3989 note = _("は眠り込んでしまった!", " falls asleep!");
3996 note = _("には効果がなかった。", " is unaffected.");
3999 /* No "real" damage */
4007 if (seen) obvious = TRUE;
4009 if (r_ptr->flagsr & RFR_RES_ALL)
4011 note = _("には効果がなかった。", " is unaffected.");
4013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4017 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
4019 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
4020 chg_virtue(V_VITALITY, -1);
4030 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
4032 if (r_ptr->flags3 & (RF3_HURT_LITE))
4034 /* Obvious effect */
4035 if (seen) obvious = TRUE;
4037 /* Memorize the effects */
4038 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
4040 /* Special effect */
4041 note = _("は光に身をすくめた!", " cringes from the light!");
4042 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
4045 /* Normally no damage */
4052 photo = m_ptr->r_idx;
4059 case GF_BLOOD_CURSE:
4061 if (seen) obvious = TRUE;
4063 if (r_ptr->flagsr & RFR_RES_ALL)
4065 note = _("には完全な耐性がある!", " is immune.");
4067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4075 bool success = FALSE;
4076 if (seen) obvious = TRUE;
4078 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
4080 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
4081 if (dam < 1) dam = 1;
4083 /* No need to tame your pet */
4086 note = _("の動きが速くなった。", " starts moving faster.");
4087 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
4091 /* Attempt a saving throw */
4092 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
4093 (r_ptr->flags1 & (RF1_UNIQUE)) ||
4094 (m_ptr->mflag2 & MFLAG2_NOPET) ||
4095 (p_ptr->cursed & TRC_AGGRAVATE) ||
4096 ((r_ptr->level+10) > randint1(dam)))
4099 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
4103 note = _("を支配した。", " is tamed!");
4105 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
4107 /* Learn about type */
4108 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
4115 if (!(r_ptr->flags3 & RF3_NO_FEAR))
4117 do_fear = randint1(90)+10;
4119 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
4122 /* No "real" damage */
4129 if (seen) obvious = TRUE;
4131 if (r_ptr->flagsr & RFR_RES_ALL)
4133 note = _("には完全な耐性がある!", " is immune.");
4135 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
4139 /* Attempt a saving throw */
4140 if (randint0(100 + dam) < (r_ptr->level + 50))
4142 note = _("には効果がなかった。", " is unaffected.");
4162 /* Absolutely no effect */
4163 if (skipped) return (FALSE);
4165 /* "Unique" monsters cannot be polymorphed */
4166 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
4168 /* Quest monsters cannot be polymorphed */
4169 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
4171 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
4173 /* "Unique" and "quest" monsters can only be "killed" by the player. */
4174 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
4176 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
4181 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
4182 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
4185 /* Modify the damage */
4187 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
4188 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
4190 /* Check for death */
4191 if (dam > m_ptr->hp)
4193 /* Extract method of death */
4198 /* Sound and Impact resisters never stun */
4200 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
4201 !(r_ptr->flags3 & RF3_NO_STUN))
4203 if (seen) obvious = TRUE;
4206 if (MON_STUNNED(m_ptr))
4208 note = _("はひどくもうろうとした。", " is more dazed.");
4209 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
4213 note = _("はもうろうとした。", " is dazed.");
4218 (void)set_monster_stunned(g_ptr->m_idx, tmp);
4224 /* Confusion and Chaos resisters (and sleepers) never confuse */
4226 !(r_ptr->flags3 & RF3_NO_CONF) &&
4227 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
4229 if (seen) obvious = TRUE;
4231 /* Already partially confused */
4232 if (MON_CONFUSED(m_ptr))
4234 note = _("はさらに混乱したようだ。", " looks more confused.");
4235 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
4238 /* Was not confused */
4241 note = _("は混乱したようだ。", " looks confused.");
4245 /* Apply confusion */
4246 (void)set_monster_confused(g_ptr->m_idx, tmp);
4254 if (seen) obvious = TRUE;
4256 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
4260 note = _("は弱くなったようだ。", " seems weakened.");
4261 m_ptr->maxhp -= do_time;
4262 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
4267 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
4268 if (do_poly && (randint1(90) > r_ptr->level))
4270 if (polymorph_monster(y, x))
4272 if (seen) obvious = TRUE;
4274 /* Monster polymorphs */
4275 note = _("が変身した!", " changes!");
4277 /* Turn off the damage */
4283 note = _("には効果がなかった。", " is unaffected.");
4286 /* Hack -- Get new monster */
4287 m_ptr = &m_list[g_ptr->m_idx];
4289 /* Hack -- Get new race */
4290 r_ptr = &r_info[m_ptr->r_idx];
4293 /* Handle "teleport" */
4296 if (seen) obvious = TRUE;
4298 note = _("が消え去った!", " disappears!");
4300 if (!who) chg_virtue(V_VALOUR, -1);
4303 teleport_away(g_ptr->m_idx, do_dist,
4304 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
4306 /* Hack -- get new location */
4310 /* Hack -- get new grid */
4311 g_ptr = &grid_array[y][x];
4318 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
4325 if (typ == GF_DRAIN_MANA)
4327 /* Drain mana does nothing */
4330 /* If another monster did the damage, hurt the monster by hand */
4333 /* Redraw (later) if needed */
4334 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
4335 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
4337 /* Wake the monster up */
4338 (void)set_monster_csleep(g_ptr->m_idx, 0);
4340 /* Hurt the monster */
4348 if (is_pet(m_ptr) && !(m_ptr->ml))
4351 /* Give detailed messages if destroyed */
4354 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4357 msg_format("%^s%s", m_name, note);
4365 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
4367 /* Generate treasure, etc */
4368 monster_death(g_ptr->m_idx, FALSE);
4371 delete_monster_idx(g_ptr->m_idx);
4375 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
4379 /* Damaged monster */
4382 /* Give detailed messages if visible or destroyed */
4383 if (note && seen_msg) msg_format("%^s%s", m_name, note);
4385 /* Hack -- Pain message */
4388 message_pain(g_ptr->m_idx, dam);
4395 /* Hack -- handle sleep */
4396 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
4400 else if (heal_leper)
4402 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
4404 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
4406 char m2_name[MAX_NLEN];
4408 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
4409 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
4412 delete_monster_idx(g_ptr->m_idx);
4415 /* If the player did it, give him experience, check fear */
4420 /* Hurt the monster, check for fear and death */
4421 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
4426 /* Damaged monster */
4429 /* HACK - anger the monster before showing the sleep message */
4430 if (do_sleep) anger_monster(m_ptr);
4432 /* Give detailed messages if visible or destroyed */
4433 if (note && seen_msg)
4434 msg_format(_("%s%s", "%^s%s"), m_name, note);
4436 /* Hack -- Pain message */
4437 else if (known && (dam || !do_fear))
4439 message_pain(g_ptr->m_idx, dam);
4442 /* Anger monsters */
4443 if (((dam > 0) || get_angry) && !do_sleep)
4444 anger_monster(m_ptr);
4446 if ((fear || do_fear) && seen)
4449 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
4452 /* Hack -- handle sleep */
4453 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
4457 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
4459 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
4463 switch (randint1(28))
4468 msg_print(_("地面が揺れた...", "The ground trembles..."));
4469 earthquake(ty, tx, 4 + randint0(4));
4470 if (!one_in_(6)) break;
4472 case 3: case 4: case 5: case 6:
4475 int extra_dam = damroll(10, 10);
4476 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
4478 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
4479 if (!one_in_(6)) break;
4484 msg_print(_("空間が歪んだ!", "Space warps about you!"));
4486 if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
4487 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
4488 if (!one_in_(6)) break;
4490 case 9: case 10: case 11:
4491 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
4492 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
4493 if (!one_in_(6)) break;
4494 case 12: case 13: case 14: case 15: case 16:
4495 aggravate_monsters(0);
4496 if (!one_in_(6)) break;
4498 count += activate_hi_summon(ty, tx, TRUE);
4499 if (!one_in_(6)) break;
4500 case 19: case 20: case 21: case 22:
4502 bool pet = !one_in_(3);
4503 BIT_FLAGS mode = PM_ALLOW_GROUP;
4505 if (pet) mode |= PM_FORCE_PET;
4506 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
4508 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');
4509 if (!one_in_(6)) break;
4511 case 23: case 24: case 25:
4512 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4513 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4515 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4516 else lose_exp(p_ptr->exp / 16);
4517 if (!one_in_(6)) break;
4518 case 26: case 27: case 28:
4527 (void)do_dec_stat(i);
4536 (void)do_dec_stat(randint0(6));
4545 if (p_ptr->inside_battle)
4547 p_ptr->health_who = g_ptr->m_idx;
4548 p_ptr->redraw |= (PR_HEALTH);
4552 /* Verify this code */
4553 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
4555 /* Redraw the monster grid */
4559 /* Update monster recall window */
4560 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
4562 p_ptr->window |= (PW_MONSTER);
4565 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
4569 if (!(flg & PROJECT_NO_HANGEKI))
4571 set_target(m_ptr, monster_target_y, monster_target_x);
4574 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
4576 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
4580 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
4582 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
4583 rakubadam_m = (dam > 200) ? 200 : dam;
4593 /* Prepare to make a Blade of Chaos */
4594 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
4596 q_ptr->pval = photo;
4598 /* Mark the item as fully known */
4599 q_ptr->ident |= (IDENT_MENTAL);
4600 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
4608 /* Return "Anything seen?" */
4613 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
4614 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4615 * @param who_name 効果を起こしたモンスターの名前
4616 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4617 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4618 * @param x 目標X座標 / Target x location (or location to travel "towards")
4619 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4620 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4622 * @param monspell 効果元のモンスター魔法ID
4623 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4625 * Handle a beam/bolt/ball causing damage to the player.
4626 * This routine takes a "source monster" (by index), a "distance", a default
4627 * "damage", and a "damage type". See "project_m()" above.
4628 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
4629 * is reduced (see "project_m()" above). This can happen if a monster breathes
4630 * at the player and hits a wall instead.
4631 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
4632 * to know if this is actually a ball or a bolt spell
4633 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
4634 * we just assume that the effects were obvious, for historical reasons.
4636 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)
4641 /* Hack -- assume obvious */
4642 bool obvious = TRUE;
4644 /* Player blind-ness */
4645 bool blind = (p_ptr->blind ? TRUE : FALSE);
4647 /* Player needs a "description" (he is blind) */
4650 /* Source monster */
4651 monster_type *m_ptr = NULL;
4653 /* Monster name (for attacks) */
4654 GAME_TEXT m_name[MAX_NLEN];
4656 /* Monster name (for damage) */
4659 /* Hack -- messages */
4665 /* Player is not here */
4666 if (!player_bold(y, x)) return (FALSE);
4668 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4670 if (kawarimi(TRUE)) return FALSE;
4673 /* Player cannot hurt himself */
4674 if (!who) return (FALSE);
4675 if (who == p_ptr->riding) return (FALSE);
4677 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4680 int max_attempts = 10;
4681 sound(SOUND_REFLECT);
4684 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4685 else if (p_ptr->special_defense & KATA_FUUJIN)
4686 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4688 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4691 /* Choose 'new' target */
4696 t_y = m_list[who].fy - 1 + randint1(3);
4697 t_x = m_list[who].fx - 1 + randint1(3);
4700 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4702 if (max_attempts < 1)
4704 t_y = m_list[who].fy;
4705 t_x = m_list[who].fx;
4710 t_y = p_ptr->y - 1 + randint1(3);
4711 t_x = p_ptr->x - 1 + randint1(3);
4714 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4716 disturb(TRUE, TRUE);
4720 /* Limit maximum damage */
4721 if (dam > 1600) dam = 1600;
4723 /* Reduce damage by distance */
4724 dam = (dam + r) / (r + 1);
4727 /* If the player is blind, be more descriptive */
4728 if (blind) fuzzy = TRUE;
4733 m_ptr = &m_list[who];
4734 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4735 monster_desc(m_name, m_ptr, 0);
4737 /* Get the monster's real name (gotten before polymorph!) */
4738 strcpy(killer, who_name);
4744 case PROJECT_WHO_UNCTRL_POWER:
4745 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4748 case PROJECT_WHO_GLASS_SHARDS:
4749 strcpy(killer, _("ガラスの破片", "shards of glass"));
4753 strcpy(killer, _("罠", "a trap"));
4758 strcpy(m_name, killer);
4761 /* Analyze the damage */
4764 /* Standard damage -- hurts inventory too */
4767 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4768 get_damage = acid_dam(dam, killer, monspell, FALSE);
4772 /* Standard damage -- hurts inventory too */
4775 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4776 get_damage = fire_dam(dam, killer, monspell, FALSE);
4780 /* Standard damage -- hurts inventory too */
4783 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4784 get_damage = cold_dam(dam, killer, monspell, FALSE);
4788 /* Standard damage -- hurts inventory too */
4791 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4792 get_damage = elec_dam(dam, killer, monspell, FALSE);
4796 /* Standard damage -- also poisons player */
4799 bool double_resist = IS_OPPOSE_POIS();
4800 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4802 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4803 if (double_resist) dam = (dam + 2) / 3;
4805 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4810 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4812 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4814 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4819 /* Standard damage -- also poisons / mutates player */
4822 bool double_resist = IS_OPPOSE_POIS();
4823 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4825 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4826 if (double_resist) dam = (2 * dam + 2) / 5;
4827 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4828 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4830 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4832 if (one_in_(5)) /* 6 */
4834 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4835 if (one_in_(4)) /* 4 */
4843 inven_damage(set_acid_destroy, 2);
4849 /* Standard damage */
4852 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4853 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4857 /* Holy Orb -- Player only takes partial damage */
4860 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4861 if (p_ptr->align > 10)
4863 else if (p_ptr->align < -10)
4865 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4871 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4872 if (p_ptr->align > 10)
4874 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4878 /* Arrow -- XXX no dodging */
4883 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4885 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4887 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4890 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4894 /* Plasma -- XXX No resist */
4897 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4898 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4900 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4902 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4903 (void)set_stun(p_ptr->stun + plus_stun);
4906 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4908 inven_damage(set_acid_destroy, 3);
4914 /* Nether -- drain experience */
4917 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4918 if (p_ptr->resist_neth)
4920 if (!prace_is_(RACE_SPECTRE))
4922 dam *= 6; dam /= (randint1(4) + 7);
4925 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4927 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4929 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4931 learn_spell(monspell);
4935 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4941 /* Water -- stun/confuse */
4944 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4945 if (!CHECK_MULTISHADOW())
4947 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4949 set_stun(p_ptr->stun + randint1(40));
4951 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4953 set_confused(p_ptr->confused + randint1(5) + 5);
4956 if (one_in_(5) && !p_ptr->resist_water)
4958 inven_damage(set_cold_destroy, 3);
4961 if (p_ptr->resist_water) get_damage /= 4;
4964 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4968 /* Chaos -- many effects */
4971 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4972 if (p_ptr->resist_chaos)
4974 dam *= 6; dam /= (randint1(4) + 7);
4977 if (!CHECK_MULTISHADOW())
4979 if (!p_ptr->resist_conf)
4981 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4983 if (!p_ptr->resist_chaos)
4985 (void)set_image(p_ptr->image + randint1(10));
4988 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4989 (void)gain_random_mutation(0);
4992 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4994 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4997 if (!p_ptr->resist_chaos || one_in_(9))
4999 inven_damage(set_elec_destroy, 2);
5000 inven_damage(set_fire_destroy, 2);
5004 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5008 /* Shards -- mostly cutting */
5011 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
5012 if (p_ptr->resist_shard)
5014 dam *= 6; dam /= (randint1(4) + 7);
5016 else if (!CHECK_MULTISHADOW())
5018 (void)set_cut(p_ptr->cut + dam);
5021 if (!p_ptr->resist_shard || one_in_(13))
5023 inven_damage(set_cold_destroy, 2);
5026 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5030 /* Sound -- mostly stunning */
5033 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
5034 if (p_ptr->resist_sound)
5036 dam *= 5; dam /= (randint1(4) + 7);
5038 else if (!CHECK_MULTISHADOW())
5040 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5041 (void)set_stun(p_ptr->stun + plus_stun);
5044 if (!p_ptr->resist_sound || one_in_(13))
5046 inven_damage(set_cold_destroy, 2);
5049 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5053 /* Pure confusion */
5056 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
5057 if (p_ptr->resist_conf)
5059 dam *= 5; dam /= (randint1(4) + 7);
5061 else if (!CHECK_MULTISHADOW())
5063 (void)set_confused(p_ptr->confused + randint1(20) + 10);
5065 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5069 /* Disenchantment -- see above */
5072 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
5073 if (p_ptr->resist_disen)
5075 dam *= 6; dam /= (randint1(4) + 7);
5077 else if (!CHECK_MULTISHADOW())
5079 (void)apply_disenchant(0);
5081 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5085 /* Nexus -- see above */
5088 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
5089 if (p_ptr->resist_nexus)
5091 dam *= 6; dam /= (randint1(4) + 7);
5093 else if (!CHECK_MULTISHADOW())
5097 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5101 /* Force -- mostly stun */
5104 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
5105 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5107 (void)set_stun(p_ptr->stun + randint1(20));
5109 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5114 /* Rocket -- stun, cut */
5117 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
5118 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
5120 (void)set_stun(p_ptr->stun + randint1(20));
5123 if (p_ptr->resist_shard)
5127 else if (!CHECK_MULTISHADOW())
5129 (void)set_cut(p_ptr->cut + (dam / 2));
5132 if (!p_ptr->resist_shard || one_in_(12))
5134 inven_damage(set_cold_destroy, 3);
5137 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5141 /* Inertia -- slowness */
5144 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5145 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5146 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5150 /* Lite -- blinding */
5153 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5154 if (p_ptr->resist_lite)
5156 dam *= 4; dam /= (randint1(4) + 7);
5158 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5160 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5163 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
5165 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
5168 else if (prace_is_(RACE_S_FAIRY))
5173 if (p_ptr->wraith_form) dam *= 2;
5174 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5176 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
5178 p_ptr->wraith_form = 0;
5179 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
5180 "The light forces you out of your incorporeal shadow form."));
5182 p_ptr->redraw |= (PR_MAP | PR_STATUS);
5183 p_ptr->update |= (PU_MONSTERS);
5184 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
5190 /* Dark -- blinding */
5193 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5194 if (p_ptr->resist_dark)
5196 dam *= 4; dam /= (randint1(4) + 7);
5198 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
5200 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
5202 (void)set_blind(p_ptr->blind + randint1(5) + 2);
5204 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5208 /* Time -- bolt fewer effects XXX */
5211 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
5212 if (p_ptr->resist_time)
5215 dam /= (randint1(4) + 7);
5216 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
5218 else if (!CHECK_MULTISHADOW())
5220 switch (randint1(10))
5222 case 1: case 2: case 3: case 4: case 5:
5224 if (p_ptr->prace == RACE_ANDROID) break;
5225 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
5226 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
5230 case 6: case 7: case 8: case 9:
5232 switch (randint1(6))
5234 case 1: k = A_STR; act = _("強く", "strong"); break;
5235 case 2: k = A_INT; act = _("聡明で", "bright"); break;
5236 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
5237 case 4: k = A_DEX; act = _("器用で", "agile"); break;
5238 case 5: k = A_CON; act = _("健康で", "hale"); break;
5239 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
5242 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
5243 "You're not as %s as you used to be..."), act);
5245 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
5246 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5247 p_ptr->update |= (PU_BONUS);
5253 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
5254 "You're not as powerful as you used to be..."));
5256 for (k = 0; k < A_MAX; k++)
5258 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
5259 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
5261 p_ptr->update |= (PU_BONUS);
5267 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5271 /* Gravity -- stun plus slowness plus teleport */
5274 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
5275 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
5277 if (!CHECK_MULTISHADOW())
5279 teleport_player(5, TELEPORT_PASSIVE);
5280 if (!p_ptr->levitation)
5281 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5282 if (!(p_ptr->resist_sound || p_ptr->levitation))
5284 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
5285 (void)set_stun(p_ptr->stun + plus_stun);
5288 if (p_ptr->levitation)
5290 dam = (dam * 2) / 3;
5293 if (!p_ptr->levitation || one_in_(13))
5295 inven_damage(set_cold_destroy, 2);
5298 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5302 /* Standard damage */
5303 case GF_DISINTEGRATE:
5305 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
5307 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5313 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
5315 (void)hp_player(dam);
5322 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
5323 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
5330 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
5331 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5337 if (p_ptr->free_act) break;
5338 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
5340 if (ironman_nightmare)
5342 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
5343 /* Have some nightmares */
5344 sanity_blast(NULL, FALSE);
5347 set_paralyzed(p_ptr->paralyzed + dam);
5357 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
5358 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5365 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
5366 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
5373 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
5375 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5376 if (!p_ptr->resist_shard || one_in_(13))
5378 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
5379 inven_damage(set_cold_destroy, 2);
5385 /* Ice -- cold plus stun plus cuts */
5388 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
5389 get_damage = cold_dam(dam, killer, monspell, FALSE);
5390 if (!CHECK_MULTISHADOW())
5392 if (!p_ptr->resist_shard)
5394 (void)set_cut(p_ptr->cut + damroll(5, 8));
5396 if (!p_ptr->resist_sound)
5398 (void)set_stun(p_ptr->stun + randint1(15));
5401 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
5403 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
5413 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
5415 if (p_ptr->mimic_form)
5417 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
5418 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5423 switch (p_ptr->prace)
5425 /* Some races are immune */
5439 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5451 if (CHECK_MULTISHADOW())
5453 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
5455 else if (p_ptr->csp)
5459 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
5461 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
5464 if (dam >= p_ptr->csp)
5468 p_ptr->csp_frac = 0;
5477 learn_spell(monspell);
5478 p_ptr->redraw |= (PR_MANA);
5479 p_ptr->window |= (PW_PLAYER | PW_SPELL);
5483 /* Heal the monster */
5484 if (m_ptr->hp < m_ptr->maxhp)
5488 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
5490 /* Redraw (later) if needed */
5491 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
5492 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
5494 /* Special message */
5497 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
5510 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5512 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5513 learn_spell(monspell);
5517 if (!CHECK_MULTISHADOW())
5519 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5521 if (!p_ptr->resist_conf)
5523 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5526 if (!p_ptr->resist_chaos && one_in_(3))
5528 (void)set_image(p_ptr->image + randint0(250) + 150);
5535 p_ptr->csp_frac = 0;
5537 p_ptr->redraw |= PR_MANA;
5540 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5546 case GF_BRAIN_SMASH:
5548 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5550 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5551 learn_spell(monspell);
5555 if (!CHECK_MULTISHADOW())
5557 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5563 p_ptr->csp_frac = 0;
5565 p_ptr->redraw |= PR_MANA;
5568 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5569 if (!CHECK_MULTISHADOW())
5571 if (!p_ptr->resist_blind)
5573 (void)set_blind(p_ptr->blind + 8 + randint0(8));
5575 if (!p_ptr->resist_conf)
5577 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5579 if (!p_ptr->free_act)
5581 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
5583 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5585 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5586 (void)do_dec_stat(A_INT);
5587 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5588 (void)do_dec_stat(A_WIS);
5590 if (!p_ptr->resist_chaos)
5592 (void)set_image(p_ptr->image + randint0(250) + 150);
5602 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5604 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5605 learn_spell(monspell);
5609 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
5610 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5618 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5620 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5621 learn_spell(monspell);
5625 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
5626 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5634 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5636 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5637 learn_spell(monspell);
5641 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5642 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5650 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5652 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5653 learn_spell(monspell);
5657 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5658 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5666 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5668 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5669 learn_spell(monspell);
5673 if (!CHECK_MULTISHADOW())
5675 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5676 curse_equipment(40, 20);
5679 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5681 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
5696 /* Hex - revenge damage stored */
5697 revenge_store(get_damage);
5699 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5700 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5702 GAME_TEXT m_name_self[80];
5705 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5707 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5708 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5709 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5712 if (p_ptr->riding && dam > 0)
5714 rakubadam_p = (dam > 200) ? 200 : dam;
5718 disturb(TRUE, TRUE);
5721 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5723 (void)kawarimi(FALSE);
5726 /* Return "Anything seen?" */
5732 * Find the distance from (x, y) to a line.
5734 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5736 /* Vector from (x, y) to (x1, y1) */
5737 POSITION py = y1 - y;
5738 POSITION px = x1 - x;
5741 POSITION ny = x2 - x1;
5742 POSITION nx = y1 - y2;
5745 POSITION pd = distance(y1, x1, y, x);
5746 POSITION nd = distance(y1, x1, y2, x2);
5748 if (pd > nd) return distance(y, x, y2, x2);
5750 /* Component of P on N */
5751 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5753 /* Absolute value */
5754 return((nd >= 0) ? nd : 0 - nd);
5761 * Modified version of los() for calculation of disintegration balls.
5762 * Disintegration effects are stopped by permanent walls.
5764 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5766 POSITION dx, dy; /* Delta */
5767 POSITION ax, ay; /* Absolute */
5768 POSITION sx, sy; /* Signs */
5769 POSITION qx, qy; /* Fractions */
5770 POSITION tx, ty; /* Scanners */
5771 POSITION f1, f2; /* Scale factors */
5772 POSITION m; /* Slope, or 1/Slope, of LOS */
5774 /* Extract the offset */
5778 /* Extract the absolute offset */
5782 /* Handle adjacent (or identical) grids */
5783 if ((ax < 2) && (ay < 2)) return (TRUE);
5785 /* Paranoia -- require "safe" origin */
5786 /* if (!in_bounds(y1, x1)) return (FALSE); */
5788 /* Directly South/North */
5791 /* South -- check for walls */
5794 for (ty = y1 + 1; ty < y2; ty++)
5796 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5800 /* North -- check for walls */
5803 for (ty = y1 - 1; ty > y2; ty--)
5805 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5813 /* Directly East/West */
5816 /* East -- check for walls */
5819 for (tx = x1 + 1; tx < x2; tx++)
5821 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5825 /* West -- check for walls */
5828 for (tx = x1 - 1; tx > x2; tx--)
5830 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5838 /* Extract some signs */
5839 sx = (dx < 0) ? -1 : 1;
5840 sy = (dy < 0) ? -1 : 1;
5842 /* Vertical "knights" */
5847 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5851 /* Horizontal "knights" */
5856 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5860 /* Calculate scale factor div 2 */
5863 /* Calculate scale factor */
5867 /* Travel horizontally */
5870 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5876 /* Consider the special case where slope == 1. */
5887 /* Note (below) the case (qy == f2), where */
5888 /* the LOS exactly meets the corner of a tile. */
5891 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5902 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5915 /* Travel vertically */
5918 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5934 /* Note (below) the case (qx == f2), where */
5935 /* the LOS exactly meets the corner of a tile. */
5938 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5949 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5970 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)
5975 int brev = rad * rad / dist;
5979 int mdis = distance(y1, x1, y2, x2) + rad;
5981 while (bdis <= mdis)
5985 if ((0 < dist) && (path_n < dist))
5987 POSITION ny = GRID_Y(path_g[path_n]);
5988 POSITION nx = GRID_X(path_g[path_n]);
5989 POSITION nd = distance(ny, nx, y1, x1);
5991 /* Get next base point */
6000 /* Travel from center outward */
6001 for (cdis = 0; cdis <= brad; cdis++)
6003 /* Scan the maximal blast area of radius "cdis" */
6004 for (y = by - cdis; y <= by + cdis; y++)
6006 for (x = bx - cdis; x <= bx + cdis; x++)
6008 /* Ignore "illegal" locations */
6009 if (!in_bounds(y, x)) continue;
6011 /* Enforce a circular "ripple" */
6012 if (distance(y1, x1, y, x) != bdis) continue;
6014 /* Enforce an arc */
6015 if (distance(by, bx, y, x) != cdis) continue;
6021 /* Lights are stopped by opaque terrains */
6022 if (!los(by, bx, y, x)) continue;
6024 case GF_DISINTEGRATE:
6025 /* Disintegration are stopped only by perma-walls */
6026 if (!in_disintegration_range(by, bx, y, x)) continue;
6029 /* Ball explosions are stopped by walls */
6030 if (!projectable(by, bx, y, x)) continue;
6034 /* Save this grid */
6042 /* Encode some more "radius" info */
6043 gm[bdis + 1] = *pgrids;
6045 /* Increase the size */
6046 brad = rad * (path_n + brev) / (dist + brev);
6048 /* Find the next ripple */
6052 /* Store the effect size */
6058 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
6059 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
6060 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
6061 * @param y 目標Y座標 / Target y location (or location to travel "towards")
6062 * @param x 目標X座標 / Target x location (or location to travel "towards")
6063 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
6064 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
6065 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
6066 * @param monspell 効果元のモンスター魔法ID
6067 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
6070 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
6071 * towards a given location (optionally passing over the heads of interposing
6072 * monsters), and have it do a given amount of damage to the monsters (and
6073 * optionally objects) within the given radius of the final location.
6075 * A "bolt" travels from source to target and affects only the target grid.
6076 * A "beam" travels from source to target, affecting all grids passed through.
6077 * A "ball" travels from source to the target, exploding at the target, and
6078 * affecting everything within the given radius of the target location.
6080 * Traditionally, a "bolt" does not affect anything on the ground, and does
6081 * not pass over the heads of interposing monsters, much like a traditional
6082 * missile, and will "stop" abruptly at the "target" even if no monster is
6083 * positioned there, while a "ball", on the other hand, passes over the heads
6084 * of monsters between the source and target, and affects everything except
6085 * the source monster which lies within the final radius, while a "beam"
6086 * affects every monster between the source and target, except for the casting
6087 * monster (or player), and rarely affects things on the ground.
6089 * Two special flags allow us to use this function in special ways, the
6090 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
6091 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
6092 * actually projecting from the source monster (or player).
6094 * The player will only get "experience" for monsters killed by himself
6095 * Unique monsters can only be destroyed by attacks from the player
6097 * Only 256 grids can be affected per projection, limiting the effective
6098 * "radius" of standard ball attacks to nine units (diameter nineteen).
6100 * One can project in a given "direction" by combining PROJECT_THRU with small
6101 * offsets to the initial location (see "line_spell()"), or by calculating
6102 * "virtual targets" far away from the player.
6104 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
6105 * continuing until it actually hits somethings (useful for "stone to mud").
6107 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
6109 * Balls must explode BEFORE hitting walls, or they would affect monsters
6110 * on both sides of a wall. Some bug reports indicate that this is still
6111 * happening in 2.7.8 for Windows, though it appears to be impossible.
6113 * We "pre-calculate" the blast area only in part for efficiency.
6114 * More importantly, this lets us do "explosions" from the "inside" out.
6115 * This results in a more logical distribution of "blast" treasure.
6116 * It also produces a better (in my opinion) animation of the explosion.
6117 * It could be (but is not) used to have the treasure dropped by monsters
6118 * in the middle of the explosion fall "outwards", and then be damaged by
6119 * the blast as it spreads outwards towards the treasure drop location.
6121 * Walls and doors are included in the blast area, so that they can be
6122 * "burned" or "melted" in later versions.
6124 * This algorithm is intended to maximize simplicity, not necessarily
6125 * efficiency, since this function is not a bottleneck in the code.
6127 * We apply the blast effect from ground zero outwards, in several passes,
6128 * first affecting features, then objects, then monsters, then the player.
6129 * This allows walls to be removed before checking the object or monster
6130 * in the wall, and protects objects which are dropped by monsters killed
6131 * in the blast, and allows the player to see all affects before he is
6132 * killed or teleported away. The semantics of this method are open to
6133 * various interpretations, but they seem to work well in practice.
6135 * We process the blast area from ground-zero outwards to allow for better
6136 * distribution of treasure dropped by monsters, and because it provides a
6137 * pleasing visual effect at low cost.
6139 * Note that the damage done by "ball" explosions decreases with distance.
6140 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
6142 * Notice the "napalm" effect of "beam" weapons. First they "project" to
6143 * the target, and then the damage "flows" along this beam of destruction.
6144 * The damage at every grid is the same as at the "center" of a "ball"
6145 * explosion, since the "beam" grids are treated as if they ARE at the
6146 * center of a "ball" explosion.
6148 * Currently, specifying "beam" plus "ball" means that locations which are
6149 * covered by the initial "beam", and also covered by the final "ball", except
6150 * for the final grid (the epicenter of the ball), will be "hit twice", once
6151 * by the initial beam, and once by the exploding ball. For the grid right
6152 * next to the epicenter, this results in 150% damage being done. The center
6153 * does not have this problem, for the same reason the final grid in a "beam"
6154 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
6155 * grids which are covered by the "ball" will NOT work, as then they will
6156 * receive LESS damage than they should. Do not combine "beam" with "ball".
6158 * The array "gy[],gx[]" with current size "grids" is used to hold the
6159 * collected locations of all grids in the "blast area" plus "beam path".
6161 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
6162 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
6163 * first blast grid (see above) with radius "N" from the blast center. Note
6164 * that only the first gm[1] grids in the blast area thus take full damage.
6165 * Also, note that gm[rad+1] is always equal to "grids", which is the total
6166 * number of blast grids.
6168 * Note that once the projection is complete, (y2,x2) holds the final location
6169 * of bolts/beams, and the "epicenter" of balls.
6171 * Note also that "rad" specifies the "inclusive" radius of projection blast,
6172 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
6173 * implementation of the "distance" function. Also, a bolt can be properly
6174 * viewed as a "ball" with a "rad" of "zero".
6176 * Note that if no "target" is reached before the beam/bolt/ball travels the
6177 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
6178 * may be relevant even for bolts, since they have a "1x1" mini-blast.
6180 * Note that for consistency, we "pretend" that the bolt actually takes "time"
6181 * to move from point A to point B, even if the player cannot see part of the
6182 * projection path. Note that in general, the player will *always* see part
6183 * of the path, since it either starts at the player or ends on the player.
6185 * Hack -- we assume that every "projection" is "self-illuminating".
6187 * Hack -- when only a single monster is affected, we automatically track
6188 * (and recall) that monster, unless "PROJECT_JUMP" is used.
6190 * Note that all projections now "explode" at their final destination, even
6191 * if they were being projected at a more distant destination. This means
6192 * that "ball" spells will *always* explode.
6194 * Note that we must call "handle_stuff()" after affecting terrain features
6195 * in the blast radius, in case the "illumination" of the grid was changed,
6196 * and "update_view()" and "update_monsters()" need to be called.
6199 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
6209 POSITION y_saver, x_saver; /* For reflecting monsters */
6211 int msec = delay_factor * delay_factor * delay_factor;
6213 /* Assume the player sees nothing */
6214 bool notice = FALSE;
6216 /* Assume the player has seen nothing */
6217 bool visual = FALSE;
6219 /* Assume the player has seen no blast grids */
6222 /* Assume to be a normal ball spell */
6223 bool breath = FALSE;
6225 /* Is the player blind? */
6226 bool blind = (p_ptr->blind ? TRUE : FALSE);
6228 bool old_hide = FALSE;
6230 /* Number of grids in the "path" */
6233 /* Actual grids in the "path" */
6236 /* Number of grids in the "blast area" (including the "beam" path) */
6239 /* Coordinates of the affected grids */
6240 POSITION gx[1024], gy[1024];
6242 /* Encoded "radius" info (see above) */
6245 /* Actual radius encoded in gm[] */
6246 POSITION gm_rad = rad;
6250 /* Attacker's name (prepared before polymorph)*/
6251 GAME_TEXT who_name[MAX_NLEN];
6253 /* Can the player see the source of this effect? */
6254 bool see_s_msg = TRUE;
6256 /* Initialize by null string */
6262 /* Default target of monsterspell is player */
6263 monster_target_y = p_ptr->y;
6264 monster_target_x = p_ptr->x;
6266 /* Hack -- Jump to target */
6267 if (flg & (PROJECT_JUMP))
6272 /* Clear the flag */
6273 flg &= ~(PROJECT_JUMP);
6278 /* Start at player */
6285 /* Start at monster */
6288 x1 = m_list[who].fx;
6289 y1 = m_list[who].fy;
6290 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
6302 /* Default "destination" */
6307 /* Hack -- verify stuff */
6308 if (flg & (PROJECT_THRU))
6310 if ((x1 == x2) && (y1 == y2))
6312 flg &= ~(PROJECT_THRU);
6316 /* Handle a breath attack */
6321 if (flg & PROJECT_HIDE) old_hide = TRUE;
6322 flg |= PROJECT_HIDE;
6326 /* Hack -- Assume there will be no blast (max radius 32) */
6327 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
6335 /* Collect beam grids */
6336 if (flg & (PROJECT_BEAM))
6347 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
6349 case GF_DISINTEGRATE:
6350 flg |= (PROJECT_GRID);
6351 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
6355 /* Calculate the projection path */
6357 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
6360 /* Giga-Hack SEEKER & SUPER_RAY */
6362 if( typ == GF_SEEKER )
6372 for (i = 0; i < path_n; ++i)
6377 POSITION ny = GRID_Y(path_g[i]);
6378 POSITION nx = GRID_X(path_g[i]);
6389 /* Only do visuals if requested */
6390 if (!blind && !(flg & (PROJECT_HIDE)))
6392 /* Only do visuals if the player can "see" the bolt */
6393 if (panel_contains(y, x) && player_has_los_bold(y, x))
6400 /* Obtain the bolt pict */
6401 p = bolt_pict(oy, ox, y, x, typ);
6403 /* Extract attr/char */
6407 /* Visual effects */
6408 print_rel(c, a, y, x);
6409 move_cursor_relative(y, x);
6410 /*if (fresh_before)*/ Term_fresh();
6411 Term_xtra(TERM_XTRA_DELAY, msec);
6413 /*if (fresh_before)*/ Term_fresh();
6415 /* Display "beam" grids */
6416 if (flg & (PROJECT_BEAM))
6418 /* Obtain the explosion pict */
6419 p = bolt_pict(y, x, y, x, typ);
6421 /* Extract attr/char */
6425 /* Visual effects */
6426 print_rel(c, a, y, x);
6429 /* Hack -- Activate delay */
6433 /* Hack -- delay anyway for consistency */
6436 /* Delay for consistency */
6437 Term_xtra(TERM_XTRA_DELAY, msec);
6440 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
6441 if (is_mirror_grid(&grid_array[y][x]))
6443 /* The target of monsterspell becomes tha mirror(broken) */
6444 monster_target_y = y;
6445 monster_target_x = x;
6447 remove_mirror(y, x);
6448 next_mirror(&oy, &ox, y, x);
6450 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
6451 for (j = last_i; j <= i; j++)
6453 y = GRID_Y(path_g[j]);
6454 x = GRID_X(path_g[j]);
6455 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
6456 if (!who && (project_m_n == 1) && !jump) {
6457 if (grid_array[project_m_y][project_m_x].m_idx > 0) {
6458 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6462 /* Hack -- auto-recall */
6463 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6465 /* Hack - auto-track */
6466 health_track(grid_array[project_m_y][project_m_x].m_idx);
6470 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
6475 for(i = last_i ; i < path_n ; i++)
6478 py = GRID_Y(path_g[i]);
6479 px = GRID_X(path_g[i]);
6480 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
6482 if (!who && (project_m_n == 1) && !jump) {
6483 if (grid_array[project_m_y][project_m_x].m_idx > 0)
6485 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6489 /* Hack -- auto-recall */
6490 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6492 /* Hack - auto-track */
6493 health_track(grid_array[project_m_y][project_m_x].m_idx);
6497 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
6501 else if(typ == GF_SUPER_RAY){
6503 int second_step = 0;
6510 for (i = 0; i < path_n; ++i)
6515 POSITION ny = GRID_Y(path_g[i]);
6516 POSITION nx = GRID_X(path_g[i]);
6527 /* Only do visuals if requested */
6528 if (!blind && !(flg & (PROJECT_HIDE)))
6530 /* Only do visuals if the player can "see" the bolt */
6531 if (panel_contains(y, x) && player_has_los_bold(y, x))
6538 /* Obtain the bolt pict */
6539 p = bolt_pict(oy, ox, y, x, typ);
6541 /* Extract attr/char */
6545 /* Visual effects */
6546 print_rel(c, a, y, x);
6547 move_cursor_relative(y, x);
6548 /*if (fresh_before)*/ Term_fresh();
6549 Term_xtra(TERM_XTRA_DELAY, msec);
6551 /*if (fresh_before)*/ Term_fresh();
6553 /* Display "beam" grids */
6554 if (flg & (PROJECT_BEAM))
6556 /* Obtain the explosion pict */
6557 p = bolt_pict(y, x, y, x, typ);
6559 /* Extract attr/char */
6563 /* Visual effects */
6564 print_rel(c, a, y, x);
6567 /* Hack -- Activate delay */
6571 /* Hack -- delay anyway for consistency */
6574 /* Delay for consistency */
6575 Term_xtra(TERM_XTRA_DELAY, msec);
6578 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
6579 if (!cave_have_flag_bold(y, x, FF_PROJECT))
6581 if( second_step )continue;
6584 if( is_mirror_grid(&grid_array[y][x]) && !second_step )
6586 /* The target of monsterspell becomes tha mirror(broken) */
6587 monster_target_y=(s16b)y;
6588 monster_target_x=(s16b)x;
6591 for( j = 0; j <=i ; j++ )
6593 y = GRID_Y(path_g[j]);
6594 x = GRID_X(path_g[j]);
6595 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
6599 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
6600 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
6601 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
6602 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
6603 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
6604 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
6605 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
6606 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
6609 for( i = 0; i < path_n ; i++ )
6612 py = GRID_Y(path_g[i]);
6613 px = GRID_X(path_g[i]);
6614 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
6615 if(!who && (project_m_n == 1) && !jump){
6616 if(grid_array[project_m_y][project_m_x].m_idx >0 ){
6617 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6621 /* Hack -- auto-recall */
6622 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6624 /* Hack - auto-track */
6625 health_track(grid_array[project_m_y][project_m_x].m_idx);
6629 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
6634 /* Project along the path */
6635 for (i = 0; i < path_n; ++i)
6640 POSITION ny = GRID_Y(path_g[i]);
6641 POSITION nx = GRID_X(path_g[i]);
6643 if (flg & PROJECT_DISI)
6645 /* Hack -- Balls explode before reaching walls */
6646 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
6648 else if (flg & PROJECT_LOS)
6650 /* Hack -- Balls explode before reaching walls */
6651 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6655 /* Hack -- Balls explode before reaching walls */
6656 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6663 /* Collect beam grids */
6664 if (flg & (PROJECT_BEAM))
6671 /* Only do visuals if requested */
6672 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6674 /* Only do visuals if the player can "see" the bolt */
6675 if (panel_contains(y, x) && player_has_los_bold(y, x))
6682 /* Obtain the bolt pict */
6683 p = bolt_pict(oy, ox, y, x, typ);
6685 /* Extract attr/char */
6689 /* Visual effects */
6690 print_rel(c, a, y, x);
6691 move_cursor_relative(y, x);
6692 /*if (fresh_before)*/ Term_fresh();
6693 Term_xtra(TERM_XTRA_DELAY, msec);
6695 /*if (fresh_before)*/ Term_fresh();
6697 /* Display "beam" grids */
6698 if (flg & (PROJECT_BEAM))
6700 /* Obtain the explosion pict */
6701 p = bolt_pict(y, x, y, x, typ);
6703 /* Extract attr/char */
6707 /* Visual effects */
6708 print_rel(c, a, y, x);
6711 /* Hack -- Activate delay */
6715 /* Hack -- delay anyway for consistency */
6718 /* Delay for consistency */
6719 Term_xtra(TERM_XTRA_DELAY, msec);
6726 /* Save the "blast epicenter" */
6730 if (breath && !path_n)
6736 flg &= ~(PROJECT_HIDE);
6740 /* Start the "explosion" */
6743 /* Hack -- make sure beams get to "explode" */
6751 /* If we found a "target", explode there */
6752 if (dist <= MAX_RANGE)
6754 /* Mega-Hack -- remove the final "beam" grid */
6755 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6758 * Create a conical breath attack
6769 flg &= ~(PROJECT_HIDE);
6771 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6775 /* Determine the blast area, work from the inside out */
6776 for (dist = 0; dist <= rad; dist++)
6778 /* Scan the maximal blast area of radius "dist" */
6779 for (y = by - dist; y <= by + dist; y++)
6781 for (x = bx - dist; x <= bx + dist; x++)
6783 /* Ignore "illegal" locations */
6784 if (!in_bounds2(y, x)) continue;
6786 /* Enforce a "circular" explosion */
6787 if (distance(by, bx, y, x) != dist) continue;
6793 /* Lights are stopped by opaque terrains */
6794 if (!los(by, bx, y, x)) continue;
6796 case GF_DISINTEGRATE:
6797 /* Disintegration are stopped only by perma-walls */
6798 if (!in_disintegration_range(by, bx, y, x)) continue;
6801 /* Ball explosions are stopped by walls */
6802 if (!projectable(by, bx, y, x)) continue;
6806 /* Save this grid */
6813 /* Encode some more "radius" info */
6819 /* Speed -- ignore "non-explosions" */
6820 if (!grids) return (FALSE);
6823 /* Display the "blast area" if requested */
6824 if (!blind && !(flg & (PROJECT_HIDE)))
6826 /* Then do the "blast", from inside out */
6827 for (t = 0; t <= gm_rad; t++)
6829 /* Dump everything with this radius */
6830 for (i = gm[t]; i < gm[t+1]; i++)
6832 /* Extract the location */
6836 /* Only do visuals if the player can "see" the blast */
6837 if (panel_contains(y, x) && player_has_los_bold(y, x))
6846 /* Obtain the explosion pict */
6847 p = bolt_pict(y, x, y, x, typ);
6849 /* Extract attr/char */
6853 /* Visual effects -- Display */
6854 print_rel(c, a, y, x);
6858 /* Hack -- center the cursor */
6859 move_cursor_relative(by, bx);
6861 /* Flush each "radius" seperately */
6862 /*if (fresh_before)*/ Term_fresh();
6864 /* Delay (efficiently) */
6865 if (visual || drawn)
6867 Term_xtra(TERM_XTRA_DELAY, msec);
6871 /* Flush the erasing */
6874 /* Erase the explosion drawn above */
6875 for (i = 0; i < grids; i++)
6877 /* Extract the location */
6881 /* Hack -- Erase if needed */
6882 if (panel_contains(y, x) && player_has_los_bold(y, x))
6888 /* Hack -- center the cursor */
6889 move_cursor_relative(by, bx);
6891 /* Flush the explosion */
6892 /*if (fresh_before)*/ Term_fresh();
6896 update_creature(p_ptr);
6898 if (flg & PROJECT_KILL)
6900 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
6901 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6905 /* Check features */
6906 if (flg & (PROJECT_GRID))
6908 /* Start with "dist" of zero */
6911 /* Scan for features */
6912 for (i = 0; i < grids; i++)
6914 /* Hack -- Notice new "dist" values */
6915 if (gm[dist+1] == i) dist++;
6917 /* Get the grid location */
6921 /* Find the closest point in the blast */
6924 int d = dist_to_line(y, x, y1, x1, by, bx);
6926 /* Affect the grid */
6927 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6931 /* Affect the grid */
6932 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6937 update_creature(p_ptr);
6940 if (flg & (PROJECT_ITEM))
6942 /* Start with "dist" of zero */
6945 /* Scan for objects */
6946 for (i = 0; i < grids; i++)
6948 /* Hack -- Notice new "dist" values */
6949 if (gm[dist+1] == i) dist++;
6951 /* Get the grid location */
6955 /* Find the closest point in the blast */
6958 int d = dist_to_line(y, x, y1, x1, by, bx);
6960 /* Affect the object in the grid */
6961 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6965 /* Affect the object in the grid */
6966 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6972 /* Check monsters */
6973 if (flg & (PROJECT_KILL))
6980 /* Start with "dist" of zero */
6983 /* Scan for monsters */
6984 for (i = 0; i < grids; i++)
6988 /* Hack -- Notice new "dist" values */
6989 if (gm[dist + 1] == i) dist++;
6991 /* Get the grid location */
6995 /* A single bolt may be reflected */
6998 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6999 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
7001 if ((flg & PROJECT_REFLECTABLE) && grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
7002 ((grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
7003 (!who || dist_hack > 1) && !one_in_(10))
7006 int max_attempts = 10;
7008 /* Choose 'new' target */
7011 t_y = y_saver - 1 + randint1(3);
7012 t_x = x_saver - 1 + randint1(3);
7015 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
7017 if (max_attempts < 1)
7023 sound(SOUND_REFLECT);
7026 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
7027 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
7028 else if (m_ptr->r_idx == MON_DIO)
7029 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
7031 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
7033 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
7035 /* Reflected bolts randomly target either one */
7036 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
7037 else flg |= PROJECT_PLAYER;
7039 /* The bolt is reflected */
7040 project(grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
7042 /* Don't affect the monster any longer */
7048 /* Find the closest point in the blast */
7051 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7055 effective_dist = dist;
7059 /* There is the riding player on this monster */
7060 if (p_ptr->riding && player_bold(y, x))
7062 /* Aimed on the player */
7063 if (flg & PROJECT_PLAYER)
7065 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7068 * A beam or bolt is well aimed
7070 * So don't affects the mount.
7077 * The spell is not well aimed,
7078 * So partly affect the mount too.
7085 * This grid is the original target.
7086 * Or aimed on your horse.
7088 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
7090 /* Hit the mount with full damage */
7094 * Otherwise this grid is not the
7095 * original target, it means that line
7096 * of fire is obstructed by this
7100 * A beam or bolt will hit either
7101 * player or mount. Choose randomly.
7103 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
7107 /* Hit the mount with full damage */
7111 /* Hit the player later */
7112 flg |= PROJECT_PLAYER;
7114 /* Don't affect the mount */
7120 * The spell is not well aimed, so
7121 * partly affect both player and
7130 /* Affect the monster in the grid */
7131 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
7135 /* Player affected one monster (without "jumping") */
7136 if (!who && (project_m_n == 1) && !jump)
7141 /* Track if possible */
7142 if (grid_array[y][x].m_idx > 0)
7144 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
7148 /* Hack -- auto-recall */
7149 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
7151 /* Hack - auto-track */
7152 if (m_ptr->ml) health_track(grid_array[y][x].m_idx);
7160 if (flg & (PROJECT_KILL))
7162 /* Start with "dist" of zero */
7165 /* Scan for player */
7166 for (i = 0; i < grids; i++)
7170 /* Hack -- Notice new "dist" values */
7171 if (gm[dist+1] == i) dist++;
7173 /* Get the grid location */
7177 /* Affect the player? */
7178 if (!player_bold(y, x)) continue;
7180 /* Find the closest point in the blast */
7183 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
7187 effective_dist = dist;
7190 /* Target may be your horse */
7193 /* Aimed on the player */
7194 if (flg & PROJECT_PLAYER)
7196 /* Hit the player with full damage */
7200 * Hack -- When this grid was not the
7201 * original target, a beam or bolt
7202 * would hit either player or mount,
7203 * and should be choosen randomly.
7205 * But already choosen to hit the
7206 * mount at this point.
7208 * Or aimed on your horse.
7210 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
7213 * A beam or bolt is well aimed
7215 * So don't affects the player.
7222 * The spell is not well aimed,
7223 * So partly affect the player too.
7229 /* Affect the player */
7230 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
7236 GAME_TEXT m_name[MAX_NLEN];
7238 monster_desc(m_name, &m_list[p_ptr->riding], 0);
7240 if (rakubadam_m > 0)
7242 if (rakuba(rakubadam_m, FALSE))
7244 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
7247 if (p_ptr->riding && rakubadam_p > 0)
7249 if(rakuba(rakubadam_p, FALSE))
7251 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
7256 /* Return "something was noticed" */
7261 * @brief 鏡魔法「封魔結界」の効果処理
7263 * @return 効果があったらTRUEを返す
7265 bool binding_field(HIT_POINT dam)
7267 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
7268 int mirror_num = 0; /* 鏡の数 */
7270 POSITION centersign;
7271 POSITION x1, x2, y1, y2;
7273 int msec = delay_factor*delay_factor*delay_factor;
7276 POSITION point_x[3];
7277 POSITION point_y[3];
7279 /* Default target of monsterspell is player */
7280 monster_target_y = p_ptr->y;
7281 monster_target_x = p_ptr->x;
7283 for (x = 0; x < cur_wid; x++)
7285 for (y = 0; y < cur_hgt; y++)
7287 if (is_mirror_grid(&grid_array[y][x]) &&
7288 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
7289 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
7290 player_has_los_bold(y, x) &&
7291 projectable(p_ptr->y, p_ptr->x, y, x)
7293 mirror_y[mirror_num] = y;
7294 mirror_x[mirror_num] = x;
7300 if (mirror_num < 2)return FALSE;
7302 point_x[0] = randint0(mirror_num);
7304 point_x[1] = randint0(mirror_num);
7305 } while (point_x[0] == point_x[1]);
7307 point_y[0] = mirror_y[point_x[0]];
7308 point_x[0] = mirror_x[point_x[0]];
7309 point_y[1] = mirror_y[point_x[1]];
7310 point_x[1] = mirror_x[point_x[1]];
7311 point_y[2] = p_ptr->y;
7312 point_x[2] = p_ptr->x;
7314 x = point_x[0] + point_x[1] + point_x[2];
7315 y = point_y[0] + point_y[1] + point_y[2];
7317 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
7318 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
7319 if (centersign == 0)return FALSE;
7321 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
7322 x1 = x1 < point_x[2] ? x1 : point_x[2];
7323 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
7324 y1 = y1 < point_y[2] ? y1 : point_y[2];
7326 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
7327 x2 = x2 > point_x[2] ? x2 : point_x[2];
7328 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
7329 y2 = y2 > point_y[2] ? y2 : point_y[2];
7331 for (y = y1; y <= y2; y++) {
7332 for (x = x1; x <= x2; x++) {
7333 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7334 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7335 centersign*((point_x[1] - x)*(point_y[2] - y)
7336 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7337 centersign*((point_x[2] - x)*(point_y[0] - y)
7338 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7340 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7341 /* Visual effects */
7343 && panel_contains(y, x)) {
7344 p = bolt_pict(y, x, y, x, GF_MANA);
7345 print_rel(PICT_C(p), PICT_A(p), y, x);
7346 move_cursor_relative(y, x);
7347 /*if (fresh_before)*/ Term_fresh();
7348 Term_xtra(TERM_XTRA_DELAY, msec);
7354 for (y = y1; y <= y2; y++) {
7355 for (x = x1; x <= x2; x++) {
7356 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7357 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7358 centersign*((point_x[1] - x)*(point_y[2] - y)
7359 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7360 centersign*((point_x[2] - x)*(point_y[0] - y)
7361 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7363 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7364 (void)project_f(0, 0, y, x, dam, GF_MANA);
7369 for (y = y1; y <= y2; y++) {
7370 for (x = x1; x <= x2; x++) {
7371 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7372 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7373 centersign*((point_x[1] - x)*(point_y[2] - y)
7374 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7375 centersign*((point_x[2] - x)*(point_y[0] - y)
7376 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7378 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7379 (void)project_o(0, 0, y, x, dam, GF_MANA);
7384 for (y = y1; y <= y2; y++) {
7385 for (x = x1; x <= x2; x++) {
7386 if (centersign*((point_x[0] - x)*(point_y[1] - y)
7387 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
7388 centersign*((point_x[1] - x)*(point_y[2] - y)
7389 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
7390 centersign*((point_x[2] - x)*(point_y[0] - y)
7391 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
7393 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
7394 (void)project_m(0, 0, y, x, dam, GF_MANA,
7395 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
7401 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
7402 remove_mirror(point_y[0], point_x[0]);
7409 * @brief 鏡魔法「鏡の封印」の効果処理
7411 * @return 効果があったらTRUEを返す
7413 void seal_of_mirror(HIT_POINT dam)
7417 for (x = 0; x < cur_wid; x++)
7419 for (y = 0; y < cur_hgt; y++)
7421 if (is_mirror_grid(&grid_array[y][x]))
7423 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
7424 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
7426 if (!grid_array[y][x].m_idx)
7428 remove_mirror(y, x);
7440 * @brief 領域魔法に応じて技能の名称を返す。
7441 * @param tval 魔法書のtval
7442 * @return 領域魔法の技能名称を保管した文字列ポインタ
7444 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
7448 case TV_HISSATSU_BOOK:
7449 return _("必殺技", "art");
7451 return _("祈り", "prayer");
7453 return _("歌", "song");
7455 return _("呪文", "spell");