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);
346 /* Update some things */
347 p_ptr->update |= (PU_FLOW);
355 if (!cave_naked_bold(y, x)) break;
356 if (player_bold(y, x)) break;
357 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
358 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
370 if (!cave_naked_bold(y, x)) break;
371 if (player_bold(y, x)) break;
372 cave_set_feat(y, x, feat_tree);
373 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
379 if (!cave_naked_bold(y, x)) break;
380 g_ptr->info |= CAVE_OBJECT;
381 g_ptr->mimic = feat_glyph;
389 if (!cave_naked_bold(y, x)) break;
390 if (player_bold(y, x)) break;
391 cave_set_feat(y, x, feat_granite);
397 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
400 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
401 cave_set_feat(y, x, feat_shallow_lava);
405 cave_set_feat(y, x, feat_deep_lava);
412 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
415 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
416 cave_set_feat(y, x, feat_shallow_water);
420 cave_set_feat(y, x, feat_deep_water);
425 /* Lite up the grid */
429 /* Turn on the light */
430 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
432 g_ptr->info |= (CAVE_GLOW);
435 update_local_illumination(y, x);
438 if (player_can_see_bold(y, x)) obvious = TRUE;
440 /* Mega-Hack -- Update the monster in the affected grid */
441 /* This allows "spear of light" (etc) to work "correctly" */
442 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
444 if (p_ptr->special_defense & NINJA_S_STEALTH)
446 if (player_bold(y, x)) set_superstealth(FALSE);
453 /* Darken the grid */
457 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
460 /* Turn off the light. */
463 if (current_floor_ptr->dun_level || !is_daytime())
465 for (j = 0; j < 9; j++)
467 int by = y + ddy_ddd[j];
468 int bx = x + ddx_ddd[j];
470 if (in_bounds2(by, bx))
472 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
474 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
485 g_ptr->info &= ~(CAVE_GLOW);
487 /* Hack -- Forget "boring" grids */
488 if (!have_flag(f_ptr->flags, FF_REMEMBER))
491 g_ptr->info &= ~(CAVE_MARK);
498 update_local_illumination(y, x);
500 if (player_can_see_bold(y, x)) obvious = TRUE;
502 /* Mega-Hack -- Update the monster in the affected grid */
503 /* This allows "spear of light" (etc) to work "correctly" */
504 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
514 if (is_mirror_grid(g_ptr))
516 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
519 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
522 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
524 if (known && (g_ptr->info & CAVE_MARK))
526 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
530 /* Destroy the wall */
531 cave_alter_feat(y, x, FF_HURT_ROCK);
533 /* Update some things */
534 p_ptr->update |= (PU_FLOW);
541 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
543 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
546 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
549 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
551 if (known && (g_ptr->info & CAVE_MARK))
553 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
557 /* Destroy the wall */
558 cave_alter_feat(y, x, FF_HURT_ROCK);
560 /* Update some things */
561 p_ptr->update |= (PU_FLOW);
566 case GF_DISINTEGRATE:
568 /* Destroy mirror/glyph */
569 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
572 /* Permanent features don't get effect */
573 /* But not protect monsters and other objects */
574 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
576 cave_alter_feat(y, x, FF_HURT_DISI);
578 /* Update some things -- similar to GF_KILL_WALL */
579 p_ptr->update |= (PU_FLOW);
586 /* Return "Anything seen?" */
593 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
594 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
595 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
596 * @param y 目標Y座標 / Target y location (or location to travel "towards")
597 * @param x 目標X座標 / Target x location (or location to travel "towards")
598 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
599 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
600 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
603 * We are called from "project()" to "damage" objects
605 * We are called both for "beam" effects and "ball" effects.
607 * Perhaps we should only SOMETIMES damage things on the ground.
609 * The "r" parameter is the "distance from ground zero".
611 * Note that we determine if the player can "see" anything that happens
612 * by taking into account: blindness, line-of-sight, and illumination.
614 * We also "see" grids which are "memorized", probably a hack
616 * We return "TRUE" if the effect of the projection is "obvious".
619 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
621 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
623 OBJECT_IDX this_o_idx, next_o_idx = 0;
625 bool obvious = FALSE;
626 bool known = player_has_los_bold(y, x);
628 BIT_FLAGS flgs[TR_FLAG_SIZE];
630 GAME_TEXT o_name[MAX_NLEN];
632 KIND_OBJECT_IDX k_idx = 0;
633 bool is_potion = FALSE;
638 /* Reduce damage by distance */
639 dam = (dam + r) / (r + 1);
642 /* Scan all objects in the grid */
643 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
645 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
649 bool do_kill = FALSE;
651 concptr note_kill = NULL;
654 /* Get the "plural"-ness */
655 bool plural = (o_ptr->number > 1);
657 next_o_idx = o_ptr->next_o_idx;
658 object_flags(o_ptr, flgs);
660 /* Check for artifact */
661 if (object_is_artifact(o_ptr)) is_art = TRUE;
663 /* Analyze the type */
666 /* Acid -- Lots of things */
669 if (hates_acid(o_ptr))
672 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
673 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
678 /* Elec -- Rings and Wands */
681 if (hates_elec(o_ptr))
684 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
685 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
690 /* Fire -- Flammable objects */
693 if (hates_fire(o_ptr))
696 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
697 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
702 /* Cold -- potions and flasks */
705 if (hates_cold(o_ptr))
707 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
709 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
717 if (hates_fire(o_ptr))
720 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
721 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
723 if (hates_elec(o_ptr))
727 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
728 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
736 if (hates_fire(o_ptr))
739 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
740 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
742 if (hates_cold(o_ptr))
746 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
747 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
752 /* Hack -- break potions and such */
758 if (hates_cold(o_ptr))
760 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
766 /* Mana and Chaos -- destroy everything */
772 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
776 case GF_DISINTEGRATE:
779 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
786 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
787 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
788 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
792 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
796 if (object_is_cursed(o_ptr))
799 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
806 identify_item(o_ptr);
808 /* Auto-inscription */
809 autopick_alter_item((-this_o_idx), FALSE);
817 /* Chests are noticed only if trapped or locked */
818 if (o_ptr->tval == TV_CHEST)
820 /* Disarm/Unlock traps */
823 /* Disarm or Unlock */
824 o_ptr->pval = (0 - o_ptr->pval);
829 if (known && (o_ptr->marked & OM_FOUND))
831 msg_print(_("カチッと音がした!", "Click!"));
841 if (o_ptr->tval == TV_CORPSE)
846 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
847 mode |= PM_FORCE_PET;
849 for (i = 0; i < o_ptr->number ; i++)
851 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
852 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
856 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
860 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
862 note_kill = _("生き返った。", " revived.");
866 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
877 /* Attempt to destroy the object */
880 /* Effect "observed" */
881 if (known && (o_ptr->marked & OM_FOUND))
884 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
887 /* Artifacts, and other objects, get to resist */
888 if (is_art || ignore)
890 /* Observe the resist */
891 if (known && (o_ptr->marked & OM_FOUND))
893 msg_format(_("%sは影響を受けない!",
894 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
901 /* Describe if needed */
902 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
904 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
907 k_idx = o_ptr->k_idx;
908 is_potion = object_is_potion(o_ptr);
909 delete_object_idx(this_o_idx);
911 /* Potions produce effects when 'shattered' */
914 (void)potion_smash_effect(who, y, x, k_idx);
922 /* Return "Anything seen?" */
928 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
929 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
930 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
931 * @param y 目標Y座標 / Target y location (or location to travel "towards")
932 * @param x 目標X座標 / Target x location (or location to travel "towards")
933 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
934 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
936 * @param see_s_msg TRUEならばメッセージを表示する
937 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
940 * This routine takes a "source monster" (by index) which is mostly used to
941 * determine if the player is causing the damage, and a "radius" (see below),
942 * which is used to decrease the power of explosions with distance, and a
943 * location, via integers which are modified by certain types of attacks
944 * (polymorph and teleport being the obvious ones), a default damage, which
945 * is modified as needed based on various properties, and finally a "damage
949 * Note that this routine can handle "no damage" attacks (like teleport) by
950 * taking a "zero" damage, and can even take "parameters" to attacks (like
951 * confuse) by accepting a "damage", using it to calculate the effect, and
952 * then setting the damage to zero. Note that the "damage" parameter is
953 * divided by the radius, so monsters not at the "epicenter" will not take
954 * as much damage (or whatever)...
957 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
958 * may result in a dereference of an invalid pointer.
961 * Various messages are produced, and damage is applied.
964 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
965 * actually be "made" of that substance, or "breathe" big balls of it.
966 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
968 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
969 * and hurts evil less. If can breath nether, then it resists it as well.
972 * Damage reductions use the following formulas:
973 * Note that "dam = dam * 6 / (randint1(6) + 6);"
974 * gives avg damage of .655, ranging from .858 to .500
975 * Note that "dam = dam * 5 / (randint1(6) + 6);"
976 * gives avg damage of .544, ranging from .714 to .417
977 * Note that "dam = dam * 4 / (randint1(6) + 6);"
978 * gives avg damage of .444, ranging from .556 to .333
979 * Note that "dam = dam * 3 / (randint1(6) + 6);"
980 * gives avg damage of .327, ranging from .427 to .250
981 * Note that "dam = dam * 2 / (randint1(6) + 6);"
982 * gives something simple.
985 * In this function, "result" messages are postponed until the end, where
986 * the "note" string is appended to the monster name, if not NULL. So,
987 * to make a spell have "no effect" just set "note" to NULL. You should
988 * also set "notice" to FALSE, or the player will learn what the spell does.
991 * We attempt to return "TRUE" if the player saw anything "useful" happen.
995 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)
999 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1001 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1002 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
1004 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1008 /* Is the monster "seen"? */
1009 bool seen = m_ptr->ml;
1010 bool seen_msg = is_seen(m_ptr);
1012 bool slept = (bool)MON_CSLEEP(m_ptr);
1014 /* Were the effects "obvious" (if seen)? */
1015 bool obvious = FALSE;
1017 /* Can the player know about this effect? */
1018 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1020 /* Were the effects "irrelevant"? */
1021 bool skipped = FALSE;
1023 /* Gets the monster angry at the source of the effect? */
1024 bool get_angry = FALSE;
1026 /* Polymorph setting (true or false) */
1027 bool do_poly = FALSE;
1029 /* Teleport setting (max distance) */
1032 /* Confusion setting (amount to confuse) */
1035 /* Stunning setting (amount to stun) */
1038 /* Sleep amount (amount to sleep) */
1041 /* Fear amount (amount to fear) */
1044 /* Time amount (amount to time) */
1047 bool heal_leper = FALSE;
1049 /* Hold the monster name */
1050 GAME_TEXT m_name[MAX_NLEN];
1053 PARAMETER_VALUE photo = 0;
1055 /* Assume no note */
1056 concptr note = NULL;
1058 /* Assume a default death */
1059 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1061 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1064 if (!g_ptr->m_idx) return (FALSE);
1066 /* Never affect projector */
1067 if (who && (g_ptr->m_idx == who)) return (FALSE);
1068 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1069 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1071 /* Don't affect already death monsters */
1072 /* Prevents problems with chain reactions of exploding monsters */
1073 if (m_ptr->hp < 0) return (FALSE);
1075 /* Reduce damage by distance */
1076 dam = (dam + r) / (r + 1);
1079 /* Get the monster name (BEFORE polymorphing) */
1080 monster_desc(m_name, m_ptr, 0);
1082 /* Get the monster possessive ("his"/"her"/"its") */
1083 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1085 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1087 if (r_ptr->flagsr & RFR_RES_ALL &&
1088 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1089 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1091 note = _("には完全な耐性がある!", " is immune.");
1093 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1094 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1098 /* Analyze the damage type */
1101 /* Magic Missile -- pure damage */
1104 if (seen) obvious = TRUE;
1111 if (seen) obvious = TRUE;
1112 if (r_ptr->flagsr & RFR_IM_ACID)
1114 note = _("にはかなり耐性がある!", " resists a lot.");
1116 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1124 if (seen) obvious = TRUE;
1125 if (r_ptr->flagsr & RFR_IM_ELEC)
1127 note = _("にはかなり耐性がある!", " resists a lot.");
1129 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1137 if (seen) obvious = TRUE;
1138 if (r_ptr->flagsr & RFR_IM_FIRE)
1140 note = _("にはかなり耐性がある!", " resists a lot.");
1142 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1144 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1146 note = _("はひどい痛手をうけた。", " is hit hard.");
1148 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1156 if (seen) obvious = TRUE;
1157 if (r_ptr->flagsr & RFR_IM_COLD)
1159 note = _("にはかなり耐性がある!", " resists a lot.");
1161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1163 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1165 note = _("はひどい痛手をうけた。", " is hit hard.");
1167 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1175 if (seen) obvious = TRUE;
1176 if (r_ptr->flagsr & RFR_IM_POIS)
1178 note = _("にはかなり耐性がある!", " resists a lot.");
1180 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1188 if (seen) obvious = TRUE;
1189 if (r_ptr->flagsr & RFR_IM_POIS)
1191 note = _("には耐性がある。", " resists.");
1192 dam *= 3; dam /= randint1(6) + 6;
1193 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1195 else if (one_in_(3)) do_poly = TRUE;
1199 /* Hellfire -- hurts Evil */
1202 if (seen) obvious = TRUE;
1203 if (r_ptr->flags3 & RF3_GOOD)
1205 note = _("はひどい痛手をうけた。", " is hit hard.");
1207 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1212 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1215 if (seen) obvious = TRUE;
1216 if (r_ptr->flags3 & RF3_EVIL)
1219 note = _("はひどい痛手をうけた。", " is hit hard.");
1220 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1224 note = _("には耐性がある。", " resists.");
1225 dam *= 3; dam /= randint1(6) + 6;
1230 /* Arrow -- XXX no defense */
1233 if (seen) obvious = TRUE;
1237 /* Plasma -- XXX perhaps check ELEC or FIRE */
1240 if (seen) obvious = TRUE;
1241 if (r_ptr->flagsr & RFR_RES_PLAS)
1243 note = _("には耐性がある。", " resists.");
1244 dam *= 3; dam /= randint1(6) + 6;
1245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1250 /* Nether -- see above */
1253 if (seen) obvious = TRUE;
1254 if (r_ptr->flagsr & RFR_RES_NETH)
1256 if (r_ptr->flags3 & RF3_UNDEAD)
1258 note = _("には完全な耐性がある!", " is immune.");
1260 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1264 note = _("には耐性がある。", " resists.");
1265 dam *= 3; dam /= randint1(6) + 6;
1267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1269 else if (r_ptr->flags3 & RF3_EVIL)
1271 note = _("はいくらか耐性を示した。", " resists somewhat.");
1273 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1278 /* Water (acid) damage -- Water spirits/elementals are immune */
1281 if (seen) obvious = TRUE;
1282 if (r_ptr->flagsr & RFR_RES_WATE)
1284 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1286 note = _("には完全な耐性がある!", " is immune.");
1291 note = _("には耐性がある。", " resists.");
1292 dam *= 3; dam /= randint1(6) + 6;
1294 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1299 /* Chaos -- Chaos breathers resist */
1302 if (seen) obvious = TRUE;
1303 if (r_ptr->flagsr & RFR_RES_CHAO)
1305 note = _("には耐性がある。", " resists.");
1306 dam *= 3; dam /= randint1(6) + 6;
1307 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1309 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1311 note = _("はいくらか耐性を示した。", " resists somewhat.");
1312 dam *= 3; dam /= randint1(6) + 6;
1313 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1318 do_conf = (5 + randint1(11) + r) / (r + 1);
1323 /* Shards -- Shard breathers resist */
1326 if (seen) obvious = TRUE;
1327 if (r_ptr->flagsr & RFR_RES_SHAR)
1329 note = _("には耐性がある。", " resists.");
1330 dam *= 3; dam /= randint1(6) + 6;
1331 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1336 /* Rocket: Shard resistance helps */
1339 if (seen) obvious = TRUE;
1340 if (r_ptr->flagsr & RFR_RES_SHAR)
1342 note = _("はいくらか耐性を示した。", " resists somewhat.");
1344 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1350 /* Sound -- Sound breathers resist */
1353 if (seen) obvious = TRUE;
1354 if (r_ptr->flagsr & RFR_RES_SOUN)
1356 note = _("には耐性がある。", " resists.");
1357 dam *= 2; dam /= randint1(6) + 6;
1358 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1360 else do_stun = (10 + randint1(15) + r) / (r + 1);
1367 if (seen) obvious = TRUE;
1368 if (r_ptr->flags3 & RF3_NO_CONF)
1370 note = _("には耐性がある。", " resists.");
1371 dam *= 3; dam /= randint1(6) + 6;
1372 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1374 else do_conf = (10 + randint1(15) + r) / (r + 1);
1378 /* Disenchantment -- Breathers and Disenchanters resist */
1381 if (seen) obvious = TRUE;
1382 if (r_ptr->flagsr & RFR_RES_DISE)
1384 note = _("には耐性がある。", " resists.");
1385 dam *= 3; dam /= randint1(6) + 6;
1386 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1391 /* Nexus -- Breathers and Existers resist */
1394 if (seen) obvious = TRUE;
1395 if (r_ptr->flagsr & RFR_RES_NEXU)
1397 note = _("には耐性がある。", " resists.");
1398 dam *= 3; dam /= randint1(6) + 6;
1399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1407 if (seen) obvious = TRUE;
1408 if (r_ptr->flagsr & RFR_RES_WALL)
1410 note = _("には耐性がある。", " resists.");
1411 dam *= 3; dam /= randint1(6) + 6;
1412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1414 else do_stun = (randint1(15) + r) / (r + 1);
1418 /* Inertia -- breathers resist */
1421 if (seen) obvious = TRUE;
1422 if (r_ptr->flagsr & RFR_RES_INER)
1424 note = _("には耐性がある。", " resists.");
1425 dam *= 3; dam /= randint1(6) + 6;
1426 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1430 /* Powerful monsters can resist */
1431 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1436 /* Normal monsters slow down */
1439 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1441 note = _("の動きが遅くなった。", " starts moving slower.");
1448 /* Time -- breathers resist */
1451 if (seen) obvious = TRUE;
1452 if (r_ptr->flagsr & RFR_RES_TIME)
1454 note = _("には耐性がある。", " resists.");
1455 dam *= 3; dam /= randint1(6) + 6;
1456 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1458 else do_time = (dam + 1) / 2;
1462 /* Gravity -- breathers resist */
1465 bool resist_tele = FALSE;
1467 if (seen) obvious = TRUE;
1468 if (r_ptr->flagsr & RFR_RES_TELE)
1470 if (r_ptr->flags1 & (RF1_UNIQUE))
1472 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1473 note = _("には効果がなかった。", " is unaffected!");
1476 else if (r_ptr->level > randint1(100))
1478 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1479 note = _("には耐性がある!", " resists!");
1484 if (!resist_tele) do_dist = 10;
1486 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1488 if (r_ptr->flagsr & RFR_RES_GRAV)
1490 note = _("には耐性がある!", " resists!");
1491 dam *= 3; dam /= randint1(6) + 6;
1493 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1498 /* Powerful monsters can resist */
1499 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1500 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1504 /* Normal monsters slow down */
1507 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1509 note = _("の動きが遅くなった。", " starts moving slower.");
1514 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1516 /* Attempt a saving throw */
1517 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1518 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1522 /* No obvious effect */
1523 note = _("には効果がなかった。", " is unaffected!");
1535 if (seen) obvious = TRUE;
1541 case GF_DISINTEGRATE:
1543 if (seen) obvious = TRUE;
1544 if (r_ptr->flags3 & RF3_HURT_ROCK)
1546 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1547 note = _("の皮膚がただれた!", " loses some skin!");
1548 note_dies = _("は蒸発した!", " evaporates!");
1556 if (seen) obvious = TRUE;
1558 /* PSI only works if the monster can see you! -- RG */
1559 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1562 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1566 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1569 note = _("には完全な耐性がある!", " is immune.");
1570 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1573 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1574 (r_ptr->flags3 & RF3_ANIMAL) ||
1575 (r_ptr->level > randint1(3 * dam)))
1577 note = _("には耐性がある!", " resists!");
1581 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1582 * attacks back on them
1584 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1585 (r_ptr->level > p_ptr->lev / 2) &&
1589 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1590 (seen ? "%^s's corrupted mind backlashes your attack!" :
1591 "%^ss corrupted mind backlashes your attack!")), m_name);
1594 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1596 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1600 /* Injure +/- confusion */
1601 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1602 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1603 if (one_in_(4) && !CHECK_MULTISHADOW())
1605 switch (randint1(4))
1608 set_confused(p_ptr->confused + 3 + randint1(dam));
1611 set_stun(p_ptr->stun + randint1(dam));
1615 if (r_ptr->flags3 & RF3_NO_FEAR)
1616 note = _("には効果がなかった。", " is unaffected.");
1618 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1622 if (!p_ptr->free_act)
1623 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1632 if ((dam > 0) && one_in_(4))
1634 switch (randint1(4))
1637 do_conf = 3 + randint1(dam);
1640 do_stun = 3 + randint1(dam);
1643 do_fear = 3 + randint1(dam);
1646 note = _("は眠り込んでしまった!", " falls asleep!");
1647 do_sleep = 3 + randint1(dam);
1652 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1658 if (seen) obvious = TRUE;
1659 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1662 note = _("には完全な耐性がある!", " is immune.");
1664 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1665 (r_ptr->flags3 & RF3_ANIMAL) ||
1666 (r_ptr->level > randint1(3 * dam)))
1668 note = _("には耐性がある!", " resists!");
1672 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1673 * attacks back on them
1675 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1676 (r_ptr->level > p_ptr->lev / 2) &&
1680 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1681 (seen ? "%^s's corrupted mind backlashes your attack!" :
1682 "%^ss corrupted mind backlashes your attack!")), m_name);
1684 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1686 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1690 /* Injure + mana drain */
1691 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1692 if (!CHECK_MULTISHADOW())
1694 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1695 p_ptr->csp -= damroll(5, dam) / 2;
1696 if (p_ptr->csp < 0) p_ptr->csp = 0;
1697 p_ptr->redraw |= PR_MANA;
1698 p_ptr->window |= (PW_SPELL);
1700 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1707 int b = damroll(5, dam) / 4;
1708 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1709 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1710 (seen ? "You convert %s's pain into %s!" :
1711 "You convert %ss pain into %s!"));
1712 msg_format(msg, m_name, str);
1714 b = MIN(p_ptr->msp, p_ptr->csp + b);
1716 p_ptr->redraw |= PR_MANA;
1717 p_ptr->window |= (PW_SPELL);
1719 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1723 case GF_TELEKINESIS:
1725 if (seen) obvious = TRUE;
1728 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1733 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1735 /* Attempt a saving throw */
1736 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1737 (r_ptr->level > 5 + randint1(dam)))
1741 /* No obvious effect */
1747 /* Psycho-spear -- powerful magic missile */
1750 if (seen) obvious = TRUE;
1754 /* Meteor -- powerful magic missile */
1757 if (seen) obvious = TRUE;
1763 if (!is_hostile(m_ptr)) break;
1764 if (seen) obvious = TRUE;
1765 /* Attempt a saving throw */
1766 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1767 (r_ptr->flags3 & RF3_NO_CONF) ||
1768 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1770 /* Memorize a flag */
1771 if (r_ptr->flags3 & RF3_NO_CONF)
1773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1780 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1781 * attacks back on them
1783 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1784 (r_ptr->level > p_ptr->lev / 2) &&
1788 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1789 (seen ? "%^s's corrupted mind backlashes your attack!" :
1790 "%^ss corrupted mind backlashes your attack!")), m_name);
1793 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1795 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1799 /* Confuse, stun, terrify */
1800 switch (randint1(4))
1803 set_stun(p_ptr->stun + dam / 2);
1806 set_confused(p_ptr->confused + dam / 2);
1810 if (r_ptr->flags3 & RF3_NO_FEAR)
1811 note = _("には効果がなかった。", " is unaffected.");
1813 set_afraid(p_ptr->afraid + dam);
1820 /* No obvious effect */
1821 note = _("には効果がなかった。", " is unaffected.");
1827 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1829 note = _("があなたに隷属した。", " is in your thrall!");
1834 switch (randint1(4))
1848 /* No "real" damage */
1853 /* Ice -- Cold + Cuts + Stun */
1856 if (seen) obvious = TRUE;
1857 do_stun = (randint1(15) + 1) / (r + 1);
1858 if (r_ptr->flagsr & RFR_IM_COLD)
1860 note = _("にはかなり耐性がある!", " resists a lot.");
1862 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1864 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1866 note = _("はひどい痛手をうけた。", " is hit hard.");
1868 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1875 case GF_HYPODYNAMIA:
1877 if (seen) obvious = TRUE;
1878 if (!monster_living(m_ptr->r_idx))
1880 if (is_original_ap_and_seen(m_ptr))
1882 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1883 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1884 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1886 note = _("には効果がなかった。", " is unaffected.");
1890 else do_time = (dam+7)/8;
1898 if (seen) obvious = TRUE;
1899 if (!monster_living(m_ptr->r_idx))
1901 if (is_original_ap_and_seen(m_ptr))
1903 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1904 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1905 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1907 note = _("には完全な耐性がある!", " is immune.");
1911 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
1912 (randint1(888) != 666)) ||
1913 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
1914 randint1(100) != 66))
1916 note = _("には耐性がある!", " resists!");
1924 /* Polymorph monster (Use "dam" as "power") */
1927 if (seen) obvious = TRUE;
1928 /* Attempt to polymorph (see below) */
1931 /* Powerful monsters can resist */
1932 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1933 (r_ptr->flags1 & RF1_QUESTOR) ||
1934 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1936 note = _("には効果がなかった。", " is unaffected.");
1941 /* No "real" damage */
1948 /* Clone monsters (Ignore "dam") */
1951 if (seen) obvious = TRUE;
1953 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
1955 note = _("には効果がなかった。", " is unaffected.");
1960 m_ptr->hp = m_ptr->maxhp;
1962 /* Attempt to clone. */
1963 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
1965 note = _("が分裂した!", " spawns!");
1969 /* No "real" damage */
1976 /* Heal Monster (use "dam" as amount of healing) */
1979 if (seen) obvious = TRUE;
1982 (void)set_monster_csleep(g_ptr->m_idx, 0);
1984 if (m_ptr->maxhp < m_ptr->max_maxhp)
1986 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
1987 m_ptr->maxhp = m_ptr->max_maxhp;
1992 /* Redraw (later) if needed */
1993 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
1994 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2002 if (seen) obvious = TRUE;
2005 (void)set_monster_csleep(g_ptr->m_idx, 0);
2006 if (MON_STUNNED(m_ptr))
2008 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2009 (void)set_monster_stunned(g_ptr->m_idx, 0);
2011 if (MON_CONFUSED(m_ptr))
2013 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2014 (void)set_monster_confused(g_ptr->m_idx, 0);
2016 if (MON_MONFEAR(m_ptr))
2018 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2019 (void)set_monster_monfear(g_ptr->m_idx, 0);
2023 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2026 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2030 chg_virtue(V_VITALITY, 1);
2032 if (r_ptr->flags1 & RF1_UNIQUE)
2033 chg_virtue(V_INDIVIDUALISM, 1);
2035 if (is_friendly(m_ptr))
2036 chg_virtue(V_HONOUR, 1);
2037 else if (!(r_ptr->flags3 & RF3_EVIL))
2039 if (r_ptr->flags3 & RF3_GOOD)
2040 chg_virtue(V_COMPASSION, 2);
2042 chg_virtue(V_COMPASSION, 1);
2045 if (r_ptr->flags3 & RF3_ANIMAL)
2046 chg_virtue(V_NATURE, 1);
2049 if (m_ptr->r_idx == MON_LEPER)
2052 if (!who) chg_virtue(V_COMPASSION, 5);
2055 /* Redraw (later) if needed */
2056 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2057 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2059 note = _("は体力を回復したようだ。", " looks healthier.");
2061 /* No "real" damage */
2067 /* Speed Monster (Ignore "dam") */
2070 if (seen) obvious = TRUE;
2073 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2075 note = _("の動きが速くなった。", " starts moving faster.");
2080 if (r_ptr->flags1 & RF1_UNIQUE)
2081 chg_virtue(V_INDIVIDUALISM, 1);
2082 if (is_friendly(m_ptr))
2083 chg_virtue(V_HONOUR, 1);
2086 /* No "real" damage */
2092 /* Slow Monster (Use "dam" as "power") */
2095 if (seen) obvious = TRUE;
2097 /* Powerful monsters can resist */
2098 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2099 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2101 note = _("には効果がなかった。", " is unaffected.");
2105 /* Normal monsters slow down */
2108 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2110 note = _("の動きが遅くなった。", " starts moving slower.");
2114 /* No "real" damage */
2120 /* Sleep (Use "dam" as "power") */
2123 if (seen) obvious = TRUE;
2125 /* Attempt a saving throw */
2126 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2127 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2128 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2130 /* Memorize a flag */
2131 if (r_ptr->flags3 & RF3_NO_SLEEP)
2133 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2135 /* No obvious effect */
2136 note = _("には効果がなかった。", " is unaffected.");
2141 /* Go to sleep (much) later */
2142 note = _("は眠り込んでしまった!", " falls asleep!");
2146 /* No "real" damage */
2152 /* Sleep (Use "dam" as "power") */
2153 case GF_STASIS_EVIL:
2155 if (seen) obvious = TRUE;
2157 /* Attempt a saving throw */
2158 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2159 !(r_ptr->flags3 & RF3_EVIL) ||
2160 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2162 note = _("には効果がなかった。", " is unaffected.");
2167 /* Go to sleep (much) later */
2168 note = _("は動けなくなった!", " is suspended!");
2172 /* No "real" damage */
2177 /* Sleep (Use "dam" as "power") */
2180 if (seen) obvious = TRUE;
2182 /* Attempt a saving throw */
2183 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2184 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2186 note = _("には効果がなかった。", " is unaffected.");
2191 /* Go to sleep (much) later */
2192 note = _("は動けなくなった!", " is suspended!");
2196 /* No "real" damage */
2205 vir = virtue_number(V_HARMONY);
2208 dam += p_ptr->virtues[vir-1]/10;
2211 vir = virtue_number(V_INDIVIDUALISM);
2214 dam -= p_ptr->virtues[vir-1]/20;
2217 if (seen) obvious = TRUE;
2219 /* Attempt a saving throw */
2220 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2224 /* No obvious effect */
2225 note = _("には効果がなかった。", " is unaffected.");
2228 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2230 else if (p_ptr->cursed & TRC_AGGRAVATE)
2232 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2233 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2237 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2240 chg_virtue(V_INDIVIDUALISM, -1);
2241 if (r_ptr->flags3 & RF3_ANIMAL)
2242 chg_virtue(V_NATURE, 1);
2245 /* No "real" damage */
2250 /* Control undead */
2251 case GF_CONTROL_UNDEAD:
2254 if (seen) obvious = TRUE;
2256 vir = virtue_number(V_UNLIFE);
2259 dam += p_ptr->virtues[vir-1]/10;
2262 vir = virtue_number(V_INDIVIDUALISM);
2265 dam -= p_ptr->virtues[vir-1]/20;
2268 /* Attempt a saving throw */
2269 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2270 !(r_ptr->flags3 & RF3_UNDEAD))
2272 /* No obvious effect */
2273 note = _("には効果がなかった。", " is unaffected.");
2275 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2277 else if (p_ptr->cursed & TRC_AGGRAVATE)
2279 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2280 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2284 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2288 /* No "real" damage */
2294 case GF_CONTROL_DEMON:
2297 if (seen) obvious = TRUE;
2299 vir = virtue_number(V_UNLIFE);
2302 dam += p_ptr->virtues[vir-1]/10;
2305 vir = virtue_number(V_INDIVIDUALISM);
2308 dam -= p_ptr->virtues[vir-1]/20;
2311 /* Attempt a saving throw */
2312 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2313 !(r_ptr->flags3 & RF3_DEMON))
2315 /* No obvious effect */
2316 note = _("には効果がなかった。", " is unaffected.");
2318 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2320 else if (p_ptr->cursed & TRC_AGGRAVATE)
2322 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2323 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2327 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2331 /* No "real" damage */
2337 case GF_CONTROL_ANIMAL:
2340 if (seen) obvious = TRUE;
2342 vir = virtue_number(V_NATURE);
2345 dam += p_ptr->virtues[vir-1]/10;
2348 vir = virtue_number(V_INDIVIDUALISM);
2351 dam -= p_ptr->virtues[vir-1]/20;
2354 /* Attempt a saving throw */
2355 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2356 !(r_ptr->flags3 & RF3_ANIMAL))
2359 /* No obvious effect */
2360 note = _("には効果がなかった。", " is unaffected.");
2362 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2364 else if (p_ptr->cursed & TRC_AGGRAVATE)
2366 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2367 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2371 note = _("はなついた。", " is tamed!");
2373 if (r_ptr->flags3 & RF3_ANIMAL)
2374 chg_virtue(V_NATURE, 1);
2377 /* No "real" damage */
2383 case GF_CHARM_LIVING:
2387 vir = virtue_number(V_UNLIFE);
2388 if (seen) obvious = TRUE;
2390 vir = virtue_number(V_UNLIFE);
2393 dam -= p_ptr->virtues[vir-1]/10;
2396 vir = virtue_number(V_INDIVIDUALISM);
2399 dam -= p_ptr->virtues[vir-1]/20;
2402 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2404 /* Attempt a saving throw */
2405 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2406 !monster_living(m_ptr->r_idx))
2409 /* No obvious effect */
2410 note = _("には効果がなかった。", " is unaffected.");
2412 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2414 else if (p_ptr->cursed & TRC_AGGRAVATE)
2416 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2417 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2421 note = _("を支配した。", " is tamed!");
2423 if (r_ptr->flags3 & RF3_ANIMAL)
2424 chg_virtue(V_NATURE, 1);
2427 /* No "real" damage */
2432 /* Confusion (Use "dam" as "power") */
2435 if (seen) obvious = TRUE;
2437 /* Get confused later */
2438 do_conf = damroll(3, (dam / 2)) + 1;
2440 /* Attempt a saving throw */
2441 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2442 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2443 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2445 /* Memorize a flag */
2446 if (r_ptr->flags3 & (RF3_NO_CONF))
2448 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2454 /* No obvious effect */
2455 note = _("には効果がなかった。", " is unaffected.");
2459 /* No "real" damage */
2466 if (seen) obvious = TRUE;
2468 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2470 /* Attempt a saving throw */
2471 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2472 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2477 /* No obvious effect */
2478 note = _("には効果がなかった。", " is unaffected.");
2482 /* No "real" damage */
2487 /* Lite, but only hurts susceptible creatures */
2496 if (r_ptr->flags3 & (RF3_HURT_LITE))
2498 /* Obvious effect */
2499 if (seen) obvious = TRUE;
2501 /* Memorize the effects */
2502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2504 /* Special effect */
2505 note = _("は光に身をすくめた!", " cringes from the light!");
2506 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2509 /* Normally no damage */
2521 /* Lite -- opposite of Dark */
2524 if (seen) obvious = TRUE;
2526 if (r_ptr->flagsr & RFR_RES_LITE)
2528 note = _("には耐性がある!", " resists!");
2529 dam *= 2; dam /= (randint1(6)+6);
2530 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2532 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2535 note = _("は光に身をすくめた!", " cringes from the light!");
2536 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2543 /* Dark -- opposite of Lite */
2546 if (seen) obvious = TRUE;
2548 if (r_ptr->flagsr & RFR_RES_DARK)
2550 note = _("には耐性がある!", " resists!");
2551 dam *= 2; dam /= (randint1(6)+6);
2552 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2561 /* Hurt by rock remover */
2562 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2565 if (seen) obvious = TRUE;
2567 /* Memorize the effects */
2568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2570 /* Cute little message */
2571 note = _("の皮膚がただれた!", " loses some skin!");
2572 note_dies = _("はドロドロに溶けた!", " dissolves!");
2575 /* Usually, ignore the effects */
2586 /* Teleport undead (Use "dam" as "power") */
2587 case GF_AWAY_UNDEAD:
2589 /* Only affect undead */
2590 if (r_ptr->flags3 & (RF3_UNDEAD))
2592 bool resists_tele = FALSE;
2594 if (r_ptr->flagsr & RFR_RES_TELE)
2596 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2598 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2599 note = _("には効果がなかった。", " is unaffected.");
2600 resists_tele = TRUE;
2602 else if (r_ptr->level > randint1(100))
2604 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2605 note = _("には耐性がある!", " resists!");
2606 resists_tele = TRUE;
2612 if (seen) obvious = TRUE;
2613 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2625 /* No "real" damage */
2631 /* Teleport evil (Use "dam" as "power") */
2634 /* Only affect evil */
2635 if (r_ptr->flags3 & (RF3_EVIL))
2637 bool resists_tele = FALSE;
2639 if (r_ptr->flagsr & RFR_RES_TELE)
2641 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2643 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2644 note = _("には効果がなかった。", " is unaffected.");
2645 resists_tele = TRUE;
2647 else if (r_ptr->level > randint1(100))
2649 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2650 note = _("には耐性がある!", " resists!");
2651 resists_tele = TRUE;
2657 if (seen) obvious = TRUE;
2658 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2670 /* No "real" damage */
2676 /* Teleport monster (Use "dam" as "power") */
2679 bool resists_tele = FALSE;
2680 if (r_ptr->flagsr & RFR_RES_TELE)
2682 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2685 note = _("には効果がなかった。", " is unaffected.");
2686 resists_tele = TRUE;
2688 else if (r_ptr->level > randint1(100))
2690 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2691 note = _("には耐性がある!", " resists!");
2692 resists_tele = TRUE;
2698 if (seen) obvious = TRUE;
2700 /* Prepare to teleport */
2704 /* No "real" damage */
2710 /* Turn undead (Use "dam" as "power") */
2711 case GF_TURN_UNDEAD:
2713 /* Only affect undead */
2714 if (r_ptr->flags3 & (RF3_UNDEAD))
2716 if (seen) obvious = TRUE;
2718 /* Learn about type */
2719 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2721 /* Apply some fear */
2722 do_fear = damroll(3, (dam / 2)) + 1;
2724 /* Attempt a saving throw */
2725 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2727 /* No obvious effect */
2728 note = _("には効果がなかった。", " is unaffected.");
2741 /* No "real" damage */
2747 /* Turn evil (Use "dam" as "power") */
2750 /* Only affect evil */
2751 if (r_ptr->flags3 & (RF3_EVIL))
2753 if (seen) obvious = TRUE;
2755 /* Learn about type */
2756 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2758 /* Apply some fear */
2759 do_fear = damroll(3, (dam / 2)) + 1;
2761 /* Attempt a saving throw */
2762 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2764 /* No obvious effect */
2765 note = _("には効果がなかった。", " is unaffected.");
2778 /* No "real" damage */
2784 /* Turn monster (Use "dam" as "power") */
2787 if (seen) obvious = TRUE;
2789 /* Apply some fear */
2790 do_fear = damroll(3, (dam / 2)) + 1;
2792 /* Attempt a saving throw */
2793 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2794 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2795 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2797 /* No obvious effect */
2798 note = _("には効果がなかった。", " is unaffected.");
2803 /* No "real" damage */
2810 case GF_DISP_UNDEAD:
2812 /* Only affect undead */
2813 if (r_ptr->flags3 & (RF3_UNDEAD))
2815 if (seen) obvious = TRUE;
2817 /* Learn about type */
2818 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2820 note = _("は身震いした。", " shudders.");
2821 note_dies = _("はドロドロに溶けた!", " dissolves!");
2841 /* Only affect evil */
2842 if (r_ptr->flags3 & (RF3_EVIL))
2844 if (seen) obvious = TRUE;
2846 /* Learn about type */
2847 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2849 note = _("は身震いした。", " shudders.");
2850 note_dies = _("はドロドロに溶けた!", " dissolves!");
2869 /* Only affect good */
2870 if (r_ptr->flags3 & (RF3_GOOD))
2872 if (seen) obvious = TRUE;
2874 /* Learn about type */
2875 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2877 note = _("は身震いした。", " shudders.");
2878 note_dies = _("はドロドロに溶けた!", " dissolves!");
2895 case GF_DISP_LIVING:
2897 /* Only affect non-undead */
2898 if (monster_living(m_ptr->r_idx))
2900 if (seen) obvious = TRUE;
2902 note = _("は身震いした。", " shudders.");
2903 note_dies = _("はドロドロに溶けた!", " dissolves!");
2922 /* Only affect demons */
2923 if (r_ptr->flags3 & (RF3_DEMON))
2925 if (seen) obvious = TRUE;
2927 /* Learn about type */
2928 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2930 note = _("は身震いした。", " shudders.");
2931 note_dies = _("はドロドロに溶けた!", " dissolves!");
2947 /* Dispel monster */
2950 if (seen) obvious = TRUE;
2951 note = _("は身震いした。", " shudders.");
2952 note_dies = _("はドロドロに溶けた!", " dissolves!");
2959 if (seen) obvious = TRUE;
2960 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
2964 /* Heal the monster */
2965 if (caster_ptr->hp < caster_ptr->maxhp)
2968 caster_ptr->hp += dam;
2969 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
2971 /* Redraw (later) if needed */
2972 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
2973 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
2975 /* Special message */
2978 monster_desc(killer, caster_ptr, 0);
2979 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
2985 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
2986 (void)hp_player(dam);
2991 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3000 if (seen) obvious = TRUE;
3001 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3002 /* Attempt a saving throw */
3003 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3004 (r_ptr->flags3 & RF3_NO_CONF) ||
3005 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3007 /* Memorize a flag */
3008 if (r_ptr->flags3 & (RF3_NO_CONF))
3010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3012 note = _("には効果がなかった。", " is unaffected.");
3015 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3017 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3018 note = _("には完全な耐性がある!", " is immune.");
3021 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3024 note = _("には耐性がある。", " resists.");
3029 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3030 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3032 if (who > 0) do_conf = randint0(4) + 4;
3033 else do_conf = randint0(8) + 8;
3039 case GF_BRAIN_SMASH:
3041 if (seen) obvious = TRUE;
3042 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3044 /* Attempt a saving throw */
3045 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3046 (r_ptr->flags3 & RF3_NO_CONF) ||
3047 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3049 /* Memorize a flag */
3050 if (r_ptr->flags3 & (RF3_NO_CONF))
3052 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3054 note = _("には効果がなかった。", " is unaffected.");
3057 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3059 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3060 note = _("には完全な耐性がある!", " is immune.");
3063 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3065 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3066 note = _("には耐性がある!", " resists!");
3071 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3072 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3076 do_conf = randint0(4) + 4;
3077 do_stun = randint0(4) + 4;
3081 do_conf = randint0(8) + 8;
3082 do_stun = randint0(8) + 8;
3084 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3092 if (seen) obvious = TRUE;
3093 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3094 /* Attempt a saving throw */
3095 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3097 note = _("には効果がなかった。", " is unaffected.");
3106 if (seen) obvious = TRUE;
3107 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3108 /* Attempt a saving throw */
3109 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3111 note = _("には効果がなかった。", " is unaffected.");
3120 if (seen) obvious = TRUE;
3121 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3122 /* Attempt a saving throw */
3123 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3125 note = _("には効果がなかった。", " is unaffected.");
3134 if (seen) obvious = TRUE;
3136 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3137 "You point at %s, screaming the word, 'DIE!'."), m_name);
3138 /* Attempt a saving throw */
3139 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3141 note = _("には効果がなかった。", " is unaffected.");
3150 if (seen) obvious = TRUE;
3151 if (r_ptr->flags1 & RF1_UNIQUE)
3153 note = _("には効果がなかった。", " is unaffected.");
3158 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3159 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3161 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3163 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3167 note = _("は耐性を持っている!", "resists!");
3174 /* Capture monster */
3178 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3179 (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)
3181 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3186 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3187 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3188 nokori_hp = m_ptr->maxhp * 3 / 10;
3190 nokori_hp = m_ptr->maxhp * 3 / 20;
3192 if (m_ptr->hp >= nokori_hp)
3194 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3197 else if (m_ptr->hp < randint0(nokori_hp))
3199 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3200 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3201 cap_mon = m_ptr->r_idx;
3202 cap_mspeed = m_ptr->mspeed;
3204 cap_maxhp = m_ptr->max_maxhp;
3205 cap_nickname = m_ptr->nickname; /* Quark transfer */
3206 if (g_ptr->m_idx == p_ptr->riding)
3208 if (rakuba(-1, FALSE))
3210 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3214 delete_monster_idx(g_ptr->m_idx);
3220 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3226 /* Attack (Use "dam" as attack type) */
3229 /* Return this monster's death */
3230 return py_attack(y, x, dam);
3233 /* Sleep (Use "dam" as "power") */
3239 if (seen) obvious = TRUE;
3240 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3242 note = _("には効果がなかった。", " is unaffected.");
3245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3248 if (MON_CSLEEP(m_ptr))
3250 note = _("には効果がなかった。", " is unaffected.");
3256 if (one_in_(5)) effect = 1;
3257 else if (one_in_(4)) effect = 2;
3258 else if (one_in_(3)) effect = 3;
3263 /* Powerful monsters can resist */
3264 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3265 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3267 note = _("には効果がなかった。", " is unaffected.");
3271 /* Normal monsters slow down */
3274 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3276 note = _("の動きが遅くなった。", " starts moving slower.");
3281 else if (effect == 2)
3283 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3285 /* Attempt a saving throw */
3286 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3287 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3292 /* No obvious effect */
3293 note = _("には効果がなかった。", " is unaffected.");
3298 else if (effect == 3)
3300 /* Attempt a saving throw */
3301 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3302 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3303 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3305 /* Memorize a flag */
3306 if (r_ptr->flags3 & RF3_NO_SLEEP)
3308 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3311 /* No obvious effect */
3312 note = _("には効果がなかった。", " is unaffected.");
3317 /* Go to sleep (much) later */
3318 note = _("は眠り込んでしまった!", " falls asleep!");
3325 note = _("には効果がなかった。", " is unaffected.");
3328 /* No "real" damage */
3336 if (seen) obvious = TRUE;
3337 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3339 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3340 chg_virtue(V_VITALITY, -1);
3350 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3352 if (r_ptr->flags3 & (RF3_HURT_LITE))
3354 /* Obvious effect */
3355 if (seen) obvious = TRUE;
3357 /* Memorize the effects */
3358 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3360 /* Special effect */
3361 note = _("は光に身をすくめた!", " cringes from the light!");
3362 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3365 /* Normally no damage */
3372 photo = m_ptr->r_idx;
3379 case GF_BLOOD_CURSE:
3381 if (seen) obvious = TRUE;
3387 bool success = FALSE;
3388 if (seen) obvious = TRUE;
3390 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3392 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3393 if (dam < 1) dam = 1;
3395 /* No need to tame your pet */
3398 note = _("の動きが速くなった。", " starts moving faster.");
3399 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3403 /* Attempt a saving throw */
3404 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3405 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3406 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3407 (p_ptr->cursed & TRC_AGGRAVATE) ||
3408 ((r_ptr->level+10) > randint1(dam)))
3411 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3415 note = _("を支配した。", " is tamed!");
3417 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3419 /* Learn about type */
3420 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3427 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3429 do_fear = randint1(90)+10;
3431 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3434 /* No "real" damage */
3441 if (seen) obvious = TRUE;
3442 /* Attempt a saving throw */
3443 if (randint0(100 + dam) < (r_ptr->level + 50))
3445 note = _("には効果がなかった。", " is unaffected.");
3465 /* Absolutely no effect */
3466 if (skipped) return (FALSE);
3468 /* "Unique" monsters cannot be polymorphed */
3469 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3471 /* Quest monsters cannot be polymorphed */
3472 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3474 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3476 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3477 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3479 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3484 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3485 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3488 /* Modify the damage */
3490 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3491 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3493 /* Check for death */
3494 if (dam > m_ptr->hp)
3496 /* Extract method of death */
3501 /* Sound and Impact resisters never stun */
3503 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3504 !(r_ptr->flags3 & RF3_NO_STUN))
3506 if (seen) obvious = TRUE;
3509 if (MON_STUNNED(m_ptr))
3511 note = _("はひどくもうろうとした。", " is more dazed.");
3512 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3516 note = _("はもうろうとした。", " is dazed.");
3521 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3527 /* Confusion and Chaos resisters (and sleepers) never confuse */
3529 !(r_ptr->flags3 & RF3_NO_CONF) &&
3530 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3532 if (seen) obvious = TRUE;
3534 /* Already partially confused */
3535 if (MON_CONFUSED(m_ptr))
3537 note = _("はさらに混乱したようだ。", " looks more confused.");
3538 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3541 /* Was not confused */
3544 note = _("は混乱したようだ。", " looks confused.");
3548 /* Apply confusion */
3549 (void)set_monster_confused(g_ptr->m_idx, tmp);
3557 if (seen) obvious = TRUE;
3559 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3563 note = _("は弱くなったようだ。", " seems weakened.");
3564 m_ptr->maxhp -= do_time;
3565 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3570 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3571 if (do_poly && (randint1(90) > r_ptr->level))
3573 if (polymorph_monster(y, x))
3575 if (seen) obvious = TRUE;
3577 /* Monster polymorphs */
3578 note = _("が変身した!", " changes!");
3580 /* Turn off the damage */
3586 note = _("には効果がなかった。", " is unaffected.");
3589 /* Hack -- Get new monster */
3590 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3592 /* Hack -- Get new race */
3593 r_ptr = &r_info[m_ptr->r_idx];
3596 /* Handle "teleport" */
3599 if (seen) obvious = TRUE;
3601 note = _("が消え去った!", " disappears!");
3603 if (!who) chg_virtue(V_VALOUR, -1);
3606 teleport_away(g_ptr->m_idx, do_dist,
3607 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3609 /* Hack -- get new location */
3613 /* Hack -- get new grid */
3614 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3621 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3628 if (typ == GF_DRAIN_MANA)
3630 /* Drain mana does nothing */
3633 /* If another monster did the damage, hurt the monster by hand */
3636 /* Redraw (later) if needed */
3637 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3638 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3640 /* Wake the monster up */
3641 (void)set_monster_csleep(g_ptr->m_idx, 0);
3643 /* Hurt the monster */
3651 if (is_pet(m_ptr) && !(m_ptr->ml))
3654 /* Give detailed messages if destroyed */
3657 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3660 msg_format("%^s%s", m_name, note);
3668 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3670 /* Generate treasure, etc */
3671 monster_death(g_ptr->m_idx, FALSE);
3674 delete_monster_idx(g_ptr->m_idx);
3678 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3682 /* Damaged monster */
3685 /* Give detailed messages if visible or destroyed */
3686 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3688 /* Hack -- Pain message */
3691 message_pain(g_ptr->m_idx, dam);
3698 /* Hack -- handle sleep */
3699 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3703 else if (heal_leper)
3705 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3707 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3709 char m2_name[MAX_NLEN];
3711 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3712 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3715 delete_monster_idx(g_ptr->m_idx);
3718 /* If the player did it, give him experience, check fear */
3723 /* Hurt the monster, check for fear and death */
3724 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3729 /* Damaged monster */
3732 /* HACK - anger the monster before showing the sleep message */
3733 if (do_sleep) anger_monster(m_ptr);
3735 /* Give detailed messages if visible or destroyed */
3736 if (note && seen_msg)
3737 msg_format(_("%s%s", "%^s%s"), m_name, note);
3739 /* Hack -- Pain message */
3740 else if (known && (dam || !do_fear))
3742 message_pain(g_ptr->m_idx, dam);
3745 /* Anger monsters */
3746 if (((dam > 0) || get_angry) && !do_sleep)
3747 anger_monster(m_ptr);
3749 if ((fear || do_fear) && seen)
3752 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3755 /* Hack -- handle sleep */
3756 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3760 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3762 blood_curse_to_enemy(who);
3765 if (p_ptr->inside_battle)
3767 p_ptr->health_who = g_ptr->m_idx;
3768 p_ptr->redraw |= (PR_HEALTH);
3772 /* Verify this code */
3773 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3775 /* Redraw the monster grid */
3778 /* Update monster recall window */
3779 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3781 p_ptr->window |= (PW_MONSTER);
3784 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3788 if (!(flg & PROJECT_NO_HANGEKI))
3790 set_target(m_ptr, monster_target_y, monster_target_x);
3793 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3795 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3799 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3801 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3802 rakubadam_m = (dam > 200) ? 200 : dam;
3812 /* Prepare to make a Blade of Chaos */
3813 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3815 q_ptr->pval = photo;
3817 /* Mark the item as fully known */
3818 q_ptr->ident |= (IDENT_MENTAL);
3819 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3827 /* Return "Anything seen?" */
3832 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3833 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3834 * @param who_name 効果を起こしたモンスターの名前
3835 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3836 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3837 * @param x 目標X座標 / Target x location (or location to travel "towards")
3838 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3839 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3841 * @param monspell 効果元のモンスター魔法ID
3842 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3844 * Handle a beam/bolt/ball causing damage to the player.
3845 * This routine takes a "source monster" (by index), a "distance", a default
3846 * "damage", and a "damage type". See "project_m()" above.
3847 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3848 * is reduced (see "project_m()" above). This can happen if a monster breathes
3849 * at the player and hits a wall instead.
3850 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3851 * to know if this is actually a ball or a bolt spell
3852 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3853 * we just assume that the effects were obvious, for historical reasons.
3855 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)
3860 /* Hack -- assume obvious */
3861 bool obvious = TRUE;
3863 /* Player blind-ness */
3864 bool blind = (p_ptr->blind ? TRUE : FALSE);
3866 /* Player needs a "description" (he is blind) */
3869 /* Source monster */
3870 monster_type *m_ptr = NULL;
3872 /* Monster name (for attacks) */
3873 GAME_TEXT m_name[MAX_NLEN];
3875 /* Monster name (for damage) */
3878 /* Hack -- messages */
3884 /* Player is not here */
3885 if (!player_bold(y, x)) return (FALSE);
3887 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
3889 if (kawarimi(TRUE)) return FALSE;
3892 /* Player cannot hurt himself */
3893 if (!who) return (FALSE);
3894 if (who == p_ptr->riding) return (FALSE);
3896 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
3899 int max_attempts = 10;
3900 sound(SOUND_REFLECT);
3903 msg_print(_("何かが跳ね返った!", "Something bounces!"));
3904 else if (p_ptr->special_defense & KATA_FUUJIN)
3905 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
3907 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
3910 /* Choose 'new' target */
3915 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
3916 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
3919 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
3921 if (max_attempts < 1)
3923 t_y = current_floor_ptr->m_list[who].fy;
3924 t_x = current_floor_ptr->m_list[who].fx;
3929 t_y = p_ptr->y - 1 + randint1(3);
3930 t_x = p_ptr->x - 1 + randint1(3);
3933 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
3935 disturb(TRUE, TRUE);
3939 /* Limit maximum damage */
3940 if (dam > 1600) dam = 1600;
3942 /* Reduce damage by distance */
3943 dam = (dam + r) / (r + 1);
3946 /* If the player is blind, be more descriptive */
3947 if (blind) fuzzy = TRUE;
3952 m_ptr = ¤t_floor_ptr->m_list[who];
3953 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
3954 monster_desc(m_name, m_ptr, 0);
3956 /* Get the monster's real name (gotten before polymorph!) */
3957 strcpy(killer, who_name);
3963 case PROJECT_WHO_UNCTRL_POWER:
3964 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
3967 case PROJECT_WHO_GLASS_SHARDS:
3968 strcpy(killer, _("ガラスの破片", "shards of glass"));
3972 strcpy(killer, _("罠", "a trap"));
3977 strcpy(m_name, killer);
3980 /* Analyze the damage */
3983 /* Standard damage -- hurts inventory too */
3986 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
3987 get_damage = acid_dam(dam, killer, monspell, FALSE);
3991 /* Standard damage -- hurts inventory too */
3994 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
3995 get_damage = fire_dam(dam, killer, monspell, FALSE);
3999 /* Standard damage -- hurts inventory too */
4002 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4003 get_damage = cold_dam(dam, killer, monspell, FALSE);
4007 /* Standard damage -- hurts inventory too */
4010 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4011 get_damage = elec_dam(dam, killer, monspell, FALSE);
4015 /* Standard damage -- also poisons player */
4018 bool double_resist = IS_OPPOSE_POIS();
4019 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4021 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4022 if (double_resist) dam = (dam + 2) / 3;
4024 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4029 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4031 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4033 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4038 /* Standard damage -- also poisons / mutates player */
4041 bool double_resist = IS_OPPOSE_POIS();
4042 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4044 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4045 if (double_resist) dam = (2 * dam + 2) / 5;
4046 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4047 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4049 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4051 if (one_in_(5)) /* 6 */
4053 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4054 if (one_in_(4)) /* 4 */
4062 inven_damage(set_acid_destroy, 2);
4068 /* Standard damage */
4071 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4072 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4076 /* Holy Orb -- Player only takes partial damage */
4079 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4080 if (p_ptr->align > 10)
4082 else if (p_ptr->align < -10)
4084 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4090 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4091 if (p_ptr->align > 10)
4093 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4097 /* Arrow -- XXX no dodging */
4102 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4104 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4106 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4109 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4113 /* Plasma -- XXX No resist */
4116 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4117 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4119 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4121 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4122 (void)set_stun(p_ptr->stun + plus_stun);
4125 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4127 inven_damage(set_acid_destroy, 3);
4133 /* Nether -- drain experience */
4136 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4137 if (p_ptr->resist_neth)
4139 if (!prace_is_(RACE_SPECTRE))
4141 dam *= 6; dam /= (randint1(4) + 7);
4144 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4146 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4148 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4150 learn_spell(monspell);
4154 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4160 /* Water -- stun/confuse */
4163 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4164 if (!CHECK_MULTISHADOW())
4166 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4168 set_stun(p_ptr->stun + randint1(40));
4170 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4172 set_confused(p_ptr->confused + randint1(5) + 5);
4175 if (one_in_(5) && !p_ptr->resist_water)
4177 inven_damage(set_cold_destroy, 3);
4180 if (p_ptr->resist_water) get_damage /= 4;
4183 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4187 /* Chaos -- many effects */
4190 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4191 if (p_ptr->resist_chaos)
4193 dam *= 6; dam /= (randint1(4) + 7);
4196 if (!CHECK_MULTISHADOW())
4198 if (!p_ptr->resist_conf)
4200 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4202 if (!p_ptr->resist_chaos)
4204 (void)set_image(p_ptr->image + randint1(10));
4207 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4208 (void)gain_mutation(p_ptr, 0);
4211 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4213 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4216 if (!p_ptr->resist_chaos || one_in_(9))
4218 inven_damage(set_elec_destroy, 2);
4219 inven_damage(set_fire_destroy, 2);
4223 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4227 /* Shards -- mostly cutting */
4230 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4231 if (p_ptr->resist_shard)
4233 dam *= 6; dam /= (randint1(4) + 7);
4235 else if (!CHECK_MULTISHADOW())
4237 (void)set_cut(p_ptr->cut + dam);
4240 if (!p_ptr->resist_shard || one_in_(13))
4242 inven_damage(set_cold_destroy, 2);
4245 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4249 /* Sound -- mostly stunning */
4252 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4253 if (p_ptr->resist_sound)
4255 dam *= 5; dam /= (randint1(4) + 7);
4257 else if (!CHECK_MULTISHADOW())
4259 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4260 (void)set_stun(p_ptr->stun + plus_stun);
4263 if (!p_ptr->resist_sound || one_in_(13))
4265 inven_damage(set_cold_destroy, 2);
4268 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4272 /* Pure confusion */
4275 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4276 if (p_ptr->resist_conf)
4278 dam *= 5; dam /= (randint1(4) + 7);
4280 else if (!CHECK_MULTISHADOW())
4282 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4284 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4288 /* Disenchantment -- see above */
4291 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4292 if (p_ptr->resist_disen)
4294 dam *= 6; dam /= (randint1(4) + 7);
4296 else if (!CHECK_MULTISHADOW())
4298 (void)apply_disenchant(0);
4300 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4304 /* Nexus -- see above */
4307 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4308 if (p_ptr->resist_nexus)
4310 dam *= 6; dam /= (randint1(4) + 7);
4312 else if (!CHECK_MULTISHADOW())
4316 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4320 /* Force -- mostly stun */
4323 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4324 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4326 (void)set_stun(p_ptr->stun + randint1(20));
4328 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4333 /* Rocket -- stun, cut */
4336 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4337 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4339 (void)set_stun(p_ptr->stun + randint1(20));
4342 if (p_ptr->resist_shard)
4346 else if (!CHECK_MULTISHADOW())
4348 (void)set_cut(p_ptr->cut + (dam / 2));
4351 if (!p_ptr->resist_shard || one_in_(12))
4353 inven_damage(set_cold_destroy, 3);
4356 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4360 /* Inertia -- slowness */
4363 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4364 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4365 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4369 /* Lite -- blinding */
4372 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4373 if (p_ptr->resist_lite)
4375 dam *= 4; dam /= (randint1(4) + 7);
4377 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4379 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4382 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4384 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4387 else if (prace_is_(RACE_S_FAIRY))
4392 if (p_ptr->wraith_form) dam *= 2;
4393 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4395 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4397 p_ptr->wraith_form = 0;
4398 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4399 "The light forces you out of your incorporeal shadow form."));
4401 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4402 p_ptr->update |= (PU_MONSTERS);
4403 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4409 /* Dark -- blinding */
4412 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4413 if (p_ptr->resist_dark)
4415 dam *= 4; dam /= (randint1(4) + 7);
4417 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4419 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4421 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4423 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4427 /* Time -- bolt fewer effects XXX */
4430 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4431 if (p_ptr->resist_time)
4434 dam /= (randint1(4) + 7);
4435 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4437 else if (!CHECK_MULTISHADOW())
4439 switch (randint1(10))
4441 case 1: case 2: case 3: case 4: case 5:
4443 if (p_ptr->prace == RACE_ANDROID) break;
4444 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4445 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4449 case 6: case 7: case 8: case 9:
4451 switch (randint1(6))
4453 case 1: k = A_STR; act = _("強く", "strong"); break;
4454 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4455 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4456 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4457 case 5: k = A_CON; act = _("健康で", "hale"); break;
4458 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4461 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4462 "You're not as %s as you used to be..."), act);
4464 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4465 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4466 p_ptr->update |= (PU_BONUS);
4472 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4473 "You're not as powerful as you used to be..."));
4475 for (k = 0; k < A_MAX; k++)
4477 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4478 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4480 p_ptr->update |= (PU_BONUS);
4486 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4490 /* Gravity -- stun plus slowness plus teleport */
4493 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4494 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4496 if (!CHECK_MULTISHADOW())
4498 teleport_player(5, TELEPORT_PASSIVE);
4499 if (!p_ptr->levitation)
4500 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4501 if (!(p_ptr->resist_sound || p_ptr->levitation))
4503 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4504 (void)set_stun(p_ptr->stun + plus_stun);
4507 if (p_ptr->levitation)
4509 dam = (dam * 2) / 3;
4512 if (!p_ptr->levitation || one_in_(13))
4514 inven_damage(set_cold_destroy, 2);
4517 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4521 /* Standard damage */
4522 case GF_DISINTEGRATE:
4524 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4526 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4532 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4534 (void)hp_player(dam);
4541 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4542 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4549 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4550 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4556 if (p_ptr->free_act) break;
4557 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4559 if (ironman_nightmare)
4561 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4562 /* Have some nightmares */
4563 sanity_blast(NULL, FALSE);
4566 set_paralyzed(p_ptr->paralyzed + dam);
4576 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4577 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4584 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4585 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4592 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4594 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4595 if (!p_ptr->resist_shard || one_in_(13))
4597 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4598 inven_damage(set_cold_destroy, 2);
4604 /* Ice -- cold plus stun plus cuts */
4607 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4608 get_damage = cold_dam(dam, killer, monspell, FALSE);
4609 if (!CHECK_MULTISHADOW())
4611 if (!p_ptr->resist_shard)
4613 (void)set_cut(p_ptr->cut + damroll(5, 8));
4615 if (!p_ptr->resist_sound)
4617 (void)set_stun(p_ptr->stun + randint1(15));
4620 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4622 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4632 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4634 if (p_ptr->mimic_form)
4636 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4637 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4642 switch (p_ptr->prace)
4644 /* Some races are immune */
4658 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4670 if (CHECK_MULTISHADOW())
4672 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4674 else if (p_ptr->csp)
4678 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4680 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4683 if (dam >= p_ptr->csp)
4687 p_ptr->csp_frac = 0;
4696 learn_spell(monspell);
4697 p_ptr->redraw |= (PR_MANA);
4698 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4702 /* Heal the monster */
4703 if (m_ptr->hp < m_ptr->maxhp)
4707 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4709 /* Redraw (later) if needed */
4710 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4711 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4713 /* Special message */
4716 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4729 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4731 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4732 learn_spell(monspell);
4736 if (!CHECK_MULTISHADOW())
4738 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4740 if (!p_ptr->resist_conf)
4742 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4745 if (!p_ptr->resist_chaos && one_in_(3))
4747 (void)set_image(p_ptr->image + randint0(250) + 150);
4754 p_ptr->csp_frac = 0;
4756 p_ptr->redraw |= PR_MANA;
4759 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4765 case GF_BRAIN_SMASH:
4767 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4769 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4770 learn_spell(monspell);
4774 if (!CHECK_MULTISHADOW())
4776 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4782 p_ptr->csp_frac = 0;
4784 p_ptr->redraw |= PR_MANA;
4787 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4788 if (!CHECK_MULTISHADOW())
4790 if (!p_ptr->resist_blind)
4792 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4794 if (!p_ptr->resist_conf)
4796 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4798 if (!p_ptr->free_act)
4800 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4802 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4804 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4805 (void)do_dec_stat(A_INT);
4806 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4807 (void)do_dec_stat(A_WIS);
4809 if (!p_ptr->resist_chaos)
4811 (void)set_image(p_ptr->image + randint0(250) + 150);
4821 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4823 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4824 learn_spell(monspell);
4828 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
4829 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4837 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4839 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4840 learn_spell(monspell);
4844 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4845 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4853 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4855 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4856 learn_spell(monspell);
4860 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4861 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4869 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
4871 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
4872 learn_spell(monspell);
4876 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4877 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
4885 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4887 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4888 learn_spell(monspell);
4892 if (!CHECK_MULTISHADOW())
4894 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
4895 curse_equipment(40, 20);
4898 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
4900 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
4915 /* Hex - revenge damage stored */
4916 revenge_store(get_damage);
4918 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
4919 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
4921 GAME_TEXT m_name_self[80];
4924 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
4926 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
4927 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
4928 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
4931 if (p_ptr->riding && dam > 0)
4933 rakubadam_p = (dam > 200) ? 200 : dam;
4937 disturb(TRUE, TRUE);
4940 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
4942 (void)kawarimi(FALSE);
4945 /* Return "Anything seen?" */
4951 * Find the distance from (x, y) to a line.
4953 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4955 /* Vector from (x, y) to (x1, y1) */
4956 POSITION py = y1 - y;
4957 POSITION px = x1 - x;
4960 POSITION ny = x2 - x1;
4961 POSITION nx = y1 - y2;
4964 POSITION pd = distance(y1, x1, y, x);
4965 POSITION nd = distance(y1, x1, y2, x2);
4967 if (pd > nd) return distance(y, x, y2, x2);
4969 /* Component of P on N */
4970 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
4972 /* Absolute value */
4973 return((nd >= 0) ? nd : 0 - nd);
4980 * Modified version of los() for calculation of disintegration balls.
4981 * Disintegration effects are stopped by permanent walls.
4983 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4985 POSITION dx, dy; /* Delta */
4986 POSITION ax, ay; /* Absolute */
4987 POSITION sx, sy; /* Signs */
4988 POSITION qx, qy; /* Fractions */
4989 POSITION tx, ty; /* Scanners */
4990 POSITION f1, f2; /* Scale factors */
4991 POSITION m; /* Slope, or 1/Slope, of LOS */
4993 /* Extract the offset */
4997 /* Extract the absolute offset */
5001 /* Handle adjacent (or identical) grids */
5002 if ((ax < 2) && (ay < 2)) return (TRUE);
5004 /* Paranoia -- require "safe" origin */
5005 /* if (!in_bounds(y1, x1)) return (FALSE); */
5007 /* Directly South/North */
5010 /* South -- check for walls */
5013 for (ty = y1 + 1; ty < y2; ty++)
5015 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5019 /* North -- check for walls */
5022 for (ty = y1 - 1; ty > y2; ty--)
5024 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5032 /* Directly East/West */
5035 /* East -- check for walls */
5038 for (tx = x1 + 1; tx < x2; tx++)
5040 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5044 /* West -- check for walls */
5047 for (tx = x1 - 1; tx > x2; tx--)
5049 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5057 /* Extract some signs */
5058 sx = (dx < 0) ? -1 : 1;
5059 sy = (dy < 0) ? -1 : 1;
5061 /* Vertical "knights" */
5066 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5070 /* Horizontal "knights" */
5075 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5079 /* Calculate scale factor div 2 */
5082 /* Calculate scale factor */
5086 /* Travel horizontally */
5089 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5095 /* Consider the special case where slope == 1. */
5106 /* Note (below) the case (qy == f2), where */
5107 /* the LOS exactly meets the corner of a tile. */
5110 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5121 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5134 /* Travel vertically */
5137 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5153 /* Note (below) the case (qx == f2), where */
5154 /* the LOS exactly meets the corner of a tile. */
5157 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5168 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5189 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)
5194 int brev = rad * rad / dist;
5198 int mdis = distance(y1, x1, y2, x2) + rad;
5200 while (bdis <= mdis)
5204 if ((0 < dist) && (path_n < dist))
5206 POSITION ny = GRID_Y(path_g[path_n]);
5207 POSITION nx = GRID_X(path_g[path_n]);
5208 POSITION nd = distance(ny, nx, y1, x1);
5210 /* Get next base point */
5219 /* Travel from center outward */
5220 for (cdis = 0; cdis <= brad; cdis++)
5222 /* Scan the maximal blast area of radius "cdis" */
5223 for (y = by - cdis; y <= by + cdis; y++)
5225 for (x = bx - cdis; x <= bx + cdis; x++)
5227 /* Ignore "illegal" locations */
5228 if (!in_bounds(y, x)) continue;
5230 /* Enforce a circular "ripple" */
5231 if (distance(y1, x1, y, x) != bdis) continue;
5233 /* Enforce an arc */
5234 if (distance(by, bx, y, x) != cdis) continue;
5240 /* Lights are stopped by opaque terrains */
5241 if (!los(by, bx, y, x)) continue;
5243 case GF_DISINTEGRATE:
5244 /* Disintegration are stopped only by perma-walls */
5245 if (!in_disintegration_range(by, bx, y, x)) continue;
5248 /* Ball explosions are stopped by walls */
5249 if (!projectable(by, bx, y, x)) continue;
5253 /* Save this grid */
5261 /* Encode some more "radius" info */
5262 gm[bdis + 1] = *pgrids;
5264 /* Increase the size */
5265 brad = rad * (path_n + brev) / (dist + brev);
5267 /* Find the next ripple */
5271 /* Store the effect size */
5277 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5278 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5279 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5280 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5281 * @param x 目標X座標 / Target x location (or location to travel "towards")
5282 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5283 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5284 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5285 * @param monspell 効果元のモンスター魔法ID
5286 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5289 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5290 * towards a given location (optionally passing over the heads of interposing
5291 * monsters), and have it do a given amount of damage to the monsters (and
5292 * optionally objects) within the given radius of the final location.
5294 * A "bolt" travels from source to target and affects only the target grid.
5295 * A "beam" travels from source to target, affecting all grids passed through.
5296 * A "ball" travels from source to the target, exploding at the target, and
5297 * affecting everything within the given radius of the target location.
5299 * Traditionally, a "bolt" does not affect anything on the ground, and does
5300 * not pass over the heads of interposing monsters, much like a traditional
5301 * missile, and will "stop" abruptly at the "target" even if no monster is
5302 * positioned there, while a "ball", on the other hand, passes over the heads
5303 * of monsters between the source and target, and affects everything except
5304 * the source monster which lies within the final radius, while a "beam"
5305 * affects every monster between the source and target, except for the casting
5306 * monster (or player), and rarely affects things on the ground.
5308 * Two special flags allow us to use this function in special ways, the
5309 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5310 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5311 * actually projecting from the source monster (or player).
5313 * The player will only get "experience" for monsters killed by himself
5314 * Unique monsters can only be destroyed by attacks from the player
5316 * Only 256 grids can be affected per projection, limiting the effective
5317 * "radius" of standard ball attacks to nine units (diameter nineteen).
5319 * One can project in a given "direction" by combining PROJECT_THRU with small
5320 * offsets to the initial location (see "line_spell()"), or by calculating
5321 * "virtual targets" far away from the player.
5323 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5324 * continuing until it actually hits somethings (useful for "stone to mud").
5326 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5328 * Balls must explode BEFORE hitting walls, or they would affect monsters
5329 * on both sides of a wall. Some bug reports indicate that this is still
5330 * happening in 2.7.8 for Windows, though it appears to be impossible.
5332 * We "pre-calculate" the blast area only in part for efficiency.
5333 * More importantly, this lets us do "explosions" from the "inside" out.
5334 * This results in a more logical distribution of "blast" treasure.
5335 * It also produces a better (in my opinion) animation of the explosion.
5336 * It could be (but is not) used to have the treasure dropped by monsters
5337 * in the middle of the explosion fall "outwards", and then be damaged by
5338 * the blast as it spreads outwards towards the treasure drop location.
5340 * Walls and doors are included in the blast area, so that they can be
5341 * "burned" or "melted" in later versions.
5343 * This algorithm is intended to maximize simplicity, not necessarily
5344 * efficiency, since this function is not a bottleneck in the code.
5346 * We apply the blast effect from ground zero outwards, in several passes,
5347 * first affecting features, then objects, then monsters, then the player.
5348 * This allows walls to be removed before checking the object or monster
5349 * in the wall, and protects objects which are dropped by monsters killed
5350 * in the blast, and allows the player to see all affects before he is
5351 * killed or teleported away. The semantics of this method are open to
5352 * various interpretations, but they seem to work well in practice.
5354 * We process the blast area from ground-zero outwards to allow for better
5355 * distribution of treasure dropped by monsters, and because it provides a
5356 * pleasing visual effect at low cost.
5358 * Note that the damage done by "ball" explosions decreases with distance.
5359 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5361 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5362 * the target, and then the damage "flows" along this beam of destruction.
5363 * The damage at every grid is the same as at the "center" of a "ball"
5364 * explosion, since the "beam" grids are treated as if they ARE at the
5365 * center of a "ball" explosion.
5367 * Currently, specifying "beam" plus "ball" means that locations which are
5368 * covered by the initial "beam", and also covered by the final "ball", except
5369 * for the final grid (the epicenter of the ball), will be "hit twice", once
5370 * by the initial beam, and once by the exploding ball. For the grid right
5371 * next to the epicenter, this results in 150% damage being done. The center
5372 * does not have this problem, for the same reason the final grid in a "beam"
5373 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5374 * grids which are covered by the "ball" will NOT work, as then they will
5375 * receive LESS damage than they should. Do not combine "beam" with "ball".
5377 * The array "gy[],gx[]" with current size "grids" is used to hold the
5378 * collected locations of all grids in the "blast area" plus "beam path".
5380 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5381 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5382 * first blast grid (see above) with radius "N" from the blast center. Note
5383 * that only the first gm[1] grids in the blast area thus take full damage.
5384 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5385 * number of blast grids.
5387 * Note that once the projection is complete, (y2,x2) holds the final location
5388 * of bolts/beams, and the "epicenter" of balls.
5390 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5391 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5392 * implementation of the "distance" function. Also, a bolt can be properly
5393 * viewed as a "ball" with a "rad" of "zero".
5395 * Note that if no "target" is reached before the beam/bolt/ball travels the
5396 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5397 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5399 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5400 * to move from point A to point B, even if the player cannot see part of the
5401 * projection path. Note that in general, the player will *always* see part
5402 * of the path, since it either starts at the player or ends on the player.
5404 * Hack -- we assume that every "projection" is "self-illuminating".
5406 * Hack -- when only a single monster is affected, we automatically track
5407 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5409 * Note that all projections now "explode" at their final destination, even
5410 * if they were being projected at a more distant destination. This means
5411 * that "ball" spells will *always* explode.
5413 * Note that we must call "handle_stuff()" after affecting terrain features
5414 * in the blast radius, in case the "illumination" of the grid was changed,
5415 * and "update_view()" and "update_monsters()" need to be called.
5418 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5428 POSITION y_saver, x_saver; /* For reflecting monsters */
5430 int msec = delay_factor * delay_factor * delay_factor;
5432 /* Assume the player sees nothing */
5433 bool notice = FALSE;
5435 /* Assume the player has seen nothing */
5436 bool visual = FALSE;
5438 /* Assume the player has seen no blast grids */
5441 /* Assume to be a normal ball spell */
5442 bool breath = FALSE;
5444 /* Is the player blind? */
5445 bool blind = (p_ptr->blind ? TRUE : FALSE);
5447 bool old_hide = FALSE;
5449 /* Number of grids in the "path" */
5452 /* Actual grids in the "path" */
5455 /* Number of grids in the "blast area" (including the "beam" path) */
5458 /* Coordinates of the affected grids */
5459 POSITION gx[1024], gy[1024];
5461 /* Encoded "radius" info (see above) */
5464 /* Actual radius encoded in gm[] */
5465 POSITION gm_rad = rad;
5469 /* Attacker's name (prepared before polymorph)*/
5470 GAME_TEXT who_name[MAX_NLEN];
5472 /* Can the player see the source of this effect? */
5473 bool see_s_msg = TRUE;
5475 /* Initialize by null string */
5481 /* Default target of monsterspell is player */
5482 monster_target_y = p_ptr->y;
5483 monster_target_x = p_ptr->x;
5485 /* Hack -- Jump to target */
5486 if (flg & (PROJECT_JUMP))
5491 /* Clear the flag */
5492 flg &= ~(PROJECT_JUMP);
5497 /* Start at player */
5504 /* Start at monster */
5507 x1 = current_floor_ptr->m_list[who].fx;
5508 y1 = current_floor_ptr->m_list[who].fy;
5509 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5521 /* Default "destination" */
5526 /* Hack -- verify stuff */
5527 if (flg & (PROJECT_THRU))
5529 if ((x1 == x2) && (y1 == y2))
5531 flg &= ~(PROJECT_THRU);
5535 /* Handle a breath attack */
5540 if (flg & PROJECT_HIDE) old_hide = TRUE;
5541 flg |= PROJECT_HIDE;
5545 /* Hack -- Assume there will be no blast (max radius 32) */
5546 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5554 /* Collect beam grids */
5555 if (flg & (PROJECT_BEAM))
5566 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5568 case GF_DISINTEGRATE:
5569 flg |= (PROJECT_GRID);
5570 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5574 /* Calculate the projection path */
5576 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5579 /* Giga-Hack SEEKER & SUPER_RAY */
5581 if( typ == GF_SEEKER )
5591 for (i = 0; i < path_n; ++i)
5596 POSITION ny = GRID_Y(path_g[i]);
5597 POSITION nx = GRID_X(path_g[i]);
5608 /* Only do visuals if requested */
5609 if (!blind && !(flg & (PROJECT_HIDE)))
5611 /* Only do visuals if the player can "see" the bolt */
5612 if (panel_contains(y, x) && player_has_los_bold(y, x))
5619 /* Obtain the bolt pict */
5620 p = bolt_pict(oy, ox, y, x, typ);
5622 /* Extract attr/char */
5626 /* Visual effects */
5627 print_rel(c, a, y, x);
5628 move_cursor_relative(y, x);
5629 /*if (fresh_before)*/ Term_fresh();
5630 Term_xtra(TERM_XTRA_DELAY, msec);
5632 /*if (fresh_before)*/ Term_fresh();
5634 /* Display "beam" grids */
5635 if (flg & (PROJECT_BEAM))
5637 /* Obtain the explosion pict */
5638 p = bolt_pict(y, x, y, x, typ);
5640 /* Extract attr/char */
5644 /* Visual effects */
5645 print_rel(c, a, y, x);
5648 /* Hack -- Activate delay */
5652 /* Hack -- delay anyway for consistency */
5655 /* Delay for consistency */
5656 Term_xtra(TERM_XTRA_DELAY, msec);
5659 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5660 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5662 /* The target of monsterspell becomes tha mirror(broken) */
5663 monster_target_y = y;
5664 monster_target_x = x;
5666 remove_mirror(y, x);
5667 next_mirror(&oy, &ox, y, x);
5669 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5670 for (j = last_i; j <= i; j++)
5672 y = GRID_Y(path_g[j]);
5673 x = GRID_X(path_g[j]);
5674 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5675 if (!who && (project_m_n == 1) && !jump) {
5676 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5677 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5681 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5682 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5686 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5691 for(i = last_i ; i < path_n ; i++)
5694 py = GRID_Y(path_g[i]);
5695 px = GRID_X(path_g[i]);
5696 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5698 if (!who && (project_m_n == 1) && !jump) {
5699 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5701 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5705 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5706 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5710 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5714 else if(typ == GF_SUPER_RAY){
5716 int second_step = 0;
5723 for (i = 0; i < path_n; ++i)
5728 POSITION ny = GRID_Y(path_g[i]);
5729 POSITION nx = GRID_X(path_g[i]);
5740 /* Only do visuals if requested */
5741 if (!blind && !(flg & (PROJECT_HIDE)))
5743 /* Only do visuals if the player can "see" the bolt */
5744 if (panel_contains(y, x) && player_has_los_bold(y, x))
5751 /* Obtain the bolt pict */
5752 p = bolt_pict(oy, ox, y, x, typ);
5754 /* Extract attr/char */
5758 /* Visual effects */
5759 print_rel(c, a, y, x);
5760 move_cursor_relative(y, x);
5761 /*if (fresh_before)*/ Term_fresh();
5762 Term_xtra(TERM_XTRA_DELAY, msec);
5764 /*if (fresh_before)*/ Term_fresh();
5766 /* Display "beam" grids */
5767 if (flg & (PROJECT_BEAM))
5769 /* Obtain the explosion pict */
5770 p = bolt_pict(y, x, y, x, typ);
5772 /* Extract attr/char */
5776 /* Visual effects */
5777 print_rel(c, a, y, x);
5780 /* Hack -- Activate delay */
5784 /* Hack -- delay anyway for consistency */
5787 /* Delay for consistency */
5788 Term_xtra(TERM_XTRA_DELAY, msec);
5791 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5792 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5794 if( second_step )continue;
5797 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5799 /* The target of monsterspell becomes tha mirror(broken) */
5800 monster_target_y = y;
5801 monster_target_x = x;
5804 for( j = 0; j <=i ; j++ )
5806 y = GRID_Y(path_g[j]);
5807 x = GRID_X(path_g[j]);
5808 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5812 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5813 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5814 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5815 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5816 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5817 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
5818 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5819 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5822 for( i = 0; i < path_n ; i++ )
5825 py = GRID_Y(path_g[i]);
5826 px = GRID_X(path_g[i]);
5827 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5828 if(!who && (project_m_n == 1) && !jump){
5829 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5830 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5834 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5835 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5839 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5844 /* Project along the path */
5845 for (i = 0; i < path_n; ++i)
5850 POSITION ny = GRID_Y(path_g[i]);
5851 POSITION nx = GRID_X(path_g[i]);
5853 if (flg & PROJECT_DISI)
5855 /* Hack -- Balls explode before reaching walls */
5856 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5858 else if (flg & PROJECT_LOS)
5860 /* Hack -- Balls explode before reaching walls */
5861 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
5865 /* Hack -- Balls explode before reaching walls */
5866 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
5873 /* Collect beam grids */
5874 if (flg & (PROJECT_BEAM))
5881 /* Only do visuals if requested */
5882 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
5884 /* Only do visuals if the player can "see" the bolt */
5885 if (panel_contains(y, x) && player_has_los_bold(y, x))
5892 /* Obtain the bolt pict */
5893 p = bolt_pict(oy, ox, y, x, typ);
5895 /* Extract attr/char */
5899 /* Visual effects */
5900 print_rel(c, a, y, x);
5901 move_cursor_relative(y, x);
5902 /*if (fresh_before)*/ Term_fresh();
5903 Term_xtra(TERM_XTRA_DELAY, msec);
5905 /*if (fresh_before)*/ Term_fresh();
5907 /* Display "beam" grids */
5908 if (flg & (PROJECT_BEAM))
5910 /* Obtain the explosion pict */
5911 p = bolt_pict(y, x, y, x, typ);
5913 /* Extract attr/char */
5917 /* Visual effects */
5918 print_rel(c, a, y, x);
5921 /* Hack -- Activate delay */
5925 /* Hack -- delay anyway for consistency */
5928 /* Delay for consistency */
5929 Term_xtra(TERM_XTRA_DELAY, msec);
5936 /* Save the "blast epicenter" */
5940 if (breath && !path_n)
5946 flg &= ~(PROJECT_HIDE);
5950 /* Start the "explosion" */
5953 /* Hack -- make sure beams get to "explode" */
5961 /* If we found a "target", explode there */
5962 if (dist <= MAX_RANGE)
5964 /* Mega-Hack -- remove the final "beam" grid */
5965 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
5968 * Create a conical breath attack
5979 flg &= ~(PROJECT_HIDE);
5981 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
5985 /* Determine the blast area, work from the inside out */
5986 for (dist = 0; dist <= rad; dist++)
5988 /* Scan the maximal blast area of radius "dist" */
5989 for (y = by - dist; y <= by + dist; y++)
5991 for (x = bx - dist; x <= bx + dist; x++)
5993 /* Ignore "illegal" locations */
5994 if (!in_bounds2(y, x)) continue;
5996 /* Enforce a "circular" explosion */
5997 if (distance(by, bx, y, x) != dist) continue;
6003 /* Lights are stopped by opaque terrains */
6004 if (!los(by, bx, y, x)) continue;
6006 case GF_DISINTEGRATE:
6007 /* Disintegration are stopped only by perma-walls */
6008 if (!in_disintegration_range(by, bx, y, x)) continue;
6011 /* Ball explosions are stopped by walls */
6012 if (!projectable(by, bx, y, x)) continue;
6016 /* Save this grid */
6023 /* Encode some more "radius" info */
6029 /* Speed -- ignore "non-explosions" */
6030 if (!grids) return (FALSE);
6033 /* Display the "blast area" if requested */
6034 if (!blind && !(flg & (PROJECT_HIDE)))
6036 /* Then do the "blast", from inside out */
6037 for (t = 0; t <= gm_rad; t++)
6039 /* Dump everything with this radius */
6040 for (i = gm[t]; i < gm[t+1]; i++)
6042 /* Extract the location */
6046 /* Only do visuals if the player can "see" the blast */
6047 if (panel_contains(y, x) && player_has_los_bold(y, x))
6056 /* Obtain the explosion pict */
6057 p = bolt_pict(y, x, y, x, typ);
6059 /* Extract attr/char */
6063 /* Visual effects -- Display */
6064 print_rel(c, a, y, x);
6068 /* Hack -- center the cursor */
6069 move_cursor_relative(by, bx);
6071 /* Flush each "radius" seperately */
6072 /*if (fresh_before)*/ Term_fresh();
6074 /* Delay (efficiently) */
6075 if (visual || drawn)
6077 Term_xtra(TERM_XTRA_DELAY, msec);
6081 /* Flush the erasing */
6084 /* Erase the explosion drawn above */
6085 for (i = 0; i < grids; i++)
6087 /* Extract the location */
6091 /* Hack -- Erase if needed */
6092 if (panel_contains(y, x) && player_has_los_bold(y, x))
6098 /* Hack -- center the cursor */
6099 move_cursor_relative(by, bx);
6101 /* Flush the explosion */
6102 /*if (fresh_before)*/ Term_fresh();
6106 update_creature(p_ptr);
6108 if (flg & PROJECT_KILL)
6110 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6111 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6115 /* Check features */
6116 if (flg & (PROJECT_GRID))
6118 /* Start with "dist" of zero */
6121 /* Scan for features */
6122 for (i = 0; i < grids; i++)
6124 /* Hack -- Notice new "dist" values */
6125 if (gm[dist+1] == i) dist++;
6127 /* Get the grid location */
6131 /* Find the closest point in the blast */
6134 int d = dist_to_line(y, x, y1, x1, by, bx);
6136 /* Affect the grid */
6137 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6141 /* Affect the grid */
6142 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6147 update_creature(p_ptr);
6150 if (flg & (PROJECT_ITEM))
6152 /* Start with "dist" of zero */
6155 /* Scan for objects */
6156 for (i = 0; i < grids; i++)
6158 /* Hack -- Notice new "dist" values */
6159 if (gm[dist+1] == i) dist++;
6161 /* Get the grid location */
6165 /* Find the closest point in the blast */
6168 int d = dist_to_line(y, x, y1, x1, by, bx);
6170 /* Affect the object in the grid */
6171 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6175 /* Affect the object in the grid */
6176 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6182 /* Check monsters */
6183 if (flg & (PROJECT_KILL))
6190 /* Start with "dist" of zero */
6193 /* Scan for monsters */
6194 for (i = 0; i < grids; i++)
6198 /* Hack -- Notice new "dist" values */
6199 if (gm[dist + 1] == i) dist++;
6201 /* Get the grid location */
6205 /* A single bolt may be reflected */
6208 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6209 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6211 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6212 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6213 (!who || dist_hack > 1) && !one_in_(10))
6216 int max_attempts = 10;
6218 /* Choose 'new' target */
6221 t_y = y_saver - 1 + randint1(3);
6222 t_x = x_saver - 1 + randint1(3);
6225 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6227 if (max_attempts < 1)
6233 sound(SOUND_REFLECT);
6236 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6237 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6238 else if (m_ptr->r_idx == MON_DIO)
6239 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6241 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6243 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6245 /* Reflected bolts randomly target either one */
6246 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6247 else flg |= PROJECT_PLAYER;
6249 /* The bolt is reflected */
6250 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6252 /* Don't affect the monster any longer */
6258 /* Find the closest point in the blast */
6261 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6265 effective_dist = dist;
6269 /* There is the riding player on this monster */
6270 if (p_ptr->riding && player_bold(y, x))
6272 /* Aimed on the player */
6273 if (flg & PROJECT_PLAYER)
6275 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6278 * A beam or bolt is well aimed
6280 * So don't affects the mount.
6287 * The spell is not well aimed,
6288 * So partly affect the mount too.
6295 * This grid is the original target.
6296 * Or aimed on your horse.
6298 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6300 /* Hit the mount with full damage */
6304 * Otherwise this grid is not the
6305 * original target, it means that line
6306 * of fire is obstructed by this
6310 * A beam or bolt will hit either
6311 * player or mount. Choose randomly.
6313 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6317 /* Hit the mount with full damage */
6321 /* Hit the player later */
6322 flg |= PROJECT_PLAYER;
6324 /* Don't affect the mount */
6330 * The spell is not well aimed, so
6331 * partly affect both player and
6340 /* Affect the monster in the grid */
6341 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6345 /* Player affected one monster (without "jumping") */
6346 if (!who && (project_m_n == 1) && !jump)
6351 /* Track if possible */
6352 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6354 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6358 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6359 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6367 if (flg & (PROJECT_KILL))
6369 /* Start with "dist" of zero */
6372 /* Scan for player */
6373 for (i = 0; i < grids; i++)
6377 /* Hack -- Notice new "dist" values */
6378 if (gm[dist+1] == i) dist++;
6380 /* Get the grid location */
6384 /* Affect the player? */
6385 if (!player_bold(y, x)) continue;
6387 /* Find the closest point in the blast */
6390 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6394 effective_dist = dist;
6397 /* Target may be your horse */
6400 /* Aimed on the player */
6401 if (flg & PROJECT_PLAYER)
6403 /* Hit the player with full damage */
6407 * Hack -- When this grid was not the
6408 * original target, a beam or bolt
6409 * would hit either player or mount,
6410 * and should be choosen randomly.
6412 * But already choosen to hit the
6413 * mount at this point.
6415 * Or aimed on your horse.
6417 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6420 * A beam or bolt is well aimed
6422 * So don't affects the player.
6429 * The spell is not well aimed,
6430 * So partly affect the player too.
6436 /* Affect the player */
6437 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6443 GAME_TEXT m_name[MAX_NLEN];
6445 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6447 if (rakubadam_m > 0)
6449 if (rakuba(rakubadam_m, FALSE))
6451 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6454 if (p_ptr->riding && rakubadam_p > 0)
6456 if(rakuba(rakubadam_p, FALSE))
6458 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6463 /* Return "something was noticed" */
6468 * @brief 鏡魔法「封魔結界」の効果処理
6470 * @return 効果があったらTRUEを返す
6472 bool binding_field(HIT_POINT dam)
6474 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6475 int mirror_num = 0; /* 鏡の数 */
6477 POSITION centersign;
6478 POSITION x1, x2, y1, y2;
6480 int msec = delay_factor*delay_factor*delay_factor;
6483 POSITION point_x[3];
6484 POSITION point_y[3];
6486 /* Default target of monsterspell is player */
6487 monster_target_y = p_ptr->y;
6488 monster_target_x = p_ptr->x;
6490 for (x = 0; x < current_floor_ptr->width; x++)
6492 for (y = 0; y < current_floor_ptr->height; y++)
6494 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6495 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6496 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6497 player_has_los_bold(y, x) &&
6498 projectable(p_ptr->y, p_ptr->x, y, x)
6500 mirror_y[mirror_num] = y;
6501 mirror_x[mirror_num] = x;
6507 if (mirror_num < 2)return FALSE;
6509 point_x[0] = randint0(mirror_num);
6511 point_x[1] = randint0(mirror_num);
6512 } while (point_x[0] == point_x[1]);
6514 point_y[0] = mirror_y[point_x[0]];
6515 point_x[0] = mirror_x[point_x[0]];
6516 point_y[1] = mirror_y[point_x[1]];
6517 point_x[1] = mirror_x[point_x[1]];
6518 point_y[2] = p_ptr->y;
6519 point_x[2] = p_ptr->x;
6521 x = point_x[0] + point_x[1] + point_x[2];
6522 y = point_y[0] + point_y[1] + point_y[2];
6524 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6525 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6526 if (centersign == 0)return FALSE;
6528 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6529 x1 = x1 < point_x[2] ? x1 : point_x[2];
6530 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6531 y1 = y1 < point_y[2] ? y1 : point_y[2];
6533 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6534 x2 = x2 > point_x[2] ? x2 : point_x[2];
6535 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6536 y2 = y2 > point_y[2] ? y2 : point_y[2];
6538 for (y = y1; y <= y2; y++) {
6539 for (x = x1; x <= x2; x++) {
6540 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6541 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6542 centersign*((point_x[1] - x)*(point_y[2] - y)
6543 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6544 centersign*((point_x[2] - x)*(point_y[0] - y)
6545 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6547 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6548 /* Visual effects */
6550 && panel_contains(y, x)) {
6551 p = bolt_pict(y, x, y, x, GF_MANA);
6552 print_rel(PICT_C(p), PICT_A(p), y, x);
6553 move_cursor_relative(y, x);
6554 /*if (fresh_before)*/ Term_fresh();
6555 Term_xtra(TERM_XTRA_DELAY, msec);
6561 for (y = y1; y <= y2; y++) {
6562 for (x = x1; x <= x2; x++) {
6563 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6564 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6565 centersign*((point_x[1] - x)*(point_y[2] - y)
6566 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6567 centersign*((point_x[2] - x)*(point_y[0] - y)
6568 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6570 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6571 (void)project_f(0, 0, y, x, dam, GF_MANA);
6576 for (y = y1; y <= y2; y++) {
6577 for (x = x1; x <= x2; x++) {
6578 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6579 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6580 centersign*((point_x[1] - x)*(point_y[2] - y)
6581 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6582 centersign*((point_x[2] - x)*(point_y[0] - y)
6583 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6585 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6586 (void)project_o(0, 0, y, x, dam, GF_MANA);
6591 for (y = y1; y <= y2; y++) {
6592 for (x = x1; x <= x2; x++) {
6593 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6594 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6595 centersign*((point_x[1] - x)*(point_y[2] - y)
6596 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6597 centersign*((point_x[2] - x)*(point_y[0] - y)
6598 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6600 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6601 (void)project_m(0, 0, y, x, dam, GF_MANA,
6602 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6608 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6609 remove_mirror(point_y[0], point_x[0]);
6616 * @brief 鏡魔法「鏡の封印」の効果処理
6618 * @return 効果があったらTRUEを返す
6620 void seal_of_mirror(HIT_POINT dam)
6624 for (x = 0; x < current_floor_ptr->width; x++)
6626 for (y = 0; y < current_floor_ptr->height; y++)
6628 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6630 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6631 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6633 if (!current_floor_ptr->grid_array[y][x].m_idx)
6635 remove_mirror(y, x);
6647 * @brief 領域魔法に応じて技能の名称を返す。
6648 * @param tval 魔法書のtval
6649 * @return 領域魔法の技能名称を保管した文字列ポインタ
6651 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6655 case TV_HISSATSU_BOOK:
6656 return _("必殺技", "art");
6658 return _("祈り", "prayer");
6660 return _("歌", "song");
6662 return _("呪文", "spell");