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.
18 #include "io/write-diary.h"
19 #include "cmd/cmd-pet.h"
20 #include "cmd/cmd-dump.h"
24 #include "object-curse.h"
25 #include "player-damage.h"
26 #include "player-effects.h"
27 #include "player-race.h"
28 #include "player-class.h"
31 #include "monster-status.h"
32 #include "monster-spell.h"
34 #include "spells-status.h"
35 #include "spells-diceroll.h"
36 #include "spells-summon.h"
37 #include "monsterrace-hook.h"
45 #include "player-status.h"
46 #include "player-move.h"
47 #include "object-hook.h"
48 #include "object-broken.h"
49 #include "object-flavor.h"
54 #include "view-mainwindow.h"
58 #include "realm-arcane.h"
59 #include "realm-chaos.h"
60 #include "realm-craft.h"
61 #include "realm-crusade.h"
62 #include "realm-daemon.h"
63 #include "realm-death.h"
64 #include "realm-hex.h"
65 #include "realm-hissatsu.h"
66 #include "realm-life.h"
67 #include "realm-nature.h"
68 #include "realm-song.h"
69 #include "realm-sorcery.h"
70 #include "realm-trump.h"
73 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
74 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
77 int project_length = 0; /*!< 投射の射程距離 */
83 STR_OFFSET cap_nickname;
86 * @brief 歌、剣術、呪術領域情報テーブル
88 const magic_type technic_info[NUM_TECHNIC][32] =
210 * @brief 魔法処理のメインルーチン
211 * @param realm 魔法領域のID
212 * @param spell 各領域の魔法ID
214 * @return 各領域魔法に各種テキストを求めた場合は文字列参照ポインタ、そうでない場合はNULLポインタを返す。
216 concptr exe_spell(player_type *caster_ptr, REALM_IDX realm, SPELL_IDX spell, BIT_FLAGS mode)
220 case REALM_LIFE: return do_life_spell(caster_ptr, spell, mode);
221 case REALM_SORCERY: return do_sorcery_spell(caster_ptr, spell, mode);
222 case REALM_NATURE: return do_nature_spell(caster_ptr, spell, mode);
223 case REALM_CHAOS: return do_chaos_spell(caster_ptr, spell, mode);
224 case REALM_DEATH: return do_death_spell(caster_ptr, spell, mode);
225 case REALM_TRUMP: return do_trump_spell(caster_ptr, spell, mode);
226 case REALM_ARCANE: return do_arcane_spell(caster_ptr, spell, mode);
227 case REALM_CRAFT: return do_craft_spell(caster_ptr, spell, mode);
228 case REALM_DAEMON: return do_daemon_spell(caster_ptr, spell, mode);
229 case REALM_CRUSADE: return do_crusade_spell(caster_ptr, spell, mode);
230 case REALM_MUSIC: return do_music_spell(caster_ptr, spell, mode);
231 case REALM_HISSATSU: return do_hissatsu_spell(caster_ptr, spell, mode);
232 case REALM_HEX: return do_hex_spell(caster_ptr, spell, mode);
239 * @brief 配置した鏡リストの次を取得する /
240 * Get another mirror. for SEEKER
241 * @param next_y 次の鏡のy座標を返す参照ポインタ
242 * @param next_x 次の鏡のx座標を返す参照ポインタ
243 * @param cury 現在の鏡のy座標
244 * @param curx 現在の鏡のx座標
246 static void next_mirror(player_type *creature_ptr, POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
248 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
249 int mirror_num = 0; /* 鏡の数 */
253 for (x = 0; x < creature_ptr->current_floor_ptr->width; x++)
255 for (y = 0; y < creature_ptr->current_floor_ptr->height; y++)
257 if (is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[y][x])) {
258 mirror_y[mirror_num] = y;
259 mirror_x[mirror_num] = x;
266 num = randint0(mirror_num);
267 *next_y = mirror_y[num];
268 *next_x = mirror_x[num];
271 *next_y = cury + randint0(5) - 2;
272 *next_x = curx + randint0(5) - 2;
277 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
278 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
279 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
280 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
281 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
285 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
286 * @param caster_ptr プレーヤーへの参照ポインタ
287 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
288 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
289 * @param y 目標Y座標 / Target y location (or location to travel "towards")
290 * @param x 目標X座標 / Target x location (or location to travel "towards")
291 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
292 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
293 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
296 * We are called both for "beam" effects and "ball" effects.
298 * The "r" parameter is the "distance from ground zero".
300 * Note that we determine if the player can "see" anything that happens
301 * by taking into account: blindness, line-of-sight, and illumination.
303 * We return "TRUE" if the effect of the projection is "obvious".
305 * We also "see" grids which are "memorized", probably a hack
307 * Perhaps we should affect doors?
310 static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
312 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
313 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
314 feature_type *f_ptr = &f_info[g_ptr->feat];
316 bool obvious = FALSE;
317 bool known = player_has_los_bold(caster_ptr, y, x);
320 dam = (dam + r) / (r + 1);
322 if (have_flag(f_ptr->flags, FF_TREE))
330 message = _("枯れた", "was blasted."); break;
332 message = _("縮んだ", "shrank."); break;
334 message = _("溶けた", "melted."); break;
337 message = _("凍り、砕け散った", "was frozen and smashed."); break;
341 message = _("燃えた", "burns up!"); break;
353 message = _("粉砕された", "was crushed."); break;
355 message = NULL; break;
359 msg_format(_("木は%s。", "A tree %s"), message);
360 cave_set_feat(caster_ptr, y, x, one_in_(3) ? feat_brake : feat_grass);
363 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
367 /* Analyze the type */
370 /* Ignore most effects */
406 if (is_hidden_door(caster_ptr, g_ptr))
408 disclose_grid(caster_ptr, y, x);
415 if (is_trap(caster_ptr, g_ptr->feat))
419 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
423 cave_alter_feat(caster_ptr, y, x, FF_DISARM);
426 if (is_closed_door(caster_ptr, g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
428 FEAT_IDX old_feat = g_ptr->feat;
429 cave_alter_feat(caster_ptr, y, x, FF_DISARM);
430 if (known && (old_feat != g_ptr->feat))
432 msg_print(_("カチッと音がした!", "Click!"));
437 if (!caster_ptr->blind && player_has_los_bold(caster_ptr, y, x))
439 g_ptr->info &= ~(CAVE_UNSAFE);
440 lite_spot(caster_ptr, y, x);
448 if (is_trap(caster_ptr, g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
452 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
456 cave_alter_feat(caster_ptr, y, x, FF_TUNNEL);
459 if (!caster_ptr->blind && player_has_los_bold(caster_ptr, y, x))
461 g_ptr->info &= ~(CAVE_UNSAFE);
462 lite_spot(caster_ptr, y, x);
470 if (have_flag(f_ptr->flags, FF_SPIKE))
472 s16b old_mimic = g_ptr->mimic;
473 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
475 cave_alter_feat(caster_ptr, y, x, FF_SPIKE);
476 g_ptr->mimic = old_mimic;
478 note_spot(caster_ptr, y, x);
479 lite_spot(caster_ptr, y, x);
481 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
483 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
492 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
494 if (known && (g_ptr->info & (CAVE_MARK)))
496 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
500 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
501 caster_ptr->update |= (PU_FLOW);
508 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
509 if (player_bold(caster_ptr, y, x)) break;
510 cave_set_feat(caster_ptr, y, x, feat_door[DOOR_DOOR].closed);
511 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
516 place_trap(caster_ptr, y, x);
521 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
522 if (player_bold(caster_ptr, y, x)) break;
523 cave_set_feat(caster_ptr, y, x, feat_tree);
524 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
529 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
530 g_ptr->info |= CAVE_OBJECT;
531 g_ptr->mimic = feat_glyph;
532 note_spot(caster_ptr, y, x);
533 lite_spot(caster_ptr, y, x);
538 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
539 if (player_bold(caster_ptr, y, x)) break;
540 cave_set_feat(caster_ptr, y, x, feat_granite);
545 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
548 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
549 cave_set_feat(caster_ptr, y, x, feat_shallow_lava);
553 cave_set_feat(caster_ptr, y, x, feat_deep_lava);
560 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
563 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
564 cave_set_feat(caster_ptr, y, x, feat_shallow_water);
568 cave_set_feat(caster_ptr, y, x, feat_deep_water);
576 if (!(d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
578 g_ptr->info |= (CAVE_GLOW);
579 note_spot(caster_ptr, y, x);
580 lite_spot(caster_ptr, y, x);
581 update_local_illumination(caster_ptr, y, x);
583 if (player_can_see_bold(caster_ptr, y, x)) obvious = TRUE;
584 if (g_ptr->m_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
586 if (caster_ptr->special_defense & NINJA_S_STEALTH)
588 if (player_bold(caster_ptr, y, x)) set_superstealth(caster_ptr, FALSE);
597 bool do_dark = !caster_ptr->phase_out && !is_mirror_grid(g_ptr);
602 if (floor_ptr->dun_level || !is_daytime())
604 for (j = 0; j < 9; j++)
606 int by = y + ddy_ddd[j];
607 int bx = x + ddx_ddd[j];
609 if (in_bounds2(floor_ptr, by, bx))
611 grid_type *cc_ptr = &floor_ptr->grid_array[by][bx];
613 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
624 g_ptr->info &= ~(CAVE_GLOW);
626 /* Hack -- Forget "boring" grids */
627 if (!have_flag(f_ptr->flags, FF_REMEMBER))
630 g_ptr->info &= ~(CAVE_MARK);
632 note_spot(caster_ptr, y, x);
635 lite_spot(caster_ptr, y, x);
637 update_local_illumination(caster_ptr, y, x);
639 if (player_can_see_bold(caster_ptr, y, x)) obvious = TRUE;
640 if (g_ptr->m_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
648 if (is_mirror_grid(g_ptr))
650 msg_print(_("鏡が割れた!", "The mirror was shattered!"));
652 remove_mirror(caster_ptr, y, x);
653 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
656 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
658 if (known && (g_ptr->info & CAVE_MARK))
660 msg_format(_("%sが割れた!", "The %s crumbled!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
664 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
665 caster_ptr->update |= (PU_FLOW);
672 if (is_mirror_grid(g_ptr) && caster_ptr->lev < 40)
674 msg_print(_("鏡が割れた!", "The mirror was shattered!"));
676 remove_mirror(caster_ptr, y, x);
677 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
680 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
682 if (known && (g_ptr->info & CAVE_MARK))
684 msg_format(_("%sが割れた!", "The %s crumbled!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
688 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
689 caster_ptr->update |= (PU_FLOW);
694 case GF_DISINTEGRATE:
696 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
697 remove_mirror(caster_ptr, y, x);
699 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
701 cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI);
702 caster_ptr->update |= (PU_FLOW);
709 lite_spot(caster_ptr, y, x);
715 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
716 * @param caster_ptr プレーヤーへの参照ポインタ
717 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
718 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
719 * @param y 目標Y座標 / Target y location (or location to travel "towards")
720 * @param x 目標X座標 / Target x location (or location to travel "towards")
721 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
722 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
723 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
726 * We are called from "project()" to "damage" objects
728 * We are called both for "beam" effects and "ball" effects.
730 * Perhaps we should only SOMETIMES damage things on the ground.
732 * The "r" parameter is the "distance from ground zero".
734 * Note that we determine if the player can "see" anything that happens
735 * by taking into account: blindness, line-of-sight, and illumination.
737 * We also "see" grids which are "memorized", probably a hack
739 * We return "TRUE" if the effect of the projection is "obvious".
742 static bool project_o(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
744 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
746 OBJECT_IDX this_o_idx, next_o_idx = 0;
748 bool obvious = FALSE;
749 bool known = player_has_los_bold(caster_ptr, y, x);
751 BIT_FLAGS flgs[TR_FLAG_SIZE];
753 GAME_TEXT o_name[MAX_NLEN];
755 KIND_OBJECT_IDX k_idx = 0;
756 bool is_potion = FALSE;
760 dam = (dam + r) / (r + 1);
762 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
764 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[this_o_idx];
768 bool do_kill = FALSE;
770 concptr note_kill = NULL;
774 bool plural = (o_ptr->number > 1);
776 next_o_idx = o_ptr->next_o_idx;
777 object_flags(o_ptr, flgs);
778 if (object_is_artifact(o_ptr)) is_art = TRUE;
784 if (hates_acid(o_ptr))
787 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
788 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
794 if (hates_elec(o_ptr))
797 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
798 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
804 if (hates_fire(o_ptr))
807 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
808 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
814 if (hates_cold(o_ptr))
816 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
818 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
824 if (hates_fire(o_ptr))
827 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
828 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
830 if (hates_elec(o_ptr))
834 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
835 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
841 if (hates_fire(o_ptr))
844 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
845 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
848 if (hates_cold(o_ptr))
852 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
853 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
863 if (hates_cold(o_ptr))
865 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
876 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
879 case GF_DISINTEGRATE:
882 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
888 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
889 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
890 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
896 if (object_is_cursed(o_ptr))
899 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
905 identify_item(caster_ptr, o_ptr);
906 autopick_alter_item(caster_ptr, (-this_o_idx), FALSE);
912 if (o_ptr->tval == TV_CHEST)
916 o_ptr->pval = (0 - o_ptr->pval);
918 if (known && (o_ptr->marked & OM_FOUND))
920 msg_print(_("カチッと音がした!", "Click!"));
930 if (o_ptr->tval == TV_CORPSE)
935 if (!who || is_pet(&caster_ptr->current_floor_ptr->m_list[who]))
936 mode |= PM_FORCE_PET;
938 for (i = 0; i < o_ptr->number; i++)
940 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
941 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
945 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
949 else if (summon_named_creature(caster_ptr, who, y, x, o_ptr->pval, mode))
951 note_kill = _("生き返った。", " revived.");
955 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
969 if (known && (o_ptr->marked & OM_FOUND))
972 object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
975 if (is_art || ignore)
977 if (known && (o_ptr->marked & OM_FOUND))
979 msg_format(_("%sは影響を受けない!",
980 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
985 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
987 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
990 k_idx = o_ptr->k_idx;
991 is_potion = object_is_potion(o_ptr);
992 delete_object_idx(caster_ptr, this_o_idx);
996 (void)potion_smash_effect(caster_ptr, who, y, x, k_idx);
999 lite_spot(caster_ptr, y, x);
1009 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1010 * @param caster_ptr プレーヤーへの参照ポインタ
1011 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1012 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1013 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1014 * @param x 目標X座標 / Target x location (or location to travel "towards")
1015 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1016 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1018 * @param see_s_msg TRUEならばメッセージを表示する
1019 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1022 * This routine takes a "source monster" (by index) which is mostly used to
1023 * determine if the player is causing the damage, and a "radius" (see below),
1024 * which is used to decrease the power of explosions with distance, and a
1025 * location, via integers which are modified by certain types of attacks
1026 * (polymorph and teleport being the obvious ones), a default damage, which
1027 * is modified as needed based on various properties, and finally a "damage
1028 * type" (see below).
1031 * Note that this routine can handle "no damage" attacks (like teleport) by
1032 * taking a "zero" damage, and can even take "parameters" to attacks (like
1033 * confuse) by accepting a "damage", using it to calculate the effect, and
1034 * then setting the damage to zero. Note that the "damage" parameter is
1035 * divided by the radius, so monsters not at the "epicenter" will not take
1036 * as much damage (or whatever)...
1039 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1040 * may result in a dereference of an invalid pointer.
1043 * Various messages are produced, and damage is applied.
1046 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1047 * actually be "made" of that substance, or "breathe" big balls of it.
1048 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1050 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1051 * and hurts evil less. If can breath nether, then it resists it as well.
1054 * Damage reductions use the following formulas:
1055 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1056 * gives avg damage of .655, ranging from .858 to .500
1057 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1058 * gives avg damage of .544, ranging from .714 to .417
1059 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1060 * gives avg damage of .444, ranging from .556 to .333
1061 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1062 * gives avg damage of .327, ranging from .427 to .250
1063 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1064 * gives something simple.
1067 * In this function, "result" messages are postponed until the end, where
1068 * the "note" string is appended to the monster name, if not NULL. So,
1069 * to make a spell have "no effect" just set "note" to NULL. You should
1070 * also set "notice" to FALSE, or the player will learn what the spell does.
1073 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1077 static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1081 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1082 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
1084 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
1085 monster_type *m_caster_ptr = (who > 0) ? &floor_ptr->m_list[who] : NULL;
1087 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1091 bool seen = m_ptr->ml;
1092 bool seen_msg = is_seen(m_ptr);
1093 bool slept = (bool)MON_CSLEEP(m_ptr);
1094 bool obvious = FALSE;
1095 bool known = ((m_ptr->cdis <= MAX_SIGHT) || caster_ptr->phase_out);
1096 bool skipped = FALSE;
1097 bool get_angry = FALSE;
1098 bool do_poly = FALSE;
1105 bool heal_leper = FALSE;
1106 GAME_TEXT m_name[MAX_NLEN];
1108 PARAMETER_VALUE photo = 0;
1109 concptr note = NULL;
1110 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1111 DEPTH caster_lev = (who > 0) ? r_info[m_caster_ptr->r_idx].level : (caster_ptr->lev * 2);
1113 if (!g_ptr->m_idx) return FALSE;
1115 /* Never affect projector */
1116 if (who && (g_ptr->m_idx == who)) return FALSE;
1117 if ((g_ptr->m_idx == caster_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return FALSE;
1118 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1120 /* Don't affect already death monsters */
1121 /* Prevents problems with chain reactions of exploding monsters */
1122 if (m_ptr->hp < 0) return FALSE;
1124 dam = (dam + r) / (r + 1);
1126 /* Get the monster name (BEFORE polymorphing) */
1127 monster_desc(caster_ptr, m_name, m_ptr, 0);
1129 /* Get the monster possessive ("his"/"her"/"its") */
1130 monster_desc(caster_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1132 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) disturb(caster_ptr, TRUE, TRUE);
1134 if (r_ptr->flagsr & RFR_RES_ALL &&
1135 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1136 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1138 note = _("には完全な耐性がある!", " is immune.");
1140 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1141 if (typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1149 if (seen) obvious = TRUE;
1154 if (seen) obvious = TRUE;
1155 if (r_ptr->flagsr & RFR_IM_ACID)
1157 note = _("にはかなり耐性がある!", " resists a lot.");
1159 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1165 if (seen) obvious = TRUE;
1166 if (r_ptr->flagsr & RFR_IM_ELEC)
1168 note = _("にはかなり耐性がある!", " resists a lot.");
1170 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1176 if (seen) obvious = TRUE;
1177 if (r_ptr->flagsr & RFR_IM_FIRE)
1179 note = _("にはかなり耐性がある!", " resists a lot.");
1181 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1183 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1185 note = _("はひどい痛手をうけた。", " is hit hard.");
1187 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1193 if (seen) obvious = TRUE;
1194 if (r_ptr->flagsr & RFR_IM_COLD)
1196 note = _("にはかなり耐性がある!", " resists a lot.");
1198 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1200 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1202 note = _("はひどい痛手をうけた。", " is hit hard.");
1204 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1210 if (seen) obvious = TRUE;
1211 if (r_ptr->flagsr & RFR_IM_POIS)
1213 note = _("にはかなり耐性がある!", " resists a lot.");
1215 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1221 if (seen) obvious = TRUE;
1222 if (r_ptr->flagsr & RFR_IM_POIS)
1224 note = _("には耐性がある。", " resists.");
1225 dam *= 3; dam /= randint1(6) + 6;
1226 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1228 else if (one_in_(3)) do_poly = TRUE;
1233 if (seen) obvious = TRUE;
1234 if (r_ptr->flags3 & RF3_GOOD)
1236 note = _("はひどい痛手をうけた。", " is hit hard.");
1238 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1244 if (seen) obvious = TRUE;
1245 if (r_ptr->flags3 & RF3_EVIL)
1248 note = _("はひどい痛手をうけた。", " is hit hard.");
1249 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1253 note = _("には耐性がある。", " resists.");
1254 dam *= 3; dam /= randint1(6) + 6;
1260 if (seen) obvious = TRUE;
1265 if (seen) obvious = TRUE;
1266 if (r_ptr->flagsr & RFR_RES_PLAS)
1268 note = _("には耐性がある。", " resists.");
1269 dam *= 3; dam /= randint1(6) + 6;
1270 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1277 if (seen) obvious = TRUE;
1278 if (r_ptr->flagsr & RFR_RES_NETH)
1280 if (r_ptr->flags3 & RF3_UNDEAD)
1282 note = _("には完全な耐性がある!", " is immune.");
1284 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1288 note = _("には耐性がある。", " resists.");
1289 dam *= 3; dam /= randint1(6) + 6;
1291 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1293 else if (r_ptr->flags3 & RF3_EVIL)
1295 note = _("はいくらか耐性を示した。", " resists somewhat.");
1297 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1304 if (seen) obvious = TRUE;
1305 if (r_ptr->flagsr & RFR_RES_WATE)
1307 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1309 note = _("には完全な耐性がある!", " is immune.");
1314 note = _("には耐性がある。", " resists.");
1315 dam *= 3; dam /= randint1(6) + 6;
1317 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1324 if (seen) obvious = TRUE;
1325 if (r_ptr->flagsr & RFR_RES_CHAO)
1327 note = _("には耐性がある。", " resists.");
1328 dam *= 3; dam /= randint1(6) + 6;
1329 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1331 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1333 note = _("はいくらか耐性を示した。", " resists somewhat.");
1334 dam *= 3; dam /= randint1(6) + 6;
1335 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1340 do_conf = (5 + randint1(11) + r) / (r + 1);
1347 if (seen) obvious = TRUE;
1348 if (r_ptr->flagsr & RFR_RES_SHAR)
1350 note = _("には耐性がある。", " resists.");
1351 dam *= 3; dam /= randint1(6) + 6;
1352 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1359 if (seen) obvious = TRUE;
1360 if (r_ptr->flagsr & RFR_RES_SHAR)
1362 note = _("はいくらか耐性を示した。", " resists somewhat.");
1364 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1371 if (seen) obvious = TRUE;
1372 if (r_ptr->flagsr & RFR_RES_SOUN)
1374 note = _("には耐性がある。", " resists.");
1375 dam *= 2; dam /= randint1(6) + 6;
1376 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1379 do_stun = (10 + randint1(15) + r) / (r + 1);
1385 if (seen) obvious = TRUE;
1386 if (r_ptr->flags3 & RF3_NO_CONF)
1388 note = _("には耐性がある。", " resists.");
1389 dam *= 3; dam /= randint1(6) + 6;
1390 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1393 do_conf = (10 + randint1(15) + r) / (r + 1);
1399 if (seen) obvious = TRUE;
1400 if (r_ptr->flagsr & RFR_RES_DISE)
1402 note = _("には耐性がある。", " resists.");
1403 dam *= 3; dam /= randint1(6) + 6;
1404 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1411 if (seen) obvious = TRUE;
1412 if (r_ptr->flagsr & RFR_RES_NEXU)
1414 note = _("には耐性がある。", " resists.");
1415 dam *= 3; dam /= randint1(6) + 6;
1416 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1423 if (seen) obvious = TRUE;
1424 if (r_ptr->flagsr & RFR_RES_WALL)
1426 note = _("には耐性がある。", " resists.");
1427 dam *= 3; dam /= randint1(6) + 6;
1428 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1431 do_stun = (randint1(15) + r) / (r + 1);
1437 if (seen) obvious = TRUE;
1438 if (r_ptr->flagsr & RFR_RES_INER)
1440 note = _("には耐性がある。", " resists.");
1441 dam *= 3; dam /= randint1(6) + 6;
1442 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1446 /* Powerful monsters can resist */
1447 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1448 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1452 /* Normal monsters slow down */
1455 if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1457 note = _("の動きが遅くなった。", " starts moving slower.");
1466 if (seen) obvious = TRUE;
1467 if (r_ptr->flagsr & RFR_RES_TIME)
1469 note = _("には耐性がある。", " resists.");
1470 dam *= 3; dam /= randint1(6) + 6;
1471 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1474 do_time = (dam + 1) / 2;
1480 bool resist_tele = FALSE;
1482 if (seen) obvious = TRUE;
1483 if (r_ptr->flagsr & RFR_RES_TELE)
1485 if (r_ptr->flags1 & (RF1_UNIQUE))
1487 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1488 note = _("には効果がなかった。", " is unaffected!");
1491 else if (r_ptr->level > randint1(100))
1493 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1494 note = _("には耐性がある!", " resists!");
1499 if (!resist_tele) do_dist = 10;
1502 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) do_dist = 0;
1504 if (r_ptr->flagsr & RFR_RES_GRAV)
1506 note = _("には耐性がある!", " resists!");
1507 dam *= 3; dam /= randint1(6) + 6;
1509 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1514 /* Powerful monsters can resist */
1515 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1516 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1520 /* Normal monsters slow down */
1523 if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1525 note = _("の動きが遅くなった。", " starts moving slower.");
1530 do_stun = damroll((caster_lev / 20) + 3, (dam)) + 1;
1532 /* Attempt a saving throw */
1533 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1534 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1538 /* No obvious effect */
1539 note = _("には効果がなかった。", " is unaffected!");
1550 if (seen) obvious = TRUE;
1553 case GF_DISINTEGRATE:
1555 if (seen) obvious = TRUE;
1556 if (r_ptr->flags3 & RF3_HURT_ROCK)
1558 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1559 note = _("の皮膚がただれた!", " loses some skin!");
1560 note_dies = _("は蒸発した!", " evaporates!");
1568 if (seen) obvious = TRUE;
1569 if (!(los(caster_ptr, m_ptr->fy, m_ptr->fx, caster_ptr->y, caster_ptr->x)))
1572 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1577 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1580 note = _("には完全な耐性がある!", " is immune.");
1581 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1584 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1585 (r_ptr->flags3 & RF3_ANIMAL) ||
1586 (r_ptr->level > randint1(3 * dam)))
1588 note = _("には耐性がある!", " resists!");
1592 * Powerful demons & undead can turn a mindcrafter's
1593 * attacks back on them
1595 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1596 (r_ptr->level > caster_ptr->lev / 2) &&
1600 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1601 (seen ? "%^s's corrupted mind backlashes your attack!" :
1602 "%^ss corrupted mind backlashes your attack!")), m_name);
1604 if ((randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav) && !CHECK_MULTISHADOW(caster_ptr))
1606 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1610 /* Injure +/- confusion */
1611 monster_desc(caster_ptr, killer, m_ptr, MD_WRONGDOER_NAME);
1612 take_hit(caster_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1613 if (one_in_(4) && !CHECK_MULTISHADOW(caster_ptr))
1615 switch (randint1(4))
1618 set_confused(caster_ptr, caster_ptr->confused + 3 + randint1(dam));
1621 set_stun(caster_ptr, caster_ptr->stun + randint1(dam));
1625 if (r_ptr->flags3 & RF3_NO_FEAR)
1626 note = _("には効果がなかった。", " is unaffected.");
1628 set_afraid(caster_ptr, caster_ptr->afraid + 3 + randint1(dam));
1632 if (!caster_ptr->free_act)
1633 (void)set_paralyzed(caster_ptr, caster_ptr->paralyzed + randint1(dam));
1643 if ((dam > 0) && one_in_(4))
1645 switch (randint1(4))
1648 do_conf = 3 + randint1(dam);
1651 do_stun = 3 + randint1(dam);
1654 do_fear = 3 + randint1(dam);
1657 note = _("は眠り込んでしまった!", " falls asleep!");
1658 do_sleep = 3 + randint1(dam);
1663 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1668 if (seen) obvious = TRUE;
1669 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1672 note = _("には完全な耐性がある!", " is immune.");
1674 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1675 (r_ptr->flags3 & RF3_ANIMAL) ||
1676 (r_ptr->level > randint1(3 * dam)))
1678 note = _("には耐性がある!", " resists!");
1682 * Powerful demons & undead can turn a mindcrafter's
1683 * attacks back on them
1685 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1686 (r_ptr->level > caster_ptr->lev / 2) &&
1690 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1691 (seen ? "%^s's corrupted mind backlashes your attack!" :
1692 "%^ss corrupted mind backlashes your attack!")), m_name);
1693 if ((randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav) && !CHECK_MULTISHADOW(caster_ptr))
1695 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1699 monster_desc(caster_ptr, killer, m_ptr, MD_WRONGDOER_NAME);
1700 if (!CHECK_MULTISHADOW(caster_ptr))
1702 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1703 caster_ptr->csp -= damroll(5, dam) / 2;
1704 if (caster_ptr->csp < 0) caster_ptr->csp = 0;
1705 caster_ptr->redraw |= PR_MANA;
1706 caster_ptr->window |= (PW_SPELL);
1708 take_hit(caster_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1716 int b = damroll(5, dam) / 4;
1717 concptr str = (caster_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1718 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1719 (seen ? "You convert %s's pain into %s!" :
1720 "You convert %ss pain into %s!"));
1721 msg_format(msg, m_name, str);
1723 b = MIN(caster_ptr->msp, caster_ptr->csp + b);
1724 caster_ptr->csp = b;
1725 caster_ptr->redraw |= PR_MANA;
1726 caster_ptr->window |= (PW_SPELL);
1729 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1732 case GF_TELEKINESIS:
1734 if (seen) obvious = TRUE;
1737 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) do_dist = 0;
1741 do_stun = damroll((caster_lev / 20) + 3, dam) + 1;
1742 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1743 (r_ptr->level > 5 + randint1(dam)))
1753 if (seen) obvious = TRUE;
1758 if (seen) obvious = TRUE;
1763 if (!is_hostile(m_ptr)) break;
1764 if (seen) obvious = TRUE;
1765 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1766 (r_ptr->flags3 & RF3_NO_CONF) ||
1767 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1769 if (r_ptr->flags3 & RF3_NO_CONF)
1771 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1777 * Powerful demons & undead can turn a mindcrafter's
1778 * attacks back on them
1780 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1781 (r_ptr->level > caster_ptr->lev / 2) &&
1785 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1786 (seen ? "%^s's corrupted mind backlashes your attack!" :
1787 "%^ss corrupted mind backlashes your attack!")), m_name);
1790 if (randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav)
1792 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1796 /* Confuse, stun, terrify */
1797 switch (randint1(4))
1800 set_stun(caster_ptr, caster_ptr->stun + dam / 2);
1803 set_confused(caster_ptr, caster_ptr->confused + dam / 2);
1807 if (r_ptr->flags3 & RF3_NO_FEAR)
1808 note = _("には効果がなかった。", " is unaffected.");
1810 set_afraid(caster_ptr, caster_ptr->afraid + dam);
1817 note = _("には効果がなかった。", " is unaffected.");
1823 if (!common_saving_throw_charm(caster_ptr, dam, m_ptr))
1825 note = _("があなたに隷属した。", " is in your thrall!");
1826 set_pet(caster_ptr, m_ptr);
1830 switch (randint1(4))
1849 if (seen) obvious = TRUE;
1850 do_stun = (randint1(15) + 1) / (r + 1);
1851 if (r_ptr->flagsr & RFR_IM_COLD)
1853 note = _("にはかなり耐性がある!", " resists a lot.");
1855 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1857 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1859 note = _("はひどい痛手をうけた。", " is hit hard.");
1861 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1866 case GF_HYPODYNAMIA:
1868 if (seen) obvious = TRUE;
1869 if (!monster_living(m_ptr->r_idx))
1871 if (is_original_ap_and_seen(caster_ptr, m_ptr))
1873 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1874 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1875 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1877 note = _("には効果がなかった。", " is unaffected.");
1882 do_time = (dam + 7) / 8;
1888 if (seen) obvious = TRUE;
1889 if (!monster_living(m_ptr->r_idx))
1891 if (is_original_ap_and_seen(caster_ptr, m_ptr))
1893 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
1894 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
1895 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
1897 note = _("には完全な耐性がある!", " is immune.");
1901 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
1902 (randint1(888) != 666)) ||
1903 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
1904 randint1(100) != 66))
1906 note = _("には耐性がある!", " resists!");
1915 if (seen) obvious = TRUE;
1918 /* Powerful monsters can resist */
1919 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1920 (r_ptr->flags1 & RF1_QUESTOR) ||
1921 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1923 note = _("には効果がなかった。", " is unaffected.");
1933 if (seen) obvious = TRUE;
1935 if ((floor_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
1937 note = _("には効果がなかった。", " is unaffected.");
1941 m_ptr->hp = m_ptr->maxhp;
1942 if (multiply_monster(caster_ptr, g_ptr->m_idx, TRUE, 0L))
1944 note = _("が分裂した!", " spawns!");
1953 if (seen) obvious = TRUE;
1955 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1957 if (m_ptr->maxhp < m_ptr->max_maxhp)
1959 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
1960 m_ptr->maxhp = m_ptr->max_maxhp;
1965 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
1966 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
1972 if (seen) obvious = TRUE;
1975 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1976 if (MON_STUNNED(m_ptr))
1978 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
1979 (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, 0);
1981 if (MON_CONFUSED(m_ptr))
1983 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
1984 (void)set_monster_confused(caster_ptr, g_ptr->m_idx, 0);
1986 if (MON_MONFEAR(m_ptr))
1988 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name, m_poss);
1989 (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, 0);
1992 if (m_ptr->hp < 30000) m_ptr->hp += dam;
1993 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1997 chg_virtue(caster_ptr, V_VITALITY, 1);
1999 if (r_ptr->flags1 & RF1_UNIQUE)
2000 chg_virtue(caster_ptr, V_INDIVIDUALISM, 1);
2002 if (is_friendly(m_ptr))
2003 chg_virtue(caster_ptr, V_HONOUR, 1);
2004 else if (!(r_ptr->flags3 & RF3_EVIL))
2006 if (r_ptr->flags3 & RF3_GOOD)
2007 chg_virtue(caster_ptr, V_COMPASSION, 2);
2009 chg_virtue(caster_ptr, V_COMPASSION, 1);
2012 if (r_ptr->flags3 & RF3_ANIMAL)
2013 chg_virtue(caster_ptr, V_NATURE, 1);
2016 if (m_ptr->r_idx == MON_LEPER)
2019 if (!who) chg_virtue(caster_ptr, V_COMPASSION, 5);
2022 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
2023 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
2025 note = _("は体力を回復したようだ。", " looks healthier.");
2032 if (seen) obvious = TRUE;
2034 if (set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2036 note = _("の動きが速くなった。", " starts moving faster.");
2041 if (r_ptr->flags1 & RF1_UNIQUE)
2042 chg_virtue(caster_ptr, V_INDIVIDUALISM, 1);
2043 if (is_friendly(m_ptr))
2044 chg_virtue(caster_ptr, V_HONOUR, 1);
2052 if (seen) obvious = TRUE;
2054 /* Powerful monsters can resist */
2055 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2056 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2058 note = _("には効果がなかった。", " is unaffected.");
2063 if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2065 note = _("の動きが遅くなった。", " starts moving slower.");
2074 if (seen) obvious = TRUE;
2076 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2077 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2078 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2080 if (r_ptr->flags3 & RF3_NO_SLEEP)
2082 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2085 note = _("には効果がなかった。", " is unaffected.");
2090 note = _("は眠り込んでしまった!", " falls asleep!");
2097 case GF_STASIS_EVIL:
2099 if (seen) obvious = TRUE;
2101 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2102 !(r_ptr->flags3 & RF3_EVIL) ||
2103 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2105 note = _("には効果がなかった。", " is unaffected.");
2110 note = _("は動けなくなった!", " is suspended!");
2119 if (seen) obvious = TRUE;
2121 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2122 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2124 note = _("には効果がなかった。", " is unaffected.");
2129 note = _("は動けなくなった!", " is suspended!");
2139 vir = virtue_number(caster_ptr, V_HARMONY);
2142 dam += caster_ptr->virtues[vir - 1] / 10;
2145 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2148 dam -= caster_ptr->virtues[vir - 1] / 20;
2151 if (seen) obvious = TRUE;
2153 if (common_saving_throw_charm(caster_ptr, dam, m_ptr))
2155 note = _("には効果がなかった。", " is unaffected.");
2158 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2160 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2162 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2163 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2167 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2168 set_pet(caster_ptr, m_ptr);
2170 chg_virtue(caster_ptr, V_INDIVIDUALISM, -1);
2171 if (r_ptr->flags3 & RF3_ANIMAL)
2172 chg_virtue(caster_ptr, V_NATURE, 1);
2178 case GF_CONTROL_UNDEAD:
2181 if (seen) obvious = TRUE;
2183 vir = virtue_number(caster_ptr, V_UNLIFE);
2186 dam += caster_ptr->virtues[vir - 1] / 10;
2189 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2192 dam -= caster_ptr->virtues[vir - 1] / 20;
2195 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2196 !(r_ptr->flags3 & RF3_UNDEAD))
2198 note = _("には効果がなかった。", " is unaffected.");
2200 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2202 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2204 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2205 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2209 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2210 set_pet(caster_ptr, m_ptr);
2216 case GF_CONTROL_DEMON:
2219 if (seen) obvious = TRUE;
2221 vir = virtue_number(caster_ptr, V_UNLIFE);
2224 dam += caster_ptr->virtues[vir - 1] / 10;
2227 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2230 dam -= caster_ptr->virtues[vir - 1] / 20;
2233 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2234 !(r_ptr->flags3 & RF3_DEMON))
2236 note = _("には効果がなかった。", " is unaffected.");
2238 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2240 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2242 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2243 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2247 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2248 set_pet(caster_ptr, m_ptr);
2254 case GF_CONTROL_ANIMAL:
2257 if (seen) obvious = TRUE;
2259 vir = virtue_number(caster_ptr, V_NATURE);
2262 dam += caster_ptr->virtues[vir - 1] / 10;
2265 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2268 dam -= caster_ptr->virtues[vir - 1] / 20;
2271 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2272 !(r_ptr->flags3 & RF3_ANIMAL))
2274 note = _("には効果がなかった。", " is unaffected.");
2276 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2278 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2280 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2281 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2285 note = _("はなついた。", " is tamed!");
2286 set_pet(caster_ptr, m_ptr);
2287 if (r_ptr->flags3 & RF3_ANIMAL)
2288 chg_virtue(caster_ptr, V_NATURE, 1);
2294 case GF_CHARM_LIVING:
2298 vir = virtue_number(caster_ptr, V_UNLIFE);
2299 if (seen) obvious = TRUE;
2301 vir = virtue_number(caster_ptr, V_UNLIFE);
2304 dam -= caster_ptr->virtues[vir - 1] / 10;
2307 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2310 dam -= caster_ptr->virtues[vir - 1] / 20;
2313 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2315 if (common_saving_throw_charm(caster_ptr, dam, m_ptr) ||
2316 !monster_living(m_ptr->r_idx))
2318 note = _("には効果がなかった。", " is unaffected.");
2320 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2322 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2324 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2325 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2329 note = _("を支配した。", " is tamed!");
2330 set_pet(caster_ptr, m_ptr);
2331 if (r_ptr->flags3 & RF3_ANIMAL)
2332 chg_virtue(caster_ptr, V_NATURE, 1);
2340 if (seen) obvious = TRUE;
2342 do_conf = damroll(3, (dam / 2)) + 1;
2343 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2344 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2345 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2347 if (r_ptr->flags3 & (RF3_NO_CONF))
2349 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2353 note = _("には効果がなかった。", " is unaffected.");
2362 if (seen) obvious = TRUE;
2364 do_stun = damroll((caster_lev / 20) + 3, (dam)) + 1;
2365 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2366 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2369 note = _("には効果がなかった。", " is unaffected.");
2384 if (r_ptr->flags3 & (RF3_HURT_LITE))
2386 if (seen) obvious = TRUE;
2388 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2390 note = _("は光に身をすくめた!", " cringes from the light!");
2391 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2402 if (seen) obvious = TRUE;
2404 if (r_ptr->flagsr & RFR_RES_LITE)
2406 note = _("には耐性がある!", " resists!");
2407 dam *= 2; dam /= (randint1(6) + 6);
2408 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2410 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2412 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2413 note = _("は光に身をすくめた!", " cringes from the light!");
2414 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2421 if (seen) obvious = TRUE;
2423 if (r_ptr->flagsr & RFR_RES_DARK)
2425 note = _("には耐性がある!", " resists!");
2426 dam *= 2; dam /= (randint1(6) + 6);
2427 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2434 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2436 if (seen) obvious = TRUE;
2438 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2440 note = _("の皮膚がただれた!", " loses some skin!");
2441 note_dies = _("はドロドロに溶けた!", " dissolves!");
2450 case GF_AWAY_UNDEAD:
2452 if (r_ptr->flags3 & (RF3_UNDEAD))
2454 bool resists_tele = FALSE;
2456 if (r_ptr->flagsr & RFR_RES_TELE)
2458 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2460 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2461 note = _("には効果がなかった。", " is unaffected.");
2462 resists_tele = TRUE;
2464 else if (r_ptr->level > randint1(100))
2466 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2467 note = _("には耐性がある!", " resists!");
2468 resists_tele = TRUE;
2474 if (seen) obvious = TRUE;
2475 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2489 if (r_ptr->flags3 & (RF3_EVIL))
2491 bool resists_tele = FALSE;
2493 if (r_ptr->flagsr & RFR_RES_TELE)
2495 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2497 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2498 note = _("には効果がなかった。", " is unaffected.");
2499 resists_tele = TRUE;
2501 else if (r_ptr->level > randint1(100))
2503 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2504 note = _("には耐性がある!", " resists!");
2505 resists_tele = TRUE;
2511 if (seen) obvious = TRUE;
2512 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2526 bool resists_tele = FALSE;
2527 if (r_ptr->flagsr & RFR_RES_TELE)
2529 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2531 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2532 note = _("には効果がなかった。", " is unaffected.");
2533 resists_tele = TRUE;
2535 else if (r_ptr->level > randint1(100))
2537 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2538 note = _("には耐性がある!", " resists!");
2539 resists_tele = TRUE;
2545 if (seen) obvious = TRUE;
2553 case GF_TURN_UNDEAD:
2555 if (r_ptr->flags3 & (RF3_UNDEAD))
2557 if (seen) obvious = TRUE;
2559 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2561 do_fear = damroll(3, (dam / 2)) + 1;
2562 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2564 note = _("には効果がなかった。", " is unaffected.");
2579 if (r_ptr->flags3 & (RF3_EVIL))
2581 if (seen) obvious = TRUE;
2583 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2585 do_fear = damroll(3, (dam / 2)) + 1;
2586 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2588 note = _("には効果がなかった。", " is unaffected.");
2603 if (seen) obvious = TRUE;
2605 do_fear = damroll(3, (dam / 2)) + 1;
2606 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2607 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2608 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2610 note = _("には効果がなかった。", " is unaffected.");
2618 case GF_DISP_UNDEAD:
2620 if (r_ptr->flags3 & (RF3_UNDEAD))
2622 if (seen) obvious = TRUE;
2624 /* Learn about type */
2625 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2627 note = _("は身震いした。", " shudders.");
2628 note_dies = _("はドロドロに溶けた!", " dissolves!");
2640 if (r_ptr->flags3 & (RF3_EVIL))
2642 if (seen) obvious = TRUE;
2644 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2646 note = _("は身震いした。", " shudders.");
2647 note_dies = _("はドロドロに溶けた!", " dissolves!");
2659 if (r_ptr->flags3 & (RF3_GOOD))
2661 if (seen) obvious = TRUE;
2663 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
2665 note = _("は身震いした。", " shudders.");
2666 note_dies = _("はドロドロに溶けた!", " dissolves!");
2676 case GF_DISP_LIVING:
2678 if (monster_living(m_ptr->r_idx))
2680 if (seen) obvious = TRUE;
2682 note = _("は身震いした。", " shudders.");
2683 note_dies = _("はドロドロに溶けた!", " dissolves!");
2695 if (r_ptr->flags3 & (RF3_DEMON))
2697 if (seen) obvious = TRUE;
2699 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
2701 note = _("は身震いした。", " shudders.");
2702 note_dies = _("はドロドロに溶けた!", " dissolves!");
2714 if (seen) obvious = TRUE;
2715 note = _("は身震いした。", " shudders.");
2716 note_dies = _("はドロドロに溶けた!", " dissolves!");
2721 if (seen) obvious = TRUE;
2722 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
2726 if (m_caster_ptr->hp < m_caster_ptr->maxhp)
2728 m_caster_ptr->hp += dam;
2729 if (m_caster_ptr->hp > m_caster_ptr->maxhp) m_caster_ptr->hp = m_caster_ptr->maxhp;
2730 if (caster_ptr->health_who == who) caster_ptr->redraw |= (PR_HEALTH);
2731 if (caster_ptr->riding == who) caster_ptr->redraw |= (PR_UHEALTH);
2735 monster_desc(caster_ptr, killer, m_caster_ptr, 0);
2736 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
2742 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
2743 (void)hp_player(caster_ptr, dam);
2748 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
2756 if (seen) obvious = TRUE;
2757 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
2759 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2760 (r_ptr->flags3 & RF3_NO_CONF) ||
2761 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
2763 if (r_ptr->flags3 & (RF3_NO_CONF))
2765 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2768 note = _("には効果がなかった。", " is unaffected.");
2771 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
2773 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2774 note = _("には完全な耐性がある!", " is immune.");
2777 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
2779 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
2780 note = _("には耐性がある。", " resists.");
2785 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
2786 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2788 if (who > 0) do_conf = randint0(4) + 4;
2789 else do_conf = randint0(8) + 8;
2794 case GF_BRAIN_SMASH:
2796 if (seen) obvious = TRUE;
2797 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
2799 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2800 (r_ptr->flags3 & RF3_NO_CONF) ||
2801 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
2803 if (r_ptr->flags3 & (RF3_NO_CONF))
2805 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2808 note = _("には効果がなかった。", " is unaffected.");
2811 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
2813 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2814 note = _("には完全な耐性がある!", " is immune.");
2817 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
2819 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
2820 note = _("には耐性がある!", " resists!");
2825 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
2826 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
2829 do_conf = randint0(4) + 4;
2830 do_stun = randint0(4) + 4;
2834 do_conf = randint0(8) + 8;
2835 do_stun = randint0(8) + 8;
2837 (void)set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
2844 if (seen) obvious = TRUE;
2845 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
2846 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
2848 note = _("には効果がなかった。", " is unaffected.");
2856 if (seen) obvious = TRUE;
2857 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
2859 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
2861 note = _("には効果がなかった。", " is unaffected.");
2869 if (seen) obvious = TRUE;
2870 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
2872 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
2874 note = _("には効果がなかった。", " is unaffected.");
2882 if (seen) obvious = TRUE;
2884 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
2885 "You point at %s, screaming the word, 'DIE!'."), m_name);
2887 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (m_caster_ptr->r_idx != MON_KENSHIROU)))
2889 note = _("には効果がなかった。", " is unaffected.");
2896 if (seen) obvious = TRUE;
2897 if (r_ptr->flags1 & RF1_UNIQUE)
2899 note = _("には効果がなかった。", " is unaffected.");
2904 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
2905 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
2907 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
2909 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
2913 /* todo 乱数で破滅のを弾いた結果が「耐性を持っている」ことになるのはおかしい */
2914 note = _("は耐性を持っている!", "resists!");
2924 if ((floor_ptr->inside_quest && (quest[floor_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
2925 (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)
2927 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
2932 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
2933 else if ((caster_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
2934 nokori_hp = m_ptr->maxhp * 3 / 10;
2936 nokori_hp = m_ptr->maxhp * 3 / 20;
2938 if (m_ptr->hp >= nokori_hp)
2940 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
2943 else if (m_ptr->hp < randint0(nokori_hp))
2945 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(caster_ptr, g_ptr->m_idx, FALSE, MON_CHAMELEON);
2946 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
2947 cap_mon = m_ptr->r_idx;
2948 cap_mspeed = m_ptr->mspeed;
2950 cap_maxhp = m_ptr->max_maxhp;
2951 cap_nickname = m_ptr->nickname;
2952 if (g_ptr->m_idx == caster_ptr->riding)
2954 if (rakuba(caster_ptr, -1, FALSE))
2956 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
2960 delete_monster_idx(caster_ptr, g_ptr->m_idx);
2966 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
2974 return py_attack(caster_ptr, y, x, dam);
2981 if (seen) obvious = TRUE;
2982 if (r_ptr->flags2 & RF2_EMPTY_MIND)
2984 note = _("には効果がなかった。", " is unaffected.");
2987 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
2990 if (MON_CSLEEP(m_ptr))
2992 note = _("には効果がなかった。", " is unaffected.");
2998 if (one_in_(5)) effect = 1;
2999 else if (one_in_(4)) effect = 2;
3000 else if (one_in_(3)) effect = 3;
3005 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3006 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3008 note = _("には効果がなかった。", " is unaffected.");
3013 if (set_monster_slow(caster_ptr, g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3015 note = _("の動きが遅くなった。", " starts moving slower.");
3019 else if (effect == 2)
3021 do_stun = damroll((caster_ptr->lev / 10) + 3, (dam)) + 1;
3022 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3023 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3026 note = _("には効果がなかった。", " is unaffected.");
3030 else if (effect == 3)
3032 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3033 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3034 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3036 if (r_ptr->flags3 & RF3_NO_SLEEP)
3038 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3041 note = _("には効果がなかった。", " is unaffected.");
3046 /* Go to sleep (much) later */
3047 note = _("は眠り込んでしまった!", " falls asleep!");
3054 note = _("には効果がなかった。", " is unaffected.");
3062 if (seen) obvious = TRUE;
3063 if (genocide_aux(caster_ptr, g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3065 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappeared!"), m_name);
3066 chg_virtue(caster_ptr, V_VITALITY, -1);
3076 msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3078 if (r_ptr->flags3 & (RF3_HURT_LITE))
3080 if (seen) obvious = TRUE;
3082 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3084 note = _("は光に身をすくめた!", " cringes from the light!");
3085 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3092 photo = m_ptr->r_idx;
3095 case GF_BLOOD_CURSE:
3097 if (seen) obvious = TRUE;
3102 bool success = FALSE;
3103 if (seen) obvious = TRUE;
3105 if ((r_ptr->flags3 & (RF3_GOOD)) && !floor_ptr->inside_arena)
3107 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3108 if (dam < 1) dam = 1;
3112 note = _("の動きが速くなった。", " starts moving faster.");
3113 (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3116 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3117 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3118 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3119 (caster_ptr->cursed & TRC_AGGRAVATE) ||
3120 ((r_ptr->level + 10) > randint1(dam)))
3122 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3126 note = _("を支配した。", " is tamed!");
3127 set_pet(caster_ptr, m_ptr);
3128 (void)set_monster_fast(caster_ptr, g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3130 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3137 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3139 do_fear = randint1(90) + 10;
3141 else if (is_original_ap_and_seen(caster_ptr, m_ptr))
3142 r_ptr->r_flags3 |= (RF3_NO_FEAR);
3150 if (seen) obvious = TRUE;
3152 if (randint0(100 + dam) < (r_ptr->level + 50))
3154 note = _("には効果がなかった。", " is unaffected.");
3168 if (skipped) return FALSE;
3170 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3171 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3172 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding))
3175 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !caster_ptr->phase_out)
3177 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3182 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(caster_ptr, V_COMPASSION, -1);
3183 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(caster_ptr, V_HONOUR, -1);
3187 dam = mon_damage_mod(caster_ptr, m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3188 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3190 if (dam > m_ptr->hp)
3197 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3198 !(r_ptr->flags3 & RF3_NO_STUN))
3200 if (seen) obvious = TRUE;
3202 if (MON_STUNNED(m_ptr))
3204 note = _("はひどくもうろうとした。", " is more dazed.");
3205 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3209 note = _("はもうろうとした。", " is dazed.");
3213 (void)set_monster_stunned(caster_ptr, g_ptr->m_idx, tmp);
3218 !(r_ptr->flags3 & RF3_NO_CONF) &&
3219 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3221 if (seen) obvious = TRUE;
3223 if (MON_CONFUSED(m_ptr))
3225 note = _("はさらに混乱したようだ。", " looks more confused.");
3226 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3230 note = _("は混乱したようだ。", " looks confused.");
3234 (void)set_monster_confused(caster_ptr, g_ptr->m_idx, tmp);
3240 if (seen) obvious = TRUE;
3242 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3246 note = _("は弱くなったようだ。", " seems weakened.");
3247 m_ptr->maxhp -= do_time;
3248 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3254 if (do_poly && (randint1(90) > r_ptr->level))
3256 if (polymorph_monster(caster_ptr, y, x))
3258 if (seen) obvious = TRUE;
3260 note = _("が変身した!", " changes!");
3264 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
3265 r_ptr = &r_info[m_ptr->r_idx];
3270 if (seen) obvious = TRUE;
3272 note = _("が消え去った!", " disappears!");
3274 if (!who) chg_virtue(caster_ptr, V_VALOUR, -1);
3276 teleport_away(caster_ptr, g_ptr->m_idx, do_dist,
3277 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3281 g_ptr = &floor_ptr->grid_array[y][x];
3286 (void)set_monster_monfear(caster_ptr, g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3291 if (typ == GF_DRAIN_MANA)
3293 /* Drain mana does nothing */
3296 /* If another monster did the damage, hurt the monster by hand */
3299 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
3300 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
3302 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
3308 if (is_pet(m_ptr) && !(m_ptr->ml))
3313 monster_desc(caster_ptr, m_name, m_ptr, MD_TRUE_NAME);
3316 msg_format("%^s%s", m_name, note);
3320 floor_ptr->monster_noise = TRUE;
3324 if (who > 0) monster_gain_exp(caster_ptr, who, m_ptr->r_idx);
3326 monster_death(caster_ptr, g_ptr->m_idx, FALSE);
3327 delete_monster_idx(caster_ptr, g_ptr->m_idx);
3330 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3335 if (note && seen_msg)
3336 msg_format("%^s%s", m_name, note);
3339 message_pain(caster_ptr, g_ptr->m_idx, dam);
3343 floor_ptr->monster_noise = TRUE;
3346 if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
3349 else if (heal_leper)
3352 msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3354 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3356 char m2_name[MAX_NLEN];
3358 monster_desc(caster_ptr, m2_name, m_ptr, MD_INDEF_VISIBLE);
3359 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3362 delete_monster_idx(caster_ptr, g_ptr->m_idx);
3365 /* If the player did it, give him experience, check fear */
3369 if (mon_take_hit(caster_ptr, g_ptr->m_idx, dam, &fear, note_dies))
3375 if (do_sleep) anger_monster(caster_ptr, m_ptr);
3377 if (note && seen_msg)
3378 msg_format(_("%s%s", "%^s%s"), m_name, note);
3379 else if (known && (dam || !do_fear))
3381 message_pain(caster_ptr, g_ptr->m_idx, dam);
3384 if (((dam > 0) || get_angry) && !do_sleep)
3385 anger_monster(caster_ptr, m_ptr);
3387 if ((fear || do_fear) && seen)
3390 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3393 if (do_sleep) (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, do_sleep);
3397 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3399 blood_curse_to_enemy(caster_ptr, who);
3402 if (caster_ptr->phase_out)
3404 caster_ptr->health_who = g_ptr->m_idx;
3405 caster_ptr->redraw |= (PR_HEALTH);
3406 handle_stuff(caster_ptr);
3409 if (m_ptr->r_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
3411 lite_spot(caster_ptr, y, x);
3412 if ((caster_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3414 caster_ptr->window |= (PW_MONSTER);
3417 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3421 if (!(flg & PROJECT_NO_HANGEKI))
3423 set_target(m_ptr, monster_target_y, monster_target_x);
3426 else if ((who > 0) && is_pet(m_caster_ptr) && !player_bold(caster_ptr, m_ptr->target_y, m_ptr->target_x))
3428 set_target(m_ptr, m_caster_ptr->fy, m_caster_ptr->fx);
3432 if (caster_ptr->riding && (caster_ptr->riding == g_ptr->m_idx) && (dam > 0))
3434 if (m_ptr->hp > m_ptr->maxhp / 3) dam = (dam + 1) / 2;
3435 rakubadam_m = (dam > 200) ? 200 : dam;
3443 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3444 q_ptr->pval = photo;
3445 q_ptr->ident |= (IDENT_FULL_KNOWN);
3446 (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
3457 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3458 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3459 * @param who_name 効果を起こしたモンスターの名前
3460 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3461 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3462 * @param x 目標X座標 / Target x location (or location to travel "towards")
3463 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3464 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3466 * @param monspell 効果元のモンスター魔法ID
3467 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3469 * Handle a beam/bolt/ball causing damage to the player.
3470 * This routine takes a "source monster" (by index), a "distance", a default
3471 * "damage", and a "damage type". See "project_m()" above.
3472 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3473 * is reduced (see "project_m()" above). This can happen if a monster breathes
3474 * at the player and hits a wall instead.
3475 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3476 * to know if this is actually a ball or a bolt spell
3477 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3478 * we just assume that the effects were obvious, for historical reasons.
3480 static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
3484 bool obvious = TRUE;
3485 bool blind = (target_ptr->blind ? TRUE : FALSE);
3487 monster_type *m_ptr = NULL;
3488 GAME_TEXT m_name[MAX_NLEN];
3492 if (!player_bold(target_ptr, y, x)) return FALSE;
3494 if ((target_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (target_ptr->lev * 3 / 5 + 20)) && who && (who != target_ptr->riding))
3496 if (kawarimi(target_ptr, TRUE)) return FALSE;
3499 if (!who) return FALSE;
3500 if (who == target_ptr->riding) return FALSE;
3502 if ((target_ptr->reflect || ((target_ptr->special_defense & KATA_FUUJIN) && !target_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
3505 int max_attempts = 10;
3506 sound(SOUND_REFLECT);
3509 msg_print(_("何かが跳ね返った!", "Something bounces!"));
3510 else if (target_ptr->special_defense & KATA_FUUJIN)
3511 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
3513 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
3519 t_y = target_ptr->current_floor_ptr->m_list[who].fy - 1 + randint1(3);
3520 t_x = target_ptr->current_floor_ptr->m_list[who].fx - 1 + randint1(3);
3522 } while (max_attempts && in_bounds2u(target_ptr->current_floor_ptr, t_y, t_x) && !projectable(target_ptr, target_ptr->y, target_ptr->x, t_y, t_x));
3524 if (max_attempts < 1)
3526 t_y = target_ptr->current_floor_ptr->m_list[who].fy;
3527 t_x = target_ptr->current_floor_ptr->m_list[who].fx;
3532 t_y = target_ptr->y - 1 + randint1(3);
3533 t_x = target_ptr->x - 1 + randint1(3);
3536 project(target_ptr, 0, 0, t_y, t_x, dam, typ, (PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE), monspell);
3538 disturb(target_ptr, TRUE, TRUE);
3542 if (dam > 1600) dam = 1600;
3544 dam = (dam + r) / (r + 1);
3545 if (blind) fuzzy = TRUE;
3549 m_ptr = &target_ptr->current_floor_ptr->m_list[who];
3550 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
3551 monster_desc(target_ptr, m_name, m_ptr, 0);
3552 strcpy(killer, who_name);
3558 case PROJECT_WHO_UNCTRL_POWER:
3559 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
3562 case PROJECT_WHO_GLASS_SHARDS:
3563 strcpy(killer, _("ガラスの破片", "shards of glass"));
3567 strcpy(killer, _("罠", "a trap"));
3570 strcpy(m_name, killer);
3577 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
3578 get_damage = acid_dam(target_ptr, dam, killer, monspell, FALSE);
3583 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
3584 get_damage = fire_dam(target_ptr, dam, killer, monspell, FALSE);
3589 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
3590 get_damage = cold_dam(target_ptr, dam, killer, monspell, FALSE);
3595 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
3596 get_damage = elec_dam(target_ptr, dam, killer, monspell, FALSE);
3601 bool double_resist = is_oppose_pois(target_ptr);
3602 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
3604 if (target_ptr->resist_pois) dam = (dam + 2) / 3;
3605 if (double_resist) dam = (dam + 2) / 3;
3607 if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(target_ptr))
3609 do_dec_stat(target_ptr, A_CON);
3612 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3614 if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
3616 set_poisoned(target_ptr, target_ptr->poisoned + randint0(dam) + 10);
3622 bool double_resist = is_oppose_pois(target_ptr);
3623 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
3625 if (target_ptr->resist_pois) dam = (2 * dam + 2) / 5;
3626 if (double_resist) dam = (2 * dam + 2) / 5;
3627 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3628 if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
3630 set_poisoned(target_ptr, target_ptr->poisoned + randint0(dam) + 10);
3632 if (one_in_(5)) /* 6 */
3634 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
3635 if (one_in_(4)) /* 4 */
3636 do_poly_self(target_ptr);
3638 status_shuffle(target_ptr);
3643 inventory_damage(target_ptr, set_acid_destroy, 2);
3650 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
3651 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3656 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
3657 if (target_ptr->align > 10)
3659 else if (target_ptr->align < -10)
3661 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3666 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
3667 if (target_ptr->align > 10)
3669 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3676 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
3678 else if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
3680 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
3684 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3689 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
3690 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3692 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
3694 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
3695 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
3698 if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || target_ptr->immune_fire))
3700 inventory_damage(target_ptr, set_acid_destroy, 3);
3707 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
3708 if (target_ptr->resist_neth)
3710 if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
3712 dam *= 6; dam /= (randint1(4) + 7);
3715 else if (!CHECK_MULTISHADOW(target_ptr)) drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
3717 if (PRACE_IS_(target_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW(target_ptr))
3719 msg_print(_("気分がよくなった。", "You feel invigorated!"));
3720 hp_player(target_ptr, dam / 4);
3721 learn_spell(target_ptr, monspell);
3725 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3732 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
3733 if (!CHECK_MULTISHADOW(target_ptr))
3735 if (!target_ptr->resist_sound && !target_ptr->resist_water)
3737 set_stun(target_ptr, target_ptr->stun + randint1(40));
3739 if (!target_ptr->resist_conf && !target_ptr->resist_water)
3741 set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
3744 if (one_in_(5) && !target_ptr->resist_water)
3746 inventory_damage(target_ptr, set_cold_destroy, 3);
3749 if (target_ptr->resist_water) get_damage /= 4;
3752 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3757 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
3758 if (target_ptr->resist_chaos)
3760 dam *= 6; dam /= (randint1(4) + 7);
3763 if (!CHECK_MULTISHADOW(target_ptr))
3765 if (!target_ptr->resist_conf)
3767 (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
3769 if (!target_ptr->resist_chaos)
3771 (void)set_image(target_ptr, target_ptr->image + randint1(10));
3774 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
3775 (void)gain_mutation(target_ptr, 0);
3778 if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
3780 drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
3783 if (!target_ptr->resist_chaos || one_in_(9))
3785 inventory_damage(target_ptr, set_elec_destroy, 2);
3786 inventory_damage(target_ptr, set_fire_destroy, 2);
3790 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3795 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
3796 if (target_ptr->resist_shard)
3798 dam *= 6; dam /= (randint1(4) + 7);
3800 else if (!CHECK_MULTISHADOW(target_ptr))
3802 (void)set_cut(target_ptr, target_ptr->cut + dam);
3805 if (!target_ptr->resist_shard || one_in_(13))
3807 inventory_damage(target_ptr, set_cold_destroy, 2);
3810 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3815 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
3816 if (target_ptr->resist_sound)
3818 dam *= 5; dam /= (randint1(4) + 7);
3820 else if (!CHECK_MULTISHADOW(target_ptr))
3822 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
3823 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
3826 if (!target_ptr->resist_sound || one_in_(13))
3828 inventory_damage(target_ptr, set_cold_destroy, 2);
3831 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3836 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
3837 if (target_ptr->resist_conf)
3839 dam *= 5; dam /= (randint1(4) + 7);
3841 else if (!CHECK_MULTISHADOW(target_ptr))
3843 (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
3845 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3850 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
3851 if (target_ptr->resist_disen)
3853 dam *= 6; dam /= (randint1(4) + 7);
3855 else if (!CHECK_MULTISHADOW(target_ptr))
3857 (void)apply_disenchant(target_ptr, 0);
3859 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3864 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
3865 if (target_ptr->resist_nexus)
3867 dam *= 6; dam /= (randint1(4) + 7);
3869 else if (!CHECK_MULTISHADOW(target_ptr))
3871 apply_nexus(m_ptr, target_ptr);
3874 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3879 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
3880 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
3882 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
3885 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3890 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
3891 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
3893 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
3896 if (target_ptr->resist_shard)
3900 else if (!CHECK_MULTISHADOW(target_ptr))
3902 (void)set_cut(target_ptr, target_ptr->cut + (dam / 2));
3905 if (!target_ptr->resist_shard || one_in_(12))
3907 inventory_damage(target_ptr, set_cold_destroy, 3);
3910 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3915 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
3916 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
3917 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3922 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
3923 if (target_ptr->resist_lite)
3925 dam *= 4; dam /= (randint1(4) + 7);
3927 else if (!blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
3929 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
3932 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
3934 if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
3937 else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
3942 if (target_ptr->wraith_form) dam *= 2;
3943 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3945 if (target_ptr->wraith_form && !CHECK_MULTISHADOW(target_ptr))
3947 target_ptr->wraith_form = 0;
3948 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
3949 "The light forces you out of your incorporeal shadow form."));
3951 target_ptr->redraw |= (PR_MAP | PR_STATUS);
3952 target_ptr->update |= (PU_MONSTERS);
3953 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
3960 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
3961 if (target_ptr->resist_dark)
3963 dam *= 4; dam /= (randint1(4) + 7);
3965 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) dam = 0;
3967 else if (!blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
3969 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
3972 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
3977 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
3978 if (target_ptr->resist_time)
3981 dam /= (randint1(4) + 7);
3982 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
3984 else if (!CHECK_MULTISHADOW(target_ptr))
3986 switch (randint1(10))
3988 case 1: case 2: case 3: case 4: case 5:
3990 if (target_ptr->prace == RACE_ANDROID) break;
3991 msg_print(_("人生が逆戻りした気がする。", "You feel like a chunk of the past has been ripped away."));
3992 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
3996 case 6: case 7: case 8: case 9:
3998 switch (randint1(6))
4000 case 1: k = A_STR; act = _("強く", "strong"); break;
4001 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4002 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4003 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4004 case 5: k = A_CON; act = _("健康で", "hale"); break;
4005 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4008 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4009 "You're not as %s as you used to be..."), act);
4011 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
4012 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
4013 target_ptr->update |= (PU_BONUS);
4019 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4020 "You're not as powerful as you used to be..."));
4022 for (k = 0; k < A_MAX; k++)
4024 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
4025 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
4027 target_ptr->update |= (PU_BONUS);
4033 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4038 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4039 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4041 if (!CHECK_MULTISHADOW(target_ptr))
4043 teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
4044 if (!target_ptr->levitation)
4045 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4046 if (!(target_ptr->resist_sound || target_ptr->levitation))
4048 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4049 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
4053 if (target_ptr->levitation)
4055 dam = (dam * 2) / 3;
4058 if (!target_ptr->levitation || one_in_(13))
4060 inventory_damage(target_ptr, set_cold_destroy, 2);
4063 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4066 case GF_DISINTEGRATE:
4068 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4070 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4075 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4077 (void)hp_player(target_ptr, dam);
4083 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4084 (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
4090 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4091 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4096 if (target_ptr->free_act) break;
4097 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4099 if (ironman_nightmare)
4101 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4102 /* Have some nightmares */
4103 sanity_blast(target_ptr, NULL, FALSE);
4106 set_paralyzed(target_ptr, target_ptr->paralyzed + dam);
4114 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4115 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4120 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4121 get_damage = take_hit(target_ptr, DAMAGE_FORCE, dam, killer, monspell);
4126 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4128 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4129 if (!target_ptr->resist_shard || one_in_(13))
4131 if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
4132 inventory_damage(target_ptr, set_cold_destroy, 2);
4139 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4140 get_damage = cold_dam(target_ptr, dam, killer, monspell, FALSE);
4141 if (!CHECK_MULTISHADOW(target_ptr))
4143 if (!target_ptr->resist_shard)
4145 (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
4147 if (!target_ptr->resist_sound)
4149 (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
4152 if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12))
4154 if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
4162 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4164 if (target_ptr->mimic_form)
4166 if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4167 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4172 switch (target_ptr->prace)
4186 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4196 if (CHECK_MULTISHADOW(target_ptr))
4198 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
4200 else if (target_ptr->csp)
4203 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4205 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4207 if (dam >= target_ptr->csp)
4209 dam = target_ptr->csp;
4210 target_ptr->csp = 0;
4211 target_ptr->csp_frac = 0;
4215 target_ptr->csp -= dam;
4218 learn_spell(target_ptr, monspell);
4219 target_ptr->redraw |= (PR_MANA);
4220 target_ptr->window |= (PW_PLAYER | PW_SPELL);
4224 if (m_ptr->hp < m_ptr->maxhp)
4227 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4229 if (target_ptr->health_who == who) target_ptr->redraw |= (PR_HEALTH);
4230 if (target_ptr->riding == who) target_ptr->redraw |= (PR_UHEALTH);
4234 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4245 if ((randint0(100 + rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
4247 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4248 learn_spell(target_ptr, monspell);
4252 if (!CHECK_MULTISHADOW(target_ptr))
4254 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psionic energy."));
4256 if (!target_ptr->resist_conf)
4258 (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
4261 if (!target_ptr->resist_chaos && one_in_(3))
4263 (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
4266 target_ptr->csp -= 50;
4267 if (target_ptr->csp < 0)
4269 target_ptr->csp = 0;
4270 target_ptr->csp_frac = 0;
4272 target_ptr->redraw |= PR_MANA;
4275 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4280 case GF_BRAIN_SMASH:
4282 if ((randint0(100 + rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
4284 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4285 learn_spell(target_ptr, monspell);
4289 if (!CHECK_MULTISHADOW(target_ptr))
4291 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psionic energy."));
4293 target_ptr->csp -= 100;
4294 if (target_ptr->csp < 0)
4296 target_ptr->csp = 0;
4297 target_ptr->csp_frac = 0;
4299 target_ptr->redraw |= PR_MANA;
4302 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4303 if (!CHECK_MULTISHADOW(target_ptr))
4305 if (!target_ptr->resist_blind)
4307 (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
4309 if (!target_ptr->resist_conf)
4311 (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
4313 if (!target_ptr->free_act)
4315 (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
4317 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4319 while (randint0(100 + rlev / 2) > (MAX(5, target_ptr->skill_sav)))
4320 (void)do_dec_stat(target_ptr, A_INT);
4321 while (randint0(100 + rlev / 2) > (MAX(5, target_ptr->skill_sav)))
4322 (void)do_dec_stat(target_ptr, A_WIS);
4324 if (!target_ptr->resist_chaos)
4326 (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
4334 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4336 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4337 learn_spell(target_ptr, monspell);
4341 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 15, 0);
4342 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4348 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4350 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4351 learn_spell(target_ptr, monspell);
4355 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 25, MIN(rlev / 2 - 15, 5));
4356 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4362 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4364 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4365 learn_spell(target_ptr, monspell);
4369 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(target_ptr, 33, MIN(rlev / 2 - 15, 15));
4370 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4376 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
4378 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
4379 learn_spell(target_ptr, monspell);
4383 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4384 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
4390 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4392 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4393 learn_spell(target_ptr, monspell);
4397 if (!CHECK_MULTISHADOW(target_ptr))
4399 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
4400 curse_equipment(target_ptr, 40, 20);
4403 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, m_name, monspell);
4405 if (target_ptr->chp < 1) target_ptr->chp = 1;
4416 revenge_store(target_ptr, get_damage);
4417 if ((target_ptr->tim_eyeeye || hex_spelling(target_ptr, HEX_EYE_FOR_EYE))
4418 && (get_damage > 0) && !target_ptr->is_dead && (who > 0))
4420 GAME_TEXT m_name_self[80];
4421 monster_desc(target_ptr, m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
4422 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
4423 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
4424 if (target_ptr->tim_eyeeye) set_tim_eyeeye(target_ptr, target_ptr->tim_eyeeye - 5, TRUE);
4427 if (target_ptr->riding && dam > 0)
4429 rakubadam_p = (dam > 200) ? 200 : dam;
4432 disturb(target_ptr, TRUE, TRUE);
4433 if ((target_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != target_ptr->riding))
4435 (void)kawarimi(target_ptr, FALSE);
4443 * Find the distance from (x, y) to a line.
4445 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4447 POSITION py = y1 - y;
4448 POSITION px = x1 - x;
4449 POSITION ny = x2 - x1;
4450 POSITION nx = y1 - y2;
4451 POSITION pd = distance(y1, x1, y, x);
4452 POSITION nd = distance(y1, x1, y2, x2);
4454 if (pd > nd) return distance(y, x, y2, x2);
4456 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
4457 return((nd >= 0) ? nd : 0 - nd);
4463 * Modified version of los() for calculation of disintegration balls.
4464 * Disintegration effects are stopped by permanent walls.
4466 bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
4468 POSITION delta_y = y2 - y1;
4469 POSITION delta_x = x2 - x1;
4470 POSITION absolute_y = ABS(delta_y);
4471 POSITION absolute_x = ABS(delta_x);
4472 if ((absolute_x < 2) && (absolute_y < 2)) return TRUE;
4477 /* South -- check for walls */
4480 for (scanner_y = y1 + 1; scanner_y < y2; scanner_y++)
4482 if (cave_stop_disintegration(floor_ptr, scanner_y, x1)) return FALSE;
4486 /* North -- check for walls */
4489 for (scanner_y = y1 - 1; scanner_y > y2; scanner_y--)
4491 if (cave_stop_disintegration(floor_ptr, scanner_y, x1)) return FALSE;
4498 /* Directly East/West */
4502 /* East -- check for walls */
4505 for (scanner_x = x1 + 1; scanner_x < x2; scanner_x++)
4507 if (cave_stop_disintegration(floor_ptr, y1, scanner_x)) return FALSE;
4511 /* West -- check for walls */
4514 for (scanner_x = x1 - 1; scanner_x > x2; scanner_x--)
4516 if (cave_stop_disintegration(floor_ptr, y1, scanner_x)) return FALSE;
4523 POSITION sign_x = (delta_x < 0) ? -1 : 1;
4524 POSITION sign_y = (delta_y < 0) ? -1 : 1;
4525 if (absolute_x == 1)
4527 if (absolute_y == 2)
4529 if (!cave_stop_disintegration(floor_ptr, y1 + sign_y, x1)) return TRUE;
4532 else if (absolute_y == 1)
4534 if (absolute_x == 2)
4536 if (!cave_stop_disintegration(floor_ptr, y1, x1 + sign_x)) return TRUE;
4540 POSITION scale_factor_2 = (absolute_x * absolute_y);
4541 POSITION scale_factor_1 = scale_factor_2 << 1;
4542 POSITION fraction_y;
4543 POSITION m; /* Slope, or 1/Slope, of LOS */
4544 if (absolute_x >= absolute_y)
4546 fraction_y = absolute_y * absolute_y;
4547 m = fraction_y << 1;
4548 scanner_x = x1 + sign_x;
4549 if (fraction_y == scale_factor_2)
4551 scanner_y = y1 + sign_y;
4552 fraction_y -= scale_factor_1;
4559 /* Note (below) the case (qy == f2), where */
4560 /* the LOS exactly meets the corner of a tile. */
4561 while (x2 - scanner_x)
4563 if (cave_stop_disintegration(floor_ptr, scanner_y, scanner_x)) return FALSE;
4567 if (fraction_y < scale_factor_2)
4569 scanner_x += sign_x;
4571 else if (fraction_y > scale_factor_2)
4573 scanner_y += sign_y;
4574 if (cave_stop_disintegration(floor_ptr, scanner_y, scanner_x)) return FALSE;
4575 fraction_y -= scale_factor_1;
4576 scanner_x += sign_x;
4580 scanner_y += sign_y;
4581 fraction_y -= scale_factor_1;
4582 scanner_x += sign_x;
4589 POSITION fraction_x = absolute_x * absolute_x;
4590 m = fraction_x << 1;
4591 scanner_y = y1 + sign_y;
4592 if (fraction_x == scale_factor_2)
4594 scanner_x = x1 + sign_x;
4595 fraction_x -= scale_factor_1;
4602 /* Note (below) the case (qx == f2), where */
4603 /* the LOS exactly meets the corner of a tile. */
4604 while (y2 - scanner_y)
4606 if (cave_stop_disintegration(floor_ptr, scanner_y, scanner_x)) return FALSE;
4610 if (fraction_x < scale_factor_2)
4612 scanner_y += sign_y;
4614 else if (fraction_x > scale_factor_2)
4616 scanner_x += sign_x;
4617 if (cave_stop_disintegration(floor_ptr, scanner_y, scanner_x)) return FALSE;
4618 fraction_x -= scale_factor_1;
4619 scanner_y += sign_y;
4623 scanner_x += sign_x;
4624 fraction_x -= scale_factor_1;
4625 scanner_y += sign_y;
4636 void breath_shape(player_type *caster_ptr, 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)
4641 int brev = rad * rad / dist;
4645 int mdis = distance(y1, x1, y2, x2) + rad;
4647 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
4648 while (bdis <= mdis)
4652 if ((0 < dist) && (path_n < dist))
4654 POSITION ny = GRID_Y(path_g[path_n]);
4655 POSITION nx = GRID_X(path_g[path_n]);
4656 POSITION nd = distance(ny, nx, y1, x1);
4666 /* Travel from center outward */
4667 for (cdis = 0; cdis <= brad; cdis++)
4669 for (y = by - cdis; y <= by + cdis; y++)
4671 for (x = bx - cdis; x <= bx + cdis; x++)
4673 if (!in_bounds(floor_ptr, y, x)) continue;
4674 if (distance(y1, x1, y, x) != bdis) continue;
4675 if (distance(by, bx, y, x) != cdis) continue;
4681 /* Lights are stopped by opaque terrains */
4682 if (!los(caster_ptr, by, bx, y, x)) continue;
4684 case GF_DISINTEGRATE:
4685 /* Disintegration are stopped only by perma-walls */
4686 if (!in_disintegration_range(floor_ptr, by, bx, y, x)) continue;
4689 /* Ball explosions are stopped by walls */
4690 if (!projectable(caster_ptr, by, bx, y, x)) continue;
4701 gm[bdis + 1] = *pgrids;
4702 brad = rad * (path_n + brev) / (dist + brev);
4711 * todo 似たような処理が山ほど並んでいる、何とかならないものか
4712 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
4713 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4714 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4715 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4716 * @param x 目標X座標 / Target x location (or location to travel "towards")
4717 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4718 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4719 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx)
4720 * @param monspell 効果元のモンスター魔法ID
4721 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4724 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
4725 * towards a given location (optionally passing over the heads of interposing
4726 * monsters), and have it do a given amount of damage to the monsters (and
4727 * optionally objects) within the given radius of the final location.
4729 * A "bolt" travels from source to target and affects only the target grid.
4730 * A "beam" travels from source to target, affecting all grids passed through.
4731 * A "ball" travels from source to the target, exploding at the target, and
4732 * affecting everything within the given radius of the target location.
4734 * Traditionally, a "bolt" does not affect anything on the ground, and does
4735 * not pass over the heads of interposing monsters, much like a traditional
4736 * missile, and will "stop" abruptly at the "target" even if no monster is
4737 * positioned there, while a "ball", on the other hand, passes over the heads
4738 * of monsters between the source and target, and affects everything except
4739 * the source monster which lies within the final radius, while a "beam"
4740 * affects every monster between the source and target, except for the casting
4741 * monster (or player), and rarely affects things on the ground.
4743 * Two special flags allow us to use this function in special ways, the
4744 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
4745 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
4746 * actually projecting from the source monster (or player).
4748 * The player will only get "experience" for monsters killed by himself
4749 * Unique monsters can only be destroyed by attacks from the player
4751 * Only 256 grids can be affected per projection, limiting the effective
4752 * "radius" of standard ball attacks to nine units (diameter nineteen).
4754 * One can project in a given "direction" by combining PROJECT_THRU with small
4755 * offsets to the initial location (see "line_spell()"), or by calculating
4756 * "virtual targets" far away from the player.
4758 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
4759 * continuing until it actually hits somethings (useful for "stone to mud").
4761 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
4763 * Balls must explode BEFORE hitting walls, or they would affect monsters
4764 * on both sides of a wall. Some bug reports indicate that this is still
4765 * happening in 2.7.8 for Windows, though it appears to be impossible.
4767 * We "pre-calculate" the blast area only in part for efficiency.
4768 * More importantly, this lets us do "explosions" from the "inside" out.
4769 * This results in a more logical distribution of "blast" treasure.
4770 * It also produces a better (in my opinion) animation of the explosion.
4771 * It could be (but is not) used to have the treasure dropped by monsters
4772 * in the middle of the explosion fall "outwards", and then be damaged by
4773 * the blast as it spreads outwards towards the treasure drop location.
4775 * Walls and doors are included in the blast area, so that they can be
4776 * "burned" or "melted" in later versions.
4778 * This algorithm is intended to maximize simplicity, not necessarily
4779 * efficiency, since this function is not a bottleneck in the code.
4781 * We apply the blast effect from ground zero outwards, in several passes,
4782 * first affecting features, then objects, then monsters, then the player.
4783 * This allows walls to be removed before checking the object or monster
4784 * in the wall, and protects objects which are dropped by monsters killed
4785 * in the blast, and allows the player to see all affects before he is
4786 * killed or teleported away. The semantics of this method are open to
4787 * various interpretations, but they seem to work well in practice.
4789 * We process the blast area from ground-zero outwards to allow for better
4790 * distribution of treasure dropped by monsters, and because it provides a
4791 * pleasing visual effect at low cost.
4793 * Note that the damage done by "ball" explosions decreases with distance.
4794 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
4796 * Notice the "napalm" effect of "beam" weapons. First they "project" to
4797 * the target, and then the damage "flows" along this beam of destruction.
4798 * The damage at every grid is the same as at the "center" of a "ball"
4799 * explosion, since the "beam" grids are treated as if they ARE at the
4800 * center of a "ball" explosion.
4802 * Currently, specifying "beam" plus "ball" means that locations which are
4803 * covered by the initial "beam", and also covered by the final "ball", except
4804 * for the final grid (the epicenter of the ball), will be "hit twice", once
4805 * by the initial beam, and once by the exploding ball. For the grid right
4806 * next to the epicenter, this results in 150% damage being done. The center
4807 * does not have this problem, for the same reason the final grid in a "beam"
4808 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
4809 * grids which are covered by the "ball" will NOT work, as then they will
4810 * receive LESS damage than they should. Do not combine "beam" with "ball".
4812 * The array "gy[],gx[]" with current size "grids" is used to hold the
4813 * collected locations of all grids in the "blast area" plus "beam path".
4815 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
4816 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
4817 * first blast grid (see above) with radius "N" from the blast center. Note
4818 * that only the first gm[1] grids in the blast area thus take full damage.
4819 * Also, note that gm[rad+1] is always equal to "grids", which is the total
4820 * number of blast grids.
4822 * Note that once the projection is complete, (y2,x2) holds the final location
4823 * of bolts/beams, and the "epicenter" of balls.
4825 * Note also that "rad" specifies the "inclusive" radius of projection blast,
4826 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
4827 * implementation of the "distance" function. Also, a bolt can be properly
4828 * viewed as a "ball" with a "rad" of "zero".
4830 * Note that if no "target" is reached before the beam/bolt/ball travels the
4831 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
4832 * may be relevant even for bolts, since they have a "1x1" mini-blast.
4834 * Note that for consistency, we "pretend" that the bolt actually takes "time"
4835 * to move from point A to point B, even if the player cannot see part of the
4836 * projection path. Note that in general, the player will *always* see part
4837 * of the path, since it either starts at the player or ends on the player.
4839 * Hack -- we assume that every "projection" is "self-illuminating".
4841 * Hack -- when only a single monster is affected, we automatically track
4842 * (and recall) that monster, unless "PROJECT_JUMP" is used.
4844 * Note that all projections now "explode" at their final destination, even
4845 * if they were being projected at a more distant destination. This means
4846 * that "ball" spells will *always* explode.
4848 * Note that we must call "handle_stuff()" after affecting terrain features
4849 * in the blast radius, in case the "illumination" of the grid was changed,
4850 * and "update_view()" and "update_monsters()" need to be called.
4853 bool project(player_type *caster_ptr, MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
4860 POSITION y_saver, x_saver; /* For reflecting monsters */
4861 int msec = delay_factor * delay_factor * delay_factor;
4862 bool notice = FALSE;
4863 bool visual = FALSE;
4865 bool breath = FALSE;
4866 bool blind = caster_ptr->blind != 0;
4867 bool old_hide = FALSE;
4871 POSITION gx[1024], gy[1024];
4873 POSITION gm_rad = rad;
4875 GAME_TEXT who_name[MAX_NLEN];
4876 bool see_s_msg = TRUE;
4880 monster_target_y = caster_ptr->y;
4881 monster_target_x = caster_ptr->x;
4883 if (flg & (PROJECT_JUMP))
4887 flg &= ~(PROJECT_JUMP);
4897 x1 = caster_ptr->current_floor_ptr->m_list[who].fx;
4898 y1 = caster_ptr->current_floor_ptr->m_list[who].fy;
4899 monster_desc(caster_ptr, who_name, &caster_ptr->current_floor_ptr->m_list[who], MD_WRONGDOER_NAME);
4912 if (flg & (PROJECT_THRU))
4914 if ((x1 == x2) && (y1 == y2))
4916 flg &= ~(PROJECT_THRU);
4924 if (flg & PROJECT_HIDE) old_hide = TRUE;
4925 flg |= PROJECT_HIDE;
4928 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
4933 if (flg & (PROJECT_BEAM))
4944 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
4946 case GF_DISINTEGRATE:
4947 flg |= (PROJECT_GRID);
4948 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
4952 /* Calculate the projection path */
4953 path_n = project_path(caster_ptr, path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
4954 handle_stuff(caster_ptr);
4956 if (typ == GF_SEEKER)
4963 for (i = 0; i < path_n; ++i)
4967 POSITION ny = GRID_Y(path_g[i]);
4968 POSITION nx = GRID_X(path_g[i]);
4975 if (!blind && !(flg & (PROJECT_HIDE)))
4977 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
4981 u16b p = bolt_pict(oy, ox, y, x, typ);
4984 print_rel(caster_ptr, c, a, y, x);
4985 move_cursor_relative(y, x);
4987 Term_xtra(TERM_XTRA_DELAY, msec);
4988 lite_spot(caster_ptr, y, x);
4990 if (flg & (PROJECT_BEAM))
4992 p = bolt_pict(y, x, y, x, typ);
4995 print_rel(caster_ptr, c, a, y, x);
5002 Term_xtra(TERM_XTRA_DELAY, msec);
5006 if (project_o(caster_ptr, 0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5007 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
5009 monster_target_y = y;
5010 monster_target_x = x;
5011 remove_mirror(caster_ptr, y, x);
5012 next_mirror(caster_ptr, &oy, &ox, y, x);
5013 path_n = i + project_path(caster_ptr, &(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5014 for (j = last_i; j <= i; j++)
5016 y = GRID_Y(path_g[j]);
5017 x = GRID_X(path_g[j]);
5018 if (project_m(caster_ptr, 0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5019 if (!who && (project_m_n == 1) && !jump) {
5020 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5022 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5026 if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
5027 health_track(caster_ptr, caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5032 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_SEEKER);
5039 for (i = last_i; i < path_n; i++)
5042 py = GRID_Y(path_g[i]);
5043 px = GRID_X(path_g[i]);
5044 if (project_m(caster_ptr, 0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5046 if (!who && (project_m_n == 1) && !jump) {
5047 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5049 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5053 if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
5054 health_track(caster_ptr, caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5059 (void)project_f(caster_ptr, 0, 0, py, px, dam, GF_SEEKER);
5064 else if (typ == GF_SUPER_RAY)
5067 int second_step = 0;
5071 for (i = 0; i < path_n; ++i)
5075 POSITION ny = GRID_Y(path_g[i]);
5076 POSITION nx = GRID_X(path_g[i]);
5083 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5088 p = bolt_pict(oy, ox, y, x, typ);
5091 print_rel(caster_ptr, c, a, y, x);
5092 move_cursor_relative(y, x);
5094 Term_xtra(TERM_XTRA_DELAY, msec);
5095 lite_spot(caster_ptr, y, x);
5097 if (flg & (PROJECT_BEAM))
5099 p = bolt_pict(y, x, y, x, typ);
5102 print_rel(caster_ptr, c, a, y, x);
5109 Term_xtra(TERM_XTRA_DELAY, msec);
5113 if (project_o(caster_ptr, 0, 0, y, x, dam, GF_SUPER_RAY))notice = TRUE;
5114 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT))
5116 if (second_step)continue;
5120 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) && !second_step)
5122 monster_target_y = y;
5123 monster_target_x = x;
5124 remove_mirror(caster_ptr, y, x);
5125 for (j = 0; j <= i; j++)
5127 y = GRID_Y(path_g[j]);
5128 x = GRID_X(path_g[j]);
5129 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_SUPER_RAY);
5133 second_step = i + 1;
5134 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x - 1, flg);
5135 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x, flg);
5136 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x + 1, flg);
5137 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x - 1, flg);
5138 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x + 1, flg);
5139 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x - 1, flg);
5140 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x, flg);
5141 path_n += project_path(caster_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x + 1, flg);
5145 for (i = 0; i < path_n; i++)
5147 POSITION py = GRID_Y(path_g[i]);
5148 POSITION px = GRID_X(path_g[i]);
5149 (void)project_m(caster_ptr, 0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5150 if (!who && (project_m_n == 1) && !jump) {
5151 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5152 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5156 if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
5157 health_track(caster_ptr, caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5162 (void)project_f(caster_ptr, 0, 0, py, px, dam, GF_SUPER_RAY);
5168 for (i = 0; i < path_n; ++i)
5172 POSITION ny = GRID_Y(path_g[i]);
5173 POSITION nx = GRID_X(path_g[i]);
5174 if (flg & PROJECT_DISI)
5176 if (cave_stop_disintegration(caster_ptr->current_floor_ptr, ny, nx) && (rad > 0)) break;
5178 else if (flg & PROJECT_LOS)
5180 if (!cave_los_bold(caster_ptr->current_floor_ptr, ny, nx) && (rad > 0)) break;
5184 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT) && (rad > 0)) break;
5189 if (flg & (PROJECT_BEAM))
5196 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
5198 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5203 p = bolt_pict(oy, ox, y, x, typ);
5206 print_rel(caster_ptr, c, a, y, x);
5207 move_cursor_relative(y, x);
5209 Term_xtra(TERM_XTRA_DELAY, msec);
5210 lite_spot(caster_ptr, y, x);
5212 if (flg & (PROJECT_BEAM))
5214 p = bolt_pict(y, x, y, x, typ);
5217 print_rel(caster_ptr, c, a, y, x);
5224 Term_xtra(TERM_XTRA_DELAY, msec);
5232 if (breath && !path_n)
5238 flg &= ~(PROJECT_HIDE);
5248 /* If we found a "target", explode there */
5249 if (dist <= MAX_RANGE)
5251 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
5254 * Create a conical breath attack
5264 flg &= ~(PROJECT_HIDE);
5265 breath_shape(caster_ptr, path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
5269 for (dist = 0; dist <= rad; dist++)
5271 for (y = by - dist; y <= by + dist; y++)
5273 for (x = bx - dist; x <= bx + dist; x++)
5275 if (!in_bounds2(caster_ptr->current_floor_ptr, y, x)) continue;
5276 if (distance(by, bx, y, x) != dist) continue;
5282 if (!los(caster_ptr, by, bx, y, x)) continue;
5284 case GF_DISINTEGRATE:
5285 if (!in_disintegration_range(caster_ptr->current_floor_ptr, by, bx, y, x)) continue;
5288 if (!projectable(caster_ptr, by, bx, y, x)) continue;
5298 gm[dist + 1] = grids;
5303 if (!grids) return FALSE;
5305 if (!blind && !(flg & (PROJECT_HIDE)))
5307 for (t = 0; t <= gm_rad; t++)
5309 for (i = gm[t]; i < gm[t + 1]; i++)
5313 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5319 p = bolt_pict(y, x, y, x, typ);
5322 print_rel(caster_ptr, c, a, y, x);
5326 move_cursor_relative(by, bx);
5328 if (visual || drawn)
5330 Term_xtra(TERM_XTRA_DELAY, msec);
5336 for (i = 0; i < grids; i++)
5340 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5342 lite_spot(caster_ptr, y, x);
5346 move_cursor_relative(by, bx);
5351 update_creature(caster_ptr);
5353 if (flg & PROJECT_KILL)
5355 see_s_msg = (who > 0) ? is_seen(&caster_ptr->current_floor_ptr->m_list[who]) :
5356 (!who ? TRUE : (player_can_see_bold(caster_ptr, y1, x1) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y1, x1)));
5359 if (flg & (PROJECT_GRID))
5362 for (i = 0; i < grids; i++)
5364 if (gm[dist + 1] == i) dist++;
5369 int d = dist_to_line(y, x, y1, x1, by, bx);
5370 if (project_f(caster_ptr, who, d, y, x, dam, typ)) notice = TRUE;
5374 if (project_f(caster_ptr, who, dist, y, x, dam, typ)) notice = TRUE;
5379 update_creature(caster_ptr);
5380 if (flg & (PROJECT_ITEM))
5383 for (i = 0; i < grids; i++)
5385 if (gm[dist + 1] == i) dist++;
5391 int d = dist_to_line(y, x, y1, x1, by, bx);
5392 if (project_o(caster_ptr, who, d, y, x, dam, typ)) notice = TRUE;
5396 if (project_o(caster_ptr, who, dist, y, x, dam, typ)) notice = TRUE;
5401 if (flg & (PROJECT_KILL))
5407 for (i = 0; i < grids; i++)
5410 if (gm[dist + 1] == i) dist++;
5416 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[y][x].m_idx];
5417 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
5418 if ((flg & PROJECT_REFLECTABLE) && caster_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
5419 ((caster_ptr->current_floor_ptr->grid_array[y][x].m_idx != caster_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
5420 (!who || dist_hack > 1) && !one_in_(10))
5423 int max_attempts = 10;
5426 t_y = y_saver - 1 + randint1(3);
5427 t_x = x_saver - 1 + randint1(3);
5429 } while (max_attempts && in_bounds2u(caster_ptr->current_floor_ptr, t_y, t_x) && !projectable(caster_ptr, y, x, t_y, t_x));
5431 if (max_attempts < 1)
5437 sound(SOUND_REFLECT);
5440 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
5441 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
5442 else if (m_ptr->r_idx == MON_DIO)
5443 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
5445 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
5448 if (is_original_ap_and_seen(caster_ptr, m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
5450 if (player_bold(caster_ptr, y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
5451 else flg |= PROJECT_PLAYER;
5453 project(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
5458 /* Find the closest point in the blast */
5461 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
5465 effective_dist = dist;
5468 if (caster_ptr->riding && player_bold(caster_ptr, y, x))
5470 if (flg & PROJECT_PLAYER)
5472 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
5475 * A beam or bolt is well aimed
5477 * So don't affects the mount.
5484 * The spell is not well aimed,
5485 * So partly affect the mount too.
5492 * This grid is the original target.
5493 * Or aimed on your horse.
5495 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
5497 /* Hit the mount with full damage */
5501 * Otherwise this grid is not the
5502 * original target, it means that line
5503 * of fire is obstructed by this
5507 * A beam or bolt will hit either
5508 * player or mount. Choose randomly.
5510 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
5514 /* Hit the mount with full damage */
5518 flg |= PROJECT_PLAYER;
5524 * The spell is not well aimed, so
5525 * partly affect both player and
5534 if (project_m(caster_ptr, who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
5537 /* Player affected one monster (without "jumping") */
5538 if (!who && (project_m_n == 1) && !jump)
5542 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0)
5544 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[y][x].m_idx];
5548 if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
5549 health_track(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].m_idx);
5555 if (flg & (PROJECT_KILL))
5558 for (i = 0; i < grids; i++)
5561 if (gm[dist + 1] == i) dist++;
5565 if (!player_bold(caster_ptr, y, x)) continue;
5567 /* Find the closest point in the blast */
5570 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
5574 effective_dist = dist;
5577 if (caster_ptr->riding)
5579 if (flg & PROJECT_PLAYER)
5581 /* Hit the player with full damage */
5585 * Hack -- When this grid was not the
5586 * original target, a beam or bolt
5587 * would hit either player or mount,
5588 * and should be choosen randomly.
5590 * But already choosen to hit the
5591 * mount at this point.
5593 * Or aimed on your horse.
5595 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
5598 * A beam or bolt is well aimed
5600 * So don't affects the player.
5607 * The spell is not well aimed,
5608 * So partly affect the player too.
5614 if (project_p(who, caster_ptr, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
5618 if (caster_ptr->riding)
5620 GAME_TEXT m_name[MAX_NLEN];
5621 monster_desc(caster_ptr, m_name, &caster_ptr->current_floor_ptr->m_list[caster_ptr->riding], 0);
5622 if (rakubadam_m > 0)
5624 if (rakuba(caster_ptr, rakubadam_m, FALSE))
5626 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
5630 if (caster_ptr->riding && rakubadam_p > 0)
5632 if (rakuba(caster_ptr, rakubadam_p, FALSE))
5634 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
5644 * @brief 鏡魔法「封魔結界」の効果処理
5646 * @return 効果があったらTRUEを返す
5648 bool binding_field(player_type *caster_ptr, HIT_POINT dam)
5650 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
5651 int mirror_num = 0; /* 鏡の数 */
5653 POSITION centersign;
5654 POSITION x1, x2, y1, y2;
5656 int msec = delay_factor * delay_factor*delay_factor;
5659 POSITION point_x[3];
5660 POSITION point_y[3];
5662 /* Default target of monsterspell is player */
5663 monster_target_y = caster_ptr->y;
5664 monster_target_x = caster_ptr->x;
5666 for (x = 0; x < caster_ptr->current_floor_ptr->width; x++)
5668 for (y = 0; y < caster_ptr->current_floor_ptr->height; y++)
5670 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) &&
5671 distance(caster_ptr->y, caster_ptr->x, y, x) <= MAX_RANGE &&
5672 distance(caster_ptr->y, caster_ptr->x, y, x) != 0 &&
5673 player_has_los_bold(caster_ptr, y, x) &&
5674 projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
5676 mirror_y[mirror_num] = y;
5677 mirror_x[mirror_num] = x;
5683 if (mirror_num < 2)return FALSE;
5685 point_x[0] = randint0(mirror_num);
5687 point_x[1] = randint0(mirror_num);
5688 } while (point_x[0] == point_x[1]);
5690 point_y[0] = mirror_y[point_x[0]];
5691 point_x[0] = mirror_x[point_x[0]];
5692 point_y[1] = mirror_y[point_x[1]];
5693 point_x[1] = mirror_x[point_x[1]];
5694 point_y[2] = caster_ptr->y;
5695 point_x[2] = caster_ptr->x;
5697 x = point_x[0] + point_x[1] + point_x[2];
5698 y = point_y[0] + point_y[1] + point_y[2];
5700 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
5701 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
5702 if (centersign == 0)return FALSE;
5704 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
5705 x1 = x1 < point_x[2] ? x1 : point_x[2];
5706 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
5707 y1 = y1 < point_y[2] ? y1 : point_y[2];
5709 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
5710 x2 = x2 > point_x[2] ? x2 : point_x[2];
5711 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
5712 y2 = y2 > point_y[2] ? y2 : point_y[2];
5714 for (y = y1; y <= y2; y++)
5716 for (x = x1; x <= x2; x++)
5718 if (centersign*((point_x[0] - x)*(point_y[1] - y)
5719 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
5720 centersign*((point_x[1] - x)*(point_y[2] - y)
5721 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
5722 centersign*((point_x[2] - x)*(point_y[0] - y)
5723 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
5725 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
5727 if (!(caster_ptr->blind)
5728 && panel_contains(y, x))
5730 p = bolt_pict(y, x, y, x, GF_MANA);
5731 print_rel(caster_ptr, PICT_C(p), PICT_A(p), y, x);
5732 move_cursor_relative(y, x);
5734 Term_xtra(TERM_XTRA_DELAY, msec);
5741 for (y = y1; y <= y2; y++)
5743 for (x = x1; x <= x2; x++)
5745 if (centersign*((point_x[0] - x)*(point_y[1] - y)
5746 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
5747 centersign*((point_x[1] - x)*(point_y[2] - y)
5748 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
5749 centersign*((point_x[2] - x)*(point_y[0] - y)
5750 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
5752 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
5754 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_MANA);
5760 for (y = y1; y <= y2; y++)
5762 for (x = x1; x <= x2; x++)
5764 if (centersign*((point_x[0] - x)*(point_y[1] - y)
5765 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
5766 centersign*((point_x[1] - x)*(point_y[2] - y)
5767 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
5768 centersign*((point_x[2] - x)*(point_y[0] - y)
5769 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
5771 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
5773 (void)project_o(caster_ptr, 0, 0, y, x, dam, GF_MANA);
5779 for (y = y1; y <= y2; y++)
5781 for (x = x1; x <= x2; x++)
5783 if (centersign*((point_x[0] - x)*(point_y[1] - y)
5784 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
5785 centersign*((point_x[1] - x)*(point_y[2] - y)
5786 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
5787 centersign*((point_x[2] - x)*(point_y[0] - y)
5788 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
5790 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
5792 (void)project_m(caster_ptr, 0, 0, y, x, dam, GF_MANA,
5793 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
5801 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
5802 remove_mirror(caster_ptr, point_y[0], point_x[0]);
5810 * @brief 鏡魔法「鏡の封印」の効果処理
5812 * @return 効果があったらTRUEを返す
5814 void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam)
5816 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
5818 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
5820 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
5823 if (!project_m(caster_ptr, 0, 0, y, x, dam, GF_GENOCIDE,
5824 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
5827 if (!caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
5829 remove_mirror(caster_ptr, y, x);
5837 * @brief 領域魔法に応じて技能の名称を返す。
5838 * @param tval 魔法書のtval
5839 * @return 領域魔法の技能名称を保管した文字列ポインタ
5841 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
5845 case TV_HISSATSU_BOOK:
5846 return _("必殺技", "art");
5848 return _("祈り", "prayer");
5850 return _("歌", "song");
5852 return _("呪文", "spell");