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-status.h"
23 #include "spells-diceroll.h"
24 #include "spells-summon.h"
25 #include "monsterrace-hook.h"
29 #include "projection.h"
34 #include "player-status.h"
35 #include "player-move.h"
36 #include "realm-hex.h"
37 #include "object-hook.h"
38 #include "object-broken.h"
44 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
45 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
47 int project_length = 0; /*!< 投射の射程距離 */
52 * @brief 配置した鏡リストの次を取得する /
53 * Get another mirror. for SEEKER
54 * @param next_y 次の鏡のy座標を返す参照ポインタ
55 * @param next_x 次の鏡のx座標を返す参照ポインタ
56 * @param cury 現在の鏡のy座標
57 * @param curx 現在の鏡のx座標
59 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
61 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
62 int mirror_num = 0; /* 鏡の数 */
66 for (x = 0; x < current_floor_ptr->width; x++)
68 for (y = 0; y < current_floor_ptr->height; y++)
70 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
71 mirror_y[mirror_num] = y;
72 mirror_x[mirror_num] = x;
79 num = randint0(mirror_num);
80 *next_y = mirror_y[num];
81 *next_x = mirror_x[num];
84 *next_y = cury + randint0(5) - 2;
85 *next_x = curx + randint0(5) - 2;
91 * Mega-Hack -- track "affected" monsters (see "project()" comments)
93 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
94 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
95 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
96 /* Mega-Hack -- monsters target */
97 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
98 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
102 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
103 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
104 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
105 * @param y 目標Y座標 / Target y location (or location to travel "towards")
106 * @param x 目標X座標 / Target x location (or location to travel "towards")
107 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
108 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
109 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
112 * We are called both for "beam" effects and "ball" effects.
114 * The "r" parameter is the "distance from ground zero".
116 * Note that we determine if the player can "see" anything that happens
117 * by taking into account: blindness, line-of-sight, and illumination.
119 * We return "TRUE" if the effect of the projection is "obvious".
121 * We also "see" grids which are "memorized", probably a hack
123 * Perhaps we should affect doors?
126 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
128 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
129 feature_type *f_ptr = &f_info[g_ptr->feat];
131 bool obvious = FALSE;
132 bool known = player_has_los_bold(y, x);
137 /* Reduce damage by distance */
138 dam = (dam + r) / (r + 1);
141 if (have_flag(f_ptr->flags, FF_TREE))
149 message = _("枯れた", "was blasted."); break;
151 message = _("縮んだ", "shrank."); break;
153 message = _("溶けた", "melted."); break;
156 message = _("凍り、砕け散った", "was frozen and smashed."); break;
160 message = _("燃えた", "burns up!"); break;
172 message = _("粉砕された", "was crushed."); break;
174 message = NULL; break;
178 msg_format(_("木は%s。", "A tree %s"), message);
179 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
182 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
186 /* Analyze the type */
189 /* Ignore most effects */
224 /* Destroy Traps (and Locks) */
227 /* Reveal secret doors */
228 if (is_hidden_door(g_ptr))
233 /* Check line of sight */
241 if (is_trap(g_ptr->feat))
243 /* Check line of sight */
246 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
250 /* Destroy the trap */
251 cave_alter_feat(y, x, FF_DISARM);
254 /* Locked doors are unlocked */
255 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
257 FEAT_IDX old_feat = g_ptr->feat;
259 /* Unlock the door */
260 cave_alter_feat(y, x, FF_DISARM);
262 /* Check line of sound */
263 if (known && (old_feat != g_ptr->feat))
265 msg_print(_("カチッと音がした!", "Click!"));
270 /* Remove "unsafe" flag if player is not blind */
271 if (!p_ptr->blind && player_has_los_bold(y, x))
273 g_ptr->info &= ~(CAVE_UNSAFE);
281 /* Destroy Doors (and traps) */
284 /* Destroy all doors and traps */
285 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
287 /* Check line of sight */
290 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
294 /* Destroy the feature */
295 cave_alter_feat(y, x, FF_TUNNEL);
298 /* Remove "unsafe" flag if player is not blind */
299 if (!p_ptr->blind && player_has_los_bold(y, x))
301 g_ptr->info &= ~(CAVE_UNSAFE);
309 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
311 if (have_flag(f_ptr->flags, FF_SPIKE))
313 s16b old_mimic = g_ptr->mimic;
314 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
316 cave_alter_feat(y, x, FF_SPIKE);
317 g_ptr->mimic = old_mimic;
322 /* Check line of sight */
323 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
325 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
332 /* Destroy walls (and doors) */
335 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
337 if (known && (g_ptr->info & (CAVE_MARK)))
339 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
343 /* Destroy the wall */
344 cave_alter_feat(y, x, FF_HURT_ROCK);
345 p_ptr->update |= (PU_FLOW);
353 if (!cave_naked_bold(y, x)) break;
354 if (player_bold(y, x)) break;
355 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
356 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
368 if (!cave_naked_bold(y, x)) break;
369 if (player_bold(y, x)) break;
370 cave_set_feat(y, x, feat_tree);
371 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
377 if (!cave_naked_bold(y, x)) break;
378 g_ptr->info |= CAVE_OBJECT;
379 g_ptr->mimic = feat_glyph;
387 if (!cave_naked_bold(y, x)) break;
388 if (player_bold(y, x)) break;
389 cave_set_feat(y, x, feat_granite);
395 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
398 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
399 cave_set_feat(y, x, feat_shallow_lava);
403 cave_set_feat(y, x, feat_deep_lava);
410 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
413 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
414 cave_set_feat(y, x, feat_shallow_water);
418 cave_set_feat(y, x, feat_deep_water);
423 /* Lite up the grid */
427 /* Turn on the light */
428 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
430 g_ptr->info |= (CAVE_GLOW);
433 update_local_illumination(y, x);
436 if (player_can_see_bold(y, x)) obvious = TRUE;
438 /* Mega-Hack -- Update the monster in the affected grid */
439 /* This allows "spear of light" (etc) to work "correctly" */
440 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
442 if (p_ptr->special_defense & NINJA_S_STEALTH)
444 if (player_bold(y, x)) set_superstealth(FALSE);
451 /* Darken the grid */
455 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
458 /* Turn off the light. */
461 if (current_floor_ptr->dun_level || !is_daytime())
463 for (j = 0; j < 9; j++)
465 int by = y + ddy_ddd[j];
466 int bx = x + ddx_ddd[j];
468 if (in_bounds2(by, bx))
470 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
472 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
483 g_ptr->info &= ~(CAVE_GLOW);
485 /* Hack -- Forget "boring" grids */
486 if (!have_flag(f_ptr->flags, FF_REMEMBER))
489 g_ptr->info &= ~(CAVE_MARK);
496 update_local_illumination(y, x);
498 if (player_can_see_bold(y, x)) obvious = TRUE;
500 /* Mega-Hack -- Update the monster in the affected grid */
501 /* This allows "spear of light" (etc) to work "correctly" */
502 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
512 if (is_mirror_grid(g_ptr))
514 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
517 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
520 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
522 if (known && (g_ptr->info & CAVE_MARK))
524 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
528 /* Destroy the wall */
529 cave_alter_feat(y, x, FF_HURT_ROCK);
530 p_ptr->update |= (PU_FLOW);
537 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
539 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
542 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
545 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
547 if (known && (g_ptr->info & CAVE_MARK))
549 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
553 /* Destroy the wall */
554 cave_alter_feat(y, x, FF_HURT_ROCK);
555 p_ptr->update |= (PU_FLOW);
560 case GF_DISINTEGRATE:
562 /* Destroy mirror/glyph */
563 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
566 /* Permanent features don't get effect */
567 /* But not protect monsters and other objects */
568 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
570 cave_alter_feat(y, x, FF_HURT_DISI);
572 /* Update some things -- similar to GF_KILL_WALL */
573 p_ptr->update |= (PU_FLOW);
580 /* Return "Anything seen?" */
587 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
588 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
589 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
590 * @param y 目標Y座標 / Target y location (or location to travel "towards")
591 * @param x 目標X座標 / Target x location (or location to travel "towards")
592 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
593 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
594 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
597 * We are called from "project()" to "damage" objects
599 * We are called both for "beam" effects and "ball" effects.
601 * Perhaps we should only SOMETIMES damage things on the ground.
603 * The "r" parameter is the "distance from ground zero".
605 * Note that we determine if the player can "see" anything that happens
606 * by taking into account: blindness, line-of-sight, and illumination.
608 * We also "see" grids which are "memorized", probably a hack
610 * We return "TRUE" if the effect of the projection is "obvious".
613 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
615 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
617 OBJECT_IDX this_o_idx, next_o_idx = 0;
619 bool obvious = FALSE;
620 bool known = player_has_los_bold(y, x);
622 BIT_FLAGS flgs[TR_FLAG_SIZE];
624 GAME_TEXT o_name[MAX_NLEN];
626 KIND_OBJECT_IDX k_idx = 0;
627 bool is_potion = FALSE;
632 /* Reduce damage by distance */
633 dam = (dam + r) / (r + 1);
636 /* Scan all objects in the grid */
637 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
639 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
643 bool do_kill = FALSE;
645 concptr note_kill = NULL;
648 /* Get the "plural"-ness */
649 bool plural = (o_ptr->number > 1);
651 next_o_idx = o_ptr->next_o_idx;
652 object_flags(o_ptr, flgs);
654 /* Check for artifact */
655 if (object_is_artifact(o_ptr)) is_art = TRUE;
657 /* Analyze the type */
660 /* Acid -- Lots of things */
663 if (hates_acid(o_ptr))
666 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
667 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
672 /* Elec -- Rings and Wands */
675 if (hates_elec(o_ptr))
678 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
679 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
684 /* Fire -- Flammable objects */
687 if (hates_fire(o_ptr))
690 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
691 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
696 /* Cold -- potions and flasks */
699 if (hates_cold(o_ptr))
701 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
703 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
711 if (hates_fire(o_ptr))
714 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
715 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
717 if (hates_elec(o_ptr))
721 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
722 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
730 if (hates_fire(o_ptr))
733 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
734 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
736 if (hates_cold(o_ptr))
740 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
741 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
746 /* Hack -- break potions and such */
752 if (hates_cold(o_ptr))
754 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
760 /* Mana and Chaos -- destroy everything */
766 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
770 case GF_DISINTEGRATE:
773 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
780 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
781 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
782 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
786 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
790 if (object_is_cursed(o_ptr))
793 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
800 identify_item(o_ptr);
802 /* Auto-inscription */
803 autopick_alter_item((-this_o_idx), FALSE);
811 /* Chests are noticed only if trapped or locked */
812 if (o_ptr->tval == TV_CHEST)
814 /* Disarm/Unlock traps */
817 /* Disarm or Unlock */
818 o_ptr->pval = (0 - o_ptr->pval);
823 if (known && (o_ptr->marked & OM_FOUND))
825 msg_print(_("カチッと音がした!", "Click!"));
835 if (o_ptr->tval == TV_CORPSE)
840 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
841 mode |= PM_FORCE_PET;
843 for (i = 0; i < o_ptr->number ; i++)
845 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
846 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
850 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
854 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
856 note_kill = _("生き返った。", " revived.");
860 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
871 /* Attempt to destroy the object */
874 /* Effect "observed" */
875 if (known && (o_ptr->marked & OM_FOUND))
878 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
881 /* Artifacts, and other objects, get to resist */
882 if (is_art || ignore)
884 /* Observe the resist */
885 if (known && (o_ptr->marked & OM_FOUND))
887 msg_format(_("%sは影響を受けない!",
888 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
895 /* Describe if needed */
896 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
898 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
901 k_idx = o_ptr->k_idx;
902 is_potion = object_is_potion(o_ptr);
903 delete_object_idx(this_o_idx);
905 /* Potions produce effects when 'shattered' */
908 (void)potion_smash_effect(who, y, x, k_idx);
916 /* Return "Anything seen?" */
922 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
923 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
924 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
925 * @param y 目標Y座標 / Target y location (or location to travel "towards")
926 * @param x 目標X座標 / Target x location (or location to travel "towards")
927 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
928 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
930 * @param see_s_msg TRUEならばメッセージを表示する
931 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
934 * This routine takes a "source monster" (by index) which is mostly used to
935 * determine if the player is causing the damage, and a "radius" (see below),
936 * which is used to decrease the power of explosions with distance, and a
937 * location, via integers which are modified by certain types of attacks
938 * (polymorph and teleport being the obvious ones), a default damage, which
939 * is modified as needed based on various properties, and finally a "damage
943 * Note that this routine can handle "no damage" attacks (like teleport) by
944 * taking a "zero" damage, and can even take "parameters" to attacks (like
945 * confuse) by accepting a "damage", using it to calculate the effect, and
946 * then setting the damage to zero. Note that the "damage" parameter is
947 * divided by the radius, so monsters not at the "epicenter" will not take
948 * as much damage (or whatever)...
951 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
952 * may result in a dereference of an invalid pointer.
955 * Various messages are produced, and damage is applied.
958 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
959 * actually be "made" of that substance, or "breathe" big balls of it.
960 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
962 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
963 * and hurts evil less. If can breath nether, then it resists it as well.
966 * Damage reductions use the following formulas:
967 * Note that "dam = dam * 6 / (randint1(6) + 6);"
968 * gives avg damage of .655, ranging from .858 to .500
969 * Note that "dam = dam * 5 / (randint1(6) + 6);"
970 * gives avg damage of .544, ranging from .714 to .417
971 * Note that "dam = dam * 4 / (randint1(6) + 6);"
972 * gives avg damage of .444, ranging from .556 to .333
973 * Note that "dam = dam * 3 / (randint1(6) + 6);"
974 * gives avg damage of .327, ranging from .427 to .250
975 * Note that "dam = dam * 2 / (randint1(6) + 6);"
976 * gives something simple.
979 * In this function, "result" messages are postponed until the end, where
980 * the "note" string is appended to the monster name, if not NULL. So,
981 * to make a spell have "no effect" just set "note" to NULL. You should
982 * also set "notice" to FALSE, or the player will learn what the spell does.
985 * We attempt to return "TRUE" if the player saw anything "useful" happen.
989 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)
993 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
995 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
996 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
998 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1002 /* Is the monster "seen"? */
1003 bool seen = m_ptr->ml;
1004 bool seen_msg = is_seen(m_ptr);
1006 bool slept = (bool)MON_CSLEEP(m_ptr);
1008 /* Were the effects "obvious" (if seen)? */
1009 bool obvious = FALSE;
1011 /* Can the player know about this effect? */
1012 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1014 /* Were the effects "irrelevant"? */
1015 bool skipped = FALSE;
1017 /* Gets the monster angry at the source of the effect? */
1018 bool get_angry = FALSE;
1020 /* Polymorph setting (true or false) */
1021 bool do_poly = FALSE;
1023 /* Teleport setting (max distance) */
1026 /* Confusion setting (amount to confuse) */
1029 /* Stunning setting (amount to stun) */
1032 /* Sleep amount (amount to sleep) */
1035 /* Fear amount (amount to fear) */
1038 /* Time amount (amount to time) */
1041 bool heal_leper = FALSE;
1043 /* Hold the monster name */
1044 GAME_TEXT m_name[MAX_NLEN];
1047 PARAMETER_VALUE photo = 0;
1049 /* Assume no note */
1050 concptr note = NULL;
1052 /* Assume a default death */
1053 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1055 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1058 if (!g_ptr->m_idx) return (FALSE);
1060 /* Never affect projector */
1061 if (who && (g_ptr->m_idx == who)) return (FALSE);
1062 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1063 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1065 /* Don't affect already death monsters */
1066 /* Prevents problems with chain reactions of exploding monsters */
1067 if (m_ptr->hp < 0) return (FALSE);
1069 /* Reduce damage by distance */
1070 dam = (dam + r) / (r + 1);
1073 /* Get the monster name (BEFORE polymorphing) */
1074 monster_desc(m_name, m_ptr, 0);
1076 /* Get the monster possessive ("his"/"her"/"its") */
1077 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1079 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1081 if (r_ptr->flagsr & RFR_RES_ALL &&
1082 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1083 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1085 note = _("には完全な耐性がある!", " is immune.");
1087 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1088 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1092 /* Analyze the damage type */
1095 /* Magic Missile -- pure damage */
1098 if (seen) obvious = TRUE;
1105 if (seen) obvious = TRUE;
1106 if (r_ptr->flagsr & RFR_IM_ACID)
1108 note = _("にはかなり耐性がある!", " resists a lot.");
1110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1118 if (seen) obvious = TRUE;
1119 if (r_ptr->flagsr & RFR_IM_ELEC)
1121 note = _("にはかなり耐性がある!", " resists a lot.");
1123 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1131 if (seen) obvious = TRUE;
1132 if (r_ptr->flagsr & RFR_IM_FIRE)
1134 note = _("にはかなり耐性がある!", " resists a lot.");
1136 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1138 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1140 note = _("はひどい痛手をうけた。", " is hit hard.");
1142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1150 if (seen) obvious = TRUE;
1151 if (r_ptr->flagsr & RFR_IM_COLD)
1153 note = _("にはかなり耐性がある!", " resists a lot.");
1155 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1157 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1159 note = _("はひどい痛手をうけた。", " is hit hard.");
1161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1169 if (seen) obvious = TRUE;
1170 if (r_ptr->flagsr & RFR_IM_POIS)
1172 note = _("にはかなり耐性がある!", " resists a lot.");
1174 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1182 if (seen) obvious = TRUE;
1183 if (r_ptr->flagsr & RFR_IM_POIS)
1185 note = _("には耐性がある。", " resists.");
1186 dam *= 3; dam /= randint1(6) + 6;
1187 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1189 else if (one_in_(3)) do_poly = TRUE;
1193 /* Hellfire -- hurts Evil */
1196 if (seen) obvious = TRUE;
1197 if (r_ptr->flags3 & RF3_GOOD)
1199 note = _("はひどい痛手をうけた。", " is hit hard.");
1201 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1206 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1209 if (seen) obvious = TRUE;
1210 if (r_ptr->flags3 & RF3_EVIL)
1213 note = _("はひどい痛手をうけた。", " is hit hard.");
1214 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1218 note = _("には耐性がある。", " resists.");
1219 dam *= 3; dam /= randint1(6) + 6;
1224 /* Arrow -- XXX no defense */
1227 if (seen) obvious = TRUE;
1231 /* Plasma -- XXX perhaps check ELEC or FIRE */
1234 if (seen) obvious = TRUE;
1235 if (r_ptr->flagsr & RFR_RES_PLAS)
1237 note = _("には耐性がある。", " resists.");
1238 dam *= 3; dam /= randint1(6) + 6;
1239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1244 /* Nether -- see above */
1247 if (seen) obvious = TRUE;
1248 if (r_ptr->flagsr & RFR_RES_NETH)
1250 if (r_ptr->flags3 & RF3_UNDEAD)
1252 note = _("には完全な耐性がある!", " is immune.");
1254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1258 note = _("には耐性がある。", " resists.");
1259 dam *= 3; dam /= randint1(6) + 6;
1261 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1263 else if (r_ptr->flags3 & RF3_EVIL)
1265 note = _("はいくらか耐性を示した。", " resists somewhat.");
1267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1272 /* Water (acid) damage -- Water spirits/elementals are immune */
1275 if (seen) obvious = TRUE;
1276 if (r_ptr->flagsr & RFR_RES_WATE)
1278 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1280 note = _("には完全な耐性がある!", " is immune.");
1285 note = _("には耐性がある。", " resists.");
1286 dam *= 3; dam /= randint1(6) + 6;
1288 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1293 /* Chaos -- Chaos breathers resist */
1296 if (seen) obvious = TRUE;
1297 if (r_ptr->flagsr & RFR_RES_CHAO)
1299 note = _("には耐性がある。", " resists.");
1300 dam *= 3; dam /= randint1(6) + 6;
1301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1303 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1305 note = _("はいくらか耐性を示した。", " resists somewhat.");
1306 dam *= 3; dam /= randint1(6) + 6;
1307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1312 do_conf = (5 + randint1(11) + r) / (r + 1);
1317 /* Shards -- Shard breathers resist */
1320 if (seen) obvious = TRUE;
1321 if (r_ptr->flagsr & RFR_RES_SHAR)
1323 note = _("には耐性がある。", " resists.");
1324 dam *= 3; dam /= randint1(6) + 6;
1325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1330 /* Rocket: Shard resistance helps */
1333 if (seen) obvious = TRUE;
1334 if (r_ptr->flagsr & RFR_RES_SHAR)
1336 note = _("はいくらか耐性を示した。", " resists somewhat.");
1338 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1344 /* Sound -- Sound breathers resist */
1347 if (seen) obvious = TRUE;
1348 if (r_ptr->flagsr & RFR_RES_SOUN)
1350 note = _("には耐性がある。", " resists.");
1351 dam *= 2; dam /= randint1(6) + 6;
1352 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1354 else do_stun = (10 + randint1(15) + r) / (r + 1);
1361 if (seen) obvious = TRUE;
1362 if (r_ptr->flags3 & RF3_NO_CONF)
1364 note = _("には耐性がある。", " resists.");
1365 dam *= 3; dam /= randint1(6) + 6;
1366 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1368 else do_conf = (10 + randint1(15) + r) / (r + 1);
1372 /* Disenchantment -- Breathers and Disenchanters resist */
1375 if (seen) obvious = TRUE;
1376 if (r_ptr->flagsr & RFR_RES_DISE)
1378 note = _("には耐性がある。", " resists.");
1379 dam *= 3; dam /= randint1(6) + 6;
1380 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1385 /* Nexus -- Breathers and Existers resist */
1388 if (seen) obvious = TRUE;
1389 if (r_ptr->flagsr & RFR_RES_NEXU)
1391 note = _("には耐性がある。", " resists.");
1392 dam *= 3; dam /= randint1(6) + 6;
1393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1401 if (seen) obvious = TRUE;
1402 if (r_ptr->flagsr & RFR_RES_WALL)
1404 note = _("には耐性がある。", " resists.");
1405 dam *= 3; dam /= randint1(6) + 6;
1406 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1408 else do_stun = (randint1(15) + r) / (r + 1);
1412 /* Inertia -- breathers resist */
1415 if (seen) obvious = TRUE;
1416 if (r_ptr->flagsr & RFR_RES_INER)
1418 note = _("には耐性がある。", " resists.");
1419 dam *= 3; dam /= randint1(6) + 6;
1420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1424 /* Powerful monsters can resist */
1425 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1426 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1430 /* Normal monsters slow down */
1433 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1435 note = _("の動きが遅くなった。", " starts moving slower.");
1442 /* Time -- breathers resist */
1445 if (seen) obvious = TRUE;
1446 if (r_ptr->flagsr & RFR_RES_TIME)
1448 note = _("には耐性がある。", " resists.");
1449 dam *= 3; dam /= randint1(6) + 6;
1450 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1452 else do_time = (dam + 1) / 2;
1456 /* Gravity -- breathers resist */
1459 bool resist_tele = FALSE;
1461 if (seen) obvious = TRUE;
1462 if (r_ptr->flagsr & RFR_RES_TELE)
1464 if (r_ptr->flags1 & (RF1_UNIQUE))
1466 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1467 note = _("には効果がなかった。", " is unaffected!");
1470 else if (r_ptr->level > randint1(100))
1472 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1473 note = _("には耐性がある!", " resists!");
1478 if (!resist_tele) do_dist = 10;
1480 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1482 if (r_ptr->flagsr & RFR_RES_GRAV)
1484 note = _("には耐性がある!", " resists!");
1485 dam *= 3; dam /= randint1(6) + 6;
1487 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1492 /* Powerful monsters can resist */
1493 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1494 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1498 /* Normal monsters slow down */
1501 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1503 note = _("の動きが遅くなった。", " starts moving slower.");
1508 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1510 /* Attempt a saving throw */
1511 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1512 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1516 /* No obvious effect */
1517 note = _("には効果がなかった。", " is unaffected!");
1529 if (seen) obvious = TRUE;
1535 case GF_DISINTEGRATE:
1537 if (seen) obvious = TRUE;
1538 if (r_ptr->flags3 & RF3_HURT_ROCK)
1540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1541 note = _("の皮膚がただれた!", " loses some skin!");
1542 note_dies = _("は蒸発した!", " evaporates!");
1550 if (seen) obvious = TRUE;
1552 /* PSI only works if the monster can see you! -- RG */
1553 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1556 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1560 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1563 note = _("には完全な耐性がある!", " is immune.");
1564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1567 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1568 (r_ptr->flags3 & RF3_ANIMAL) ||
1569 (r_ptr->level > randint1(3 * dam)))
1571 note = _("には耐性がある!", " resists!");
1575 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1576 * attacks back on them
1578 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1579 (r_ptr->level > p_ptr->lev / 2) &&
1583 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1584 (seen ? "%^s's corrupted mind backlashes your attack!" :
1585 "%^ss corrupted mind backlashes your attack!")), m_name);
1588 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1590 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1594 /* Injure +/- confusion */
1595 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1596 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1597 if (one_in_(4) && !CHECK_MULTISHADOW())
1599 switch (randint1(4))
1602 set_confused(p_ptr->confused + 3 + randint1(dam));
1605 set_stun(p_ptr->stun + randint1(dam));
1609 if (r_ptr->flags3 & RF3_NO_FEAR)
1610 note = _("には効果がなかった。", " is unaffected.");
1612 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1616 if (!p_ptr->free_act)
1617 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1626 if ((dam > 0) && one_in_(4))
1628 switch (randint1(4))
1631 do_conf = 3 + randint1(dam);
1634 do_stun = 3 + randint1(dam);
1637 do_fear = 3 + randint1(dam);
1640 note = _("は眠り込んでしまった!", " falls asleep!");
1641 do_sleep = 3 + randint1(dam);
1646 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1652 if (seen) obvious = TRUE;
1653 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1656 note = _("には完全な耐性がある!", " is immune.");
1658 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1659 (r_ptr->flags3 & RF3_ANIMAL) ||
1660 (r_ptr->level > randint1(3 * dam)))
1662 note = _("には耐性がある!", " resists!");
1666 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1667 * attacks back on them
1669 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1670 (r_ptr->level > p_ptr->lev / 2) &&
1674 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1675 (seen ? "%^s's corrupted mind backlashes your attack!" :
1676 "%^ss corrupted mind backlashes your attack!")), m_name);
1678 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1680 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1684 /* Injure + mana drain */
1685 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1686 if (!CHECK_MULTISHADOW())
1688 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1689 p_ptr->csp -= damroll(5, dam) / 2;
1690 if (p_ptr->csp < 0) p_ptr->csp = 0;
1691 p_ptr->redraw |= PR_MANA;
1692 p_ptr->window |= (PW_SPELL);
1694 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1701 int b = damroll(5, dam) / 4;
1702 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1703 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1704 (seen ? "You convert %s's pain into %s!" :
1705 "You convert %ss pain into %s!"));
1706 msg_format(msg, m_name, str);
1708 b = MIN(p_ptr->msp, p_ptr->csp + b);
1710 p_ptr->redraw |= PR_MANA;
1711 p_ptr->window |= (PW_SPELL);
1713 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1717 case GF_TELEKINESIS:
1719 if (seen) obvious = TRUE;
1722 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1727 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1729 /* Attempt a saving throw */
1730 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1731 (r_ptr->level > 5 + randint1(dam)))
1735 /* No obvious effect */
1741 /* Psycho-spear -- powerful magic missile */
1744 if (seen) obvious = TRUE;
1748 /* Meteor -- powerful magic missile */
1751 if (seen) obvious = TRUE;
1757 if (!is_hostile(m_ptr)) break;
1758 if (seen) obvious = TRUE;
1759 /* Attempt a saving throw */
1760 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1761 (r_ptr->flags3 & RF3_NO_CONF) ||
1762 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1764 /* Memorize a flag */
1765 if (r_ptr->flags3 & RF3_NO_CONF)
1767 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1774 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1775 * attacks back on them
1777 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1778 (r_ptr->level > p_ptr->lev / 2) &&
1782 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1783 (seen ? "%^s's corrupted mind backlashes your attack!" :
1784 "%^ss corrupted mind backlashes your attack!")), m_name);
1787 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1789 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1793 /* Confuse, stun, terrify */
1794 switch (randint1(4))
1797 set_stun(p_ptr->stun + dam / 2);
1800 set_confused(p_ptr->confused + dam / 2);
1804 if (r_ptr->flags3 & RF3_NO_FEAR)
1805 note = _("には効果がなかった。", " is unaffected.");
1807 set_afraid(p_ptr->afraid + dam);
1814 /* No obvious effect */
1815 note = _("には効果がなかった。", " is unaffected.");
1821 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1823 note = _("があなたに隷属した。", " is in your thrall!");
1828 switch (randint1(4))
1842 /* No "real" damage */
1847 /* Ice -- Cold + Cuts + Stun */
1850 if (seen) obvious = TRUE;
1851 do_stun = (randint1(15) + 1) / (r + 1);
1852 if (r_ptr->flagsr & RFR_IM_COLD)
1854 note = _("にはかなり耐性がある!", " resists a lot.");
1856 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1858 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1860 note = _("はひどい痛手をうけた。", " is hit hard.");
1862 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1869 case GF_HYPODYNAMIA:
1871 if (seen) obvious = TRUE;
1872 if (!monster_living(m_ptr->r_idx))
1874 if (is_original_ap_and_seen(m_ptr))
1876 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1877 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1878 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1880 note = _("には効果がなかった。", " is unaffected.");
1884 else do_time = (dam+7)/8;
1892 if (seen) obvious = TRUE;
1893 if (!monster_living(m_ptr->r_idx))
1895 if (is_original_ap_and_seen(m_ptr))
1897 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1898 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1899 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1901 note = _("には完全な耐性がある!", " is immune.");
1905 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
1906 (randint1(888) != 666)) ||
1907 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
1908 randint1(100) != 66))
1910 note = _("には耐性がある!", " resists!");
1918 /* Polymorph monster (Use "dam" as "power") */
1921 if (seen) obvious = TRUE;
1922 /* Attempt to polymorph (see below) */
1925 /* Powerful monsters can resist */
1926 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1927 (r_ptr->flags1 & RF1_QUESTOR) ||
1928 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1930 note = _("には効果がなかった。", " is unaffected.");
1935 /* No "real" damage */
1942 /* Clone monsters (Ignore "dam") */
1945 if (seen) obvious = TRUE;
1947 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
1949 note = _("には効果がなかった。", " is unaffected.");
1954 m_ptr->hp = m_ptr->maxhp;
1956 /* Attempt to clone. */
1957 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
1959 note = _("が分裂した!", " spawns!");
1963 /* No "real" damage */
1970 /* Heal Monster (use "dam" as amount of healing) */
1973 if (seen) obvious = TRUE;
1976 (void)set_monster_csleep(g_ptr->m_idx, 0);
1978 if (m_ptr->maxhp < m_ptr->max_maxhp)
1980 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
1981 m_ptr->maxhp = m_ptr->max_maxhp;
1986 /* Redraw (later) if needed */
1987 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
1988 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
1996 if (seen) obvious = TRUE;
1999 (void)set_monster_csleep(g_ptr->m_idx, 0);
2000 if (MON_STUNNED(m_ptr))
2002 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2003 (void)set_monster_stunned(g_ptr->m_idx, 0);
2005 if (MON_CONFUSED(m_ptr))
2007 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2008 (void)set_monster_confused(g_ptr->m_idx, 0);
2010 if (MON_MONFEAR(m_ptr))
2012 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2013 (void)set_monster_monfear(g_ptr->m_idx, 0);
2017 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2020 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2024 chg_virtue(V_VITALITY, 1);
2026 if (r_ptr->flags1 & RF1_UNIQUE)
2027 chg_virtue(V_INDIVIDUALISM, 1);
2029 if (is_friendly(m_ptr))
2030 chg_virtue(V_HONOUR, 1);
2031 else if (!(r_ptr->flags3 & RF3_EVIL))
2033 if (r_ptr->flags3 & RF3_GOOD)
2034 chg_virtue(V_COMPASSION, 2);
2036 chg_virtue(V_COMPASSION, 1);
2039 if (r_ptr->flags3 & RF3_ANIMAL)
2040 chg_virtue(V_NATURE, 1);
2043 if (m_ptr->r_idx == MON_LEPER)
2046 if (!who) chg_virtue(V_COMPASSION, 5);
2049 /* Redraw (later) if needed */
2050 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2051 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2053 note = _("は体力を回復したようだ。", " looks healthier.");
2055 /* No "real" damage */
2061 /* Speed Monster (Ignore "dam") */
2064 if (seen) obvious = TRUE;
2067 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2069 note = _("の動きが速くなった。", " starts moving faster.");
2074 if (r_ptr->flags1 & RF1_UNIQUE)
2075 chg_virtue(V_INDIVIDUALISM, 1);
2076 if (is_friendly(m_ptr))
2077 chg_virtue(V_HONOUR, 1);
2080 /* No "real" damage */
2086 /* Slow Monster (Use "dam" as "power") */
2089 if (seen) obvious = TRUE;
2091 /* Powerful monsters can resist */
2092 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2093 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2095 note = _("には効果がなかった。", " is unaffected.");
2099 /* Normal monsters slow down */
2102 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2104 note = _("の動きが遅くなった。", " starts moving slower.");
2108 /* No "real" damage */
2114 /* Sleep (Use "dam" as "power") */
2117 if (seen) obvious = TRUE;
2119 /* Attempt a saving throw */
2120 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2121 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2122 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2124 /* Memorize a flag */
2125 if (r_ptr->flags3 & RF3_NO_SLEEP)
2127 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2129 /* No obvious effect */
2130 note = _("には効果がなかった。", " is unaffected.");
2135 /* Go to sleep (much) later */
2136 note = _("は眠り込んでしまった!", " falls asleep!");
2140 /* No "real" damage */
2146 /* Sleep (Use "dam" as "power") */
2147 case GF_STASIS_EVIL:
2149 if (seen) obvious = TRUE;
2151 /* Attempt a saving throw */
2152 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2153 !(r_ptr->flags3 & RF3_EVIL) ||
2154 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2156 note = _("には効果がなかった。", " is unaffected.");
2161 /* Go to sleep (much) later */
2162 note = _("は動けなくなった!", " is suspended!");
2166 /* No "real" damage */
2171 /* Sleep (Use "dam" as "power") */
2174 if (seen) obvious = TRUE;
2176 /* Attempt a saving throw */
2177 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2178 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2180 note = _("には効果がなかった。", " is unaffected.");
2185 /* Go to sleep (much) later */
2186 note = _("は動けなくなった!", " is suspended!");
2190 /* No "real" damage */
2199 vir = virtue_number(V_HARMONY);
2202 dam += p_ptr->virtues[vir-1]/10;
2205 vir = virtue_number(V_INDIVIDUALISM);
2208 dam -= p_ptr->virtues[vir-1]/20;
2211 if (seen) obvious = TRUE;
2213 /* Attempt a saving throw */
2214 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2218 /* No obvious effect */
2219 note = _("には効果がなかった。", " is unaffected.");
2222 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2224 else if (p_ptr->cursed & TRC_AGGRAVATE)
2226 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2227 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2231 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2234 chg_virtue(V_INDIVIDUALISM, -1);
2235 if (r_ptr->flags3 & RF3_ANIMAL)
2236 chg_virtue(V_NATURE, 1);
2239 /* No "real" damage */
2244 /* Control undead */
2245 case GF_CONTROL_UNDEAD:
2248 if (seen) obvious = TRUE;
2250 vir = virtue_number(V_UNLIFE);
2253 dam += p_ptr->virtues[vir-1]/10;
2256 vir = virtue_number(V_INDIVIDUALISM);
2259 dam -= p_ptr->virtues[vir-1]/20;
2262 /* Attempt a saving throw */
2263 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2264 !(r_ptr->flags3 & RF3_UNDEAD))
2266 /* No obvious effect */
2267 note = _("には効果がなかった。", " is unaffected.");
2269 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2271 else if (p_ptr->cursed & TRC_AGGRAVATE)
2273 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2274 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2278 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2282 /* No "real" damage */
2288 case GF_CONTROL_DEMON:
2291 if (seen) obvious = TRUE;
2293 vir = virtue_number(V_UNLIFE);
2296 dam += p_ptr->virtues[vir-1]/10;
2299 vir = virtue_number(V_INDIVIDUALISM);
2302 dam -= p_ptr->virtues[vir-1]/20;
2305 /* Attempt a saving throw */
2306 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2307 !(r_ptr->flags3 & RF3_DEMON))
2309 /* No obvious effect */
2310 note = _("には効果がなかった。", " is unaffected.");
2312 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2314 else if (p_ptr->cursed & TRC_AGGRAVATE)
2316 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2317 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2321 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2325 /* No "real" damage */
2331 case GF_CONTROL_ANIMAL:
2334 if (seen) obvious = TRUE;
2336 vir = virtue_number(V_NATURE);
2339 dam += p_ptr->virtues[vir-1]/10;
2342 vir = virtue_number(V_INDIVIDUALISM);
2345 dam -= p_ptr->virtues[vir-1]/20;
2348 /* Attempt a saving throw */
2349 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2350 !(r_ptr->flags3 & RF3_ANIMAL))
2353 /* No obvious effect */
2354 note = _("には効果がなかった。", " is unaffected.");
2356 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2358 else if (p_ptr->cursed & TRC_AGGRAVATE)
2360 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2361 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2365 note = _("はなついた。", " is tamed!");
2367 if (r_ptr->flags3 & RF3_ANIMAL)
2368 chg_virtue(V_NATURE, 1);
2371 /* No "real" damage */
2377 case GF_CHARM_LIVING:
2381 vir = virtue_number(V_UNLIFE);
2382 if (seen) obvious = TRUE;
2384 vir = virtue_number(V_UNLIFE);
2387 dam -= p_ptr->virtues[vir-1]/10;
2390 vir = virtue_number(V_INDIVIDUALISM);
2393 dam -= p_ptr->virtues[vir-1]/20;
2396 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2398 /* Attempt a saving throw */
2399 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2400 !monster_living(m_ptr->r_idx))
2403 /* No obvious effect */
2404 note = _("には効果がなかった。", " is unaffected.");
2406 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2408 else if (p_ptr->cursed & TRC_AGGRAVATE)
2410 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2411 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2415 note = _("を支配した。", " is tamed!");
2417 if (r_ptr->flags3 & RF3_ANIMAL)
2418 chg_virtue(V_NATURE, 1);
2421 /* No "real" damage */
2426 /* Confusion (Use "dam" as "power") */
2429 if (seen) obvious = TRUE;
2431 /* Get confused later */
2432 do_conf = damroll(3, (dam / 2)) + 1;
2434 /* Attempt a saving throw */
2435 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2436 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2437 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2439 /* Memorize a flag */
2440 if (r_ptr->flags3 & (RF3_NO_CONF))
2442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2448 /* No obvious effect */
2449 note = _("には効果がなかった。", " is unaffected.");
2453 /* No "real" damage */
2460 if (seen) obvious = TRUE;
2462 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2464 /* Attempt a saving throw */
2465 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2466 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2471 /* No obvious effect */
2472 note = _("には効果がなかった。", " is unaffected.");
2476 /* No "real" damage */
2481 /* Lite, but only hurts susceptible creatures */
2490 if (r_ptr->flags3 & (RF3_HURT_LITE))
2492 /* Obvious effect */
2493 if (seen) obvious = TRUE;
2495 /* Memorize the effects */
2496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2498 /* Special effect */
2499 note = _("は光に身をすくめた!", " cringes from the light!");
2500 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2503 /* Normally no damage */
2515 /* Lite -- opposite of Dark */
2518 if (seen) obvious = TRUE;
2520 if (r_ptr->flagsr & RFR_RES_LITE)
2522 note = _("には耐性がある!", " resists!");
2523 dam *= 2; dam /= (randint1(6)+6);
2524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2526 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2528 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2529 note = _("は光に身をすくめた!", " cringes from the light!");
2530 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2537 /* Dark -- opposite of Lite */
2540 if (seen) obvious = TRUE;
2542 if (r_ptr->flagsr & RFR_RES_DARK)
2544 note = _("には耐性がある!", " resists!");
2545 dam *= 2; dam /= (randint1(6)+6);
2546 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2555 /* Hurt by rock remover */
2556 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2559 if (seen) obvious = TRUE;
2561 /* Memorize the effects */
2562 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2564 /* Cute little message */
2565 note = _("の皮膚がただれた!", " loses some skin!");
2566 note_dies = _("はドロドロに溶けた!", " dissolves!");
2569 /* Usually, ignore the effects */
2580 /* Teleport undead (Use "dam" as "power") */
2581 case GF_AWAY_UNDEAD:
2583 /* Only affect undead */
2584 if (r_ptr->flags3 & (RF3_UNDEAD))
2586 bool resists_tele = FALSE;
2588 if (r_ptr->flagsr & RFR_RES_TELE)
2590 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2592 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2593 note = _("には効果がなかった。", " is unaffected.");
2594 resists_tele = TRUE;
2596 else if (r_ptr->level > randint1(100))
2598 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2599 note = _("には耐性がある!", " resists!");
2600 resists_tele = TRUE;
2606 if (seen) obvious = TRUE;
2607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2619 /* No "real" damage */
2625 /* Teleport evil (Use "dam" as "power") */
2628 /* Only affect evil */
2629 if (r_ptr->flags3 & (RF3_EVIL))
2631 bool resists_tele = FALSE;
2633 if (r_ptr->flagsr & RFR_RES_TELE)
2635 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2637 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2638 note = _("には効果がなかった。", " is unaffected.");
2639 resists_tele = TRUE;
2641 else if (r_ptr->level > randint1(100))
2643 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2644 note = _("には耐性がある!", " resists!");
2645 resists_tele = TRUE;
2651 if (seen) obvious = TRUE;
2652 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2664 /* No "real" damage */
2670 /* Teleport monster (Use "dam" as "power") */
2673 bool resists_tele = FALSE;
2674 if (r_ptr->flagsr & RFR_RES_TELE)
2676 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2678 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2679 note = _("には効果がなかった。", " is unaffected.");
2680 resists_tele = TRUE;
2682 else if (r_ptr->level > randint1(100))
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2685 note = _("には耐性がある!", " resists!");
2686 resists_tele = TRUE;
2692 if (seen) obvious = TRUE;
2694 /* Prepare to teleport */
2698 /* No "real" damage */
2704 /* Turn undead (Use "dam" as "power") */
2705 case GF_TURN_UNDEAD:
2707 /* Only affect undead */
2708 if (r_ptr->flags3 & (RF3_UNDEAD))
2710 if (seen) obvious = TRUE;
2712 /* Learn about type */
2713 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2715 /* Apply some fear */
2716 do_fear = damroll(3, (dam / 2)) + 1;
2718 /* Attempt a saving throw */
2719 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2721 /* No obvious effect */
2722 note = _("には効果がなかった。", " is unaffected.");
2735 /* No "real" damage */
2741 /* Turn evil (Use "dam" as "power") */
2744 /* Only affect evil */
2745 if (r_ptr->flags3 & (RF3_EVIL))
2747 if (seen) obvious = TRUE;
2749 /* Learn about type */
2750 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2752 /* Apply some fear */
2753 do_fear = damroll(3, (dam / 2)) + 1;
2755 /* Attempt a saving throw */
2756 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2758 /* No obvious effect */
2759 note = _("には効果がなかった。", " is unaffected.");
2772 /* No "real" damage */
2778 /* Turn monster (Use "dam" as "power") */
2781 if (seen) obvious = TRUE;
2783 /* Apply some fear */
2784 do_fear = damroll(3, (dam / 2)) + 1;
2786 /* Attempt a saving throw */
2787 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2788 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2789 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2791 /* No obvious effect */
2792 note = _("には効果がなかった。", " is unaffected.");
2797 /* No "real" damage */
2804 case GF_DISP_UNDEAD:
2806 /* Only affect undead */
2807 if (r_ptr->flags3 & (RF3_UNDEAD))
2809 if (seen) obvious = TRUE;
2811 /* Learn about type */
2812 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2814 note = _("は身震いした。", " shudders.");
2815 note_dies = _("はドロドロに溶けた!", " dissolves!");
2835 /* Only affect evil */
2836 if (r_ptr->flags3 & (RF3_EVIL))
2838 if (seen) obvious = TRUE;
2840 /* Learn about type */
2841 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2843 note = _("は身震いした。", " shudders.");
2844 note_dies = _("はドロドロに溶けた!", " dissolves!");
2863 /* Only affect good */
2864 if (r_ptr->flags3 & (RF3_GOOD))
2866 if (seen) obvious = TRUE;
2868 /* Learn about type */
2869 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2871 note = _("は身震いした。", " shudders.");
2872 note_dies = _("はドロドロに溶けた!", " dissolves!");
2889 case GF_DISP_LIVING:
2891 /* Only affect non-undead */
2892 if (monster_living(m_ptr->r_idx))
2894 if (seen) obvious = TRUE;
2896 note = _("は身震いした。", " shudders.");
2897 note_dies = _("はドロドロに溶けた!", " dissolves!");
2916 /* Only affect demons */
2917 if (r_ptr->flags3 & (RF3_DEMON))
2919 if (seen) obvious = TRUE;
2921 /* Learn about type */
2922 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2924 note = _("は身震いした。", " shudders.");
2925 note_dies = _("はドロドロに溶けた!", " dissolves!");
2941 /* Dispel monster */
2944 if (seen) obvious = TRUE;
2945 note = _("は身震いした。", " shudders.");
2946 note_dies = _("はドロドロに溶けた!", " dissolves!");
2953 if (seen) obvious = TRUE;
2954 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
2958 /* Heal the monster */
2959 if (caster_ptr->hp < caster_ptr->maxhp)
2962 caster_ptr->hp += dam;
2963 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
2965 /* Redraw (later) if needed */
2966 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
2967 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
2969 /* Special message */
2972 monster_desc(killer, caster_ptr, 0);
2973 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
2979 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
2980 (void)hp_player(dam);
2985 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
2994 if (seen) obvious = TRUE;
2995 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
2996 /* Attempt a saving throw */
2997 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2998 (r_ptr->flags3 & RF3_NO_CONF) ||
2999 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3001 /* Memorize a flag */
3002 if (r_ptr->flags3 & (RF3_NO_CONF))
3004 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3006 note = _("には効果がなかった。", " is unaffected.");
3009 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3011 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3012 note = _("には完全な耐性がある!", " is immune.");
3015 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3018 note = _("には耐性がある。", " resists.");
3023 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3024 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3026 if (who > 0) do_conf = randint0(4) + 4;
3027 else do_conf = randint0(8) + 8;
3033 case GF_BRAIN_SMASH:
3035 if (seen) obvious = TRUE;
3036 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3038 /* Attempt a saving throw */
3039 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3040 (r_ptr->flags3 & RF3_NO_CONF) ||
3041 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3043 /* Memorize a flag */
3044 if (r_ptr->flags3 & (RF3_NO_CONF))
3046 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3048 note = _("には効果がなかった。", " is unaffected.");
3051 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3053 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3054 note = _("には完全な耐性がある!", " is immune.");
3057 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3060 note = _("には耐性がある!", " resists!");
3065 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3066 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3070 do_conf = randint0(4) + 4;
3071 do_stun = randint0(4) + 4;
3075 do_conf = randint0(8) + 8;
3076 do_stun = randint0(8) + 8;
3078 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3086 if (seen) obvious = TRUE;
3087 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3088 /* Attempt a saving throw */
3089 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3091 note = _("には効果がなかった。", " is unaffected.");
3100 if (seen) obvious = TRUE;
3101 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3102 /* Attempt a saving throw */
3103 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3105 note = _("には効果がなかった。", " is unaffected.");
3114 if (seen) obvious = TRUE;
3115 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3116 /* Attempt a saving throw */
3117 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3119 note = _("には効果がなかった。", " is unaffected.");
3128 if (seen) obvious = TRUE;
3130 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3131 "You point at %s, screaming the word, 'DIE!'."), m_name);
3132 /* Attempt a saving throw */
3133 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3135 note = _("には効果がなかった。", " is unaffected.");
3144 if (seen) obvious = TRUE;
3145 if (r_ptr->flags1 & RF1_UNIQUE)
3147 note = _("には効果がなかった。", " is unaffected.");
3152 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3153 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3155 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3157 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3161 note = _("は耐性を持っている!", "resists!");
3168 /* Capture monster */
3172 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3173 (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)
3175 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3180 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3181 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3182 nokori_hp = m_ptr->maxhp * 3 / 10;
3184 nokori_hp = m_ptr->maxhp * 3 / 20;
3186 if (m_ptr->hp >= nokori_hp)
3188 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3191 else if (m_ptr->hp < randint0(nokori_hp))
3193 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3194 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3195 cap_mon = m_ptr->r_idx;
3196 cap_mspeed = m_ptr->mspeed;
3198 cap_maxhp = m_ptr->max_maxhp;
3199 cap_nickname = m_ptr->nickname; /* Quark transfer */
3200 if (g_ptr->m_idx == p_ptr->riding)
3202 if (rakuba(-1, FALSE))
3204 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3208 delete_monster_idx(g_ptr->m_idx);
3214 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3220 /* Attack (Use "dam" as attack type) */
3223 /* Return this monster's death */
3224 return py_attack(y, x, dam);
3227 /* Sleep (Use "dam" as "power") */
3233 if (seen) obvious = TRUE;
3234 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3236 note = _("には効果がなかった。", " is unaffected.");
3239 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3242 if (MON_CSLEEP(m_ptr))
3244 note = _("には効果がなかった。", " is unaffected.");
3250 if (one_in_(5)) effect = 1;
3251 else if (one_in_(4)) effect = 2;
3252 else if (one_in_(3)) effect = 3;
3257 /* Powerful monsters can resist */
3258 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3259 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3261 note = _("には効果がなかった。", " is unaffected.");
3265 /* Normal monsters slow down */
3268 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3270 note = _("の動きが遅くなった。", " starts moving slower.");
3275 else if (effect == 2)
3277 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3279 /* Attempt a saving throw */
3280 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3281 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3286 /* No obvious effect */
3287 note = _("には効果がなかった。", " is unaffected.");
3292 else if (effect == 3)
3294 /* Attempt a saving throw */
3295 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3296 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3297 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3299 /* Memorize a flag */
3300 if (r_ptr->flags3 & RF3_NO_SLEEP)
3302 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3305 /* No obvious effect */
3306 note = _("には効果がなかった。", " is unaffected.");
3311 /* Go to sleep (much) later */
3312 note = _("は眠り込んでしまった!", " falls asleep!");
3319 note = _("には効果がなかった。", " is unaffected.");
3322 /* No "real" damage */
3330 if (seen) obvious = TRUE;
3331 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3333 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3334 chg_virtue(V_VITALITY, -1);
3344 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3346 if (r_ptr->flags3 & (RF3_HURT_LITE))
3348 /* Obvious effect */
3349 if (seen) obvious = TRUE;
3351 /* Memorize the effects */
3352 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3354 /* Special effect */
3355 note = _("は光に身をすくめた!", " cringes from the light!");
3356 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3359 /* Normally no damage */
3366 photo = m_ptr->r_idx;
3373 case GF_BLOOD_CURSE:
3375 if (seen) obvious = TRUE;
3381 bool success = FALSE;
3382 if (seen) obvious = TRUE;
3384 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3386 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3387 if (dam < 1) dam = 1;
3389 /* No need to tame your pet */
3392 note = _("の動きが速くなった。", " starts moving faster.");
3393 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3397 /* Attempt a saving throw */
3398 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3399 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3400 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3401 (p_ptr->cursed & TRC_AGGRAVATE) ||
3402 ((r_ptr->level+10) > randint1(dam)))
3405 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3409 note = _("を支配した。", " is tamed!");
3411 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3413 /* Learn about type */
3414 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3421 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3423 do_fear = randint1(90)+10;
3425 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3428 /* No "real" damage */
3435 if (seen) obvious = TRUE;
3436 /* Attempt a saving throw */
3437 if (randint0(100 + dam) < (r_ptr->level + 50))
3439 note = _("には効果がなかった。", " is unaffected.");
3459 /* Absolutely no effect */
3460 if (skipped) return (FALSE);
3462 /* "Unique" monsters cannot be polymorphed */
3463 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3465 /* Quest monsters cannot be polymorphed */
3466 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3468 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3470 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3471 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3473 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3478 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3479 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3482 /* Modify the damage */
3484 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3485 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3487 /* Check for death */
3488 if (dam > m_ptr->hp)
3490 /* Extract method of death */
3495 /* Sound and Impact resisters never stun */
3497 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3498 !(r_ptr->flags3 & RF3_NO_STUN))
3500 if (seen) obvious = TRUE;
3503 if (MON_STUNNED(m_ptr))
3505 note = _("はひどくもうろうとした。", " is more dazed.");
3506 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3510 note = _("はもうろうとした。", " is dazed.");
3515 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3521 /* Confusion and Chaos resisters (and sleepers) never confuse */
3523 !(r_ptr->flags3 & RF3_NO_CONF) &&
3524 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3526 if (seen) obvious = TRUE;
3528 /* Already partially confused */
3529 if (MON_CONFUSED(m_ptr))
3531 note = _("はさらに混乱したようだ。", " looks more confused.");
3532 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3535 /* Was not confused */
3538 note = _("は混乱したようだ。", " looks confused.");
3542 /* Apply confusion */
3543 (void)set_monster_confused(g_ptr->m_idx, tmp);
3551 if (seen) obvious = TRUE;
3553 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3557 note = _("は弱くなったようだ。", " seems weakened.");
3558 m_ptr->maxhp -= do_time;
3559 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3564 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3565 if (do_poly && (randint1(90) > r_ptr->level))
3567 if (polymorph_monster(y, x))
3569 if (seen) obvious = TRUE;
3571 /* Monster polymorphs */
3572 note = _("が変身した!", " changes!");
3574 /* Turn off the damage */
3580 note = _("には効果がなかった。", " is unaffected.");
3583 /* Hack -- Get new monster */
3584 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3586 /* Hack -- Get new race */
3587 r_ptr = &r_info[m_ptr->r_idx];
3590 /* Handle "teleport" */
3593 if (seen) obvious = TRUE;
3595 note = _("が消え去った!", " disappears!");
3597 if (!who) chg_virtue(V_VALOUR, -1);
3600 teleport_away(g_ptr->m_idx, do_dist,
3601 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3603 /* Hack -- get new location */
3607 /* Hack -- get new grid */
3608 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3615 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3622 if (typ == GF_DRAIN_MANA)
3624 /* Drain mana does nothing */
3627 /* If another monster did the damage, hurt the monster by hand */
3630 /* Redraw (later) if needed */
3631 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3632 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3634 /* Wake the monster up */
3635 (void)set_monster_csleep(g_ptr->m_idx, 0);
3637 /* Hurt the monster */
3645 if (is_pet(m_ptr) && !(m_ptr->ml))
3648 /* Give detailed messages if destroyed */
3651 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3654 msg_format("%^s%s", m_name, note);
3662 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3664 /* Generate treasure, etc */
3665 monster_death(g_ptr->m_idx, FALSE);
3668 delete_monster_idx(g_ptr->m_idx);
3672 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3676 /* Damaged monster */
3679 /* Give detailed messages if visible or destroyed */
3680 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3682 /* Hack -- Pain message */
3685 message_pain(g_ptr->m_idx, dam);
3692 /* Hack -- handle sleep */
3693 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3697 else if (heal_leper)
3699 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3701 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3703 char m2_name[MAX_NLEN];
3705 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3706 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3709 delete_monster_idx(g_ptr->m_idx);
3712 /* If the player did it, give him experience, check fear */
3717 /* Hurt the monster, check for fear and death */
3718 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3723 /* Damaged monster */
3726 /* HACK - anger the monster before showing the sleep message */
3727 if (do_sleep) anger_monster(m_ptr);
3729 /* Give detailed messages if visible or destroyed */
3730 if (note && seen_msg)
3731 msg_format(_("%s%s", "%^s%s"), m_name, note);
3733 /* Hack -- Pain message */
3734 else if (known && (dam || !do_fear))
3736 message_pain(g_ptr->m_idx, dam);
3739 /* Anger monsters */
3740 if (((dam > 0) || get_angry) && !do_sleep)
3741 anger_monster(m_ptr);
3743 if ((fear || do_fear) && seen)
3746 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3749 /* Hack -- handle sleep */
3750 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3754 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3756 blood_curse_to_enemy(who);
3759 if (p_ptr->inside_battle)
3761 p_ptr->health_who = g_ptr->m_idx;
3762 p_ptr->redraw |= (PR_HEALTH);
3766 /* Verify this code */
3767 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3769 /* Redraw the monster grid */
3772 /* Update monster recall window */
3773 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3775 p_ptr->window |= (PW_MONSTER);
3778 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3782 if (!(flg & PROJECT_NO_HANGEKI))
3784 set_target(m_ptr, monster_target_y, monster_target_x);
3787 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3789 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3793 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3795 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3796 rakubadam_m = (dam > 200) ? 200 : dam;
3806 /* Prepare to make a Blade of Chaos */
3807 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3809 q_ptr->pval = photo;
3811 /* Mark the item as fully known */
3812 q_ptr->ident |= (IDENT_MENTAL);
3813 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3821 /* Return "Anything seen?" */
3826 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3827 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3828 * @param who_name 効果を起こしたモンスターの名前
3829 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3830 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3831 * @param x 目標X座標 / Target x location (or location to travel "towards")
3832 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3833 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3835 * @param monspell 効果元のモンスター魔法ID
3836 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3838 * Handle a beam/bolt/ball causing damage to the player.
3839 * This routine takes a "source monster" (by index), a "distance", a default
3840 * "damage", and a "damage type". See "project_m()" above.
3841 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3842 * is reduced (see "project_m()" above). This can happen if a monster breathes
3843 * at the player and hits a wall instead.
3844 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3845 * to know if this is actually a ball or a bolt spell
3846 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3847 * we just assume that the effects were obvious, for historical reasons.
3849 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)
3854 /* Hack -- assume obvious */
3855 bool obvious = TRUE;
3857 /* Player blind-ness */
3858 bool blind = (p_ptr->blind ? TRUE : FALSE);
3860 /* Player needs a "description" (he is blind) */
3863 /* Source monster */
3864 monster_type *m_ptr = NULL;
3866 /* Monster name (for attacks) */
3867 GAME_TEXT m_name[MAX_NLEN];
3869 /* Monster name (for damage) */
3872 /* Hack -- messages */
3878 /* Player is not here */
3879 if (!player_bold(y, x)) return (FALSE);
3881 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
3883 if (kawarimi(TRUE)) return FALSE;
3886 /* Player cannot hurt himself */
3887 if (!who) return (FALSE);
3888 if (who == p_ptr->riding) return (FALSE);
3890 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
3893 int max_attempts = 10;
3894 sound(SOUND_REFLECT);
3897 msg_print(_("何かが跳ね返った!", "Something bounces!"));
3898 else if (p_ptr->special_defense & KATA_FUUJIN)
3899 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
3901 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
3904 /* Choose 'new' target */
3909 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
3910 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
3913 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
3915 if (max_attempts < 1)
3917 t_y = current_floor_ptr->m_list[who].fy;
3918 t_x = current_floor_ptr->m_list[who].fx;
3923 t_y = p_ptr->y - 1 + randint1(3);
3924 t_x = p_ptr->x - 1 + randint1(3);
3927 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
3929 disturb(TRUE, TRUE);
3933 /* Limit maximum damage */
3934 if (dam > 1600) dam = 1600;
3936 /* Reduce damage by distance */
3937 dam = (dam + r) / (r + 1);
3940 /* If the player is blind, be more descriptive */
3941 if (blind) fuzzy = TRUE;
3946 m_ptr = ¤t_floor_ptr->m_list[who];
3947 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
3948 monster_desc(m_name, m_ptr, 0);
3950 /* Get the monster's real name (gotten before polymorph!) */
3951 strcpy(killer, who_name);
3957 case PROJECT_WHO_UNCTRL_POWER:
3958 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
3961 case PROJECT_WHO_GLASS_SHARDS:
3962 strcpy(killer, _("ガラスの破片", "shards of glass"));
3966 strcpy(killer, _("罠", "a trap"));
3969 strcpy(m_name, killer);
3972 /* Analyze the damage */
3975 /* Standard damage -- hurts inventory too */
3978 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
3979 get_damage = acid_dam(dam, killer, monspell, FALSE);
3983 /* Standard damage -- hurts inventory too */
3986 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
3987 get_damage = fire_dam(dam, killer, monspell, FALSE);
3991 /* Standard damage -- hurts inventory too */
3994 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
3995 get_damage = cold_dam(dam, killer, monspell, FALSE);
3999 /* Standard damage -- hurts inventory too */
4002 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4003 get_damage = elec_dam(dam, killer, monspell, FALSE);
4007 /* Standard damage -- also poisons player */
4010 bool double_resist = IS_OPPOSE_POIS();
4011 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4013 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4014 if (double_resist) dam = (dam + 2) / 3;
4016 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4021 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4023 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4025 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4030 /* Standard damage -- also poisons / mutates player */
4033 bool double_resist = IS_OPPOSE_POIS();
4034 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4036 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4037 if (double_resist) dam = (2 * dam + 2) / 5;
4038 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4039 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4041 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4043 if (one_in_(5)) /* 6 */
4045 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4046 if (one_in_(4)) /* 4 */
4054 inven_damage(set_acid_destroy, 2);
4060 /* Standard damage */
4063 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4064 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4068 /* Holy Orb -- Player only takes partial damage */
4071 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4072 if (p_ptr->align > 10)
4074 else if (p_ptr->align < -10)
4076 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4082 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4083 if (p_ptr->align > 10)
4085 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4089 /* Arrow -- XXX no dodging */
4094 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4096 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4098 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4101 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4105 /* Plasma -- XXX No resist */
4108 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4109 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4111 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4113 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4114 (void)set_stun(p_ptr->stun + plus_stun);
4117 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4119 inven_damage(set_acid_destroy, 3);
4125 /* Nether -- drain experience */
4128 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4129 if (p_ptr->resist_neth)
4131 if (!prace_is_(RACE_SPECTRE))
4133 dam *= 6; dam /= (randint1(4) + 7);
4136 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4138 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4140 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4142 learn_spell(monspell);
4146 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4152 /* Water -- stun/confuse */
4155 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4156 if (!CHECK_MULTISHADOW())
4158 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4160 set_stun(p_ptr->stun + randint1(40));
4162 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4164 set_confused(p_ptr->confused + randint1(5) + 5);
4167 if (one_in_(5) && !p_ptr->resist_water)
4169 inven_damage(set_cold_destroy, 3);
4172 if (p_ptr->resist_water) get_damage /= 4;
4175 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4179 /* Chaos -- many effects */
4182 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4183 if (p_ptr->resist_chaos)
4185 dam *= 6; dam /= (randint1(4) + 7);
4188 if (!CHECK_MULTISHADOW())
4190 if (!p_ptr->resist_conf)
4192 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4194 if (!p_ptr->resist_chaos)
4196 (void)set_image(p_ptr->image + randint1(10));
4199 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4200 (void)gain_mutation(p_ptr, 0);
4203 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4205 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4208 if (!p_ptr->resist_chaos || one_in_(9))
4210 inven_damage(set_elec_destroy, 2);
4211 inven_damage(set_fire_destroy, 2);
4215 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4219 /* Shards -- mostly cutting */
4222 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4223 if (p_ptr->resist_shard)
4225 dam *= 6; dam /= (randint1(4) + 7);
4227 else if (!CHECK_MULTISHADOW())
4229 (void)set_cut(p_ptr->cut + dam);
4232 if (!p_ptr->resist_shard || one_in_(13))
4234 inven_damage(set_cold_destroy, 2);
4237 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4241 /* Sound -- mostly stunning */
4244 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4245 if (p_ptr->resist_sound)
4247 dam *= 5; dam /= (randint1(4) + 7);
4249 else if (!CHECK_MULTISHADOW())
4251 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4252 (void)set_stun(p_ptr->stun + plus_stun);
4255 if (!p_ptr->resist_sound || one_in_(13))
4257 inven_damage(set_cold_destroy, 2);
4260 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4264 /* Pure confusion */
4267 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4268 if (p_ptr->resist_conf)
4270 dam *= 5; dam /= (randint1(4) + 7);
4272 else if (!CHECK_MULTISHADOW())
4274 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4276 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4280 /* Disenchantment -- see above */
4283 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4284 if (p_ptr->resist_disen)
4286 dam *= 6; dam /= (randint1(4) + 7);
4288 else if (!CHECK_MULTISHADOW())
4290 (void)apply_disenchant(0);
4292 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4296 /* Nexus -- see above */
4299 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4300 if (p_ptr->resist_nexus)
4302 dam *= 6; dam /= (randint1(4) + 7);
4304 else if (!CHECK_MULTISHADOW())
4308 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4312 /* Force -- mostly stun */
4315 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4316 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4318 (void)set_stun(p_ptr->stun + randint1(20));
4320 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4325 /* Rocket -- stun, cut */
4328 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4329 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4331 (void)set_stun(p_ptr->stun + randint1(20));
4334 if (p_ptr->resist_shard)
4338 else if (!CHECK_MULTISHADOW())
4340 (void)set_cut(p_ptr->cut + (dam / 2));
4343 if (!p_ptr->resist_shard || one_in_(12))
4345 inven_damage(set_cold_destroy, 3);
4348 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4352 /* Inertia -- slowness */
4355 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4356 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4357 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4361 /* Lite -- blinding */
4364 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4365 if (p_ptr->resist_lite)
4367 dam *= 4; dam /= (randint1(4) + 7);
4369 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4371 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4374 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4376 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4379 else if (prace_is_(RACE_S_FAIRY))
4384 if (p_ptr->wraith_form) dam *= 2;
4385 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4387 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4389 p_ptr->wraith_form = 0;
4390 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4391 "The light forces you out of your incorporeal shadow form."));
4393 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4394 p_ptr->update |= (PU_MONSTERS);
4395 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4401 /* Dark -- blinding */
4404 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4405 if (p_ptr->resist_dark)
4407 dam *= 4; dam /= (randint1(4) + 7);
4409 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4411 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4413 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4415 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4419 /* Time -- bolt fewer effects XXX */
4422 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4423 if (p_ptr->resist_time)
4426 dam /= (randint1(4) + 7);
4427 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4429 else if (!CHECK_MULTISHADOW())
4431 switch (randint1(10))
4433 case 1: case 2: case 3: case 4: case 5:
4435 if (p_ptr->prace == RACE_ANDROID) break;
4436 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4437 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4441 case 6: case 7: case 8: case 9:
4443 switch (randint1(6))
4445 case 1: k = A_STR; act = _("強く", "strong"); break;
4446 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4447 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4448 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4449 case 5: k = A_CON; act = _("健康で", "hale"); break;
4450 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4453 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4454 "You're not as %s as you used to be..."), act);
4456 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4457 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4458 p_ptr->update |= (PU_BONUS);
4464 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4465 "You're not as powerful as you used to be..."));
4467 for (k = 0; k < A_MAX; k++)
4469 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4470 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4472 p_ptr->update |= (PU_BONUS);
4478 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4482 /* Gravity -- stun plus slowness plus teleport */
4485 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4486 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4488 if (!CHECK_MULTISHADOW())
4490 teleport_player(5, TELEPORT_PASSIVE);
4491 if (!p_ptr->levitation)
4492 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4493 if (!(p_ptr->resist_sound || p_ptr->levitation))
4495 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4496 (void)set_stun(p_ptr->stun + plus_stun);
4499 if (p_ptr->levitation)
4501 dam = (dam * 2) / 3;
4504 if (!p_ptr->levitation || one_in_(13))
4506 inven_damage(set_cold_destroy, 2);
4509 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4513 /* Standard damage */
4514 case GF_DISINTEGRATE:
4516 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4518 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4524 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4526 (void)hp_player(dam);
4533 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4534 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4541 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4542 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4548 if (p_ptr->free_act) break;
4549 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4551 if (ironman_nightmare)
4553 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4554 /* Have some nightmares */
4555 sanity_blast(NULL, FALSE);
4558 set_paralyzed(p_ptr->paralyzed + dam);
4568 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4569 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4576 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4577 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4584 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4586 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4587 if (!p_ptr->resist_shard || one_in_(13))
4589 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4590 inven_damage(set_cold_destroy, 2);
4596 /* Ice -- cold plus stun plus cuts */
4599 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4600 get_damage = cold_dam(dam, killer, monspell, FALSE);
4601 if (!CHECK_MULTISHADOW())
4603 if (!p_ptr->resist_shard)
4605 (void)set_cut(p_ptr->cut + damroll(5, 8));
4607 if (!p_ptr->resist_sound)
4609 (void)set_stun(p_ptr->stun + randint1(15));
4612 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4614 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4624 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4626 if (p_ptr->mimic_form)
4628 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4629 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4634 switch (p_ptr->prace)
4636 /* Some races are immune */
4650 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4662 if (CHECK_MULTISHADOW())
4664 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4666 else if (p_ptr->csp)
4670 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4672 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4675 if (dam >= p_ptr->csp)
4679 p_ptr->csp_frac = 0;
4688 learn_spell(monspell);
4689 p_ptr->redraw |= (PR_MANA);
4690 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4694 /* Heal the monster */
4695 if (m_ptr->hp < m_ptr->maxhp)
4699 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4701 /* Redraw (later) if needed */
4702 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4703 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4705 /* Special message */
4708 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4721 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4723 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4724 learn_spell(monspell);
4728 if (!CHECK_MULTISHADOW())
4730 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4732 if (!p_ptr->resist_conf)
4734 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4737 if (!p_ptr->resist_chaos && one_in_(3))
4739 (void)set_image(p_ptr->image + randint0(250) + 150);
4746 p_ptr->csp_frac = 0;
4748 p_ptr->redraw |= PR_MANA;
4751 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4757 case GF_BRAIN_SMASH:
4759 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4761 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4762 learn_spell(monspell);
4766 if (!CHECK_MULTISHADOW())
4768 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4774 p_ptr->csp_frac = 0;
4776 p_ptr->redraw |= PR_MANA;
4779 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4780 if (!CHECK_MULTISHADOW())
4782 if (!p_ptr->resist_blind)
4784 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4786 if (!p_ptr->resist_conf)
4788 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4790 if (!p_ptr->free_act)
4792 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4794 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4796 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4797 (void)do_dec_stat(A_INT);
4798 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4799 (void)do_dec_stat(A_WIS);
4801 if (!p_ptr->resist_chaos)
4803 (void)set_image(p_ptr->image + randint0(250) + 150);
4813 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4815 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4816 learn_spell(monspell);
4820 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
4821 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4829 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4831 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4832 learn_spell(monspell);
4836 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4837 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4845 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4847 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4848 learn_spell(monspell);
4852 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4853 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4861 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
4863 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
4864 learn_spell(monspell);
4868 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4869 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
4877 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4879 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4880 learn_spell(monspell);
4884 if (!CHECK_MULTISHADOW())
4886 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
4887 curse_equipment(40, 20);
4890 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
4892 if (p_ptr->chp < 1) p_ptr->chp = 1;
4907 /* Hex - revenge damage stored */
4908 revenge_store(get_damage);
4910 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
4911 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
4913 GAME_TEXT m_name_self[80];
4916 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
4918 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
4919 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
4920 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
4923 if (p_ptr->riding && dam > 0)
4925 rakubadam_p = (dam > 200) ? 200 : dam;
4929 disturb(TRUE, TRUE);
4932 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
4934 (void)kawarimi(FALSE);
4937 /* Return "Anything seen?" */
4943 * Find the distance from (x, y) to a line.
4945 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4947 /* Vector from (x, y) to (x1, y1) */
4948 POSITION py = y1 - y;
4949 POSITION px = x1 - x;
4952 POSITION ny = x2 - x1;
4953 POSITION nx = y1 - y2;
4956 POSITION pd = distance(y1, x1, y, x);
4957 POSITION nd = distance(y1, x1, y2, x2);
4959 if (pd > nd) return distance(y, x, y2, x2);
4961 /* Component of P on N */
4962 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
4964 /* Absolute value */
4965 return((nd >= 0) ? nd : 0 - nd);
4972 * Modified version of los() for calculation of disintegration balls.
4973 * Disintegration effects are stopped by permanent walls.
4975 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4977 POSITION dx, dy; /* Delta */
4978 POSITION ax, ay; /* Absolute */
4979 POSITION sx, sy; /* Signs */
4980 POSITION qx, qy; /* Fractions */
4981 POSITION tx, ty; /* Scanners */
4982 POSITION f1, f2; /* Scale factors */
4983 POSITION m; /* Slope, or 1/Slope, of LOS */
4985 /* Extract the offset */
4989 /* Extract the absolute offset */
4993 /* Handle adjacent (or identical) grids */
4994 if ((ax < 2) && (ay < 2)) return (TRUE);
4996 /* Paranoia -- require "safe" origin */
4997 /* if (!in_bounds(y1, x1)) return (FALSE); */
4999 /* Directly South/North */
5002 /* South -- check for walls */
5005 for (ty = y1 + 1; ty < y2; ty++)
5007 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5011 /* North -- check for walls */
5014 for (ty = y1 - 1; ty > y2; ty--)
5016 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5024 /* Directly East/West */
5027 /* East -- check for walls */
5030 for (tx = x1 + 1; tx < x2; tx++)
5032 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5036 /* West -- check for walls */
5039 for (tx = x1 - 1; tx > x2; tx--)
5041 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5049 /* Extract some signs */
5050 sx = (dx < 0) ? -1 : 1;
5051 sy = (dy < 0) ? -1 : 1;
5053 /* Vertical "knights" */
5058 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5062 /* Horizontal "knights" */
5067 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5071 /* Calculate scale factor div 2 */
5074 /* Calculate scale factor */
5078 /* Travel horizontally */
5081 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5087 /* Consider the special case where slope == 1. */
5098 /* Note (below) the case (qy == f2), where */
5099 /* the LOS exactly meets the corner of a tile. */
5102 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5113 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5126 /* Travel vertically */
5129 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5145 /* Note (below) the case (qx == f2), where */
5146 /* the LOS exactly meets the corner of a tile. */
5149 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5160 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5181 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)
5186 int brev = rad * rad / dist;
5190 int mdis = distance(y1, x1, y2, x2) + rad;
5192 while (bdis <= mdis)
5196 if ((0 < dist) && (path_n < dist))
5198 POSITION ny = GRID_Y(path_g[path_n]);
5199 POSITION nx = GRID_X(path_g[path_n]);
5200 POSITION nd = distance(ny, nx, y1, x1);
5202 /* Get next base point */
5211 /* Travel from center outward */
5212 for (cdis = 0; cdis <= brad; cdis++)
5214 /* Scan the maximal blast area of radius "cdis" */
5215 for (y = by - cdis; y <= by + cdis; y++)
5217 for (x = bx - cdis; x <= bx + cdis; x++)
5219 /* Ignore "illegal" locations */
5220 if (!in_bounds(y, x)) continue;
5222 /* Enforce a circular "ripple" */
5223 if (distance(y1, x1, y, x) != bdis) continue;
5225 /* Enforce an arc */
5226 if (distance(by, bx, y, x) != cdis) continue;
5232 /* Lights are stopped by opaque terrains */
5233 if (!los(by, bx, y, x)) continue;
5235 case GF_DISINTEGRATE:
5236 /* Disintegration are stopped only by perma-walls */
5237 if (!in_disintegration_range(by, bx, y, x)) continue;
5240 /* Ball explosions are stopped by walls */
5241 if (!projectable(by, bx, y, x)) continue;
5245 /* Save this grid */
5253 /* Encode some more "radius" info */
5254 gm[bdis + 1] = *pgrids;
5256 /* Increase the size */
5257 brad = rad * (path_n + brev) / (dist + brev);
5259 /* Find the next ripple */
5263 /* Store the effect size */
5269 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5270 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5271 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5272 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5273 * @param x 目標X座標 / Target x location (or location to travel "towards")
5274 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5275 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5276 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5277 * @param monspell 効果元のモンスター魔法ID
5278 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5281 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5282 * towards a given location (optionally passing over the heads of interposing
5283 * monsters), and have it do a given amount of damage to the monsters (and
5284 * optionally objects) within the given radius of the final location.
5286 * A "bolt" travels from source to target and affects only the target grid.
5287 * A "beam" travels from source to target, affecting all grids passed through.
5288 * A "ball" travels from source to the target, exploding at the target, and
5289 * affecting everything within the given radius of the target location.
5291 * Traditionally, a "bolt" does not affect anything on the ground, and does
5292 * not pass over the heads of interposing monsters, much like a traditional
5293 * missile, and will "stop" abruptly at the "target" even if no monster is
5294 * positioned there, while a "ball", on the other hand, passes over the heads
5295 * of monsters between the source and target, and affects everything except
5296 * the source monster which lies within the final radius, while a "beam"
5297 * affects every monster between the source and target, except for the casting
5298 * monster (or player), and rarely affects things on the ground.
5300 * Two special flags allow us to use this function in special ways, the
5301 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5302 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5303 * actually projecting from the source monster (or player).
5305 * The player will only get "experience" for monsters killed by himself
5306 * Unique monsters can only be destroyed by attacks from the player
5308 * Only 256 grids can be affected per projection, limiting the effective
5309 * "radius" of standard ball attacks to nine units (diameter nineteen).
5311 * One can project in a given "direction" by combining PROJECT_THRU with small
5312 * offsets to the initial location (see "line_spell()"), or by calculating
5313 * "virtual targets" far away from the player.
5315 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5316 * continuing until it actually hits somethings (useful for "stone to mud").
5318 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5320 * Balls must explode BEFORE hitting walls, or they would affect monsters
5321 * on both sides of a wall. Some bug reports indicate that this is still
5322 * happening in 2.7.8 for Windows, though it appears to be impossible.
5324 * We "pre-calculate" the blast area only in part for efficiency.
5325 * More importantly, this lets us do "explosions" from the "inside" out.
5326 * This results in a more logical distribution of "blast" treasure.
5327 * It also produces a better (in my opinion) animation of the explosion.
5328 * It could be (but is not) used to have the treasure dropped by monsters
5329 * in the middle of the explosion fall "outwards", and then be damaged by
5330 * the blast as it spreads outwards towards the treasure drop location.
5332 * Walls and doors are included in the blast area, so that they can be
5333 * "burned" or "melted" in later versions.
5335 * This algorithm is intended to maximize simplicity, not necessarily
5336 * efficiency, since this function is not a bottleneck in the code.
5338 * We apply the blast effect from ground zero outwards, in several passes,
5339 * first affecting features, then objects, then monsters, then the player.
5340 * This allows walls to be removed before checking the object or monster
5341 * in the wall, and protects objects which are dropped by monsters killed
5342 * in the blast, and allows the player to see all affects before he is
5343 * killed or teleported away. The semantics of this method are open to
5344 * various interpretations, but they seem to work well in practice.
5346 * We process the blast area from ground-zero outwards to allow for better
5347 * distribution of treasure dropped by monsters, and because it provides a
5348 * pleasing visual effect at low cost.
5350 * Note that the damage done by "ball" explosions decreases with distance.
5351 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5353 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5354 * the target, and then the damage "flows" along this beam of destruction.
5355 * The damage at every grid is the same as at the "center" of a "ball"
5356 * explosion, since the "beam" grids are treated as if they ARE at the
5357 * center of a "ball" explosion.
5359 * Currently, specifying "beam" plus "ball" means that locations which are
5360 * covered by the initial "beam", and also covered by the final "ball", except
5361 * for the final grid (the epicenter of the ball), will be "hit twice", once
5362 * by the initial beam, and once by the exploding ball. For the grid right
5363 * next to the epicenter, this results in 150% damage being done. The center
5364 * does not have this problem, for the same reason the final grid in a "beam"
5365 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5366 * grids which are covered by the "ball" will NOT work, as then they will
5367 * receive LESS damage than they should. Do not combine "beam" with "ball".
5369 * The array "gy[],gx[]" with current size "grids" is used to hold the
5370 * collected locations of all grids in the "blast area" plus "beam path".
5372 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5373 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5374 * first blast grid (see above) with radius "N" from the blast center. Note
5375 * that only the first gm[1] grids in the blast area thus take full damage.
5376 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5377 * number of blast grids.
5379 * Note that once the projection is complete, (y2,x2) holds the final location
5380 * of bolts/beams, and the "epicenter" of balls.
5382 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5383 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5384 * implementation of the "distance" function. Also, a bolt can be properly
5385 * viewed as a "ball" with a "rad" of "zero".
5387 * Note that if no "target" is reached before the beam/bolt/ball travels the
5388 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5389 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5391 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5392 * to move from point A to point B, even if the player cannot see part of the
5393 * projection path. Note that in general, the player will *always* see part
5394 * of the path, since it either starts at the player or ends on the player.
5396 * Hack -- we assume that every "projection" is "self-illuminating".
5398 * Hack -- when only a single monster is affected, we automatically track
5399 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5401 * Note that all projections now "explode" at their final destination, even
5402 * if they were being projected at a more distant destination. This means
5403 * that "ball" spells will *always* explode.
5405 * Note that we must call "handle_stuff()" after affecting terrain features
5406 * in the blast radius, in case the "illumination" of the grid was changed,
5407 * and "update_view()" and "update_monsters()" need to be called.
5410 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5420 POSITION y_saver, x_saver; /* For reflecting monsters */
5422 int msec = delay_factor * delay_factor * delay_factor;
5424 /* Assume the player sees nothing */
5425 bool notice = FALSE;
5427 /* Assume the player has seen nothing */
5428 bool visual = FALSE;
5430 /* Assume the player has seen no blast grids */
5433 /* Assume to be a normal ball spell */
5434 bool breath = FALSE;
5436 /* Is the player blind? */
5437 bool blind = (p_ptr->blind ? TRUE : FALSE);
5439 bool old_hide = FALSE;
5441 /* Number of grids in the "path" */
5444 /* Actual grids in the "path" */
5447 /* Number of grids in the "blast area" (including the "beam" path) */
5450 /* Coordinates of the affected grids */
5451 POSITION gx[1024], gy[1024];
5453 /* Encoded "radius" info (see above) */
5456 /* Actual radius encoded in gm[] */
5457 POSITION gm_rad = rad;
5461 /* Attacker's name (prepared before polymorph)*/
5462 GAME_TEXT who_name[MAX_NLEN];
5464 /* Can the player see the source of this effect? */
5465 bool see_s_msg = TRUE;
5467 /* Initialize by null string */
5473 /* Default target of monsterspell is player */
5474 monster_target_y = p_ptr->y;
5475 monster_target_x = p_ptr->x;
5477 /* Hack -- Jump to target */
5478 if (flg & (PROJECT_JUMP))
5483 /* Clear the flag */
5484 flg &= ~(PROJECT_JUMP);
5489 /* Start at player */
5496 /* Start at monster */
5499 x1 = current_floor_ptr->m_list[who].fx;
5500 y1 = current_floor_ptr->m_list[who].fy;
5501 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5513 /* Default "destination" */
5518 /* Hack -- verify stuff */
5519 if (flg & (PROJECT_THRU))
5521 if ((x1 == x2) && (y1 == y2))
5523 flg &= ~(PROJECT_THRU);
5527 /* Handle a breath attack */
5532 if (flg & PROJECT_HIDE) old_hide = TRUE;
5533 flg |= PROJECT_HIDE;
5537 /* Hack -- Assume there will be no blast (max radius 32) */
5538 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5546 /* Collect beam grids */
5547 if (flg & (PROJECT_BEAM))
5558 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5560 case GF_DISINTEGRATE:
5561 flg |= (PROJECT_GRID);
5562 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5566 /* Calculate the projection path */
5568 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5571 /* Giga-Hack SEEKER & SUPER_RAY */
5573 if( typ == GF_SEEKER )
5583 for (i = 0; i < path_n; ++i)
5588 POSITION ny = GRID_Y(path_g[i]);
5589 POSITION nx = GRID_X(path_g[i]);
5600 /* Only do visuals if requested */
5601 if (!blind && !(flg & (PROJECT_HIDE)))
5603 /* Only do visuals if the player can "see" the bolt */
5604 if (panel_contains(y, x) && player_has_los_bold(y, x))
5611 /* Obtain the bolt pict */
5612 p = bolt_pict(oy, ox, y, x, typ);
5614 /* Extract attr/char */
5618 /* Visual effects */
5619 print_rel(c, a, y, x);
5620 move_cursor_relative(y, x);
5621 /*if (fresh_before)*/ Term_fresh();
5622 Term_xtra(TERM_XTRA_DELAY, msec);
5624 /*if (fresh_before)*/ Term_fresh();
5626 /* Display "beam" grids */
5627 if (flg & (PROJECT_BEAM))
5629 /* Obtain the explosion pict */
5630 p = bolt_pict(y, x, y, x, typ);
5632 /* Extract attr/char */
5636 /* Visual effects */
5637 print_rel(c, a, y, x);
5640 /* Hack -- Activate delay */
5644 /* Hack -- delay anyway for consistency */
5647 /* Delay for consistency */
5648 Term_xtra(TERM_XTRA_DELAY, msec);
5651 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5652 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5654 /* The target of monsterspell becomes tha mirror(broken) */
5655 monster_target_y = y;
5656 monster_target_x = x;
5658 remove_mirror(y, x);
5659 next_mirror(&oy, &ox, y, x);
5661 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5662 for (j = last_i; j <= i; j++)
5664 y = GRID_Y(path_g[j]);
5665 x = GRID_X(path_g[j]);
5666 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5667 if (!who && (project_m_n == 1) && !jump) {
5668 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5669 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5673 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5674 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5678 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5683 for(i = last_i ; i < path_n ; i++)
5686 py = GRID_Y(path_g[i]);
5687 px = GRID_X(path_g[i]);
5688 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5690 if (!who && (project_m_n == 1) && !jump) {
5691 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5693 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5697 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5698 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5702 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5706 else if(typ == GF_SUPER_RAY){
5708 int second_step = 0;
5715 for (i = 0; i < path_n; ++i)
5720 POSITION ny = GRID_Y(path_g[i]);
5721 POSITION nx = GRID_X(path_g[i]);
5732 /* Only do visuals if requested */
5733 if (!blind && !(flg & (PROJECT_HIDE)))
5735 /* Only do visuals if the player can "see" the bolt */
5736 if (panel_contains(y, x) && player_has_los_bold(y, x))
5743 /* Obtain the bolt pict */
5744 p = bolt_pict(oy, ox, y, x, typ);
5746 /* Extract attr/char */
5750 /* Visual effects */
5751 print_rel(c, a, y, x);
5752 move_cursor_relative(y, x);
5753 /*if (fresh_before)*/ Term_fresh();
5754 Term_xtra(TERM_XTRA_DELAY, msec);
5756 /*if (fresh_before)*/ Term_fresh();
5758 /* Display "beam" grids */
5759 if (flg & (PROJECT_BEAM))
5761 /* Obtain the explosion pict */
5762 p = bolt_pict(y, x, y, x, typ);
5764 /* Extract attr/char */
5768 /* Visual effects */
5769 print_rel(c, a, y, x);
5772 /* Hack -- Activate delay */
5776 /* Hack -- delay anyway for consistency */
5779 /* Delay for consistency */
5780 Term_xtra(TERM_XTRA_DELAY, msec);
5783 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5784 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5786 if( second_step )continue;
5789 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5791 /* The target of monsterspell becomes tha mirror(broken) */
5792 monster_target_y = y;
5793 monster_target_x = x;
5796 for( j = 0; j <=i ; j++ )
5798 y = GRID_Y(path_g[j]);
5799 x = GRID_X(path_g[j]);
5800 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5804 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5805 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5806 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5807 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5808 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5809 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
5810 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5811 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5814 for( i = 0; i < path_n ; i++ )
5817 py = GRID_Y(path_g[i]);
5818 px = GRID_X(path_g[i]);
5819 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5820 if(!who && (project_m_n == 1) && !jump){
5821 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5822 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5826 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5827 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5831 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5836 /* Project along the path */
5837 for (i = 0; i < path_n; ++i)
5842 POSITION ny = GRID_Y(path_g[i]);
5843 POSITION nx = GRID_X(path_g[i]);
5845 if (flg & PROJECT_DISI)
5847 /* Hack -- Balls explode before reaching walls */
5848 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5850 else if (flg & PROJECT_LOS)
5852 /* Hack -- Balls explode before reaching walls */
5853 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
5857 /* Hack -- Balls explode before reaching walls */
5858 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
5865 /* Collect beam grids */
5866 if (flg & (PROJECT_BEAM))
5873 /* Only do visuals if requested */
5874 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
5876 /* Only do visuals if the player can "see" the bolt */
5877 if (panel_contains(y, x) && player_has_los_bold(y, x))
5884 /* Obtain the bolt pict */
5885 p = bolt_pict(oy, ox, y, x, typ);
5887 /* Extract attr/char */
5891 /* Visual effects */
5892 print_rel(c, a, y, x);
5893 move_cursor_relative(y, x);
5894 /*if (fresh_before)*/ Term_fresh();
5895 Term_xtra(TERM_XTRA_DELAY, msec);
5897 /*if (fresh_before)*/ Term_fresh();
5899 /* Display "beam" grids */
5900 if (flg & (PROJECT_BEAM))
5902 /* Obtain the explosion pict */
5903 p = bolt_pict(y, x, y, x, typ);
5905 /* Extract attr/char */
5909 /* Visual effects */
5910 print_rel(c, a, y, x);
5913 /* Hack -- Activate delay */
5917 /* Hack -- delay anyway for consistency */
5920 /* Delay for consistency */
5921 Term_xtra(TERM_XTRA_DELAY, msec);
5928 /* Save the "blast epicenter" */
5932 if (breath && !path_n)
5938 flg &= ~(PROJECT_HIDE);
5942 /* Start the "explosion" */
5945 /* Hack -- make sure beams get to "explode" */
5953 /* If we found a "target", explode there */
5954 if (dist <= MAX_RANGE)
5956 /* Mega-Hack -- remove the final "beam" grid */
5957 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
5960 * Create a conical breath attack
5971 flg &= ~(PROJECT_HIDE);
5973 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
5977 /* Determine the blast area, work from the inside out */
5978 for (dist = 0; dist <= rad; dist++)
5980 /* Scan the maximal blast area of radius "dist" */
5981 for (y = by - dist; y <= by + dist; y++)
5983 for (x = bx - dist; x <= bx + dist; x++)
5985 /* Ignore "illegal" locations */
5986 if (!in_bounds2(y, x)) continue;
5988 /* Enforce a "circular" explosion */
5989 if (distance(by, bx, y, x) != dist) continue;
5995 /* Lights are stopped by opaque terrains */
5996 if (!los(by, bx, y, x)) continue;
5998 case GF_DISINTEGRATE:
5999 /* Disintegration are stopped only by perma-walls */
6000 if (!in_disintegration_range(by, bx, y, x)) continue;
6003 /* Ball explosions are stopped by walls */
6004 if (!projectable(by, bx, y, x)) continue;
6008 /* Save this grid */
6015 /* Encode some more "radius" info */
6021 /* Speed -- ignore "non-explosions" */
6022 if (!grids) return (FALSE);
6025 /* Display the "blast area" if requested */
6026 if (!blind && !(flg & (PROJECT_HIDE)))
6028 /* Then do the "blast", from inside out */
6029 for (t = 0; t <= gm_rad; t++)
6031 /* Dump everything with this radius */
6032 for (i = gm[t]; i < gm[t+1]; i++)
6034 /* Extract the location */
6038 /* Only do visuals if the player can "see" the blast */
6039 if (panel_contains(y, x) && player_has_los_bold(y, x))
6048 /* Obtain the explosion pict */
6049 p = bolt_pict(y, x, y, x, typ);
6051 /* Extract attr/char */
6055 /* Visual effects -- Display */
6056 print_rel(c, a, y, x);
6060 /* Hack -- center the cursor */
6061 move_cursor_relative(by, bx);
6063 /* Flush each "radius" seperately */
6064 /*if (fresh_before)*/ Term_fresh();
6066 /* Delay (efficiently) */
6067 if (visual || drawn)
6069 Term_xtra(TERM_XTRA_DELAY, msec);
6073 /* Flush the erasing */
6076 /* Erase the explosion drawn above */
6077 for (i = 0; i < grids; i++)
6079 /* Extract the location */
6083 /* Hack -- Erase if needed */
6084 if (panel_contains(y, x) && player_has_los_bold(y, x))
6090 /* Hack -- center the cursor */
6091 move_cursor_relative(by, bx);
6093 /* Flush the explosion */
6094 /*if (fresh_before)*/ Term_fresh();
6098 update_creature(p_ptr);
6100 if (flg & PROJECT_KILL)
6102 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6103 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6107 /* Check features */
6108 if (flg & (PROJECT_GRID))
6110 /* Start with "dist" of zero */
6113 /* Scan for features */
6114 for (i = 0; i < grids; i++)
6116 /* Hack -- Notice new "dist" values */
6117 if (gm[dist+1] == i) dist++;
6119 /* Get the grid location */
6123 /* Find the closest point in the blast */
6126 int d = dist_to_line(y, x, y1, x1, by, bx);
6128 /* Affect the grid */
6129 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6133 /* Affect the grid */
6134 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6139 update_creature(p_ptr);
6142 if (flg & (PROJECT_ITEM))
6144 /* Start with "dist" of zero */
6147 /* Scan for objects */
6148 for (i = 0; i < grids; i++)
6150 /* Hack -- Notice new "dist" values */
6151 if (gm[dist+1] == i) dist++;
6153 /* Get the grid location */
6157 /* Find the closest point in the blast */
6160 int d = dist_to_line(y, x, y1, x1, by, bx);
6162 /* Affect the object in the grid */
6163 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6167 /* Affect the object in the grid */
6168 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6174 /* Check monsters */
6175 if (flg & (PROJECT_KILL))
6182 /* Start with "dist" of zero */
6185 /* Scan for monsters */
6186 for (i = 0; i < grids; i++)
6190 /* Hack -- Notice new "dist" values */
6191 if (gm[dist + 1] == i) dist++;
6193 /* Get the grid location */
6197 /* A single bolt may be reflected */
6200 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6201 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6203 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6204 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6205 (!who || dist_hack > 1) && !one_in_(10))
6208 int max_attempts = 10;
6210 /* Choose 'new' target */
6213 t_y = y_saver - 1 + randint1(3);
6214 t_x = x_saver - 1 + randint1(3);
6217 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6219 if (max_attempts < 1)
6225 sound(SOUND_REFLECT);
6228 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6229 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6230 else if (m_ptr->r_idx == MON_DIO)
6231 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6233 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6235 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6237 /* Reflected bolts randomly target either one */
6238 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6239 else flg |= PROJECT_PLAYER;
6241 /* The bolt is reflected */
6242 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6244 /* Don't affect the monster any longer */
6250 /* Find the closest point in the blast */
6253 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6257 effective_dist = dist;
6261 /* There is the riding player on this monster */
6262 if (p_ptr->riding && player_bold(y, x))
6264 /* Aimed on the player */
6265 if (flg & PROJECT_PLAYER)
6267 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6270 * A beam or bolt is well aimed
6272 * So don't affects the mount.
6279 * The spell is not well aimed,
6280 * So partly affect the mount too.
6287 * This grid is the original target.
6288 * Or aimed on your horse.
6290 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6292 /* Hit the mount with full damage */
6296 * Otherwise this grid is not the
6297 * original target, it means that line
6298 * of fire is obstructed by this
6302 * A beam or bolt will hit either
6303 * player or mount. Choose randomly.
6305 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6309 /* Hit the mount with full damage */
6313 /* Hit the player later */
6314 flg |= PROJECT_PLAYER;
6316 /* Don't affect the mount */
6322 * The spell is not well aimed, so
6323 * partly affect both player and
6332 /* Affect the monster in the grid */
6333 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6337 /* Player affected one monster (without "jumping") */
6338 if (!who && (project_m_n == 1) && !jump)
6343 /* Track if possible */
6344 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6346 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6350 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6351 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6359 if (flg & (PROJECT_KILL))
6361 /* Start with "dist" of zero */
6364 /* Scan for player */
6365 for (i = 0; i < grids; i++)
6369 /* Hack -- Notice new "dist" values */
6370 if (gm[dist+1] == i) dist++;
6372 /* Get the grid location */
6376 /* Affect the player? */
6377 if (!player_bold(y, x)) continue;
6379 /* Find the closest point in the blast */
6382 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6386 effective_dist = dist;
6389 /* Target may be your horse */
6392 /* Aimed on the player */
6393 if (flg & PROJECT_PLAYER)
6395 /* Hit the player with full damage */
6399 * Hack -- When this grid was not the
6400 * original target, a beam or bolt
6401 * would hit either player or mount,
6402 * and should be choosen randomly.
6404 * But already choosen to hit the
6405 * mount at this point.
6407 * Or aimed on your horse.
6409 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6412 * A beam or bolt is well aimed
6414 * So don't affects the player.
6421 * The spell is not well aimed,
6422 * So partly affect the player too.
6428 /* Affect the player */
6429 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6435 GAME_TEXT m_name[MAX_NLEN];
6437 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6439 if (rakubadam_m > 0)
6441 if (rakuba(rakubadam_m, FALSE))
6443 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6446 if (p_ptr->riding && rakubadam_p > 0)
6448 if(rakuba(rakubadam_p, FALSE))
6450 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6455 /* Return "something was noticed" */
6460 * @brief 鏡魔法「封魔結界」の効果処理
6462 * @return 効果があったらTRUEを返す
6464 bool binding_field(HIT_POINT dam)
6466 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6467 int mirror_num = 0; /* 鏡の数 */
6469 POSITION centersign;
6470 POSITION x1, x2, y1, y2;
6472 int msec = delay_factor*delay_factor*delay_factor;
6475 POSITION point_x[3];
6476 POSITION point_y[3];
6478 /* Default target of monsterspell is player */
6479 monster_target_y = p_ptr->y;
6480 monster_target_x = p_ptr->x;
6482 for (x = 0; x < current_floor_ptr->width; x++)
6484 for (y = 0; y < current_floor_ptr->height; y++)
6486 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6487 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6488 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6489 player_has_los_bold(y, x) &&
6490 projectable(p_ptr->y, p_ptr->x, y, x)
6492 mirror_y[mirror_num] = y;
6493 mirror_x[mirror_num] = x;
6499 if (mirror_num < 2)return FALSE;
6501 point_x[0] = randint0(mirror_num);
6503 point_x[1] = randint0(mirror_num);
6504 } while (point_x[0] == point_x[1]);
6506 point_y[0] = mirror_y[point_x[0]];
6507 point_x[0] = mirror_x[point_x[0]];
6508 point_y[1] = mirror_y[point_x[1]];
6509 point_x[1] = mirror_x[point_x[1]];
6510 point_y[2] = p_ptr->y;
6511 point_x[2] = p_ptr->x;
6513 x = point_x[0] + point_x[1] + point_x[2];
6514 y = point_y[0] + point_y[1] + point_y[2];
6516 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6517 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6518 if (centersign == 0)return FALSE;
6520 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6521 x1 = x1 < point_x[2] ? x1 : point_x[2];
6522 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6523 y1 = y1 < point_y[2] ? y1 : point_y[2];
6525 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6526 x2 = x2 > point_x[2] ? x2 : point_x[2];
6527 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6528 y2 = y2 > point_y[2] ? y2 : point_y[2];
6530 for (y = y1; y <= y2; y++) {
6531 for (x = x1; x <= x2; x++) {
6532 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6533 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6534 centersign*((point_x[1] - x)*(point_y[2] - y)
6535 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6536 centersign*((point_x[2] - x)*(point_y[0] - y)
6537 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6539 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6540 /* Visual effects */
6542 && panel_contains(y, x)) {
6543 p = bolt_pict(y, x, y, x, GF_MANA);
6544 print_rel(PICT_C(p), PICT_A(p), y, x);
6545 move_cursor_relative(y, x);
6546 /*if (fresh_before)*/ Term_fresh();
6547 Term_xtra(TERM_XTRA_DELAY, msec);
6553 for (y = y1; y <= y2; y++) {
6554 for (x = x1; x <= x2; x++) {
6555 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6556 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6557 centersign*((point_x[1] - x)*(point_y[2] - y)
6558 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6559 centersign*((point_x[2] - x)*(point_y[0] - y)
6560 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6562 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6563 (void)project_f(0, 0, y, x, dam, GF_MANA);
6568 for (y = y1; y <= y2; y++) {
6569 for (x = x1; x <= x2; x++) {
6570 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6571 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6572 centersign*((point_x[1] - x)*(point_y[2] - y)
6573 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6574 centersign*((point_x[2] - x)*(point_y[0] - y)
6575 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6577 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6578 (void)project_o(0, 0, y, x, dam, GF_MANA);
6583 for (y = y1; y <= y2; y++) {
6584 for (x = x1; x <= x2; x++) {
6585 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6586 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6587 centersign*((point_x[1] - x)*(point_y[2] - y)
6588 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6589 centersign*((point_x[2] - x)*(point_y[0] - y)
6590 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6592 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6593 (void)project_m(0, 0, y, x, dam, GF_MANA,
6594 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6600 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6601 remove_mirror(point_y[0], point_x[0]);
6608 * @brief 鏡魔法「鏡の封印」の効果処理
6610 * @return 効果があったらTRUEを返す
6612 void seal_of_mirror(HIT_POINT dam)
6616 for (x = 0; x < current_floor_ptr->width; x++)
6618 for (y = 0; y < current_floor_ptr->height; y++)
6620 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6622 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6623 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6625 if (!current_floor_ptr->grid_array[y][x].m_idx)
6627 remove_mirror(y, x);
6639 * @brief 領域魔法に応じて技能の名称を返す。
6640 * @param tval 魔法書のtval
6641 * @return 領域魔法の技能名称を保管した文字列ポインタ
6643 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6647 case TV_HISSATSU_BOOK:
6648 return _("必殺技", "art");
6650 return _("祈り", "prayer");
6652 return _("歌", "song");
6654 return _("呪文", "spell");